master
parent
874cb4fbc4
commit
0e8d192291
@ -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); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -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; |
||||||
|
} |
@ -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); |
||||||
|
} |
@ -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; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue