From 433037a99603329450fec4b5bdd72e9983bebd93 Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Thu, 23 May 2024 15:30:08 +0800 Subject: [PATCH] Changes --- .../main/java/com/cweb/config/SysConfig.java | 3 +- .../controller/goods/GoodsController.java | 11 ++++- cweb/src/main/resources/pre/config.properties | 1 - .../business/BsOrderGoodsController.java | 14 ++++++ order/src/main/resources/dev/logback.xml | 44 +++++++++++++++++++ .../java/com/hfkj/entity/BsOrderGoods.java | 4 +- ...Service.java => PcytCNPCCouponConfig.java} | 44 ++++++++++++++++--- .../service/coupon/channel/PetroConfig.java | 3 -- .../service/goods/BsOrderGoodsService.java | 10 +++++ .../goods/impl/BsOrderGoodsServiceImpl.java | 25 +++++++++++ .../goods/impl/GoodsBrandServiceImpl.java | 7 +-- .../service/order/OrderPaySuccessService.java | 31 +------------ .../order/impl/BsOrderChildServiceImpl.java | 4 +- 13 files changed, 152 insertions(+), 49 deletions(-) rename service/src/main/java/com/hfkj/service/coupon/channel/{PcytCNPCCouponService.java => PcytCNPCCouponConfig.java} (66%) diff --git a/cweb/src/main/java/com/cweb/config/SysConfig.java b/cweb/src/main/java/com/cweb/config/SysConfig.java index 3697328..42217d3 100644 --- a/cweb/src/main/java/com/cweb/config/SysConfig.java +++ b/cweb/src/main/java/com/cweb/config/SysConfig.java @@ -1,5 +1,6 @@ package com.cweb.config; +import lombok.Data; import lombok.Getter; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.PropertySource; @@ -8,7 +9,7 @@ import org.springframework.stereotype.Component; @Component("sysConfig") @ConfigurationProperties @PropertySource("classpath:/config.properties") -@Getter +@Data public class SysConfig { private String fileUrl; diff --git a/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java b/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java index c9dfc80..fccb6c9 100644 --- a/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java +++ b/cweb/src/main/java/com/cweb/controller/goods/GoodsController.java @@ -1,5 +1,6 @@ package com.cweb.controller.goods; +import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.hfkj.common.exception.ErrorCode; @@ -79,13 +80,19 @@ public class GoodsController { @RequestMapping(value="/getListBrand",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询品牌列表") - public ResponseData getListBrand(@RequestParam(value = "title" , required = false) String title) { + public ResponseData getListBrand(@RequestParam(value = "title" , required = false) String title, + @RequestParam(value = "ext1" , required = false) String ext1) { try { Map map = new HashMap<>(); map.put("title", title); - return ResponseMsgUtil.success(goodsBrandService.getList(map)); + JSONObject object = new JSONObject(); + object.put("list", goodsBrandService.getList(map)); + map.put("ext1", "热门"); + object.put("listExt", goodsBrandService.getList(map)); + + return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("error!",e); diff --git a/cweb/src/main/resources/pre/config.properties b/cweb/src/main/resources/pre/config.properties index 44ea8fc..d26a02e 100644 --- a/cweb/src/main/resources/pre/config.properties +++ b/cweb/src/main/resources/pre/config.properties @@ -1,2 +1 @@ fileUrl=/home/project/hsg/filesystem -cmsPath=/home/project/hsg/filesystem/cmsPath 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 a2649b7..958937b 100644 --- a/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java +++ b/order/src/main/java/com/order/controller/business/BsOrderGoodsController.java @@ -158,4 +158,18 @@ public class BsOrderGoodsController { } } + @RequestMapping(value="/confirmReceipt",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "确认收货") + public ResponseData confirmReceipt(@RequestParam(value = "id" , required = false) Long id) { + try { + bsOrderGoodsService.confirmReceipt(id); + + return ResponseMsgUtil.success("成功"); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } } diff --git a/order/src/main/resources/dev/logback.xml b/order/src/main/resources/dev/logback.xml index 9382585..a036789 100644 --- a/order/src/main/resources/dev/logback.xml +++ b/order/src/main/resources/dev/logback.xml @@ -69,4 +69,48 @@ + + + + + log/petroLog.log + + log/ScPetroLog/ScPetroLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + + + + log/petroLog.log + + log/PcytCNPC/PcytCNPCCouponLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + diff --git a/service/src/main/java/com/hfkj/entity/BsOrderGoods.java b/service/src/main/java/com/hfkj/entity/BsOrderGoods.java index b861bd4..ed3b314 100644 --- a/service/src/main/java/com/hfkj/entity/BsOrderGoods.java +++ b/service/src/main/java/com/hfkj/entity/BsOrderGoods.java @@ -160,7 +160,7 @@ public class BsOrderGoods implements Serializable { private Integer payType; /** - * 1:待发货 2:已发货 3:配送中 4:已送达 5:已取消 6:退货中 7:已退货 8:待支付 0:删除 + * 1:待发货 2:已发货 3:配送中 4:已送达 5:已取消 6:退货中 7:已退货 8:待支付 9:已收货 0:删除 */ private Integer status; @@ -662,4 +662,4 @@ public class BsOrderGoods implements Serializable { sb.append("]"); return sb.toString(); } -} \ No newline at end of file +} diff --git a/service/src/main/java/com/hfkj/service/coupon/channel/PcytCNPCCouponService.java b/service/src/main/java/com/hfkj/service/coupon/channel/PcytCNPCCouponConfig.java similarity index 66% rename from service/src/main/java/com/hfkj/service/coupon/channel/PcytCNPCCouponService.java rename to service/src/main/java/com/hfkj/service/coupon/channel/PcytCNPCCouponConfig.java index 75e20ec..e94d239 100644 --- a/service/src/main/java/com/hfkj/service/coupon/channel/PcytCNPCCouponService.java +++ b/service/src/main/java/com/hfkj/service/coupon/channel/PcytCNPCCouponConfig.java @@ -1,10 +1,13 @@ package com.hfkj.service.coupon.channel; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.hfkj.common.utils.HttpsUtils; import com.hfkj.common.utils.MD5Util; import com.hfkj.config.CommonSysConst; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Configuration; import java.util.Arrays; @@ -20,7 +23,9 @@ import java.util.Set; * @createTime 18:33 2023/11/13 **/ @Configuration -public class PcytCNPCCouponService { +public class PcytCNPCCouponConfig { + + private static Logger log = LoggerFactory.getLogger(PcytCNPCCouponConfig.class); /** * @Author Sum1Dream @@ -30,11 +35,18 @@ public class PcytCNPCCouponService { * @return com.alibaba.fastjson.JSONObject */ public static JSONObject getCouponList() throws Exception { + log.info("========================请求任务Start========================="); JSONObject paramMap = new JSONObject(); paramMap.put("method" , "api.coupon.reserve"); paramMap.put("merchant" ,CommonSysConst.getSysConfig().getPcytCnpcMerchant()); paramMap.put("sign", generateSign(paramMap , CommonSysConst.getSysConfig().getPcytCnpcSecret())); - return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); + + log.info("获取卡券列表-请求参数: " + JSON.toJSONString(paramMap)); + JSONObject object = HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); + log.info("获取卡券列表-回调参数: " + JSON.toJSONString(object)); + log.info("========================请求任务End========================="); + // 请求接口 + return object; } /** @@ -46,6 +58,7 @@ public class PcytCNPCCouponService { * @return com.alibaba.fastjson.JSONObject */ public static JSONObject getCoupon(String orderNo , String mobile, String reqCode) throws Exception { + log.info("========================请求任务Start========================="); JSONObject paramMap = new JSONObject(); paramMap.put("method" , "api.coupon.once"); @@ -54,7 +67,14 @@ public class PcytCNPCCouponService { paramMap.put("reqCode" , reqCode); paramMap.put("merchant" ,CommonSysConst.getSysConfig().getPcytCnpcMerchant()); paramMap.put("sign", generateSign(paramMap , CommonSysConst.getSysConfig().getPcytCnpcSecret())); - return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); + + + log.info("获取电子券-请求参数: " + JSON.toJSONString(paramMap)); + JSONObject object = HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); + log.info("获取电子券-回调参数: " + JSON.toJSONString(object)); + log.info("========================请求任务End========================="); + // 请求接口 + return object; } /** @@ -66,13 +86,20 @@ public class PcytCNPCCouponService { * @return com.alibaba.fastjson.JSONObject */ public static JSONObject getCouponQuery(String couponCode ) throws Exception { + log.info("========================请求任务Start========================="); JSONObject paramMap = new JSONObject(); paramMap.put("method" , "api.coupon.query"); paramMap.put("couponCode" , couponCode); paramMap.put("merchant" ,CommonSysConst.getSysConfig().getPcytCnpcMerchant()); paramMap.put("sign", generateSign(paramMap , CommonSysConst.getSysConfig().getPcytCnpcSecret())); - return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); + + log.info("查询电子券信息-请求参数: " + JSON.toJSONString(paramMap)); + JSONObject object = HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); + log.info("查询电子券信息-回调参数: " + JSON.toJSONString(object)); + log.info("========================请求任务End========================="); + // 请求接口 + return object; } /** @@ -84,13 +111,20 @@ public class PcytCNPCCouponService { * @return com.alibaba.fastjson.JSONObject */ public static JSONObject getCouponDestroy(String couponCode ) throws Exception { + + log.info("========================请求任务Start========================="); JSONObject paramMap = new JSONObject(); paramMap.put("method" , "api.coupon.destroy"); paramMap.put("couponCode" , couponCode); paramMap.put("merchant" ,CommonSysConst.getSysConfig().getPcytCnpcMerchant()); paramMap.put("sign", generateSign(paramMap , CommonSysConst.getSysConfig().getPcytCnpcSecret())); - return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); + log.info("作废电子券-请求参数: " + JSON.toJSONString(paramMap)); + JSONObject object = HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getPcytCnpcPostUrl() , paramSort(paramMap), new HashMap<>()); + log.info("作废电子券-回调参数: " + JSON.toJSONString(object)); + log.info("========================请求任务End========================="); + // 请求接口 + return object; } diff --git a/service/src/main/java/com/hfkj/service/coupon/channel/PetroConfig.java b/service/src/main/java/com/hfkj/service/coupon/channel/PetroConfig.java index bb7f213..9d0755a 100644 --- a/service/src/main/java/com/hfkj/service/coupon/channel/PetroConfig.java +++ b/service/src/main/java/com/hfkj/service/coupon/channel/PetroConfig.java @@ -27,9 +27,6 @@ public class PetroConfig { private static String petroAppid; private static String petroAesKey; - private static final String version = "1.0"; - - private final static String charset = "UTF-8"; private static Logger log = LoggerFactory.getLogger(PetroConfig.class); 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 2743665..c598e37 100644 --- a/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java +++ b/service/src/main/java/com/hfkj/service/goods/BsOrderGoodsService.java @@ -118,4 +118,14 @@ public interface BsOrderGoodsService { * @Return com.alibaba.fastjson.JSONObject */ Object getLogisticsMsg(Long orderGoodsId); + + /** + * @Author Sum1Dream + * @Name getLogisticsMsg + * @Description // 确认收货 + * @Date 16:19 2023/4/20 + * @Param [num] + * @Return com.alibaba.fastjson.JSONObject + */ + void confirmReceipt(Long orderGoodsId); } 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 236728c..0a0978c 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 @@ -13,6 +13,7 @@ import com.hfkj.entity.BsOrderGoodsExample; import com.hfkj.entity.GoodsLogistics; import com.hfkj.entity.GoodsLogisticsExample; import com.hfkj.service.goods.BsOrderGoodsService; +import com.hfkj.service.order.BsOrderService; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -39,6 +40,10 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService { @Resource private RedisUtil redisUtil; + @Resource + private BsOrderService orderService; + + @Override public void create(BsOrderGoods orderGoods) { bsOrderGoodsMapper.insert(orderGoods); @@ -233,4 +238,24 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService { return data; } } + + @Override + public void confirmReceipt(Long orderGoodsId) { + BsOrderGoods orderGoods = queryDetail(orderGoodsId); + + if (orderGoods == null || + orderGoods.getStatus() == 1 || + orderGoods.getStatus() == 5 || + orderGoods.getStatus() == 6 || + orderGoods.getStatus() == 7 || + orderGoods.getStatus() == 8) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前状态,不支持确认收货!"); + } + + orderGoods.setStatus(9); + // todo 缺少修改主订单状态 + update(orderGoods); + // 删除缓存 + orderService.cacheDelete(orderGoods.getOrderNo()); + } } diff --git a/service/src/main/java/com/hfkj/service/goods/impl/GoodsBrandServiceImpl.java b/service/src/main/java/com/hfkj/service/goods/impl/GoodsBrandServiceImpl.java index a48a910..534858c 100644 --- a/service/src/main/java/com/hfkj/service/goods/impl/GoodsBrandServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/goods/impl/GoodsBrandServiceImpl.java @@ -3,15 +3,12 @@ package com.hfkj.service.goods.impl; import com.hfkj.dao.GoodsBrandMapper; import com.hfkj.entity.GoodsBrand; import com.hfkj.entity.GoodsBrandExample; -import com.hfkj.entity.GoodsMsg; -import com.hfkj.entity.GoodsType; import com.hfkj.service.goods.GoodsBrandService; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Map; @@ -63,6 +60,10 @@ public class GoodsBrandServiceImpl implements GoodsBrandService { criteria.andTitleLike("%"+MapUtils.getString(map, "title")+"%"); } + if (StringUtils.isNotBlank(MapUtils.getString(map, "ext1"))) { + criteria.andExt1EqualTo(MapUtils.getString(map, "ext1")); + } + criteria.andStatusNotEqualTo(0); return goodsBrandMapper.selectByExample(example); diff --git a/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java index 50e83f4..0735870 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java @@ -6,14 +6,13 @@ 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.RedisUtil; import com.hfkj.entity.*; import com.hfkj.model.order.OrderModel; import com.hfkj.service.coupon.BsOrderCouponNoService; import com.hfkj.service.coupon.BsOrderCouponService; import com.hfkj.service.coupon.channel.ChongQingCNPCCouponService; import com.hfkj.service.coupon.channel.HuiLianTongCouponService; -import com.hfkj.service.coupon.channel.PcytCNPCCouponService; +import com.hfkj.service.coupon.channel.PcytCNPCCouponConfig; import com.hfkj.service.coupon.channel.PetroConfig; import com.hfkj.service.goods.BsOrderGoodsService; import com.hfkj.service.goods.GoodsMsgService; @@ -23,11 +22,9 @@ import com.hfkj.sysenum.GoodsVpdSourceEnum; import com.hfkj.sysenum.order.OrderChildProductTypeEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.Resource; -import java.math.BigDecimal; import java.util.Date; import java.util.List; @@ -133,30 +130,6 @@ public class OrderPaySuccessService { } } else if (vpd.getSource() == GoodsVpdSourceEnum.type6.getCode()) { -/* // 派发停车券 - ApiBlxCoupon apiBlxCoupon = apiBlxCouponService.findBlxCoupon(coupon.getCouponKey()); - if (apiBlxCoupon == null || apiBlxCoupon.getCouponStatus() != 1) { - throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买"); - } - // 计算上送卡券数量 - int num = coupon.getSalesPrice().divide(new BigDecimal(apiBlxCoupon.getDenomination())).intValue(); - if (num > 0) { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("couponCode" , coupon.getCouponKey()); - jsonObject.put("receiverPhone" , order.getMemPhone()); - jsonObject.put("receiverCount" , num); - - JSONObject object = blxConfig.sendCoupon(jsonObject); - - if (object.getInteger("code") == 1) { - order.setOrderStatus(OrderStatus.STATUS3.getNumber()); - order.setFinishTime(new Date()); - orderService.updateOrderData(order); - highUserCardService.getBlxCouponBalance(order.getMemPhone()); - } else { - throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , object.getString("msg")); - } - }*/ } else if (vpd.getSource() == GoodsVpdSourceEnum.type7.getCode()) { // 发放卡券 @@ -172,7 +145,7 @@ public class OrderPaySuccessService { } else if (vpd.getSource() == GoodsVpdSourceEnum.type10.getCode()) { // 发放卡券 - JSONObject jsonObject = PcytCNPCCouponService.getCoupon(orderCoupon.getOrderNo() , orderCoupon.getUserPhone() , orderCoupon.getGoodsVpdKey()); + JSONObject jsonObject = PcytCNPCCouponConfig.getCoupon(orderCoupon.getOrderNo() , orderCoupon.getUserPhone() , orderCoupon.getGoodsVpdKey()); if (!jsonObject.getString("code").equals("200")) { throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , jsonObject.getString("errMsg")); } diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java index 266b76b..35951a7 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java @@ -87,9 +87,7 @@ public class BsOrderChildServiceImpl implements BsOrderChildService { } object.put("address", address); - if (orderGoods.getLogisticsNo() != null) { - object.put("logisticsNo", orderGoods.getLogisticsNo()); - } + object.put("orderGoodsId", orderGoods.getId()); childModel.setBusiness(object); }