Commit f9db006a48e07ca05d2930d7dafa966b4ad24a4e

Authored by fengliang
2 parents ebec5f24 cfffc04d

Merge remote-tracking branch 'origin/feature-v1.0.26.20241010' into feature-v1.0.27.20241011

# Conflicts:
#	etrade-shop/src/main/java/com/diligrp/etrade/shop/constant/Constant.java
Showing 24 changed files with 1223 additions and 52 deletions
etrade-order/src/main/java/com/diligrp/etrade/order/api/OrderController.java
... ... @@ -28,6 +28,7 @@ import com.xxl.job.core.handler.annotation.XxlJob;
28 28 import jakarta.annotation.Resource;
29 29 import jakarta.validation.Valid;
30 30 import jodd.util.StringUtil;
  31 +import org.apache.commons.lang3.StringUtils;
31 32 import org.redisson.api.RBucket;
32 33 import org.redisson.api.RLock;
33 34 import org.redisson.api.RedissonClient;
... ... @@ -59,9 +60,6 @@ public class OrderController {
59 60 @Resource
60 61 private RedissonClient redissonClient;
61 62  
62   - @Resource
63   - private BasicDataConfigRpc basicDataConfigRpc;
64   -
65 63 /**
66 64 * 买家创建订单
67 65 * @return
... ... @@ -787,24 +785,20 @@ public class OrderController {
787 785 * @return
788 786 */
789 787 @RequestMapping(value = "/getTransportFee",method = {RequestMethod.POST},produces="application/json;charset=UTF-8")
790   - public Message<TransportFeeDto> getTransportFee(@RequestBody OrderDto order){
  788 + public Message<TransportFeeDto> getTransportFee(@RequestBody OrderTransportFeeQuery order){
791 789 try{
792   - if(order.getMarketId()==null){
793   - return Message.failure(OrderErrorCode.PARAM_ERROR,"市场不能为空");
  790 + if(order.getBuyerId() == null){
  791 + return Message.failure(OrderErrorCode.PARAM_ERROR,"买家不能为空");
794 792 }
795   - ConfigQueryDto query = new ConfigQueryDto();
796   - query.setMarketId(order.getMarketId());
797   - query.setType("TransportFee");
798   - BaseOutput<List<ConfigDto>> listBaseOutput = basicDataConfigRpc.queryAll(query);
799   - if("200".equals(listBaseOutput.getCode())){
800   - List<ConfigDto> configDtos = listBaseOutput.getData();
801   - if(configDtos!=null&&configDtos.size()>0) {
802   - ConfigDto configDto = configDtos.get(0);
803   - TransportFeeDto transportFeeDto = new TransportFeeDto();
804   - long l = Long.parseLong(configDto.getValue());
805   - transportFeeDto.setTransportFee(l);
806   - return Message.success(transportFeeDto);
807   - }
  793 + if (StringUtils.isBlank(order.getAchieveAddress())){
  794 + return Message.failure(OrderErrorCode.PARAM_ERROR,"收货地址不能为空");
  795 + }
  796 + if (order.getTotleAmount() == null){
  797 + return Message.failure(OrderErrorCode.PARAM_ERROR,"商品总价不能为空");
  798 + }
  799 + TransportFeeDto transportFeeDto = orderService.getTransportFee(order);
  800 + if(transportFeeDto!=null){
  801 + return Message.success(transportFeeDto);
808 802 }
809 803 return Message.success(new TransportFeeDto());
810 804 }catch (PlatformServiceException pe) {
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/dao/OrderMapper.java
... ... @@ -131,4 +131,11 @@ public interface OrderMapper extends MybatisMapperSupport {
131 131 * @param ids
132 132 */
133 133 void updateDeductState(@Param("ids")List<Long> ids);
  134 +
  135 + /**
  136 + * 查询是否存在已支付相同配送地址订单
  137 + * @param orderTransportFeeQuery
  138 + * @return
  139 + */
  140 + Integer selectOrderByTransportFee(OrderTransportFeeQuery orderTransportFeeQuery);
134 141 }
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/domain/OrderTransportFeeQuery.java 0 → 100644
  1 +package com.diligrp.etrade.order.domain;
  2 +
  3 +import java.math.BigDecimal;
  4 +import java.time.LocalDateTime;
  5 +
  6 +public class OrderTransportFeeQuery {
  7 + /**
  8 + * 买方客户id
  9 + */
  10 + private Long buyerId;
  11 +
  12 + /**
  13 + * 店铺id
  14 + */
  15 + private Long shopId;
  16 +
  17 + /**
  18 + * 市场id
  19 + */
  20 + private Long marketId;
  21 +
  22 + /**
  23 + * 开始时间
  24 + */
  25 + private LocalDateTime startTime;
  26 +
  27 + /**
  28 + * 结束时间
  29 + */
  30 + private LocalDateTime endTime;
  31 +
  32 + /**
  33 + * 收货地址
  34 + */
  35 + private String achieveAddress;
  36 +
  37 + /**
  38 + * 订单总金额
  39 + */
  40 + private BigDecimal totleAmount;
  41 +
  42 + public Long getBuyerId() {
  43 + return buyerId;
  44 + }
  45 +
  46 + public void setBuyerId(Long buyerId) {
  47 + this.buyerId = buyerId;
  48 + }
  49 +
  50 + public Long getShopId() {
  51 + return shopId;
  52 + }
  53 +
  54 + public void setShopId(Long shopId) {
  55 + this.shopId = shopId;
  56 + }
  57 +
  58 + public Long getMarketId() {
  59 + return marketId;
  60 + }
  61 +
  62 + public void setMarketId(Long marketId) {
  63 + this.marketId = marketId;
  64 + }
  65 +
  66 + public LocalDateTime getStartTime() {
  67 + return startTime;
  68 + }
  69 +
  70 + public void setStartTime(LocalDateTime startTime) {
  71 + this.startTime = startTime;
  72 + }
  73 +
  74 + public LocalDateTime getEndTime() {
  75 + return endTime;
  76 + }
  77 +
  78 + public void setEndTime(LocalDateTime endTime) {
  79 + this.endTime = endTime;
  80 + }
  81 +
  82 + public String getAchieveAddress() {
  83 + return achieveAddress;
  84 + }
  85 +
  86 + public void setAchieveAddress(String achieveAddress) {
  87 + this.achieveAddress = achieveAddress;
  88 + }
  89 +
  90 + public BigDecimal getTotleAmount() {
  91 + return totleAmount;
  92 + }
  93 +
  94 + public void setTotleAmount(BigDecimal totleAmount) {
  95 + this.totleAmount = totleAmount;
  96 + }
  97 +}
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/OrderGoodsService.java
1 1 package com.diligrp.etrade.order.service;
2 2  
3 3 import com.diligrp.etrade.order.domain.OrderCreateDto;
  4 +import com.diligrp.etrade.order.domain.OrderDto;
4 5 import com.diligrp.etrade.order.domain.ProductDto;
5 6 import com.diligrp.etrade.order.model.Order;
6 7 import com.diligrp.etrade.order.model.OrderGoods;
  8 +import com.diligrp.etrade.shop.domain.response.ShopExpressVo;
7 9 import com.diligrp.etrade.shop.domain.response.ShopVo;
8 10 import org.springframework.transaction.annotation.Transactional;
9 11  
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/OrderService.java
... ... @@ -256,4 +256,6 @@ public interface OrderService {
256 256 * 获取订单状态
257 257 */
258 258 OrderDto checkOrderState(String code);
  259 +
  260 + TransportFeeDto getTransportFee(OrderTransportFeeQuery order);
259 261 }
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderGoodsServiceImpl.java
... ... @@ -22,6 +22,7 @@ import com.diligrp.etrade.rpc.type.CustomerState;
22 22 import com.diligrp.etrade.shop.domain.request.ShopCo;
23 23 import com.diligrp.etrade.shop.domain.request.StockDeductRequest;
24 24 import com.diligrp.etrade.shop.domain.response.ProductDetailVo;
  25 +import com.diligrp.etrade.shop.domain.response.ShopExpressVo;
25 26 import com.diligrp.etrade.shop.domain.response.ShopVo;
26 27 import com.diligrp.etrade.shop.exception.InsufficientStockException;
27 28 import com.diligrp.etrade.shop.exception.StockNotFoundException;
... ... @@ -163,22 +164,22 @@ public class OrderGoodsServiceImpl implements OrderGoodsService {
163 164 }
164 165 //配送情况增加计算运费
165 166 if(buyerOrderDto.getAchieveType().equals(OrderAchieveType.SELLER_DELIVERY.getCodeInteger())&&transportFeeFlag){
166   - ConfigQueryDto query = new ConfigQueryDto();
167   - query.setType("TransportFee");
168   - query.setMarketId(buyerOrderDto.getMarketId());
169   - BaseOutput<List<ConfigDto>> listBaseOutput = basicDataConfigRpc.queryAll(query);
170   - Long transportFee = buyerOrderDto.getTransportFee().multiply(NumberTransform.ONE_HUNDERD).longValue();
171   - Long transportFeeConfig = 0L;
172   - if("200".equals(listBaseOutput.getCode())){
173   - List<ConfigDto> configDtos = listBaseOutput.getData();
174   - if(configDtos!=null&&configDtos.size()>0) {
175   - ConfigDto configDto = configDtos.get(0);
176   - transportFeeConfig = Long.parseLong(configDto.getValue());
177   - }
178   - }
179   - if(!transportFee.equals(transportFeeConfig)){
180   - throw new OrderException(OrderErrorCode.PARAM_ERROR,"运费与设置不一致,请刷新后重试");
181   - }
  167 +// ConfigQueryDto query = new ConfigQueryDto();
  168 +// query.setType("TransportFee");
  169 +// query.setMarketId(buyerOrderDto.getMarketId());
  170 +// BaseOutput<List<ConfigDto>> listBaseOutput = basicDataConfigRpc.queryAll(query);
  171 +// Long transportFee = buyerOrderDto.getTransportFee().multiply(NumberTransform.ONE_HUNDERD).longValue();
  172 +// Long transportFeeConfig = 0L;
  173 +// if("200".equals(listBaseOutput.getCode())){
  174 +// List<ConfigDto> configDtos = listBaseOutput.getData();
  175 +// if(configDtos!=null&&configDtos.size()>0) {
  176 +// ConfigDto configDto = configDtos.get(0);
  177 +// transportFeeConfig = Long.parseLong(configDto.getValue());
  178 +// }
  179 +// }
  180 +// if(!transportFee.equals(transportFeeConfig)){
  181 +// throw new OrderException(OrderErrorCode.PARAM_ERROR,"运费与设置不一致,请刷新后重试");
  182 +// }
182 183 allmount = allmount.add(buyerOrderDto.getTransportFee());
183 184 }
184 185 //效验库存
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderServiceImpl.java
... ... @@ -42,8 +42,13 @@ import com.diligrp.etrade.rpc.util.Constants;
42 42 import com.diligrp.etrade.shared.SharedConfiguration;
43 43 import com.diligrp.etrade.shared.domain.OrderQrCode;
44 44 import com.diligrp.etrade.shop.domain.request.ShopCo;
  45 +import com.diligrp.etrade.shop.domain.request.ShopExpressQueryCo;
  46 +import com.diligrp.etrade.shop.domain.response.ShopExpressVo;
45 47 import com.diligrp.etrade.shop.domain.response.ShopVo;
  48 +import com.diligrp.etrade.shop.service.ShopExpressSettingService;
46 49 import com.diligrp.etrade.shop.service.ShopService;
  50 +import com.diligrp.etrade.shop.type.ExpressCondition;
  51 +import com.diligrp.etrade.shop.type.ExpressType;
47 52 import jakarta.annotation.Resource;
48 53 import org.apache.commons.collections4.CollectionUtils;
49 54 import org.apache.commons.lang3.StringUtils;
... ... @@ -82,6 +87,9 @@ public class OrderServiceImpl implements OrderService {
82 87 private OrderGoodsService orderGoodsService;
83 88  
84 89 @Resource
  90 + private ShopExpressSettingService shopExpressSettingService;
  91 +
  92 + @Resource
85 93 private OrderPaymentService orderPaymentService;
86 94  
87 95 @Resource
... ... @@ -133,6 +141,7 @@ public class OrderServiceImpl implements OrderService {
133 141 orderCreateDto.setShopCustomerId(shop.getCustomerId());
134 142 orderCreateDto.setShopName(shop.getName());
135 143 orderCreateDto.setShopCustomerName(shop.getCustomerName());
  144 + setTransportFee(orderCreateDto,transportFeeFlag);
136 145 //效验买方地址是否可配送
137 146 orderDeliveryService.checkPersonContact(orderCreateDto);
138 147 //验证订单商品总重量与订单商品总价格
... ... @@ -144,6 +153,33 @@ public class OrderServiceImpl implements OrderService {
144 153 return order;
145 154 }
146 155  
  156 + private void setTransportFee(OrderCreateDto orderCreateDto, Boolean transportFeeFlag) {
  157 + if(!transportFeeFlag || orderCreateDto.getAchieveType().equals(OrderAchieveType.BUYER_SELF.getCodeInteger())){
  158 + return;
  159 + }
  160 + OrderTransportFeeQuery orderTransportFeeQuery = new OrderTransportFeeQuery();
  161 + orderTransportFeeQuery.setShopId(orderCreateDto.getShopId());
  162 + orderTransportFeeQuery.setBuyerId(orderCreateDto.getBuyerId());
  163 + orderTransportFeeQuery.setMarketId(orderCreateDto.getMarketId());
  164 + orderTransportFeeQuery.setAchieveAddress(orderCreateDto.getDelivery().getAddress());
  165 + if(orderCreateDto.getTransportFee()!=null){
  166 + orderTransportFeeQuery.setTotleAmount(orderCreateDto.getTotleAmount().subtract(orderCreateDto.getTransportFee()));
  167 + }else{
  168 + orderCreateDto.setTransportFee(NumberTransform.ZERO);
  169 + orderTransportFeeQuery.setTotleAmount(orderCreateDto.getTotleAmount());
  170 + }
  171 + TransportFeeDto transportFee = getTransportFee(orderTransportFeeQuery);
  172 + if(transportFee != null){
  173 + if(!transportFee.getTransportFee().equals(orderCreateDto.getTransportFee().multiply(NumberTransform.ONE_HUNDERD).setScale(2,RoundingMode.HALF_UP).longValue())){
  174 + throw new OrderException(OrderErrorCode.PARAM_ERROR,"运费与设置不一致,请刷新后重试");
  175 + }
  176 + }else{
  177 + throw new OrderException(OrderErrorCode.PARAM_ERROR,"运费与设置不一致,请刷新后重试");
  178 + }
  179 +
  180 +
  181 + }
  182 +
147 183 /**
148 184 * 买方效验
149 185 * @param customerId
... ... @@ -1033,6 +1069,71 @@ public class OrderServiceImpl implements OrderService {
1033 1069 }
1034 1070  
1035 1071 @Override
  1072 + public TransportFeeDto getTransportFee(OrderTransportFeeQuery order) {
  1073 + TransportFeeDto transportFeeDto = new TransportFeeDto();
  1074 + ShopExpressQueryCo shopExpressQueryCo = new ShopExpressQueryCo();
  1075 + shopExpressQueryCo.setShopId(order.getShopId());
  1076 + ShopExpressVo shopExpressVo = shopExpressSettingService.detail(shopExpressQueryCo);
  1077 + if(shopExpressVo == null){
  1078 + throw new OrderException(OrderErrorCode.PARAM_ERROR,"当前商家暂不支持配送");
  1079 + }else{
  1080 + if(CollectionUtils.isEmpty(shopExpressVo.getType())){
  1081 + throw new OrderException(OrderErrorCode.PARAM_ERROR,"当前商家暂不支持配送");
  1082 + }else if(!shopExpressVo.getType().contains(ExpressType.DELIVERY.getCode())){
  1083 + throw new OrderException(OrderErrorCode.PARAM_ERROR,"当前商家暂不支持配送");
  1084 + }
  1085 + }
  1086 + if(shopExpressVo.getFee()==null){
  1087 + return transportFeeDto;
  1088 + }
  1089 + if(CollectionUtils.isNotEmpty(shopExpressVo.getCondition())){
  1090 + if(shopExpressVo.getCondition().contains(ExpressCondition.MONEY.getCode())){
  1091 + if(shopExpressVo.getFreeAmount()==null){
  1092 + return transportFeeDto;
  1093 + }
  1094 + if(order.getTotleAmount().compareTo(shopExpressVo.getFreeAmount())>=0){
  1095 + return transportFeeDto;
  1096 + }else{
  1097 + transportFeeDto.setTransportFee(shopExpressVo.getFee().multiply(NumberTransform.ONE_HUNDERD).longValue());
  1098 + }
  1099 + }
  1100 + if(shopExpressVo.getCondition().contains(ExpressCondition.LOGIC.getCode())){
  1101 + if(shopExpressVo.getFreeTime() == null){
  1102 + return transportFeeDto;
  1103 + }else{
  1104 + LocalDateTime now = LocalDateTime.now();
  1105 + LocalDateTime newDateTime = now.toLocalDate().atTime(shopExpressVo.getFreeTime());
  1106 + OrderTransportFeeQuery orderTransportFeeQuery = new OrderTransportFeeQuery();
  1107 + if(newDateTime.isBefore(now)){
  1108 + orderTransportFeeQuery.setStartTime(newDateTime);
  1109 + orderTransportFeeQuery.setEndTime(newDateTime.plusHours(shopExpressVo.getPeriod()));
  1110 + }else{
  1111 + orderTransportFeeQuery.setStartTime(newDateTime.minusHours(shopExpressVo.getPeriod()));
  1112 + orderTransportFeeQuery.setEndTime(newDateTime);
  1113 + }
  1114 + orderTransportFeeQuery.setShopId(shopExpressVo.getShopId());
  1115 +
  1116 + orderTransportFeeQuery.setBuyerId(order.getBuyerId());
  1117 + orderTransportFeeQuery.setMarketId(order.getMarketId());
  1118 + orderTransportFeeQuery.setAchieveAddress(order.getAchieveAddress());
  1119 + Integer number = orderMapper.selectOrderByTransportFee(orderTransportFeeQuery);
  1120 + if(number!=null &&number>0){
  1121 + transportFeeDto.setTransportFee(0L);
  1122 + return transportFeeDto;
  1123 + }else{
  1124 + transportFeeDto.setTransportFee(shopExpressVo.getFee().multiply(NumberTransform.ONE_HUNDERD).longValue());
  1125 + return transportFeeDto;
  1126 + }
  1127 + }
  1128 + }
  1129 + return transportFeeDto;
  1130 + }else{
  1131 + transportFeeDto.setTransportFee(shopExpressVo.getFee().multiply(NumberTransform.ONE_HUNDERD).longValue());
  1132 + return transportFeeDto;
  1133 + }
  1134 + }
  1135 +
  1136 + @Override
1036 1137 public Integer checkPayStateOnLine(String paymentId, Long marketId) {
1037 1138 WeChatPayFunctionDto functionDto = new WeChatPayFunctionDto(paymentId,"online",marketId);
1038 1139 OrderPaymentCheckDto orderPaymentCheckDto = this.wxChatPayCheck(functionDto);
... ...
etrade-order/src/main/resources/com/diligrp/etrade/dao/mapper/order/OrderMapper.xml
... ... @@ -522,4 +522,18 @@
522 522 parameterType="java.lang.String">
523 523 select verify_state,`state`,achieve_state,order_status,pay_state from `order` where `code` = #{code}
524 524 </select>
  525 + <select id="selectOrderByTransportFee" resultType="java.lang.Integer"
  526 + parameterType="com.diligrp.etrade.order.domain.OrderTransportFeeQuery">
  527 + select count(*) from `order` ord
  528 + left join order_delivery ode on ord.`code` = ode.order_code
  529 + <where>
  530 + ord.buyer_id = #{buyerId}
  531 + and ord.shop_id = #{shopId}
  532 + and ord.achieve_type = 2
  533 + and ord.pay_state = 3
  534 + and ode.address = #{achieveAddress}
  535 + and ord.pay_time >= #{startTime}
  536 + and #{endTime} > ord.pay_time
  537 + </where>
  538 + </select>
525 539 </mapper>
526 540 \ No newline at end of file
... ...
etrade-shop/src/main/java/com/diligrp/etrade/shop/api/ShopApi.java
... ... @@ -44,7 +44,7 @@ public class ShopApi {
44 44 */
45 45 @RequestMapping(value = "/update")
46 46 public Message<ShopApproveVo> appUpdate(@Validated({Default.class, UpdateShopApprove.class}) @RequestBody ShopApproveUpdate shopApproveCo) {
47   - log.warn("店铺更新-小程序:{}", JsonUtils.toJsonString(shopApproveCo));
  47 + log.info("店铺更新-小程序:{}", JsonUtils.toJsonString(shopApproveCo));
48 48 return Message.success(shopCommonService.doUpdateShopApprove(shopApproveCo));
49 49 }
50 50  
... ... @@ -53,7 +53,7 @@ public class ShopApi {
53 53 */
54 54 @RequestMapping(value = "/detail/snapshot")
55 55 public Message<ShopApproveVo> minDetailSnapshot(@RequestBody ShopApproveCo shopApproveCo) {
56   - log.warn("店铺详情快照-小程序:{}", JsonUtils.toJsonString(shopApproveCo));
  56 + log.info("店铺详情快照-小程序:{}", JsonUtils.toJsonString(shopApproveCo));
57 57 return Message.success(shopCommonService.doDetailSnapshot(shopApproveCo));
58 58 }
59 59  
... ... @@ -62,7 +62,7 @@ public class ShopApi {
62 62 */
63 63 @RequestMapping(value = "/detail")
64 64 public Message<ShopVo> minDetail(@RequestBody ShopApproveCo shopApproveCo) {
65   - log.warn("店铺详情-小程序:{}", JsonUtils.toJsonString(shopApproveCo));
  65 + log.info("店铺详情-小程序:{}", JsonUtils.toJsonString(shopApproveCo));
66 66 return Message.success(shopCommonService.detail(shopApproveCo));
67 67 }
68 68  
... ... @@ -71,7 +71,7 @@ public class ShopApi {
71 71 */
72 72 @RequestMapping(value = "/recommendation")
73 73 public Message<RecommendVo> recommendation(@RequestBody ShopApproveCo shopApproveCo) {
74   - log.warn("店铺推荐-小程序:{}", JsonUtils.toJsonString(shopApproveCo));
  74 + log.info("店铺推荐-小程序:{}", JsonUtils.toJsonString(shopApproveCo));
75 75 return Message.success(shopCommonService.recommendation(shopApproveCo));
76 76 }
77 77  
... ... @@ -81,7 +81,7 @@ public class ShopApi {
81 81 */
82 82 @RequestMapping(value = "/qrCode")
83 83 public Message<ShopQrCodeVo> qrCode(@RequestBody ShopApproveCo shopApproveCo) {
84   - log.warn("店铺二维码解析-小程序:{}", JsonUtils.toJsonString(shopApproveCo));
  84 + log.info("店铺二维码解析-小程序:{}", JsonUtils.toJsonString(shopApproveCo));
85 85 return Message.success(shopCommonService.qrCode(shopApproveCo));
86 86 }
87 87  
... ... @@ -93,7 +93,7 @@ public class ShopApi {
93 93 */
94 94 @RequestMapping(value = "/selectByCustomerIds")
95 95 public Message<List<ShopVo>> selectByCustomerIds(@RequestBody ShopCo shopCo) {
96   - log.warn("根据客户查询店铺-小程序:{}", JsonUtils.toJsonString(shopCo));
  96 + log.info("根据客户查询店铺-小程序:{}", JsonUtils.toJsonString(shopCo));
97 97 return Message.success(shopCommonService.selectByCustomerIds(shopCo));
98 98 }
99 99  
... ... @@ -102,7 +102,7 @@ public class ShopApi {
102 102 */
103 103 @RequestMapping(value = "/introduction/save")
104 104 public Message<ShopIntroductionTemp> saveShopIntroduction(@RequestBody ShopIntroductionTemp shopIntroductionTemp) {
105   - log.warn("保存店铺介绍-小程序:{}", JsonUtils.toJsonString(shopIntroductionTemp));
  105 + log.info("保存店铺介绍-小程序:{}", JsonUtils.toJsonString(shopIntroductionTemp));
106 106 return Message.success(shopCommonService.saveShopIntroduction(shopIntroductionTemp));
107 107 }
108 108  
... ... @@ -111,7 +111,7 @@ public class ShopApi {
111 111 */
112 112 @RequestMapping(value = "/introduction/query")
113 113 public Message<ShopIntroductionTemp> queryShopIntroduction(@RequestBody ShopIntroductionTemp shopIntroductionTemp) {
114   - log.warn("查询店铺介绍-小程序:{}", JsonUtils.toJsonString(shopIntroductionTemp));
  114 + log.info("查询店铺介绍-小程序:{}", JsonUtils.toJsonString(shopIntroductionTemp));
115 115 return Message.success(shopCommonService.queryShopIntroduction(shopIntroductionTemp));
116 116 }
117 117  
... ... @@ -120,7 +120,7 @@ public class ShopApi {
120 120 */
121 121 @RequestMapping(value = "/search")
122 122 public Message<PageMessage<ShopVo>> search(@RequestBody ShopSearchCo shopSearchCo) {
123   - log.warn("店铺搜索-小程序:{}", JsonUtils.toJsonString(shopSearchCo));
  123 + log.info("店铺搜索-小程序:{}", JsonUtils.toJsonString(shopSearchCo));
124 124 return Message.success(shopCommonService.search(shopSearchCo));
125 125 }
126 126  
... ... @@ -179,7 +179,7 @@ public class ShopApi {
179 179 */
180 180 @RequestMapping(value = "/recommendation/all")
181 181 public Message<List<ShopRecommendationVo>> recommendationAll(@RequestBody ShopRecommendationCo recommendationCo) {
182   - log.warn("店铺推荐全部-小程序:{}", JsonUtils.toJsonString(recommendationCo));
  182 + log.info("店铺推荐全部-小程序:{}", JsonUtils.toJsonString(recommendationCo));
183 183 return Message.success(shopCommonService.recommendationAll(recommendationCo));
184 184 }
185 185 }
186 186 \ No newline at end of file
... ...
etrade-shop/src/main/java/com/diligrp/etrade/shop/api/ShopExpressSettingApi.java 0 → 100644
  1 +package com.diligrp.etrade.shop.api;
  2 +
  3 +
  4 +import com.diligrp.etrade.core.domain.Message;
  5 +import com.diligrp.etrade.core.util.JsonUtils;
  6 +import com.diligrp.etrade.shop.domain.request.ShopExpressCo;
  7 +import com.diligrp.etrade.shop.domain.request.ShopExpressQueryCo;
  8 +import com.diligrp.etrade.shop.domain.response.ShopExpressVo;
  9 +import com.diligrp.etrade.shop.service.ShopExpressSettingService;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.web.bind.annotation.RequestBody;
  14 +import org.springframework.web.bind.annotation.RequestMapping;
  15 +import org.springframework.web.bind.annotation.RestController;
  16 +
  17 +/**
  18 + * 店铺运费设置小程序相关接口
  19 + */
  20 +@RestController
  21 +@RequestMapping("/api/shop/express/setting")
  22 +public class ShopExpressSettingApi {
  23 + private static final Logger log = LoggerFactory.getLogger(ShopExpressSettingApi.class);
  24 + @Autowired
  25 + private ShopExpressSettingService shopExpressSettingService;
  26 +
  27 +
  28 + /**
  29 + * 店铺运费设置详情-小程序
  30 + */
  31 + @RequestMapping(value = "/detail")
  32 + public Message<ShopExpressVo> detail(@RequestBody ShopExpressQueryCo shopExpressQueryCo) {
  33 + log.info("店铺运费设置详情-小程序:{}", JsonUtils.toJsonString(shopExpressQueryCo));
  34 + return Message.success(shopExpressSettingService.detail(shopExpressQueryCo));
  35 + }
  36 +
  37 +
  38 + /**
  39 + * 保存店铺运费设置-小程序
  40 + */
  41 + @RequestMapping(value = "/save")
  42 + public Message<Boolean> save(@RequestBody ShopExpressCo shopExpressCo) {
  43 + log.info("店铺运费保存设置-小程序:{}", JsonUtils.toJsonString(shopExpressCo));
  44 + return Message.success(shopExpressSettingService.save(shopExpressCo));
  45 + }
  46 +
  47 +}
0 48 \ No newline at end of file
... ...
etrade-shop/src/main/java/com/diligrp/etrade/shop/api/ShopManageApi.java
... ... @@ -40,7 +40,7 @@ public class ShopManageApi {
40 40 */
41 41 @RequestMapping(value = "/update")
42 42 public Message<ShopApproveVo> appUpdate(@Validated({Default.class, UpdateShopApprove.class}) @RequestBody ShopApproveUpdate shopApproveCo) {
43   - log.warn("店铺更新-app:{}", JsonUtils.toJsonString(shopApproveCo));
  43 + log.info("店铺更新-app:{}", JsonUtils.toJsonString(shopApproveCo));
44 44 return Message.success(shopCommonService.doUpdateShopApprove(shopApproveCo));
45 45 }
46 46  
... ... @@ -49,7 +49,7 @@ public class ShopManageApi {
49 49 */
50 50 @RequestMapping(value = "/detail/snapshot")
51 51 public Message<ShopApproveVo> appDetailSnapshot(@RequestBody ShopApproveCo shopApproveCo) {
52   - log.warn("店铺详情快照-app:{}", JsonUtils.toJsonString(shopApproveCo));
  52 + log.info("店铺详情快照-app:{}", JsonUtils.toJsonString(shopApproveCo));
53 53 return Message.success(shopCommonService.doDetailSnapshot(shopApproveCo));
54 54 }
55 55  
... ... @@ -58,7 +58,7 @@ public class ShopManageApi {
58 58 */
59 59 @RequestMapping(value = "/detail")
60 60 public Message<ShopVo> minDetail(@RequestBody ShopApproveCo shopApproveCo) {
61   - log.warn("店铺详情-app:{}", JsonUtils.toJsonString(shopApproveCo));
  61 + log.info("店铺详情-app:{}", JsonUtils.toJsonString(shopApproveCo));
62 62 return Message.success(shopCommonService.detail(shopApproveCo));
63 63 }
64 64  
... ... @@ -67,7 +67,7 @@ public class ShopManageApi {
67 67 */
68 68 @RequestMapping(value = "/recommendation")
69 69 public Message<RecommendVo> recommendation(@RequestBody ShopApproveCo shopApproveCo) {
70   - log.warn("店铺推荐-app:{}", JsonUtils.toJsonString(shopApproveCo));
  70 + log.info("店铺推荐-app:{}", JsonUtils.toJsonString(shopApproveCo));
71 71 return Message.success(shopCommonService.recommendation(shopApproveCo));
72 72 }
73 73  
... ... @@ -92,7 +92,7 @@ public class ShopManageApi {
92 92 */
93 93 @RequestMapping(value = "/selectByCustomerIds")
94 94 public Message<List<ShopVo>> selectByCustomerIds(@RequestBody ShopCo shopCo) {
95   - log.warn("根据客户查询店铺-app:{}", JsonUtils.toJsonString(shopCo));
  95 + log.info("根据客户查询店铺-app:{}", JsonUtils.toJsonString(shopCo));
96 96 return Message.success(shopCommonService.selectByCustomerIds(shopCo));
97 97 }
98 98  
... ... @@ -101,7 +101,7 @@ public class ShopManageApi {
101 101 */
102 102 @RequestMapping(value = "/introduction/save")
103 103 public Message<ShopIntroductionTemp> saveShopIntroduction(@RequestBody ShopIntroductionTemp shopIntroductionTemp) {
104   - log.warn("保存店铺介绍-app:{}", JsonUtils.toJsonString(shopIntroductionTemp));
  104 + log.info("保存店铺介绍-app:{}", JsonUtils.toJsonString(shopIntroductionTemp));
105 105 return Message.success(shopCommonService.saveShopIntroduction(shopIntroductionTemp));
106 106 }
107 107  
... ... @@ -110,7 +110,7 @@ public class ShopManageApi {
110 110 */
111 111 @RequestMapping(value = "/introduction/query")
112 112 public Message<ShopIntroductionTemp> queryShopIntroduction(@RequestBody ShopIntroductionTemp shopIntroductionTemp) {
113   - log.warn("查询店铺介绍-app:{}", JsonUtils.toJsonString(shopIntroductionTemp));
  113 + log.info("查询店铺介绍-app:{}", JsonUtils.toJsonString(shopIntroductionTemp));
114 114 return Message.success(shopCommonService.queryShopIntroduction(shopIntroductionTemp));
115 115 }
116 116  
... ...
etrade-shop/src/main/java/com/diligrp/etrade/shop/constant/Constant.java
... ... @@ -81,4 +81,9 @@ public interface Constant {
81 81 BigDecimal STOCK_CONFIG_JMSF_DEFAULT = BigDecimal.valueOf(100.00);
82 82  
83 83 Integer IMAGE_GLOBAL_TYPE_SHARE = 1;
  84 +
  85 + /**
  86 + * 店铺包邮时间间隔 /小时
  87 + */
  88 + Integer SHOP_EXPRESS_FREE_TIME_PERIOD = 24;
84 89 }
... ...
etrade-shop/src/main/java/com/diligrp/etrade/shop/dao/ShopExpressSettingDao.java 0 → 100644
  1 +package com.diligrp.etrade.shop.dao;
  2 +
  3 +import com.diligrp.etrade.core.mybatis.MybatisMapperSupport;
  4 +import com.diligrp.etrade.shop.domain.response.ShopExpressVo;
  5 +import com.diligrp.etrade.shop.model.ShopExpressSetting;
  6 +import org.springframework.stereotype.Repository;
  7 +
  8 +@Repository("shopExpressSettingDao")
  9 +public interface ShopExpressSettingDao extends MybatisMapperSupport {
  10 +
  11 + int insert(ShopExpressSetting record);
  12 +
  13 + ShopExpressVo selectByShopId(Long shopId);
  14 +
  15 + int update(ShopExpressSetting record);
  16 +}
0 17 \ No newline at end of file
... ...
etrade-shop/src/main/java/com/diligrp/etrade/shop/domain/request/ShopExpressCo.java 0 → 100644
  1 +package com.diligrp.etrade.shop.domain.request;
  2 +
  3 +import com.diligrp.etrade.core.util.JsonUtils;
  4 +import com.diligrp.etrade.shop.model.ShopExpressSetting;
  5 +import jakarta.validation.constraints.NotNull;
  6 +import jakarta.validation.constraints.Size;
  7 +import org.springframework.format.annotation.DateTimeFormat;
  8 +
  9 +import java.io.Serializable;
  10 +import java.math.BigDecimal;
  11 +import java.time.LocalTime;
  12 +import java.util.Date;
  13 +import java.util.List;
  14 +
  15 +/**
  16 + * 店铺运费设置
  17 + *
  18 + * @author
  19 + */
  20 +public class ShopExpressCo implements Serializable {
  21 +
  22 +
  23 + private Long id;
  24 + /**
  25 + * 店铺id
  26 + */
  27 + private Long shopId;
  28 + /**
  29 + * 配送方式
  30 + */
  31 + @Size(min = 1, message = "至少选择一种配送方式!")
  32 + private List<Integer> type;
  33 + /**
  34 + * 固定运费
  35 + */
  36 + @NotNull(message = "fee should not be null")
  37 + private BigDecimal fee;
  38 + /**
  39 + * 包邮条件
  40 + */
  41 + private List<Integer> condition;
  42 + /**
  43 + * 包邮金额
  44 + */
  45 + private BigDecimal freeAmount;
  46 + /**
  47 + * 包邮时间
  48 + */
  49 + @DateTimeFormat(pattern = "HH:mm")
  50 + private LocalTime freeTime;
  51 + /**
  52 + * 创建时间
  53 + */
  54 + private Date createdTime;
  55 + /**
  56 + * 创建人名字
  57 + */
  58 + private String creater;
  59 + /**
  60 + * 创建人ID
  61 + */
  62 + private Long createrId;
  63 + /**
  64 + * 更新时间
  65 + */
  66 + private Date modifiedTime;
  67 + /**
  68 + * 修改人名字
  69 + */
  70 + private String modifier;
  71 + /**
  72 + * 修改人ID
  73 + */
  74 + private Long modifierId;
  75 +
  76 + public ShopExpressSetting toShopExpressSetting() {
  77 + ShopExpressSetting shopExpressSetting = new ShopExpressSetting();
  78 + shopExpressSetting.setId(this.getId());
  79 + shopExpressSetting.setShopId(this.getShopId());
  80 + shopExpressSetting.setType(JsonUtils.toJsonString(this.getType()) );
  81 + shopExpressSetting.setFee(this.getFee());
  82 + shopExpressSetting.setCondition(JsonUtils.toJsonString(this.getCondition()));
  83 + shopExpressSetting.setFreeAmount(this.getFreeAmount());
  84 + shopExpressSetting.setFreeTime(this.getFreeTime());
  85 + return shopExpressSetting;
  86 + }
  87 +
  88 + public Long getId() {
  89 + return id;
  90 + }
  91 +
  92 + public void setId(Long id) {
  93 + this.id = id;
  94 + }
  95 +
  96 + public Long getShopId() {
  97 + return shopId;
  98 + }
  99 +
  100 + public void setShopId(Long shopId) {
  101 + this.shopId = shopId;
  102 + }
  103 +
  104 + public List<Integer> getType() {
  105 + return type;
  106 + }
  107 +
  108 + public void setType(List<Integer> type) {
  109 + this.type = type;
  110 + }
  111 +
  112 + public BigDecimal getFee() {
  113 + return fee;
  114 + }
  115 +
  116 + public void setFee(BigDecimal fee) {
  117 + this.fee = fee;
  118 + }
  119 +
  120 + public List<Integer> getCondition() {
  121 + return condition;
  122 + }
  123 +
  124 + public void setCondition(List<Integer> condition) {
  125 + this.condition = condition;
  126 + }
  127 +
  128 + public BigDecimal getFreeAmount() {
  129 + return freeAmount;
  130 + }
  131 +
  132 + public void setFreeAmount(BigDecimal freeAmount) {
  133 + this.freeAmount = freeAmount;
  134 + }
  135 +
  136 + public LocalTime getFreeTime() {
  137 + return freeTime;
  138 + }
  139 +
  140 + public void setFreeTime(LocalTime freeTime) {
  141 + this.freeTime = freeTime;
  142 + }
  143 +
  144 + public Date getCreatedTime() {
  145 + return createdTime;
  146 + }
  147 +
  148 + public void setCreatedTime(Date createdTime) {
  149 + this.createdTime = createdTime;
  150 + }
  151 +
  152 + public String getCreater() {
  153 + return creater;
  154 + }
  155 +
  156 + public void setCreater(String creater) {
  157 + this.creater = creater;
  158 + }
  159 +
  160 + public Long getCreaterId() {
  161 + return createrId;
  162 + }
  163 +
  164 + public void setCreaterId(Long createrId) {
  165 + this.createrId = createrId;
  166 + }
  167 +
  168 + public Date getModifiedTime() {
  169 + return modifiedTime;
  170 + }
  171 +
  172 + public void setModifiedTime(Date modifiedTime) {
  173 + this.modifiedTime = modifiedTime;
  174 + }
  175 +
  176 + public String getModifier() {
  177 + return modifier;
  178 + }
  179 +
  180 + public void setModifier(String modifier) {
  181 + this.modifier = modifier;
  182 + }
  183 +
  184 + public Long getModifierId() {
  185 + return modifierId;
  186 + }
  187 +
  188 + public void setModifierId(Long modifierId) {
  189 + this.modifierId = modifierId;
  190 + }
  191 +}
0 192 \ No newline at end of file
... ...
etrade-shop/src/main/java/com/diligrp/etrade/shop/domain/request/ShopExpressQueryCo.java 0 → 100644
  1 +package com.diligrp.etrade.shop.domain.request;
  2 +
  3 +import jakarta.validation.constraints.NotNull;
  4 +
  5 +import java.io.Serializable;
  6 +
  7 +/**
  8 + * 店铺运费设置查询
  9 + *
  10 + * @author
  11 + */
  12 +public class ShopExpressQueryCo implements Serializable {
  13 +
  14 +
  15 + /**
  16 + * 店铺id
  17 + */
  18 + @NotNull(message = "shopId should not be null")
  19 + private Long shopId;
  20 +
  21 +
  22 + public Long getShopId() {
  23 + return shopId;
  24 + }
  25 +
  26 + public void setShopId(Long shopId) {
  27 + this.shopId = shopId;
  28 + }
  29 +}
0 30 \ No newline at end of file
... ...
etrade-shop/src/main/java/com/diligrp/etrade/shop/domain/response/ShopExpressVo.java 0 → 100644
  1 +package com.diligrp.etrade.shop.domain.response;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +
  5 +import java.io.Serializable;
  6 +import java.math.BigDecimal;
  7 +import java.time.LocalTime;
  8 +import java.util.Date;
  9 +import java.util.List;
  10 +
  11 +/**
  12 + * 店铺运费设置
  13 + *
  14 + * @author
  15 + */
  16 +public class ShopExpressVo implements Serializable {
  17 +
  18 + private static final long serialVersionUID = 1L;
  19 +
  20 + private Long id;
  21 + /**
  22 + * 店铺id
  23 + */
  24 + private Long shopId;
  25 + /**
  26 + * 配送方式
  27 + */
  28 + private List<Integer> type;
  29 + /**
  30 + * 固定运费
  31 + */
  32 + private BigDecimal fee;
  33 + /**
  34 + * 包邮条件
  35 + */
  36 + private List<Integer> condition;
  37 + /**
  38 + * 包邮金额
  39 + */
  40 + private BigDecimal freeAmount;
  41 + /**
  42 + * 包邮时间
  43 + */
  44 + @JsonFormat(pattern = "HH:mm")
  45 + private LocalTime freeTime;
  46 +
  47 + /**
  48 + * 包邮时间段 单位小时
  49 + */
  50 + private Integer period;
  51 +
  52 + /**
  53 + * 创建时间
  54 + */
  55 + private Date createdTime;
  56 + /**
  57 + * 创建人名字
  58 + */
  59 + private String creater;
  60 + /**
  61 + * 创建人ID
  62 + */
  63 + private Long createrId;
  64 + /**
  65 + * 更新时间
  66 + */
  67 + private Date modifiedTime;
  68 + /**
  69 + * 修改人名字
  70 + */
  71 + private String modifier;
  72 + /**
  73 + * 修改人ID
  74 + */
  75 + private Long modifierId;
  76 +
  77 + public Long getId() {
  78 + return id;
  79 + }
  80 +
  81 + public void setId(Long id) {
  82 + this.id = id;
  83 + }
  84 +
  85 + public Long getShopId() {
  86 + return shopId;
  87 + }
  88 +
  89 + public void setShopId(Long shopId) {
  90 + this.shopId = shopId;
  91 + }
  92 +
  93 + public List<Integer> getType() {
  94 + return type;
  95 + }
  96 +
  97 + public void setType(List<Integer> type) {
  98 + this.type = type;
  99 + }
  100 +
  101 + public BigDecimal getFee() {
  102 + return fee;
  103 + }
  104 +
  105 + public void setFee(BigDecimal fee) {
  106 + this.fee = fee;
  107 + }
  108 +
  109 + public List<Integer> getCondition() {
  110 + return condition;
  111 + }
  112 +
  113 + public void setCondition(List<Integer> condition) {
  114 + this.condition = condition;
  115 + }
  116 +
  117 + public BigDecimal getFreeAmount() {
  118 + return freeAmount;
  119 + }
  120 +
  121 + public void setFreeAmount(BigDecimal freeAmount) {
  122 + this.freeAmount = freeAmount;
  123 + }
  124 +
  125 + public LocalTime getFreeTime() {
  126 + return freeTime;
  127 + }
  128 +
  129 + public void setFreeTime(LocalTime freeTime) {
  130 + this.freeTime = freeTime;
  131 + }
  132 +
  133 + public Integer getPeriod() {
  134 + return period;
  135 + }
  136 +
  137 + public void setPeriod(Integer period) {
  138 + this.period = period;
  139 + }
  140 +
  141 + public Date getCreatedTime() {
  142 + return createdTime;
  143 + }
  144 +
  145 + public void setCreatedTime(Date createdTime) {
  146 + this.createdTime = createdTime;
  147 + }
  148 +
  149 + public String getCreater() {
  150 + return creater;
  151 + }
  152 +
  153 + public void setCreater(String creater) {
  154 + this.creater = creater;
  155 + }
  156 +
  157 + public Long getCreaterId() {
  158 + return createrId;
  159 + }
  160 +
  161 + public void setCreaterId(Long createrId) {
  162 + this.createrId = createrId;
  163 + }
  164 +
  165 + public Date getModifiedTime() {
  166 + return modifiedTime;
  167 + }
  168 +
  169 + public void setModifiedTime(Date modifiedTime) {
  170 + this.modifiedTime = modifiedTime;
  171 + }
  172 +
  173 + public String getModifier() {
  174 + return modifier;
  175 + }
  176 +
  177 + public void setModifier(String modifier) {
  178 + this.modifier = modifier;
  179 + }
  180 +
  181 + public Long getModifierId() {
  182 + return modifierId;
  183 + }
  184 +
  185 + public void setModifierId(Long modifierId) {
  186 + this.modifierId = modifierId;
  187 + }
  188 +}
0 189 \ No newline at end of file
... ...
etrade-shop/src/main/java/com/diligrp/etrade/shop/model/ShopExpressSetting.java 0 → 100644
  1 +package com.diligrp.etrade.shop.model;
  2 +
  3 +import java.io.Serializable;
  4 +import java.math.BigDecimal;
  5 +import java.time.LocalTime;
  6 +import java.util.Date;
  7 +
  8 +/**
  9 + * 店铺运费设置
  10 + * shop_express_setting
  11 + */
  12 +
  13 +public class ShopExpressSetting implements Serializable {
  14 + private static final long serialVersionUID = 1L;
  15 + private Long id;
  16 + /**
  17 + * 店铺id
  18 + */
  19 + private Long shopId;
  20 + /**
  21 + * 配送方式
  22 + */
  23 + private String type;
  24 + /**
  25 + * 固定运费
  26 + */
  27 + private BigDecimal fee;
  28 + /**
  29 + * 包邮条件
  30 + */
  31 + private String condition;
  32 + /**
  33 + * 包邮金额
  34 + */
  35 + private BigDecimal freeAmount;
  36 + /**
  37 + * 包邮时间
  38 + */
  39 + private LocalTime freeTime;
  40 + /**
  41 + * 包邮时间段 单位小时
  42 + */
  43 + private Integer period;
  44 + /**
  45 + * 创建时间
  46 + */
  47 + private Date createdTime;
  48 + /**
  49 + * 创建人名字
  50 + */
  51 + private String creater;
  52 + /**
  53 + * 创建人ID
  54 + */
  55 + private Long createrId;
  56 + /**
  57 + * 更新时间
  58 + */
  59 + private Date modifiedTime;
  60 + /**
  61 + * 修改人名字
  62 + */
  63 + private String modifier;
  64 + /**
  65 + * 修改人ID
  66 + */
  67 + private Long modifierId;
  68 +
  69 + public Long getId() {
  70 + return id;
  71 + }
  72 +
  73 + public void setId(Long id) {
  74 + this.id = id;
  75 + }
  76 +
  77 + public Long getShopId() {
  78 + return shopId;
  79 + }
  80 +
  81 + public void setShopId(Long shopId) {
  82 + this.shopId = shopId;
  83 + }
  84 +
  85 + public String getType() {
  86 + return type;
  87 + }
  88 +
  89 + public void setType(String type) {
  90 + this.type = type;
  91 + }
  92 +
  93 + public BigDecimal getFee() {
  94 + return fee;
  95 + }
  96 +
  97 + public void setFee(BigDecimal fee) {
  98 + this.fee = fee;
  99 + }
  100 +
  101 + public String getCondition() {
  102 + return condition;
  103 + }
  104 +
  105 + public void setCondition(String condition) {
  106 + this.condition = condition;
  107 + }
  108 +
  109 + public BigDecimal getFreeAmount() {
  110 + return freeAmount;
  111 + }
  112 +
  113 + public void setFreeAmount(BigDecimal freeAmount) {
  114 + this.freeAmount = freeAmount;
  115 + }
  116 +
  117 + public LocalTime getFreeTime() {
  118 + return freeTime;
  119 + }
  120 +
  121 + public void setFreeTime(LocalTime freeTime) {
  122 + this.freeTime = freeTime;
  123 + }
  124 +
  125 + public Integer getPeriod() {
  126 + return period;
  127 + }
  128 +
  129 + public void setPeriod(Integer period) {
  130 + this.period = period;
  131 + }
  132 +
  133 + public Date getCreatedTime() {
  134 + return createdTime;
  135 + }
  136 +
  137 + public void setCreatedTime(Date createdTime) {
  138 + this.createdTime = createdTime;
  139 + }
  140 +
  141 + public String getCreater() {
  142 + return creater;
  143 + }
  144 +
  145 + public void setCreater(String creater) {
  146 + this.creater = creater;
  147 + }
  148 +
  149 + public Long getCreaterId() {
  150 + return createrId;
  151 + }
  152 +
  153 + public void setCreaterId(Long createrId) {
  154 + this.createrId = createrId;
  155 + }
  156 +
  157 + public Date getModifiedTime() {
  158 + return modifiedTime;
  159 + }
  160 +
  161 + public void setModifiedTime(Date modifiedTime) {
  162 + this.modifiedTime = modifiedTime;
  163 + }
  164 +
  165 + public String getModifier() {
  166 + return modifier;
  167 + }
  168 +
  169 + public void setModifier(String modifier) {
  170 + this.modifier = modifier;
  171 + }
  172 +
  173 + public Long getModifierId() {
  174 + return modifierId;
  175 + }
  176 +
  177 + public void setModifierId(Long modifierId) {
  178 + this.modifierId = modifierId;
  179 + }
  180 +}
0 181 \ No newline at end of file
... ...
etrade-shop/src/main/java/com/diligrp/etrade/shop/service/ShopExpressSettingService.java 0 → 100644
  1 +package com.diligrp.etrade.shop.service;
  2 +
  3 +import com.diligrp.etrade.shop.domain.request.ShopExpressCo;
  4 +import com.diligrp.etrade.shop.domain.request.ShopExpressQueryCo;
  5 +import com.diligrp.etrade.shop.domain.response.ShopExpressVo;
  6 +
  7 +public interface ShopExpressSettingService {
  8 +
  9 +
  10 + /**
  11 + * 查询店铺店铺运费设置详情
  12 + */
  13 + ShopExpressVo detail(ShopExpressQueryCo shopExpressQueryCo);
  14 +
  15 + /**
  16 + * 保存店铺运费设置
  17 + */
  18 + boolean save(ShopExpressCo shopExpressCo);
  19 +}
... ...
etrade-shop/src/main/java/com/diligrp/etrade/shop/service/impl/ShopExpressSettingServiceImpl.java 0 → 100644
  1 +package com.diligrp.etrade.shop.service.impl;
  2 +
  3 +import com.diligrp.etrade.shop.constant.Constant;
  4 +import com.diligrp.etrade.shop.dao.ShopExpressSettingDao;
  5 +import com.diligrp.etrade.shop.domain.request.ShopExpressCo;
  6 +import com.diligrp.etrade.shop.domain.request.ShopExpressQueryCo;
  7 +import com.diligrp.etrade.shop.domain.response.ShopExpressVo;
  8 +import com.diligrp.etrade.shop.model.ShopExpressSetting;
  9 +import com.diligrp.etrade.shop.service.ShopExpressSettingService;
  10 +import com.diligrp.etrade.shop.type.ExpressType;
  11 +import org.slf4j.Logger;
  12 +import org.slf4j.LoggerFactory;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.stereotype.Service;
  15 +
  16 +import java.util.List;
  17 +
  18 +@Service
  19 +public class ShopExpressSettingServiceImpl implements ShopExpressSettingService {
  20 +
  21 + private static final Logger log = LoggerFactory.getLogger(ShopExpressSettingServiceImpl.class);
  22 +
  23 + @Autowired
  24 + private ShopExpressSettingDao shopExpressSettingDao;
  25 +
  26 + @Override
  27 + public ShopExpressVo detail(ShopExpressQueryCo queryCo) {
  28 +
  29 + ShopExpressVo shopExpressVo = shopExpressSettingDao.selectByShopId(queryCo.getShopId());
  30 + if (shopExpressVo == null) {
  31 + shopExpressVo = new ShopExpressVo();
  32 + shopExpressVo.setType(List.of(ExpressType.PICK_UP.getCode()));
  33 + }
  34 +
  35 + return shopExpressVo;
  36 + }
  37 +
  38 + @Override
  39 + public boolean save(ShopExpressCo shopExpressCo) {
  40 +
  41 + ShopExpressVo shopExpressVo = shopExpressSettingDao.selectByShopId(shopExpressCo.getShopId());
  42 + if (shopExpressVo == null) {
  43 + ShopExpressSetting shopExpressSetting = shopExpressCo.toShopExpressSetting();
  44 + shopExpressSetting.setPeriod(Constant.SHOP_EXPRESS_FREE_TIME_PERIOD);
  45 + int insert = shopExpressSettingDao.insert(shopExpressSetting);
  46 + return insert > 0;
  47 + } else {
  48 + ShopExpressSetting shopExpressSetting = shopExpressCo.toShopExpressSetting();
  49 + int update = shopExpressSettingDao.update(shopExpressSetting);
  50 + return update > 0;
  51 + }
  52 +
  53 + }
  54 +}
... ...
etrade-shop/src/main/java/com/diligrp/etrade/shop/type/ExpressCondition.java 0 → 100644
  1 +package com.diligrp.etrade.shop.type;
  2 +
  3 +import com.diligrp.etrade.core.type.IEnumType;
  4 +
  5 +import java.util.Arrays;
  6 +import java.util.List;
  7 +import java.util.Optional;
  8 +import java.util.stream.Stream;
  9 +
  10 +public enum ExpressCondition implements IEnumType {
  11 +
  12 +
  13 + MONEY("满金额包邮", 1),
  14 + LOGIC("满逻辑包邮", 2),
  15 +
  16 + ;
  17 + private final String name;
  18 + private final int code;
  19 +
  20 + private ExpressCondition(String name, int code) {
  21 + this.name = name;
  22 + this.code = code;
  23 + }
  24 +
  25 + public static Optional<ExpressCondition> get(int code) {
  26 + Stream<ExpressCondition> stream = Arrays.stream(values());
  27 + return stream.filter((gender) -> {
  28 + return gender.getCode() == code;
  29 + }).findFirst();
  30 + }
  31 +
  32 + public static String getName(int code) {
  33 + Stream<ExpressCondition> stream = Arrays.stream(values());
  34 + Optional<String> result = stream.filter((gender) -> {
  35 + return gender.getCode() == code;
  36 + }).map(ExpressCondition::getName).findFirst();
  37 + return result.isPresent() ? (String) result.get() : null;
  38 + }
  39 +
  40 + public static List<ExpressCondition> getList() {
  41 + return Arrays.asList(values());
  42 + }
  43 +
  44 + public String getName() {
  45 + return this.name;
  46 + }
  47 +
  48 + public int getCode() {
  49 + return this.code;
  50 + }
  51 +
  52 + public String toString() {
  53 + return this.name;
  54 + }
  55 +}
0 56 \ No newline at end of file
... ...
etrade-shop/src/main/java/com/diligrp/etrade/shop/type/ExpressType.java 0 → 100644
  1 +package com.diligrp.etrade.shop.type;
  2 +
  3 +import com.diligrp.etrade.core.type.IEnumType;
  4 +
  5 +import java.util.Arrays;
  6 +import java.util.List;
  7 +import java.util.Optional;
  8 +import java.util.stream.Stream;
  9 +
  10 +public enum ExpressType implements IEnumType {
  11 +
  12 +
  13 + PICK_UP("到店自提", 1),
  14 + DELIVERY("物流配送", 2),
  15 +
  16 + ;
  17 + private final String name;
  18 + private final int code;
  19 +
  20 + private ExpressType(String name, int code) {
  21 + this.name = name;
  22 + this.code = code;
  23 + }
  24 +
  25 + public static Optional<ExpressType> get(int code) {
  26 + Stream<ExpressType> stream = Arrays.stream(values());
  27 + return stream.filter((gender) -> {
  28 + return gender.getCode() == code;
  29 + }).findFirst();
  30 + }
  31 +
  32 + public static String getName(int code) {
  33 + Stream<ExpressType> stream = Arrays.stream(values());
  34 + Optional<String> result = stream.filter((gender) -> {
  35 + return gender.getCode() == code;
  36 + }).map(ExpressType::getName).findFirst();
  37 + return result.isPresent() ? (String) result.get() : null;
  38 + }
  39 +
  40 + public static List<ExpressType> getList() {
  41 + return Arrays.asList(values());
  42 + }
  43 +
  44 + public String getName() {
  45 + return this.name;
  46 + }
  47 +
  48 + public int getCode() {
  49 + return this.code;
  50 + }
  51 +
  52 + public String toString() {
  53 + return this.name;
  54 + }
  55 +}
0 56 \ No newline at end of file
... ...
etrade-shop/src/main/resources/com/diligrp/etrade/dao/mapper/ShopExpressSettingDao.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.diligrp.etrade.shop.dao.ShopExpressSettingDao">
  4 +
  5 + <resultMap id="BaseResultMap" type="com.diligrp.etrade.shop.domain.response.ShopExpressVo">
  6 + <id column="id" jdbcType="BIGINT" property="id" />
  7 + <result column="shop_id" jdbcType="BIGINT" property="shopId" />
  8 + <result column="type" property="type" typeHandler="com.diligrp.etrade.core.mybatis.JsonArrayTypeHandler"/>
  9 + <result column="fee" jdbcType="DECIMAL" property="fee" />
  10 + <result column="condition" property="condition" typeHandler="com.diligrp.etrade.core.mybatis.JsonArrayTypeHandler"/>
  11 + <result column="free_amount" jdbcType="DECIMAL" property="freeAmount" />
  12 + <result column="free_time" jdbcType="VARCHAR" property="freeTime" />
  13 + <result column="period" jdbcType="INTEGER" property="period" />
  14 + <result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
  15 + <result column="creater" jdbcType="VARCHAR" property="creater" />
  16 + <result column="creater_id" jdbcType="BIGINT" property="createrId" />
  17 + <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
  18 + <result column="modifier" jdbcType="VARCHAR" property="modifier" />
  19 + <result column="modifier_id" jdbcType="BIGINT" property="modifierId" />
  20 + </resultMap>
  21 +
  22 + <sql id="Base_Column_List">
  23 + id, shop_id, `type`, fee, `condition`, free_amount, free_time, `period`, created_time, creater,
  24 + creater_id, modified_time, modifier, modifier_id
  25 + </sql>
  26 + <select id="selectByShopId" parameterType="java.lang.Long" resultMap="BaseResultMap">
  27 + select
  28 + <include refid="Base_Column_List" />
  29 + from shop_express_setting
  30 + where shop_id = #{shopId,jdbcType=BIGINT}
  31 + </select>
  32 +
  33 + <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.diligrp.etrade.shop.model.ShopExpressSetting" useGeneratedKeys="true">
  34 + insert into shop_express_setting (shop_id, `type`, fee,
  35 + `condition`, free_amount, free_time, period,
  36 + creater, creater_id, modifier, modifier_id
  37 + )
  38 + values (#{shopId,jdbcType=BIGINT}, #{type,jdbcType=OTHER}, #{fee,jdbcType=DECIMAL},
  39 + #{condition,jdbcType=OTHER}, #{freeAmount,jdbcType=DECIMAL}, #{freeTime,jdbcType=VARCHAR}, #{period,jdbcType=INTEGER},
  40 + #{creater,jdbcType=VARCHAR}, #{createrId,jdbcType=BIGINT}, #{modifier,jdbcType=VARCHAR}, #{modifierId,jdbcType=BIGINT}
  41 + )
  42 + </insert>
  43 +
  44 + <update id="update" parameterType="com.diligrp.etrade.shop.model.ShopExpressSetting">
  45 + update shop_express_setting
  46 + <set>
  47 + <if test="type != null">
  48 + `type` = #{type,jdbcType=OTHER},
  49 + </if>
  50 + <if test="fee != null">
  51 + fee = #{fee,jdbcType=DECIMAL},
  52 + </if>
  53 + <if test="condition != null">
  54 + `condition` = #{condition,jdbcType=OTHER},
  55 + </if>
  56 + <if test="freeAmount != null">
  57 + free_amount = #{freeAmount,jdbcType=DECIMAL},
  58 + </if>
  59 + <if test="freeTime != null">
  60 + free_time = #{freeTime,jdbcType=VARCHAR},
  61 + </if>
  62 + <if test="period != null">
  63 + period = #{period,jdbcType=INTEGER},
  64 + </if>
  65 + <if test="modifier != null">
  66 + modifier = #{modifier,jdbcType=VARCHAR},
  67 + </if>
  68 + <if test="modifierId != null">
  69 + modifier_id = #{modifierId,jdbcType=BIGINT},
  70 + </if>
  71 + </set>
  72 + where shop_id = #{shopId,jdbcType=BIGINT}
  73 + </update>
  74 +
  75 +</mapper>
0 76 \ No newline at end of file
... ...
scripts/etrade-shop/etrade_shop.sql
... ... @@ -420,4 +420,23 @@ CREATE TABLE `shop` (
420 420 UNIQUE INDEX `unq_market_customer`(`market_id` ASC, `customer_id` ASC, `name` ASC) USING BTREE COMMENT '同一市场同一客户只有一个店铺',
421 421 INDEX `idx_customer_id`(`customer_id` ASC) USING BTREE COMMENT '开店客户id索引'
422 422 ) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '店铺信息表' ;
  423 +
  424 +DROP TABLE IF EXISTS `shop_express_setting`;
  425 +CREATE TABLE `shop_express_setting` (
  426 + `id` bigint NOT NULL AUTO_INCREMENT,
  427 + `shop_id` bigint NOT NULL COMMENT '店铺id',
  428 + `type` json NOT NULL COMMENT '配送方式',
  429 + `fee` DECIMAL(24,2) DEFAULT NULL COMMENT '固定运费',
  430 + `condition` json DEFAULT NULL COMMENT '包邮条件',
  431 + `free_amount` DECIMAL(24,2) DEFAULT NULL COMMENT '包邮金额',
  432 + `free_time` varchar(50) COMMENT '包邮时间',
  433 + `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  434 + `creater` varchar(50) NULL DEFAULT NULL COMMENT '创建人名字',
  435 + `creater_id` bigint NULL DEFAULT NULL COMMENT '创建人ID',
  436 + `modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  437 + `modifier` varchar(50) NULL DEFAULT NULL COMMENT '修改人名字',
  438 + `modifier_id` bigint NULL DEFAULT NULL COMMENT '修改人ID',
  439 + PRIMARY KEY (`id`) USING BTREE,
  440 + INDEX idx_shop_id(`shop_id`) USING BTREE COMMENT '店铺id'
  441 +) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '店铺运费设置' ;
423 442 -- 店铺部分end--
424 443 \ No newline at end of file
... ...
scripts/upgrade/v1.0.26/etrade_shop_1.0.24_data_kangtian.sql 0 → 100644
  1 +DROP TABLE IF EXISTS `shop_express_setting`;
  2 +CREATE TABLE `shop_express_setting`
  3 +(
  4 + `id` bigint NOT NULL AUTO_INCREMENT,
  5 + `shop_id` bigint NOT NULL COMMENT '店铺id',
  6 + `type` json NOT NULL COMMENT '配送方式',
  7 + `fee` DECIMAL(24, 2) DEFAULT NULL COMMENT '固定运费',
  8 + `condition` json DEFAULT NULL COMMENT '包邮条件',
  9 + `free_amount` DECIMAL(24, 2) DEFAULT NULL COMMENT '包邮金额',
  10 + `free_time` time COMMENT '包邮时间',
  11 + `period` int COMMENT '包邮时间段(如偏移24小时)',
  12 + `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  13 + `creater` varchar(50) NULL DEFAULT NULL COMMENT '创建人名字',
  14 + `creater_id` bigint NULL DEFAULT NULL COMMENT '创建人ID',
  15 + `modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  16 + `modifier` varchar(50) NULL DEFAULT NULL COMMENT '修改人名字',
  17 + `modifier_id` bigint NULL DEFAULT NULL COMMENT '修改人ID',
  18 + PRIMARY KEY (`id`) USING BTREE,
  19 + INDEX idx_shop_id(`shop_id`) USING BTREE COMMENT '店铺id'
  20 +) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '店铺运费设置';
0 21 \ No newline at end of file
... ...