袁野 1 month ago
parent 87fb375349
commit 16811aca02
  1. 101
      bweb/src/main/java/com/hfkj/controller/cornucopia/CornucopiaController.java
  2. 69
      bweb/src/main/java/com/hfkj/controller/order/BsOrderController.java
  3. 26
      cweb/src/main/java/com/hfkj/controller/ClientController.java
  4. 35
      cweb/src/main/java/com/hfkj/controller/GoodsController.java
  5. 91
      cweb/src/main/java/com/hfkj/controller/cornucopia/CornucopiaController.java
  6. 106
      cweb/src/main/java/com/hfkj/controller/order/BsOrderController.java
  7. 68
      service/src/main/java/com/hfkj/service/cornucopia/BsCornucopiaConfigService.java
  8. 57
      service/src/main/java/com/hfkj/service/cornucopia/BsCornucopiaLotteryRecordService.java
  9. 90
      service/src/main/java/com/hfkj/service/cornucopia/BsCornucopiaPoolService.java
  10. 84
      service/src/main/java/com/hfkj/service/cornucopia/Impl/BsCornucopiaConfigServiceImpl.java
  11. 67
      service/src/main/java/com/hfkj/service/cornucopia/Impl/BsCornucopiaLotteryRecordServiceImpl.java
  12. 157
      service/src/main/java/com/hfkj/service/cornucopia/Impl/BsCornucopiaPoolServiceImpl.java
  13. 9
      service/src/main/java/com/hfkj/service/goods/impl/GoodsDataServiceImpl.java
  14. 13
      service/src/main/java/com/hfkj/service/order/BsOrderService.java
  15. 42
      service/src/main/java/com/hfkj/service/order/Impl/BsOrderServiceImpl.java
  16. 19
      service/src/main/java/com/hfkj/service/order/OrderBusinessService.java
  17. 7
      service/src/main/java/com/hfkj/service/pdd/PddService.java
  18. 4
      service/src/main/java/com/hfkj/sysenum/user/UserAccountRecordSourceTypeEnum.java

@ -0,0 +1,101 @@
package com.hfkj.controller.cornucopia;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.SessionObject;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.controller.order.BsOrderController;
import com.hfkj.entity.BsCornucopiaConfig;
import com.hfkj.entity.BsCornucopiaPool;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.cornucopia.BsCornucopiaConfigService;
import com.hfkj.service.cornucopia.BsCornucopiaLotteryRecordService;
import com.hfkj.service.cornucopia.BsCornucopiaPoolService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value="/cornucopia")
@Api(value="聚宝盆管理")
public class CornucopiaController {
private static final Logger log = LoggerFactory.getLogger(CornucopiaController.class);
@Resource
private BsCornucopiaConfigService cornucopiaConfigService;
@Resource
private BsCornucopiaPoolService cornucopiaPoolService;
@Resource
private BsCornucopiaLotteryRecordService cornucopiaLotteryRecordService;
@RequestMapping(value="/editCornucopiaConfig",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "编辑聚宝盆开奖配置内容")
public ResponseData editCornucopiaConfig(@RequestBody BsCornucopiaConfig body, HttpServletRequest request) {
try {
if (body == null
|| body.getType() == null
|| body.getName() == null
|| body.getProportion() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询是否存在当前开奖内容
BsCornucopiaConfig cornucopiaConfig = cornucopiaConfigService.queryDetail(body.getType());
if (cornucopiaConfig == null) {
cornucopiaConfig = new BsCornucopiaConfig();
cornucopiaConfig.setStatus(1);
cornucopiaConfig.setCreateTime(new Date());
}
cornucopiaConfig.setUpdateTime(new Date());
cornucopiaConfig.setType(body.getType());
cornucopiaConfig.setName(body.getName());
cornucopiaConfig.setProportion(body.getProportion());
cornucopiaConfigService.edit(cornucopiaConfig);
return ResponseMsgUtil.success(cornucopiaConfig);
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getCornucopiaConfig",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询聚宝盆配置参数列表")
public ResponseData getCornucopiaConfig() {
try {
return ResponseMsgUtil.success(cornucopiaConfigService.queryAllList(new HashMap<>()));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,69 @@
package com.hfkj.controller.order;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.order.BsOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value="/order")
@Api(value="订单管理")
public class BsOrderController {
private static final Logger log = LoggerFactory.getLogger(BsOrderController.class);
@Resource
private BsOrderService orderService;
@RequestMapping(value="/getOrderList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询列表")
public ResponseData getOrderList(@RequestParam(value = "orderNo" , required = false) String orderNo,
@RequestParam(value = "type" , required = false) Integer type,
@RequestParam(value = "status" , required = false) Integer status,
@RequestParam(value = "userPhone" , required = false) String userPhone,
@RequestParam(value = "goodsName" , required = false) String goodsName,
@RequestParam(value = "createTimeS" , required = false) Long createTimeS,
@RequestParam(value = "createTimeE" , required = false) Long createTimeE,
@RequestParam(value = "pageNum" , required = true) Integer pageNum,
@RequestParam(value = "pageSize" , required = true) Integer pageSize, HttpServletRequest request) {
try {
Map<String , Object> map = new HashMap<>();
map.put("orderNo", orderNo);
map.put("userPhone", userPhone);
map.put("type", type);
map.put("status", status);
map.put("goodsName", goodsName);
map.put("createTimeS", createTimeS);
map.put("createTimeE", createTimeE);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(orderService.getOrderList(map)));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -17,10 +17,7 @@ import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@ -81,6 +78,27 @@ public class ClientController {
}
}
@RequestMapping(value = "/smsLogin", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "登录并注册")
public ResponseData smsLogin(@RequestParam(value = "phone" , required = true) String phone) {
try {
// 校验手机号格式
if (!MemberValidateUtil.validatePhone(phone)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号");
}
return ResponseMsgUtil.success(userService.login(phone, UserLoginType.SMS, new HashMap<>(), null));
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/loginOut",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "退出登录")

@ -38,8 +38,7 @@ public class GoodsController {
@Autowired
private UserCenter userCenter;
@Resource
private BsOrderService bsOrderService;
@RequestMapping(value="/goodsList",method = RequestMethod.GET)
@ResponseBody
@ -63,11 +62,16 @@ public class GoodsController {
goodsList = goodsDataService.goodsModelTaoBaoList(jsonObject);
} else if (type == 2) {
JSONObject object = PddService.authority();
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
Map<String , Object> mapUser = new HashMap<>();
mapUser.put("uid", userSession.getUser().getId());
JSONObject object = PddService.authority(mapUser.toString());
boolean generateAuthorityUrl = object.getJSONObject("authorityQueryResponse").getInteger("bind") == 0;
if (generateAuthorityUrl && title != null) {
goodsList = new ArrayList<>();
JSONObject jsonObject = PddService.promotion();
JSONObject jsonObject = PddService.promotion(mapUser.toString());
JSONObject promotion = jsonObject.getJSONObject("rpPromotionUrlGenerateResponse").getJSONArray("urlList").getJSONObject(0);
GoodsModel goodsModel = new GoodsModel();
goodsModel.setPddUrl(promotion);
@ -77,7 +81,7 @@ public class GoodsController {
if (pageSize < 10) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "pageSize的取值范围是10-100!");
}
JSONObject jsonObject = PddService.syncInvoke(title , pageNo , pageSize);
JSONObject jsonObject = PddService.syncInvoke(title , pageNo , pageSize , mapUser.toString());
goodsList = goodsDataService.goodsModelPddList(jsonObject);
}
@ -93,28 +97,7 @@ public class GoodsController {
}
}
@RequestMapping(value="/create",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "创建订单")
public ResponseData create(@RequestBody JSONObject jsonObject) {
try {
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
if (userSession == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, "");
}
jsonObject.put("userId", userSession.getUser().getId());
jsonObject.put("userPhone", userSession.getUser().getPhone());
return ResponseMsgUtil.success(bsOrderService.create(jsonObject));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/createCommand",method = RequestMethod.GET)
@ResponseBody

@ -0,0 +1,91 @@
package com.hfkj.controller.cornucopia;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.cornucopia.BsCornucopiaConfigService;
import com.hfkj.service.cornucopia.BsCornucopiaLotteryRecordService;
import com.hfkj.service.cornucopia.BsCornucopiaPoolService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
@Controller
@RequestMapping(value="/cornucopia")
@Api(value="聚宝盆管理")
public class CornucopiaController {
private static final Logger log = LoggerFactory.getLogger(CornucopiaController.class);
@Resource
private BsCornucopiaConfigService cornucopiaConfigService;
@Resource
private BsCornucopiaPoolService cornucopiaPoolService;
@Resource
private BsCornucopiaLotteryRecordService cornucopiaLotteryRecordService;
@Resource
private UserCenter userCenter;
@RequestMapping(value="/getCornucopiaConfig",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询聚宝盆配置参数列表")
public ResponseData getCornucopiaConfig() {
try {
return ResponseMsgUtil.success(cornucopiaConfigService.queryAllList(new HashMap<>()));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/investmentCornucopia",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "投入聚宝盆")
public ResponseData investmentCornucopia(@RequestBody JSONObject body, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
if (body == null||
body.getInteger("type") == null ||
body.getBigDecimal("goldCoin") == null
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
cornucopiaPoolService.investmentCornucopia(body.getInteger("type") , userModel.getAccount().getId() , body.getBigDecimal("goldCoin"));
return ResponseMsgUtil.success("投入成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,106 @@
package com.hfkj.controller.order;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.UserSessionObject;
import com.hfkj.service.order.BsOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value="/order")
@Api(value="订单管理")
public class BsOrderController {
private static final Logger log = LoggerFactory.getLogger(BsOrderController.class);
@Resource
private BsOrderService orderService;
@Resource
private UserCenter userCenter;
@Resource
private BsOrderService bsOrderService;
@RequestMapping(value="/getOrderList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询列表")
public ResponseData getOrderList(@RequestParam(value = "orderNo" , required = false) String orderNo,
@RequestParam(value = "type" , required = false) Integer type,
@RequestParam(value = "status" , required = false) Integer status,
@RequestParam(value = "userPhone" , required = false) String userPhone,
@RequestParam(value = "goodsName" , required = false) String goodsName,
@RequestParam(value = "createTimeS" , required = false) Long createTimeS,
@RequestParam(value = "createTimeE" , required = false) Long createTimeE,
@RequestParam(value = "pageNum" , required = true) Integer pageNum,
@RequestParam(value = "pageSize" , required = true) Integer pageSize, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
Map<String , Object> map = new HashMap<>();
map.put("orderNo", orderNo);
map.put("userPhone", userPhone);
map.put("type", type);
map.put("userId", userModel.getAccount().getId());
map.put("status", status);
map.put("goodsName", goodsName);
map.put("createTimeS", createTimeS);
map.put("createTimeE", createTimeE);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(orderService.getOrderList(map)));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/create",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "创建订单")
public ResponseData create(@RequestBody JSONObject jsonObject) {
try {
// 用户session
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class);
if (userSession == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, "");
}
jsonObject.put("userId", userSession.getUser().getId());
jsonObject.put("userPhone", userSession.getUser().getPhone());
return ResponseMsgUtil.success(bsOrderService.create(jsonObject));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,68 @@
package com.hfkj.service.cornucopia;
import com.hfkj.entity.BsCornucopiaConfig;
import java.util.List;
import java.util.Map;
public interface BsCornucopiaConfigService {
/**
* @MethodName create
* @Description: 创建
* @param cornucopiaConfig
* @Author: Sum1Dream
* @Date: 2024/7/4 下午2:30
*/
void create(BsCornucopiaConfig cornucopiaConfig);
/**
* @MethodName update
* @Description: 更新
* @param cornucopiaConfig
* @Author: Sum1Dream
* @Date: 2024/7/4 下午2:30
*/
void edit(BsCornucopiaConfig cornucopiaConfig);
/**
* @MethodName delete
* @Description: 删除
* @param id
* @param fullDelete
* @Author: Sum1Dream
* @Date: 2024/7/4 下午2:30
*/
void delete(Long id , Boolean fullDelete);
/**
* @MethodName queryDetail
* @Description:查询详情
* @param id
* @return: com.hfkj.entity.BsCornucopiaConfig
* @Author: Sum1Dream
* @Date: 2024/7/4 下午2:30
*/
BsCornucopiaConfig queryDetail(Long id);
/**
* @MethodName queryDetail
* @Description:
* @param type
* @return: com.hfkj.entity.BsCornucopiaConfig
* @Author: Sum1Dream
* @Date: 2024/9/27 下午2:28
*/
BsCornucopiaConfig queryDetail(Integer type);
/**
* @MethodName queryAllList
* @Description: map
* @param
* @return: java.util.List<com.hfkj.entity.BsCornucopiaConfig>
* @Author: Sum1Dream
* @Date: 2024/9/27 上午11:42
*/
List<BsCornucopiaConfig> queryAllList(Map<String , Object> map);
}

@ -0,0 +1,57 @@
package com.hfkj.service.cornucopia;
import com.hfkj.entity.BsCornucopiaLotteryRecord;
import java.util.List;
import java.util.Map;
public interface BsCornucopiaLotteryRecordService {
/**
* @MethodName create
* @Description: 创建
* @param cornucopiaLotteryRecord
* @Author: Sum1Dream
* @Date: 2024/7/4 下午2:30
*/
void create(BsCornucopiaLotteryRecord cornucopiaLotteryRecord);
/**
* @MethodName update
* @Description: 更新
* @param cornucopiaLotteryRecord
* @Author: Sum1Dream
* @Date: 2024/7/4 下午2:30
*/
void update(BsCornucopiaLotteryRecord cornucopiaLotteryRecord);
/**
* @MethodName delete
* @Description: 删除
* @param id
* @param fullDelete
* @Author: Sum1Dream
* @Date: 2024/7/4 下午2:30
*/
void delete(Long id , Boolean fullDelete);
/**
* @MethodName queryDetail
* @Description:查询详情
* @param id
* @return: com.hfkj.entity.BsCornucopiaLotteryRecord
* @Author: Sum1Dream
* @Date: 2024/7/4 下午2:30
*/
BsCornucopiaLotteryRecord queryDetail(Long id);
/**
* @MethodName queryAllList
* @Description: map
* @param
* @return: java.util.List<com.hfkj.entity.BsCornucopiaLotteryRecord>
* @Author: Sum1Dream
* @Date: 2024/9/27 上午11:42
*/
List<BsCornucopiaLotteryRecord> queryAllList(Map<String , Object> map);
}

@ -0,0 +1,90 @@
package com.hfkj.service.cornucopia;
import com.hfkj.entity.BsCornucopiaLotteryRecord;
import com.hfkj.entity.BsCornucopiaPool;
import com.hfkj.entity.BsCornucopiaPoolRecord;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
public interface BsCornucopiaPoolService {
/**
* @MethodName create
* @Description: 创建
* @param cornucopiaPool
* @Author: Sum1Dream
* @Date: 2024/7/4 下午2:30
*/
void create(BsCornucopiaPool cornucopiaPool);
/**
* @MethodName update
* @Description: 更新
* @param cornucopiaPool
* @Author: Sum1Dream
* @Date: 2024/7/4 下午2:30
*/
void update(BsCornucopiaPool cornucopiaPool);
/**
* @MethodName delete
* @Description: 删除
* @param id
* @param fullDelete
* @Author: Sum1Dream
* @Date: 2024/7/4 下午2:30
*/
void delete(Long id , Boolean fullDelete);
/**
* @MethodName queryDetail
* @Description:查询详情
* @param id
* @return: com.hfkj.entity.BsCornucopiaPool
* @Author: Sum1Dream
* @Date: 2024/7/4 下午2:30
*/
BsCornucopiaPool queryDetail(Long id);
/**
* @MethodName queryAllList
* @Description: map
* @param
* @return: java.util.List<com.hfkj.entity.BsCornucopiaPool>
* @Author: Sum1Dream
* @Date: 2024/9/27 上午11:42
*/
List<BsCornucopiaPool> queryAllList(Map<String , Object> map);
/**
* @MethodName investmentCornucopia
* @Description: 投入聚宝盆
* @param type
* @param userId
* @param goldCoin
* @Author: Sum1Dream
* @Date: 2024/9/27 下午2:50
*/
void investmentCornucopia(Integer type , Long userId , BigDecimal goldCoin) throws Exception;
/**
* @MethodName create
* @Description: 创建
* @param cornucopiaPoolRecord
* @Author: Sum1Dream
* @Date: 2024/7/4 下午2:30
*/
void create(BsCornucopiaPoolRecord cornucopiaPoolRecord);
/**
* @MethodName queryAllList
* @Description: map
* @param
* @return: java.util.List<com.hfkj.entity.BsCornucopiaPool>
* @Author: Sum1Dream
* @Date: 2024/9/27 上午11:42
*/
List<BsCornucopiaPoolRecord> queryAllListRecord(Map<String , Object> map);
}

@ -0,0 +1,84 @@
package com.hfkj.service.cornucopia.Impl;
import com.hfkj.dao.BsCornucopiaConfigMapper;
import com.hfkj.entity.BsCornucopiaConfig;
import com.hfkj.entity.BsCornucopiaConfigExample;
import com.hfkj.service.cornucopia.BsCornucopiaConfigService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("bsCornucopiaConfigService")
public class BsCornucopiaConfigServiceImpl implements BsCornucopiaConfigService {
@Resource
private BsCornucopiaConfigMapper bsCornucopiaConfigMapper;
@Override
public void create(BsCornucopiaConfig cornucopiaConfig) {
bsCornucopiaConfigMapper.insert(cornucopiaConfig);
}
@Override
public void edit(BsCornucopiaConfig cornucopiaConfig) {
if (cornucopiaConfig.getId() == null) {
bsCornucopiaConfigMapper.insert(cornucopiaConfig);
} else {
bsCornucopiaConfigMapper.updateByPrimaryKey(cornucopiaConfig);
}
}
@Override
public void delete(Long id, Boolean fullDelete) {
if (fullDelete) {
bsCornucopiaConfigMapper.deleteByPrimaryKey(id);
} else {
BsCornucopiaConfig cornucopiaConfig = queryDetail(id);
cornucopiaConfig.setStatus(0);
cornucopiaConfig.setUpdateTime(new Date());
bsCornucopiaConfigMapper.updateByPrimaryKey(cornucopiaConfig);
}
}
@Override
public BsCornucopiaConfig queryDetail(Long id) {
return bsCornucopiaConfigMapper.selectByPrimaryKey(id);
}
@Override
public BsCornucopiaConfig queryDetail(Integer type) {
BsCornucopiaConfigExample example = new BsCornucopiaConfigExample();
BsCornucopiaConfigExample.Criteria criteria = example.createCriteria();
criteria.andTypeEqualTo(type);
List<BsCornucopiaConfig> list = bsCornucopiaConfigMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public List<BsCornucopiaConfig> queryAllList(Map<String, Object> map) {
BsCornucopiaConfigExample example = new BsCornucopiaConfigExample();
BsCornucopiaConfigExample.Criteria criteria = example.createCriteria();
if (MapUtils.getInteger(map, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type"));
}
if (MapUtils.getString(map, "name") != null) {
criteria.andNameLike("%" + MapUtils.getString(map, "name") + "%");
}
return bsCornucopiaConfigMapper.selectByExample(example);
}
}

@ -0,0 +1,67 @@
package com.hfkj.service.cornucopia.Impl;
import com.hfkj.dao.BsCornucopiaLotteryRecordMapper;
import com.hfkj.entity.BsCornucopiaConfig;
import com.hfkj.entity.BsCornucopiaLotteryRecord;
import com.hfkj.entity.BsCornucopiaLotteryRecordExample;
import com.hfkj.service.cornucopia.BsCornucopiaLotteryRecordService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("bsCornucopiaLotteryRecordService")
public class BsCornucopiaLotteryRecordServiceImpl implements BsCornucopiaLotteryRecordService {
@Resource
private BsCornucopiaLotteryRecordMapper bsCornucopiaLotteryRecordMapper;
@Override
public void create(BsCornucopiaLotteryRecord cornucopiaLotteryRecord) {
bsCornucopiaLotteryRecordMapper.insert(cornucopiaLotteryRecord);
}
@Override
public void update(BsCornucopiaLotteryRecord cornucopiaLotteryRecord) {
bsCornucopiaLotteryRecordMapper.updateByPrimaryKeySelective(cornucopiaLotteryRecord);
}
@Override
public void delete(Long id, Boolean fullDelete) {
if (fullDelete) {
bsCornucopiaLotteryRecordMapper.deleteByPrimaryKey(id);
} else {
BsCornucopiaLotteryRecord cornucopiaLotteryRecord = queryDetail(id);
cornucopiaLotteryRecord.setStatus(0);
cornucopiaLotteryRecord.setUpdateTime(new Date());
update(cornucopiaLotteryRecord);
}
}
@Override
public BsCornucopiaLotteryRecord queryDetail(Long id) {
return bsCornucopiaLotteryRecordMapper.selectByPrimaryKey(id);
}
@Override
public List<BsCornucopiaLotteryRecord> queryAllList(Map<String, Object> map) {
BsCornucopiaLotteryRecordExample example = new BsCornucopiaLotteryRecordExample();
BsCornucopiaLotteryRecordExample.Criteria criteria = example.createCriteria();
if (MapUtils.getInteger(map, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type"));
}
if (MapUtils.getString(map, "lotteryNo") != null) {
criteria.andLotteryNoLike("%" + MapUtils.getString(map, "lotteryNo") + "%");
}
return bsCornucopiaLotteryRecordMapper.selectByExample(example);
}
}

@ -0,0 +1,157 @@
package com.hfkj.service.cornucopia.Impl;
import com.hfkj.common.exception.BaseException;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.dao.BsCornucopiaPoolMapper;
import com.hfkj.dao.BsCornucopiaPoolRecordMapper;
import com.hfkj.entity.*;
import com.hfkj.service.cornucopia.BsCornucopiaPoolService;
import com.hfkj.service.user.BsUserAccountService;
import com.hfkj.sysenum.user.UserAccountRecordTypeEnum;
import org.apache.commons.collections4.MapUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@Service("bsCornucopiaPoolService")
public class BsCornucopiaPoolServiceImpl implements BsCornucopiaPoolService {
@Resource
private BsCornucopiaPoolMapper bsCornucopiaPoolMapper;
@Resource
private BsCornucopiaPoolRecordMapper cornucopiaPoolRecordMapper;
@Resource
private BsUserAccountService userAccountService;
@Resource
private RedisTemplate<String,Object> redisTemplate;
private final String LOCK_KEY = "POOL_TRADE_LOCK_";
@Override
public void create(BsCornucopiaPool cornucopiaPool) {
bsCornucopiaPoolMapper.insert(cornucopiaPool);
}
@Override
public void update(BsCornucopiaPool cornucopiaPool) {
bsCornucopiaPoolMapper.updateByPrimaryKeySelective(cornucopiaPool);
}
@Override
public void delete(Long id, Boolean fullDelete) {
if (fullDelete) {
bsCornucopiaPoolMapper.deleteByPrimaryKey(id);
} else {
BsCornucopiaPool cornucopiaPool = queryDetail(id);
cornucopiaPool.setStatus(0);
cornucopiaPool.setUpdateTime(new Date());
update(cornucopiaPool);
}
}
@Override
public BsCornucopiaPool queryDetail(Long id) {
return bsCornucopiaPoolMapper.selectByPrimaryKey(id);
}
@Override
public List<BsCornucopiaPool> queryAllList(Map<String, Object> map) {
BsCornucopiaPoolExample example = new BsCornucopiaPoolExample();
BsCornucopiaPoolExample.Criteria criteria = example.createCriteria();
if (MapUtils.getInteger(map, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type"));
}
if (MapUtils.getString(map, "userName") != null) {
criteria.andUserNameLike("%" + MapUtils.getString(map, "userName") + "%");
}
if (MapUtils.getLong(map, "userId") != null) {
criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId"));
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
}
return bsCornucopiaPoolMapper.selectByExample(example);
}
@Override
@Transactional(propagation= Propagation.REQUIRED,rollbackFor= {RuntimeException.class})
public void investmentCornucopia(Integer type, Long userId, BigDecimal goldCoin) throws Exception {
// 锁编号
String lockKey = LOCK_KEY+userId;
// 获取锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent(lockKey, "");
if (Boolean.TRUE.equals(lock)) {
try {
// 获取锁成功
// 锁超时时间 10秒
redisTemplate.expire(lockKey, 10, TimeUnit.SECONDS);
// 查询账户
BsUserAccount userAccount = userAccountService.getAccount(userId);
// 判断当前账户余额是否足够投入 true 不够 false 够
Boolean isMeet = userAccount.getGoldCoin().compareTo(goldCoin) < 0;
// 判断是否充足
if (isMeet) {
}
} catch (BaseException e) {
// 释放锁
redisTemplate.delete(lockKey);
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, e.getErrorMsg());
} catch (Exception e) {
// 释放锁
redisTemplate.delete(lockKey);
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "啊偶~交易出现未知问题!请稍后重试");
}
} else {
Thread.sleep(100);
investmentCornucopia(type , userId ,goldCoin);
}
}
@Override
public void create(BsCornucopiaPoolRecord cornucopiaPoolRecord) {
cornucopiaPoolRecordMapper.insert(cornucopiaPoolRecord);
}
@Override
public List<BsCornucopiaPoolRecord> queryAllListRecord(Map<String, Object> map) {
BsCornucopiaPoolRecordExample example = new BsCornucopiaPoolRecordExample();
BsCornucopiaPoolRecordExample.Criteria criteria = example.createCriteria();
if (MapUtils.getInteger(map, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type"));
}
if (MapUtils.getString(map, "userName") != null) {
criteria.andUserNameLike("%" + MapUtils.getString(map, "userName") + "%");
}
if (MapUtils.getLong(map, "userId") != null) {
criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId"));
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
}
return cornucopiaPoolRecordMapper.selectByExample(example);
}
}

@ -58,7 +58,7 @@ public class GoodsDataServiceImpl implements GoodsDataService {
// 商品佣金信息
incomeInfoModel = new IncomeInfoModel();
publishInfoModel = new PublishInfoModel();
publishInfoModel.setClickUrl(publish_info.getString("click_url"));
publishInfoModel.setClickUrl("https:" + publish_info.getString("click_url"));
if (publish_info.getString("coupon_share_url") != null) {
publishInfoModel.setCouponShareUrl("https:" + publish_info.getString("coupon_share_url"));
}
@ -182,9 +182,10 @@ public class GoodsDataServiceImpl implements GoodsDataService {
// 价格促销信息
pricePromotionInfoModel = new PricePromotionInfoModel();
pricePromotionInfoModel.setReservePrice(goods.getBigDecimal("minNormalPrice").divide(new BigDecimal(100) , 2 , RoundingMode.DOWN));
pricePromotionInfoModel.setZkFinalPrice(goods.getBigDecimal("minGroupPrice").divide(new BigDecimal(100) , 2 , RoundingMode.DOWN));
pricePromotionInfoModel.setFinalPromotionPrice(pricePromotionInfoModel.getZkFinalPrice());
pricePromotionInfoModel.setFinalPromotionPrice(goods.getBigDecimal("minNormalPrice").divide(new BigDecimal(100) , 2 , RoundingMode.DOWN));
pricePromotionInfoModel.setZkFinalPrice(pricePromotionInfoModel.getFinalPromotionPrice().add(morePromotionModel.getPromotionFee()));
pricePromotionInfoModel.setReservePrice(pricePromotionInfoModel.getZkFinalPrice());
// 插入更多活动优惠
pricePromotionInfoModel.setMorePromotionList(morePromotionModels);

@ -3,6 +3,9 @@ package com.hfkj.service.order;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.entity.BsOrder;
import java.util.List;
import java.util.Map;
/**
* @className: BsOrderService
@ -48,6 +51,16 @@ public interface BsOrderService {
* @Date: 2024/9/24 下午3:08
*/
BsOrder findByOrderNo(String orderNo);
/**
* @MethodName getOrderList
* @Description:
* @param map
* @return: java.util.List<com.hfkj.entity.BsOrder>
* @Author: Sum1Dream
* @Date: 2024/9/26 上午11:31
*/
List<BsOrder> getOrderList(Map<String , Object> map);
}

@ -8,15 +8,13 @@ import com.hfkj.entity.BsOrder;
import com.hfkj.entity.BsOrderExample;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.order.OrderBusinessService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.OrderUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Service("bsOrderService")
public class BsOrderServiceImpl implements BsOrderService {
@ -73,6 +71,7 @@ public class BsOrderServiceImpl implements BsOrderService {
map.put("uid", order.getUserId());
map.put("searchId", body.getString("searchId"));
map.put("goodsSign", body.getString("goodsSign"));
map.put("url", body.getString("url"));
order.setCustomparameters(map.toString());
order.setGoodsName(body.getString("goodsName"));
order.setType(body.getInteger("type"));
@ -82,7 +81,7 @@ public class BsOrderServiceImpl implements BsOrderService {
// 淘宝订单业务
if (body.getInteger("type") == 1) {
return orderBusinessService.taobaoUrl(order);
}
// 拼多多订单业务
if (body.getInteger("type") == 2) {
@ -114,4 +113,37 @@ public class BsOrderServiceImpl implements BsOrderService {
return (BsOrder) o;
}
@Override
public List<BsOrder> getOrderList(Map<String, Object> map) {
BsOrderExample example = new BsOrderExample();
BsOrderExample.Criteria criteria = example.createCriteria();
if (MapUtils.getString(map , "orderNo") != null) {
criteria.andOrderNoEqualTo(MapUtils.getString(map , "orderNo"));
}
if (MapUtils.getInteger(map , "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map , "type"));
}
if (MapUtils.getString(map , "userPhone") != null) {
criteria.andUserPhoneEqualTo(MapUtils.getString(map , "userPhone"));
}
if (MapUtils.getString(map , "goodsName") != null) {
criteria.andGoodsNameLike("%" + MapUtils.getString(map , "goodsName") + "%");
}
if (MapUtils.getLong(map, "createTimeS") != null) {
criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "createTimeS")));
}
if (MapUtils.getLong(map, "createTimeE") != null) {
criteria.andCreateTimeLessThan(new Date(MapUtils.getLong(map, "createTimeE")));
}
if (MapUtils.getInteger(map , "status") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map , "status"));
}
if (MapUtils.getLong(map , "userId") != null) {
criteria.andUserIdEqualTo(MapUtils.getLong(map , "userId"));
}
return bsOrderMapper.selectByExample(example);
}
}

@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.dao.BsOrderMapper;
import com.hfkj.entity.BsOrder;
import com.hfkj.service.pdd.PddService;
import com.hfkj.service.taobao.TaoBaoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@ -27,8 +29,13 @@ public class OrderBusinessService {
// 淘口令生成业务
public JSONObject taobaoUrl(BsOrder bsOrder) {
return null;
public JSONObject taobaoUrl(BsOrder bsOrder) throws Exception{
JSONObject jsonObject = JSONObject.parseObject(bsOrder.getCustomparameters());
JSONObject object = TaoBaoService.createCommand(jsonObject.getString("url"));
if (!jsonObject.getBoolean("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
}
return object;
}
@ -46,11 +53,15 @@ public class OrderBusinessService {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "缺少goodsSign!");
}
Map<String , Object> mapUser = new HashMap<>();
mapUser.put("uid", bsOrder.getUserId());
mapUser.put("orderNo", bsOrder.getOrderNo());
// 判断是否需要授权
JSONObject object = PddService.authority(bsOrder.getCustomparameters());
JSONObject object = PddService.authority(mapUser.toString());
boolean generateAuthorityUrl = object.getJSONObject("authorityQueryResponse").getInteger("bind") == 0;
JSONObject o = PddService.promotion(searchId , goodsSign , generateAuthorityUrl , bsOrder.getCustomparameters());
JSONObject o = PddService.promotion(searchId , goodsSign , generateAuthorityUrl , mapUser.toString());
return o.getJSONObject("goodsPromotionUrlGenerateResponse").getJSONArray("goodsPromotionUrlList").getJSONObject(0);

@ -25,7 +25,7 @@ public class PddService {
private static Logger log = LoggerFactory.getLogger(PddService.class);
public static JSONObject syncInvoke(String title , Long pageNo , Long pageSize) throws Exception {
public static JSONObject syncInvoke(String title , Long pageNo , Long pageSize , String customParameters) throws Exception {
log.info("============ 拼多多请求-START =============");
String clientId = "71a050c5d93d4169a237539af44c7c33";
@ -38,8 +38,10 @@ public class PddService {
request.setPage(pageNo.intValue());
request.setPageSize(pageSize.intValue());
request.setSortType(0);
request.setPid("41483885_294044603");
request.setUseCustomized(true);
request.setWithCoupon(true);
request.setCustomParameters(customParameters);
PddDdkGoodsSearchResponse response = client.syncInvoke(request);
log.info("请求接口:" + "syncInvoke");
@ -93,7 +95,7 @@ public class PddService {
* @Author: Sum1Dream
* @Date: 2024/9/20 下午3:57
*/
public static JSONObject promotion() throws Exception {
public static JSONObject promotion(String customParameters) throws Exception {
log.info("============ 拼多多请求-START =============");
String clientId = "71a050c5d93d4169a237539af44c7c33";
@ -105,6 +107,7 @@ public class PddService {
pIdList.add("41483885_294044603");
request.setPIdList(pIdList);
request.setChannelType(10);
request.setCustomParameters(customParameters);
PddDdkRpPromUrlGenerateResponse response = client.syncInvoke(request);
log.info("请求接口:" + "promotion");

@ -16,6 +16,10 @@ public enum UserAccountRecordSourceTypeEnum {
* 自购元宝升级优淘会员等级
*/
type2(2 , "升级优淘会员"),
/**
* 聚宝盆
*/
type3(3 , "聚宝盆"),
;
private Integer type;

Loading…
Cancel
Save