From 683a976d464c2a5b43998840a8bd8692fb3b779a Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Thu, 15 Aug 2024 09:43:21 +0800 Subject: [PATCH] / --- .../com/bweb/controller/TestController.java | 40 ++++ .../bweb/controller/file/FileController.java | 106 ++++++++++ .../com/cweb/controller/CommonController.java | 20 +- .../business/BsOrderGoodsController.java | 196 +++++++++++++++++- .../com/hfkj/schedule/OrderGoodsSchedule.java | 52 +++++ .../java/com/hfkj/common/utils/OrderUtil.java | 3 +- .../orderExport/OrderGoodsExportModel.java | 116 +++++++++++ .../hfkj/service/file/FileRecordsService.java | 83 ++++++++ .../file/impl/FileRecordsServiceImpl.java | 71 +++++++ .../service/goods/BsOrderGoodsService.java | 12 +- .../goods/impl/BsOrderGoodsServiceImpl.java | 18 +- .../sysenum/fileRecords/FileRecordsEnum.java | 59 ++++++ 12 files changed, 762 insertions(+), 14 deletions(-) create mode 100644 bweb/src/main/java/com/bweb/controller/file/FileController.java create mode 100644 schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java create mode 100644 service/src/main/java/com/hfkj/model/order/orderExport/OrderGoodsExportModel.java create mode 100644 service/src/main/java/com/hfkj/service/file/FileRecordsService.java create mode 100644 service/src/main/java/com/hfkj/service/file/impl/FileRecordsServiceImpl.java create mode 100644 service/src/main/java/com/hfkj/sysenum/fileRecords/FileRecordsEnum.java diff --git a/bweb/src/main/java/com/bweb/controller/TestController.java b/bweb/src/main/java/com/bweb/controller/TestController.java index bcfc9cb..34801df 100644 --- a/bweb/src/main/java/com/bweb/controller/TestController.java +++ b/bweb/src/main/java/com/bweb/controller/TestController.java @@ -1,8 +1,10 @@ package com.bweb.controller; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; +import com.hfkj.common.utils.DateUtil; import com.hfkj.common.utils.OrderUtil; import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.entity.*; @@ -14,6 +16,7 @@ import com.hfkj.service.goods.GoodsSpecsService; import com.hfkj.service.hlt.HltCanteenService; import com.hfkj.service.hlt.HuiLianTongUnionCardService; import com.hfkj.service.order.BsOrderChildService; +import com.hfkj.sysenum.order.OrderLogisticsStatusEnum; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; @@ -48,6 +51,8 @@ public class TestController { private BsOrderChildService orderChildService; @Resource private BsOrderGoodsService orderGoodsService; + @Resource + private BsOrderGoodsService bsOrderGoodsService; @RequestMapping(value="/canteenConsume",method = RequestMethod.GET) @ResponseBody @@ -129,4 +134,39 @@ public class TestController { return ResponseMsgUtil.exception(e); } } + + @RequestMapping(value="/orderGoodsConfirmReceipt",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "商品确认收货") + public ResponseData orderGoodsConfirmReceipt() { + try { + + Map map = new HashMap<>(); + + map.put("logisticsStatus" , "SIGN"); + map.put("status" , 2); + + List orderGoodsList = orderGoodsService.getList(map); + + for (BsOrderGoods goods : orderGoodsList) { + + // 判断时间是否是十天前 + + if (DateUtil.differentDays(goods.getCreateTime() , new Date()) > 9) { + bsOrderGoodsService.confirmReceipt(goods.getId()); + goods.setStatus(3); + goods.setUpdateTime(new Date()); + orderGoodsService.update(goods); + } + } + + return ResponseMsgUtil.success("成功"); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + + } diff --git a/bweb/src/main/java/com/bweb/controller/file/FileController.java b/bweb/src/main/java/com/bweb/controller/file/FileController.java new file mode 100644 index 0000000..ef5c13b --- /dev/null +++ b/bweb/src/main/java/com/bweb/controller/file/FileController.java @@ -0,0 +1,106 @@ +package com.bweb.controller.file; + +import com.bweb.controller.cms.CmsContentController; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.security.SessionObject; +import com.hfkj.common.security.UserCenter; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.entity.FileRecords; +import com.hfkj.model.ResponseData; +import com.hfkj.model.SecUserSessionObject; +import com.hfkj.service.file.FileRecordsService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +@Controller +@RequestMapping(value="/file") +@Api(value="文件操作") +public class FileController { + + Logger log = LoggerFactory.getLogger(CmsContentController.class); + + @Resource + private FileRecordsService fileRecordsService; + + @Resource + private UserCenter userCenter; + + + @RequestMapping(value="/getFileRecordsList",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询列表") + public ResponseData getFileRecordsList( HttpServletRequest request) { + try { + + SessionObject sessionObject = userCenter.getSessionObject(request); + SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject(); + + Map map = new HashMap<>(); + map.put("opId", userModel.getAccount().getId()); + return ResponseMsgUtil.success(fileRecordsService.getList(map)); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/findFileRecords",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询详情") + public ResponseData findFileRecords( + @RequestParam(value = "id" , required = true) Long id) { + try { + + return ResponseMsgUtil.success(fileRecordsService.queryDetail(id)); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getDownLoad",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "下载") + public ResponseData getDownLoad( + @RequestParam(value = "id" , required = true) Long id) { + try { + + FileRecords fileRecords = fileRecordsService.queryDetail(id); + if (fileRecords.getStatus() != 1) { + throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前状态错误!"); + } + + fileRecords.setStatus(1); + fileRecords.setUpdateTime(new Date()); + fileRecords.setDownloadStatus(1); + fileRecords.setDownloadTime(new Date()); + fileRecordsService.update(fileRecords); + + return ResponseMsgUtil.success(fileRecords.getFileUrl()); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/cweb/src/main/java/com/cweb/controller/CommonController.java b/cweb/src/main/java/com/cweb/controller/CommonController.java index dc60b0b..a02b5f1 100644 --- a/cweb/src/main/java/com/cweb/controller/CommonController.java +++ b/cweb/src/main/java/com/cweb/controller/CommonController.java @@ -7,11 +7,14 @@ import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; import com.hfkj.common.utils.RedisUtil; import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.entity.BsOrderGoods; import com.hfkj.entity.GoodsLogistics; +import com.hfkj.entity.GoodsUserAddress; import com.hfkj.model.ResponseData; import com.hfkj.qianzhu.channel.QianZhuService; import com.hfkj.service.CommonService; import com.hfkj.service.goods.BsOrderGoodsService; +import com.hfkj.service.goods.GoodsUserAddressService; import com.hfkj.service.hlt.HuiLianTongUnionCardService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -41,6 +44,9 @@ public class CommonController { @Resource private BsOrderGoodsService bsOrderGoodsService; + @Resource + private GoodsUserAddressService addressService; + @RequestMapping(value = "/test", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "test") @@ -96,7 +102,19 @@ public class CommonController { Map params = new HashMap<>(); - GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(logisticsNo); + BsOrderGoods orderGoods = bsOrderGoodsService.findGoodsOrderLogisticsNo(logisticsNo); + + if (orderGoods == null) { + throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!"); + } + + GoodsUserAddress userAddress = addressService.queryDetail(orderGoods.getDeliveryAddressId()); + + if (userAddress == null) { + throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!"); + } + + GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(logisticsNo , userAddress.getPhone()); params.put("logistics", logistics); JSONArray object = JSONArray.parseArray(logistics.getLogisticsTraceDetails()); diff --git a/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java b/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java index 9fbb1d9..1946ad3 100644 --- a/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java +++ b/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java @@ -1,7 +1,8 @@ package com.order.controller.business; +import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.databind.util.BeanUtil; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.hfkj.common.exception.ErrorCode; @@ -9,31 +10,44 @@ 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.OrderUtil; +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.entity.GoodsLogistics; +import com.hfkj.entity.GoodsUserAddress; import com.hfkj.model.ResponseData; import com.hfkj.model.SecUserSessionObject; +import com.hfkj.model.order.orderExport.OrderGoodsExportModel; +import com.hfkj.service.file.FileRecordsService; import com.hfkj.service.goods.BsOrderGoodsService; +import com.hfkj.service.goods.GoodsUserAddressService; import com.hfkj.service.order.BsOrderService; import com.hfkj.sysenum.SecUserObjectTypeEnum; -import com.hfkj.sysenum.order.OrderGoodsStatusEnum; +import com.hfkj.sysenum.fileRecords.FileRecordsEnum; +import com.hfkj.sysenum.order.OrderChildStatusEnum; import com.hfkj.sysenum.order.OrderLogisticsStatusEnum; +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.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; +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="/orderGoods") @@ -51,6 +65,12 @@ public class BsOrderGoodsController { @Resource private BsOrderService orderService; + @Resource + private FileRecordsService fileRecordsService; + + @Resource + private GoodsUserAddressService addressService; + @RequestMapping(value="/getListGoods",method = RequestMethod.GET) @ResponseBody @@ -66,6 +86,7 @@ public class BsOrderGoodsController { @RequestParam(value = "logisticsStatus" , required = false) String logisticsStatus, @RequestParam(value = "payType" , required = false) Integer payType, @RequestParam(value = "status" , required = false) Integer status, + @RequestParam(value = "merId" , required = false) Long merId, @RequestParam(value = "createTimeS" , required = false) Long createTimeS, @RequestParam(value = "createTimeE" , required = false) Long createTimeE, @RequestParam(value = "pageNum" , required = true) Integer pageNum, @@ -76,7 +97,9 @@ public class BsOrderGoodsController { SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject(); Map map = new HashMap<>(); - + if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) { + map.put("merId", merId); + } if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { map.put("merId", userModel.getAccount().getObjectId()); } @@ -104,6 +127,155 @@ public class BsOrderGoodsController { } } + + @RequestMapping(value="/exportGoodsOrder",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "导出商品订单") + public ResponseData exportGoodsOrder(@RequestParam(value = "logisticsNo" , required = false) String logisticsNo, + @RequestParam(value = "goodsType" , required = false) Long goodsType, + @RequestParam(value = "goodsBrand" , required = false) Long goodsBrand, + @RequestParam(value = "orderNo" , required = false) String orderNo, + @RequestParam(value = "childOrderNo" , required = false) String childOrderNo, + @RequestParam(value = "userPhone" , required = false) String userPhone, + @RequestParam(value = "goodsSpecsName" , required = false) String goodsSpecsName, + @RequestParam(value = "goodsName" , required = false) String goodsName, + @RequestParam(value = "logisticsStatus" , required = false) String logisticsStatus, + @RequestParam(value = "payType" , required = false) Integer payType, + @RequestParam(value = "status" , required = false) Integer status, + @RequestParam(value = "merId" , required = false) Long merId, + @RequestParam(value = "createTimeS" , required = false) Long createTimeS, + @RequestParam(value = "createTimeE" , required = false) Long createTimeE, HttpServletRequest request) { + // 插入下载记录 + FileRecords fileRecords = new FileRecords(); + + + + try { + + SessionObject sessionObject = userCenter.getSessionObject(request); + SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject(); + + + + + Map map = new HashMap<>(); + if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) { + map.put("merId", merId); + } + if (userModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { + map.put("merId", userModel.getAccount().getObjectId()); + } + + map.put("logisticsNo", logisticsNo); + map.put("goodsType", goodsType); + map.put("goodsBrand", goodsBrand); + map.put("orderNo", orderNo); + map.put("childOrderNo", childOrderNo); + map.put("userPhone", userPhone); + map.put("logisticsStatus", logisticsStatus); + map.put("goodsSpecsName", goodsSpecsName); + map.put("goodsName", goodsName); + map.put("payType", payType); + map.put("createTimeS", createTimeS); + map.put("createTimeE", createTimeE); + map.put("status", status); + + String dataSting = ""; + if (createTimeE != null) { + dataSting = DateUtil.date2String(DateUtil.long2Date(createTimeS) , DateUtil.Y_M_D) + "-" + DateUtil.date2String(DateUtil.long2Date(createTimeE) , DateUtil.Y_M_D); + } else { + dataSting = DateUtil.date2String(new Date(), DateUtil.Y_M_D); + } + + String fileUrl = CommonSysConst.getSysConfig().getFileUrl(); + String pathName = "/temporary/" + userModel.getAccount().getId() + "/" + FileRecordsEnum.status1.getName() + "交易数据导出" + dataSting +".xlsx"; + + if (fileRecordsService.findExported(map.toString() , userModel.getAccount().getId())) { + throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "相同导出内容请勿重复点击!"); + } + + fileRecords.setCreateTime(new Date()); + fileRecords.setBusinessType(FileRecordsEnum.status1.getCode()); + fileRecords.setDownloadConditions(map.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.status1.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 list = bsOrderGoodsService.getList(map); + List goodsExportModels = new ArrayList<>(); + + for (BsOrderGoods bsOrderGoods : list) { + OrderGoodsExportModel orderGoodsExportModel = new OrderGoodsExportModel(); + + BeanUtils.copyProperties(orderGoodsExportModel, bsOrderGoods); + if (bsOrderGoods.getIntegralDiscountPrice() != null) { + orderGoodsExportModel.setIntegralDiscountPrice(BigDecimal.valueOf(bsOrderGoods.getIntegralDiscountPrice()).divide(new BigDecimal(100))); + } + if (bsOrderGoods.getPayChannel() != null) { + orderGoodsExportModel.setPayChannel(OrderPayChannelEnum.getData(bsOrderGoods.getPayChannel()).getName()); + } + if (bsOrderGoods.getPayType() != null) { + orderGoodsExportModel.setPayType(OrderPayTypeEnum.getData(bsOrderGoods.getPayType()).getName()); + } + if (bsOrderGoods.getStatus() != null) { + orderGoodsExportModel.setTradeStatus(OrderChildStatusEnum.getData(bsOrderGoods.getStatus()).getName()); + } + goodsExportModels.add(orderGoodsExportModel); + } + + File file = new File(fileUrl); + if (!file.exists()) { + file.mkdirs(); + } + + EasyExcel.write(fileUrl+pathName) + .head(OrderGoodsExportModel.class) + .sheet(fileRecords.getTitle()) + .doWrite(goodsExportModels); + + fileRecords.setStatus(1); + fileRecords.setUpdateTime(new Date()); + fileRecordsService.update(fileRecords); + } catch (Exception e) { + fileRecords.setStatus(3); + fileRecords.setUpdateTime(new Date()); + 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="/updateLogisticsNo",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "更新物流订单号") @@ -154,7 +326,13 @@ public class BsOrderGoodsController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂未发货!"); } - GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(orderGoods.getLogisticsNo()); + GoodsUserAddress userAddress = addressService.queryDetail(orderGoods.getDeliveryAddressId()); + + if (userAddress == null) { + throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!"); + } + + GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(orderGoods.getLogisticsNo() , userAddress.getPhone()); if (logistics.getLogisticsStatus() != null) { orderGoods.setLogisticsStatus(logistics.getLogisticsStatus()); diff --git a/schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java b/schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java new file mode 100644 index 0000000..df7660e --- /dev/null +++ b/schedule/src/main/java/com/hfkj/schedule/OrderGoodsSchedule.java @@ -0,0 +1,52 @@ +package com.hfkj.schedule; + +import com.hfkj.common.utils.DateUtil; +import com.hfkj.entity.BsOrderGoods; +import com.hfkj.service.goods.BsOrderGoodsService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.Scheduled; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @ClassName OrderGoodsSchedule + * @Author Sum1Dream + * @Description 实物订单定时任务 + * @Date 2024/8/12 下午3:00 + **/ +@Configuration +public class OrderGoodsSchedule { + + private static Logger log = LoggerFactory.getLogger(OrderGoodsSchedule.class); + + @Resource + private BsOrderGoodsService orderGoodsService; + @Resource + private BsOrderGoodsService bsOrderGoodsService; + + //每日凌晨12点5秒执行一次 + @Scheduled(cron = "5 0 0 * * ?") + public void orderGoodsConfirmReceipt() { + Map map = new HashMap<>(); + + map.put("logisticsStatus" , "SIGN"); + map.put("status" , 2); + + List orderGoodsList = orderGoodsService.getList(map); + + for (BsOrderGoods goods : orderGoodsList) { + + // 判断时间是否是十天前 + + if (DateUtil.differentDays(goods.getCreateTime() , new Date()) > 10) { + bsOrderGoodsService.confirmReceipt(goods.getId()); + } + } + } +} diff --git a/service/src/main/java/com/hfkj/common/utils/OrderUtil.java b/service/src/main/java/com/hfkj/common/utils/OrderUtil.java index 17ccbd4..87f98e0 100644 --- a/service/src/main/java/com/hfkj/common/utils/OrderUtil.java +++ b/service/src/main/java/com/hfkj/common/utils/OrderUtil.java @@ -71,13 +71,14 @@ public class OrderUtil { * @return * @throws Exception */ - public static JSONObject getLogisticsMsg(String num) { + public static JSONObject getLogisticsMsg(String num , String mobile) { String appcode = "f9ace4c915054ca697a76fb9a4e1e8c0"; Map headers = new HashMap<>(); headers.put("Authorization", "APPCODE " + appcode); Map querys = new HashMap<>(); querys.put("number", num); + querys.put("mobile", mobile); return HttpsUtils.doGet("https://express3.market.alicloudapi.com/express3" , querys ,headers); } diff --git a/service/src/main/java/com/hfkj/model/order/orderExport/OrderGoodsExportModel.java b/service/src/main/java/com/hfkj/model/order/orderExport/OrderGoodsExportModel.java new file mode 100644 index 0000000..dc67d5e --- /dev/null +++ b/service/src/main/java/com/hfkj/model/order/orderExport/OrderGoodsExportModel.java @@ -0,0 +1,116 @@ +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 OrderGoodsExportModel { + + @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 finishTime; + + +} diff --git a/service/src/main/java/com/hfkj/service/file/FileRecordsService.java b/service/src/main/java/com/hfkj/service/file/FileRecordsService.java new file mode 100644 index 0000000..cdf83f6 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/file/FileRecordsService.java @@ -0,0 +1,83 @@ +package com.hfkj.service.file; + +import com.hfkj.entity.FileRecords; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName FileRecordsService + * @Author Sum1Dream + * @Description 文件记录 + * @Date 2024/8/12 下午2:04 + **/ +public interface FileRecordsService { + + /** + * @MethodName create + * @Description: 创建 + * @param fileRecords + * @Author: Sum1Dream + * @Date: 2024/8/12 下午2:06 + */ + void create(FileRecords fileRecords); + + /** + * @MethodName update + * @Description: 更新 + * @param fileRecords + * @Author: Sum1Dream + * @Date: 2024/8/12 下午2:06 + */ + void update(FileRecords fileRecords); + + /** + * @MethodName delete + * @Description: 删除 + * @param id + * @param fullDelete + * @Author: Sum1Dream + * @Date: 2024/8/12 下午2:06 + */ + void delete(Long id , Boolean fullDelete); + + /** + * @MethodName queryDetail + * @Description: 查询详情 + * @param id + * @return: com.hfkj.entity.FileRecords + * @Author: Sum1Dream + * @Date: 2024/8/12 下午2:07 + */ + FileRecords queryDetail(Long id); + + /** + * @MethodName queryDetailByMap + * @Description: 查询 + * @param map + * @return: com.hfkj.entity.FileRecords + * @Author: Sum1Dream + * @Date: 2024/8/12 下午2:07 + */ + FileRecords queryDetailByMap(Map map); + + /** + * @MethodName getList + * @Description: 查询列表 + * @param map + * @return: java.util.List + * @Author: Sum1Dream + * @Date: 2024/8/12 下午2:07 + */ + List getList(Map map); + + /** + * @MethodName findExported + * @Description: 是否可以导出 + * @param content + * @return: java.lang.Boolean + * @Author: Sum1Dream + * @Date: 2024/8/14 下午5:03 + */ + Boolean findExported(String content , Long opId); +} diff --git a/service/src/main/java/com/hfkj/service/file/impl/FileRecordsServiceImpl.java b/service/src/main/java/com/hfkj/service/file/impl/FileRecordsServiceImpl.java new file mode 100644 index 0000000..cc5798a --- /dev/null +++ b/service/src/main/java/com/hfkj/service/file/impl/FileRecordsServiceImpl.java @@ -0,0 +1,71 @@ +package com.hfkj.service.file.impl; + +import com.hfkj.dao.FileRecordsMapper; +import com.hfkj.entity.FileRecords; +import com.hfkj.entity.FileRecordsExample; +import com.hfkj.service.file.FileRecordsService; +import org.apache.commons.collections4.MapUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +@Service("fileRecordsService") +public class FileRecordsServiceImpl implements FileRecordsService { + + @Resource + private FileRecordsMapper fileRecordsMapper; + + @Override + public void create(FileRecords fileRecords) { + fileRecordsMapper.insert(fileRecords); + } + + @Override + public void update(FileRecords fileRecords) { + fileRecordsMapper.updateByPrimaryKeySelective(fileRecords); + } + + @Override + public void delete(Long id, Boolean fullDelete) { + fileRecordsMapper.deleteByPrimaryKey(id); + } + + @Override + public FileRecords queryDetail(Long id) { + return fileRecordsMapper.selectByPrimaryKey(id); + } + + @Override + public FileRecords queryDetailByMap(Map map) { + return null; + } + + @Override + public List getList(Map map) { + + FileRecordsExample example = new FileRecordsExample(); + FileRecordsExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getLong(map, "opId") != null) { + criteria.andOpIdEqualTo(MapUtils.getLong(map, "opId")); + } + example.setOrderByClause("create_time desc"); + return fileRecordsMapper.selectByExample(example); + } + + @Override + public Boolean findExported(String content , Long opId) { + + FileRecordsExample example = new FileRecordsExample(); + FileRecordsExample.Criteria criteria = example.createCriteria(); + + criteria.andDownloadConditionsEqualTo(content).andOpIdEqualTo(opId).andStatusEqualTo(2); + + List list = fileRecordsMapper.selectByExample(example); + + return !list.isEmpty(); + } +} diff --git a/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java b/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java index daaf481..c478dba 100644 --- a/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java +++ b/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java @@ -58,6 +58,16 @@ public interface BsOrderGoodsService { */ BsOrderGoods findGoodsOrder(String orderNo); + /** + * @MethodName findGoodsOrderLogisticsNo + * @Description: 根据物流单好查询 + * @param logisticsNo + * @return: com.hfkj.entity.BsOrderGoods + * @Author: Sum1Dream + * @Date: 2024/8/13 上午9:50 + */ + BsOrderGoods findGoodsOrderLogisticsNo(String logisticsNo); + /** * @MethodName findGoodsOrderByChild * @Description: @@ -127,7 +137,7 @@ public interface BsOrderGoodsService { * @Param [num] * @Return com.alibaba.fastjson.JSONObject */ - Object getLogisticsMsg(String logisticsNo); + Object getLogisticsMsg(String logisticsNo , String mobile); /** * 更新缓存 diff --git a/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java b/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java index d54861f..d8e1c30 100644 --- a/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/goods/impl/BsOrderGoodsServiceImpl.java @@ -79,6 +79,20 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService { return null; } + @Override + public BsOrderGoods findGoodsOrderLogisticsNo(String logisticsNo) { + BsOrderGoodsExample example = new BsOrderGoodsExample(); + example.createCriteria().andStatusNotEqualTo(0).andLogisticsNoEqualTo(logisticsNo); + + List list = bsOrderGoodsMapper.selectByExample(example); + + if (!list.isEmpty()) { + return list.get(0); + } + + return null; + } + @Override public BsOrderGoods findGoodsOrderByChild(String orderChildNo) { BsOrderGoodsExample example = new BsOrderGoodsExample(); @@ -240,10 +254,10 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService { } @Override - public Object getLogisticsMsg(String logisticsNo) { + public Object getLogisticsMsg(String logisticsNo , String mobile) { Object data = redisUtil.get(CACHE_KEY + logisticsNo); if (data == null) { - JSONObject jsonObjects = OrderUtil.getLogisticsMsg(logisticsNo); + JSONObject jsonObjects = OrderUtil.getLogisticsMsg(logisticsNo , mobile); if (jsonObjects == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂未发货!"); } diff --git a/service/src/main/java/com/hfkj/sysenum/fileRecords/FileRecordsEnum.java b/service/src/main/java/com/hfkj/sysenum/fileRecords/FileRecordsEnum.java new file mode 100644 index 0000000..e22f5b8 --- /dev/null +++ b/service/src/main/java/com/hfkj/sysenum/fileRecords/FileRecordsEnum.java @@ -0,0 +1,59 @@ +package com.hfkj.sysenum.fileRecords; + + +import lombok.Getter; + +import java.util.Objects; + +@Getter +public enum FileRecordsEnum { + /** + * 实物订单 + */ + status1(1, "实物订单"), + + /** + * 虚拟订单 + */ + status2(2, "虚拟订单"), + + /** + * 肯德基订单 + */ + status3(3, "肯德基订单"), + + /** + * 星巴克订单 + */ + status4(4, "星巴克订单"), + + /** + * 财务对账订单 + */ + status5(5, "财务对账订单"), + + /** + * 物流订单上传订单 + */ + status6(6, "物流订单上传订单"), + + status7(7, "物流订单下载订单"), + ; + + private final int code; + + private final String name; + + + FileRecordsEnum(int code, String name) { + this.code = code; + this.name = name; + } + + public static FileRecordsEnum getData(Integer type) { + for (FileRecordsEnum ele : values()) { + if (Objects.equals(type,ele.getCode())) return ele; + } + return null; + } +}