浏览代码

下单流程修改,去除mq配置

lhm 3 年之前
父节点
当前提交
828b82439a
共有 23 个文件被更改,包括 1031 次插入481 次删除
  1. 1 0
      kmall-admin/src/main/java/com/kmall/admin/biz/CustomsClearanceTimeliness.java
  2. 4 3
      kmall-admin/src/main/java/com/kmall/admin/biz/clearance/CustomsClearanceTimelinessBiz.java
  3. 3 2
      kmall-admin/src/main/java/com/kmall/admin/config/ThreadPoolConfig.java
  4. 1 0
      kmall-admin/src/main/java/com/kmall/admin/config/mq/CustomRabbitMQProperties.java
  5. 12 11
      kmall-admin/src/main/java/com/kmall/admin/config/mq/RabbitMQConfig.java
  6. 7 0
      kmall-admin/src/main/java/com/kmall/admin/dao/OrderGoodsDao.java
  7. 65 0
      kmall-admin/src/main/java/com/kmall/admin/dao/haikong/HaiKongMemberOrderSyncResendDao.java
  8. 8 0
      kmall-admin/src/main/java/com/kmall/admin/entity/ProductStoreRelaEntity.java
  9. 151 0
      kmall-admin/src/main/java/com/kmall/admin/entity/haikong/HaiKongMemberOrderSyncResendEntity.java
  10. 40 0
      kmall-admin/src/main/java/com/kmall/admin/haikong/constant/HaiKongMemberOrderResendStatusEnum.java
  11. 86 0
      kmall-admin/src/main/java/com/kmall/admin/haikong/vo/CalculateOrderDiscountPriceResponseVO.java
  12. 72 0
      kmall-admin/src/main/java/com/kmall/admin/haikong/vo/QueryGoodsVO.java
  13. 7 0
      kmall-admin/src/main/java/com/kmall/admin/service/OrderGoodsService.java
  14. 38 0
      kmall-admin/src/main/java/com/kmall/admin/service/haikong/HaiKongMemberOrderSyncResendService.java
  15. 10 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderGoodsServiceImpl.java
  16. 213 425
      kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java
  17. 62 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/haikong/HaiKongMemberOrderSyncResendServiceImpl.java
  18. 29 29
      kmall-admin/src/main/resources/conf/mq.properties
  19. 79 0
      kmall-admin/src/main/resources/mybatis/mapper/OrderGoodsDao.xml
  20. 101 0
      kmall-admin/src/main/resources/mybatis/mapper/haikong/HaiKongMemberOrderSyncResendDao.xml
  21. 1 1
      kmall-admin/src/main/resources/mybatis/mapper/haikong/ScoreConsumeRecordDao.xml
  22. 29 2
      kmall-admin/src/main/webapp/js/sale/sale.js
  23. 12 8
      kmall-admin/src/test/java/com/kmall/admin/Test.java

+ 1 - 0
kmall-admin/src/main/java/com/kmall/admin/biz/CustomsClearanceTimeliness.java

@@ -8,6 +8,7 @@ import java.util.List;
  * @version 1.0
  * @version 1.0
  * 2021-09-09 17:59
  * 2021-09-09 17:59
  */
  */
+@Deprecated
 public interface CustomsClearanceTimeliness {
 public interface CustomsClearanceTimeliness {
 
 
     /**
     /**

+ 4 - 3
kmall-admin/src/main/java/com/kmall/admin/biz/clearance/CustomsClearanceTimelinessBiz.java

@@ -22,15 +22,16 @@ import java.util.stream.Collectors;
  * @version 1.0
  * @version 1.0
  * 2021-09-09 18:01
  * 2021-09-09 18:01
  */
  */
-@Component
+//@Component
+@Deprecated
 public class CustomsClearanceTimelinessBiz implements CustomsClearanceTimeliness {
 public class CustomsClearanceTimelinessBiz implements CustomsClearanceTimeliness {
 
 
     private static final Logger LOGGER = LoggerFactory.getLogger(CustomsClearanceTimelinessBiz.class);
     private static final Logger LOGGER = LoggerFactory.getLogger(CustomsClearanceTimelinessBiz.class);
 
 
-    @Autowired
+//    @Autowired
     private ThreadPoolExecutor threadPoolExecutor;
     private ThreadPoolExecutor threadPoolExecutor;
 
 
-    @Autowired
+//    @Autowired
     private RabbitTemplate clearRabbitTemplate;
     private RabbitTemplate clearRabbitTemplate;
 
 
     /**
     /**

+ 3 - 2
kmall-admin/src/main/java/com/kmall/admin/config/ThreadPoolConfig.java

@@ -13,10 +13,11 @@ import java.util.concurrent.TimeUnit;
  * @version 1.0
  * @version 1.0
  * 2021-09-08 19:18
  * 2021-09-08 19:18
  */
  */
-@Configuration
+//@Configuration
+@Deprecated
 public class ThreadPoolConfig {
 public class ThreadPoolConfig {
 
 
-    @Bean
+//    @Bean
     public ThreadPoolExecutor threadPoolExecutor () {
     public ThreadPoolExecutor threadPoolExecutor () {
 
 
         return new ThreadPoolExecutor(
         return new ThreadPoolExecutor(

+ 1 - 0
kmall-admin/src/main/java/com/kmall/admin/config/mq/CustomRabbitMQProperties.java

@@ -7,6 +7,7 @@ package com.kmall.admin.config.mq;
  * @version 1.0
  * @version 1.0
  * 2021-08-26 17:08
  * 2021-08-26 17:08
  */
  */
+@Deprecated
 public class CustomRabbitMQProperties {
 public class CustomRabbitMQProperties {
 
 
     /**
     /**

+ 12 - 11
kmall-admin/src/main/java/com/kmall/admin/config/mq/RabbitMQConfig.java

@@ -24,14 +24,15 @@ import org.springframework.core.env.Environment;
  * @version 1.0
  * @version 1.0
  * 2021-08-26 17:07
  * 2021-08-26 17:07
  */
  */
-@Configuration
-@PropertySource(value = {"classpath:conf/mq.properties"})
+//@Configuration
+//@PropertySource(value = {"classpath:conf/mq.properties"})
+@Deprecated
 public class RabbitMQConfig {
 public class RabbitMQConfig {
 
 
-    @Autowired
+//    @Autowired
     private Environment environment;
     private Environment environment;
 
 
-    @Bean
+//    @Bean
     public CustomRabbitMQProperties customRabbitMQProperties () {
     public CustomRabbitMQProperties customRabbitMQProperties () {
         CustomRabbitMQProperties customRabbitMQProperties = new CustomRabbitMQProperties();
         CustomRabbitMQProperties customRabbitMQProperties = new CustomRabbitMQProperties();
         customRabbitMQProperties.setUsername(environment.getProperty("mq.username"));
         customRabbitMQProperties.setUsername(environment.getProperty("mq.username"));
@@ -49,7 +50,7 @@ public class RabbitMQConfig {
     }
     }
 
 
     /* ----------------------------------------------- 基础配置 --------------------------------------------- */
     /* ----------------------------------------------- 基础配置 --------------------------------------------- */
-    @Bean
+//    @Bean
     public ConnectionFactory connectionFactory () {
     public ConnectionFactory connectionFactory () {
         CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
         CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
         connectionFactory.setUsername(customRabbitMQProperties().getUsername());
         connectionFactory.setUsername(customRabbitMQProperties().getUsername());
@@ -70,7 +71,7 @@ public class RabbitMQConfig {
      * SimpleRabbitListenerContainerFactory发现消息中有content_type有text就会默认将其转换成string类型
      * SimpleRabbitListenerContainerFactory发现消息中有content_type有text就会默认将其转换成string类型
      * @return rabbit监听器容器工厂
      * @return rabbit监听器容器工厂
      */
      */
-    @Bean
+//    @Bean
     public RabbitListenerContainerFactory<?> rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
     public RabbitListenerContainerFactory<?> rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
         SimpleRabbitListenerContainerFactory containerFactory = new SimpleRabbitListenerContainerFactory();
         SimpleRabbitListenerContainerFactory containerFactory = new SimpleRabbitListenerContainerFactory();
         containerFactory.setConnectionFactory(connectionFactory);
         containerFactory.setConnectionFactory(connectionFactory);
@@ -91,7 +92,7 @@ public class RabbitMQConfig {
         return containerFactory;
         return containerFactory;
     }
     }
 
 
-    @Bean
+//    @Bean
     public AmqpAdmin amqpAdmin () {
     public AmqpAdmin amqpAdmin () {
         AmqpAdmin amqpAdmin = new RabbitAdmin(connectionFactory());
         AmqpAdmin amqpAdmin = new RabbitAdmin(connectionFactory());
 
 
@@ -103,7 +104,7 @@ public class RabbitMQConfig {
     }
     }
 
 
     /* ----------------------------------------------- 队列配置 --------------------------------------------- */
     /* ----------------------------------------------- 队列配置 --------------------------------------------- */
-    @Bean
+//    @Bean
     public RabbitTemplate clearRabbitTemplate (ConnectionFactory connectionFactory) {
     public RabbitTemplate clearRabbitTemplate (ConnectionFactory connectionFactory) {
         RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
         RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
 
 
@@ -115,17 +116,17 @@ public class RabbitMQConfig {
         return rabbitTemplate;
         return rabbitTemplate;
     }
     }
 
 
-    @Bean
+//    @Bean
     public DirectExchange clearDirectExchange () {
     public DirectExchange clearDirectExchange () {
         return new DirectExchange(customRabbitMQProperties().getE_normal_oms_order_to_handle_customs_clearance());
         return new DirectExchange(customRabbitMQProperties().getE_normal_oms_order_to_handle_customs_clearance());
     }
     }
 
 
-    @Bean
+//    @Bean
     public Queue clearQueue () {
     public Queue clearQueue () {
         return new Queue(customRabbitMQProperties().getQ_normal_oms_order_to_handle_customs_clearance());
         return new Queue(customRabbitMQProperties().getQ_normal_oms_order_to_handle_customs_clearance());
     }
     }
 
 
-    @Bean
+//    @Bean
     public Binding clearBinding () {
     public Binding clearBinding () {
         return BindingBuilder.bind(clearQueue()).to(clearDirectExchange()).with(customRabbitMQProperties().getK_normal_oms_order_to_handle_customs_clearance());
         return BindingBuilder.bind(clearQueue()).to(clearDirectExchange()).with(customRabbitMQProperties().getK_normal_oms_order_to_handle_customs_clearance());
     }
     }

+ 7 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/OrderGoodsDao.java

@@ -42,4 +42,11 @@ public interface OrderGoodsDao extends BaseDao<OrderGoodsEntity> {
     List<OrderGoodsRestoreVo> queryListByOrderIds(List<Integer> orderIdList);
     List<OrderGoodsRestoreVo> queryListByOrderIds(List<Integer> orderIdList);
 
 
     List<OrderGoodsEntity> queryListHkMall(Map<String, Object> map);
     List<OrderGoodsEntity> queryListHkMall(Map<String, Object> map);
+
+    /**
+     * 批量新增订单详情
+     *
+     * @param orderGoodsVos 订单详情
+     */
+    void saveBatchOrderDetail(List<OrderGoodsVo> orderGoodsVos);
 }
 }

+ 65 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/haikong/HaiKongMemberOrderSyncResendDao.java

@@ -0,0 +1,65 @@
+package com.kmall.admin.dao.haikong;
+
+import com.kmall.admin.entity.haikong.HaiKongMemberOrderSyncResendEntity;
+import com.kmall.manager.dao.BaseDao;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 海控同步消费订单重发表
+ * @author lhm
+ * @createDate 2021-11-30
+ */
+public interface HaiKongMemberOrderSyncResendDao {
+
+    /**
+     * 批量更新重发状态
+     * @param entities  实体
+     */
+    void updateBatchResendStatus(List<HaiKongMemberOrderSyncResendEntity> entities);
+
+    /**
+     * 查询对象
+     * @param id    id
+     * @return      实体
+     */
+    HaiKongMemberOrderSyncResendEntity queryObject(@Param("id") Integer id);
+
+    /**
+     * 查询总数
+     * @return  总数
+     */
+    int queryTotal();
+
+    /**
+     * 根据状态查询集合
+     * @param resendStatus  重发状态
+     * @return              集合
+     */
+    List<HaiKongMemberOrderSyncResendEntity> queryList(@Param("resend_status") String resendStatus);
+
+    /**
+     * 新增数据
+     * @param haiKongMemberOrderSyncResendEntity    要新增的数据
+     */
+    void save(HaiKongMemberOrderSyncResendEntity haiKongMemberOrderSyncResendEntity);
+
+    /**
+     * 更新数据
+     * @param haiKongMemberOrderSyncResendEntity    要更新的数据
+     */
+    void update(HaiKongMemberOrderSyncResendEntity haiKongMemberOrderSyncResendEntity);
+
+    /**
+     * 删除数据
+     * @param id    id
+     */
+    void delete(@Param("id") Integer id);
+
+    /**
+     * 批量删除数据
+     * @param ids   id 集合
+     */
+    void deleteBatch(List<Integer> ids);
+}

+ 8 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/ProductStoreRelaEntity.java

@@ -1,5 +1,7 @@
 package com.kmall.admin.entity;
 package com.kmall.admin.entity;
 
 
+import com.kmall.admin.haikong.vo.QueryGoodsVO;
+import com.kmall.common.utils.BeanUtils;
 import com.kmall.common.utils.Constant;
 import com.kmall.common.utils.Constant;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
@@ -146,6 +148,12 @@ public class ProductStoreRelaEntity implements Serializable {
     //积分生成规则id
     //积分生成规则id
     private Long pointsRulesId;
     private Long pointsRulesId;
 
 
+    public ProductStoreRelaEntity() {
+    }
+
+    public ProductStoreRelaEntity(QueryGoodsVO queryGoodsVO) {
+        BeanUtils.copyProperties(queryGoodsVO, this);
+    }
 
 
     public Date getLastSaleTime() {
     public Date getLastSaleTime() {
         return lastSaleTime;
         return lastSaleTime;

+ 151 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/haikong/HaiKongMemberOrderSyncResendEntity.java

@@ -0,0 +1,151 @@
+package com.kmall.admin.entity.haikong;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author lhm
+ * @createDate 2021-11-30
+ */
+public class HaiKongMemberOrderSyncResendEntity {
+
+    private Integer id;
+
+    /**
+     * 会员唯一标识,手机号与唯一标识必传其一
+     */
+    private String openId;
+
+    /**
+     * 会员手机号
+     */
+    private String phone;
+
+    /**
+     * 消费时间
+     */
+    private Date consumeDate;
+
+    /**
+     * 订单金额
+     */
+    private BigDecimal orderAmount;
+
+    /**
+     * 订单编号
+     */
+    private String orderNo;
+
+    /**
+     * 这笔订单需要发放的积分
+     */
+    private Integer orderScore;
+
+    /**
+     * 重发状态,0:未重发 1:重发成功 2:重发失败
+     */
+    private String resendStatus;
+
+    /**
+     * 最后一次重发时间
+     */
+    private Date lastResendTime;
+
+    private Date createTime;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public Date getConsumeDate() {
+        return consumeDate;
+    }
+
+    public void setConsumeDate(Date consumeDate) {
+        this.consumeDate = consumeDate;
+    }
+
+    public BigDecimal getOrderAmount() {
+        return orderAmount;
+    }
+
+    public void setOrderAmount(BigDecimal orderAmount) {
+        this.orderAmount = orderAmount;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public Integer getOrderScore() {
+        return orderScore;
+    }
+
+    public void setOrderScore(Integer orderScore) {
+        this.orderScore = orderScore;
+    }
+
+    public String getResendStatus() {
+        return resendStatus;
+    }
+
+    public void setResendStatus(String resendStatus) {
+        this.resendStatus = resendStatus;
+    }
+
+    public Date getLastResendTime() {
+        return lastResendTime;
+    }
+
+    public void setLastResendTime(Date lastResendTime) {
+        this.lastResendTime = lastResendTime;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    @Override
+    public String toString() {
+        return "HaiKongMemberOrderSyncResendEntity{" +
+                "id=" + id +
+                ", openId='" + openId + '\'' +
+                ", phone='" + phone + '\'' +
+                ", consumeDate=" + consumeDate +
+                ", orderAmount=" + orderAmount +
+                ", orderNo='" + orderNo + '\'' +
+                ", orderScore=" + orderScore +
+                ", resendStatus='" + resendStatus + '\'' +
+                ", lastResendTime=" + lastResendTime +
+                ", createTime=" + createTime +
+                '}';
+    }
+}

+ 40 - 0
kmall-admin/src/main/java/com/kmall/admin/haikong/constant/HaiKongMemberOrderResendStatusEnum.java

@@ -0,0 +1,40 @@
+package com.kmall.admin.haikong.constant;
+
+/**
+ * 重发状态枚举类
+ * @author lhm
+ * @createDate 2021-11-30
+ */
+public enum HaiKongMemberOrderResendStatusEnum {
+    /**
+     * 未重发
+     */
+    WAIT_RESEND("0", "未重发"),
+    /**
+     * 重发成功
+     */
+    RESEND_SUCCESS("1", "重发成功"),
+    /**
+     * 重发失败
+     */
+    RESEND_FAILED("2", "重发失败")
+    ;
+
+
+    private final String status;
+
+    private final String desc;
+
+    HaiKongMemberOrderResendStatusEnum(String status, String desc) {
+        this.status = status;
+        this.desc = desc;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+}

+ 86 - 0
kmall-admin/src/main/java/com/kmall/admin/haikong/vo/CalculateOrderDiscountPriceResponseVO.java

@@ -14,6 +14,29 @@ public class CalculateOrderDiscountPriceResponseVO {
 
 
     private BigDecimal orderTotalPrice;
     private BigDecimal orderTotalPrice;
 
 
+    private String memberCode;
+
+    private String memberPhone;
+
+    /**
+     * 抵扣积分
+     */
+    private Integer deductionScore;
+
+    /**
+     * 积分抵扣金额
+     */
+    private BigDecimal scoreDeductionPrice;
+
+    /**
+     * 积分规则
+     */
+    private Integer scoreLimit;
+
+    private Integer beforeScore;
+
+    private Integer afterScore;
+
     private List<GoodsDetailsDto> goodsDetailsDtos;
     private List<GoodsDetailsDto> goodsDetailsDtos;
 
 
     public BigDecimal getOrderTotalPrice() {
     public BigDecimal getOrderTotalPrice() {
@@ -32,10 +55,73 @@ public class CalculateOrderDiscountPriceResponseVO {
         this.goodsDetailsDtos = goodsDetailsDtos;
         this.goodsDetailsDtos = goodsDetailsDtos;
     }
     }
 
 
+    public String getMemberCode() {
+        return memberCode;
+    }
+
+    public void setMemberCode(String memberCode) {
+        this.memberCode = memberCode;
+    }
+
+    public String getMemberPhone() {
+        return memberPhone;
+    }
+
+    public void setMemberPhone(String memberPhone) {
+        this.memberPhone = memberPhone;
+    }
+
+    public Integer getDeductionScore() {
+        return deductionScore;
+    }
+
+    public void setDeductionScore(Integer deductionScore) {
+        this.deductionScore = deductionScore;
+    }
+
+    public BigDecimal getScoreDeductionPrice() {
+        return scoreDeductionPrice;
+    }
+
+    public void setScoreDeductionPrice(BigDecimal scoreDeductionPrice) {
+        this.scoreDeductionPrice = scoreDeductionPrice;
+    }
+
+    public Integer getScoreLimit() {
+        return scoreLimit;
+    }
+
+    public void setScoreLimit(Integer scoreLimit) {
+        this.scoreLimit = scoreLimit;
+    }
+
+    public Integer getBeforeScore() {
+        return beforeScore;
+    }
+
+    public void setBeforeScore(Integer beforeScore) {
+        this.beforeScore = beforeScore;
+    }
+
+    public Integer getAfterScore() {
+        return afterScore;
+    }
+
+    public void setAfterScore(Integer afterScore) {
+        this.afterScore = afterScore;
+    }
+
     @Override
     @Override
     public String toString() {
     public String toString() {
         return "CalculateOrderDiscountPriceResponseVO{" +
         return "CalculateOrderDiscountPriceResponseVO{" +
                 "orderTotalPrice=" + orderTotalPrice +
                 "orderTotalPrice=" + orderTotalPrice +
+                ", memberCode='" + memberCode + '\'' +
+                ", memberPhone='" + memberPhone + '\'' +
+                ", deductionScore=" + deductionScore +
+                ", scoreDeductionPrice=" + scoreDeductionPrice +
+                ", scoreLimit=" + scoreLimit +
+                ", beforeScore=" + beforeScore +
+                ", afterScore=" + afterScore +
                 ", goodsDetailsDtos=" + goodsDetailsDtos +
                 ", goodsDetailsDtos=" + goodsDetailsDtos +
                 '}';
                 '}';
     }
     }

+ 72 - 0
kmall-admin/src/main/java/com/kmall/admin/haikong/vo/QueryGoodsVO.java

@@ -1,6 +1,7 @@
 package com.kmall.admin.haikong.vo;
 package com.kmall.admin.haikong.vo;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.Objects;
 import java.util.Objects;
 
 
 /**
 /**
@@ -11,6 +12,11 @@ import java.util.Objects;
 public class QueryGoodsVO {
 public class QueryGoodsVO {
 
 
     /**
     /**
+     * 商品id
+     */
+    private Long id;
+
+    /**
      * 商品条码
      * 商品条码
      */
      */
     private String prodBarcode;
     private String prodBarcode;
@@ -21,6 +27,16 @@ public class QueryGoodsVO {
     private String sku;
     private String sku;
 
 
     /**
     /**
+     * 商户编号
+     */
+    private String merchSn;
+
+    /**
+     * 第三方商户编码
+     */
+    private String thirdPartyMerchCode;
+
+    /**
      * 门店id
      * 门店id
      */
      */
     private Integer storeId;
     private Integer storeId;
@@ -125,6 +141,17 @@ public class QueryGoodsVO {
      */
      */
     private BigDecimal totalPrice;
     private BigDecimal totalPrice;
 
 
+    /**
+     * 销售时间
+     */
+    private Date lastSaleTime;
+
+    /**
+     * 活动
+     */
+    private String activity;
+
+
     public String getProdBarcode() {
     public String getProdBarcode() {
         return prodBarcode;
         return prodBarcode;
     }
     }
@@ -309,11 +336,54 @@ public class QueryGoodsVO {
         this.totalPrice = totalPrice;
         this.totalPrice = totalPrice;
     }
     }
 
 
+    public Date getLastSaleTime() {
+        return lastSaleTime;
+    }
+
+    public void setLastSaleTime(Date lastSaleTime) {
+        this.lastSaleTime = lastSaleTime;
+    }
+
+    public String getActivity() {
+        return activity;
+    }
+
+    public void setActivity(String activity) {
+        this.activity = activity;
+    }
+
+    public String getMerchSn() {
+        return merchSn;
+    }
+
+    public void setMerchSn(String merchSn) {
+        this.merchSn = merchSn;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getThirdPartyMerchCode() {
+        return thirdPartyMerchCode;
+    }
+
+    public void setThirdPartyMerchCode(String thirdPartyMerchCode) {
+        this.thirdPartyMerchCode = thirdPartyMerchCode;
+    }
+
     @Override
     @Override
     public String toString() {
     public String toString() {
         return "QueryGoodsVO{" +
         return "QueryGoodsVO{" +
                 "prodBarcode='" + prodBarcode + '\'' +
                 "prodBarcode='" + prodBarcode + '\'' +
                 ", sku='" + sku + '\'' +
                 ", sku='" + sku + '\'' +
+                ", merchSn='" + merchSn + '\'' +
+                ", id=" + id +
+                ", thirdPartyMerchCode='" + thirdPartyMerchCode + '\'' +
                 ", storeId=" + storeId +
                 ", storeId=" + storeId +
                 ", sellVolume=" + sellVolume +
                 ", sellVolume=" + sellVolume +
                 ", retailPrice=" + retailPrice +
                 ", retailPrice=" + retailPrice +
@@ -335,6 +405,8 @@ public class QueryGoodsVO {
                 ", toBeRestored=" + toBeRestored +
                 ", toBeRestored=" + toBeRestored +
                 ", exitRegionNumber=" + exitRegionNumber +
                 ", exitRegionNumber=" + exitRegionNumber +
                 ", totalPrice=" + totalPrice +
                 ", totalPrice=" + totalPrice +
+                ", lastSaleTime=" + lastSaleTime +
+                ", activity='" + activity + '\'' +
                 '}';
                 '}';
     }
     }
 
 

+ 7 - 0
kmall-admin/src/main/java/com/kmall/admin/service/OrderGoodsService.java

@@ -3,6 +3,7 @@ package com.kmall.admin.service;
 import com.kmall.admin.dto.OrderGoodsDto;
 import com.kmall.admin.dto.OrderGoodsDto;
 import com.kmall.admin.entity.OrderGoodsEntity;
 import com.kmall.admin.entity.OrderGoodsEntity;
 import com.kmall.api.entity.OrderGoodsRestoreVo;
 import com.kmall.api.entity.OrderGoodsRestoreVo;
+import com.kmall.api.entity.OrderGoodsVo;
 
 
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -46,4 +47,10 @@ public interface OrderGoodsService {
 	 */
 	 */
 	List<OrderGoodsRestoreVo> queryListByOrderIds(List<Integer> orderIdList);
 	List<OrderGoodsRestoreVo> queryListByOrderIds(List<Integer> orderIdList);
 
 
+	/**
+	 * 批量新增订单详情
+	 * @param orderGoodsVos	订单详情
+	 */
+	void saveBatchOrderDetail(List<OrderGoodsVo> orderGoodsVos);
+
 }
 }

+ 38 - 0
kmall-admin/src/main/java/com/kmall/admin/service/haikong/HaiKongMemberOrderSyncResendService.java

@@ -0,0 +1,38 @@
+package com.kmall.admin.service.haikong;
+
+import com.kmall.admin.entity.haikong.HaiKongMemberOrderSyncResendEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author lhm
+ * @createDate 2021-11-30
+ */
+public interface HaiKongMemberOrderSyncResendService {
+
+    /**
+     * 按条件查询
+     * @param resendStatus   条件
+     * @return      实体
+     */
+    List<HaiKongMemberOrderSyncResendEntity> queryList(String resendStatus);
+
+    /**
+     * 批量更新状态
+     * @param entities  实体
+     */
+    void updateBatchResendStatus(List<HaiKongMemberOrderSyncResendEntity> entities);
+
+    /**
+     * 更新
+     * @param haiKongMemberOrderSyncResendEntity    更新的数据
+     */
+    void update(HaiKongMemberOrderSyncResendEntity haiKongMemberOrderSyncResendEntity);
+
+    /**
+     * 新增
+     * @param haiKongMemberOrderSyncResendEntity    新增的数据
+     */
+    void save(HaiKongMemberOrderSyncResendEntity haiKongMemberOrderSyncResendEntity);
+}

+ 10 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderGoodsServiceImpl.java

@@ -5,6 +5,7 @@ import com.kmall.admin.dto.OrderGoodsDto;
 import com.kmall.admin.entity.OrderGoodsEntity;
 import com.kmall.admin.entity.OrderGoodsEntity;
 import com.kmall.admin.service.OrderGoodsService;
 import com.kmall.admin.service.OrderGoodsService;
 import com.kmall.api.entity.OrderGoodsRestoreVo;
 import com.kmall.api.entity.OrderGoodsRestoreVo;
+import com.kmall.api.entity.OrderGoodsVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -82,4 +83,13 @@ public class OrderGoodsServiceImpl implements OrderGoodsService {
 		return orderGoodsDao.queryListByOrderIds(orderIdList);
 		return orderGoodsDao.queryListByOrderIds(orderIdList);
 	}
 	}
 
 
+	/**
+	 * 批量新增订单详情
+	 *
+	 * @param orderGoodsVos 订单详情
+	 */
+	@Override
+	public void saveBatchOrderDetail(List<OrderGoodsVo> orderGoodsVos) {
+		orderGoodsDao.saveBatchOrderDetail(orderGoodsVos);
+	}
 }
 }

+ 213 - 425
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java

@@ -20,6 +20,7 @@ import com.kmall.admin.dao.vip.Mall2MemberPointsDao;
 import com.kmall.admin.dao.vip.Mall2PointsRulesDao;
 import com.kmall.admin.dao.vip.Mall2PointsRulesDao;
 import com.kmall.admin.dto.*;
 import com.kmall.admin.dto.*;
 import com.kmall.admin.entity.*;
 import com.kmall.admin.entity.*;
+import com.kmall.admin.entity.haikong.HaiKongMemberOrderSyncResendEntity;
 import com.kmall.admin.entity.mk.MkActivitiesEntity;
 import com.kmall.admin.entity.mk.MkActivitiesEntity;
 import com.kmall.admin.entity.mk.store.MkStorePromOrderRealEntity;
 import com.kmall.admin.entity.mk.store.MkStorePromOrderRealEntity;
 import com.kmall.admin.entity.record.NewRetailOrderRestoreStockRecordEntity;
 import com.kmall.admin.entity.record.NewRetailOrderRestoreStockRecordEntity;
@@ -29,7 +30,9 @@ import com.kmall.admin.entity.vip.Mall2PointsRulesEntity;
 import com.kmall.admin.fromcomm.dao.SysConfigDao;
 import com.kmall.admin.fromcomm.dao.SysConfigDao;
 import com.kmall.admin.fromcomm.entity.SysUserEntity;
 import com.kmall.admin.fromcomm.entity.SysUserEntity;
 import com.kmall.admin.haikong.constant.Constants;
 import com.kmall.admin.haikong.constant.Constants;
+import com.kmall.admin.haikong.constant.HaiKongMemberOrderResendStatusEnum;
 import com.kmall.admin.haikong.constant.VmcconnectUrlEnum;
 import com.kmall.admin.haikong.constant.VmcconnectUrlEnum;
+import com.kmall.admin.haikong.dto.MemberOrderInfoSyncDTO;
 import com.kmall.admin.haikong.dto.WareQueryStockResponseDTO;
 import com.kmall.admin.haikong.dto.WareQueryStockResponseDTO;
 import com.kmall.admin.haikong.utils.ListUtils;
 import com.kmall.admin.haikong.utils.ListUtils;
 import com.kmall.admin.haikong.vo.CalculateOrderDiscountPriceResponseVO;
 import com.kmall.admin.haikong.vo.CalculateOrderDiscountPriceResponseVO;
@@ -41,6 +44,7 @@ import com.kmall.admin.haikong.config.HaiKongProperties;
 import com.kmall.admin.haikong.dto.MemberInfoDTO;
 import com.kmall.admin.haikong.dto.MemberInfoDTO;
 import com.kmall.admin.haikong.utils.Response;
 import com.kmall.admin.haikong.utils.Response;
 import com.kmall.admin.service.*;
 import com.kmall.admin.service.*;
+import com.kmall.admin.service.haikong.HaiKongMemberOrderSyncResendService;
 import com.kmall.admin.service.kmall2eccs.KtoEccsService;
 import com.kmall.admin.service.kmall2eccs.KtoEccsService;
 import com.kmall.admin.service.mk.MkActivitiesService;
 import com.kmall.admin.service.mk.MkActivitiesService;
 import com.kmall.admin.service.mk.store.MkStoreCampMinusService;
 import com.kmall.admin.service.mk.store.MkStoreCampMinusService;
@@ -91,6 +95,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.CollectionUtils;
 
 
+import java.awt.image.LookupOp;
 import java.io.IOException;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.math.RoundingMode;
@@ -208,8 +213,8 @@ public class OrderServiceImpl implements OrderService {
     @Autowired
     @Autowired
     private AddressInfoService addressInfoService;
     private AddressInfoService addressInfoService;
 
 
-    @Autowired
-    private CustomsClearanceTimeliness customsClearanceTimeliness;
+//    @Autowired
+//    private CustomsClearanceTimeliness customsClearanceTimeliness;
 
 
     @Autowired
     @Autowired
     private HaiKongMemberTemplate haiKongMemberTemplate;
     private HaiKongMemberTemplate haiKongMemberTemplate;
@@ -251,6 +256,11 @@ public class OrderServiceImpl implements OrderService {
     @Autowired
     @Autowired
     private MallVmcSendLogDao mallVmcSendLogDao;
     private MallVmcSendLogDao mallVmcSendLogDao;
 
 
+    /**
+     * 同步订单消费信息,重发业务
+     */
+    private HaiKongMemberOrderSyncResendService haiKongMemberOrderSyncResendService;
+
 
 
 
 
     @Override
     @Override
@@ -596,6 +606,7 @@ public class OrderServiceImpl implements OrderService {
     /**
     /**
      * 退款
      * 退款
      */
      */
+    @Override
     @Transactional
     @Transactional
     public void refund(OrderEntity order) {
     public void refund(OrderEntity order) {
         boolean needUpdateStock = true;
         boolean needUpdateStock = true;
@@ -2012,8 +2023,9 @@ public class OrderServiceImpl implements OrderService {
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
+    @Deprecated
     public synchronized Map offlineRetailSubmitHaiKong(Map param, SysUserEntity user) {
     public synchronized Map offlineRetailSubmitHaiKong(Map param, SysUserEntity user) {
-        // 解析订单数据 List
+        /*// 解析订单数据 List
         List<LinkedHashMap> goodsList = (List<LinkedHashMap>) param.get("goodsList");
         List<LinkedHashMap> goodsList = (List<LinkedHashMap>) param.get("goodsList");
         // 解析用户信息 LinkedHashMap
         // 解析用户信息 LinkedHashMap
         Map userInfo = (Map) param.get("userInfo");
         Map userInfo = (Map) param.get("userInfo");
@@ -2290,78 +2302,8 @@ public class OrderServiceImpl implements OrderService {
         // 6. 订单入库
         // 6. 订单入库
 
 
 
 
-        return resultObj;
-    }
-
-    /**
-     * 设置订单商品详情数据
-     * @param orderGoodsEntity 订单商品详情
-     * @param goodsEntity   商品信息
-     * @return              订单商品详情
-     */
-    private OrderGoodsEntity wrapOrderGoods(OrderGoodsEntity orderGoodsEntity, GoodsEntity goodsEntity) {
-        // 设置商品信息
-        BeanUtils.copyProperties(goodsEntity, orderGoodsEntity);
-        // 设置订单信息
-        // 销售数
-        orderGoodsEntity.setNumber(goodsEntity.getGoodsNumber());
-        // TODO other...
-        return orderGoodsEntity;
-    }
-
-    /**
-     * 计算优惠后的价格
-     * 1、优惠券优先于积分抵扣
-     * 2、限时特价与积分不互斥,虽然海控没说哪个优先,但我觉得应该是限时特价优先于积分
-     * 3、优惠券之间互斥
-     * 4、活动和优惠券互斥
-     * @param orderPrice    订单总价
-     * @param score         会员积分
-     * @param goodsEntities 订单商品明细
-     * @param storeId       门店id
-     * @param userInfo      用户信息
-     * @return              优惠后的价格
-     */
-    private BigDecimal calculatePreferentialPrice (BigDecimal orderPrice, Integer score, List<LinkedHashMap> goodsEntities, Integer storeId, Map userInfo) {
-        // 优惠后的价格
-        BigDecimal preferentialPrice = BigDecimal.ZERO;
-        // 1. 判断是否有积分,是否需要计算积分抵扣后的价格
-        AtomicBoolean isCalculateScorePrice = new AtomicBoolean(false);
-        if (Objects.nonNull(score) && score > 0) {
-            isCalculateScorePrice.set(true);
-        }
-        // 2. 查询订单商品是否有优惠券和参加活动
-        goodsEntities.forEach(map -> {
-            // 2-1. 判断活动和优惠券之间的互斥关系
-
-            // 2-2. 计算优惠、活动后的总价格
-
-        });
-        // 3. 计算积分抵扣后的总价格
-        if (isCalculateScorePrice.get()) {
-            // 3-1. 计算总价的50%
-            BigDecimal halfPrice = preferentialPrice.multiply(new BigDecimal("0.5")).setScale(2, BigDecimal.ROUND_HALF_UP);
-            Integer scoreLimit = haiKongProperties.getMemberScoreLimit();
-            if (score < scoreLimit) {
-                LOGGER.warn("用户【{}】的积分数量为:{},最低需要30积分才能抵扣!", userInfo.get("customName"), score);
-                return preferentialPrice;
-            } else {
-                // 3-2. 计算出积分能抵扣的价格
-                int scoreMayDeductionPrice = score % scoreLimit == 0 ? score / scoreLimit : (int) (score / scoreLimit);
-                // 3-3. 计算积分抵扣后的价格
-                BigDecimal scoreMayDeductionPriceDecimal = new BigDecimal(scoreMayDeductionPrice);
-                if (halfPrice.compareTo(scoreMayDeductionPriceDecimal) > 0) {
-                    preferentialPrice = preferentialPrice.subtract(scoreMayDeductionPriceDecimal);
-                } else {
-                    // 积分能抵扣的金额如果比总价的50%还要多,只能抵扣50%
-                    // 总价50%的值
-                    int halfPriceInt = halfPrice.setScale(0, BigDecimal.ROUND_FLOOR).intValue();
-                    int i = scoreMayDeductionPrice - halfPriceInt;
-                    preferentialPrice = preferentialPrice.subtract(new BigDecimal(halfPriceInt));
-                }
-            }
-        }
-        return preferentialPrice;
+        return resultObj;*/
+        return null;
     }
     }
 
 
     /**
     /**
@@ -2407,10 +2349,35 @@ public class OrderServiceImpl implements OrderService {
             machineCode = URLDecoder.decode(machineCode, "UTF-8");
             machineCode = URLDecoder.decode(machineCode, "UTF-8");
         } catch (Exception e) {
         } catch (Exception e) {
 //            e.printStackTrace();
 //            e.printStackTrace();
+            LOGGER.error("decode machine code failed! error message : ", e);
         }
         }
 
 
         Map resultObj = Maps.newHashMap();
         Map resultObj = Maps.newHashMap();
-
+        // 海控需求,下单流程修改,收银端接收会员码,付款码,用户信息,订单数据
+        // 1. 校验库存:保税仓库存 + 展销店库存 - 出区数 >= 购买数
+        // 获取保税仓库存
+        String queryWarehouseStockResponse = haiKongWarehouseTemplate.queryWarehouseStock(null);
+        if (org.springframework.util.StringUtils.isEmpty(queryWarehouseStockResponse)) {
+            LOGGER.error("调用库存系统接口出现错误!返回结果为空!");
+            throw new ServiceException("调用库存系统接口出现错误!");
+        }
+        WareQueryStockResponseDTO wareQueryStockResponseDTO = JacksonUtil.fromStringJson(queryWarehouseStockResponse, WareQueryStockResponseDTO.class);
+        if (Objects.isNull(wareQueryStockResponseDTO)) {
+            throw new ServiceException("解析一步达库存系统响应数据出现错误!");
+        }
+        List<WareQueryStockResponseDTO.WareQueryStockResponseItemDTO> items = wareQueryStockResponseDTO.getItems();
+        // 解析xml,组装成map key=>sku value=>库存
+        Map<String, Integer> stockMap = new HashMap<>(16);
+        items.forEach(item -> {
+            String itemCode = item.getItemCode();
+            Integer quantity = item.getQuantity();
+            if (stockMap.containsKey(itemCode)) {
+                // 避免出现sku相同情况
+                stockMap.put(itemCode, stockMap.get(itemCode) + quantity);
+            } else {
+                stockMap.put(itemCode, quantity);
+            }
+        });
         try {
         try {
             if (user == null) {
             if (user == null) {
                 resultObj.put("errno", 400);
                 resultObj.put("errno", 400);
@@ -2433,200 +2400,129 @@ public class OrderServiceImpl implements OrderService {
             List<GoodsEntity> goodsEntities = new ArrayList<>();
             List<GoodsEntity> goodsEntities = new ArrayList<>();
 
 
             BigDecimal totalTax = new BigDecimal(0);
             BigDecimal totalTax = new BigDecimal(0);
-
+            // 根据商品条码、sku、门店id查询相对应的商品信息,并组装成对象
+            List<QueryGoodsVO> queryGoodsVOList = new ArrayList<>();
+            goodsList.forEach(map -> {
+                QueryGoodsVO queryGoodsVo = new QueryGoodsVO();
+                queryGoodsVo.setProdBarcode((String) map.get("prodBarcode"));
+                queryGoodsVo.setSku((String) map.get("goodsSn"));
+                queryGoodsVo.setStoreId(storeId);
+                queryGoodsVo.setSellVolume((Integer) map.get("sellVolume"));
+                queryGoodsVo.setRetailPrice(new BigDecimal(String.valueOf(map.get("retailPrice"))));
+                queryGoodsVo.setGoodsTaxes(new BigDecimal(String.valueOf(map.get("goodstaxes"))));
+                queryGoodsVo.setDisCountedPrice(new BigDecimal(String.valueOf(map.get("disCountedPrice"))));
+                queryGoodsVo.setActivity((String) map.get("activity"));
+                queryGoodsVOList.add(queryGoodsVo);
+            });
+            // 将在循环中查询数据库改为一次性查询
+            List<GoodsEntity> goodsEntityList = goodsService.queryGoodsStockByQueryGoodsVoList(queryGoodsVOList);
+            // 复制集合数据
+            ListUtils listUtils = BeanUtils.instantiate(ListUtils.class);
+            listUtils.copyList(goodsEntityList, queryGoodsVOList);
             // 检查库存和更新库存
             // 检查库存和更新库存
-            for (LinkedHashMap goodsDto : goodsList) {
+            for (QueryGoodsVO goodsDto : queryGoodsVOList) {
                 // 要购买的数量
                 // 要购买的数量
-                Integer sellVolume = (Integer) goodsDto.get("sellVolume");
-
-                Integer goodsSellNumber = (Integer) goodsDto.get("sellVolume");
-
-                String prodBarcode = (String) goodsDto.get("prodBarcode");
-                String sku = (String) goodsDto.get("goodsSn");
-                Map<GoodsEntity, Integer> numberMap = new HashMap<>();
-                // 根据商品条码,门店id,sku查找库存
-                List<GoodsEntity> queryGoodsList = goodsDao.queryListByBarcode(prodBarcode, storeId,sku);
-                if (queryGoodsList != null && queryGoodsList.size() != 0) {
-                    for (GoodsEntity goodsEntity : queryGoodsList) {
-                        // 如果当前还有需要购买的
-                        if (sellVolume > 0) {
-                            // 当前商品剩余的数量, 门店库存
-                            Integer remainAmount = Integer.parseInt(goodsEntity.getStockNum());
-                            if (sellVolume >= remainAmount) {
-                                // 证明该sku库存不足,需要继续向下个sku消费
-                                sellVolume -= remainAmount;
-                                // 记录该商品用了多少个数量
-                                numberMap.put(goodsEntity, remainAmount);
-                            } else {
-                                // 记录该商品用了多少个数量
-                                numberMap.put(goodsEntity, sellVolume);
-                                sellVolume = 0;
-                            }
-                        }
+                Integer sellVolume = goodsDto.getSellVolume();
+                String prodBarcode = goodsDto.getProdBarcode();
+                String sku = goodsDto.getSku();
+                Integer goodsNumber = goodsDto.getGoodsNumber();
+                // 仓库库存可用库存数
+                Integer warehouseStock = stockMap.get(sku);
+
+                // 判断库存
+                if (stockMap.containsKey(sku)) {
+                    // 当前出区数
+                    Integer exitRegionNumber = goodsDto.getExitRegionNumber();
+                    // 保税仓库存 + 门店库存 - 出区数 >= 购买数
+                    if (!((warehouseStock + goodsNumber) - exitRegionNumber >= sellVolume)) {
+                        // 库存不足
+                        LOGGER.error("sku:【{}】库存不足,门店可用库存:【{}】,仓库可用库存:【{}】,购买数量:【{}】", sku, goodsNumber, warehouseStock, sellVolume);
+                        throw new ServiceException(String.format("sku:【%s】库存不足,门店可用库存:【%s】,仓库可用库存:【%s】,购买数量:【%s】", sku, goodsNumber, warehouseStock, sellVolume));
                     }
                     }
-                }
-
-                // 园区库存是有问题的, 这里去掉校验极端情况下可能会导致园区库存为负数
-//                if (sellVolume > 0) {
-//                    resultObj.put("errno", 400);
-//                    resultObj.put("errmsg", "订单提交失败:条形码:" + prodBarcode + ",电商门店库存不足");
-//                    return resultObj;
-//                }
-
-                Iterator<GoodsEntity> goodsIterator = numberMap.keySet().iterator();
-                // 循环购买的商品map,重新计算数量跟价格
-                while (goodsIterator.hasNext()) {
-                    GoodsEntity goodsEntity = goodsIterator.next();
-                    // 该商品购买数量
-                    Integer num = numberMap.get(goodsEntity);
-                    // 取得规格的信息,判断规格库存,门店库存
-                    ProductStoreRelaEntity productInfo = productStoreRelaDao
-                            .queryByGoodsIdAndStoreId(Long.valueOf(storeId), Long.valueOf(goodsEntity.getId()));
-                    // 判断园区库存
-                    synchronized (productInfo) {
-//                        if (null == productInfo || null == productInfo.getStockNum() ||
-//                                productInfo.getStockNum() < (num)) {
-//                            resultObj.put("errno", 400);
-//                            resultObj.put("errmsg", "条形码:" + prodBarcode + ",电商门店库存不足,仅剩余" + productInfo.getStockNum());
-//                            return resultObj;
-//                        } else {
-                            // 判断销售价是否低于底线价
-//                        if(productInfo.getBottomLinePrice() != null){
-//                            BigDecimal bottomLinePrice = new BigDecimal(productInfo.getBottomLinePrice());
-//                            if (goodsEntity.getStoreRetailPrice().compareTo(bottomLinePrice) <= -1) {
-//                                LOGGER.error("销售价格小于底线价格");
-//
-//                                // 记录该信息,到价格过低日志表中,这里没有活动id
-//                                Mall2LowPriceWarningEntity lowPriceWarningEntity = new Mall2LowPriceWarningEntity();
-//                                lowPriceWarningEntity.setSalePrice(goodsEntity.getStoreRetailPrice());
-//                                lowPriceWarningEntity.setWarningPrice(bottomLinePrice);
-//                                lowPriceWarningEntity.setSku(goodsEntity.getGoodsSn());
-//                                lowPriceWarningEntity.setWarningType("00");
-//                                lowPriceWarningEntity.setStoreId(storeId+"");
-//                                lowPriceWarningEntity.setCreateTime(new Date());
-//
-//                                lowPriceWarningDao.save(lowPriceWarningEntity);
-//                                resultObj.put("errno", 400);
-//                                resultObj.put("errmsg", "商品"+goodsEntity.getName()+"的销售价格小于底线价格");
-//                                return resultObj;
-//                            }
-//                        }
-                        // 门店库存变化记录
-                        StoreMngChangeEntity storeMngChangeEntity = new StoreMngChangeEntity();
-                        storeMngChangeEntity.setChangeType(Dict.changeType.item_1.getItem());
-                        storeMngChangeEntity.setChangeReason("商品销售扣减");
-                        storeMngChangeEntity.setGoodsId(Integer.parseInt(String.valueOf(productInfo.getGoodsId())));
-                        storeMngChangeEntity.setStoreId(Integer.parseInt(String.valueOf(productInfo.getStoreId())));
-                        storeMngChangeEntity.setMerchSn(productInfo.getMerchSn());
-                        storeMngChangeEntity.setStoreChangeNum(num);
-                        storeMngChangeEntity.setStoreOriginalNum(productInfo.getStockNum());
-                        storeMngChangeEntity.setStoreValidNum(productInfo.getStockNum() - num);
-                        storeMngChangeEntity.setCreateTime(new Date());
-                        storeMngChangeEntity.setModTime(new Date());
-                        storeMngChangeEntity.setCreaterSn(user.getUsername());
-                        storeMngChangeEntity.setModerSn(user.getUsername());
-                        storeMngChangeEntity.setIsValid(0);
-                        storeMngChangeDao.save(storeMngChangeEntity);
-
-                        int validNum = productInfo.getStockNum() - num;
-                        if (goodsEntity != null) {
-                            MngChangeEntity mngChangeEntity = new MngChangeEntity();
-                            mngChangeEntity.setThirdPartyMerchCode(goodsEntity.getThirdPartyMerchCode());
-                            mngChangeEntity.setChangeReason("商品销售扣减");
-                            mngChangeEntity.setCreateTime(new Date());
-                            mngChangeEntity.setModTime(new Date());
-                            mngChangeEntity.setCreaterSn(user.getUsername());
-                            mngChangeEntity.setModerSn(user.getUsername());
-                            mngChangeEntity.setIsValid(0);
-                            mngChangeEntity.setMerchSn(goodsEntity.getMerchSn());
-                            mngChangeEntity.setOriginalNum(goodsEntity.getGoodsNumber());//原库存数
-                            mngChangeEntity.setValidNum(goodsEntity.getGoodsNumber() - num);//可用数
-                            mngChangeEntity.setChangeNum(num);//变化数
-                            mngChangeEntity.setChangeType(Dict.changeType.item_1.getItem());
-                            mngChangeEntity.setGoodsId(Integer.parseInt(String.valueOf(goodsEntity.getId())));
-
-                            mngChangeDao.save(mngChangeEntity);
-
-                            // 如果园区库存数量小于等于0, 则不更新园区库存, 园区库存只做参考
-                            int diff = Math.max(goodsEntity.getGoodsNumber() - num, 0);
-                            goodsEntity.setGoodsNumber(diff);
-                            goodsEntity.setLastSaleTime(new Date());
-                            goodsDao.update(goodsEntity);
-                        }
-                        // 门店库存
-                        productInfo.setStockNum(validNum);
-                        productInfo.setStoreId(Long.valueOf(storeId));
-                        productInfo.setSellVolume(productInfo.getSellVolume() + num);
-                        productInfo.setLastSaleTime(new Date());
-                        productStoreRelaDao.updateStockNum(productInfo);//修改普通商品库存
-                    }
-
-                    BigDecimal retailPrice = new BigDecimal(0);
-                    BigDecimal storeRetailPrice = new BigDecimal(0);
-                    if (goodsDto.get("retailPrice") instanceof Double) {
-
-                        retailPrice = new BigDecimal((Double) goodsDto.get("retailPrice")); // 单价
-                        storeRetailPrice = new BigDecimal((Double) goodsDto.get("retailPrice")); // 单价
-                    } else if (goodsDto.get("retailPrice") instanceof Integer) {
-                        retailPrice = new BigDecimal((Integer) goodsDto.get("retailPrice"));
-                        storeRetailPrice = new BigDecimal((Integer) goodsDto.get("retailPrice"));
-                    } else if (goodsDto.get("retailPrice") instanceof Float) {
-                        retailPrice = new BigDecimal((Float) goodsDto.get("retailPrice"));
-                        storeRetailPrice = new BigDecimal((Float) goodsDto.get("retailPrice"));
-                    }
-
+                    // 门店库存变化记录
+                    StoreMngChangeEntity storeMngChangeEntity = new StoreMngChangeEntity();
+                    storeMngChangeEntity.setChangeType(Dict.changeType.item_1.getItem());
+                    storeMngChangeEntity.setChangeReason("商品销售扣减");
+                    storeMngChangeEntity.setGoodsId(goodsDto.getId().intValue());
+                    storeMngChangeEntity.setStoreId(Integer.parseInt(String.valueOf(goodsDto.getStoreId())));
+                    storeMngChangeEntity.setMerchSn(goodsDto.getMerchSn());
+                    storeMngChangeEntity.setStoreChangeNum(sellVolume);
+                    storeMngChangeEntity.setStoreOriginalNum(goodsDto.getStockNum());
+                    storeMngChangeEntity.setStoreValidNum(goodsDto.getStockNum() - sellVolume);
+                    storeMngChangeEntity.setCreateTime(new Date());
+                    storeMngChangeEntity.setModTime(new Date());
+                    storeMngChangeEntity.setCreaterSn(user.getUsername());
+                    storeMngChangeEntity.setModerSn(user.getUsername());
+                    storeMngChangeEntity.setIsValid(0);
+                    storeMngChangeDao.save(storeMngChangeEntity);
+
+                    int validNum = goodsDto.getStockNum() - sellVolume;
+                    // 园区库存变化记录
+                    MngChangeEntity mngChangeEntity = new MngChangeEntity();
+                    mngChangeEntity.setThirdPartyMerchCode(goodsDto.getThirdPartyMerchCode());
+                    mngChangeEntity.setChangeReason("商品销售扣减");
+                    mngChangeEntity.setCreateTime(new Date());
+                    mngChangeEntity.setModTime(new Date());
+                    mngChangeEntity.setCreaterSn(user.getUsername());
+                    mngChangeEntity.setModerSn(user.getUsername());
+                    mngChangeEntity.setIsValid(0);
+                    mngChangeEntity.setMerchSn(goodsDto.getMerchSn());
+                    mngChangeEntity.setOriginalNum(goodsNumber);//原库存数
+                    mngChangeEntity.setValidNum(goodsNumber - sellVolume);//可用数
+                    mngChangeEntity.setChangeNum(sellVolume);//变化数
+                    mngChangeEntity.setChangeType(Dict.changeType.item_1.getItem());
+                    mngChangeEntity.setGoodsId(goodsDto.getId().intValue());
+
+                    mngChangeDao.save(mngChangeEntity);
+
+                    // 如果园区库存数量小于等于0, 则不更新园区库存, 园区库存只做参考
+                    int diff = Math.max(goodsNumber - sellVolume, 0);
+                    goodsDto.setGoodsNumber(diff);
+                    goodsDto.setLastSaleTime(new Date());
+                    GoodsEntity goodsEntity = new GoodsEntity(goodsDto);
+                    goodsDao.update(goodsEntity);
+                    // 门店库存
+                    goodsDto.setStockNum(validNum);
+                    goodsDto.setStoreId(storeId);
+                    goodsDto.setSellVolume(goodsDto.getSellVolume() + sellVolume);
+                    goodsDto.setLastSaleTime(new Date());
+                    ProductStoreRelaEntity productStoreRelaEntity = new ProductStoreRelaEntity(goodsDto);
+                    productStoreRelaDao.updateStockNum(productStoreRelaEntity);//修改普通商品库存
+
+                    BigDecimal retailPrice = goodsDto.getRetailPrice(); // 单价
+                    BigDecimal storeRetailPrice = goodsDto.getRetailPrice(); // 单价
                     // 优惠价
                     // 优惠价
-                    BigDecimal disCountedPrice = new BigDecimal(0);
+                    BigDecimal disCountedPrice = goodsDto.getDisCountedPrice();
                     // 实际支付价
                     // 实际支付价
-                    BigDecimal actualPaymentAmount = new BigDecimal(0);
-
-                    if (goodsDto.get("discountedPrice") instanceof Double) {
-                        disCountedPrice = new BigDecimal((Double) goodsDto.get("discountedPrice")); // 优惠金额
-                    } else if (goodsDto.get("discountedPrice") instanceof Integer) {
-                        disCountedPrice = new BigDecimal((Integer) goodsDto.get("discountedPrice"));
-                    } else if (goodsDto.get("discountedPrice") instanceof Float) {
-                        disCountedPrice = new BigDecimal((Float) goodsDto.get("discountedPrice"));
-                    }
-                    if (goodsDto.get("actualPaymentAmount") instanceof Double) {
-                        actualPaymentAmount = new BigDecimal((Double) goodsDto.get("actualPaymentAmount")); // 实际支付价格
-                    } else if (goodsDto.get("actualPaymentAmount") instanceof Integer) {
-                        actualPaymentAmount = new BigDecimal((Integer) goodsDto.get("actualPaymentAmount"));
-                    } else if (goodsDto.get("actualPaymentAmount") instanceof Float) {
-                        actualPaymentAmount = new BigDecimal((Float) goodsDto.get("actualPaymentAmount"));
-                    }
+                    BigDecimal actualPaymentAmount = goodsDto.getTotalPrice();
+
                     disCountedPrice = disCountedPrice
                     disCountedPrice = disCountedPrice
-                            .divide(new BigDecimal(goodsSellNumber), 3, RoundingMode.HALF_UP)
-                            .multiply(new BigDecimal(num))
+                            .divide(new BigDecimal(sellVolume), 3, RoundingMode.HALF_UP)
+                            .multiply(new BigDecimal(sellVolume))
                             .setScale(2, RoundingMode.HALF_UP);
                             .setScale(2, RoundingMode.HALF_UP);
                     actualPaymentAmount = actualPaymentAmount
                     actualPaymentAmount = actualPaymentAmount
-                            .divide(new BigDecimal(goodsSellNumber), 3, RoundingMode.HALF_UP)
-                            .multiply(new BigDecimal(num))
+                            .divide(new BigDecimal(sellVolume), 3, RoundingMode.HALF_UP)
+                            .multiply(new BigDecimal(sellVolume))
                             .setScale(2, RoundingMode.HALF_UP);
                             .setScale(2, RoundingMode.HALF_UP);
 
 
-
-                    goodsEntity.setRetailPrice(retailPrice);
-                    goodsEntity.setStoreRetailPrice(storeRetailPrice);
-                    goodsEntity.setDiscountedPrice(disCountedPrice);
-                    goodsEntity.setActualPaymentAmount(actualPaymentAmount);
+                    goodsDto.setRetailPrice(retailPrice);
+                    goodsDto.setStoreRetailPrice(storeRetailPrice);
+                    goodsDto.setDisCountedPrice(disCountedPrice);
+                    goodsDto.setTotalPrice(actualPaymentAmount);
 
 
                     // 借用这个字段来存储购买数
                     // 借用这个字段来存储购买数
-                    goodsEntity.setGoodsNumber(num);
-                    goodsEntity.setActivity((String) goodsDto.get("activity"));
+                    goodsDto.setGoodsNumber(sellVolume);
+                    goodsDto.setActivity(goodsDto.getActivity());
+                    goodsEntity = new GoodsEntity(goodsDto);
                     goodsEntities.add(goodsEntity);
                     goodsEntities.add(goodsEntity);
+                } else {
+                    // sku不存在
+                    LOGGER.error("库存系统中不包含此sku:【{}】,校验库存出错!下单失败!", sku);
+                    throw new ServiceException(String.format("库存系统中不包含此sku:【%s】,下单失败!", sku));
                 }
                 }
 
 
                 // 计算该购物车所需要的所有税费
                 // 计算该购物车所需要的所有税费
-                Object taxObject = goodsDto.get("goodstaxes");
-                BigDecimal tax = new BigDecimal(0);
-                if (taxObject instanceof Double) {
-                    tax = new BigDecimal((Double) taxObject);
-                } else if (taxObject instanceof Integer) {
-                    tax = new BigDecimal((Integer) taxObject);
-                } else if (taxObject instanceof Float) {
-                    tax = new BigDecimal((Float) taxObject);
-                } else if (taxObject instanceof String) {
-                    tax = new BigDecimal((String) taxObject);
-                }
+                BigDecimal tax = goodsDto.getGoodsRate();
                 totalTax = totalTax.add(tax).setScale(2, BigDecimal.ROUND_HALF_DOWN); // 计算总的税额
                 totalTax = totalTax.add(tax).setScale(2, BigDecimal.ROUND_HALF_DOWN); // 计算总的税额
             }
             }
 
 
@@ -2659,21 +2555,8 @@ public class OrderServiceImpl implements OrderService {
                 userDao.update(userEntity);
                 userDao.update(userEntity);
             }
             }
 
 
-
-            // TODO 查询使用的优惠券,并减扣金额
-            String couponSn = (String) userInfo.get("couponSn");
-            // 获取当前时间
-            String currentTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
-            MkActivitiesCouponEntity couponEntity = mkActivitiesCouponService.queryByCouponSn(couponSn, currentTime);
-//            // 优惠金额
-            BigDecimal disCountAmount = new BigDecimal(0);
-            if (couponEntity != null) {
-                disCountAmount = couponEntity.getCouponPrice();
-            }
-
-
             // 判断该用户是否是生日
             // 判断该用户是否是生日
-            Boolean isBirth = false;
+            /*Boolean isBirth = false;
             String birthday = "";
             String birthday = "";
             if (userEntity.getIdNo().length() == 15) {
             if (userEntity.getIdNo().length() == 15) {
                 birthday = userEntity.getIdNo().substring(8, 10) + "-" + userEntity.getIdNo().substring(10, 12);
                 birthday = userEntity.getIdNo().substring(8, 10) + "-" + userEntity.getIdNo().substring(10, 12);
@@ -2685,27 +2568,19 @@ public class OrderServiceImpl implements OrderService {
             String today = format.format(new Date());
             String today = format.format(new Date());
             if (birthday.equalsIgnoreCase(today)) {
             if (birthday.equalsIgnoreCase(today)) {
                 isBirth = true;
                 isBirth = true;
-            }
-
-
+            }*/
             // 生成订单
             // 生成订单
             String merchOrderSn = "EMATO" + CommonUtil.generateOrderNumber();
             String merchOrderSn = "EMATO" + CommonUtil.generateOrderNumber();
 
 
-            OrderVo order = setOrderVo(goodsEntities, userEntity, storeId.longValue(), user.getMerchSn(), disCountAmount, totalTax, status, mapAddr);
+            // OrderVo order = setOrderVo(goodsEntities, userEntity, storeId.longValue(), user.getMerchSn(), disCountAmount, totalTax, status, mapAddr);
+            OrderVo order = setOrderVo(goodsEntities, userEntity, storeId.longValue(), user.getMerchSn(), totalTax, status, mapAddr);
             order.setStore_id(storeId.longValue());
             order.setStore_id(storeId.longValue());
-//            if(storeTopic != null){
-//                order.setActivity_id(storeTopic.getId().longValue());
-//            }
+            String couponSn = (String) userInfo.get("couponSn");
             order.setMerchOrderSn(merchOrderSn);
             order.setMerchOrderSn(merchOrderSn);
             order.setCoupon_name(couponSn); // 借用这个字段来记录是否使用优惠券
             order.setCoupon_name(couponSn); // 借用这个字段来记录是否使用优惠券
             //插入订单信息和订单商品
             //插入订单信息和订单商品
             orderDao.saveOrderVo(order);
             orderDao.saveOrderVo(order);
 
 
-
-            // TODO req_2021-07-19 电商端下单时间 req_20210826_001
-            customsClearanceTimeliness.send(Arrays.asList(order.getOrder_sn()), "customerOrder");
-
-
             // TODO 订单流转表
             // TODO 订单流转表
             OrderProcessRecordEntity processRecordEntity = new OrderProcessRecordEntity();
             OrderProcessRecordEntity processRecordEntity = new OrderProcessRecordEntity();
             processRecordEntity.setOrderSn(order.getOrder_sn());
             processRecordEntity.setOrderSn(order.getOrder_sn());
@@ -2721,15 +2596,10 @@ public class OrderServiceImpl implements OrderService {
                 return resultObj;
                 return resultObj;
             }
             }
 
 
-            List<OrderGoodsVo> orderGoodsVoList = new ArrayList<>();
+            List<OrderGoodsVo> orderGoodsVoList = goodsEntities.stream().map(goodsEntity -> setOrderGoodsVo(order, goodsEntity)).collect(Collectors.toList());
+            // 批量保存订单详情
+            orderGoodsService.saveBatchOrderDetail(orderGoodsVoList);
 
 
-            for (GoodsEntity goodsDto : goodsEntities) {
-
-                OrderGoodsVo orderGoodsVo = setOrderGoodsVo(order, goodsDto);
-                //新增订单详情
-                orderGoodsDao.saveOrderGoodsVo(orderGoodsVo);
-                orderGoodsVoList.add(orderGoodsVo);
-            }
             //清空预订单商品临时表
             //清空预订单商品临时表
             Map orderInfoMap = Maps.newHashMap();
             Map orderInfoMap = Maps.newHashMap();
             orderInfoMap.put("orderInfo", order);
             orderInfoMap.put("orderInfo", order);
@@ -2744,10 +2614,6 @@ public class OrderServiceImpl implements OrderService {
 
 
             StoreEntity store = storeService.queryObject(order.getStore_id().intValue());
             StoreEntity store = storeService.queryObject(order.getStore_id().intValue());
 
 
-            // 设置支付单开始时间
-            // TODO req_2021-07-19 顾客付款时间 req_20210826_001
-            customsClearanceTimeliness.send(Arrays.asList(order.getOrder_sn()), "customerPay");
-
             processRecordEntity.setPaymentStartTime(new Date());
             processRecordEntity.setPaymentStartTime(new Date());
             // 判断是微信的支付码还是支付宝的支付码
             // 判断是微信的支付码还是支付宝的支付码
 //            if (parCode.startsWith("28")) {
 //            if (parCode.startsWith("28")) {
@@ -2755,7 +2621,7 @@ public class OrderServiceImpl implements OrderService {
 //                try {
 //                try {
 //                    AliPay(user, parCode, order, processRecordEntity, orderWXPayRecordCurrent, store);
 //                    AliPay(user, parCode, order, processRecordEntity, orderWXPayRecordCurrent, store);
 //                } catch (Exception e) {
 //                } catch (Exception e) {
-//                    e.printStackTrace();
+//                    LOGGER.error("支付宝支付出现异常!订单号:【{}】", order.getOrder_sn(), e);
 //                    throw e;
 //                    throw e;
 //                }
 //                }
 //            } else {
 //            } else {
@@ -2767,8 +2633,6 @@ public class OrderServiceImpl implements OrderService {
 //                    throw e;
 //                    throw e;
 //                }
 //                }
 //            }
 //            }
-            // TODO req_2021-07-19 客户付款完成时间 req_20210826_001
-            customsClearanceTimeliness.send(Arrays.asList(order.getOrder_sn()), "customerPayFinished");
 
 
             processRecordEntity.setPaymentStartTime(new Date());
             processRecordEntity.setPaymentStartTime(new Date());
 
 
@@ -2828,17 +2692,52 @@ public class OrderServiceImpl implements OrderService {
             consumptionRecords.setUserId(userEntity.getId() + "");
             consumptionRecords.setUserId(userEntity.getId() + "");
             consumptionRecords.setOrderSn(order.getOrder_sn());
             consumptionRecords.setOrderSn(order.getOrder_sn());
             consumptionRecords.setConsumptionTime(new Date());
             consumptionRecords.setConsumptionTime(new Date());
-            consumptionRecords.setShopSn(storeId + "");
-            // TODO 判断是否有使用生日优惠
-            if (isBirth) {
+            consumptionRecords.setShopSn(String.valueOf(storeId));
+            // 判断是否有使用生日优惠
+            /*if (isBirth) {
                 consumptionRecords.setIsUseBirthdayOffer("0"); // 使用生日优惠
                 consumptionRecords.setIsUseBirthdayOffer("0"); // 使用生日优惠
             } else {
             } else {
                 consumptionRecords.setIsUseBirthdayOffer("1"); // 没使用生日优惠
                 consumptionRecords.setIsUseBirthdayOffer("1"); // 没使用生日优惠
-            }
+            }*/
+            // 积分消费记录
+            int deductionScore = (Integer) param.get("deductionScore");
+            String memberCode = String.valueOf(param.get("memberCode"));
+            String memberPhone = String.valueOf(param.get("memberPhone"));
+            BigDecimal scoreDeductionPrice = new BigDecimal(String.valueOf(param.get("scoreDeductionPrice")));
+            Integer beforeScore = (Integer) param.get("beforeScore");
+            Integer afterScore = (Integer) param.get("afterScore");
+            consumptionRecords.setBeforeScore(beforeScore);
+            consumptionRecords.setAfterScore(afterScore);
+            consumptionRecords.setOrderTotalPrice(order.getActual_price());
+            consumptionRecords.setScoreDeductionPrice(scoreDeductionPrice);
+            consumptionRecords.setMemberCode(memberCode);
+            consumptionRecords.setMemberPhone(memberPhone);
+            consumptionRecords.setDeductionScore(deductionScore);
             consumptionRecords.setCreaterSn(userId + "");
             consumptionRecords.setCreaterSn(userId + "");
             consumptionRecords.setCreateTime(new Date());
             consumptionRecords.setCreateTime(new Date());
             memberConsumptionRecordsDao.save(consumptionRecords);
             memberConsumptionRecordsDao.save(consumptionRecords);
 
 
+            // 同步会员订单消费记录
+            HaiKongMemberOrderSyncResendEntity haiKongMemberOrderSyncResendEntity = new HaiKongMemberOrderSyncResendEntity();
+            try {
+                MemberOrderInfoSyncDTO memberOrderInfoSyncDTO = new MemberOrderInfoSyncDTO();
+                memberOrderInfoSyncDTO.setPhone(memberPhone);
+                memberOrderInfoSyncDTO.setOrderNo(order.getOrder_sn());
+                memberOrderInfoSyncDTO.setConsumeDate(new Date());
+                memberOrderInfoSyncDTO.setOrderAmount(order.getActual_price());
+                memberOrderInfoSyncDTO.setOrderScore(deductionScore);
+                BeanUtils.copyProperties(memberOrderInfoSyncDTO, haiKongMemberOrderSyncResendEntity);
+                String body = JacksonUtil.toJson(memberOrderInfoSyncDTO);
+                LOGGER.info("请求会员系统同步消费订单接口!请求体:{}", body);
+                // 发送请求
+                String memberOrderSyncResponseJson = haiKongMemberTemplate.memberOrderSync(body);
+                LOGGER.info("请求会员系统同步消费订单接口成功!响应数据:{}", memberOrderSyncResponseJson);
+            } catch (Exception e) {
+                LOGGER.error("请求会员系统同步消费订单接口失败!准备新增发送失败记录,等待重发!异常信息:", e);
+                // TODO 没有请求成功,写表,重发
+                haiKongMemberOrderSyncResendEntity.setResendStatus(HaiKongMemberOrderResendStatusEnum.WAIT_RESEND.getStatus());
+                haiKongMemberOrderSyncResendService.save(haiKongMemberOrderSyncResendEntity);
+            }
 
 
             // 生成取票码
             // 生成取票码
             PickUpCodeEntity pickUpCodeEntity = new PickUpCodeEntity();
             PickUpCodeEntity pickUpCodeEntity = new PickUpCodeEntity();
@@ -2856,32 +2755,6 @@ public class OrderServiceImpl implements OrderService {
             WebSocketServer.sendMessage(sessionId, order.getOrder_sn(), order.getStore_id()
             WebSocketServer.sendMessage(sessionId, order.getOrder_sn(), order.getStore_id()
                     + "");
                     + "");
 
 
-            // TODO 下单流程完成了,现在将下单的库存明细存入表中,准备发送到中控
-//            List<KtoEccsEntity> ktoEccsEntities = new LinkedList<>();
-////            orderGoodsVoList
-//            for (OrderGoodsVo orderGoodsVo : orderGoodsVoList) {
-//                KtoEccsEntity ktoEccsEntity = new KtoEccsEntity();
-//                ktoEccsEntity.setRequestData(JSON.toJSONString(orderGoodsVo));
-//                ktoEccsEntity.setRequestType("03");
-//                ktoEccsEntity.setSendStatus("00");
-//                ktoEccsEntity.setCreaterSn(user.getUserId()+"");
-//                ktoEccsEntity.setCreateTime(new Date());
-//                ktoEccsEntities.add(ktoEccsEntity);
-//            }
-//
-//
-//            if(ktoEccsEntities.size() > 0){
-//                if(ktoEccsEntities.size() > 50){
-//                    List<List<KtoEccsEntity>> partition = Lists.partition(ktoEccsEntities, 50);
-//                    for (List<KtoEccsEntity> ktoEccs : partition) {
-//                        ktoEccsService.saveBatch(ktoEccs);
-//                    }
-//                }else{
-//                    ktoEccsService.saveBatch(ktoEccsEntities);
-//                }
-//            }
-
-
             return resultObj;
             return resultObj;
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
@@ -2891,99 +2764,6 @@ public class OrderServiceImpl implements OrderService {
         }
         }
     }
     }
 
 
-//    private BigDecimal getDisCountAmout(List<GoodsEntity> goodsEntities) {
-//        BigDecimal disCountAmount;
-//        // TODO 生成订单之前,先查询是否有优惠券或者满减
-//        // TODO 20200610 要修改成全部商品
-//        // 优惠券的集合
-//        List<MkStoreTicketDiscountEntity> mkStoreTicketDiscountEntities = new ArrayList<>();
-//        // 满减的集合
-//        List<MkStoreCampMinusLevelEntity> mkStoreCampMinusEntities = new ArrayList<>();
-//        // 存商品跟金额的关系
-//        Map<Long,BigDecimal> moneyMap = new HashMap<>();
-//        // 商品总价
-//        BigDecimal totalPrice = new BigDecimal(0);
-//
-//        for(GoodsEntity goodsEntity : goodsEntities){
-//            Long goodsId = goodsEntity.getId();
-//            // 计算该商品的价格
-//            BigDecimal goodsPrice = goodsEntity.getStoreRetailPrice().multiply(new BigDecimal(goodsEntity.getGoodsNumber())).setScale(2, RoundingMode.HALF_UP);
-//            moneyMap.put(goodsId,goodsPrice);
-//            totalPrice = totalPrice.add(goodsPrice);
-//            // 查询该商品id是否有优惠券
-//            List<MkStoreTicketDiscountEntity> mkStoreTicketDiscountEntity = mkStoreTicketDiscountService.queryByGoodsId(goodsId);
-//            if(mkStoreTicketDiscountEntity != null) {
-//                mkStoreTicketDiscountEntities.addAll(mkStoreTicketDiscountEntity);
-//            }
-//            // 查询该商品id是否有满减
-//            List<MkStoreCampMinusLevelEntity> mkStoreCampMinusEntity = mkStoreCampMinusService.queryByGoodsId(goodsId);
-//            if(mkStoreCampMinusEntity != null) {
-//                mkStoreCampMinusEntities.addAll(mkStoreCampMinusEntity);
-//            }
-//        }
-//
-//        // 满减优惠的金额
-//        BigDecimal campDisCountAmount = new BigDecimal(0);
-//        if(mkStoreCampMinusEntities.size() > 0){
-//            // 上一次所需金额,用于取最大的优惠力度
-//            BigDecimal lastAmount = new BigDecimal(0);
-//            for (int i = 0 ; i < mkStoreCampMinusEntities.size() ; i++){
-//                MkStoreCampMinusLevelEntity mkStoreCampMinusLevelEntity = mkStoreCampMinusEntities.get(i);
-//                // TODO 20200610还有满多少件,跟满多少元打折的,逻辑复杂,下次开发
-//                BigDecimal discCond = mkStoreCampMinusLevelEntity.getYuanMinusCond();
-//                // 判断这次金额是否大于上次金额,如果不大于,直接continue
-//                if(discCond.compareTo(lastAmount) > 0){
-//                    // 如果总金额大于所需金额,则可以使用该优惠券,记录该优惠券的角标,金额跟优惠的钱
-//                    if(totalPrice.compareTo(discCond) > 0){
-//                        // 记录上一次金额
-//                        lastAmount = discCond;
-//                        campDisCountAmount = mkStoreCampMinusLevelEntity.getYuanMinusPref();
-//                    }
-//                }
-//            }
-//        }
-//
-//        // 优惠券优惠的金额
-//        BigDecimal ticketDisCountAmount = new BigDecimal(0);
-//        if(mkStoreTicketDiscountEntities.size() > 0){
-//            // 上一次所需金额,用于取最大的优惠力度
-//            BigDecimal lastAmount = new BigDecimal(0);
-//            BigDecimal lastRadio = new BigDecimal(0);
-//            for (int i = 0 ; i < mkStoreTicketDiscountEntities.size() ; i++){
-//                MkStoreTicketDiscountEntity mkStoreTicketDiscountEntity = mkStoreTicketDiscountEntities.get(i);
-//                // 代金券所需金额
-//                // TODO 20200610还有折扣券的,逻辑较为复杂,下次在开发
-//
-//                if("00".equals(mkStoreTicketDiscountEntity.getApplyType())){
-//                    BigDecimal discCond = mkStoreTicketDiscountEntity.getVoucherCond();
-//                    // 判断这次金额是否大于上次金额,如果不大于,直接continue
-//                    if(discCond.compareTo(lastAmount) > 0){
-//                        // 如果总金额大于所需金额,则可以使用该优惠券,记录该优惠券的角标,金额跟优惠的钱
-//                        if(totalPrice.compareTo(discCond) > 0){
-//                            // 记录上一次金额
-//                            lastAmount = discCond;
-//                            ticketDisCountAmount = mkStoreTicketDiscountEntity.getVoucherMoney();
-//                        }
-//                    }
-//                }else if("01".equals(mkStoreTicketDiscountEntity.getApplyType())){
-//                    BigDecimal discCond = mkStoreTicketDiscountEntity.getDiscCond();
-//                    if(totalPrice.compareTo(discCond) > 0){
-//                        // 打的折扣
-//                        lastRadio = mkStoreTicketDiscountEntity.getDiscRatio();
-//                    }
-//
-//
-//                }
-//
-//
-//            }
-//        }
-//
-//
-//        disCountAmount = ticketDisCountAmount.compareTo(campDisCountAmount) > 0 ? ticketDisCountAmount : campDisCountAmount;
-//        return disCountAmount;
-//    }
-
     private void AliPay(SysUserEntity user, String parCode, OrderVo order, OrderProcessRecordEntity processRecordEntity, OrderWXPayRecordEntity orderWXPayRecordCurrent, StoreEntity store) throws Exception {
     private void AliPay(SysUserEntity user, String parCode, OrderVo order, OrderProcessRecordEntity processRecordEntity, OrderWXPayRecordEntity orderWXPayRecordCurrent, StoreEntity store) throws Exception {
 
 
         AliPayRequestParams params = new AliPayRequestParams();
         AliPayRequestParams params = new AliPayRequestParams();
@@ -4029,6 +3809,7 @@ public class OrderServiceImpl implements OrderService {
         CalculateOrderDiscountPriceResponseVO calculateOrderDiscountPriceResponseVO = new CalculateOrderDiscountPriceResponseVO();
         CalculateOrderDiscountPriceResponseVO calculateOrderDiscountPriceResponseVO = new CalculateOrderDiscountPriceResponseVO();
         String storeId = calculateOrderDiscountPriceVo.getStoreId();
         String storeId = calculateOrderDiscountPriceVo.getStoreId();
         String memberCode = calculateOrderDiscountPriceVo.getMemberCode();
         String memberCode = calculateOrderDiscountPriceVo.getMemberCode();
+        calculateOrderDiscountPriceResponseVO.setMemberCode(memberCode);
         List<GoodsDetailsDto> goodsDetailsDtos = calculateOrderDiscountPriceVo.getGoodsList();
         List<GoodsDetailsDto> goodsDetailsDtos = calculateOrderDiscountPriceVo.getGoodsList();
         BigDecimal orderTotalPrice = BigDecimal.ZERO;
         BigDecimal orderTotalPrice = BigDecimal.ZERO;
         List<QueryGoodsVO> goodsVos = new ArrayList<>();
         List<QueryGoodsVO> goodsVos = new ArrayList<>();
@@ -4349,10 +4130,11 @@ public class OrderServiceImpl implements OrderService {
                 Integer score = memberInfoDTO.getScore();
                 Integer score = memberInfoDTO.getScore();
                 if (Objects.nonNull(score) && score > 0) {
                 if (Objects.nonNull(score) && score > 0) {
                     // 有积分
                     // 有积分
-                    afterDiscountPrice = calculatePreferentialPrice(orderTotalPrice, score, storeId, memberCode);
+                    afterDiscountPrice = calculatePreferentialPrice(orderTotalPrice, score, storeId, memberCode, calculateOrderDiscountPriceResponseVO);
                     LOGGER.info("会员【{}】,当前积分:{},积分抵扣后的订单金额:{},积分抵扣前的订单金额:{}", memberCode, score, afterDiscountPrice, orderTotalPrice);
                     LOGGER.info("会员【{}】,当前积分:{},积分抵扣后的订单金额:{},积分抵扣前的订单金额:{}", memberCode, score, afterDiscountPrice, orderTotalPrice);
                     calculateOrderDiscountPriceResponseVO.setOrderTotalPrice(afterDiscountPrice);
                     calculateOrderDiscountPriceResponseVO.setOrderTotalPrice(afterDiscountPrice);
                     calculateOrderDiscountPriceResponseVO.setGoodsDetailsDtos(goodsDetailsDtos);
                     calculateOrderDiscountPriceResponseVO.setGoodsDetailsDtos(goodsDetailsDtos);
+                    calculateOrderDiscountPriceResponseVO.setBeforeScore(score);
                     // 订单完成后再添加积分消费记录,以及同步积分信息
                     // 订单完成后再添加积分消费记录,以及同步积分信息
                     return calculateOrderDiscountPriceResponseVO;
                     return calculateOrderDiscountPriceResponseVO;
                 } else {
                 } else {
@@ -4381,7 +4163,7 @@ public class OrderServiceImpl implements OrderService {
      * @param memberCode        会员码
      * @param memberCode        会员码
      * @return                  积分抵扣后的订单总金额
      * @return                  积分抵扣后的订单总金额
      */
      */
-    private BigDecimal calculatePreferentialPrice(BigDecimal orderTotalPrice, Integer score, String storeId, String memberCode) {
+    private BigDecimal calculatePreferentialPrice(BigDecimal orderTotalPrice, Integer score, String storeId, String memberCode, CalculateOrderDiscountPriceResponseVO calculateOrderDiscountPriceResponseVO) {
         // 1. 判断是否有积分,是否需要计算积分抵扣后的价格
         // 1. 判断是否有积分,是否需要计算积分抵扣后的价格
         AtomicBoolean isCalculateScorePrice = new AtomicBoolean(false);
         AtomicBoolean isCalculateScorePrice = new AtomicBoolean(false);
         if (Objects.nonNull(score) && score > 0) {
         if (Objects.nonNull(score) && score > 0) {
@@ -4405,7 +4187,13 @@ public class OrderServiceImpl implements OrderService {
                     scoreMayDeductionPriceDecimal = halfPrice;
                     scoreMayDeductionPriceDecimal = halfPrice;
                 }
                 }
                 orderTotalPrice = orderTotalPrice.subtract(scoreMayDeductionPriceDecimal);
                 orderTotalPrice = orderTotalPrice.subtract(scoreMayDeductionPriceDecimal);
-                LOGGER.info("会员【{}】,当前积分:{},抵扣订单金额后剩余积分:{}", memberCode, score, (score - scoreMayDeductionPriceDecimal.multiply(new BigDecimal(scoreLimit)).intValue()));
+                int afterScore = score - scoreMayDeductionPriceDecimal.multiply(new BigDecimal(scoreLimit)).intValue();
+                calculateOrderDiscountPriceResponseVO.setAfterScore(afterScore);
+                calculateOrderDiscountPriceResponseVO.setScoreLimit(scoreLimit);
+                calculateOrderDiscountPriceResponseVO.setDeductionScore(score - afterScore);
+                calculateOrderDiscountPriceResponseVO.setOrderTotalPrice(orderTotalPrice);
+                calculateOrderDiscountPriceResponseVO.setScoreDeductionPrice(scoreMayDeductionPriceDecimal);
+                LOGGER.info("会员【{}】,当前积分:{},抵扣订单金额后剩余积分:{}", memberCode, score, afterScore);
             }
             }
         } else {
         } else {
             LOGGER.info("会员【{}】的积分为0,不参加积分抵扣!", memberCode);
             LOGGER.info("会员【{}】的积分为0,不参加积分抵扣!", memberCode);
@@ -4547,12 +4335,12 @@ public class OrderServiceImpl implements OrderService {
      *
      *
      * @return
      * @return
      */
      */
-    public OrderVo setOrderVo(List<GoodsEntity> goodsList, UserEntity loginUser, Long storeId, String merchSn, BigDecimal disCountAmount, BigDecimal totalTax, int status, Map mapAddr) {
+    public OrderVo setOrderVo(List<GoodsEntity> goodsList, UserEntity loginUser, Long storeId, String merchSn, BigDecimal totalTax, int status, Map mapAddr) {
         OrderVo orderInfo = new OrderVo();
         OrderVo orderInfo = new OrderVo();
 
 
-        BigDecimal goodsTotalPrice = new BigDecimal(0.00);
+        BigDecimal goodsTotalPrice = BigDecimal.ZERO;
         BigDecimal fullCutCouponDec = Constant.ZERO;  // 非现金抵扣 = 各种优惠价格 +优惠券的价格   暂时借用这个字段去,为了不改动ccnet系统
         BigDecimal fullCutCouponDec = Constant.ZERO;  // 非现金抵扣 = 各种优惠价格 +优惠券的价格   暂时借用这个字段去,为了不改动ccnet系统
-        BigDecimal couponPrice = disCountAmount;
+        BigDecimal couponPrice = BigDecimal.ZERO;
         BigDecimal freightPrice = Constant.ZERO;
         BigDecimal freightPrice = Constant.ZERO;
         BigDecimal actualPrice = Constant.ZERO;
         BigDecimal actualPrice = Constant.ZERO;
         //订单价格计算:订单的总价+运费
         //订单价格计算:订单的总价+运费
@@ -4563,7 +4351,7 @@ public class OrderServiceImpl implements OrderService {
                     .add(goodsEntity.getDiscountedPrice()).setScale(2, RoundingMode.HALF_UP);
                     .add(goodsEntity.getDiscountedPrice()).setScale(2, RoundingMode.HALF_UP);
             actualPrice = actualPrice
             actualPrice = actualPrice
                     .add(goodsEntity.getActualPaymentAmount()).setScale(2, RoundingMode.HALF_UP);
                     .add(goodsEntity.getActualPaymentAmount()).setScale(2, RoundingMode.HALF_UP);
-
+            couponPrice = couponPrice.add(goodsEntity.getDiscountedPrice()).setScale(2, RoundingMode.HALF_UP);
         }
         }
 
 
 
 

+ 62 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/haikong/HaiKongMemberOrderSyncResendServiceImpl.java

@@ -0,0 +1,62 @@
+package com.kmall.admin.service.impl.haikong;
+
+import com.kmall.admin.dao.haikong.HaiKongMemberOrderSyncResendDao;
+import com.kmall.admin.entity.haikong.HaiKongMemberOrderSyncResendEntity;
+import com.kmall.admin.service.haikong.HaiKongMemberOrderSyncResendService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author lhm
+ * @createDate 2021-11-30
+ */
+@Service("haiKongMemberOrderSyncResendServiceImpl")
+public class HaiKongMemberOrderSyncResendServiceImpl implements HaiKongMemberOrderSyncResendService {
+
+    @Autowired
+    private HaiKongMemberOrderSyncResendDao haiKongMemberOrderSyncResendDao;
+
+    /**
+     * 按条件查询
+     *
+     * @param resendStatus 条件
+     * @return 实体
+     */
+    @Override
+    public List<HaiKongMemberOrderSyncResendEntity> queryList(String resendStatus) {
+        return haiKongMemberOrderSyncResendDao.queryList(resendStatus);
+    }
+
+    /**
+     * 批量更新状态
+     *
+     * @param entities 实体
+     */
+    @Override
+    public void updateBatchResendStatus(List<HaiKongMemberOrderSyncResendEntity> entities) {
+        haiKongMemberOrderSyncResendDao.updateBatchResendStatus(entities);
+    }
+
+    /**
+     * 更新
+     *
+     * @param haiKongMemberOrderSyncResendEntity 更新的数据
+     */
+    @Override
+    public void update(HaiKongMemberOrderSyncResendEntity haiKongMemberOrderSyncResendEntity) {
+        haiKongMemberOrderSyncResendDao.update(haiKongMemberOrderSyncResendEntity);
+    }
+
+    /**
+     * 新增
+     *
+     * @param haiKongMemberOrderSyncResendEntity 新增的数据
+     */
+    @Override
+    public void save(HaiKongMemberOrderSyncResendEntity haiKongMemberOrderSyncResendEntity) {
+        haiKongMemberOrderSyncResendDao.save(haiKongMemberOrderSyncResendEntity);
+    }
+}

+ 29 - 29
kmall-admin/src/main/resources/conf/mq.properties

@@ -1,31 +1,31 @@
-# rabbitmq\u76F8\u5173\u914D\u7F6E req_20210826_001
-
-# \u5F00\u53D1\u73AF\u5883\u914D\u7F6E
-mq.host=127.0.0.1
-mq.username=guest
-mq.password=guest
-mq.port=5672
-mq.virtual.host=/
-
-# \u6D4B\u8BD5\u73AF\u5883mq\u76F8\u5173\u914D\u7F6E
+## rabbitmq\u76F8\u5173\u914D\u7F6E req_20210826_001
+#
+## \u5F00\u53D1\u73AF\u5883\u914D\u7F6E
+#mq.host=127.0.0.1
+#mq.username=guest
+#mq.password=guest
 #mq.port=5672
 #mq.port=5672
-#mq.host=120.24.174.90
-#mq.username=admin
-#mq.password=Abc-123#
 #mq.virtual.host=/
 #mq.virtual.host=/
-
-# \u751F\u4EA7\u73AF\u5883mq\u76F8\u5173\u914D\u7F6E
-#mq.port=5672
-#mq.host=120.76.26.84
-#mq.username=admin
-#mq.password=Abc-123#
-#mq.virtual.host=/
-
-# \u901A\u7528\u914D\u7F6E
-mq.open=false
-mq.channel.cache.size=50
-
-# \u6E05\u5173\u65F6\u6548\u6027\u961F\u5217\u914D\u7F6E
-k.normal.oms.order.to.handle.customs.clearance=k.normal.oms.order.to.handle.customs.clearance
-q.normal.oms.order.to.handle.customs.clearance=q.normal.oms.order.to.handle.customs.clearance
-e.normal.oms.order.to.handle.customs.clearance=e.normal.oms.order.to.handle.customs.clearance
+#
+## \u6D4B\u8BD5\u73AF\u5883mq\u76F8\u5173\u914D\u7F6E
+##mq.port=5672
+##mq.host=120.24.174.90
+##mq.username=admin
+##mq.password=Abc-123#
+##mq.virtual.host=/
+#
+## \u751F\u4EA7\u73AF\u5883mq\u76F8\u5173\u914D\u7F6E
+##mq.port=5672
+##mq.host=120.76.26.84
+##mq.username=admin
+##mq.password=Abc-123#
+##mq.virtual.host=/
+#
+## \u901A\u7528\u914D\u7F6E
+#mq.open=false
+#mq.channel.cache.size=50
+#
+## \u6E05\u5173\u65F6\u6548\u6027\u961F\u5217\u914D\u7F6E
+#k.normal.oms.order.to.handle.customs.clearance=k.normal.oms.order.to.handle.customs.clearance
+#q.normal.oms.order.to.handle.customs.clearance=q.normal.oms.order.to.handle.customs.clearance
+#e.normal.oms.order.to.handle.customs.clearance=e.normal.oms.order.to.handle.customs.clearance

+ 79 - 0
kmall-admin/src/main/resources/mybatis/mapper/OrderGoodsDao.xml

@@ -183,6 +183,85 @@
         </if>
         </if>
         )
         )
     </insert>
     </insert>
+    <insert id="saveBatchOrderDetail">
+        insert into mall_order_goods
+        (
+            `order_id`,
+            `goods_id`,
+            `goods_name`,
+            `goods_sn`,
+            `product_id`,
+            `number`,
+            `market_price`,
+            `retail_price`,
+            `discounted_price`,
+            `actual_payment_amount`,
+            `goods_specification_name_value`,
+            `is_real`,
+            `goods_specification_ids`,
+            `list_pic_url`,
+            `is_dist_sell_scan`,
+            `tax_price`,
+            `store_topic_id`,
+            `goods_rate`,
+            `settle_price`,
+            `sku`,
+            `order_biz_type`,
+            `activity`,
+            `creater_sn`,
+            `create_time`,
+            `moder_sn`,
+            `mod_time`
+        )
+        values
+        <foreach collection="list" item="item" open="(" separator="," close=")">
+            #{item.order_id},
+            #{item.goods_id},
+            #{item.goods_name},
+            #{item.goods_sn},
+            #{item.product_id},
+            #{item.number},
+            #{item.market_price},
+            #{item.retail_price},
+            #{item.discountedPrice},
+            #{item.actualPaymentAmount},
+            #{item.goods_specification_name_value},
+            #{item.is_real},
+            #{item.goods_specification_ids},
+            #{item.list_pic_url},
+            0,
+            #{item.taxPrice},
+            #{item.storeTopicId},
+            <if test="item.goodsRate != null" >
+                #{item.goodsRate},
+            </if>
+            <if test="item.settlePrice != null" >
+                #{item.settlePrice},
+            </if>
+
+            <if test="item.sku != null" >
+                #{item.sku,jdbcType=VARCHAR},
+            </if>
+            <if test="item.orderBizType != null" >
+                #{item.orderBizType,jdbcType=VARCHAR},
+            </if>
+            <if test="item.activity != null">
+                #{item.activity},
+            </if>
+            <if test="item.createrSn != null" >
+                #{item.createrSn,jdbcType=VARCHAR},
+            </if>
+            <if test="item.createTime != null" >
+                #{item.createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="item.moderSn != null" >
+                #{item.moderSn,jdbcType=VARCHAR},
+            </if>
+            <if test="item.modTime != null" >
+                #{item.modTime,jdbcType=TIMESTAMP}
+            </if>
+        </foreach>
+    </insert>
 
 
 
 
     <update id="update" parameterType="com.kmall.admin.entity.OrderGoodsEntity">
     <update id="update" parameterType="com.kmall.admin.entity.OrderGoodsEntity">

+ 101 - 0
kmall-admin/src/main/resources/mybatis/mapper/haikong/HaiKongMemberOrderSyncResendDao.xml

@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.kmall.admin.dao.haikong.HaiKongMemberOrderSyncResendDao">
+    <resultMap id="CommonResultMap" type="com.kmall.admin.entity.haikong.HaiKongMemberOrderSyncResendEntity">
+        <id column="id" property="id" />
+        <result column="order_no" property="orderNo" />
+        <result column="order_amount" property="orderAmount" />
+        <result column="member_score" property="orderScore" />
+        <result column="consume_date" property="consumeDate" />
+        <result column="open_id" property="openId" />
+        <result column="phone" property="phone" />
+        <result column="resend_status" property="resendStatus" />
+        <result column="last_resend_time" property="lastResendTime" />
+        <result column="create_time" property="createTime" />
+    </resultMap>
+
+    <select id="queryObject" resultType="com.kmall.admin.entity.haikong.HaiKongMemberOrderSyncResendEntity">
+        select *
+        from haikong_member_order_sync_resend
+        where haikong_member_order_sync_resend.id = #{id}
+    </select>
+
+    <select id="queryTotal" resultType="int">
+        select count(1)
+        from haikong_member_order_sync_resend
+    </select>
+
+    <select id="queryList" resultType="com.kmall.admin.entity.haikong.HaiKongMemberOrderSyncResendEntity">
+        select *
+        from haikong_member_order_sync_resend
+        WHERE 1=1
+        <if test="resendStatus != null and resendStatus.trim() != ''">
+            AND name LIKE concat('%',#{resendStatus},'%')
+        </if>
+    </select>
+
+    <insert id="save" parameterType="com.kmall.admin.entity.haikong.HaiKongMemberOrderSyncResendEntity" useGeneratedKeys="true" keyProperty="id">
+        insert into haikong_member_order_sync_resend(
+        `open_id`,
+        `phone`,
+        `consume_date`,
+        `order_amount`,
+        `order_no`,
+        `order_score`,
+        `resend_status`,
+        `last_resend_time`,
+        `create_time`)
+        values(
+        #{openId},
+        #{phone},
+        #{consumeDate},
+        #{orderAmount},
+        #{orderNo},
+        #{orderScore},
+        #{resendStatus},
+        #{lastResendTime},
+        #{createTime}
+    </insert>
+
+    <update id="update" parameterType="com.kmall.admin.entity.haikong.HaiKongMemberOrderSyncResendEntity">
+        update haikong_member_order_sync_resend
+        <set>
+            <if test="openId != null">`open_id` = #{openId}, </if>
+            <if test="phone != null">`phone` = #{phone}, </if>
+            <if test="consumeDate != null">`consume_date` = #{consumeDate}, </if>
+            <if test="orderAmount != null">`order_amount` = #{orderAmount}, </if>
+            <if test="orderNo != null">`order_no` = #{orderNo}, </if>
+            <if test="orderScore != null">`order_score` = #{orderScore}, </if>
+            <if test="resendStatus != null">`resend_status` = #{resendStatus}, </if>
+            <if test="lastResendTime != null">`last_resend_time` = #{lastResendTime}</if>
+            <if test="createTime != null">`create_time` = #{createTime}</if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <update id="updateBatchResendStatus">
+        update haikong_member_order_sync_resend
+        <trim prefix="set" suffixOverrides=",">
+            resend_status =
+            <foreach collection="list" item="item" open="case " close=" end,">
+                when id = #{item.id} then #{item.resendStatus}
+            </foreach>
+        </trim>
+        where
+        <foreach collection="list" item="item" open="( " separator=") or (" close=" )">
+            id = #{item.id}
+        </foreach>
+    </update>
+
+    <delete id="delete">
+        delete from haikong_member_order_sync_resend where id = #{id}
+    </delete>
+
+    <delete id="deleteBatch">
+        delete from haikong_member_order_sync_resend where id in
+        <foreach item="item" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </delete>
+
+</mapper>

+ 1 - 1
kmall-admin/src/main/resources/mybatis/mapper/haikong/ScoreConsumeRecordDao.xml

@@ -24,7 +24,7 @@
         from mall_score_consume_record
         from mall_score_consume_record
     </select>
     </select>
 
 
-    <select id="queryList" resultType="com.kmall.admin.entity.AdPositionEntity">
+    <select id="queryList" resultType="com.kmall.admin.entity.haikong.ScoreConsumeRecord">
         select *
         select *
         from mall_score_consume_record
         from mall_score_consume_record
         WHERE 1=1
         WHERE 1=1

+ 29 - 2
kmall-admin/src/main/webapp/js/sale/sale.js

@@ -591,8 +591,21 @@ let vm = new Vue({
         canRefund:true,
         canRefund:true,
         openSku:false,
         openSku:false,
         // 保存商品详情的list
         // 保存商品详情的list
-        calGoodsList : []
-
+        calGoodsList : [],
+        // 会员码
+        memberCode: '',
+        // 会员手机
+        memberPhone: '',
+        // 订单抵扣积分
+        deductionScore: '',
+        // 积分抵扣金额
+        scoreDeductionPrice: '',
+        // 积分抵扣金额
+        scoreLimit: 0,
+        // 抵扣前积分
+        beforeScore: 0,
+        // 抵扣后积分
+        afterScore: 0
     },
     },
     watch: {
     watch: {
         prodBarcode (){
         prodBarcode (){
@@ -1944,6 +1957,13 @@ function toPayOrder(payCode){
                  'goodsList':vm.goodsList,
                  'goodsList':vm.goodsList,
                  'sessionId':vm.sessionId,
                  'sessionId':vm.sessionId,
                  'machineCode':vm.machineCode,
                  'machineCode':vm.machineCode,
+                 'memberCode': vm.memberCode,
+                 'memberPhone': vm.memberPhone,
+                 'deductionScore': vm.deductionScore,
+                 'scoreDeductionPrice': vm.scoreDeductionPrice,
+                 'scoreLimit': vm.scoreLimit,
+                 'beforeScore': vm.beforeScore,
+                 'afterScore': vm.afterScore,
                  'cmbProvince':cmbProvince,
                  'cmbProvince':cmbProvince,
                  'cmbCity':cmbCity,
                  'cmbCity':cmbCity,
                  'cmbArea':cmbArea,
                  'cmbArea':cmbArea,
@@ -2031,6 +2051,13 @@ calculateOrderPrice = function() {
                 vm.goodsList.clear();
                 vm.goodsList.clear();
                 calGoodsList.forEach(goods => vm.goodsList.push(goods));
                 calGoodsList.forEach(goods => vm.goodsList.push(goods));
                 vm.actualPrice = r.data.orderTotalPrice;
                 vm.actualPrice = r.data.orderTotalPrice;
+                vm.memberCode = r.data.memberCode;
+                vm.memberPhone = r.data.memberPhone;
+                vm.deductionScore = r.data.deductionScore;
+                vm.scoreDeductionPrice = r.data.scoreDeductionPrice;
+                vm.scoreLimit = r.data.scoreLimit;
+                vm.beforeScore = r.data.beforeScore;
+                vm.afterScore = r.data.afterScore;
                 console.log("计算后数据===>" + JSON.stringify(calGoodsList));
                 console.log("计算后数据===>" + JSON.stringify(calGoodsList));
                 console.log("替换后数据===>" + JSON.stringify(vm.goodsList));
                 console.log("替换后数据===>" + JSON.stringify(vm.goodsList));
 
 

+ 12 - 8
kmall-admin/src/test/java/com/kmall/admin/Test.java

@@ -1,9 +1,13 @@
 package com.kmall.admin;
 package com.kmall.admin;
 
 
+import com.fasterxml.jackson.core.type.TypeReference;
 import com.kmall.admin.entity.GoodsEntity;
 import com.kmall.admin.entity.GoodsEntity;
+import com.kmall.admin.haikong.dto.MemberInfoDTO;
 import com.kmall.admin.haikong.utils.ListUtils;
 import com.kmall.admin.haikong.utils.ListUtils;
-import com.kmall.admin.haikong.vo.QueryGoodsVo;
+import com.kmall.admin.haikong.utils.Response;
+import com.kmall.admin.haikong.vo.QueryGoodsVO;
 import com.kmall.admin.service.GoodsService;
 import com.kmall.admin.service.GoodsService;
+import com.kmall.admin.utils.jackson.JacksonUtil;
 import org.junit.runner.RunWith;
 import org.junit.runner.RunWith;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -36,20 +40,20 @@ public class Test {
     public void testQueryGoodsStockByQueryGoodsVoList() {
     public void testQueryGoodsStockByQueryGoodsVoList() {
         ListUtils listUtils = BeanUtils.instantiate(ListUtils.class);
         ListUtils listUtils = BeanUtils.instantiate(ListUtils.class);
 
 
-        List<QueryGoodsVo> list = new ArrayList<>();
+        List<QueryGoodsVO> list = new ArrayList<>();
 
 
-        QueryGoodsVo queryGoodsVo = new QueryGoodsVo();
+        QueryGoodsVO queryGoodsVo = new QueryGoodsVO();
         queryGoodsVo.setStoreId(171);
         queryGoodsVo.setStoreId(171);
         queryGoodsVo.setSku("ISZWCW50466");
         queryGoodsVo.setSku("ISZWCW50466");
         queryGoodsVo.setProdBarcode("9421033250865");
         queryGoodsVo.setProdBarcode("9421033250865");
 
 
-        QueryGoodsVo queryGoodsVo1 = new QueryGoodsVo();
-        queryGoodsVo1.setStoreId(163);
-        queryGoodsVo1.setSku("ISZWCW50466");
-        queryGoodsVo1.setProdBarcode("9421033250865");
+        QueryGoodsVO queryGoodsVO1 = new QueryGoodsVO();
+        queryGoodsVO1.setStoreId(163);
+        queryGoodsVO1.setSku("ISZWCW50466");
+        queryGoodsVO1.setProdBarcode("9421033250865");
 
 
         list.add(queryGoodsVo);
         list.add(queryGoodsVo);
-        list.add(queryGoodsVo1);
+        list.add(queryGoodsVO1);
 
 
         List<GoodsEntity> goodsEntityList = goodsService.queryGoodsStockByQueryGoodsVoList(list);
         List<GoodsEntity> goodsEntityList = goodsService.queryGoodsStockByQueryGoodsVoList(list);