袁野 2 months ago
parent 874cb4fbc4
commit 0e8d192291
  1. 18
      cweb/src/main/java/com/cweb/controller/meituan/MeiTuanController.java
  2. 7
      order/src/main/java/com/order/controller/business/BsOrderGoodsController.java
  3. 81
      order/src/main/java/com/order/controller/business/BsOrderMeiTuanController.java
  4. 447
      order/src/main/java/com/order/controller/business/OrderSettlementController.java
  5. 133
      order/src/main/java/com/order/controller/notify/MeiTuanController.java
  6. 2
      service/src/main/java/com/hfkj/config/CommonSysConfig.java
  7. 34
      service/src/main/java/com/hfkj/meituan/MeiTuanService.java
  8. 58
      service/src/main/java/com/hfkj/model/order/orderExport/MerOrderSettlementDetailModel.java
  9. 120
      service/src/main/java/com/hfkj/model/order/orderExport/OrderMeiTuanExportModel.java
  10. 39
      service/src/main/java/com/hfkj/model/order/orderExport/OrderSettlementModel.java
  11. 34
      service/src/main/java/com/hfkj/model/order/orderExport/OrderSettlementSumModel.java
  12. 10
      service/src/main/java/com/hfkj/service/coupon/BsOrderCouponService.java
  13. 24
      service/src/main/java/com/hfkj/service/coupon/impl/BsOrderCouponServiceImpl.java
  14. 11
      service/src/main/java/com/hfkj/service/goods/BsOrderCinemaService.java
  15. 2
      service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java
  16. 32
      service/src/main/java/com/hfkj/service/goods/BsOrderMeiTuanService.java
  17. 18
      service/src/main/java/com/hfkj/service/goods/BsOrderMemberService.java
  18. 9
      service/src/main/java/com/hfkj/service/goods/BsOrderStarbucksService.java
  19. 32
      service/src/main/java/com/hfkj/service/goods/impl/BsOrderCinemaServiceImpl.java
  20. 22
      service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java
  21. 151
      service/src/main/java/com/hfkj/service/goods/impl/BsOrderMeiTuanServiceImpl.java
  22. 44
      service/src/main/java/com/hfkj/service/goods/impl/BsOrderMemberServiceImpl.java
  23. 25
      service/src/main/java/com/hfkj/service/goods/impl/BsOrderStarbucksServiceImpl.java
  24. 47
      service/src/main/java/com/hfkj/service/order/OrderCancelService.java
  25. 8
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  26. 49
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
  27. 26
      service/src/main/java/com/hfkj/service/order/OrderRefundSuccessService.java
  28. 47
      service/src/main/java/com/hfkj/service/order/OrderSettlementService.java
  29. 26
      service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java
  30. 46
      service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java
  31. 1
      service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java
  32. 374
      service/src/main/java/com/hfkj/service/order/impl/OrderSettlementServiceImpl.java
  33. 2
      service/src/main/java/com/hfkj/sysenum/UserLoginPlatform.java
  34. 12
      service/src/main/java/com/hfkj/sysenum/fileRecords/FileRecordsEnum.java
  35. 2
      service/src/main/resources/dev/commonConfig.properties
  36. 7
      service/src/main/resources/prod/commonConfig.properties

@ -4,8 +4,11 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.utils.RandomStringGeneratorUtil; import com.hfkj.common.utils.RandomStringGeneratorUtil;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.BsOrderMeituan;
import com.hfkj.meituan.MeiTuanService; import com.hfkj.meituan.MeiTuanService;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.service.goods.BsOrderMeiTuanService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -16,9 +19,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects;
@Controller @Controller
@RequestMapping(value="/meiTuan") @RequestMapping(value="/meiTuan")
@ -27,20 +32,31 @@ public class MeiTuanController {
private static final Logger log = LoggerFactory.getLogger(MeiTuanController.class); private static final Logger log = LoggerFactory.getLogger(MeiTuanController.class);
@Resource
private BsOrderMeiTuanService bsOrderMeiTuanService;
@RequestMapping(value = "/loginFree", method = RequestMethod.GET) @RequestMapping(value = "/loginFree", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "H5免登接口") @ApiOperation(value = "H5免登接口")
public ResponseData loginFree(@RequestParam(name = "staffPhone", required = true) String staffPhone, public ResponseData loginFree(@RequestParam(name = "staffPhone", required = true) String staffPhone,
@RequestParam(name = "childNo", required = false) String childNo,
@RequestParam(name = "productType", required = true) String productType) { @RequestParam(name = "productType", required = true) String productType) {
try { try {
Map<String , Object> map = new HashMap<>(); Map<String , Object> map = new HashMap<>();
Map<String , Object> staffInfo = new HashMap<>(); Map<String , Object> staffInfo = new HashMap<>();
Map<String , Object> bizParam = new HashMap<>();
staffInfo.put("staffPhone", staffPhone); staffInfo.put("staffPhone", staffPhone);
if (Objects.equals(productType, "sqt_order_detail")) {
BsOrderMeituan orderMeiTuan = bsOrderMeiTuanService.findOrderMeiTuan(childNo);
bizParam.put("sqtBizOrderId" , orderMeiTuan.getSqtBizOrderId());
}
map.put("staffInfo", staffInfo); map.put("staffInfo", staffInfo);
map.put("entId", 104310L); map.put("bizParam", bizParam);
map.put("entId", CommonSysConst.getSysConfig().getEntId());
map.put("ts", new Date().getTime()); map.put("ts", new Date().getTime());
map.put("productType", productType); map.put("productType", productType);
map.put("nonce" , RandomStringGeneratorUtil.generateRandomString(36)); map.put("nonce" , RandomStringGeneratorUtil.generateRandomString(36));

@ -151,15 +151,12 @@ public class BsOrderGoodsController {
@RequestParam(value = "payType" , required = false) Integer payType, @RequestParam(value = "payType" , required = false) Integer payType,
@RequestParam(value = "status" , required = false) Integer status, @RequestParam(value = "status" , required = false) Integer status,
@RequestParam(value = "merId" , required = false) Long merId, @RequestParam(value = "merId" , required = false) Long merId,
@RequestParam(value = "finishTimeS" , required = false) Long finishTimeS, @RequestParam(value = "finishTimeS" , required = false) Long finishTimeS,
@RequestParam(value = "finishTimeE" , required = false) Long finishTimeE, @RequestParam(value = "finishTimeE" , required = false) Long finishTimeE,
@RequestParam(value = "createTimeS" , required = false) Long createTimeS, @RequestParam(value = "createTimeS" , required = false) Long createTimeS,
@RequestParam(value = "createTimeE" , required = false) Long createTimeE, HttpServletRequest request) { @RequestParam(value = "createTimeE" , required = false) Long createTimeE, HttpServletRequest request) {
// 插入下载记录 // 插入下载记录
FileRecords fileRecords = new FileRecords(); FileRecords fileRecords = new FileRecords();
try { try {
SessionObject sessionObject = userCenter.getSessionObject(request); SessionObject sessionObject = userCenter.getSessionObject(request);

@ -1,16 +1,27 @@
package com.order.controller.business; package com.order.controller.business;
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.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; 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.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsOrderMeituan;
import com.hfkj.entity.SecConfig; import com.hfkj.entity.SecConfig;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.SecConfigService; import com.hfkj.service.SecConfigService;
import com.hfkj.service.goods.BsOrderMeiTuanService;
import com.hfkj.service.goods.impl.BsOrderMeiTuanServiceImpl;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
@ -18,7 +29,11 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap;
import java.util.Map;
@Controller @Controller
@RequestMapping(value="/orderMeiTuan") @RequestMapping(value="/orderMeiTuan")
@ -28,12 +43,22 @@ public class BsOrderMeiTuanController {
@Resource @Resource
private SecConfigService secConfigService; private SecConfigService secConfigService;
@Resource
private BsOrderMeiTuanService orderMeiTuanService;
@Resource
private UserCenter userCenter;
private static final Logger log = LoggerFactory.getLogger(BsOrderGoodsController.class); private static final Logger log = LoggerFactory.getLogger(BsOrderGoodsController.class);
@Autowired
private BsOrderMeiTuanServiceImpl bsOrderMeiTuanService;
@RequestMapping(value="/servicePrice",method = RequestMethod.GET) @RequestMapping(value="/servicePrice",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "查询服务费") @ApiOperation(value = "查询服务费")
public ResponseData servicePrice(@RequestParam(value = "platformCode" , required = true) String platformCode, public ResponseData servicePrice(@RequestParam(value = "platformCode" , required = true) String platformCode,
@RequestParam(value = "tradeNo" , required = true) String tradeNo,
@RequestParam(value = "price" , required = true) BigDecimal price @RequestParam(value = "price" , required = true) BigDecimal price
) { ) {
try { try {
@ -46,9 +71,61 @@ public class BsOrderMeiTuanController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相信息"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相信息");
} }
servicePrice = price.multiply(new BigDecimal(config.getCodeValue())); BsOrderMeituan orderMeiTuan = orderMeiTuanService.findOrderMeiTuanByTradeNo(tradeNo);
servicePrice = price.multiply(new BigDecimal(config.getCodeValue())).setScale(2 , RoundingMode.HALF_UP);
JSONObject object = new JSONObject();
object.put("servicePrice" , servicePrice);
object.put("goodsName" , orderMeiTuan.getGoodsName());
object.put("tradeAmount" , orderMeiTuan.getTradeAmount());
return ResponseMsgUtil.success(object);
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getListMeiTuan",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询列表")
public ResponseData getListMeiTuan(
@RequestParam(value = "orderNo" , required = false) String orderNo,
@RequestParam(value = "childOrderNo" , required = false) String childOrderNo,
@RequestParam(value = "userPhone" , required = false) String userPhone,
@RequestParam(value = "goodsName" , required = false) String goodsName,
@RequestParam(value = "tradeNo" , required = false) String tradeNo,
@RequestParam(value = "payType" , required = false) Integer payType,
@RequestParam(value = "status" , required = false) Integer status,
@RequestParam(value = "createTimeS" , required = false) Long createTimeS,
@RequestParam(value = "createTimeE" , required = false) Long createTimeE,
@RequestParam(value = "finishTimeS" , required = false) Long finishTimeS,
@RequestParam(value = "finishTimeE" , required = false) Long finishTimeE,
@RequestParam(value = "pageNum" , required = true) Integer pageNum,
@RequestParam(value = "pageSize" , required = true) Integer pageSize) {
try {
Map<String , Object> map = new HashMap<>();
map.put("orderNo", orderNo);
map.put("childOrderNo", childOrderNo);
map.put("userPhone", userPhone);
map.put("tradeNo", tradeNo);
map.put("goodsName", goodsName);
map.put("payType", payType);
map.put("createTimeS", createTimeS);
map.put("createTimeE", createTimeE);
map.put("finishTimeS", finishTimeS);
map.put("finishTimeE", finishTimeE);
map.put("status", status);
return ResponseMsgUtil.success(servicePrice); PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(bsOrderMeiTuanService.getOrderList(map)));
} catch (Exception e) { } catch (Exception e) {
log.error("error!",e); log.error("error!",e);

@ -0,0 +1,447 @@
package com.order.controller.business;
import com.alibaba.excel.EasyExcel;
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.DateUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.BsOrderGoods;
import com.hfkj.entity.FileRecords;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.order.orderExport.MerOrderSettlementDetailModel;
import com.hfkj.model.order.orderExport.OrderGoodsExportModel;
import com.hfkj.model.order.orderExport.OrderSettlementModel;
import com.hfkj.model.order.orderExport.OrderSettlementSumModel;
import com.hfkj.service.file.FileRecordsService;
import com.hfkj.service.order.OrderSettlementService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import com.hfkj.sysenum.fileRecords.FileRecordsEnum;
import com.hfkj.sysenum.order.OrderChildStatusEnum;
import com.hfkj.sysenum.order.OrderPayChannelEnum;
import com.hfkj.sysenum.order.OrderPayTypeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.beanutils.BeanUtils;
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.io.File;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@Controller
@RequestMapping(value="/settlement")
@Api(value="订单统计业务")
public class OrderSettlementController {
private static final Logger log = LoggerFactory.getLogger(OrderSettlementController.class);
@Resource
private UserCenter userCenter;
@Resource
private OrderSettlementService orderSettlementService;
@Resource
private FileRecordsService fileRecordsService;
@RequestMapping(value="/settlementDetail",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "结算详情")
public ResponseData settlementDetail(@RequestParam(value = "platform" , required = false) String platform,
@RequestParam(value = "merId" , required = false) Long merId,
@RequestParam(value = "payType" , required = false) Long payType,
@RequestParam(value = "finishTimeS" , required = false) Long finishTimeS,
@RequestParam(value = "finishTimeE" , required = false) Long finishTimeE, HttpServletRequest request) {
try {
Map<String,Object> param = new HashMap<>();
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) {
param.put("merId", merId);
}
if (SecUserObjectTypeEnum.type2.getCode() == userModel.getAccount().getObjectType()) {
param.put("merId", userModel.getAccount().getObjectId());
}
param.put("platform", platform);
param.put("payType", payType);
param.put("finishTimeS", finishTimeS);
param.put("finishTimeE", finishTimeE);
return ResponseMsgUtil.success(orderSettlementService.getDetail(param));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/exportSettlementDetail",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "导出结算详情")
public ResponseData exportSettlementDetail(@RequestParam(value = "platform" , required = false) String platform,
@RequestParam(value = "merId" , required = false) Long merId,
@RequestParam(value = "payType" , required = false) Long payType,
@RequestParam(value = "finishTimeS" , required = false) Long finishTimeS,
@RequestParam(value = "finishTimeE" , required = false) Long finishTimeE, HttpServletRequest request) {
// 插入下载记录
FileRecords fileRecords = new FileRecords();
try {
Map<String,Object> param = new HashMap<>();
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) {
param.put("merId", merId);
}
if (SecUserObjectTypeEnum.type2.getCode() == userModel.getAccount().getObjectType()) {
param.put("merId", userModel.getAccount().getObjectId());
}
param.put("platform", platform);
param.put("payType", payType);
param.put("finishTimeS", finishTimeS);
param.put("finishTimeE", finishTimeE);
String dataSting = DateUtil.date2String(new Date(), DateUtil.YMDHMS);
String fileUrl = CommonSysConst.getSysConfig().getFileUrl();
String filePath = "/temporary/" + userModel.getAccount().getId() + "/" ;
String pathName = filePath + FileRecordsEnum.status10.getName() + "交易数据导出" + dataSting +".xlsx";
if (fileRecordsService.findExported(param.toString() , userModel.getAccount().getId())) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "相同导出内容请勿重复点击!");
}
fileRecords.setCreateTime(new Date());
fileRecords.setBusinessType(FileRecordsEnum.status10.getCode());
fileRecords.setDownloadConditions(param.toString());
fileRecords.setOpId(userModel.getAccount().getId());
fileRecords.setOpName(userModel.getAccount().getUserName());
fileRecords.setStatus(2);
fileRecords.setDownloadStatus(2);
fileRecords.setFileUrl(CommonSysConst.getSysConfig().getDomainName() + "/filesystem" + pathName);
fileRecords.setType("2");
fileRecords.setTitle(FileRecordsEnum.status10.getName() + "交易数据导出" + dataSting + ".xls");
fileRecordsService.create(fileRecords);
// 创建线程
ThreadPoolExecutor executor = new ThreadPoolExecutor(
2, // 核心线程数
5, // 最大线程数
1, // 线程空闲时间
TimeUnit.MINUTES, // 时间单位
new ArrayBlockingQueue<>(5), // 任务队列
new ThreadPoolExecutor.CallerRunsPolicy() // 拒绝策略
);
// 提交任务给线程池
executor.execute(() -> {
try {
List<MerOrderSettlementDetailModel> list = orderSettlementService.getDetail(param);
File file = new File(fileUrl + filePath);
if (!file.exists()) {
file.mkdirs();
}
EasyExcel.write(fileUrl+pathName)
.head(OrderGoodsExportModel.class)
.sheet(fileRecords.getTitle())
.doWrite(list);
fileRecords.setStatus(1);
fileRecords.setUpdateTime(new Date());
fileRecordsService.update(fileRecords);
} catch (Exception e) {
fileRecords.setStatus(3);
fileRecords.setUpdateTime(new Date());
fileRecords.setExt1(e.toString());
fileRecordsService.update(fileRecords);
log.error("error!",e);
}
});
// 关闭线程池
executor.shutdown();
return ResponseMsgUtil.success(fileRecords);
} catch (Exception e) {
fileRecords.setStatus(3);
fileRecords.setUpdateTime(new Date());
fileRecordsService.update(fileRecords);
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getSettlement",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "结算详情")
public ResponseData getSettlement(@RequestParam(value = "platform" , required = false) String platform,
@RequestParam(value = "merId" , required = false) Long merId,
@RequestParam(value = "payType" , required = false) Long payType,
@RequestParam(value = "finishTimeS" , required = false) Long finishTimeS,
@RequestParam(value = "finishTimeE" , required = false) Long finishTimeE) {
try {
Map<String,Object> param = new HashMap<>();
SecUserSessionObject userSessionObject = userCenter.getSessionModel(SecUserSessionObject.class);
if (SecUserObjectTypeEnum.type2.getCode() == userSessionObject.getAccount().getObjectType()) {
param.put("merId", userSessionObject.getAccount().getObjectId());
}
param.put("platform", platform);
param.put("payType", payType);
param.put("finishTimeS", finishTimeS);
param.put("finishTimeE", finishTimeE);
return ResponseMsgUtil.success(orderSettlementService.getSettlement(param));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/exportSettlement",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "导出结算")
public ResponseData exportSettlement(@RequestParam(value = "platform" , required = false) String platform,
@RequestParam(value = "merId" , required = false) Long merId,
@RequestParam(value = "payType" , required = false) Long payType,
@RequestParam(value = "finishTimeS" , required = false) Long finishTimeS,
@RequestParam(value = "finishTimeE" , required = false) Long finishTimeE, HttpServletRequest request) {
// 插入下载记录
FileRecords fileRecords = new FileRecords();
try {
Map<String,Object> param = new HashMap<>();
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) {
param.put("merId", merId);
}
if (SecUserObjectTypeEnum.type2.getCode() == userModel.getAccount().getObjectType()) {
param.put("merId", userModel.getAccount().getObjectId());
}
param.put("platform", platform);
param.put("payType", payType);
param.put("finishTimeS", finishTimeS);
param.put("finishTimeE", finishTimeE);
String dataSting = DateUtil.date2String(new Date(), DateUtil.YMDHMS);
String fileUrl = CommonSysConst.getSysConfig().getFileUrl();
String filePath = "/temporary/" + userModel.getAccount().getId() + "/" ;
String pathName = filePath + FileRecordsEnum.status11.getName() + "交易数据导出" + dataSting +".xlsx";
if (fileRecordsService.findExported(param.toString() , userModel.getAccount().getId())) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "相同导出内容请勿重复点击!");
}
fileRecords.setCreateTime(new Date());
fileRecords.setBusinessType(FileRecordsEnum.status11.getCode());
fileRecords.setDownloadConditions(param.toString());
fileRecords.setOpId(userModel.getAccount().getId());
fileRecords.setOpName(userModel.getAccount().getUserName());
fileRecords.setStatus(2);
fileRecords.setDownloadStatus(2);
fileRecords.setFileUrl(CommonSysConst.getSysConfig().getDomainName() + "/filesystem" + pathName);
fileRecords.setType("2");
fileRecords.setTitle(FileRecordsEnum.status11.getName() + "交易数据导出" + dataSting + ".xls");
fileRecordsService.create(fileRecords);
// 创建线程
ThreadPoolExecutor executor = new ThreadPoolExecutor(
2, // 核心线程数
5, // 最大线程数
1, // 线程空闲时间
TimeUnit.MINUTES, // 时间单位
new ArrayBlockingQueue<>(5), // 任务队列
new ThreadPoolExecutor.CallerRunsPolicy() // 拒绝策略
);
// 提交任务给线程池
executor.execute(() -> {
try {
List<OrderSettlementModel> list = orderSettlementService.getSettlement(param);
File file = new File(fileUrl + filePath);
if (!file.exists()) {
file.mkdirs();
}
EasyExcel.write(fileUrl+pathName)
.head(OrderGoodsExportModel.class)
.sheet(fileRecords.getTitle())
.doWrite(list);
fileRecords.setStatus(1);
fileRecords.setUpdateTime(new Date());
fileRecordsService.update(fileRecords);
} catch (Exception e) {
fileRecords.setStatus(3);
fileRecords.setUpdateTime(new Date());
fileRecords.setExt1(e.toString());
fileRecordsService.update(fileRecords);
log.error("error!",e);
}
});
// 关闭线程池
executor.shutdown();
return ResponseMsgUtil.success(fileRecords);
} catch (Exception e) {
fileRecords.setStatus(3);
fileRecords.setUpdateTime(new Date());
fileRecordsService.update(fileRecords);
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getSum",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "结算总和")
public ResponseData getSum(@RequestParam(value = "platform" , required = false) String platform,
@RequestParam(value = "merId" , required = false) Long merId,
@RequestParam(value = "payType" , required = false) Long payType,
@RequestParam(value = "finishTimeS" , required = false) Long finishTimeS,
@RequestParam(value = "finishTimeE" , required = false) Long finishTimeE) {
try {
Map<String,Object> param = new HashMap<>();
SecUserSessionObject userSessionObject = userCenter.getSessionModel(SecUserSessionObject.class);
if (SecUserObjectTypeEnum.type2.getCode() == userSessionObject.getAccount().getObjectType()) {
param.put("merId", userSessionObject.getAccount().getObjectId());
}
param.put("platform", platform);
param.put("payType", payType);
param.put("finishTimeS", finishTimeS);
param.put("finishTimeE", finishTimeE);
return ResponseMsgUtil.success(orderSettlementService.getSum(param));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/exportSettlementSum",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "导出结算总和")
public ResponseData exportSettlementSum(@RequestParam(value = "platform" , required = false) String platform,
@RequestParam(value = "merId" , required = false) Long merId,
@RequestParam(value = "payType" , required = false) Long payType,
@RequestParam(value = "finishTimeS" , required = false) Long finishTimeS,
@RequestParam(value = "finishTimeE" , required = false) Long finishTimeE, HttpServletRequest request) {
// 插入下载记录
FileRecords fileRecords = new FileRecords();
try {
Map<String,Object> param = new HashMap<>();
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) {
param.put("merId", merId);
}
if (SecUserObjectTypeEnum.type2.getCode() == userModel.getAccount().getObjectType()) {
param.put("merId", userModel.getAccount().getObjectId());
}
param.put("platform", platform);
param.put("payType", payType);
param.put("finishTimeS", finishTimeS);
param.put("finishTimeE", finishTimeE);
String dataSting = DateUtil.date2String(new Date(), DateUtil.YMDHMS);
String fileUrl = CommonSysConst.getSysConfig().getFileUrl();
String filePath = "/temporary/" + userModel.getAccount().getId() + "/" ;
String pathName = filePath + FileRecordsEnum.status12.getName() + "交易数据导出" + dataSting +".xlsx";
if (fileRecordsService.findExported(param.toString() , userModel.getAccount().getId())) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "相同导出内容请勿重复点击!");
}
fileRecords.setCreateTime(new Date());
fileRecords.setBusinessType(FileRecordsEnum.status12.getCode());
fileRecords.setDownloadConditions(param.toString());
fileRecords.setOpId(userModel.getAccount().getId());
fileRecords.setOpName(userModel.getAccount().getUserName());
fileRecords.setStatus(2);
fileRecords.setDownloadStatus(2);
fileRecords.setFileUrl(CommonSysConst.getSysConfig().getDomainName() + "/filesystem" + pathName);
fileRecords.setType("2");
fileRecords.setTitle(FileRecordsEnum.status12.getName() + "交易数据导出" + dataSting + ".xls");
fileRecordsService.create(fileRecords);
// 创建线程
ThreadPoolExecutor executor = new ThreadPoolExecutor(
2, // 核心线程数
5, // 最大线程数
1, // 线程空闲时间
TimeUnit.MINUTES, // 时间单位
new ArrayBlockingQueue<>(5), // 任务队列
new ThreadPoolExecutor.CallerRunsPolicy() // 拒绝策略
);
// 提交任务给线程池
executor.execute(() -> {
try {
List<OrderSettlementSumModel> list = orderSettlementService.getSum(param);
File file = new File(fileUrl + filePath);
if (!file.exists()) {
file.mkdirs();
}
EasyExcel.write(fileUrl+pathName)
.head(OrderGoodsExportModel.class)
.sheet(fileRecords.getTitle())
.doWrite(list);
fileRecords.setStatus(1);
fileRecords.setUpdateTime(new Date());
fileRecordsService.update(fileRecords);
} catch (Exception e) {
fileRecords.setStatus(3);
fileRecords.setUpdateTime(new Date());
fileRecords.setExt1(e.toString());
fileRecordsService.update(fileRecords);
log.error("error!",e);
}
});
// 关闭线程池
executor.shutdown();
return ResponseMsgUtil.success(fileRecords);
} catch (Exception e) {
fileRecords.setStatus(3);
fileRecords.setUpdateTime(new Date());
fileRecordsService.update(fileRecords);
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -19,14 +19,11 @@ import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
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.annotation.Resource;
import java.util.Date; import java.math.BigDecimal;
import java.util.Objects; import java.util.*;
@Controller @Controller
@RequestMapping(value = "/meiTuan") @RequestMapping(value = "/meiTuan")
@ -107,8 +104,7 @@ public class MeiTuanController {
JSONObject staffInfo = jsonObject.getJSONObject("staffInfo"); JSONObject staffInfo = jsonObject.getJSONObject("staffInfo");
object.put("thirdTradeNo", thirdTradeNo); object.put("thirdTradeNo", thirdTradeNo);
object.put("thirdPayUrl", "https://phgcs.dctpay.com/cweb/#/pages/meiTuanPay/index?tradeNo=" + jsonObject.getString("tradeNo") + "&goodsName=" + object.put("thirdPayUrl", "https://phg.dctpay.com/cweb/#/pages/meiTuanPay/index?tradeNo=" + jsonObject.getString("tradeNo") +
jsonObject.getString("goodsName") +
"&tradeAmount=" + jsonObject.getString("tradeAmount") + "&tradeAmount=" + jsonObject.getString("tradeAmount") +
"&outSidePhone=" + staffInfo.getString("staffPhone") "&outSidePhone=" + staffInfo.getString("staffPhone")
); );
@ -123,22 +119,64 @@ public class MeiTuanController {
// 退款 // 退款
if (Objects.equals(jsonObject.getString("method"), "trade.third.refund")) { if (Objects.equals(jsonObject.getString("method"), "trade.third.refund")) {
BsOrderRefund orderRefund = orderRefundService.meiTuanRefund( // 查询退款订
jsonObject.getString("tradeRefundNo") , BsOrderRefund bsOrderRefund = orderRefundService.getRefundByTradeRefundNo(jsonObject.getString("tradeRefundNo"));
jsonObject.getString("tradeNo") ,
jsonObject.getBigDecimal("refundAmount") , if (bsOrderRefund != null) {
"美团退款" // 美团退款订单
JSONObject object = new JSONObject();
object.put("thirdRefundNo" , bsOrderRefund.getRefundOrderNo());
log.info("美团退款订单-参数: {}", object);
JSONObject data = new JSONObject();
data.put("status", 0);
data.put("msg", "成功");
data.put("data", EncryptUtil.aesEncrypt(object.toJSONString() , CommonSysConst.getSysConfig().getMtSecretKey()));
log.info("============回调任务End=============");
return data;
} else {
BsOrderMeituan bsOrderMeituan = bsOrderMeiTuanService.findOrderMeiTuanByTradeNo(jsonObject.getString("tradeNo"));
Map<String , Object> refundMap = new HashMap<>();
refundMap.put("orderNo", bsOrderMeituan.getOrderNo());
List<BsOrderRefund> refundList = orderRefundService.getRefundList(refundMap);
BigDecimal refundListPrice = new BigDecimal(0);
for (BsOrderRefund refund : refundList) {
refundListPrice = refundListPrice.add(refund.getTradeRefundPrice());
}
if (bsOrderMeituan.getTradeAmount().compareTo(refundListPrice.add(jsonObject.getBigDecimal("refundAmount"))) > -1) {
BsOrderRefund orderRefund = orderRefundService.meiTuanRefund(
jsonObject.getString("tradeRefundNo") ,
jsonObject.getString("tradeNo") ,
jsonObject.getBigDecimal("refundAmount") ,
"美团退款"
); );
// 美团退款订单 // 美团退款订单
JSONObject object = new JSONObject(); JSONObject object = new JSONObject();
object.put("thirdRefundNo" , orderRefund.getRefundOrderNo()); object.put("thirdRefundNo" , orderRefund.getRefundOrderNo());
log.info("美团关闭订单-参数: {}", object); log.info("美团退款订单-参数: {}", object);
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("status", 0); data.put("status", 0);
data.put("msg", "成功"); data.put("msg", "成功");
data.put("data", EncryptUtil.aesEncrypt(object.toJSONString() , CommonSysConst.getSysConfig().getMtSecretKey())); data.put("data", EncryptUtil.aesEncrypt(object.toJSONString() , CommonSysConst.getSysConfig().getMtSecretKey()));
log.info("============回调任务End============="); log.info("============回调任务End=============");
return data; return data;
} else {
JSONObject data = new JSONObject();
data.put("status", 411);
data.put("traceId", jsonObject.getString("traceId"));
data.put("msg", "退款超额");
data.put("data", null);
log.info("美团退款超额订单-参数: {}", data);
log.info("============回调任务End=============");
return data;
}
}
} }
// 交易关单 // 交易关单
@ -203,4 +241,53 @@ public class MeiTuanController {
return e; return e;
} }
} }
@RequestMapping(value = "/orderPush", method = RequestMethod.POST)
@ApiOperation(value = "订单状态变更回调")
@ResponseBody
public Object orderPush(
@RequestParam(name = "traceId", required = false) String traceId,
@RequestParam(name = "accessKey", required = false) String accessKey,
@RequestParam(name = "content", required = false) String content
) {
try {
log.info("============回调任务Start=============");
if (accessKey == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "accessKey错误");
}
if (!Objects.equals(accessKey, CommonSysConst.getSysConfig().getMtAccessKey())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "accessKey错误");
}
if (content == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "content错误");
}
JSONObject jsonObject = JSONObject.parseObject(EncryptUtil.aesDecrypt(content, CommonSysConst.getSysConfig().getMtSecretKey()));;
log.info("美团-解密参数: {}", jsonObject);
JSONObject object = jsonObject.getJSONObject("data");
BsOrderMeituan orderMeiTuan = bsOrderMeiTuanService.findOrderMeiTuanBySqtBizOrderId(object.getString("sqtBizOrderId"));
if (orderMeiTuan != null) {
bsOrderMeiTuanService.orderFinish(orderMeiTuan.getChildOrderNo());
}
JSONObject data = new JSONObject();
data.put("status", 0);
data.put("msg", "成功");
data.put("data", new JSONObject());
log.info("============回调任务End=============");
return data;
} catch (Exception e) {
log.error("WechatPayController --> wechatNotify() error!", e);
return e;
}
}
} }

@ -134,7 +134,7 @@ public class CommonSysConfig {
/** /**
* 美团接口请求参数 * 美团接口请求参数
*/ */
private String mtNotifyUrl; private String entId;
private String mtAccessKey; private String mtAccessKey;
private String mtSecretKey; private String mtSecretKey;
private String mtPostUrl; private String mtPostUrl;

@ -34,7 +34,7 @@ public class MeiTuanService {
*/ */
public static JSONObject loginFree(Map<String , Object> map) throws Exception { public static JSONObject loginFree(Map<String , Object> map) throws Exception {
JSONObject object = doPostMeiTuanUrl("https://waimai-openapi.apigw.test.meituan.com/api/sqt/open/login/h5/loginFree/redirection?test_open_swimlane=test-open" , map); JSONObject object = doPostMeiTuanUrl("login/h5/loginFree/redirection", map);
if (object.getBoolean("msg")) { if (object.getBoolean("msg")) {
return object; return object;
@ -44,6 +44,28 @@ public class MeiTuanService {
} }
/**
* @MethodName queryDetail
* @Description: 查询订单
* @param map
* @return: com.alibaba.fastjson.JSONObject
* @Author: Sum1Dream
* @Date: 2024/9/26 下午2:08
*/
public static JSONObject queryDetail(Map<String , Object> map) {
try {
JSONObject object = request(CommonSysConst.getSysConfig().getMtPostUrl() + "order/queryDetail", map);
return JSONObject.parseObject(EncryptUtil.aesDecrypt(object.getString("data") , CommonSysConst.getSysConfig().getMtSecretKey()));
} catch (Exception e) {
log.info("响应错误信息:{}", e);
}
return null;
}
/** /**
* @MethodName paySuccess * @MethodName paySuccess
* @Description: 支付成功通知接口 * @Description: 支付成功通知接口
@ -90,23 +112,23 @@ public class MeiTuanService {
/** /**
* @MethodName doPostMeiTuanUrl * @MethodName doPostMeiTuanUrl
* @Description: 美团免登陆接口 * @Description: 请求
* @param postUrl * @param url
* @param param * @param param
* @return: com.alibaba.fastjson.JSONObject * @return: com.alibaba.fastjson.JSONObject
* @Author: Sum1Dream * @Author: Sum1Dream
* @Date: 2024/9/18 下午5:44 * @Date: 2024/9/18 下午5:44
*/ */
public static JSONObject doPostMeiTuanUrl(String postUrl, Map<String,Object> param) throws Exception { public static JSONObject doPostMeiTuanUrl(String url, Map<String,Object> param) throws Exception {
log.info("============ 美团请求-START ============="); log.info("============ 美团请求-START =============");
param.put("accessKey", CommonSysConst.getSysConfig().getMtAccessKey()); param.put("accessKey", CommonSysConst.getSysConfig().getMtAccessKey());
param.put("content", EncryptUtil.aesEncrypt(JsonUtil.object2Json(param), CommonSysConst.getSysConfig().getMtSecretKey())); param.put("content", EncryptUtil.aesEncrypt(JsonUtil.object2Json(param), CommonSysConst.getSysConfig().getMtSecretKey()));
log.info("请求接口:" + postUrl); log.info("请求接口:" + url);
log.info("请求参数:" + JSONObject.toJSONString(param)); log.info("请求参数:" + JSONObject.toJSONString(param));
JSONObject response = HttpsUtils.doPostMeiTuanUrl(postUrl, JSONObject.toJSONString(param)); JSONObject response = HttpsUtils.doPostMeiTuanUrl(CommonSysConst.getSysConfig().getMtPostUrl() + url, JSONObject.toJSONString(param));
log.info("响应参数:" + response.toJSONString()); log.info("响应参数:" + response.toJSONString());
log.info("============ 美团请求-END =============="); log.info("============ 美团请求-END ==============");

@ -0,0 +1,58 @@
package com.hfkj.model.order.orderExport;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @ClassName MerOrderSettlementDetailModel
* @Author Sum1Dream
* @Description 商户订单结算详情
* @Date 2024/9/29 上午10:50
**/
@Data
public class MerOrderSettlementDetailModel {
@ColumnWidth(50)
@ExcelProperty("商品名称")
public String goodsName;
@ColumnWidth(20)
@ExcelProperty("商户名称")
public String merName;
@ColumnWidth(20)
@ExcelProperty("业务类型")
public String businessType;
@ColumnWidth(20)
@ExcelProperty("登录平台")
public String platform;
@ColumnWidth(40)
@ExcelProperty("订单号")
public String orderNo;
@ColumnWidth(15)
@ExcelProperty("子订单号")
public String childOrderNo;
@ColumnWidth(20)
@ExcelProperty("业务信息")
public String business;
@ColumnWidth(20)
@ExcelProperty({"支付金额"})
public BigDecimal payRealPrice;
@ColumnWidth(20)
@ExcelProperty({"支付方式"})
public String payType;
@ColumnWidth(20)
@ExcelProperty("收货时间")
public String finishTime;
}

@ -0,0 +1,120 @@
package com.hfkj.model.order.orderExport;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @ClassName OrderGoodsExportModel
* @Author Sum1Dream
* @Description 实物订单导出
* @Date 2024/8/12 下午5:07
**/
@Data
public class OrderMeiTuanExportModel {
@ColumnWidth(50)
@ExcelProperty("商品名称")
public String goodsName;
@ColumnWidth(20)
@ExcelProperty("商户名称")
public String merName;
@ColumnWidth(20)
@ExcelProperty("类型名称")
public String goodsTypeName;
@ColumnWidth(20)
@ExcelProperty("品牌名称")
public String goodsBrandName;
@ColumnWidth(20)
@ExcelProperty("用户手机号")
public String userPhone;
@ColumnWidth(40)
@ExcelProperty("订单号")
public String orderNo;
@ColumnWidth(15)
@ExcelProperty("子订单号")
public String childOrderNo;
@ColumnWidth(20)
@ExcelProperty("物流单号")
public String logisticsNo;
@ColumnWidth(30)
@ExcelProperty("商品规格")
public String goodsSpecsName;
@ColumnWidth(20)
@ExcelProperty("商品价格")
public BigDecimal goodsPrice;
@ColumnWidth(20)
@ExcelProperty("购买数量")
public Integer goodsCount;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "订单金额"})
public BigDecimal totalPrice;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "总优惠"})
public BigDecimal totalDeductionPrice;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "优惠券优惠"})
public BigDecimal couponDiscountPrice;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "积分抵扣"})
public BigDecimal integralDiscountPrice;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "实付金额"})
public BigDecimal payRealPrice;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "支付渠道"})
public String payChannel;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "支付方式"})
public String payType;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "支付单号"})
public String paySerialNo;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "交易状态"})
public String tradeStatus;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "创建时间"})
public Date createTime;
@ColumnWidth(20)
@ExcelProperty({"交易信息", "支付时间"})
public Date payTime;
@ColumnWidth(20)
@ExcelProperty("物流状态")
public String logisticsStatusDesc;
@ColumnWidth(20)
@ExcelProperty("更新时间")
public Date updateTime;
@ColumnWidth(20)
@ExcelProperty("确认收货时间")
public Date finishTime;
}

@ -0,0 +1,39 @@
package com.hfkj.model.order.orderExport;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @ClassName MerOrderSettlementDetailModel
* @Author Sum1Dream
* @Description 商户订单结算详情
* @Date 2024/9/29 上午10:50
**/
@Data
public class OrderSettlementModel {
@ColumnWidth(40)
@ExcelProperty("商户名称")
public String merName;
@ColumnWidth(20)
@ExcelProperty("支付方式")
public String payType;
@ColumnWidth(20)
@ExcelProperty("业务类型")
public String businessType;
@ColumnWidth(20)
@ExcelProperty({"结算金额"})
public BigDecimal payRealPrice;
@ColumnWidth(30)
@ExcelProperty("结算日期")
public String time;
}

@ -0,0 +1,34 @@
package com.hfkj.model.order.orderExport;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @ClassName MerOrderSettlementDetailModel
* @Author Sum1Dream
* @Description 商户订单结算详情
* @Date 2024/9/29 上午10:50
**/
@Data
public class OrderSettlementSumModel {
@ColumnWidth(20)
@ExcelProperty("业务类型")
public String businessType;
@ColumnWidth(20)
@ExcelProperty("支付方式")
public String payType;
@ColumnWidth(20)
@ExcelProperty({"结算金额"})
public BigDecimal payRealPrice;
@ColumnWidth(30)
@ExcelProperty("结算日期")
public String time;
}

@ -41,4 +41,14 @@ public interface BsOrderCouponService {
*/ */
List<OrderCouponModel> getOrderList(Map<String,Object> param); List<OrderCouponModel> getOrderList(Map<String,Object> param);
/**
* @MethodName getOrderCouponList
* @Description: 查询卡券订单列表
* @param map
* @return: java.util.List<com.hfkj.entity.BsOrderCoupon>
* @Author: Sum1Dream
* @Date: 2024/9/29 下午3:55
*/
List<BsOrderCoupon> getOrderCouponList(Map<String,Object> map);
} }

@ -11,6 +11,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -67,5 +68,28 @@ public class BsOrderCouponServiceImpl implements BsOrderCouponService {
return orderCouponMapper.getOrderList(param); return orderCouponMapper.getOrderList(param);
} }
@Override
public List<BsOrderCoupon> getOrderCouponList(Map<String, Object> map) {
BsOrderCouponExample example = new BsOrderCouponExample();
BsOrderCouponExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "finishTimeS") != null) {
criteria.andUpdateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "finishTimeS")));
}
if (MapUtils.getLong(map, "finishTimeE") != null) {
criteria.andUpdateTimeLessThan(new Date(MapUtils.getLong(map, "finishTimeE")));
}
if (MapUtils.getLong(map, "merId") != null) {
criteria.andMerIdEqualTo(MapUtils.getLong(map, "merId"));
}
if (MapUtils.getInteger(map, "payType") != null) {
criteria.andPayTypeEqualTo(MapUtils.getInteger(map, "payType"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "platform"))) {
criteria.andPlatformCodeEqualTo(MapUtils.getString(map, "platform"));
}
criteria.andStatusEqualTo(2);
return orderCouponMapper.selectByExample(example);
}
} }

@ -74,4 +74,15 @@ public interface BsOrderCinemaService {
* @Date: 2024/7/4 下午2:35 * @Date: 2024/7/4 下午2:35
*/ */
List<BsOrderCinema> getList(Map<String , Object> map); List<BsOrderCinema> getList(Map<String , Object> map);
/**
* @MethodName getListFinish
* @Description:
* @param map
* @return: java.util.List<com.hfkj.entity.BsOrderCinema>
* @Author: Sum1Dream
* @Date: 2024/9/29 下午4:24
*/
List<BsOrderCinema> getListFinish(Map<String , Object> map);
} }

@ -97,7 +97,7 @@ public interface BsOrderGoodsService {
* @return java.util.List<com.hfkj.entity.GoodsBrand> * @return java.util.List<com.hfkj.entity.GoodsBrand>
*/ */
List<BsOrderGoods> getList(Map<String , Object> map); List<BsOrderGoods> getList(Map<String , Object> map);
List<BsOrderGoods> getList(); List<BsOrderGoods> getListFinish(Map<String , Object> map);
/** /**
* @Author Sum1Dream * @Author Sum1Dream

@ -2,6 +2,9 @@ package com.hfkj.service.goods;
import com.hfkj.entity.BsOrderMeituan; import com.hfkj.entity.BsOrderMeituan;
import java.util.List;
import java.util.Map;
public interface BsOrderMeiTuanService { public interface BsOrderMeiTuanService {
/** /**
@ -62,6 +65,35 @@ public interface BsOrderMeiTuanService {
*/ */
BsOrderMeituan findOrderMeiTuanByTradeNo(String tradeNo); BsOrderMeituan findOrderMeiTuanByTradeNo(String tradeNo);
/**
* @MethodName findOrderMeiTuanBySqtBizOrderId
* @Description:
* @param sqtBizOrderId
* @return: com.hfkj.entity.BsOrderMeituan
* @Author: Sum1Dream
* @Date: 2024/9/26 下午3:39
*/
BsOrderMeituan findOrderMeiTuanBySqtBizOrderId(String sqtBizOrderId);
/**
* @MethodName getOrderList
* @Description: 查询美团订单
* @param map
* @return: java.util.List<com.hfkj.entity.BsOrderMeituan>
* @Author: Sum1Dream
* @Date: 2024/9/26 下午1:45
*/
List<BsOrderMeituan> getOrderList(Map<String , Object> map);
/**
* @MethodName getOrderListFinish
* @Description:
* @param map
* @return: java.util.List<com.hfkj.entity.BsOrderMeituan>
* @Author: Sum1Dream
* @Date: 2024/9/29 下午4:34
*/
List<BsOrderMeituan> getOrderListFinish(Map<String , Object> map);
void orderFinish(String childNo);
} }

@ -55,6 +55,15 @@ public interface BsOrderMemberService {
* @Date: 2024/9/5 下午4:22 * @Date: 2024/9/5 下午4:22
*/ */
BsOrderMember findGoodsOrder(String orderNo); BsOrderMember findGoodsOrder(String orderNo);
/**
* @MethodName findGoodsOrderByChildNo
* @Description: 根据子订单号查询
* @param childNo
* @return: com.hfkj.entity.BsOrderMember
* @Author: Sum1Dream
* @Date: 2024/9/25 上午10:50
*/
BsOrderMember findGoodsOrderByChildNo(String childNo);
/** /**
* @MethodName queryDetailByMap * @MethodName queryDetailByMap
@ -75,4 +84,13 @@ public interface BsOrderMemberService {
* @Date: 2024/9/5 下午4:27 * @Date: 2024/9/5 下午4:27
*/ */
List<BsOrderMember> getList(Map<String , Object> map); List<BsOrderMember> getList(Map<String , Object> map);
/**
* @MethodName getListFinish
* @Description:
* @param map
* @return: java.util.List<com.hfkj.entity.BsOrderMember>
* @Author: Sum1Dream
* @Date: 2024/9/29 下午4:38
*/
List<BsOrderMember> getListFinish(Map<String , Object> map);
} }

@ -81,6 +81,15 @@ public interface BsOrderStarbucksService {
* @Date: 2024/7/4 下午2:35 * @Date: 2024/7/4 下午2:35
*/ */
List<BsOrderStarbucks> getList(Map<String , Object> map); List<BsOrderStarbucks> getList(Map<String , Object> map);
/**
* @MethodName getListFinish
* @Description:
* @param map
* @return: java.util.List<com.hfkj.entity.BsOrderStarbucks>
* @Author: Sum1Dream
* @Date: 2024/9/29 下午4:36
*/
List<BsOrderStarbucks> getListFinish(Map<String , Object> map);
/** /**
* @MethodName updateOrderStatus * @MethodName updateOrderStatus

@ -11,10 +11,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collections; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("bsOrderCinemaService") @Service("bsOrderCinemaService")
public class BsOrderCinemaServiceImpl implements BsOrderCinemaService { public class BsOrderCinemaServiceImpl implements BsOrderCinemaService {
@ -106,4 +103,31 @@ public class BsOrderCinemaServiceImpl implements BsOrderCinemaService {
example.setOrderByClause("exception_status desc"); example.setOrderByClause("exception_status desc");
return bsOrderCinemaMapper.selectByExample(example); return bsOrderCinemaMapper.selectByExample(example);
} }
@Override
public List<BsOrderCinema> getListFinish(Map<String, Object> map) {
BsOrderCinemaExample example = new BsOrderCinemaExample();
BsOrderCinemaExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "finishTimeS") != null) {
criteria.andUpdateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "finishTimeS")));
}
if (MapUtils.getLong(map, "finishTimeE") != null) {
criteria.andUpdateTimeLessThan(new Date(MapUtils.getLong(map, "finishTimeE")));
}
if (MapUtils.getLong(map, "merId") != null) {
criteria.andMerIdEqualTo(MapUtils.getLong(map, "merId"));
}
if (MapUtils.getInteger(map, "payType") != null) {
criteria.andPayTypeEqualTo(MapUtils.getInteger(map, "payType"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "platform"))) {
criteria.andPlatformCodeEqualTo(MapUtils.getString(map, "platform"));
}
List<Integer> statusList = new ArrayList<>();
statusList.add(10);
statusList.add(15);
criteria.andStatusIn(statusList);
return bsOrderCinemaMapper.selectByExample(example);
}
} }

@ -194,9 +194,27 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService {
} }
@Override @Override
public List<BsOrderGoods> getList() { public List<BsOrderGoods> getListFinish(Map<String , Object> map) {
BsOrderGoodsExample example = new BsOrderGoodsExample(); BsOrderGoodsExample example = new BsOrderGoodsExample();
BsOrderGoodsExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "finishTimeS") != null) {
criteria.andFinishTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "finishTimeS")));
}
if (MapUtils.getLong(map, "finishTimeE") != null) {
criteria.andFinishTimeLessThan(new Date(MapUtils.getLong(map, "finishTimeE")));
}
if (MapUtils.getLong(map, "merId") != null) {
criteria.andMerIdEqualTo(MapUtils.getLong(map, "merId"));
} else {
criteria.andMerIdIsNotNull();
}
if (MapUtils.getInteger(map, "payType") != null) {
criteria.andPayTypeEqualTo(MapUtils.getInteger(map, "payType"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "platform"))) {
criteria.andPlatformCodeEqualTo(MapUtils.getString(map, "platform"));
}
criteria.andStatusEqualTo(3);
return bsOrderGoodsMapper.selectByExample(example); return bsOrderGoodsMapper.selectByExample(example);
} }

@ -1,13 +1,21 @@
package com.hfkj.service.goods.impl; package com.hfkj.service.goods.impl;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.dao.BsOrderMeituanMapper; import com.hfkj.dao.BsOrderMeituanMapper;
import com.hfkj.entity.BsOrderMeituan; import com.hfkj.entity.BsOrderMeituan;
import com.hfkj.entity.BsOrderMeituanExample; import com.hfkj.entity.BsOrderMeituanExample;
import com.hfkj.meituan.MeiTuanService;
import com.hfkj.service.goods.BsOrderMeiTuanService; import com.hfkj.service.goods.BsOrderMeiTuanService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.sysenum.order.OrderChildStatusEnum;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.*;
@Service("bsOrderMeiTuanService") @Service("bsOrderMeiTuanService")
public class BsOrderMeiTuanServiceImpl implements BsOrderMeiTuanService { public class BsOrderMeiTuanServiceImpl implements BsOrderMeiTuanService {
@ -15,6 +23,9 @@ public class BsOrderMeiTuanServiceImpl implements BsOrderMeiTuanService {
@Resource @Resource
private BsOrderMeituanMapper bsOrderMeituanMapper; private BsOrderMeituanMapper bsOrderMeituanMapper;
@Resource
private BsOrderService orderService;
@Override @Override
public void create(BsOrderMeituan orderMeiTuan) { public void create(BsOrderMeituan orderMeiTuan) {
bsOrderMeituanMapper.insert(orderMeiTuan); bsOrderMeituanMapper.insert(orderMeiTuan);
@ -64,4 +75,142 @@ public class BsOrderMeiTuanServiceImpl implements BsOrderMeiTuanService {
return null; return null;
} }
@Override
public BsOrderMeituan findOrderMeiTuanBySqtBizOrderId(String sqtBizOrderId) {
BsOrderMeituanExample example = new BsOrderMeituanExample();
BsOrderMeituanExample.Criteria criteria = example.createCriteria();
criteria.andSqtBizOrderIdEqualTo(sqtBizOrderId);
List<BsOrderMeituan> list = bsOrderMeituanMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public List<BsOrderMeituan> getOrderList(Map<String, Object> map) {
BsOrderMeituanExample example = new BsOrderMeituanExample();
BsOrderMeituanExample.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(MapUtils.getString(map, "orderNo"))) {
criteria.andOrderNoEqualTo(MapUtils.getString(map, "orderNo"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "childOrderNo"))) {
criteria.andChildOrderNoEqualTo(MapUtils.getString(map, "childOrderNo"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "tradeNo"))) {
criteria.andChildOrderNoEqualTo(MapUtils.getString(map, "tradeNo"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "userPhone"))) {
criteria.andUserPhoneEqualTo(MapUtils.getString(map, "userPhone"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "goodsName"))) {
criteria.andGoodsNameLike("%"+MapUtils.getString(map, "goodsName")+"%");
}
if (MapUtils.getInteger(map, "payType") != null) {
criteria.andPayTypeEqualTo(MapUtils.getInteger(map, "payType"));
}
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.getLong(map, "finishTimeS") != null) {
criteria.andFinishTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "finishTimeS")));
}
if (MapUtils.getLong(map, "finishTimeE") != null) {
criteria.andFinishTimeLessThan(new Date(MapUtils.getLong(map, "finishTimeE")));
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
}
example.setOrderByClause("create_time desc");
return bsOrderMeituanMapper.selectByExample(example);
}
@Override
public List<BsOrderMeituan> getOrderListFinish(Map<String, Object> map) {
BsOrderMeituanExample example = new BsOrderMeituanExample();
BsOrderMeituanExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "finishTimeS") != null) {
criteria.andFinishTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "finishTimeS")));
}
if (MapUtils.getLong(map, "finishTimeE") != null) {
criteria.andFinishTimeLessThan(new Date(MapUtils.getLong(map, "finishTimeE")));
}
if (MapUtils.getLong(map, "merId") != null) {
criteria.andMerIdEqualTo(MapUtils.getLong(map, "merId"));
}
if (MapUtils.getInteger(map, "payType") != null) {
criteria.andPayTypeEqualTo(MapUtils.getInteger(map, "payType"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "platform"))) {
criteria.andPlatformCodeEqualTo(MapUtils.getString(map, "platform"));
}
criteria.andStatusEqualTo(3);
return bsOrderMeituanMapper.selectByExample(example);
}
@Override
public void orderFinish(String childNo) {
BsOrderMeituan orderMeiTuan = findOrderMeiTuan(childNo);
if (orderMeiTuan != null) {
// 查询上游订单状态
Map<String , Object> map = new HashMap<>();
map.put("ts" , new Date().getTime());
map.put("entId" , CommonSysConst.getSysConfig().getEntId());
map.put("sqtBizOrderId" , orderMeiTuan.getSqtBizOrderId());
JSONObject object = MeiTuanService.queryDetail(map);
Boolean finish = false;
Date finshDate = new Date();
if (object != null) {
// 订单基本信息
JSONObject baseInfo = object.getJSONObject("baseInfo");
// 业务信息字段
JSONObject orderInfo = JSONObject.parseObject(object.getString("origOrderInfo"));
// 判断业务类型
// 到店
if (baseInfo.getString("firstBusinessType").equals("010")) {
// 判断是否完成
if (orderInfo.getInteger("groupConsumeStatus") == 10) {
finish = true;
}
}
// 外卖
if (baseInfo.getString("firstBusinessType").equals("020")) {
// 判断是否完成
if (orderInfo.getInteger("orderStatus") == 8) {
finish = true;
finshDate = DateUtil.StringToDate(orderInfo.getString("deliverTime") , "yyyy-MM-dd HH:mm:ss");
}
}
if (finish) {
// 子订单完成
orderService.childOrderComplete(childNo);
orderMeiTuan.setFinishTime(finshDate);
orderMeiTuan.setUpdateTime(new Date());
orderMeiTuan.setStatus(OrderChildStatusEnum.status3.getCode());
update(orderMeiTuan);
}
}
}
}
} }

@ -1,12 +1,17 @@
package com.hfkj.service.goods.impl; package com.hfkj.service.goods.impl;
import com.hfkj.dao.BsOrderMemberMapper; import com.hfkj.dao.BsOrderMemberMapper;
import com.hfkj.entity.BsOrderGoodsExample;
import com.hfkj.entity.BsOrderMember; import com.hfkj.entity.BsOrderMember;
import com.hfkj.entity.BsOrderMemberExample;
import com.hfkj.service.goods.BsOrderMemberService; import com.hfkj.service.goods.BsOrderMemberService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -41,6 +46,20 @@ public class BsOrderMemberServiceImpl implements BsOrderMemberService {
return null; return null;
} }
@Override
public BsOrderMember findGoodsOrderByChildNo(String childNo) {
BsOrderMemberExample example = new BsOrderMemberExample();
example.createCriteria().andChildOrderNoEqualTo(childNo);
List<BsOrderMember> list = bsOrderMemberMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override @Override
public BsOrderMember queryDetailByMap(Map<String, Object> map) { public BsOrderMember queryDetailByMap(Map<String, Object> map) {
return null; return null;
@ -48,6 +67,31 @@ public class BsOrderMemberServiceImpl implements BsOrderMemberService {
@Override @Override
public List<BsOrderMember> getList(Map<String, Object> map) { public List<BsOrderMember> getList(Map<String, Object> map) {
return Collections.emptyList(); return Collections.emptyList();
} }
@Override
public List<BsOrderMember> getListFinish(Map<String, Object> map) {
BsOrderMemberExample example = new BsOrderMemberExample();
BsOrderMemberExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "finishTimeS") != null) {
criteria.andFinishTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "finishTimeS")));
}
if (MapUtils.getLong(map, "finishTimeE") != null) {
criteria.andFinishTimeLessThan(new Date(MapUtils.getLong(map, "finishTimeE")));
}
if (MapUtils.getLong(map, "merId") != null) {
criteria.andMerIdEqualTo(MapUtils.getLong(map, "merId"));
}
if (MapUtils.getInteger(map, "payType") != null) {
criteria.andPayTypeEqualTo(MapUtils.getInteger(map, "payType"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "platform"))) {
criteria.andPlatformCodeEqualTo(MapUtils.getString(map, "platform"));
}
criteria.andStatusEqualTo(3);
return bsOrderMemberMapper.selectByExample(example);
}
} }

@ -95,6 +95,31 @@ public class BsOrderStarbucksServiceImpl implements BsOrderStarbucksService {
return bsOrderStarbucksMapper.selectByExample(example); return bsOrderStarbucksMapper.selectByExample(example);
} }
@Override
public List<BsOrderStarbucks> getListFinish(Map<String, Object> map) {
BsOrderStarbucksExample example = new BsOrderStarbucksExample();
BsOrderStarbucksExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "finishTimeS") != null) {
criteria.andUpdateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "finishTimeS")));
}
if (MapUtils.getLong(map, "finishTimeE") != null) {
criteria.andUpdateTimeLessThan(new Date(MapUtils.getLong(map, "finishTimeE")));
}
if (MapUtils.getLong(map, "merId") != null) {
criteria.andMerIdEqualTo(MapUtils.getLong(map, "merId"));
}
if (MapUtils.getInteger(map, "payType") != null) {
criteria.andPayTypeEqualTo(MapUtils.getInteger(map, "payType"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "platform"))) {
criteria.andPlatformCodeEqualTo(MapUtils.getString(map, "platform"));
}
criteria.andStatusEqualTo(15);
return bsOrderStarbucksMapper.selectByExample(example);
}
@Override @Override
public void updateOrderStatus(String orderNo, Integer status) { public void updateOrderStatus(String orderNo, Integer status) {
// 查询星巴克订单 // 查询星巴克订单

@ -1,18 +1,16 @@
package com.hfkj.service.order; package com.hfkj.service.order;
import com.hfkj.common.utils.RedisUtil; import com.hfkj.common.utils.RedisUtil;
import com.hfkj.entity.BsOrderChild; import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.BsOrderCoupon; import com.hfkj.entity.*;
import com.hfkj.entity.BsOrderMeituan;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.model.order.OrderChildModel; import com.hfkj.model.order.OrderChildModel;
import com.hfkj.model.order.OrderModel; import com.hfkj.model.order.OrderModel;
import com.hfkj.service.coupon.BsOrderCouponService; import com.hfkj.service.coupon.BsOrderCouponService;
import com.hfkj.service.goods.BsOrderMeiTuanService; import com.hfkj.service.goods.*;
import com.hfkj.service.goods.GoodsMsgService; import com.hfkj.sysenum.GoodsVpdSourceEnum;
import com.hfkj.service.goods.GoodsSpecsService;
import com.hfkj.sysenum.order.OrderChildProductTypeEnum; import com.hfkj.sysenum.order.OrderChildProductTypeEnum;
import com.hfkj.sysenum.order.OrderChildStatusEnum; import com.hfkj.sysenum.order.OrderChildStatusEnum;
import com.hfkj.yushang.YuShangService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -23,7 +21,9 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 取消订单业务 * 取消订单业务
@ -34,12 +34,8 @@ import java.util.List;
@Component @Component
public class OrderCancelService { public class OrderCancelService {
Logger log = LoggerFactory.getLogger(OrderCancelService.class); Logger log = LoggerFactory.getLogger(OrderCancelService.class);
@Autowired
private RedisUtil redisUtil;
@Resource @Resource
private BsOrderService orderService; private GoodsVpdService goodsVpdService;
@Resource
private BsOrderChildService orderChildService;
@Resource @Resource
private BsOrderCouponService orderCouponService; private BsOrderCouponService orderCouponService;
@Resource @Resource
@ -48,6 +44,8 @@ public class OrderCancelService {
private GoodsSpecsService goodsSpecsService; private GoodsSpecsService goodsSpecsService;
@Resource @Resource
private BsOrderMeiTuanService bsOrderMeiTuanService; private BsOrderMeiTuanService bsOrderMeiTuanService;
@Resource
private BsOrderMemberService bsOrderMemberService;
/** /**
* 订单业务处理 * 订单业务处理
* @param order * @param order
@ -78,11 +76,26 @@ public class OrderCancelService {
// 归库 // 归库
goodsSpecsService.editStockNum(orderChild.getProductSpecId(), orderChild.getProductCount(), 1); goodsSpecsService.editStockNum(orderChild.getProductSpecId(), orderChild.getProductCount(), 1);
// 虚拟 // 虚拟商品
BsOrderCoupon orderCoupon = orderCouponService.getDetailByChildOrderNo(orderChild.getChildOrderNo()); GoodsVpd vpd = goodsVpdService.queryDetailBySpecsId(orderChild.getProductSpecId());
orderCoupon.setCancelTime(new Date()); if (vpd.getSource() == GoodsVpdSourceEnum.type2.getCode()) {
orderCoupon.setStatus(OrderChildStatusEnum.status5.getCode()); BsOrderMember orderMember = bsOrderMemberService.findGoodsOrderByChildNo(orderChild.getChildOrderNo());
orderCouponService.editData(orderCoupon);
if (orderMember != null) {
orderMember.setUpdateTime(new Date());
orderMember.setStatus(OrderChildStatusEnum.status5.getCode());
bsOrderMemberService.update(orderMember);
}
} else {
// 虚拟
BsOrderCoupon orderCoupon = orderCouponService.getDetailByChildOrderNo(orderChild.getChildOrderNo());
orderCoupon.setCancelTime(new Date());
orderCoupon.setStatus(OrderChildStatusEnum.status5.getCode());
orderCouponService.editData(orderCoupon);
}
} }
} }

@ -20,13 +20,11 @@ import com.hfkj.service.coupon.BsOrderCouponService;
import com.hfkj.service.coupon.channel.HuiLianTongCouponService; import com.hfkj.service.coupon.channel.HuiLianTongCouponService;
import com.hfkj.service.goods.*; import com.hfkj.service.goods.*;
import com.hfkj.service.hlt.HuiLianTongUnionCardService; import com.hfkj.service.hlt.HuiLianTongUnionCardService;
import com.hfkj.service.impl.SecConfigServiceImpl;
import com.hfkj.sysenum.GoodsVpdSourceEnum; import com.hfkj.sysenum.GoodsVpdSourceEnum;
import com.hfkj.sysenum.order.*; import com.hfkj.sysenum.order.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -137,7 +135,7 @@ public class OrderCreateService {
orderMember.setMerId(orderChild.getMerId()); orderMember.setMerId(orderChild.getMerId());
orderMember.setPlatformCode(businessObj.getString("platformCode")); orderMember.setPlatformCode(businessObj.getString("platformCode"));
orderMember.setUserId(order.getUserId()); orderMember.setUserId(order.getUserId());
orderMember.setUserPhone(order.getUserPhone()); orderMember.setUserPhone(businessObj.getString("userPhone"));
orderMember.setGoodsId(goodsMsg.getId()); orderMember.setGoodsId(goodsMsg.getId());
orderMember.setGoodsName(goodsMsg.getTitle()); orderMember.setGoodsName(goodsMsg.getTitle());
orderMember.setGoodsTypeId(goodsMsg.getGoodsType()); orderMember.setGoodsTypeId(goodsMsg.getGoodsType());
@ -153,6 +151,8 @@ public class OrderCreateService {
orderMember.setGoodsVpdSource(goodsVpd.getSource()); orderMember.setGoodsVpdSource(goodsVpd.getSource());
orderMember.setGoodsCount(orderChild.getProductCount()); orderMember.setGoodsCount(orderChild.getProductCount());
orderMember.setStatus(OrderChildStatusEnum.status1.getCode()); orderMember.setStatus(OrderChildStatusEnum.status1.getCode());
orderMember.setUpdateTime(new Date());
orderMember.setCreateTime(new Date());
orderMemberService.create(orderMember); orderMemberService.create(orderMember);
} }
@ -541,7 +541,7 @@ public class OrderCreateService {
orderChild.setMerId(productConfig.getMerId()); orderChild.setMerId(productConfig.getMerId());
orderChild.setProductName(orderMeiTuan.getGoodsName()); orderChild.setProductName(orderMeiTuan.getGoodsName());
orderChild.setProductCount(1); orderChild.setProductCount(1);
orderChild.setProductImg("202409/1726638258182.png"); orderChild.setProductImg("202409/1727150603020.png");
orderChild.setProductSpecName(orderMeiTuan.getGoodsName()); orderChild.setProductSpecName(orderMeiTuan.getGoodsName());
orderChild.setProductPrice(orderMeiTuan.getTotalPrice()); orderChild.setProductPrice(orderMeiTuan.getTotalPrice());

@ -119,30 +119,31 @@ public class OrderPaySuccessService {
if (vpd.getSource() == GoodsVpdSourceEnum.type2.getCode()) { if (vpd.getSource() == GoodsVpdSourceEnum.type2.getCode()) {
BsOrderMember orderMember = bsOrderMemberService.findGoodsOrderByChildNo(childOrder.getChildOrderNo());
Map<String , Object> map = new HashMap<>();
map.put("productCode" , vpd.getKey()); if (orderMember != null) {
map.put("AppKey" , CommonSysConst.getSysConfig().getYuShangAppKey()); Map<String , Object> map = new HashMap<>();
map.put("BuyCount" , childOrder.getProductCount()); map.put("productCode" , vpd.getKey());
map.put("MOrderID" , childOrder.getChildOrderNo()); map.put("AppKey" , CommonSysConst.getSysConfig().getYuShangAppKey());
map.put("ChargeAccount" , childOrder.getChildOrderNo()); map.put("BuyCount" , childOrder.getProductCount());
// 推送给娱尚 map.put("MOrderID" , childOrder.getChildOrderNo());
YuShangService.insertV2(map); map.put("ChargeAccount" , orderMember.getUserPhone());
// 推送给娱尚
BsOrderMember orderMember = new BsOrderMember(); YuShangService.insertV2(map);
orderMember.setTotalPrice(childOrder.getProductTotalPrice());
orderMember.setTotalPrice(childOrder.getProductTotalPrice()); orderMember.setTotalDeductionPrice(childOrder.getTotalDeductionPrice());
orderMember.setTotalDeductionPrice(childOrder.getTotalDeductionPrice()); orderMember.setCouponDiscountPrice(childOrder.getCouponDiscountPrice());
orderMember.setCouponDiscountPrice(childOrder.getCouponDiscountPrice()); orderMember.setIntegralDiscountPrice(childOrder.getIntegralDiscountPrice());
orderMember.setIntegralDiscountPrice(childOrder.getIntegralDiscountPrice()); orderMember.setPayRealPrice(childOrder.getSurplusRefundPrice());
orderMember.setPayRealPrice(childOrder.getSurplusRefundPrice()); orderMember.setPayChannel(order.getPayChannel());
orderMember.setPayChannel(order.getPayChannel()); orderMember.setPayType(order.getPayType());
orderMember.setPayType(order.getPayType()); orderMember.setPaySerialNo(order.getPaySerialNo());
orderMember.setPaySerialNo(order.getPaySerialNo()); orderMember.setPayTime(order.getPayTime());
orderMember.setPayTime(order.getPayTime()); orderMember.setStatus(OrderChildStatusEnum.status3.getCode());
orderMember.setStatus(OrderChildStatusEnum.status3.getCode()); orderMember.setFinishTime(new Date());
orderMember.setUpdateTime(new Date()); orderMember.setUpdateTime(new Date());
bsOrderMemberService.update(orderMember); bsOrderMemberService.update(orderMember);
}
} else { } else {
// 查询卡券订单的卡密 // 查询卡券订单的卡密

@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -36,9 +37,10 @@ public class OrderRefundSuccessService {
private BsOrderCouponService orderCouponService; private BsOrderCouponService orderCouponService;
@Resource @Resource
private BsOrderStarbucksService bsOrderStarbucksService; private BsOrderStarbucksService bsOrderStarbucksService;
@Autowired @Resource
private BsOrderMeiTuanServiceImpl bsOrderMeiTuanService; private BsOrderMeiTuanServiceImpl bsOrderMeiTuanService;
@Resource
private BsOrderChildService bsOrderChildService;
/** /**
* 订单业务处理 * 订单业务处理
* @param orderChild * @param orderChild
@ -129,22 +131,12 @@ public class OrderRefundSuccessService {
*/ */
public void meiTuan(BsOrderChild childOrder) { public void meiTuan(BsOrderChild childOrder) {
// 美团退款 // 美团退款
BsOrderMeituan orderMeiTuan = bsOrderMeiTuanService.findOrderMeiTuan(childOrder.getOrderNo()); BsOrderMeituan orderMeiTuan = bsOrderMeiTuanService.findOrderMeiTuan(childOrder.getChildOrderNo());
try {
if (orderMeiTuan != null) { if (orderMeiTuan != null) {
Map<String , Object> map = new HashMap<>(); orderMeiTuan.setStatus(OrderChildStatusEnum.status4.getCode());
map.put("orderNo", childOrder.getOrderNo()); orderMeiTuan.setRefundTime(new Date());
CinemaService.refundMovieOrder(map); orderMeiTuan.setExceptionStatus(false);
orderMeiTuan.setStatus(OrderChildStatusEnum.status4.getCode());
orderMeiTuan.setRefundTime(new Date());
orderMeiTuan.setExceptionStatus(false);
bsOrderMeiTuanService.update(orderMeiTuan);
}
} catch (Exception e) {
orderMeiTuan.setExceptionStatus(true);
orderMeiTuan.setExceptionMsg(e.getMessage());
bsOrderMeiTuanService.update(orderMeiTuan); bsOrderMeiTuanService.update(orderMeiTuan);
} }

@ -0,0 +1,47 @@
package com.hfkj.service.order;
import com.hfkj.model.order.orderExport.MerOrderSettlementDetailModel;
import com.hfkj.model.order.orderExport.OrderSettlementModel;
import com.hfkj.model.order.orderExport.OrderSettlementSumModel;
import java.util.List;
import java.util.Map;
/**
* @ClassName OrderSettlementService
* @Author Sum1Dream
* @Description 订单结算
* @Date 2024/9/29 下午4:12
**/
public interface OrderSettlementService {
/**
* @MethodName getDetail
* @Description: 获取结算订单详情
* @param map
* @return: java.util.List<com.hfkj.model.order.orderExport.MerOrderSettlementDetailModel>
* @Author: Sum1Dream
* @Date: 2024/9/29 下午4:14
*/
List<MerOrderSettlementDetailModel> getDetail(Map<String,Object> map);
/**
* @MethodName getSettlement
* @Description: 结算订单
* @param map
* @return: java.util.List<com.hfkj.model.order.orderExport.OrderSettlementModel>
* @Author: Sum1Dream
* @Date: 2024/9/29 下午4:14
*/
List<OrderSettlementModel> getSettlement(Map<String,Object> map);
/**
* @MethodName getSum
* @Description: 结算总和
* @param map
* @return: java.util.List<com.hfkj.model.order.orderExport.OrderSettlementSumModel>
* @Author: Sum1Dream
* @Date: 2024/9/29 下午4:14
*/
List<OrderSettlementSumModel> getSum(Map<String,Object> map);
}

@ -3,8 +3,10 @@ package com.hfkj.service.order.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.utils.StarbucksUtil; import com.hfkj.common.utils.StarbucksUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.dao.BsOrderChildMapper; import com.hfkj.dao.BsOrderChildMapper;
import com.hfkj.entity.*; import com.hfkj.entity.*;
import com.hfkj.meituan.MeiTuanService;
import com.hfkj.model.order.OrderChildModel; import com.hfkj.model.order.OrderChildModel;
import com.hfkj.qianzhu.StarbucksService; import com.hfkj.qianzhu.StarbucksService;
import com.hfkj.service.BsProductConfigService; import com.hfkj.service.BsProductConfigService;
@ -15,6 +17,7 @@ import com.hfkj.service.order.BsOrderService;
import com.hfkj.sysenum.order.OrderChildProductTypeEnum; import com.hfkj.sysenum.order.OrderChildProductTypeEnum;
import com.hfkj.sysenum.order.OrderChildStatusEnum; import com.hfkj.sysenum.order.OrderChildStatusEnum;
import com.hfkj.sysenum.order.OrderLogisticsStatusEnum; import com.hfkj.sysenum.order.OrderLogisticsStatusEnum;
import com.meituan.sqt.utils.EncryptUtil;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -50,6 +53,11 @@ public class BsOrderChildServiceImpl implements BsOrderChildService {
@Resource @Resource
private BsOrderService orderService; private BsOrderService orderService;
@Resource
private BsOrderMeiTuanService orderMeiTuanService;
@Resource
private BsOrderMemberService orderMemberService;
@Override @Override
public void editData(BsOrderChild data) { public void editData(BsOrderChild data) {
@ -73,7 +81,6 @@ public class BsOrderChildServiceImpl implements BsOrderChildService {
return childModel; return childModel;
} }
return null; return null;
} }
@Override @Override
@ -128,7 +135,16 @@ public class BsOrderChildServiceImpl implements BsOrderChildService {
} }
} else if (childModel.getProductType().equals(OrderChildProductTypeEnum.type2.getCode())) { } else if (childModel.getProductType().equals(OrderChildProductTypeEnum.type2.getCode())) {
childModel.setBusiness(goodsVpdService.queryDetailBySpecsId(childModel.getProductSpecId()));
GoodsVpd goodsVpd = goodsVpdService.queryDetailBySpecsId(childModel.getProductSpecId());
if (goodsVpd.getSource() == 2) {
BsOrderMember orderMember = orderMemberService.findGoodsOrderByChildNo(childModel.getChildOrderNo());
if (orderMember != null) {
goodsVpd.setExt1(orderMember.getUserPhone());
}
}
childModel.setBusiness(goodsVpd);
} else if (childModel.getProductType().equals(OrderChildProductTypeEnum.type4.getCode())) { } else if (childModel.getProductType().equals(OrderChildProductTypeEnum.type4.getCode())) {
BsProductConfig productConfig = bsProductConfigService.queryDetail(OrderChildProductTypeEnum.type4.getCode()); BsProductConfig productConfig = bsProductConfigService.queryDetail(OrderChildProductTypeEnum.type4.getCode());
// 查询星巴克订单列表信息 // 查询星巴克订单列表信息
@ -200,6 +216,12 @@ public class BsOrderChildServiceImpl implements BsOrderChildService {
object.put("orderItemList", orderItemList); object.put("orderItemList", orderItemList);
childModel.setBusiness(object); childModel.setBusiness(object);
} else if (childModel.getProductType().equals(OrderChildProductTypeEnum.type5.getCode())) {
if (childModel.getStatus().equals(OrderChildStatusEnum.status2.getCode())) {
orderMeiTuanService.orderFinish(childModel.getChildOrderNo());
}
} }
orderChildModelList.add(childModel); orderChildModelList.add(childModel);
} }

@ -255,13 +255,6 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
@Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor= {RuntimeException.class}) @Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor= {RuntimeException.class})
public BsOrderRefund meiTuanRefund(String tradeRefundNo, String tradeNo , BigDecimal refundPrice, String remark) { public BsOrderRefund meiTuanRefund(String tradeRefundNo, String tradeNo , BigDecimal refundPrice, String remark) {
// 查询退款订
BsOrderRefund bsOrderRefund = getRefundByTradeRefundNo(tradeRefundNo);
if (bsOrderRefund != null) {
return bsOrderRefund;
}
// 查询业务订单 // 查询业务订单
BsOrderMeituan orderMeiTuan = orderMeiTuanService.findOrderMeiTuanByTradeNo(tradeNo); BsOrderMeituan orderMeiTuan = orderMeiTuanService.findOrderMeiTuanByTradeNo(tradeNo);
if (orderMeiTuan == null) { if (orderMeiTuan == null) {
@ -289,6 +282,7 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
orderRefund.setMerId(orderChild.getMerId()); orderRefund.setMerId(orderChild.getMerId());
orderRefund.setOrderNo(orderChild.getOrderNo()); orderRefund.setOrderNo(orderChild.getOrderNo());
orderRefund.setTradeRefundNo(tradeRefundNo); orderRefund.setTradeRefundNo(tradeRefundNo);
orderRefund.setTradeRefundPrice(refundPrice);
orderRefund.setOrderChildNo(orderChild.getChildOrderNo()); orderRefund.setOrderChildNo(orderChild.getChildOrderNo());
orderRefund.setUserId(order.getUserId()); orderRefund.setUserId(order.getUserId());
orderRefund.setUserPhone(order.getUserPhone()); orderRefund.setUserPhone(order.getUserPhone());
@ -305,29 +299,26 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
} else { } else {
// 部分退款 // 部分退款
// 计算部分退款比例 // 计算部分退款比例
BigDecimal proportion = refundPrice.divide(orderChild.getProductTotalPrice() , 2 , RoundingMode.HALF_UP); BigDecimal proportion = refundPrice.divide(orderMeiTuan.getTradeAmount() , 2 , RoundingMode.HALF_UP);
// 退积分 // 退积分
Long unitPriceIntegral = new BigDecimal(orderChild.getIntegralDiscountPrice()).multiply(proportion).longValue(); Long unitPriceIntegral = new BigDecimal(orderChild.getIntegralDiscountPrice()).multiply(proportion).longValue();
// 退金额 // 退金额
BigDecimal price = orderChild.getProductActualPrice().multiply(proportion); BigDecimal price = orderChild.getProductActualPrice().multiply(proportion).setScale(2 , RoundingMode.HALF_UP);
if (price.compareTo(new BigDecimal("0.01")) < 0) {
price = new BigDecimal(0);
}
// 插入退款积分 // 如果退积分大于可退那么按照可退处理
if (unitPriceIntegral > orderChild.getSurplusRefundIntegral()) { if (unitPriceIntegral.compareTo(orderChild.getSurplusRefundIntegral()) >- 1) {
// 插入退款积分
orderRefund.setRefundIntegral(orderChild.getSurplusRefundIntegral()); orderRefund.setRefundIntegral(orderChild.getSurplusRefundIntegral());
} else { } else {
orderRefund.setRefundIntegral(unitPriceIntegral); orderRefund.setRefundIntegral(unitPriceIntegral);
} }
// 插入退款金额 // 如果退金额大于可退那么按照可退处理
if (price.compareTo(orderChild.getSurplusRefundPrice()) > 0) { if (price.compareTo(orderChild.getSurplusRefundPrice()) >- 1) {
// 插入退款金额
orderRefund.setRefundPrice(orderChild.getSurplusRefundPrice()); orderRefund.setRefundPrice(orderChild.getSurplusRefundPrice());
} else { } else {
orderRefund.setRefundPrice(price); orderRefund.setRefundPrice(price);
} }
} }
@ -355,33 +346,26 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
editData(orderRefund); editData(orderRefund);
// 资金退款
if (orderRefund.getRefundPrice().compareTo(new BigDecimal(0)) > 0) { orderRefund.setRefundStatus(refundMoney(orderRefund)?OrderRefundStatusEnum.status2.getCode():OrderRefundStatusEnum.status3.getCode());
// 资金退款
orderRefund.setRefundStatus(refundMoney(orderRefund)?OrderRefundStatusEnum.status2.getCode():OrderRefundStatusEnum.status3.getCode());
} else {
orderRefund.setRefundStatus(OrderRefundStatusEnum.status2.getCode());
}
editData(orderRefund); editData(orderRefund);
// 退款成功 // 退款成功
if (orderRefund.getRefundStatus().equals(OrderRefundStatusEnum.status2.getCode())) { if (orderRefund.getRefundStatus().equals(OrderRefundStatusEnum.status2.getCode())) {
// 修改子订单可退数量、金额、积分 // 修改子订单可退数量、金额、积分
// orderChild.setSurplusRefundCount(orderChild.getSurplusRefundCount() - productCount);
orderChild.setSurplusRefundPrice(orderChild.getSurplusRefundPrice().subtract(orderRefund.getRefundPrice())); orderChild.setSurplusRefundPrice(orderChild.getSurplusRefundPrice().subtract(orderRefund.getRefundPrice()));
orderChild.setSurplusRefundIntegral(orderChild.getSurplusRefundIntegral() - orderRefund.getRefundIntegral()); orderChild.setSurplusRefundIntegral(orderChild.getSurplusRefundIntegral() - orderRefund.getRefundIntegral());
orderChild.setStatus(orderChild.getSurplusRefundCount()==0?OrderChildStatusEnum.status4.getCode():orderChild.getStatus()); orderChild.setStatus(orderChild.getSurplusRefundPrice().compareTo(new BigDecimal(0)) == 0 && orderChild.getSurplusRefundIntegral() == 0?OrderChildStatusEnum.status4.getCode():orderChild.getStatus());
// 退款业务处理
orderRefundSuccessService.orderRefundHandle(orderChild);
orderChildService.editData(orderChild); orderChildService.editData(orderChild);
// 查询子订单已全部退款 // 查询子订单已全部退款
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("orderNo", orderChild.getOrderNo()); map.put("orderNo", orderChild.getOrderNo());
List<BsOrderChild> orderChildList = orderChildService.getList(map); List<BsOrderChild> orderChildList = orderChildService.getList(map);
if (orderChildList.size() == orderChildList.stream().filter(o->o.getStatus().equals(OrderChildStatusEnum.status4.getCode())).collect(Collectors.toList()).size()) { if (orderChildList.size() == orderChildList.stream().filter(o->o.getStatus().equals(OrderChildStatusEnum.status4.getCode())).collect(Collectors.toList()).size()) {
// 退款业务处理
orderRefundSuccessService.orderRefundHandle(orderChild);
order.setOrderStatus(OrderStatusEnum.status4.getCode()); order.setOrderStatus(OrderStatusEnum.status4.getCode());
order.setRefundTime(new Date()); order.setRefundTime(new Date());
orderService.editData(order); orderService.editData(order);

@ -579,6 +579,7 @@ public class BsOrderServiceImpl implements BsOrderService {
} }
} }
return orderModel; return orderModel;

@ -0,0 +1,374 @@
package com.hfkj.service.order.impl;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.entity.*;
import com.hfkj.model.order.OrderCouponModel;
import com.hfkj.model.order.orderExport.MerOrderSettlementDetailModel;
import com.hfkj.model.order.orderExport.OrderSettlementModel;
import com.hfkj.model.order.orderExport.OrderSettlementSumModel;
import com.hfkj.service.BsMerService;
import com.hfkj.service.coupon.BsOrderCouponService;
import com.hfkj.service.goods.*;
import com.hfkj.service.order.OrderSettlementService;
import com.hfkj.sysenum.UserLoginPlatform;
import com.hfkj.sysenum.mer.PayPlatformEnum;
import com.hfkj.sysenum.order.OrderPayTypeEnum;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@Service("orderSettlementService")
public class OrderSettlementServiceImpl implements OrderSettlementService {
@Resource
private BsOrderCouponService orderCouponService;
@Resource
private BsOrderGoodsService goodsService;
@Resource
private BsOrderCinemaService cinemaService;
@Resource
private BsOrderStarbucksService starbucksService;
@Resource
private BsOrderMeiTuanService meiTuanService;
@Resource
private BsOrderMemberService memberService;
@Resource
private BsMerService bsMerService;
@Override
public List<MerOrderSettlementDetailModel> getDetail(Map<String, Object> map) {
return settlementData(map);
}
@Override
public List<OrderSettlementModel> getSettlement(Map<String, Object> map) {
List<MerOrderSettlementDetailModel> list = settlementData(map);
Map<String, List<MerOrderSettlementDetailModel>> merList = list.stream().collect(Collectors.groupingBy(MerOrderSettlementDetailModel:: getMerName));
List<OrderSettlementModel> settlementModels = new ArrayList<>();
OrderSettlementModel settlementModel;
for (String key : merList.keySet()) {
Map<String, List<MerOrderSettlementDetailModel>> detailList = merList.get(key).stream().collect(Collectors.groupingBy(MerOrderSettlementDetailModel:: getBusinessType));
for (String key1 : detailList.keySet()) {
Map<String, List<MerOrderSettlementDetailModel>> listMap = detailList.get(key1).stream().collect(Collectors.groupingBy(MerOrderSettlementDetailModel:: getPayType));
for (String key2 : listMap.keySet()) {
settlementModel = new OrderSettlementModel();
if (map.get("finishTimeS") == null) {
settlementModel.setTime("全时间段");
} else {
settlementModel.setTime(map.get("finishTimeS") + "-" + map.get("finishTimeE"));
}
settlementModel.setPayType(key2);
settlementModel.setBusinessType(key1);
settlementModel.setMerName(key);
BigDecimal reduce = listMap.get(key2).stream().map(MerOrderSettlementDetailModel::getPayRealPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
settlementModel.setPayRealPrice(reduce);
settlementModels.add(settlementModel);
}
}
}
return settlementModels;
}
@Override
public List<OrderSettlementSumModel> getSum(Map<String, Object> map) {
List<MerOrderSettlementDetailModel> list = settlementData(map);
List<OrderSettlementSumModel> sumModels = new ArrayList<>();
OrderSettlementSumModel sumModel;
Map<String, List<MerOrderSettlementDetailModel>> detailList = list.stream().collect(Collectors.groupingBy(MerOrderSettlementDetailModel:: getBusinessType));
for (String key1 : detailList.keySet()) {
Map<String, List<MerOrderSettlementDetailModel>> listMap = detailList.get(key1).stream().collect(Collectors.groupingBy(MerOrderSettlementDetailModel:: getPayType));
for (String key2 : listMap.keySet()) {
sumModel = new OrderSettlementSumModel();
if (map.get("finishTimeS") == null) {
sumModel.setTime("全时间段");
} else {
sumModel.setTime(map.get("finishTimeS") + "-" + map.get("finishTimeE"));
}
sumModel.setPayType(key2);
sumModel.setBusinessType(key1);
BigDecimal reduce = listMap.get(key2).stream().map(MerOrderSettlementDetailModel::getPayRealPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
sumModel.setPayRealPrice(reduce);
sumModels.add(sumModel);
}
}
return sumModels;
}
// 查询结算订单详情
private List<MerOrderSettlementDetailModel> settlementData(Map<String, Object> map) {
List<MerOrderSettlementDetailModel> list = new ArrayList<>();
// 卡券订单整合
list = couponOrder(map , list);
// 查询实物订单
list = goodsOrder(map , list);
// 查询电影票订单
list = cinemaOrder(map , list);
// 查询星巴克
list = starbucksOrder(map , list);
// 查询美团订单
list = meiTuanOrder(map , list);
// 查询会员订单
list = membersOrder(map , list);
return list;
}
// 实物订单整合
private List<MerOrderSettlementDetailModel> goodsOrder(Map<String, Object> map, List<MerOrderSettlementDetailModel> list) {
// 查询实物订单
List<BsOrderGoods> orderGoodsList = goodsService.getListFinish(map);
MerOrderSettlementDetailModel model;
for (BsOrderGoods orderGoods : orderGoodsList) {
model = new MerOrderSettlementDetailModel();
model.setBusinessType("实物订单");
model.setGoodsName(orderGoods.getGoodsName());
model.setMerName(findMerName(orderGoods.getMerId()));
if (orderGoods.getPlatformCode() != null) {
model.setPlatform(UserLoginPlatform.getDataByType(orderGoods.getPlatformCode()).getName());
}
model.setOrderNo(orderGoods.getOrderNo());
model.setChildOrderNo(orderGoods.getChildOrderNo());
model.setBusiness(orderGoods.getLogisticsNo());
if (orderGoods.getPayRealPrice() == null) {
model.setPayRealPrice(new BigDecimal(0));
} else {
model.setPayRealPrice(orderGoods.getPayRealPrice());
}
if (orderGoods.getPayType() != null) {
model.setPayType(OrderPayTypeEnum.getData(orderGoods.getPayType()).getName());
} else {
model.setPayType("未知");
}
if (orderGoods.getFinishTime() != null) {
model.setFinishTime(DateUtil.date2String(orderGoods.getFinishTime() , DateUtil.Y_M_D_HMS));
} else {
model.setFinishTime(DateUtil.date2String(orderGoods.getUpdateTime() , DateUtil.Y_M_D_HMS));
}
list.add(model);
}
return list;
}
// 卡券订单整合
private List<MerOrderSettlementDetailModel> couponOrder(Map<String, Object> map , List<MerOrderSettlementDetailModel> list) {
// 查询卡券订单
List<BsOrderCoupon> orderCouponList = orderCouponService.getOrderCouponList(map);
Map<String , Object> mapCou = new HashMap<>();
mapCou.put("couStatus", 2);
// 查询卡券订单卡密
List<OrderCouponModel> orderCouponModelList = orderCouponService.getOrderList(mapCou);
MerOrderSettlementDetailModel model;
for (BsOrderCoupon orderCoupon : orderCouponList) {
String business = couponCode(orderCoupon.getChildOrderNo() , orderCouponModelList);
if (business != null) {
model = new MerOrderSettlementDetailModel();
model.setGoodsName(orderCoupon.getGoodsName());
model.setBusinessType("卡券订单");
model.setMerName(findMerName(orderCoupon.getMerId()));
if (orderCoupon.getPlatformCode() != null) {
model.setPlatform(UserLoginPlatform.getDataByType(orderCoupon.getPlatformCode()).getName());
}
model.setOrderNo(orderCoupon.getOrderNo());
model.setChildOrderNo(orderCoupon.getChildOrderNo());
model.setBusiness(business);
if (orderCoupon.getPayRealPrice() == null) {
model.setPayRealPrice(new BigDecimal(0));
} else {
model.setPayRealPrice(orderCoupon.getPayRealPrice());
}
if (orderCoupon.getPayType() != null) {
model.setPayType(OrderPayTypeEnum.getData(orderCoupon.getPayType()).getName());
} else {
model.setPayType("未知");
}
model.setFinishTime(DateUtil.date2String(orderCoupon.getUpdateTime() , DateUtil.Y_M_D_HMS));
list.add(model);
}
}
return list;
}
// 整合电影票订单
private List<MerOrderSettlementDetailModel> cinemaOrder(Map<String, Object> map, List<MerOrderSettlementDetailModel> list) {
// 查询电影票订单
List<BsOrderCinema> orderCinemaList = cinemaService.getListFinish(map);
MerOrderSettlementDetailModel model;
for (BsOrderCinema orderCinema : orderCinemaList) {
model = new MerOrderSettlementDetailModel();
model.setBusinessType("电影票订单");
model.setGoodsName(orderCinema.getGoodsName());
model.setMerName(findMerName(orderCinema.getMerId()));
if (orderCinema.getPlatformCode() != null) {
model.setPlatform(UserLoginPlatform.getDataByType(orderCinema.getPlatformCode()).getName());
}
model.setOrderNo(orderCinema.getOrderNo());
model.setChildOrderNo(orderCinema.getChildOrderNo());
if (orderCinema.getPayRealPrice() == null) {
model.setPayRealPrice(new BigDecimal(0));
} else {
model.setPayRealPrice(orderCinema.getPayRealPrice());
}
if (orderCinema.getPayType() != null) {
model.setPayType(OrderPayTypeEnum.getData(orderCinema.getPayType()).getName());
} else {
model.setPayType("未知");
}
if (orderCinema.getFinishTime() != null) {
model.setFinishTime(DateUtil.date2String(orderCinema.getFinishTime() , DateUtil.Y_M_D_HMS));
} else {
model.setFinishTime(DateUtil.date2String(orderCinema.getUpdateTime() , DateUtil.Y_M_D_HMS));
}
list.add(model);
}
return list;
}
// 整合星巴克订单
private List<MerOrderSettlementDetailModel> starbucksOrder(Map<String, Object> map, List<MerOrderSettlementDetailModel> list) {
// 查询星巴克
List<BsOrderStarbucks> orderStarbucksList = starbucksService.getListFinish(map);
MerOrderSettlementDetailModel model;
for (BsOrderStarbucks orderStarbucks : orderStarbucksList) {
model = new MerOrderSettlementDetailModel();
model.setBusinessType("星巴克订单");
model.setGoodsName(orderStarbucks.getName());
model.setMerName(findMerName(orderStarbucks.getMerId()));
if (orderStarbucks.getPlatformCode() != null) {
model.setPlatform(UserLoginPlatform.getDataByType(orderStarbucks.getPlatformCode()).getName());
}
model.setOrderNo(orderStarbucks.getOrderNo());
model.setChildOrderNo(orderStarbucks.getChildOrderNo());
if (orderStarbucks.getPrice() == null) {
model.setPayRealPrice(new BigDecimal(0));
} else {
model.setPayRealPrice(orderStarbucks.getPrice());
}
if (orderStarbucks.getPayType() != null) {
model.setPayType(OrderPayTypeEnum.getData(orderStarbucks.getPayType()).getName());
} else {
model.setPayType("未知");
}
model.setFinishTime(DateUtil.date2String(orderStarbucks.getUpdateTime() , DateUtil.Y_M_D_HMS));
list.add(model);
}
return list;
}
// 整合美团订单
private List<MerOrderSettlementDetailModel> meiTuanOrder(Map<String, Object> map, List<MerOrderSettlementDetailModel> list) {
// 查询美团订单
List<BsOrderMeituan> orderMeituanList = meiTuanService.getOrderListFinish(map);
MerOrderSettlementDetailModel model;
for (BsOrderMeituan orderMeiTuan : orderMeituanList) {
model = new MerOrderSettlementDetailModel();
model.setBusinessType("美团订单");
model.setGoodsName(orderMeiTuan.getGoodsName());
model.setMerName(findMerName(orderMeiTuan.getMerId()));
if (orderMeiTuan.getPlatformCode() != null) {
model.setPlatform(UserLoginPlatform.getDataByType(orderMeiTuan.getPlatformCode()).getName());
}
model.setOrderNo(orderMeiTuan.getOrderNo());
model.setChildOrderNo(orderMeiTuan.getChildOrderNo());
if (orderMeiTuan.getPayRealPrice() == null) {
model.setPayRealPrice(new BigDecimal(0));
} else {
model.setPayRealPrice(orderMeiTuan.getPayRealPrice());
}
if (orderMeiTuan.getPayType() != null) {
model.setPayType(OrderPayTypeEnum.getData(orderMeiTuan.getPayType()).getName());
} else {
model.setPayType("未知");
}
if (orderMeiTuan.getFinishTime() != null) {
model.setFinishTime(DateUtil.date2String(orderMeiTuan.getFinishTime() , DateUtil.Y_M_D_HMS));
} else {
model.setFinishTime(DateUtil.date2String(orderMeiTuan.getUpdateTime() , DateUtil.Y_M_D_HMS));
}
list.add(model);
}
return list;
}
// 整合会员订单
private List<MerOrderSettlementDetailModel> membersOrder(Map<String, Object> map, List<MerOrderSettlementDetailModel> list) {
// 查询会员订单
List<BsOrderMember> orderMembersList = memberService.getListFinish(map);
MerOrderSettlementDetailModel model;
for (BsOrderMember orderMember : orderMembersList) {
model = new MerOrderSettlementDetailModel();
model.setBusinessType("会员订单");
model.setGoodsName(orderMember.getGoodsName());
model.setMerName(findMerName(orderMember.getMerId()));
if (orderMember.getPlatformCode() != null) {
model.setPlatform(UserLoginPlatform.getDataByType(orderMember.getPlatformCode()).getName());
}
model.setOrderNo(orderMember.getOrderNo());
model.setChildOrderNo(orderMember.getChildOrderNo());
if (orderMember.getPayRealPrice() == null) {
model.setPayRealPrice(new BigDecimal(0));
} else {
model.setPayRealPrice(orderMember.getPayRealPrice());
}
if (orderMember.getPayType() != null) {
model.setPayType(OrderPayTypeEnum.getData(orderMember.getPayType()).getName());
} else {
model.setPayType("未知");
}
if (orderMember.getFinishTime() != null) {
model.setFinishTime(DateUtil.date2String(orderMember.getFinishTime() , DateUtil.Y_M_D_HMS));
} else {
model.setFinishTime(DateUtil.date2String(orderMember.getUpdateTime() , DateUtil.Y_M_D_HMS));
}
list.add(model);
}
return list;
}
private String findMerName(Long merId) {
// 查询商户
List<BsMer> bsMerList = bsMerService.getList(new HashMap<>());
bsMerList = bsMerList.stream().filter(s -> s.getId().equals(merId)).collect(Collectors.toList());
if (bsMerList.size() > 0) {
return bsMerList.get(0).getMerName();
}
return merId.toString();
}
private String couponCode(String childOrderNo , List<OrderCouponModel> orderCouponModelList) {
orderCouponModelList = orderCouponModelList.stream().filter(s -> s.getChildOrderNo().equals(childOrderNo)).collect(Collectors.toList());
if (!orderCouponModelList.isEmpty()) {
StringBuilder sb = new StringBuilder();
for (OrderCouponModel orderCouponModel : orderCouponModelList) {
sb.append(orderCouponModel.getCouNo()).append(",");
}
return sb.substring(0, sb.length() - 1);
}
return null;
}
}

@ -10,7 +10,7 @@ import java.util.Objects;
**/ **/
public enum UserLoginPlatform { public enum UserLoginPlatform {
H5("H5", "H5客户端"), H5("H5", "H5客户端"),
WXAPPLETS("WXAPPLETS", "微信小程序"), WXAPPLETS("WXAPPLETS", "普汇GO"),
VFAMILY("VFAMILY", "V家园"), VFAMILY("VFAMILY", "V家园"),
GZGOV("GZGOV", "省自机关"), GZGOV("GZGOV", "省自机关"),
; ;

@ -51,6 +51,18 @@ public enum FileRecordsEnum {
* 退款记录 * 退款记录
*/ */
status9(9, "退款记录"), status9(9, "退款记录"),
/**
* 导出结算详情
*/
status10(10, "结算详情"),
/**
* 导出结算统计
*/
status11(11, "结算统计"),
/**
* 导出结算总和
*/
status12(12, "结算总和"),
; ;
private final int code; private final int code;

@ -72,7 +72,7 @@ ctMemberId=1622808562621276161
ctPostUrl=http://113.250.49.100:8088/recharge/ ctPostUrl=http://113.250.49.100:8088/recharge/
mtNotifyUrl = https://phg.dctpay.com/order/cinemaNotify/notify entId=68465
mtAccessKey=DVNKSHSDHHJ6-TK mtAccessKey=DVNKSHSDHHJ6-TK
mtSecretKey=lj2YDjGnqroY1OuR5zriWg== mtSecretKey=lj2YDjGnqroY1OuR5zriWg==
mtPostUrl=https://waimai-openapi.apigw.test.meituan.com/api/sqt/open/login/h5/loginFree/redirection?test_open_swimlane=test-open mtPostUrl=https://waimai-openapi.apigw.test.meituan.com/api/sqt/open/login/h5/loginFree/redirection?test_open_swimlane=test-open

@ -56,6 +56,13 @@ huiftReqUrl=https://gzyhmp.huift.com.cn
huiftShopCode=20240653-59c4-4181-9157-17fd4b95c3fc huiftShopCode=20240653-59c4-4181-9157-17fd4b95c3fc
huiftSignSecret=19C17F9E19B8DDDDF2FD2EE4EA9F6C61 huiftSignSecret=19C17F9E19B8DDDDF2FD2EE4EA9F6C61
entId=68465
mtAccessKey=DYCUPRFHDVY9-TK
mtSecretKey=6TnzPWsQr/45BW4DIKZJDQ==
mtPostUrl=https://bep-openapi.meituan.com/api/sqt/open/
#QIANZHU #QIANZHU
qianZhuUrl=https://live.qianzhu8.com qianZhuUrl=https://live.qianzhu8.com
qianzhuH5url=https://nf.qianzhu8.com/gateway qianzhuH5url=https://nf.qianzhu8.com/gateway

Loading…
Cancel
Save