Commit d665621f0973702e3f8aef5be98b5df460dbd165

Authored by fengliang
1 parent d81cfbf1

update:订单列表时间查询修改

etrade-order/src/main/java/com/diligrp/etrade/order/api/OrderQueryBuyerController.java
... ... @@ -124,15 +124,13 @@ public class OrderQueryBuyerController {
124 124 @RequestMapping(value = "/queryOrderPageByBuyer",method = {RequestMethod.POST},produces="application/json;charset=UTF-8")
125 125 public PageMessage<OrderDto> queryOrderPageByBuyer(@Valid @RequestBody OrderQueryBuyerDto orderQueryDto, BindingResult result){
126 126 LOGGER.info("买家查询订单列表,{}",orderQueryDto);
127   - if(orderQueryDto.getMonth()==null&&(orderQueryDto.getStartDate()==null||orderQueryDto.getEndDate()==null)){
128   - throw new OrderException(OrderErrorCode.PARAM_ERROR,"请选择月份或自定义查询时间");
129   - }else if(orderQueryDto.getStartDate()!=null&&orderQueryDto.getEndDate()!=null){
  127 + if(orderQueryDto.getStartDate()!=null&&orderQueryDto.getEndDate()!=null){
130 128 if(orderQueryDto.getEndDate().isBefore(orderQueryDto.getStartDate())){
131 129 throw new OrderException(OrderErrorCode.PARAM_ERROR,"结束时间不能大于开始时间");
132 130 }
133 131 orderQueryDto.setStartDate(LocalDateTime.of(orderQueryDto.getStartDate().toLocalDate(), LocalTime.MIN));
134 132 orderQueryDto.setEndDate(LocalDateTime.of(orderQueryDto.getEndDate().toLocalDate(), LocalTime.MAX));
135   - }else{
  133 + }else if(orderQueryDto.getMonth()!=null){
136 134 orderQueryDto.setStartDate(orderQueryDto.getMonth().with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN));
137 135 orderQueryDto.setEndDate(orderQueryDto.getMonth().with(TemporalAdjusters.lastDayOfMonth()).with(LocalTime.MAX));
138 136 }
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/api/OrderQuerySellerController.java
... ... @@ -71,15 +71,13 @@ public class OrderQuerySellerController {
71 71 @RequestMapping(value = "/queryOrderPageBySeller",method = {RequestMethod.POST},produces="application/json;charset=UTF-8")
72 72 public PageMessage<OrderDto> queryOrderPageBySeller(@Valid @RequestBody OrderQuerySellerDto orderQuerySellerDto, BindingResult result){
73 73 LOGGER.info("卖方查询订单列表,{}",orderQuerySellerDto);
74   - if(orderQuerySellerDto.getMonth()==null&&(orderQuerySellerDto.getStartDate()==null||orderQuerySellerDto.getEndDate()==null)){
75   - throw new OrderException(OrderErrorCode.PARAM_ERROR,"请选择月份或自定义查询时间");
76   - }else if(orderQuerySellerDto.getStartDate()!=null&&orderQuerySellerDto.getEndDate()!=null){
  74 + if(orderQuerySellerDto.getStartDate()!=null&&orderQuerySellerDto.getEndDate()!=null){
77 75 if(orderQuerySellerDto.getEndDate().isBefore(orderQuerySellerDto.getStartDate())){
78 76 throw new OrderException(OrderErrorCode.PARAM_ERROR,"结束时间不能大于开始时间");
79 77 }
80 78 orderQuerySellerDto.setStartDate(LocalDateTime.of(orderQuerySellerDto.getStartDate().toLocalDate(), LocalTime.MIN));
81 79 orderQuerySellerDto.setEndDate(LocalDateTime.of(orderQuerySellerDto.getEndDate().toLocalDate(), LocalTime.MAX));
82   - }else{
  80 + }else if(orderQuerySellerDto.getMonth()!=null){
83 81 orderQuerySellerDto.setStartDate(orderQuerySellerDto.getMonth().with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN));
84 82 orderQuerySellerDto.setEndDate(orderQuerySellerDto.getMonth().with(TemporalAdjusters.lastDayOfMonth()).with(LocalTime.MAX));
85 83 }
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/api/ShopCartApi.java
... ... @@ -74,7 +74,7 @@ public class ShopCartApi {
74 74 throw new OrderException(OrderErrorCode.PARAM_ERROR,"重复提交");
75 75 }
76 76 bucket.set(1, Duration.ofSeconds(3));
77   - shopCartService.saveShopCart(shopCartDto);
  77 + shopCartService.saveShopCart(shopCartDto,false);
78 78 return Message.success();
79 79 }finally {
80 80 lock.unlock();
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/IShopCartMessageService.java
... ... @@ -16,7 +16,7 @@ public interface IShopCartMessageService {
16 16  
17 17 void updateShopCartMessage(ShopCartMessageDto shopCartMessageDto);
18 18  
19   - void updateByOld(ShopCartMessage shopCartMessageOld,ShopCartMessageDto shopCartMessageDto,Boolean bo);
  19 + void updateByOld(ShopCartMessage shopCartMessageOld,ShopCartMessageDto shopCartMessageDto,Boolean bo,boolean checkflag);
20 20  
21 21 List<ShopCartMessage> findList(ShopCartMessageDto shopCartMessageDto);
22 22  
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/IShopCartService.java
... ... @@ -10,7 +10,7 @@ public interface IShopCartService {
10 10 List<ShopCartVo> listShopCart(ShopCartDto shopCartDto);
11 11  
12 12  
13   - void saveShopCart(ShopCartDto shopCartDto);
  13 + void saveShopCart(ShopCartDto shopCartDto,boolean flag);
14 14  
15 15 void updateShopcartList(List<ShopCartCacheDto> shopCartCacheDtoList);
16 16  
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderServiceImpl.java
... ... @@ -772,11 +772,12 @@ public class OrderServiceImpl implements OrderService {
772 772 WeChatPayTradeDto weChatPayTradeDto = new WeChatPayTradeDto();
773 773 //效验店铺
774 774 ShopVo shop = orderGoodsService.checkShop(orderWeChatPayBatch.getShopId());
775   - if(StringUtils.isBlank(shop.getWxMerchantNumber())){
776   - throw new OrderException(OrderErrorCode.PARAM_ERROR,"卖方未开通微信支付,请选择其他支付方式");
777   - }
  775 +// if(StringUtils.isBlank(shop.getWxMerchantNumber())){
  776 +// throw new OrderException(OrderErrorCode.PARAM_ERROR,"卖方未开通微信支付,请选择其他支付方式");
  777 +// }
778 778 //构建微信支付参数
779 779 weChatPayTradeDto.setAmount(orderWeChatPayBatch.getTotlePayAmount().multiply(NumberTransform.ONE_HUNDERD).longValue());
  780 + weChatPayTradeDto.setMarketId(orderWeChatPayBatch.getMarketId());
780 781 weChatPayTradeDto.setType(orderWeChatPayBatch.getPayType());
781 782 weChatPayTradeDto.setCode(orderWeChatPayBatch.getCode());
782 783 weChatPayTradeDto.setOutTradeNo(orderWeChatPayBatch.getCodes().get(0));
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/ShopCartImpl.java
... ... @@ -159,7 +159,7 @@ public class ShopCartImpl implements IShopCartService {
159 159 */
160 160 @Transactional
161 161 @Override
162   - public void saveShopCart(ShopCartDto shopCartDto) {
  162 + public void saveShopCart(ShopCartDto shopCartDto ,boolean checkflag) {
163 163 //1、判断是否存在该店铺信息,存在则更新店铺信息
164 164 ShopCart shopCart = new ShopCart();
165 165 shopCart.setShopId(shopCartDto.getShopId());
... ... @@ -220,7 +220,7 @@ public class ShopCartImpl implements IShopCartService {
220 220 }
221 221 //存在相同商品信息,对商品信息进行更新操作
222 222 ShopCartMessage shopCartMessageOld = shopCartMessages.get(0);
223   - shopCartMessageService.updateByOld(shopCartMessageOld, shopCartDto.getShopCartMessageDto(),shopCartDto.getBo());
  223 + shopCartMessageService.updateByOld(shopCartMessageOld, shopCartDto.getShopCartMessageDto(),shopCartDto.getBo(),checkflag);
224 224 }
225 225  
226 226  
... ... @@ -237,7 +237,7 @@ public class ShopCartImpl implements IShopCartService {
237 237 shopCartDto.setShopCartMessageDto(shopCartMessageDto);
238 238 return shopCartDto;
239 239 }).toList();
240   - shopCartDtos.forEach(this::saveShopCart);
  240 + shopCartDtos.forEach(item ->saveShopCart(item,true));
241 241 }
242 242 });
243 243 }
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/ShopCartMessageServiceImpl.java
... ... @@ -130,14 +130,16 @@ public class ShopCartMessageServiceImpl implements IShopCartMessageService {
130 130 */
131 131 @Transactional
132 132 @Override
133   - public void updateByOld(ShopCartMessage shopCartMessageOld, ShopCartMessageDto shopCartMessageDto, Boolean bo) {
  133 + public void updateByOld(ShopCartMessage shopCartMessageOld, ShopCartMessageDto shopCartMessageDto, Boolean bo,boolean checkflag) {
134 134 AssertUtils.notNull(shopCartMessageOld, "历史购物车商品信息不为空");
135 135 AssertUtils.notNull(shopCartMessageDto, "新增购物车商品信息不为空");
136 136 //获取历史购物车商品
137 137 AssertUtils.isTrue(shopCartMessageOld.getType().equals(shopCartMessageDto.getType()), "历史购物车商品信息与新增购物车商品信息卖货方式不同");
138 138 shopCartMessageDto.setId(shopCartMessageOld.getId());
139 139 shopCartMessageDto.setVersion(shopCartMessageOld.getVersion());
140   - shopCartMessageDto.setCheckFlag(shopCartMessageOld.getCheckFlag());
  140 + if(checkflag){
  141 + shopCartMessageDto.setCheckFlag(shopCartMessageDto.getCheckFlag());
  142 + }
141 143 //如果是处理离线缓存数据,bo=true,总重量做覆盖,不是处理离线数据,总重量做增量
142 144 if (bo) {
143 145 //如果缓存时间在更新之前之前,说明缓存数据不是最新数据,则不进行更新操作
... ...
etrade-order/src/main/resources/com/diligrp/etrade/dao/mapper/order/OrderQueryBuyerMapper.xml
... ... @@ -200,8 +200,13 @@
200 200 <if test="achieveState != null">
201 201 and ord.achieve_state = #{achieveState,jdbcType=INTEGER}
202 202 </if>
203   - and ord.created_time >= #{startDate}
204   - and #{endDate} >= ord.created_time
  203 + <if test="startDate != null">
  204 + and ord.created_time >= #{startDate}
  205 + </if>
  206 + <if test="endDate != null">
  207 + and #{endDate} >= ord.created_time
  208 + </if>
  209 +
205 210 </where>
206 211 <if test="orderState != null and orderState == 1">
207 212 order by ord.id desc
... ...
etrade-order/src/main/resources/com/diligrp/etrade/dao/mapper/order/OrderQuerySellerMapper.xml
... ... @@ -221,8 +221,12 @@
221 221 <if test="customerId != null">
222 222 and ord.shop_customer_id = #{customerId}
223 223 </if>
224   - and ord.created_time >= #{startDate}
225   - and #{endDate} >= ord.created_time
  224 + <if test="startDate != null">
  225 + and ord.created_time >= #{startDate}
  226 + </if>
  227 + <if test="endDate != null">
  228 + and #{endDate} >= ord.created_time
  229 + </if>
226 230 <if test="storeEmployeeId != null">
227 231 and (opa.payee_seller_id = #{storeEmployeeId} or ord.seller_id = #{storeEmployeeId} or ord.verify_ids = #{storeEmployeeId} or ord.cancel_id = #{storeEmployeeId}
228 232 <if test="orderState == null or orderState == 1">
... ...