Ver código fonte

Merge branch 'master' of http://git.ds-bay.com/project/kmall-pt-general

csk 4 anos atrás
pai
commit
1220961c38
100 arquivos alterados com 7819 adições e 213 exclusões
  1. 37 27
      kmall-admin/src/main/java/com/kmall/admin/Test.java
  2. 49 0
      kmall-admin/src/main/java/com/kmall/admin/config/EccsPropertiesConfig.java
  3. 115 3
      kmall-admin/src/main/java/com/kmall/admin/controller/BrandController.java
  4. 16 2
      kmall-admin/src/main/java/com/kmall/admin/controller/GoodsController.java
  5. 211 0
      kmall-admin/src/main/java/com/kmall/admin/controller/GoodsProductController.java
  6. 33 1
      kmall-admin/src/main/java/com/kmall/admin/controller/OrderController.java
  7. 1 1
      kmall-admin/src/main/java/com/kmall/admin/controller/UserController.java
  8. 107 0
      kmall-admin/src/main/java/com/kmall/admin/controller/compared/ImportPayOrderRecordController.java
  9. 107 0
      kmall-admin/src/main/java/com/kmall/admin/controller/compared/ImportTaxOrderRecordController.java
  10. 29 3
      kmall-admin/src/main/java/com/kmall/admin/controller/compared/OrderComparedErrorController.java
  11. 40 4
      kmall-admin/src/main/java/com/kmall/admin/controller/compared/PayOrderInfoController.java
  12. 142 0
      kmall-admin/src/main/java/com/kmall/admin/controller/compared/TaxComparedErrorController.java
  13. 152 0
      kmall-admin/src/main/java/com/kmall/admin/controller/compared/TaxInfoController.java
  14. 42 0
      kmall-admin/src/main/java/com/kmall/admin/controller/fromccnet/ToBeRestoredInvetoryController.java
  15. 156 0
      kmall-admin/src/main/java/com/kmall/admin/controller/kmall2eccs/KtoEccsController.java
  16. 102 0
      kmall-admin/src/main/java/com/kmall/admin/controller/shop/PriceModificationRecordController.java
  17. 117 0
      kmall-admin/src/main/java/com/kmall/admin/controller/shop/ShopErrorPriceRecordController.java
  18. 3 0
      kmall-admin/src/main/java/com/kmall/admin/dao/BrandDao.java
  19. 9 0
      kmall-admin/src/main/java/com/kmall/admin/dao/GoodsDao.java
  20. 23 0
      kmall-admin/src/main/java/com/kmall/admin/dao/GoodsProductDao.java
  21. 4 0
      kmall-admin/src/main/java/com/kmall/admin/dao/GoodsSpecificationDao.java
  22. 9 0
      kmall-admin/src/main/java/com/kmall/admin/dao/MkActivitiesPromotionDao.java
  23. 9 0
      kmall-admin/src/main/java/com/kmall/admin/dao/MkDailyActivitiesDao.java
  24. 2 0
      kmall-admin/src/main/java/com/kmall/admin/dao/OrderDao.java
  25. 2 2
      kmall-admin/src/main/java/com/kmall/admin/dao/OrderGoodsDao.java
  26. 9 0
      kmall-admin/src/main/java/com/kmall/admin/dao/ProductDao.java
  27. 4 0
      kmall-admin/src/main/java/com/kmall/admin/dao/ProductStoreRelaDao.java
  28. 16 0
      kmall-admin/src/main/java/com/kmall/admin/dao/compared/ImportPayOrderRecordDao.java
  29. 16 0
      kmall-admin/src/main/java/com/kmall/admin/dao/compared/ImportTaxOrderRecordDao.java
  30. 3 1
      kmall-admin/src/main/java/com/kmall/admin/dao/compared/PayOrderInfoDao.java
  31. 16 0
      kmall-admin/src/main/java/com/kmall/admin/dao/compared/TaxComparedErrorDao.java
  32. 21 0
      kmall-admin/src/main/java/com/kmall/admin/dao/compared/TaxInfoDao.java
  33. 28 0
      kmall-admin/src/main/java/com/kmall/admin/dao/kmall2eccs/KtoEccsDao.java
  34. 2 0
      kmall-admin/src/main/java/com/kmall/admin/dao/mk/MkActivitiesDao.java
  35. 16 0
      kmall-admin/src/main/java/com/kmall/admin/dao/shop/PriceModificationRecordDao.java
  36. 16 0
      kmall-admin/src/main/java/com/kmall/admin/dao/shop/ShopErrorPriceRecordDao.java
  37. 10 0
      kmall-admin/src/main/java/com/kmall/admin/dto/GoodsDetailsDto.java
  38. 556 0
      kmall-admin/src/main/java/com/kmall/admin/dto/GoodsProductDto.java
  39. 30 0
      kmall-admin/src/main/java/com/kmall/admin/dto/OrderGoodsDto.java
  40. 18 0
      kmall-admin/src/main/java/com/kmall/admin/dto/PdProductDtoInfo.java
  41. 30 0
      kmall-admin/src/main/java/com/kmall/admin/dto/QueryOrderDto.java
  42. 43 0
      kmall-admin/src/main/java/com/kmall/admin/dto/TaxOrderDto.java
  43. 37 0
      kmall-admin/src/main/java/com/kmall/admin/dto/UpdateGoodPriceDto.java
  44. 13 0
      kmall-admin/src/main/java/com/kmall/admin/entity/BrandEntity.java
  45. 12 0
      kmall-admin/src/main/java/com/kmall/admin/entity/GoodsEntity.java
  46. 727 0
      kmall-admin/src/main/java/com/kmall/admin/entity/GoodsProductEntity.java
  47. 11 0
      kmall-admin/src/main/java/com/kmall/admin/entity/OrderRefundEntity.java
  48. 12 1
      kmall-admin/src/main/java/com/kmall/admin/entity/ProductStoreRelaEntity.java
  49. 154 0
      kmall-admin/src/main/java/com/kmall/admin/entity/compared/ImportPayOrderRecordEntity.java
  50. 154 0
      kmall-admin/src/main/java/com/kmall/admin/entity/compared/ImportTaxOrderRecordEntity.java
  51. 104 0
      kmall-admin/src/main/java/com/kmall/admin/entity/compared/TaxComparedErrorEntity.java
  52. 155 0
      kmall-admin/src/main/java/com/kmall/admin/entity/compared/TaxInfoEntity.java
  53. 188 0
      kmall-admin/src/main/java/com/kmall/admin/entity/kmall2eccs/KtoEccsEntity.java
  54. 239 0
      kmall-admin/src/main/java/com/kmall/admin/entity/shop/PriceModificationRecordEntity.java
  55. 336 0
      kmall-admin/src/main/java/com/kmall/admin/entity/shop/ShopErrorPriceRecordEntity.java
  56. 38 0
      kmall-admin/src/main/java/com/kmall/admin/properties/EccsProperties.java
  57. 4 0
      kmall-admin/src/main/java/com/kmall/admin/service/BrandService.java
  58. 81 0
      kmall-admin/src/main/java/com/kmall/admin/service/GoodsProductService.java
  59. 6 0
      kmall-admin/src/main/java/com/kmall/admin/service/GoodsService.java
  60. 18 0
      kmall-admin/src/main/java/com/kmall/admin/service/MkActivitiesPromotionService.java
  61. 18 0
      kmall-admin/src/main/java/com/kmall/admin/service/MkDailyActivitiesService.java
  62. 17 9
      kmall-admin/src/main/java/com/kmall/admin/service/OrderGoodsService.java
  63. 19 2
      kmall-admin/src/main/java/com/kmall/admin/service/OrderService.java
  64. 13 0
      kmall-admin/src/main/java/com/kmall/admin/service/ProductStoreRelaService.java
  65. 73 0
      kmall-admin/src/main/java/com/kmall/admin/service/compared/ImportPayOrderRecordService.java
  66. 73 0
      kmall-admin/src/main/java/com/kmall/admin/service/compared/ImportTaxOrderRecordService.java
  67. 2 1
      kmall-admin/src/main/java/com/kmall/admin/service/compared/OrderComparedErrorService.java
  68. 2 1
      kmall-admin/src/main/java/com/kmall/admin/service/compared/PayOrderInfoService.java
  69. 80 0
      kmall-admin/src/main/java/com/kmall/admin/service/compared/TaxComparedErrorService.java
  70. 88 0
      kmall-admin/src/main/java/com/kmall/admin/service/compared/TaxInfoService.java
  71. 68 6
      kmall-admin/src/main/java/com/kmall/admin/service/impl/BrandServiceImpl.java
  72. 245 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsProductServiceImpl.java
  73. 336 12
      kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java
  74. 26 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/MkActivitiesPromotionServiceImpl.java
  75. 26 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/MkDailyActivitiesServiceImpl.java
  76. 20 8
      kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderGoodsServiceImpl.java
  77. 7 2
      kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderRefundServiceImpl.java
  78. 405 62
      kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java
  79. 71 16
      kmall-admin/src/main/java/com/kmall/admin/service/impl/ProductStoreRelaServiceImpl.java
  80. 59 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/compared/ImportPayOrderRecordServiceImpl.java
  81. 59 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/compared/ImportTaxOrderRecordServiceImpl.java
  82. 80 24
      kmall-admin/src/main/java/com/kmall/admin/service/impl/compared/OrderComparedErrorServiceImpl.java
  83. 3 2
      kmall-admin/src/main/java/com/kmall/admin/service/impl/compared/PayOrderInfoServiceImpl.java
  84. 166 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/compared/TaxComparedErrorServiceImpl.java
  85. 120 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/compared/TaxInfoServiceImpl.java
  86. 267 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/kmall2eccs/KtoEccsServiceImpl.java
  87. 5 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/mk/MkActivitiesServiceImpl.java
  88. 59 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/shop/PriceModificationRecordServiceImpl.java
  89. 177 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/shop/ShopErrorPriceRecordServiceImpl.java
  90. 82 0
      kmall-admin/src/main/java/com/kmall/admin/service/kmall2eccs/KtoEccsService.java
  91. 2 0
      kmall-admin/src/main/java/com/kmall/admin/service/mk/MkActivitiesService.java
  92. 73 0
      kmall-admin/src/main/java/com/kmall/admin/service/shop/PriceModificationRecordService.java
  93. 86 0
      kmall-admin/src/main/java/com/kmall/admin/service/shop/ShopErrorPriceRecordService.java
  94. 51 0
      kmall-admin/src/main/java/com/kmall/admin/task/SendToEccsTask.java
  95. 50 14
      kmall-admin/src/main/java/com/kmall/admin/utils/CalculateTax.java
  96. 128 0
      kmall-admin/src/main/java/com/kmall/admin/utils/OkHttpUtils.java
  97. 1 0
      kmall-admin/src/main/java/com/kmall/admin/utils/oms/OmsSign.java
  98. 56 0
      kmall-admin/src/main/java/com/kmall/admin/utils/sign/OutRequestMessage.java
  99. 43 9
      kmall-admin/src/main/java/com/kmall/admin/websocket/WebSocketServer.java
  100. 23 0
      kmall-admin/src/main/resources/XmlTemplate/BrandDtoList.xml

+ 37 - 27
kmall-admin/src/main/java/com/kmall/admin/Test.java

@@ -15,14 +15,17 @@ package com.kmall.admin;
 import cn.hutool.http.HttpRequest;
 import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSON;
+import com.google.gson.Gson;
+import com.kmall.admin.dto.GoodsProductDto;
+import com.kmall.admin.dto.PdProductDtoInfo;
 import com.kmall.admin.entity.GoodsEntity;
 import com.kmall.admin.utils.CalculateTax;
+import com.kmall.admin.utils.data.response.ResponseMessage;
+import com.kmall.admin.utils.oms.OmsSign;
+import okhttp3.Request;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 名称:Test <br>
@@ -34,33 +37,40 @@ import java.util.Map;
  */
 public class Test {
     public static void main(String[] args) {
-//        String result = HttpUtil.get("https://oms.ds-bay.com/oms-controller-mgt/pdProductRecord/hsCodeMapBySkuList?skuList=ISZWCW48781");
-//        Map<String,Map> map = JSON.parseObject(result, Map.class);
-//        System.out.println(map);
-//        Map skuMap =  map.get("ISZWCW48781");
-//        System.out.println(skuMap);
-//        String cusGoodsName = (String) skuMap.get("cusGoodsName");
-//        System.out.println(cusGoodsName);
-//        String valueAddedTaxRate = (String) skuMap.get("valueAddedTaxRate");
-//        System.out.println(valueAddedTaxRate);
+        Map<String, String> sParaTemp = new TreeMap<String, String>();
+        List<GoodsProductDto> goodsProductDtoList = new ArrayList<>();
+        GoodsProductDto dto = new GoodsProductDto();
+        dto.setMerchSn("mhbs990053989883052032");
+        goodsProductDtoList.add(dto);
+        PdProductDtoInfo pdProductDtoInfo = new PdProductDtoInfo();
+        pdProductDtoInfo.setPdProductDtoList(goodsProductDtoList);
+        sParaTemp.put("data", JSON.toJSONString(pdProductDtoInfo));
+        sParaTemp.put("merchId","mhbs990053989883052032");
+        String timestamp = String.valueOf(System.currentTimeMillis()/1000);
+        sParaTemp.put("timestamp", timestamp);
+        //生成要请求给oms秘钥
+//        String sign = OmsSign.sign(sParaTemp,cus.getWaybill().get("secret-key"));
+        String sign = OmsSign.sign(sParaTemp,"IxyIvP0sJqlUZinx");
+        sParaTemp.put("sign", sign);
+        //构建Request
+        String  url = "http://127.0.0.1:8680/al/product/addPdProductList";
+        Request request = com.kmall.admin.utils.oms.OkHttpUtils.buildRequest(url, JSON.toJSONString(sParaTemp));
+        // 同步访问,返回结果字符串
+        String responseString = null;
+        try {
 
+            responseString = com.kmall.admin.utils.oms.OkHttpUtils.post(request);
 
-        // 消费税税率
-        final BigDecimal impConsumTaxRate = new BigDecimal("15");
-        // 增值税税率
-        final BigDecimal valueAddedTaxRate =new BigDecimal("13");
-        BigDecimal grandConsumerTax = new BigDecimal("214");
-        BigDecimal grandValueAddTax = new BigDecimal("0");
-        if (BigDecimal.ZERO.compareTo(grandValueAddTax)==0){
-            System.out.println(grandValueAddTax);
+        } catch (Exception e) {
+            e.printStackTrace();
         }
-        if (BigDecimal.ZERO.compareTo(grandConsumerTax)!=0) {
-            System.out.println(valueAddedTaxRate.add(impConsumTaxRate).
-                    divide(new BigDecimal(100).subtract(impConsumTaxRate), 10, BigDecimal.ROUND_HALF_UP)
-                    .multiply(new BigDecimal("0.7")).setScale(4, BigDecimal.ROUND_HALF_UP));
-        }else {
 
-            System.out.println(valueAddedTaxRate.multiply(new BigDecimal("0.7")).divide(new BigDecimal("100"), 4, BigDecimal.ROUND_HALF_UP));
+        //解析响应数据
+        Gson gson = new Gson();
+        ResponseMessage result = gson.fromJson(responseString, ResponseMessage.class);
+        if(result == null){
+            String info = "解析响应数据Result失败";
+            throw new RuntimeException(info);
         }
     }
 }

+ 49 - 0
kmall-admin/src/main/java/com/kmall/admin/config/EccsPropertiesConfig.java

@@ -0,0 +1,49 @@
+package com.kmall.admin.config;
+
+import com.kmall.admin.properties.EccsProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Configurable;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
+import org.springframework.core.env.Environment;
+import org.springframework.core.env.StandardEnvironment;
+
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2021-01-28 15:27
+ */
+
+@Configuration
+@PropertySource("classpath:conf/eccs.properties")
+public class EccsPropertiesConfig {
+
+//    @Value("${md5Salt}")
+    private String md5Salt;
+
+//    @Value("${requestUrl}")
+    private String requestUrl;
+
+    @Autowired
+    private Environment environment;
+
+
+
+
+    @Bean
+    public EccsProperties ecsProperties(){
+
+        String md5Salt = environment.getProperty("md5Salt");
+        String requestUrl = environment.getProperty("requestUrl");
+
+        EccsProperties eccsProperties = new EccsProperties();
+        eccsProperties.setMd5Salt(md5Salt);
+        eccsProperties.setRequestUrl(requestUrl);
+        return eccsProperties;
+
+    }
+
+}

+ 115 - 3
kmall-admin/src/main/java/com/kmall/admin/controller/BrandController.java

@@ -3,17 +3,27 @@ package com.kmall.admin.controller;
 import com.google.common.collect.ImmutableBiMap;
 import com.kmall.admin.dto.CopyBrandDto;
 import com.kmall.admin.dto.CopyCategoryDto;
+import com.kmall.admin.dto.StoreGoodsDto;
 import com.kmall.admin.entity.BrandEntity;
+import com.kmall.admin.entity.CategoryEntity;
+import com.kmall.admin.entity.ProductStoreRelaEntity;
 import com.kmall.admin.service.BrandService;
+import com.kmall.admin.service.CategoryService;
 import com.kmall.admin.utils.ParamUtils;
+import com.kmall.common.constant.Dict;
+import com.kmall.common.constant.JxlsXmlTemplateName;
 import com.kmall.common.utils.*;
+import com.kmall.common.utils.excel.ExcelExport;
+import com.kmall.common.utils.excel.ExcelUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.*;
 
 /**
  * Controller
@@ -28,6 +38,12 @@ public class BrandController {
     @Autowired
     private BrandService brandService;
 
+    @Autowired
+    private ExcelUtil excelUtil;
+
+    @Autowired
+    private CategoryService categoryService;
+
     /**
      * 查看列表
      */
@@ -80,6 +96,11 @@ public class BrandController {
         if (Objects.nonNull(brandEntity)){
             throw new RRException("该分类下已经有该品牌名称");
         }
+        // 查询该分类是一级还是二级分类
+        CategoryEntity categoryEntity = categoryService.queryObject(brand.getCategoryId());
+        // 获取节点等级
+        String level = categoryEntity.getLevel();
+        brand.setCategoryLevel(level);
         brandService.save(brand);
 
         return R.ok();
@@ -102,6 +123,11 @@ public class BrandController {
             throw new RRException(r.get("msg").toString());
         }
 
+        // 查询该分类是一级还是二级分类
+        CategoryEntity categoryEntity = categoryService.queryObject(brand.getCategoryId());
+        // 获取节点等级
+        String level = categoryEntity.getLevel();
+        brand.setCategoryLevel(level);
         brandService.update(brand);
 
         return R.ok();
@@ -140,4 +166,90 @@ public class BrandController {
         brandService.saveCopyCategory(copyBrandDto);
         return R.ok();
     }
+
+
+
+
+    /**
+     * 品牌导出
+     * @param params
+     * @param response
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "export")
+    public R export(@RequestParam Map<String, Object> params, HttpServletResponse response, HttpServletRequest request) {
+        // 根据条件查询出列表
+        List<BrandEntity> brandEntityList = brandService.queryExportList(params);
+
+        ExcelExport ee = new ExcelExport("品牌制造商信息");
+
+        String[] header = new String[]{"品牌id","所属商户","所属商户id","所属分类","所属分类id","品牌名称","描述","是否显示","是否新品牌"};
+
+
+        List<Map<String, Object>> list = new ArrayList<>();
+        if (brandEntityList!=null && brandEntityList.size()>0){
+            for (BrandEntity brandEntity : brandEntityList) {
+                LinkedHashMap<String, Object> map = new LinkedHashMap<>();
+                map.put("Id",brandEntity.getId());
+                map.put("MerchName",brandEntity.getMerchName());
+                map.put("MerchSn",brandEntity.getMerchSn());
+                map.put("CategoryName",brandEntity.getCategoryName());
+                map.put("CategoryId",brandEntity.getCategoryId());
+                map.put("BrandName",brandEntity.getName());
+                map.put("SimpleDesc",brandEntity.getSimpleDesc());
+                map.put("IsShow",brandEntity.getIsShow()==1?"是":"否");
+                map.put("IsNew",brandEntity.getIsNew()==1?"是":"否");
+                list.add(map);
+            }
+        }
+
+
+
+        ee.addSheetByMap("品牌制造商信息", list, header);
+        ee.export(response);
+
+        return R.ok();
+    }
+
+
+
+
+    /**
+     * 导入品牌
+     */
+    @RequestMapping("/upload")
+    @ResponseBody
+    public R upload(@RequestParam("file") MultipartFile file) {
+        List<BrandEntity> brandEntityList = new ArrayList<>();//信息
+        try {
+            BrandEntity brandEntity = new BrandEntity();
+            Map<String, Object> beans = new HashMap<String, Object>();
+            beans.put("BrandEntity", brandEntity);
+            beans.put("BrandEntityList", brandEntityList);
+            if (file.isEmpty()) {
+                return R.error("文件不能为空!");
+            }
+            excelUtil.readExcel(JxlsXmlTemplateName.BRAND_DTO_LIST, beans, file.getInputStream());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.error("导入失败!");
+        }
+        try {
+            brandService.uploadExcel(brandEntityList);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.error(e.getMessage());
+        }
+        //上传文件
+        return R.ok("导入成功!");
+    }
+
+
+
+
+
+
+
+
 }

+ 16 - 2
kmall-admin/src/main/java/com/kmall/admin/controller/GoodsController.java

@@ -722,9 +722,23 @@ public class GoodsController {
     }
 
 
+    /**
+     * 校验系统中的商品价格是否有问题
+     * @return
+     */
+    @RequestMapping("/checkGoodsPrice")
+    public R checkGoodsPrice(){
+        SysUserEntity user = ShiroUtils.getUserEntity();
+        // 先同步海关商品编码,再同步税率
+        try {
+            goodsService.checkGoodsPrice(user);
+        }catch (Exception e){
+            e.printStackTrace();
 
-
-
+            return R.error("校验失败,请联系管理员");
+        }
+        return R.ok("校验成功");
+    }
 
 
 

+ 211 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/GoodsProductController.java

@@ -0,0 +1,211 @@
+package com.kmall.admin.controller;
+
+import java.util.*;
+
+import com.google.common.collect.ImmutableBiMap;
+import com.kmall.admin.dto.GoodsDto;
+import com.kmall.admin.dto.GoodsProductDto;
+import com.kmall.admin.entity.GoodsProductEntity;
+import com.kmall.admin.service.GoodsProductService;
+import com.kmall.common.constant.Dict;
+import com.kmall.common.constant.JxlsXmlTemplateName;
+import com.kmall.common.utils.*;
+import com.kmall.common.utils.excel.ExcelUtil;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+
+/**
+ * 产品信息备案表Controller
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-28 16:26:42
+ */
+@Controller
+@RequestMapping("goodsproduct")
+public class GoodsProductController {
+    @Autowired
+    private GoodsProductService goodsProductService;
+
+    @Autowired
+    private ExcelUtil excelUtil;
+
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+    @RequiresPermissions("goodsproduct:list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+        //查询列表数据
+        Query query = new Query(params);
+
+        List<GoodsProductEntity> goodsProductList = goodsProductService.queryList(query);
+        int total = goodsProductService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(goodsProductList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{mallGoodsProductSn}")
+    @RequiresPermissions("goodsproduct:info")
+    @ResponseBody
+    public R info(@PathVariable("mallGoodsProductSn") Integer mallGoodsProductSn) {
+        GoodsProductEntity goodsProduct = goodsProductService.queryObject(mallGoodsProductSn);
+
+        return R.ok().put("goodsProduct", goodsProduct);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+    @RequiresPermissions("goodsproduct:save")
+    @ResponseBody
+    public R save(@RequestBody GoodsProductEntity goodsProduct) {
+        goodsProductService.save(goodsProduct);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+    @RequiresPermissions("goodsproduct:update")
+    @ResponseBody
+    public R update(@RequestBody GoodsProductEntity goodsProduct) {
+        goodsProductService.update(goodsProduct);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+    @RequiresPermissions("goodsproduct:delete")
+    @ResponseBody
+    public R delete(@RequestBody Integer[]mallGoodsProductSns) {
+        goodsProductService.deleteBatch(mallGoodsProductSns);
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+
+        List<GoodsProductEntity> list = goodsProductService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
+
+
+
+
+
+    /**
+     * 上传文件
+     */
+    @RequestMapping("/upload")
+    @ResponseBody
+    public R upload(@RequestParam("file") MultipartFile file) {
+        List<GoodsProductDto> goodsProductDtoList = new ArrayList<>();//商品信息
+        try {
+            Map<String, Object> beans = new HashMap<String, Object>();
+            beans.put("GoodsProductDtoList", goodsProductDtoList);
+            if (file.isEmpty()) {
+                return R.error("文件不能为空!");
+            }
+            excelUtil.readExcel(JxlsXmlTemplateName.GOODS_PRODUCT_DTO_LIST, beans, file.getInputStream());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.error("导入失败!");
+        }
+        if (Objects.nonNull(goodsProductDtoList) && goodsProductDtoList.size()>0){
+            for (GoodsProductDto goodsProductDto : goodsProductDtoList) {
+                Map<String, Object> valideDate = MapBeanUtil.fromObject(goodsProductDto);
+                ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
+                builder.put("merchSn", "商户编号");
+                builder.put("sku", "sku(商品料件号)");
+                builder.put("prodBarcode", "商品条形码");
+                builder.put("prodName", "品名");
+                builder.put("prodBrand", "品牌");
+                builder.put("unitCode", "计量单位");
+                builder.put("cusGoodsCode", "商品编码");
+                builder.put("cusDeclEle", "申报要素(海关规格型号)");
+                builder.put("oriCntCode", "原产国代码");
+                builder.put("ciqProdModel", "规格型号");
+                builder.put("ciqMainEle", "主要成分");
+                builder.put("declCurrencyCode", "申报币种代码");
+                builder.put("netWeight", "单个净重(g)");
+                builder.put("declPrice", "申报价格(RMB)");
+                builder.put("legalUnit1Qty", "第一法定单位数量");
+                builder.put("legalUnit2Qty", "第二法定单位数量");
+                R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
+                if (Integer.valueOf(r.get("code").toString()) != 0) {
+                    throw new RRException(r.get("msg").toString());
+                }
+            }
+        }
+        try {
+            goodsProductService.uploadExcel(goodsProductDtoList);
+        }catch(Exception e){
+            return R.error(e.getMessage());
+        }
+        //上传文件
+        return R.ok();
+    }
+
+
+
+
+
+
+    /**
+     * sendSelectProduct
+     */
+    @RequestMapping("/sendSelectProduct")
+    @ResponseBody
+    public R sendSelectProduct(@RequestBody Integer[]mallGoodsProductSns) {
+        String result = goodsProductService.sendSelectProduct(mallGoodsProductSns);
+        return R.ok(result);
+    }
+
+
+
+    /**
+     * sendAllProduct
+     */
+    @RequestMapping("/sendAllProduct")
+    @ResponseBody
+    public R sendAllProduct() {
+        String result = goodsProductService.sendAllProduct();
+        return R.ok(result);
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+}

+ 33 - 1
kmall-admin/src/main/java/com/kmall/admin/controller/OrderController.java

@@ -1,5 +1,7 @@
 package com.kmall.admin.controller;
 
+import com.alibaba.fastjson.JSON;
+import com.google.gson.Gson;
 import com.kmall.admin.dto.OrderExpressDto;
 import com.kmall.admin.dto.SystemFormatDto;
 import com.kmall.admin.entity.*;
@@ -8,6 +10,8 @@ import com.kmall.admin.service.*;
 import com.kmall.admin.utils.CalculateTax;
 import com.kmall.admin.utils.ParamUtils;
 import com.kmall.admin.utils.ShiroUtils;
+import com.kmall.admin.utils.data.response.ResponseMessage;
+import com.kmall.admin.utils.oms.OmsSign;
 import com.kmall.common.constant.Dict;
 import com.kmall.common.constant.JxlsXmlTemplateName;
 import com.kmall.common.utils.*;
@@ -26,6 +30,7 @@ import com.kmall.manager.manager.wechat.WechatGlobalUtil;
 import com.kmall.manager.manager.wechat.WechatUtil;
 import com.kmall.manager.manager.wechat.wxglobal.dto.WechatGlobalRefundApiResult;
 import net.sf.json.JSONObject;
+import okhttp3.Request;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -1038,13 +1043,15 @@ public class OrderController {
      */
     @RequestMapping("/orderRefund")
     public R orderRefund( @RequestBody Map param) {
+
+        SysUserEntity user = ShiroUtils.getUserEntity();
         Integer orderId = (Integer) param.get("orderId");
         OrderEntity orderInfo = orderService.queryObject(orderId.longValue());
 
         String sessionId = (String) param.get("sessionId");
 
         try {
-            return orderService.orderRefund(orderInfo,sessionId);
+            return orderService.orderRefund(orderInfo,sessionId,user);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -1289,6 +1296,31 @@ public class OrderController {
 
     }
 
+    @RequestMapping("/queryInveResponse/{orderSn}")
+    public R queryInveResponse(@PathVariable("orderSn")String orderSn){
+        try {
+
+            // 查询订单是否存在
+//            OrderEntity order = orderService.queryObjectByOrderSn(orderSn);
+//            if(order == null){
+//                return R.error("该订单不存在");
+//            }
+
+            List<String> resultMessage = orderService.queryInveResponse(orderSn);
+            if(resultMessage == null || resultMessage.size() == 0){
+                resultMessage.add("暂无回执");
+            }
+            return R.ok().put("resultMessage",resultMessage);
+
+
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.error("系统异常:"+e.getMessage());
+        }
+
+    }
+
 
 
 

+ 1 - 1
kmall-admin/src/main/java/com/kmall/admin/controller/UserController.java

@@ -87,7 +87,7 @@ public class UserController {
      * 删除
      */
     @RequestMapping("/delete")
-    @RequiresPermissions("user:delete")
+//    @RequiresPermissions("user:delete")
     public R delete(@RequestBody Integer[] ids) {
         userService.deleteBatch(ids);
 

+ 107 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/compared/ImportPayOrderRecordController.java

@@ -0,0 +1,107 @@
+package com.kmall.admin.controller.compared;
+
+import java.util.List;
+import java.util.Map;
+
+import com.kmall.admin.entity.compared.ImportPayOrderRecordEntity;
+import com.kmall.admin.service.compared.ImportPayOrderRecordService;
+import com.kmall.common.utils.PageUtils;
+import com.kmall.common.utils.Query;
+import com.kmall.common.utils.R;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * 导入支付单记录表Controller
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-12 16:26:45
+ */
+@Controller
+@RequestMapping("importpayorderrecord")
+public class ImportPayOrderRecordController {
+    @Autowired
+    private ImportPayOrderRecordService importPayOrderRecordService;
+
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+    @RequiresPermissions("importpayorderrecord:list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+        //查询列表数据
+        Query query = new Query(params);
+
+        List<ImportPayOrderRecordEntity> importPayOrderRecordList = importPayOrderRecordService.queryList(query);
+        int total = importPayOrderRecordService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(importPayOrderRecordList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{iporId}")
+    @RequiresPermissions("importpayorderrecord:info")
+    @ResponseBody
+    public R info(@PathVariable("iporId") Long iporId) {
+        ImportPayOrderRecordEntity importPayOrderRecord = importPayOrderRecordService.queryObject(iporId);
+
+        return R.ok().put("importPayOrderRecord", importPayOrderRecord);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+    @RequiresPermissions("importpayorderrecord:save")
+    @ResponseBody
+    public R save(@RequestBody ImportPayOrderRecordEntity importPayOrderRecord) {
+        importPayOrderRecordService.save(importPayOrderRecord);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+    @RequiresPermissions("importpayorderrecord:update")
+    @ResponseBody
+    public R update(@RequestBody ImportPayOrderRecordEntity importPayOrderRecord) {
+        importPayOrderRecordService.update(importPayOrderRecord);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+    @RequiresPermissions("importpayorderrecord:delete")
+    @ResponseBody
+    public R delete(@RequestBody Long[]iporIds) {
+        importPayOrderRecordService.deleteBatch(iporIds);
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+
+        List<ImportPayOrderRecordEntity> list = importPayOrderRecordService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
+}

+ 107 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/compared/ImportTaxOrderRecordController.java

@@ -0,0 +1,107 @@
+package com.kmall.admin.controller.compared;
+
+import java.util.List;
+import java.util.Map;
+
+import com.kmall.admin.entity.compared.ImportTaxOrderRecordEntity;
+import com.kmall.admin.service.compared.ImportTaxOrderRecordService;
+import com.kmall.common.utils.PageUtils;
+import com.kmall.common.utils.Query;
+import com.kmall.common.utils.R;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * 导入税单记录表Controller
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-12 16:26:45
+ */
+@Controller
+@RequestMapping("importtaxorderrecord")
+public class ImportTaxOrderRecordController {
+    @Autowired
+    private ImportTaxOrderRecordService importTaxOrderRecordService;
+
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+    @RequiresPermissions("importtaxorderrecord:list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+        //查询列表数据
+        Query query = new Query(params);
+
+        List<ImportTaxOrderRecordEntity> importTaxOrderRecordList = importTaxOrderRecordService.queryList(query);
+        int total = importTaxOrderRecordService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(importTaxOrderRecordList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{itorId}")
+    @RequiresPermissions("importtaxorderrecord:info")
+    @ResponseBody
+    public R info(@PathVariable("itorId") Long itorId) {
+        ImportTaxOrderRecordEntity importTaxOrderRecord = importTaxOrderRecordService.queryObject(itorId);
+
+        return R.ok().put("importTaxOrderRecord", importTaxOrderRecord);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+    @RequiresPermissions("importtaxorderrecord:save")
+    @ResponseBody
+    public R save(@RequestBody ImportTaxOrderRecordEntity importTaxOrderRecord) {
+        importTaxOrderRecordService.save(importTaxOrderRecord);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+    @RequiresPermissions("importtaxorderrecord:update")
+    @ResponseBody
+    public R update(@RequestBody ImportTaxOrderRecordEntity importTaxOrderRecord) {
+        importTaxOrderRecordService.update(importTaxOrderRecord);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+    @RequiresPermissions("importtaxorderrecord:delete")
+    @ResponseBody
+    public R delete(@RequestBody Long[]itorIds) {
+        importTaxOrderRecordService.deleteBatch(itorIds);
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+
+        List<ImportTaxOrderRecordEntity> list = importTaxOrderRecordService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
+}

+ 29 - 3
kmall-admin/src/main/java/com/kmall/admin/controller/compared/OrderComparedErrorController.java

@@ -5,6 +5,8 @@ import java.util.Map;
 
 import com.kmall.admin.entity.compared.OrderComparedErrorEntity;
 import com.kmall.admin.service.compared.OrderComparedErrorService;
+import com.kmall.admin.utils.ParamUtils;
+import com.kmall.common.utils.DateUtils;
 import com.kmall.common.utils.PageUtils;
 import com.kmall.common.utils.Query;
 import com.kmall.common.utils.R;
@@ -24,6 +26,8 @@ import org.springframework.web.bind.annotation.*;
 @Controller
 @RequestMapping("ordercomparederror")
 public class OrderComparedErrorController {
+    private static String  ISO = "iso-8859-1";
+    private static String  UTF = "utf-8";
     @Autowired
     private OrderComparedErrorService orderComparedErrorService;
 
@@ -35,6 +39,18 @@ public class OrderComparedErrorController {
     @ResponseBody
     public R list(@RequestParam Map<String, Object> params) {
         //查询列表数据
+        params = ParamUtils.setTimeMap(params);
+        String createTime = (String) params.get("createTime");
+        if(org.apache.commons.lang.StringUtils.isNotEmpty(createTime)) {
+            try {
+                createTime = new String(createTime.getBytes(ISO), UTF);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            createTime = DateUtils.getDate(createTime);
+            params.put("createTime",createTime);
+        }
+        //查询列表数据
         Query query = new Query(params);
 
         List<OrderComparedErrorEntity> orderComparedErrorList = orderComparedErrorService.queryList(query);
@@ -106,12 +122,22 @@ public class OrderComparedErrorController {
     }
 
 
-    @RequestMapping("/comparedOrder")
+    @RequestMapping("/comparedOrder/{comparedDate}")
     @ResponseBody
-    public R comparedOrder() {
+    public R comparedOrder( @PathVariable("comparedDate") String comparedDate) {
+
+
+        if(org.apache.commons.lang.StringUtils.isNotEmpty(comparedDate)) {
+            try {
+                comparedDate = new String(comparedDate.getBytes(ISO), UTF);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            comparedDate = DateUtils.getDate(comparedDate);
+        }
 
         try {
-            String returnMsg = orderComparedErrorService.comparedOrder();
+            String returnMsg = orderComparedErrorService.comparedOrder(comparedDate);
             return R.ok().put("msg",returnMsg);
         } catch (Exception e) {
             e.printStackTrace();

+ 40 - 4
kmall-admin/src/main/java/com/kmall/admin/controller/compared/PayOrderInfoController.java

@@ -1,14 +1,15 @@
 package com.kmall.admin.controller.compared;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 import com.kmall.admin.dto.GoodsDto;
 import com.kmall.admin.dto.PayOrderDto;
+import com.kmall.admin.entity.compared.ImportPayOrderRecordEntity;
 import com.kmall.admin.entity.compared.PayOrderInfoEntity;
+import com.kmall.admin.fromcomm.entity.SysUserEntity;
+import com.kmall.admin.service.compared.ImportPayOrderRecordService;
 import com.kmall.admin.service.compared.PayOrderInfoService;
+import com.kmall.admin.utils.ShiroUtils;
 import com.kmall.common.constant.Dict;
 import com.kmall.common.constant.JxlsXmlTemplateName;
 import com.kmall.common.utils.PageUtils;
@@ -36,6 +37,8 @@ public class PayOrderInfoController {
     private PayOrderInfoService payOrderInfoService;
     @Autowired
     private ExcelUtil excelUtil;
+    @Autowired
+    private ImportPayOrderRecordService importPayOrderRecordService;
     /**
      * 查看列表
      */
@@ -132,11 +135,35 @@ public class PayOrderInfoController {
             e.printStackTrace();
             return R.error("导入失败!");
         }
+        if(payOrderDtoList == null || payOrderDtoList.size() == 0){
+            return R.error("报表格式有误");
+        }
+
+        try {
+            saveRecord(file);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
         payOrderInfoService.uploadExcel(payOrderDtoList,Dict.payFlag.item_alipay.getItem());
         //上传文件
         return R.ok();
     }
 
+    private void saveRecord(MultipartFile file) {
+        SysUserEntity user = ShiroUtils.getUserEntity();
+        ImportPayOrderRecordEntity importPayOrderRecordEntity = new ImportPayOrderRecordEntity();
+
+        importPayOrderRecordEntity.setImporter(user.getUserId()+"");
+        importPayOrderRecordEntity.setImportTime(new Date());
+        importPayOrderRecordEntity.setCreaterSn(user.getUserId()+"");
+        importPayOrderRecordEntity.setCreateTime(new Date());
+        importPayOrderRecordEntity.setImportFileName(file.getOriginalFilename());
+
+        importPayOrderRecordService.save(importPayOrderRecordEntity);
+
+    }
+
     @RequestMapping("/uploadWXOrder")
     @ResponseBody
     public R uploadWXOrder(@RequestParam("file") MultipartFile file) {
@@ -152,6 +179,15 @@ public class PayOrderInfoController {
             e.printStackTrace();
             return R.error("导入失败!");
         }
+        if(payOrderDtoList == null || payOrderDtoList.size() == 0){
+            return R.error("报表格式有误");
+        }
+
+        try {
+            saveRecord(file);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
         payOrderInfoService.uploadExcel(payOrderDtoList,Dict.payFlag.item_weixin.getItem());
         //上传文件
         return R.ok();

+ 142 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/compared/TaxComparedErrorController.java

@@ -0,0 +1,142 @@
+package com.kmall.admin.controller.compared;
+
+import java.util.List;
+import java.util.Map;
+
+import com.kmall.admin.entity.compared.TaxComparedErrorEntity;
+import com.kmall.admin.service.compared.TaxComparedErrorService;
+import com.kmall.admin.utils.ParamUtils;
+import com.kmall.common.utils.DateUtils;
+import com.kmall.common.utils.PageUtils;
+import com.kmall.common.utils.Query;
+import com.kmall.common.utils.R;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * Controller
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-12-29 14:11:24
+ */
+@Controller
+@RequestMapping("taxcomparederror")
+public class TaxComparedErrorController {
+    @Autowired
+    private TaxComparedErrorService taxComparedErrorService;
+
+    private static String  ISO = "iso-8859-1";
+    private static String  UTF = "utf-8";
+
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+        //查询列表数据
+        params = ParamUtils.setTimeMap(params);
+        String createTime = (String) params.get("createTime");
+        if(org.apache.commons.lang.StringUtils.isNotEmpty(createTime)) {
+            try {
+                createTime = new String(createTime.getBytes(ISO), UTF);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            createTime = DateUtils.getDate(createTime);
+            params.put("createTime",createTime);
+        }
+        Query query = new Query(params);
+        List<TaxComparedErrorEntity> taxComparedErrorList = taxComparedErrorService.queryList(query);
+        int total = taxComparedErrorService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(taxComparedErrorList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{mtceId}")
+    @ResponseBody
+    public R info(@PathVariable("mtceId") Integer mtceId) {
+        TaxComparedErrorEntity taxComparedError = taxComparedErrorService.queryObject(mtceId);
+
+        return R.ok().put("taxComparedError", taxComparedError);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+    @ResponseBody
+    public R save(@RequestBody TaxComparedErrorEntity taxComparedError) {
+        taxComparedErrorService.save(taxComparedError);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+    @ResponseBody
+    public R update(@RequestBody TaxComparedErrorEntity taxComparedError) {
+        taxComparedErrorService.update(taxComparedError);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+    @ResponseBody
+    public R delete(@RequestBody Integer[]mtceIds) {
+        taxComparedErrorService.deleteBatch(mtceIds);
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+
+        List<TaxComparedErrorEntity> list = taxComparedErrorService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
+
+    @RequestMapping("/comparedTaxOrder/{comparedDate}")
+    @ResponseBody
+    public R comparedTaxOrder(@PathVariable("comparedDate") String comparedDate) {
+
+        if(org.apache.commons.lang.StringUtils.isNotEmpty(comparedDate)) {
+            try {
+                comparedDate = new String(comparedDate.getBytes(ISO), UTF);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            comparedDate = DateUtils.getDate(comparedDate);
+        }
+
+        try {
+            String returnMsg = taxComparedErrorService.comparedTaxOrder(comparedDate);
+            return R.ok().put("msg",returnMsg);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.error(e.getMessage());
+        }
+
+    }
+
+
+}

+ 152 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/compared/TaxInfoController.java

@@ -0,0 +1,152 @@
+package com.kmall.admin.controller.compared;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.kmall.admin.dto.PayOrderDto;
+import com.kmall.admin.dto.TaxOrderDto;
+import com.kmall.admin.entity.compared.TaxInfoEntity;
+import com.kmall.admin.service.compared.TaxInfoService;
+import com.kmall.common.constant.Dict;
+import com.kmall.common.constant.JxlsXmlTemplateName;
+import com.kmall.common.utils.PageUtils;
+import com.kmall.common.utils.Query;
+import com.kmall.common.utils.R;
+import com.kmall.common.utils.excel.ExcelUtil;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+
+/**
+ * Controller
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-12-29 14:11:24
+ */
+@Controller
+@RequestMapping("taxinfo")
+public class TaxInfoController {
+    @Autowired
+    private TaxInfoService taxInfoService;
+    @Autowired
+    private ExcelUtil excelUtil;
+
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+//        params.put("compared","0");
+        //查询列表数据
+        Query query = new Query(params);
+
+        List<TaxInfoEntity> taxInfoList = taxInfoService.queryList(query);
+        int total = taxInfoService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(taxInfoList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{mtiId}")
+    @ResponseBody
+    public R info(@PathVariable("mtiId") Integer mtiId) {
+        TaxInfoEntity taxInfo = taxInfoService.queryObject(mtiId);
+
+        return R.ok().put("taxInfo", taxInfo);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+    @ResponseBody
+    public R save(@RequestBody TaxInfoEntity taxInfo) {
+        taxInfoService.save(taxInfo);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+    @ResponseBody
+    public R update(@RequestBody TaxInfoEntity taxInfo) {
+        taxInfoService.update(taxInfo);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+    @ResponseBody
+    public R delete(@RequestBody Integer[]mtiIds) {
+        taxInfoService.deleteBatch(mtiIds);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/deleteAll")
+    @ResponseBody
+    public R deleteAll() {
+        taxInfoService.deleteAll();
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+
+        List<TaxInfoEntity> list = taxInfoService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
+
+
+    /**
+     * 上传文件
+     */
+    @RequestMapping("/uploadTax")
+    @ResponseBody
+    public R uploadTax(@RequestParam("file") MultipartFile file) {
+        List<TaxOrderDto> taxOrderDtoList = new ArrayList<>();// 支付订单信息
+        try {
+            Map<String, Object> beans = new HashMap<String, Object>();
+            beans.put("TaxOrderDtoList", taxOrderDtoList);
+            if (file.isEmpty()) {
+                return R.error("文件不能为空!");
+            }
+            excelUtil.readExcel(JxlsXmlTemplateName.TAX_ORDER_DTO_LIST, beans, file.getInputStream());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.error("导入失败!");
+        }
+        boolean flag = taxInfoService.uploadExcel(taxOrderDtoList);
+        if(!flag){
+            return R.error("导入失败,报表格式有误");
+        }
+        //上传文件
+        return R.ok();
+    }
+
+}

+ 42 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/fromccnet/ToBeRestoredInvetoryController.java

@@ -0,0 +1,42 @@
+package com.kmall.admin.controller.fromccnet;
+
+import com.kmall.admin.service.OrderService;
+import com.kmall.common.utils.R;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2021-01-15 11:48
+ */
+@RestController
+@RequestMapping("restored")
+public class ToBeRestoredInvetoryController {
+
+    @Autowired
+    private OrderService orderService;
+
+    private final Logger LOGGER = LoggerFactory.getLogger(ToBeRestoredInvetoryController.class);
+
+    @RequestMapping("/toBeRestored/{orderSn}")
+    public R toBeRestored(@PathVariable("orderSn") String orderSn) {
+
+        try {
+            LOGGER.info("开始恢复退单成功的库存,订单号为{}",orderSn);
+            orderService.toBeRestored(orderSn);
+            return R.ok("恢复成功");
+        } catch (Exception e) {
+            LOGGER.info("恢复库存异常,原因为{},订单号为{}",e.getMessage(),orderSn);
+            return R.error(e.getMessage());
+        }
+
+    }
+
+
+}

+ 156 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/kmall2eccs/KtoEccsController.java

@@ -0,0 +1,156 @@
+package com.kmall.admin.controller.kmall2eccs;
+
+import java.util.List;
+import java.util.Map;
+
+import com.kmall.admin.entity.GoodsEntity;
+import com.kmall.admin.entity.ProductStoreRelaEntity;
+import com.kmall.admin.entity.kmall2eccs.KtoEccsEntity;
+import com.kmall.admin.service.GoodsService;
+import com.kmall.admin.service.ProductStoreRelaService;
+import com.kmall.admin.service.kmall2eccs.KtoEccsService;
+import com.kmall.common.constant.Dict;
+import com.kmall.common.utils.PageUtils;
+import com.kmall.common.utils.Query;
+import com.kmall.common.utils.R;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * Controller
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-12 15:50:45
+ */
+@Controller
+@RequestMapping("ktoeccs")
+public class KtoEccsController {
+    @Autowired
+    private KtoEccsService ktoEccsService;
+
+    @Autowired
+    private GoodsService goodsService;
+    @Autowired
+    private ProductStoreRelaService productStoreRelaService;
+
+    private static final Logger logger = LoggerFactory.getLogger(KtoEccsController.class);
+
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+        //查询列表数据
+        Query query = new Query(params);
+
+        List<KtoEccsEntity> ktoEccsList = ktoEccsService.queryList(query);
+        int total = ktoEccsService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(ktoEccsList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{kteId}")
+    @ResponseBody
+    public R info(@PathVariable("kteId") Long kteId) {
+        KtoEccsEntity ktoEccs = ktoEccsService.queryObject(kteId);
+
+        return R.ok().put("ktoEccs", ktoEccs);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+    @ResponseBody
+    public R save(@RequestBody KtoEccsEntity ktoEccs) {
+        ktoEccsService.save(ktoEccs);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+    @ResponseBody
+    public R update(@RequestBody KtoEccsEntity ktoEccs) {
+        ktoEccsService.update(ktoEccs);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+    @ResponseBody
+    public R delete(@RequestBody Long[]kteIds) {
+        ktoEccsService.deleteBatch(kteIds);
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+
+        List<KtoEccsEntity> list = ktoEccsService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
+
+
+    /**
+     * 中网向中控发送请求
+     */
+    @RequestMapping("/sendToEccs")
+    @ResponseBody
+    public R sendToEccs(@RequestBody Map<String,String> param){
+        R r = ktoEccsService.sendToEccs(param, Dict.sendToEccsType.inter.getItem());
+        return r;
+    }
+
+    /**
+     * 同步kmall商品库存,只给中控使用
+     */
+    @RequestMapping("/queryAllGoodsInfo")
+    @ResponseBody
+    public List<GoodsEntity> queryAllGoodsInfo(){
+
+
+        List<GoodsEntity> goodsEntities = goodsService.queryAllList();
+
+        return  goodsEntities;
+    }
+
+    /**
+     * 同步kmall门店商品库存,只给中控使用
+     */
+    @RequestMapping("/queryAllStoreProductInfo")
+    @ResponseBody
+    public List<ProductStoreRelaEntity> queryAllStoreProductInfo(){
+
+
+        List<ProductStoreRelaEntity> productStoreRelaEntities = productStoreRelaService.queryAllList();
+
+        return  productStoreRelaEntities;
+    }
+
+
+
+}

+ 102 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/shop/PriceModificationRecordController.java

@@ -0,0 +1,102 @@
+package com.kmall.admin.controller.shop;
+
+import java.util.List;
+import java.util.Map;
+
+import com.kmall.admin.entity.shop.PriceModificationRecordEntity;
+import com.kmall.admin.service.shop.PriceModificationRecordService;
+import com.kmall.common.utils.PageUtils;
+import com.kmall.common.utils.Query;
+import com.kmall.common.utils.R;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * 价格修改记录表Controller
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-22 09:07:06
+ */
+@Controller
+@RequestMapping("pricemodificationrecord")
+public class PriceModificationRecordController {
+    @Autowired
+    private PriceModificationRecordService priceModificationRecordService;
+
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+        //查询列表数据
+        Query query = new Query(params);
+
+        List<PriceModificationRecordEntity> priceModificationRecordList = priceModificationRecordService.queryList(query);
+        int total = priceModificationRecordService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(priceModificationRecordList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{mpmrId}")
+    @ResponseBody
+    public R info(@PathVariable("mpmrId") Integer mpmrId) {
+        PriceModificationRecordEntity priceModificationRecord = priceModificationRecordService.queryObject(mpmrId);
+
+        return R.ok().put("priceModificationRecord", priceModificationRecord);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+    @ResponseBody
+    public R save(@RequestBody PriceModificationRecordEntity priceModificationRecord) {
+        priceModificationRecordService.save(priceModificationRecord);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+    @ResponseBody
+    public R update(@RequestBody PriceModificationRecordEntity priceModificationRecord) {
+        priceModificationRecordService.update(priceModificationRecord);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+    @ResponseBody
+    public R delete(@RequestBody Integer[]mpmrIds) {
+        priceModificationRecordService.deleteBatch(mpmrIds);
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+
+        List<PriceModificationRecordEntity> list = priceModificationRecordService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
+}

+ 117 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/shop/ShopErrorPriceRecordController.java

@@ -0,0 +1,117 @@
+package com.kmall.admin.controller.shop;
+
+import java.util.List;
+import java.util.Map;
+
+import com.kmall.admin.dto.UpdateGoodPriceDto;
+import com.kmall.admin.entity.shop.ShopErrorPriceRecordEntity;
+import com.kmall.admin.service.shop.ShopErrorPriceRecordService;
+import com.kmall.common.utils.PageUtils;
+import com.kmall.common.utils.Query;
+import com.kmall.common.utils.R;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * 门店价格异常记录表Controller
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-19 16:03:52
+ */
+@Controller
+@RequestMapping("shoperrorpricerecord")
+public class ShopErrorPriceRecordController {
+    @Autowired
+    private ShopErrorPriceRecordService shopErrorPriceRecordService;
+
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+        //查询列表数据
+        Query query = new Query(params);
+
+        List<ShopErrorPriceRecordEntity> shopErrorPriceRecordList = shopErrorPriceRecordService.queryList(query);
+        int total = shopErrorPriceRecordService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(shopErrorPriceRecordList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{mseprId}")
+    @ResponseBody
+    public R info(@PathVariable("mseprId") Integer mseprId) {
+        ShopErrorPriceRecordEntity shopErrorPriceRecord = shopErrorPriceRecordService.queryObject(mseprId);
+
+        return R.ok().put("shopErrorPriceRecord", shopErrorPriceRecord);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+    @ResponseBody
+    public R save(@RequestBody ShopErrorPriceRecordEntity shopErrorPriceRecord) {
+        shopErrorPriceRecordService.save(shopErrorPriceRecord);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+    @ResponseBody
+    public R update(@RequestBody ShopErrorPriceRecordEntity shopErrorPriceRecord) {
+        shopErrorPriceRecordService.update(shopErrorPriceRecord);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+    @ResponseBody
+    public R delete(@RequestBody Integer[]mseprIds) {
+        shopErrorPriceRecordService.deleteBatch(mseprIds);
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+
+        List<ShopErrorPriceRecordEntity> list = shopErrorPriceRecordService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
+
+    @RequestMapping("/updateGoodsPrice")
+    @ResponseBody
+    public R updateGoodsPrice(@RequestBody UpdateGoodPriceDto updateGoodPriceDto ){
+
+
+        try {
+            shopErrorPriceRecordService.updateGoodsPrice(updateGoodPriceDto);
+        } catch (Exception e) {
+            return R.error("系统异常,请联系管理员!"+e.getMessage());
+        }
+
+        return R.ok("操作成功");
+    }
+}

+ 3 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/BrandDao.java

@@ -5,6 +5,7 @@ import com.kmall.manager.dao.BaseDao;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * Dao
@@ -27,4 +28,6 @@ public interface BrandDao extends BaseDao<BrandEntity> {
     String queryBrandName(@Param("prodBarcode") String prodBarcode, @Param("storeId") String storeId);
 
     BrandEntity queryByCategoryIdAndBrandNameAndMerchSn(@Param("categoryId") Integer categoryId,@Param("name") String name,@Param("merchSn") String merchSn);
+
+    List<BrandEntity> queryExportList(Map<String, Object> params);
 }

+ 9 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/GoodsDao.java

@@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * Dao
@@ -75,4 +76,12 @@ public interface GoodsDao extends BaseDao<GoodsEntity> {
 
     GoodsEntity queryByBarcodeAndSku(@Param("prodBarcode") String prodBarcode, @Param("goodsSn") String goodsSn);
 
+    /**
+     * 查询所有特殊化妆品的商品
+     * @param hdCodeSet
+     * @return
+     */
+    List<GoodsEntity> querySpecialCosmetics(@Param("hdCodeSet") Set<String> hdCodeSet);
+
+    void updateBatch(List<GoodsEntity> updateGoodsList);
 }

+ 23 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/GoodsProductDao.java

@@ -0,0 +1,23 @@
+package com.kmall.admin.dao;
+
+
+import com.kmall.admin.entity.GoodsProductEntity;
+import com.kmall.manager.dao.BaseDao;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 产品信息备案表Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-28 16:26:42
+ */
+public interface GoodsProductDao extends BaseDao<GoodsProductEntity> {
+
+    GoodsProductEntity selectByParams(@Param("sku") String sku,@Param("merchSn") String merchSn,
+                                      @Param("thirdMerchSn") String thirdMerchSn);
+
+    List<GoodsProductEntity> selectByMallGoodsProductSns(@Param("mallGoodsProductSns") Integer[] mallGoodsProductSns);
+}

+ 4 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/GoodsSpecificationDao.java

@@ -3,6 +3,8 @@ package com.kmall.admin.dao;
 import com.kmall.admin.entity.GoodsSpecificationEntity;
 import com.kmall.manager.dao.BaseDao;
 
+import java.util.List;
+
 /**
  * 商品对应规格表值表Dao
  *
@@ -20,4 +22,6 @@ public interface GoodsSpecificationDao extends BaseDao<GoodsSpecificationEntity>
     int deleteByGoodsId(Long goodsId);
 
     GoodsSpecificationEntity queryByGoodsId(Long goodsId);
+
+    void updateBatch(List<GoodsSpecificationEntity> updateSpecificationList);
 }

+ 9 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/MkActivitiesPromotionDao.java

@@ -22,4 +22,13 @@ public interface MkActivitiesPromotionDao extends BaseDao<MkActivitiesPromotionE
      */
     MkActivitiesPromotionEntity queryByBarCode(@Param("mkaId") String mkaId,
                                                @Param("prodBarcode") String prodBarcode);
+
+    MkActivitiesPromotionEntity queryByDateAndBarcode(@Param("storeId") String storeId,
+                                                      @Param("currentTime") String currentTime,
+                                                      @Param("topic") String topic,
+                                                      @Param("prodBarcode") String prodBarcode);
+
+    void updatePriceBySku(@Param("updatePrice") String updatePrice,
+                          @Param("sku") String sku,
+                          @Param("mkaId") Long mkaId);
 }

+ 9 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/MkDailyActivitiesDao.java

@@ -22,4 +22,13 @@ public interface MkDailyActivitiesDao extends BaseDao<MkDailyActivitiesEntity> {
      */
     MkDailyActivitiesEntity queryByBarCode(@Param("mkaId") String mkaId,
                                            @Param("prodBarcode") String prodBarcode);
+
+    MkDailyActivitiesEntity queryByDateAndBarcode(@Param("storeId") String storeId,
+                                                  @Param("currentTime") String currentTime,
+                                                  @Param("topic") String topic,
+                                                  @Param("prodBarcode") String prodBarcode);
+
+    void updatePriceBySku(@Param("updatePrice") String updatePrice,
+                          @Param("sku") String sku,
+                          @Param("mkaId") Long mkaId);
 }

+ 2 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/OrderDao.java

@@ -170,4 +170,6 @@ public interface OrderDao extends BaseDao<OrderEntity> {
     List<TaxDetailDto> queryCurrentTaxDetailList(@Param("billDate") String billDate, @Param("storeId") String storeId);
 
     List<TaxDetailDto> queryRefundPreviousTaxDetailList(@Param("billDate") String billDate, @Param("storeId") String storeId);
+
+    List<OrderEntity> queryAll201Order(@Param("date") String date);
 }

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

@@ -1,12 +1,11 @@
 package com.kmall.admin.dao;
 
+import com.kmall.admin.dto.OrderGoodsDto;
 import com.kmall.admin.entity.OrderGoodsEntity;
 import com.kmall.api.entity.OrderGoodsVo;
-import com.kmall.api.entity.OrderVo;
 import com.kmall.manager.dao.BaseDao;
 import org.apache.ibatis.annotations.Param;
 
-import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -31,4 +30,5 @@ public interface OrderGoodsDao extends BaseDao<OrderGoodsEntity> {
 
     Integer queryHistoryPriceTotal(Map<String, Object> map);
 
+    List<OrderGoodsDto> queryYesterdayTax(@Param("date") String date);
 }

+ 9 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/ProductDao.java

@@ -1,9 +1,12 @@
 package com.kmall.admin.dao;
 
+import com.kmall.admin.entity.GoodsEntity;
 import com.kmall.admin.entity.ProductEntity;
 import org.apache.ibatis.annotations.Param;
 import com.kmall.manager.dao.BaseDao;
 
+import java.util.List;
+
 /**
  * Dao
  *
@@ -29,6 +32,12 @@ public interface ProductDao extends BaseDao<ProductEntity> {
      */
     ProductEntity queryObjectByGoodsIdAndStoreId(@Param("goodsId") String goodsId,@Param("storeId")String storeId);
 
+    /**
+     * 批量更新
+     * @param updateGoodsList
+     */
+    void updateBatch(List<ProductEntity> updateGoodsList);
+
 //    /**
 //     * 根据编码查询产品
 //     *

+ 4 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/ProductStoreRelaDao.java

@@ -83,4 +83,8 @@ public interface ProductStoreRelaDao extends BaseDao<ProductStoreRelaEntity> {
      * @return
      */
     List<ProductStoreRelaEntity> queryExportList(Map<String, Object> params);
+
+    void updatePriceBySku(@Param("updatePrice") String updatePrice, @Param("sku") String sku);
+
+    List<ProductStoreRelaEntity> queryAllList();
 }

+ 16 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/compared/ImportPayOrderRecordDao.java

@@ -0,0 +1,16 @@
+package com.kmall.admin.dao.compared;
+
+
+import com.kmall.admin.entity.compared.ImportPayOrderRecordEntity;
+import com.kmall.manager.dao.BaseDao;
+
+/**
+ * 导入支付单记录表Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-12 16:26:45
+ */
+public interface ImportPayOrderRecordDao extends BaseDao<ImportPayOrderRecordEntity> {
+
+}

+ 16 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/compared/ImportTaxOrderRecordDao.java

@@ -0,0 +1,16 @@
+package com.kmall.admin.dao.compared;
+
+
+import com.kmall.admin.entity.compared.ImportTaxOrderRecordEntity;
+import com.kmall.manager.dao.BaseDao;
+
+/**
+ * 导入税单记录表Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-12 16:26:45
+ */
+public interface ImportTaxOrderRecordDao extends BaseDao<ImportTaxOrderRecordEntity> {
+
+}

+ 3 - 1
kmall-admin/src/main/java/com/kmall/admin/dao/compared/PayOrderInfoDao.java

@@ -3,6 +3,7 @@ package com.kmall.admin.dao.compared;
 
 import com.kmall.admin.entity.compared.PayOrderInfoEntity;
 import com.kmall.manager.dao.BaseDao;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -18,8 +19,9 @@ public interface PayOrderInfoDao extends BaseDao<PayOrderInfoEntity> {
     /**
      *
      * @return
+     * @param comparedDate
      */
-    List<PayOrderInfoEntity> queryNoComparedOrder();
+    List<PayOrderInfoEntity> queryNoComparedOrder(@Param("comparedDate") String comparedDate);
 
     void updateBatch(List<PayOrderInfoEntity> payOrderInfoEntities);
 }

+ 16 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/compared/TaxComparedErrorDao.java

@@ -0,0 +1,16 @@
+package com.kmall.admin.dao.compared;
+
+
+import com.kmall.admin.entity.compared.TaxComparedErrorEntity;
+import com.kmall.manager.dao.BaseDao;
+
+/**
+ * Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-12-29 14:11:24
+ */
+public interface TaxComparedErrorDao extends BaseDao<TaxComparedErrorEntity> {
+
+}

+ 21 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/compared/TaxInfoDao.java

@@ -0,0 +1,21 @@
+package com.kmall.admin.dao.compared;
+
+
+import com.kmall.admin.entity.compared.TaxInfoEntity;
+import com.kmall.manager.dao.BaseDao;
+
+import java.util.List;
+
+/**
+ * Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-12-29 14:11:24
+ */
+public interface TaxInfoDao extends BaseDao<TaxInfoEntity> {
+
+    void updateBatch(List<TaxInfoEntity> taxInfoEntities);
+
+    void deleteAll();
+}

+ 28 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/kmall2eccs/KtoEccsDao.java

@@ -0,0 +1,28 @@
+package com.kmall.admin.dao.kmall2eccs;
+
+
+import com.kmall.admin.entity.kmall2eccs.KtoEccsEntity;
+import com.kmall.manager.dao.BaseDao;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-12 15:50:45
+ */
+public interface KtoEccsDao extends BaseDao<KtoEccsEntity> {
+
+    /**
+     *
+     * @return
+     * @param page
+     * @param pageSize
+     */
+    List<KtoEccsEntity> queryNotSendRecord(@Param("page") Integer page, @Param("pageSize") Integer pageSize);
+
+    void updateBatch(List<KtoEccsEntity> queryList);
+}

+ 2 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/mk/MkActivitiesDao.java

@@ -22,4 +22,6 @@ public interface MkActivitiesDao extends BaseDao<MkActivitiesEntity> {
      * @return
      */
     List<MkActivitiesEntity> queryByNow(@Param("storeId") String storeId, @Param("currentTime") String currentTime);
+
+    List<MkActivitiesEntity> queryByTopic(@Param("storeId") String storeId, @Param("currentTime")String currentTime, @Param("topic") String topic);
 }

+ 16 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/shop/PriceModificationRecordDao.java

@@ -0,0 +1,16 @@
+package com.kmall.admin.dao.shop;
+
+
+import com.kmall.admin.entity.shop.PriceModificationRecordEntity;
+import com.kmall.manager.dao.BaseDao;
+
+/**
+ * 价格修改记录表Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-22 09:07:06
+ */
+public interface PriceModificationRecordDao extends BaseDao<PriceModificationRecordEntity> {
+
+}

+ 16 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/shop/ShopErrorPriceRecordDao.java

@@ -0,0 +1,16 @@
+package com.kmall.admin.dao.shop;
+
+
+import com.kmall.admin.entity.shop.ShopErrorPriceRecordEntity;
+import com.kmall.manager.dao.BaseDao;
+
+/**
+ * 门店价格异常记录表Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-19 16:03:52
+ */
+public interface ShopErrorPriceRecordDao extends BaseDao<ShopErrorPriceRecordEntity> {
+
+}

+ 10 - 0
kmall-admin/src/main/java/com/kmall/admin/dto/GoodsDetailsDto.java

@@ -54,6 +54,16 @@ public class GoodsDetailsDto {
 
     private String ciqProdModel;
 
+    private String storeId;
+
+    public String getStoreId() {
+        return storeId;
+    }
+
+    public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+
     public String getStockNum() {
         return stockNum;
     }

+ 556 - 0
kmall-admin/src/main/java/com/kmall/admin/dto/GoodsProductDto.java

@@ -0,0 +1,556 @@
+package com.kmall.admin.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * @author Scott
+ * @email
+ * @date 2017-08-13 10:41:08
+ */
+public class GoodsProductDto implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private String merchSn;
+
+    private String mallGoodsProductSn;
+
+    private String prodBarcode;
+
+    private String sku;
+
+    private String cusCode;
+
+    private String cusGoodsCode;
+
+    private String prodName;
+
+    private String prodEname;
+
+    private String ciqProdModel;
+
+    private String prodTaxCode;
+
+    private String cusBizMode;
+
+    private String prodBrand;
+
+    private String oriCntCode;
+
+    private String unitCode;
+
+    private String declPrice;
+
+    private String declCurrencyCode;
+
+    private String supplierName;
+
+    private String supplierCntCode;
+
+    private String prodCompName;
+
+    private String prodCompCntCode;
+
+    private String ciqMainEle;
+
+    private String applyStandard;
+
+    private String tradeCountry;
+
+    private String ciqMonitorType;
+
+    private String outFoodCompCode;
+
+    private String compRisk;
+
+    private String isLaw;
+
+    private String isAuthen;
+
+    private String isGift;
+
+    private String remark;
+
+    private String cusDeclEle;
+
+    private String cusRecCode;
+
+    private String isCheck;
+
+    private String isValid;
+
+    private String createrSn;
+
+    private String createTime;
+
+    private String moderSn;
+
+    private String modTime;
+
+    private String tstm;
+
+    private String exField;
+
+    private String exField2;
+
+    private String exField3;
+
+    private String exField4;
+
+    private String exField5;
+
+    private String changeReason;
+
+    private String isAudit;
+
+    private String legalUnit1Qty;// 第一法定单位数量
+
+    private String legalUnit2Qty;// 第二法定单位数量
+
+    private String netWeight;// 净重
+
+    private String localEmsNo;// 园区账册编号
+
+    private String itemRecordNo;// 园内商品序号
+
+    private String grossWeight;// 毛重
+
+
+    private String emsClassCode;// 账册分类代码
+
+
+    private String thirdMerchSn;
+
+
+    public String getMerchSn() {
+        return merchSn;
+    }
+
+    public void setMerchSn(String merchSn) {
+        this.merchSn = merchSn;
+    }
+
+    public String getProdBarcode() {
+        return prodBarcode;
+    }
+
+    public void setProdBarcode(String prodBarcode) {
+        this.prodBarcode = prodBarcode;
+    }
+
+    public String getSku() {
+        return sku;
+    }
+
+    public void setSku(String sku) {
+        this.sku = sku;
+    }
+
+    public String getCusCode() {
+        return cusCode;
+    }
+
+    public void setCusCode(String cusCode) {
+        this.cusCode = cusCode;
+    }
+
+    public String getCusGoodsCode() {
+        return cusGoodsCode;
+    }
+
+    public void setCusGoodsCode(String cusGoodsCode) {
+        this.cusGoodsCode = cusGoodsCode;
+    }
+
+    public String getProdName() {
+        return prodName;
+    }
+
+    public void setProdName(String prodName) {
+        this.prodName = prodName;
+    }
+
+    public String getProdEname() {
+        return prodEname;
+    }
+
+    public void setProdEname(String prodEname) {
+        this.prodEname = prodEname;
+    }
+
+    public String getCiqProdModel() {
+        return ciqProdModel;
+    }
+
+    public void setCiqProdModel(String ciqProdModel) {
+        this.ciqProdModel = ciqProdModel;
+    }
+
+    public String getProdTaxCode() {
+        return prodTaxCode;
+    }
+
+    public void setProdTaxCode(String prodTaxCode) {
+        this.prodTaxCode = prodTaxCode;
+    }
+
+    public String getCusBizMode() {
+        return cusBizMode;
+    }
+
+    public void setCusBizMode(String cusBizMode) {
+        this.cusBizMode = cusBizMode;
+    }
+
+    public String getProdBrand() {
+        return prodBrand;
+    }
+
+    public void setProdBrand(String prodBrand) {
+        this.prodBrand = prodBrand;
+    }
+
+    public String getOriCntCode() {
+        return oriCntCode;
+    }
+
+    public void setOriCntCode(String oriCntCode) {
+        this.oriCntCode = oriCntCode;
+    }
+
+    public String getUnitCode() {
+        return unitCode;
+    }
+
+    public void setUnitCode(String unitCode) {
+        this.unitCode = unitCode;
+    }
+
+    public String getDeclPrice() {
+        return declPrice;
+    }
+
+    public void setDeclPrice(String declPrice) {
+        this.declPrice = declPrice;
+    }
+
+    public String getDeclCurrencyCode() {
+        return declCurrencyCode;
+    }
+
+    public void setDeclCurrencyCode(String declCurrencyCode) {
+        this.declCurrencyCode = declCurrencyCode;
+    }
+
+    public String getSupplierName() {
+        return supplierName;
+    }
+
+    public void setSupplierName(String supplierName) {
+        this.supplierName = supplierName;
+    }
+
+    public String getSupplierCntCode() {
+        return supplierCntCode;
+    }
+
+    public void setSupplierCntCode(String supplierCntCode) {
+        this.supplierCntCode = supplierCntCode;
+    }
+
+    public String getProdCompName() {
+        return prodCompName;
+    }
+
+    public void setProdCompName(String prodCompName) {
+        this.prodCompName = prodCompName;
+    }
+
+    public String getProdCompCntCode() {
+        return prodCompCntCode;
+    }
+
+    public void setProdCompCntCode(String prodCompCntCode) {
+        this.prodCompCntCode = prodCompCntCode;
+    }
+
+    public String getCiqMainEle() {
+        return ciqMainEle;
+    }
+
+    public void setCiqMainEle(String ciqMainEle) {
+        this.ciqMainEle = ciqMainEle;
+    }
+
+    public String getApplyStandard() {
+        return applyStandard;
+    }
+
+    public void setApplyStandard(String applyStandard) {
+        this.applyStandard = applyStandard;
+    }
+
+    public String getTradeCountry() {
+        return tradeCountry;
+    }
+
+    public void setTradeCountry(String tradeCountry) {
+        this.tradeCountry = tradeCountry;
+    }
+
+    public String getCiqMonitorType() {
+        return ciqMonitorType;
+    }
+
+    public void setCiqMonitorType(String ciqMonitorType) {
+        this.ciqMonitorType = ciqMonitorType;
+    }
+
+    public String getOutFoodCompCode() {
+        return outFoodCompCode;
+    }
+
+    public void setOutFoodCompCode(String outFoodCompCode) {
+        this.outFoodCompCode = outFoodCompCode;
+    }
+
+    public String getCompRisk() {
+        return compRisk;
+    }
+
+    public void setCompRisk(String compRisk) {
+        this.compRisk = compRisk;
+    }
+
+    public String getIsLaw() {
+        return isLaw;
+    }
+
+    public void setIsLaw(String isLaw) {
+        this.isLaw = isLaw;
+    }
+
+    public String getIsAuthen() {
+        return isAuthen;
+    }
+
+    public void setIsAuthen(String isAuthen) {
+        this.isAuthen = isAuthen;
+    }
+
+    public String getIsGift() {
+        return isGift;
+    }
+
+    public void setIsGift(String isGift) {
+        this.isGift = isGift;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public String getCusDeclEle() {
+        return cusDeclEle;
+    }
+
+    public void setCusDeclEle(String cusDeclEle) {
+        this.cusDeclEle = cusDeclEle;
+    }
+
+    public String getCusRecCode() {
+        return cusRecCode;
+    }
+
+    public void setCusRecCode(String cusRecCode) {
+        this.cusRecCode = cusRecCode;
+    }
+
+    public String getIsCheck() {
+        return isCheck;
+    }
+
+    public void setIsCheck(String isCheck) {
+        this.isCheck = isCheck;
+    }
+
+    public String getIsValid() {
+        return isValid;
+    }
+
+    public void setIsValid(String isValid) {
+        this.isValid = isValid;
+    }
+
+    public String getCreaterSn() {
+        return createrSn;
+    }
+
+    public void setCreaterSn(String createrSn) {
+        this.createrSn = createrSn;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getModerSn() {
+        return moderSn;
+    }
+
+    public void setModerSn(String moderSn) {
+        this.moderSn = moderSn;
+    }
+
+    public String getModTime() {
+        return modTime;
+    }
+
+    public void setModTime(String modTime) {
+        this.modTime = modTime;
+    }
+
+    public String getTstm() {
+        return tstm;
+    }
+
+    public void setTstm(String tstm) {
+        this.tstm = tstm;
+    }
+
+    public String getExField() {
+        return exField;
+    }
+
+    public void setExField(String exField) {
+        this.exField = exField;
+    }
+
+    public String getExField2() {
+        return exField2;
+    }
+
+    public void setExField2(String exField2) {
+        this.exField2 = exField2;
+    }
+
+    public String getExField3() {
+        return exField3;
+    }
+
+    public void setExField3(String exField3) {
+        this.exField3 = exField3;
+    }
+
+    public String getExField4() {
+        return exField4;
+    }
+
+    public void setExField4(String exField4) {
+        this.exField4 = exField4;
+    }
+
+    public String getExField5() {
+        return exField5;
+    }
+
+    public void setExField5(String exField5) {
+        this.exField5 = exField5;
+    }
+
+    public String getChangeReason() {
+        return changeReason;
+    }
+
+    public void setChangeReason(String changeReason) {
+        this.changeReason = changeReason;
+    }
+
+    public String getIsAudit() {
+        return isAudit;
+    }
+
+    public void setIsAudit(String isAudit) {
+        this.isAudit = isAudit;
+    }
+
+    public String getLegalUnit1Qty() {
+        return legalUnit1Qty;
+    }
+
+    public void setLegalUnit1Qty(String legalUnit1Qty) {
+        this.legalUnit1Qty = legalUnit1Qty;
+    }
+
+    public String getLegalUnit2Qty() {
+        return legalUnit2Qty;
+    }
+
+    public void setLegalUnit2Qty(String legalUnit2Qty) {
+        this.legalUnit2Qty = legalUnit2Qty;
+    }
+
+    public String getNetWeight() {
+        return netWeight;
+    }
+
+    public void setNetWeight(String netWeight) {
+        this.netWeight = netWeight;
+    }
+
+    public String getLocalEmsNo() {
+        return localEmsNo;
+    }
+
+    public void setLocalEmsNo(String localEmsNo) {
+        this.localEmsNo = localEmsNo;
+    }
+
+    public String getItemRecordNo() {
+        return itemRecordNo;
+    }
+
+    public void setItemRecordNo(String itemRecordNo) {
+        this.itemRecordNo = itemRecordNo;
+    }
+
+    public String getGrossWeight() {
+        return grossWeight;
+    }
+
+    public void setGrossWeight(String grossWeight) {
+        this.grossWeight = grossWeight;
+    }
+
+    public String getEmsClassCode() {
+        return emsClassCode;
+    }
+
+    public void setEmsClassCode(String emsClassCode) {
+        this.emsClassCode = emsClassCode;
+    }
+
+    public String getThirdMerchSn() {
+        return thirdMerchSn;
+    }
+
+    public void setThirdMerchSn(String thirdMerchSn) {
+        this.thirdMerchSn = thirdMerchSn;
+    }
+
+    public String getMallGoodsProductSn() {
+        return mallGoodsProductSn;
+    }
+
+    public void setMallGoodsProductSn(String mallGoodsProductSn) {
+        this.mallGoodsProductSn = mallGoodsProductSn;
+    }
+}

+ 30 - 0
kmall-admin/src/main/java/com/kmall/admin/dto/OrderGoodsDto.java

@@ -0,0 +1,30 @@
+package com.kmall.admin.dto;
+
+import java.io.Serializable;
+
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2020-12-29 15:16
+ */
+public class OrderGoodsDto implements Serializable {
+
+    private String orderSn;
+    private String tax;
+
+    public String getOrderSn() {
+        return orderSn;
+    }
+
+    public void setOrderSn(String orderSn) {
+        this.orderSn = orderSn;
+    }
+
+    public String getTax() {
+        return tax;
+    }
+
+    public void setTax(String tax) {
+        this.tax = tax;
+    }
+}

+ 18 - 0
kmall-admin/src/main/java/com/kmall/admin/dto/PdProductDtoInfo.java

@@ -0,0 +1,18 @@
+package com.kmall.admin.dto;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class PdProductDtoInfo implements Serializable {
+
+
+   List<GoodsProductDto> pdProductDtoList;
+
+    public List<GoodsProductDto> getPdProductDtoList() {
+        return pdProductDtoList;
+    }
+
+    public void setPdProductDtoList(List<GoodsProductDto> pdProductDtoList) {
+        this.pdProductDtoList = pdProductDtoList;
+    }
+}

+ 30 - 0
kmall-admin/src/main/java/com/kmall/admin/dto/QueryOrderDto.java

@@ -0,0 +1,30 @@
+package com.kmall.admin.dto;
+
+import java.io.Serializable;
+
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2021-01-12 14:01
+ */
+public class QueryOrderDto implements Serializable {
+
+    private String thirdSn ;
+    private String queryDate;
+
+    public String getThirdSn() {
+        return thirdSn;
+    }
+
+    public void setThirdSn(String thirdSn) {
+        this.thirdSn = thirdSn;
+    }
+
+    public String getQueryDate() {
+        return queryDate;
+    }
+
+    public void setQueryDate(String queryDate) {
+        this.queryDate = queryDate;
+    }
+}

+ 43 - 0
kmall-admin/src/main/java/com/kmall/admin/dto/TaxOrderDto.java

@@ -0,0 +1,43 @@
+package com.kmall.admin.dto;
+
+import java.io.Serializable;
+
+/**
+ * 实体
+ * 表名 mall_pay_order_info
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-11-26 10:16:58
+ */
+public class TaxOrderDto implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private String orderSn;
+    private String preTaxPrice;
+    private String tax;
+
+    public String getOrderSn() {
+        return orderSn;
+    }
+
+    public void setOrderSn(String orderSn) {
+        this.orderSn = orderSn;
+    }
+
+    public String getPreTaxPrice() {
+        return preTaxPrice;
+    }
+
+    public void setPreTaxPrice(String preTaxPrice) {
+        this.preTaxPrice = preTaxPrice;
+    }
+
+    public String getTax() {
+        return tax;
+    }
+
+    public void setTax(String tax) {
+        this.tax = tax;
+    }
+}

+ 37 - 0
kmall-admin/src/main/java/com/kmall/admin/dto/UpdateGoodPriceDto.java

@@ -0,0 +1,37 @@
+package com.kmall.admin.dto;
+
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2021-01-21 15:37
+ */
+public class UpdateGoodPriceDto {
+
+    private String mseprId;
+    private String type;
+    private String customPriceInput;
+
+    public String getMseprId() {
+        return mseprId;
+    }
+
+    public void setMseprId(String mseprId) {
+        this.mseprId = mseprId;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getCustomPriceInput() {
+        return customPriceInput;
+    }
+
+    public void setCustomPriceInput(String customPriceInput) {
+        this.customPriceInput = customPriceInput;
+    }
+}

+ 13 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/BrandEntity.java

@@ -48,6 +48,7 @@ public class BrandEntity implements Serializable {
     private String merchName;
     private Integer categoryId;
     private String categoryName;
+    private String categoryLevel;
 
     public String getCategoryName() {
         return categoryName;
@@ -264,4 +265,16 @@ public class BrandEntity implements Serializable {
     public Integer getNewSortOrder() {
         return newSortOrder;
     }
+
+    /**
+     * 分类等级
+     * @return
+     */
+    public String getCategoryLevel() {
+        return categoryLevel;
+    }
+
+    public void setCategoryLevel(String categoryLevel) {
+        this.categoryLevel = categoryLevel;
+    }
 }

+ 12 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/GoodsEntity.java

@@ -247,6 +247,10 @@ public class GoodsEntity implements Serializable {
 
     private BigDecimal legalUnit2Qty;
 
+
+    private Integer toBeRestored;
+
+
     public BigDecimal getCosmThresholdValue() {
         return cosmThresholdValue;
     }
@@ -1212,4 +1216,12 @@ public class GoodsEntity implements Serializable {
     public void setActivity(String activity) {
         this.activity = activity;
     }
+
+    public Integer getToBeRestored() {
+        return toBeRestored;
+    }
+
+    public void setToBeRestored(Integer toBeRestored) {
+        this.toBeRestored = toBeRestored;
+    }
 }

+ 727 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/GoodsProductEntity.java

@@ -0,0 +1,727 @@
+package com.kmall.admin.entity;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 产品信息备案表实体
+ * 表名 mall_goods_product
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-28 16:26:42
+ */
+public class GoodsProductEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 产品信息备案编号
+     */
+    private Integer mallGoodsProductSn;
+    /**
+     * 商户编号
+     */
+    private String merchSn;
+    /**
+     * 第三方商户编号
+     */
+    private String thirdMerchSn;
+    /**
+     * 产品条码
+     */
+    private String prodBarcode;
+    /**
+     * sku
+     */
+    private String sku;
+    /**
+     * 海关商品编码
+     */
+    private String cusGoodsCode;
+    /**
+     * 中文名称
+     */
+    private String prodName;
+    /**
+     * 国检规格型号
+     */
+    private String ciqProdModel;
+    /**
+     * 品牌
+     */
+    private String prodBrand;
+    /**
+     * 原产国代码,海关编码
+     */
+    private String oriCntCode;
+    /**
+     * 计量单位代码,参见海关编码
+     */
+    private String unitCode;
+    /**
+     * 申报价格
+     */
+    private BigDecimal declPrice;
+    /**
+     * 申报币种代码,参见海关编码
+     */
+    private String declCurrencyCode;
+    /**
+     * 供应商企业名称,非必送
+     */
+    private String supplierName;
+    /**
+     * 供货商企业国别代码,非必送,海关编码
+     */
+    private String supplierCntCode;
+    /**
+     * 生产企业名称
+     */
+    private String prodCompName;
+    /**
+     * 生产企业国别名称
+     */
+    private String prodCompCntCode;
+    /**
+     * 主要成分
+     */
+    private String ciqMainEle;
+    /**
+     * 国检监管类别,
+             0101:3C目录内
+             0102:HS编码涉及3C但在3C目录外
+             0201:普通食品、化妆品及一般要求
+             0202:保健食品
+             0203:有检疫要求(含肉、含蛋、含乳等)的深加工食品
+             0204:备案管理的化妆品(婴幼儿化妆品除外)
+             0205:实施注册管理的进口婴幼儿乳粉、实施备案管理的进口婴幼儿化妆品
+             0206:其他有特殊检验检疫监管要求的食品
+             0301:一次性卫生用品
+             0401:医学微生物、人体组、生物制品、血液及其制品、环保微生物菌剂
+             9999:其他产品)
+     */
+    private String ciqMonitorType;
+    /**
+     * 是否法检   0:否 1:是
+     */
+    private String isLaw;
+    /**
+     * 是否赠品 0:否 1:是
+     */
+    private String isGift;
+    /**
+     * 海关申报要素,报统一版
+     */
+    private String cusDeclEle;
+    /**
+     * 创建人编号
+     */
+    private String createrSn;
+    /**
+     * 创建时间,yyyy-MM-dd HH:mm:ss
+     */
+    private Date createTime;
+    /**
+     * 修改人编号
+     */
+    private String moderSn;
+    /**
+     * 修改时间,yyyy-MM-dd HH:mm:ss
+     */
+    private Date modTime;
+    /**
+     * 时间戳
+     */
+    private Date tstm;
+    /**
+     * 
+     */
+    private String exField;
+    /**
+     * 
+     */
+    private String exField2;
+    /**
+     * 
+     */
+    private String exField3;
+    /**
+     * 
+     */
+    private String exField4;
+    /**
+     * 
+     */
+    private String exField5;
+    /**
+     * 第一法定单位数量
+     */
+    private BigDecimal legalUnit1Qty;
+    /**
+     * 净重,kg
+     */
+    private BigDecimal netWeight;
+    /**
+     * 第二法定单位数量
+     */
+    private BigDecimal legalUnit2Qty;
+    /**
+     * 毛重,kg
+     */
+    private BigDecimal grossWeight;
+    /**
+     * 园区账册编号
+     */
+    private String localEmsNo;
+    /**
+     * 园区商品序号
+     */
+    private String itemRecordNo;
+    /**
+     * 账册分类代码
+     */
+    private String emsClassCode;
+
+
+    private String isSend;
+
+
+    public String getIsSend() {
+        return isSend;
+    }
+
+    public void setIsSend(String isSend) {
+        this.isSend = isSend;
+    }
+
+    /**
+     * 设置:产品信息备案编号
+     */
+    public void setMallGoodsProductSn(Integer mallGoodsProductSn) {
+        this.mallGoodsProductSn = mallGoodsProductSn;
+    }
+
+    /**
+     * 获取:产品信息备案编号
+     */
+    public Integer getMallGoodsProductSn() {
+        return mallGoodsProductSn;
+    }
+    /**
+     * 设置:商户编号
+     */
+    public void setMerchSn(String merchSn) {
+        this.merchSn = merchSn;
+    }
+
+    /**
+     * 获取:商户编号
+     */
+    public String getMerchSn() {
+        return merchSn;
+    }
+    /**
+     * 设置:第三方商户编号
+     */
+    public void setThirdMerchSn(String thirdMerchSn) {
+        this.thirdMerchSn = thirdMerchSn;
+    }
+
+    /**
+     * 获取:第三方商户编号
+     */
+    public String getThirdMerchSn() {
+        return thirdMerchSn;
+    }
+    /**
+     * 设置:产品条码
+     */
+    public void setProdBarcode(String prodBarcode) {
+        this.prodBarcode = prodBarcode;
+    }
+
+    /**
+     * 获取:产品条码
+     */
+    public String getProdBarcode() {
+        return prodBarcode;
+    }
+    /**
+     * 设置:sku
+     */
+    public void setSku(String sku) {
+        this.sku = sku;
+    }
+
+    /**
+     * 获取:sku
+     */
+    public String getSku() {
+        return sku;
+    }
+    /**
+     * 设置:海关商品编码
+     */
+    public void setCusGoodsCode(String cusGoodsCode) {
+        this.cusGoodsCode = cusGoodsCode;
+    }
+
+    /**
+     * 获取:海关商品编码
+     */
+    public String getCusGoodsCode() {
+        return cusGoodsCode;
+    }
+    /**
+     * 设置:中文名称
+     */
+    public void setProdName(String prodName) {
+        this.prodName = prodName;
+    }
+
+    /**
+     * 获取:中文名称
+     */
+    public String getProdName() {
+        return prodName;
+    }
+    /**
+     * 设置:国检规格型号
+     */
+    public void setCiqProdModel(String ciqProdModel) {
+        this.ciqProdModel = ciqProdModel;
+    }
+
+    /**
+     * 获取:国检规格型号
+     */
+    public String getCiqProdModel() {
+        return ciqProdModel;
+    }
+    /**
+     * 设置:品牌
+     */
+    public void setProdBrand(String prodBrand) {
+        this.prodBrand = prodBrand;
+    }
+
+    /**
+     * 获取:品牌
+     */
+    public String getProdBrand() {
+        return prodBrand;
+    }
+    /**
+     * 设置:原产国代码,海关编码
+     */
+    public void setOriCntCode(String oriCntCode) {
+        this.oriCntCode = oriCntCode;
+    }
+
+    /**
+     * 获取:原产国代码,海关编码
+     */
+    public String getOriCntCode() {
+        return oriCntCode;
+    }
+    /**
+     * 设置:计量单位代码,参见海关编码
+     */
+    public void setUnitCode(String unitCode) {
+        this.unitCode = unitCode;
+    }
+
+    /**
+     * 获取:计量单位代码,参见海关编码
+     */
+    public String getUnitCode() {
+        return unitCode;
+    }
+    /**
+     * 设置:申报价格
+     */
+    public void setDeclPrice(BigDecimal declPrice) {
+        this.declPrice = declPrice;
+    }
+
+    /**
+     * 获取:申报价格
+     */
+    public BigDecimal getDeclPrice() {
+        return declPrice;
+    }
+    /**
+     * 设置:申报币种代码,参见海关编码
+     */
+    public void setDeclCurrencyCode(String declCurrencyCode) {
+        this.declCurrencyCode = declCurrencyCode;
+    }
+
+    /**
+     * 获取:申报币种代码,参见海关编码
+     */
+    public String getDeclCurrencyCode() {
+        return declCurrencyCode;
+    }
+    /**
+     * 设置:供应商企业名称,非必送
+     */
+    public void setSupplierName(String supplierName) {
+        this.supplierName = supplierName;
+    }
+
+    /**
+     * 获取:供应商企业名称,非必送
+     */
+    public String getSupplierName() {
+        return supplierName;
+    }
+    /**
+     * 设置:供货商企业国别代码,非必送,海关编码
+     */
+    public void setSupplierCntCode(String supplierCntCode) {
+        this.supplierCntCode = supplierCntCode;
+    }
+
+    /**
+     * 获取:供货商企业国别代码,非必送,海关编码
+     */
+    public String getSupplierCntCode() {
+        return supplierCntCode;
+    }
+    /**
+     * 设置:生产企业名称
+     */
+    public void setProdCompName(String prodCompName) {
+        this.prodCompName = prodCompName;
+    }
+
+    /**
+     * 获取:生产企业名称
+     */
+    public String getProdCompName() {
+        return prodCompName;
+    }
+    /**
+     * 设置:生产企业国别名称
+     */
+    public void setProdCompCntCode(String prodCompCntCode) {
+        this.prodCompCntCode = prodCompCntCode;
+    }
+
+    /**
+     * 获取:生产企业国别名称
+     */
+    public String getProdCompCntCode() {
+        return prodCompCntCode;
+    }
+    /**
+     * 设置:主要成分
+     */
+    public void setCiqMainEle(String ciqMainEle) {
+        this.ciqMainEle = ciqMainEle;
+    }
+
+    /**
+     * 获取:主要成分
+     */
+    public String getCiqMainEle() {
+        return ciqMainEle;
+    }
+    /**
+     * 设置:国检监管类别,
+             0101:3C目录内
+             0102:HS编码涉及3C但在3C目录外
+             0201:普通食品、化妆品及一般要求
+             0202:保健食品
+             0203:有检疫要求(含肉、含蛋、含乳等)的深加工食品
+             0204:备案管理的化妆品(婴幼儿化妆品除外)
+             0205:实施注册管理的进口婴幼儿乳粉、实施备案管理的进口婴幼儿化妆品
+             0206:其他有特殊检验检疫监管要求的食品
+             0301:一次性卫生用品
+             0401:医学微生物、人体组、生物制品、血液及其制品、环保微生物菌剂
+             9999:其他产品)
+     */
+    public void setCiqMonitorType(String ciqMonitorType) {
+        this.ciqMonitorType = ciqMonitorType;
+    }
+
+    /**
+     * 获取:国检监管类别,
+             0101:3C目录内
+             0102:HS编码涉及3C但在3C目录外
+             0201:普通食品、化妆品及一般要求
+             0202:保健食品
+             0203:有检疫要求(含肉、含蛋、含乳等)的深加工食品
+             0204:备案管理的化妆品(婴幼儿化妆品除外)
+             0205:实施注册管理的进口婴幼儿乳粉、实施备案管理的进口婴幼儿化妆品
+             0206:其他有特殊检验检疫监管要求的食品
+             0301:一次性卫生用品
+             0401:医学微生物、人体组、生物制品、血液及其制品、环保微生物菌剂
+             9999:其他产品)
+     */
+    public String getCiqMonitorType() {
+        return ciqMonitorType;
+    }
+    /**
+     * 设置:是否法检   0:否 1:是
+     */
+    public void setIsLaw(String isLaw) {
+        this.isLaw = isLaw;
+    }
+
+    /**
+     * 获取:是否法检   0:否 1:是
+     */
+    public String getIsLaw() {
+        return isLaw;
+    }
+    /**
+     * 设置:是否赠品 0:否 1:是
+     */
+    public void setIsGift(String isGift) {
+        this.isGift = isGift;
+    }
+
+    /**
+     * 获取:是否赠品 0:否 1:是
+     */
+    public String getIsGift() {
+        return isGift;
+    }
+    /**
+     * 设置:海关申报要素,报统一版
+     */
+    public void setCusDeclEle(String cusDeclEle) {
+        this.cusDeclEle = cusDeclEle;
+    }
+
+    /**
+     * 获取:海关申报要素,报统一版
+     */
+    public String getCusDeclEle() {
+        return cusDeclEle;
+    }
+    /**
+     * 设置:创建人编号
+     */
+    public void setCreaterSn(String createrSn) {
+        this.createrSn = createrSn;
+    }
+
+    /**
+     * 获取:创建人编号
+     */
+    public String getCreaterSn() {
+        return createrSn;
+    }
+    /**
+     * 设置:创建时间,yyyy-MM-dd HH:mm:ss
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取:创建时间,yyyy-MM-dd HH:mm:ss
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+    /**
+     * 设置:修改人编号
+     */
+    public void setModerSn(String moderSn) {
+        this.moderSn = moderSn;
+    }
+
+    /**
+     * 获取:修改人编号
+     */
+    public String getModerSn() {
+        return moderSn;
+    }
+    /**
+     * 设置:修改时间,yyyy-MM-dd HH:mm:ss
+     */
+    public void setModTime(Date modTime) {
+        this.modTime = modTime;
+    }
+
+    /**
+     * 获取:修改时间,yyyy-MM-dd HH:mm:ss
+     */
+    public Date getModTime() {
+        return modTime;
+    }
+    /**
+     * 设置:时间戳
+     */
+    public void setTstm(Date tstm) {
+        this.tstm = tstm;
+    }
+
+    /**
+     * 获取:时间戳
+     */
+    public Date getTstm() {
+        return tstm;
+    }
+    /**
+     * 设置:
+     */
+    public void setExField(String exField) {
+        this.exField = exField;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getExField() {
+        return exField;
+    }
+    /**
+     * 设置:
+     */
+    public void setExField2(String exField2) {
+        this.exField2 = exField2;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getExField2() {
+        return exField2;
+    }
+    /**
+     * 设置:
+     */
+    public void setExField3(String exField3) {
+        this.exField3 = exField3;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getExField3() {
+        return exField3;
+    }
+    /**
+     * 设置:
+     */
+    public void setExField4(String exField4) {
+        this.exField4 = exField4;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getExField4() {
+        return exField4;
+    }
+    /**
+     * 设置:
+     */
+    public void setExField5(String exField5) {
+        this.exField5 = exField5;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getExField5() {
+        return exField5;
+    }
+    /**
+     * 设置:第一法定单位数量
+     */
+    public void setLegalUnit1Qty(BigDecimal legalUnit1Qty) {
+        this.legalUnit1Qty = legalUnit1Qty;
+    }
+
+    /**
+     * 获取:第一法定单位数量
+     */
+    public BigDecimal getLegalUnit1Qty() {
+        return legalUnit1Qty;
+    }
+    /**
+     * 设置:净重,kg
+     */
+    public void setNetWeight(BigDecimal netWeight) {
+        this.netWeight = netWeight;
+    }
+
+    /**
+     * 获取:净重,kg
+     */
+    public BigDecimal getNetWeight() {
+        return netWeight;
+    }
+    /**
+     * 设置:第二法定单位数量
+     */
+    public void setLegalUnit2Qty(BigDecimal legalUnit2Qty) {
+        this.legalUnit2Qty = legalUnit2Qty;
+    }
+
+    /**
+     * 获取:第二法定单位数量
+     */
+    public BigDecimal getLegalUnit2Qty() {
+        return legalUnit2Qty;
+    }
+    /**
+     * 设置:毛重,kg
+     */
+    public void setGrossWeight(BigDecimal grossWeight) {
+        this.grossWeight = grossWeight;
+    }
+
+    /**
+     * 获取:毛重,kg
+     */
+    public BigDecimal getGrossWeight() {
+        return grossWeight;
+    }
+    /**
+     * 设置:园区账册编号
+     */
+    public void setLocalEmsNo(String localEmsNo) {
+        this.localEmsNo = localEmsNo;
+    }
+
+    /**
+     * 获取:园区账册编号
+     */
+    public String getLocalEmsNo() {
+        return localEmsNo;
+    }
+    /**
+     * 设置:园区商品序号
+     */
+    public void setItemRecordNo(String itemRecordNo) {
+        this.itemRecordNo = itemRecordNo;
+    }
+
+    /**
+     * 获取:园区商品序号
+     */
+    public String getItemRecordNo() {
+        return itemRecordNo;
+    }
+    /**
+     * 设置:账册分类代码
+     */
+    public void setEmsClassCode(String emsClassCode) {
+        this.emsClassCode = emsClassCode;
+    }
+
+    /**
+     * 获取:账册分类代码
+     */
+    public String getEmsClassCode() {
+        return emsClassCode;
+    }
+}

+ 11 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/OrderRefundEntity.java

@@ -96,6 +96,8 @@ public class OrderRefundEntity implements Serializable {
 
     private String wechatRefundStatusDes;
 
+    private Integer restore;
+
 
 
     /**
@@ -526,4 +528,13 @@ public class OrderRefundEntity implements Serializable {
     public void setRate(String rate) {
         this.rate = rate;
     }
+
+
+    public Integer getRestore() {
+        return restore;
+    }
+
+    public void setRestore(Integer restore) {
+        this.restore = restore;
+    }
 }

+ 12 - 1
kmall-admin/src/main/java/com/kmall/admin/entity/ProductStoreRelaEntity.java

@@ -54,7 +54,7 @@ public class ProductStoreRelaEntity implements Serializable {
     /**
      * 销售量
      */
-    private Integer sellVolume = 0;
+    private Integer sellVolume;
 
     // 翻译
     private String storeName;
@@ -142,6 +142,9 @@ public class ProductStoreRelaEntity implements Serializable {
     // 最后销售时间
     private Date lastSaleTime;
 
+    private Integer toBeRestored;
+
+
     public Date getLastSaleTime() {
         return lastSaleTime;
     }
@@ -597,4 +600,12 @@ public class ProductStoreRelaEntity implements Serializable {
             sellVolume--;
         }
     }
+
+    public Integer getToBeRestored() {
+        return toBeRestored;
+    }
+
+    public void setToBeRestored(Integer toBeRestored) {
+        this.toBeRestored = toBeRestored;
+    }
 }

+ 154 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/compared/ImportPayOrderRecordEntity.java

@@ -0,0 +1,154 @@
+package com.kmall.admin.entity.compared;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 导入支付单记录表实体
+ * 表名 import_pay_order_record
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-12 16:26:45
+ */
+public class ImportPayOrderRecordEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private Long iporId;
+    /**
+     * 导入人
+     */
+    private String importer;
+    /**
+     * 导入时间
+     */
+    private Date importTime;
+    /**
+     * 导入文件名
+     */
+    private String importFileName;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 创建人编号
+     */
+    private String createrSn;
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+    /**
+     * 修改人编号
+     */
+    private String moderSn;
+
+    /**
+     * 设置:编号
+     */
+    public void setIporId(Long iporId) {
+        this.iporId = iporId;
+    }
+
+    /**
+     * 获取:编号
+     */
+    public Long getIporId() {
+        return iporId;
+    }
+    /**
+     * 设置:导入人
+     */
+    public void setImporter(String importer) {
+        this.importer = importer;
+    }
+
+    /**
+     * 获取:导入人
+     */
+    public String getImporter() {
+        return importer;
+    }
+    /**
+     * 设置:导入时间
+     */
+    public void setImportTime(Date importTime) {
+        this.importTime = importTime;
+    }
+
+    /**
+     * 获取:导入时间
+     */
+    public Date getImportTime() {
+        return importTime;
+    }
+    /**
+     * 设置:导入文件名
+     */
+    public void setImportFileName(String importFileName) {
+        this.importFileName = importFileName;
+    }
+
+    /**
+     * 获取:导入文件名
+     */
+    public String getImportFileName() {
+        return importFileName;
+    }
+    /**
+     * 设置:创建时间
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取:创建时间
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+    /**
+     * 设置:创建人编号
+     */
+    public void setCreaterSn(String createrSn) {
+        this.createrSn = createrSn;
+    }
+
+    /**
+     * 获取:创建人编号
+     */
+    public String getCreaterSn() {
+        return createrSn;
+    }
+    /**
+     * 设置:修改时间
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    /**
+     * 获取:修改时间
+     */
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+    /**
+     * 设置:修改人编号
+     */
+    public void setModerSn(String moderSn) {
+        this.moderSn = moderSn;
+    }
+
+    /**
+     * 获取:修改人编号
+     */
+    public String getModerSn() {
+        return moderSn;
+    }
+}

+ 154 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/compared/ImportTaxOrderRecordEntity.java

@@ -0,0 +1,154 @@
+package com.kmall.admin.entity.compared;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 导入税单记录表实体
+ * 表名 import_tax_order_record
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-12 16:26:45
+ */
+public class ImportTaxOrderRecordEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private Long itorId;
+    /**
+     * 导入人
+     */
+    private String importer;
+    /**
+     * 导入时间
+     */
+    private Date importTime;
+    /**
+     * 导入文件名
+     */
+    private String importFileName;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 创建人编号
+     */
+    private String createrSn;
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+    /**
+     * 修改人编号
+     */
+    private String moderSn;
+
+    /**
+     * 设置:编号
+     */
+    public void setItorId(Long itorId) {
+        this.itorId = itorId;
+    }
+
+    /**
+     * 获取:编号
+     */
+    public Long getItorId() {
+        return itorId;
+    }
+    /**
+     * 设置:导入人
+     */
+    public void setImporter(String importer) {
+        this.importer = importer;
+    }
+
+    /**
+     * 获取:导入人
+     */
+    public String getImporter() {
+        return importer;
+    }
+    /**
+     * 设置:导入时间
+     */
+    public void setImportTime(Date importTime) {
+        this.importTime = importTime;
+    }
+
+    /**
+     * 获取:导入时间
+     */
+    public Date getImportTime() {
+        return importTime;
+    }
+    /**
+     * 设置:导入文件名
+     */
+    public void setImportFileName(String importFileName) {
+        this.importFileName = importFileName;
+    }
+
+    /**
+     * 获取:导入文件名
+     */
+    public String getImportFileName() {
+        return importFileName;
+    }
+    /**
+     * 设置:创建时间
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取:创建时间
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+    /**
+     * 设置:创建人编号
+     */
+    public void setCreaterSn(String createrSn) {
+        this.createrSn = createrSn;
+    }
+
+    /**
+     * 获取:创建人编号
+     */
+    public String getCreaterSn() {
+        return createrSn;
+    }
+    /**
+     * 设置:修改时间
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    /**
+     * 获取:修改时间
+     */
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+    /**
+     * 设置:修改人编号
+     */
+    public void setModerSn(String moderSn) {
+        this.moderSn = moderSn;
+    }
+
+    /**
+     * 获取:修改人编号
+     */
+    public String getModerSn() {
+        return moderSn;
+    }
+}

+ 104 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/compared/TaxComparedErrorEntity.java

@@ -0,0 +1,104 @@
+package com.kmall.admin.entity.compared;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 实体
+ * 表名 mall_tax_compared_error
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-12-29 14:11:24
+ */
+public class TaxComparedErrorEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     *
+     */
+    private Integer mtceId;
+    /**
+     *
+     */
+    private String merchOrderSn;
+    /**
+     *
+     */
+    private BigDecimal kmallTax;
+    /**
+     *
+     */
+    private BigDecimal omsTax;
+    /**
+     *
+     */
+    private String createTime;
+
+    /**
+     * 设置:
+     */
+    public void setMtceId(Integer mtceId) {
+        this.mtceId = mtceId;
+    }
+
+    /**
+     * 获取:
+     */
+    public Integer getMtceId() {
+        return mtceId;
+    }
+    /**
+     * 设置:
+     */
+    public void setMerchOrderSn(String merchOrderSn) {
+        this.merchOrderSn = merchOrderSn;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getMerchOrderSn() {
+        return merchOrderSn;
+    }
+    /**
+     * 设置:
+     */
+    public void setKmallTax(BigDecimal kmallTax) {
+        this.kmallTax = kmallTax;
+    }
+
+    /**
+     * 获取:
+     */
+    public BigDecimal getKmallTax() {
+        return kmallTax;
+    }
+    /**
+     * 设置:
+     */
+    public void setOmsTax(BigDecimal omsTax) {
+        this.omsTax = omsTax;
+    }
+
+    /**
+     * 获取:
+     */
+    public BigDecimal getOmsTax() {
+        return omsTax;
+    }
+    /**
+     * 设置:
+     */
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getCreateTime() {
+        return createTime;
+    }
+}

+ 155 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/compared/TaxInfoEntity.java

@@ -0,0 +1,155 @@
+package com.kmall.admin.entity.compared;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 实体
+ * 表名 mall_tax_info
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-12-29 14:11:24
+ */
+public class TaxInfoEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     *
+     */
+    private Integer mtiId;
+    /**
+     *
+     */
+    private String merchOrderSn;
+    /**
+     *
+     */
+    private BigDecimal preTaxPrice;
+    /**
+     *
+     */
+    private BigDecimal tax;
+    /**
+     *
+     */
+    private String importTime;
+    /**
+     *
+     */
+    private String importer;
+    /**
+     *
+     */
+    private String compared;
+    /**
+     *
+     */
+    private String comparedTime;
+
+    /**
+     * 设置:
+     */
+    public void setMtiId(Integer mtiId) {
+        this.mtiId = mtiId;
+    }
+
+    /**
+     * 获取:
+     */
+    public Integer getMtiId() {
+        return mtiId;
+    }
+    /**
+     * 设置:
+     */
+    public void setMerchOrderSn(String merchOrderSn) {
+        this.merchOrderSn = merchOrderSn;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getMerchOrderSn() {
+        return merchOrderSn;
+    }
+    /**
+     * 设置:
+     */
+    public void setPreTaxPrice(BigDecimal preTaxPrice) {
+        this.preTaxPrice = preTaxPrice;
+    }
+
+    /**
+     * 获取:
+     */
+    public BigDecimal getPreTaxPrice() {
+        return preTaxPrice;
+    }
+    /**
+     * 设置:
+     */
+    public void setTax(BigDecimal tax) {
+        this.tax = tax;
+    }
+
+    /**
+     * 获取:
+     */
+    public BigDecimal getTax() {
+        return tax;
+    }
+    /**
+     * 设置:
+     */
+    public void setImportTime(String importTime) {
+        this.importTime = importTime;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getImportTime() {
+        return importTime;
+    }
+    /**
+     * 设置:
+     */
+    public void setImporter(String importer) {
+        this.importer = importer;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getImporter() {
+        return importer;
+    }
+    /**
+     * 设置:
+     */
+    public void setCompared(String compared) {
+        this.compared = compared;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getCompared() {
+        return compared;
+    }
+    /**
+     * 设置:
+     */
+    public void setComparedTime(String comparedTime) {
+        this.comparedTime = comparedTime;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getComparedTime() {
+        return comparedTime;
+    }
+}

+ 188 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/kmall2eccs/KtoEccsEntity.java

@@ -0,0 +1,188 @@
+package com.kmall.admin.entity.kmall2eccs;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 实体
+ * 表名 kmall_to_eccs
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-12 15:50:45
+ */
+public class KtoEccsEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private Long kteId;
+    /**
+     * 请求数据
+     */
+    private String requestData;
+    /**
+     * 请求时间
+     */
+    private Date requestTime;
+    /**
+     * 请求类型(01 进货 02 上架 03 销售 04 退款 )
+     */
+    private String requestType;
+    /**
+     * 是否请求过  00 未请求  01已请求 02请求失败
+     */
+    private String sendStatus;
+    /**
+     * 失败原因
+     */
+    private String failReason;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 创建人编号
+     */
+    private String createrSn;
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+    /**
+     * 修改人编号
+     */
+    private String moderSn;
+
+    /**
+     * 设置:编号
+     */
+    public void setKteId(Long kteId) {
+        this.kteId = kteId;
+    }
+
+    /**
+     * 获取:编号
+     */
+    public Long getKteId() {
+        return kteId;
+    }
+    /**
+     * 设置:请求数据
+     */
+    public void setRequestData(String requestData) {
+        this.requestData = requestData;
+    }
+
+    /**
+     * 获取:请求数据
+     */
+    public String getRequestData() {
+        return requestData;
+    }
+    /**
+     * 设置:请求时间
+     */
+    public void setRequestTime(Date requestTime) {
+        this.requestTime = requestTime;
+    }
+
+    /**
+     * 获取:请求时间
+     */
+    public Date getRequestTime() {
+        return requestTime;
+    }
+    /**
+     * 设置:请求类型(01 进货 02 上架 03 销售 04 退款
+     */
+    public void setRequestType(String requestType) {
+        this.requestType = requestType;
+    }
+
+    /**
+     * 获取:请求类型(01 进货 02 上架 03 销售 04 退款
+     */
+    public String getRequestType() {
+        return requestType;
+    }
+    /**
+     * 设置:是否请求过  00 未请求  01已请求 02请求失败
+     */
+    public void setSendStatus(String sendStatus) {
+        this.sendStatus = sendStatus;
+    }
+
+    /**
+     * 获取:是否请求过  00 未请求  01已请求 02请求失败
+     */
+    public String getSendStatus() {
+        return sendStatus;
+    }
+    /**
+     * 设置:失败原因
+     */
+    public void setFailReason(String failReason) {
+        this.failReason = failReason;
+    }
+
+    /**
+     * 获取:失败原因
+     */
+    public String getFailReason() {
+        return failReason;
+    }
+    /**
+     * 设置:创建时间
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取:创建时间
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+    /**
+     * 设置:创建人编号
+     */
+    public void setCreaterSn(String createrSn) {
+        this.createrSn = createrSn;
+    }
+
+    /**
+     * 获取:创建人编号
+     */
+    public String getCreaterSn() {
+        return createrSn;
+    }
+    /**
+     * 设置:修改时间
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    /**
+     * 获取:修改时间
+     */
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+    /**
+     * 设置:修改人编号
+     */
+    public void setModerSn(String moderSn) {
+        this.moderSn = moderSn;
+    }
+
+    /**
+     * 获取:修改人编号
+     */
+    public String getModerSn() {
+        return moderSn;
+    }
+}

+ 239 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/shop/PriceModificationRecordEntity.java

@@ -0,0 +1,239 @@
+package com.kmall.admin.entity.shop;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 价格修改记录表实体
+ * 表名 mall_price_modification_record
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-22 09:07:06
+ */
+public class PriceModificationRecordEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 价格修改记录表id
+     */
+    private Integer mpmrId;
+    /**
+     * 商户编码
+     */
+    private String merchSn;
+    /**
+     * 第三方商户
+     */
+    private String thirdMerchSn;
+    /**
+     * 门店编码
+     */
+    private String shopSn;
+    /**
+     * 条码
+     */
+    private String barcode;
+    /**
+     * sku
+     */
+    private String sku;
+    /**
+     * 当前价格
+     */
+    private String currentPrice;
+    /**
+     * 修改价格
+     */
+    private String modifyPrice;
+    /**
+     * 修改方式 (1.界面修改 2.excel修改 )
+     */
+    private Integer modifyType;
+    /**
+     * 修改价格源头 (1.门店商品 2.日常活动 3.临时促销)
+     */
+    private Integer modifySource;
+    /**
+     * 修改人编号
+     */
+    private String moderSn;
+    /**
+     * 修改时间,yyyy-MM-dd HH:mm:ss
+     */
+    private Date modTime;
+    /**
+     * 时间戳
+     */
+    private Date tstm;
+
+    /**
+     * 设置:价格修改记录表id
+     */
+    public void setMpmrId(Integer mpmrId) {
+        this.mpmrId = mpmrId;
+    }
+
+    /**
+     * 获取:价格修改记录表id
+     */
+    public Integer getMpmrId() {
+        return mpmrId;
+    }
+    /**
+     * 设置:商户编码
+     */
+    public void setMerchSn(String merchSn) {
+        this.merchSn = merchSn;
+    }
+
+    /**
+     * 获取:商户编码
+     */
+    public String getMerchSn() {
+        return merchSn;
+    }
+    /**
+     * 设置:第三方商户
+     */
+    public void setThirdMerchSn(String thirdMerchSn) {
+        this.thirdMerchSn = thirdMerchSn;
+    }
+
+    /**
+     * 获取:第三方商户
+     */
+    public String getThirdMerchSn() {
+        return thirdMerchSn;
+    }
+    /**
+     * 设置:门店编码
+     */
+    public void setShopSn(String shopSn) {
+        this.shopSn = shopSn;
+    }
+
+    /**
+     * 获取:门店编码
+     */
+    public String getShopSn() {
+        return shopSn;
+    }
+    /**
+     * 设置:条码
+     */
+    public void setBarcode(String barcode) {
+        this.barcode = barcode;
+    }
+
+    /**
+     * 获取:条码
+     */
+    public String getBarcode() {
+        return barcode;
+    }
+    /**
+     * 设置:sku
+     */
+    public void setSku(String sku) {
+        this.sku = sku;
+    }
+
+    /**
+     * 获取:sku
+     */
+    public String getSku() {
+        return sku;
+    }
+    /**
+     * 设置:当前价格
+     */
+    public void setCurrentPrice(String currentPrice) {
+        this.currentPrice = currentPrice;
+    }
+
+    /**
+     * 获取:当前价格
+     */
+    public String getCurrentPrice() {
+        return currentPrice;
+    }
+    /**
+     * 设置:修改价格
+     */
+    public void setModifyPrice(String modifyPrice) {
+        this.modifyPrice = modifyPrice;
+    }
+
+    /**
+     * 获取:修改价格
+     */
+    public String getModifyPrice() {
+        return modifyPrice;
+    }
+    /**
+     * 设置:修改方式 (1.界面修改 2.excel修改 )
+     */
+    public void setModifyType(Integer modifyType) {
+        this.modifyType = modifyType;
+    }
+
+    /**
+     * 获取:修改方式 (1.界面修改 2.excel修改 )
+     */
+    public Integer getModifyType() {
+        return modifyType;
+    }
+    /**
+     * 设置:修改价格源头 (1.门店商品 2.日常活动 3.临时促销)
+     */
+    public void setModifySource(Integer modifySource) {
+        this.modifySource = modifySource;
+    }
+
+    /**
+     * 获取:修改价格源头 (1.门店商品 2.日常活动 3.临时促销)
+     */
+    public Integer getModifySource() {
+        return modifySource;
+    }
+    /**
+     * 设置:修改人编号
+     */
+    public void setModerSn(String moderSn) {
+        this.moderSn = moderSn;
+    }
+
+    /**
+     * 获取:修改人编号
+     */
+    public String getModerSn() {
+        return moderSn;
+    }
+    /**
+     * 设置:修改时间,yyyy-MM-dd HH:mm:ss
+     */
+    public void setModTime(Date modTime) {
+        this.modTime = modTime;
+    }
+
+    /**
+     * 获取:修改时间,yyyy-MM-dd HH:mm:ss
+     */
+    public Date getModTime() {
+        return modTime;
+    }
+    /**
+     * 设置:时间戳
+     */
+    public void setTstm(Date tstm) {
+        this.tstm = tstm;
+    }
+
+    /**
+     * 获取:时间戳
+     */
+    public Date getTstm() {
+        return tstm;
+    }
+}

+ 336 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/shop/ShopErrorPriceRecordEntity.java

@@ -0,0 +1,336 @@
+package com.kmall.admin.entity.shop;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 门店价格异常记录表实体
+ * 表名 mall_shop_error_price_record
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-19 16:03:52
+ */
+public class ShopErrorPriceRecordEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 异常记录id
+     */
+    private Integer mseprId;
+    /**
+     * 商户编码
+     */
+    private String merchSn;
+    /**
+     * 第三方商户
+     */
+    private String thirdMerchSn;
+    /**
+     * 门店编码
+     */
+    private String shopSn;
+    /**
+     * 条码
+     */
+    private String barcode;
+    /**
+     * sku
+     */
+    private String sku;
+    /**
+     * 当前价格
+     */
+    private String currentPrice;
+    /**
+     * 价格来源
+     */
+    private Integer priceType;
+    /**
+     * 建议价格
+     */
+    private String suggestedPrice;
+    /**
+     * 校验时间
+     */
+    private Date checkTime;
+    /**
+     * 校验人
+     */
+    private String verifier;
+    /**
+     * 创建人编号
+     */
+    private String createrSn;
+    /**
+     * 创建时间,yyyy-MM-dd HH:mm:ss
+     */
+    private Date createTime;
+    /**
+     * 修改人编号
+     */
+    private String moderSn;
+    /**
+     * 修改时间,yyyy-MM-dd HH:mm:ss
+     */
+    private Date modTime;
+    /**
+     * 时间戳
+     */
+    private Date tstm;
+
+    private String shopName;
+    private String lowestPrice;
+    private String highestPrice;
+    private String modify;
+    private Long mkaId;
+
+    /**
+     * 设置:异常记录id
+     */
+    public void setMseprId(Integer mseprId) {
+        this.mseprId = mseprId;
+    }
+
+    /**
+     * 获取:异常记录id
+     */
+    public Integer getMseprId() {
+        return mseprId;
+    }
+    /**
+     * 设置:商户编码
+     */
+    public void setMerchSn(String merchSn) {
+        this.merchSn = merchSn;
+    }
+
+    /**
+     * 获取:商户编码
+     */
+    public String getMerchSn() {
+        return merchSn;
+    }
+    /**
+     * 设置:第三方商户
+     */
+    public void setThirdMerchSn(String thirdMerchSn) {
+        this.thirdMerchSn = thirdMerchSn;
+    }
+
+    /**
+     * 获取:第三方商户
+     */
+    public String getThirdMerchSn() {
+        return thirdMerchSn;
+    }
+    /**
+     * 设置:门店编码
+     */
+    public void setShopSn(String shopSn) {
+        this.shopSn = shopSn;
+    }
+
+    /**
+     * 获取:门店编码
+     */
+    public String getShopSn() {
+        return shopSn;
+    }
+    /**
+     * 设置:条码
+     */
+    public void setBarcode(String barcode) {
+        this.barcode = barcode;
+    }
+
+    /**
+     * 获取:条码
+     */
+    public String getBarcode() {
+        return barcode;
+    }
+    /**
+     * 设置:sku
+     */
+    public void setSku(String sku) {
+        this.sku = sku;
+    }
+
+    /**
+     * 获取:sku
+     */
+    public String getSku() {
+        return sku;
+    }
+    /**
+     * 设置:当前价格
+     */
+    public void setCurrentPrice(String currentPrice) {
+        this.currentPrice = currentPrice;
+    }
+
+    /**
+     * 获取:当前价格
+     */
+    public String getCurrentPrice() {
+        return currentPrice;
+    }
+    /**
+     * 设置:价格来源
+     */
+    public void setPriceType(Integer priceType) {
+        this.priceType = priceType;
+    }
+
+    /**
+     * 获取:价格来源
+     */
+    public Integer getPriceType() {
+        return priceType;
+    }
+    /**
+     * 设置:建议价格
+     */
+    public void setSuggestedPrice(String suggestedPrice) {
+        this.suggestedPrice = suggestedPrice;
+    }
+
+    /**
+     * 获取:建议价格
+     */
+    public String getSuggestedPrice() {
+        return suggestedPrice;
+    }
+    /**
+     * 设置:校验时间
+     */
+    public void setCheckTime(Date checkTime) {
+        this.checkTime = checkTime;
+    }
+
+    /**
+     * 获取:校验时间
+     */
+    public Date getCheckTime() {
+        return checkTime;
+    }
+    /**
+     * 设置:校验人
+     */
+    public void setVerifier(String verifier) {
+        this.verifier = verifier;
+    }
+
+    /**
+     * 获取:校验人
+     */
+    public String getVerifier() {
+        return verifier;
+    }
+    /**
+     * 设置:创建人编号
+     */
+    public void setCreaterSn(String createrSn) {
+        this.createrSn = createrSn;
+    }
+
+    /**
+     * 获取:创建人编号
+     */
+    public String getCreaterSn() {
+        return createrSn;
+    }
+    /**
+     * 设置:创建时间,yyyy-MM-dd HH:mm:ss
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取:创建时间,yyyy-MM-dd HH:mm:ss
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+    /**
+     * 设置:修改人编号
+     */
+    public void setModerSn(String moderSn) {
+        this.moderSn = moderSn;
+    }
+
+    /**
+     * 获取:修改人编号
+     */
+    public String getModerSn() {
+        return moderSn;
+    }
+    /**
+     * 设置:修改时间,yyyy-MM-dd HH:mm:ss
+     */
+    public void setModTime(Date modTime) {
+        this.modTime = modTime;
+    }
+
+    /**
+     * 获取:修改时间,yyyy-MM-dd HH:mm:ss
+     */
+    public Date getModTime() {
+        return modTime;
+    }
+    /**
+     * 设置:时间戳
+     */
+    public void setTstm(Date tstm) {
+        this.tstm = tstm;
+    }
+
+    /**
+     * 获取:时间戳
+     */
+    public Date getTstm() {
+        return tstm;
+    }
+
+    public String getShopName() {
+        return shopName;
+    }
+
+    public void setShopName(String shopName) {
+        this.shopName = shopName;
+    }
+
+    public String getLowestPrice() {
+        return lowestPrice;
+    }
+
+    public void setLowestPrice(String lowestPrice) {
+        this.lowestPrice = lowestPrice;
+    }
+
+    public String getHighestPrice() {
+        return highestPrice;
+    }
+
+    public void setHighestPrice(String highestPrice) {
+        this.highestPrice = highestPrice;
+    }
+
+    public String getModify() {
+        return modify;
+    }
+
+    public void setModify(String modify) {
+        this.modify = modify;
+    }
+
+    public Long getMkaId() {
+        return mkaId;
+    }
+
+    public void setMkaId(Long mkaId) {
+        this.mkaId = mkaId;
+    }
+}

+ 38 - 0
kmall-admin/src/main/java/com/kmall/admin/properties/EccsProperties.java

@@ -0,0 +1,38 @@
+package com.kmall.admin.properties;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2021-01-27 17:28
+ */
+
+
+public class EccsProperties {
+
+
+
+    private String md5Salt;
+
+    private String requestUrl;
+
+
+    public String getMd5Salt() {
+        return md5Salt;
+    }
+
+    public void setMd5Salt(String md5Salt) {
+        this.md5Salt = md5Salt;
+    }
+
+    public String getRequestUrl() {
+        return requestUrl;
+    }
+
+    public void setRequestUrl(String requestUrl) {
+        this.requestUrl = requestUrl;
+    }
+}

+ 4 - 0
kmall-admin/src/main/java/com/kmall/admin/service/BrandService.java

@@ -86,4 +86,8 @@ public interface BrandService {
 
 
     BrandEntity queryByCategoryIdAndBrandNameAndMerchSn(Integer categoryId, String name, String merchSn);
+
+    List<BrandEntity> queryExportList(Map<String, Object> params);
+
+    void uploadExcel(List<BrandEntity> brandEntityList);
 }

+ 81 - 0
kmall-admin/src/main/java/com/kmall/admin/service/GoodsProductService.java

@@ -0,0 +1,81 @@
+package com.kmall.admin.service;
+
+
+import com.kmall.admin.dto.GoodsProductDto;
+import com.kmall.admin.entity.GoodsProductEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 产品信息备案表Service接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-28 16:26:42
+ */
+public interface GoodsProductService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param mallGoodsProductSn 主键
+     * @return 实体
+     */
+    GoodsProductEntity queryObject(Integer mallGoodsProductSn);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<GoodsProductEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param goodsProduct 实体
+     * @return 保存条数
+     */
+    int save(GoodsProductEntity goodsProduct);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param goodsProduct 实体
+     * @return 更新条数
+     */
+    int update(GoodsProductEntity goodsProduct);
+
+    /**
+     * 根据主键删除
+     *
+     * @param mallGoodsProductSn
+     * @return 删除条数
+     */
+    int delete(Integer mallGoodsProductSn);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param mallGoodsProductSns
+     * @return 删除条数
+     */
+    int deleteBatch(Integer[]mallGoodsProductSns);
+
+    void uploadExcel(List<GoodsProductDto> goodsProductDtoList);
+
+    String sendSelectProduct(Integer[] mallGoodsProductSns);
+
+    String sendAllProduct();
+
+}

+ 6 - 0
kmall-admin/src/main/java/com/kmall/admin/service/GoodsService.java

@@ -5,6 +5,7 @@ import com.kmall.admin.dto.GoodsDto;
 import com.kmall.admin.dto.GoodsPanoramaDto;
 import com.kmall.admin.entity.GoodsEntity;
 import com.kmall.admin.entity.TaxErrorRecordEntity;
+import com.kmall.admin.fromcomm.entity.SysUserEntity;
 import com.kmall.api.entity.exportpdf.PDFGoodsDto;
 
 import java.util.List;
@@ -204,4 +205,9 @@ public interface GoodsService {
     void insertTaxErrorRecord(TaxErrorRecordEntity taxErrorRecordEntity);
 
     void updateByEntity(GoodsEntity updateGoods);
+
+    void checkGoodsPrice(SysUserEntity user);
+
+    List<GoodsEntity> queryAllList();
+
 }

+ 18 - 0
kmall-admin/src/main/java/com/kmall/admin/service/MkActivitiesPromotionService.java

@@ -86,4 +86,22 @@ public interface MkActivitiesPromotionService {
      * @return
      */
     MkActivitiesPromotionEntity queryByBarCode(String mkaId, String prodBarcode);
+
+    /**
+     * 根据条码,门店,当前时间查询
+     * @param storeId
+     * @param format
+     * @param lscx
+     * @param prodBarcode
+     * @return
+     */
+    MkActivitiesPromotionEntity queryByDateAndBarcode(String storeId, String format, String lscx, String prodBarcode);
+
+    /**
+     * 根据sku和活动id批量修改价格
+     * @param updatePrice
+     * @param sku
+     * @param mkaId
+     */
+    void updatePriceBySku(String updatePrice, String sku, Long mkaId);
 }

+ 18 - 0
kmall-admin/src/main/java/com/kmall/admin/service/MkDailyActivitiesService.java

@@ -87,4 +87,22 @@ public interface MkDailyActivitiesService {
      * @return
      */
     MkDailyActivitiesEntity queryByBarCode(String mkaId, String prodBarcode);
+
+    /**
+     * 根据条码,门店,当前时间查询
+     * @param storeId
+     * @param format
+     * @param rchd
+     * @param prodBarcode
+     * @return
+     */
+    MkDailyActivitiesEntity queryByDateAndBarcode(String storeId, String format, String rchd, String prodBarcode);
+
+    /**
+     * 根据sku和活动id批量修改价格
+     * @param updatePrice
+     * @param sku
+     * @param mkaId
+     */
+    void updatePriceBySku(String updatePrice, String sku, Long mkaId);
 }

+ 17 - 9
kmall-admin/src/main/java/com/kmall/admin/service/OrderGoodsService.java

@@ -1,32 +1,40 @@
 package com.kmall.admin.service;
 
+import com.kmall.admin.dto.OrderGoodsDto;
 import com.kmall.admin.entity.OrderGoodsEntity;
 
 import java.util.List;
 import java.util.Map;
 
 /**
- * 
- * 
+ *
+ *
  * @author Scott
  * @email
  * @date 2017-08-13 10:41:09
  */
 public interface OrderGoodsService {
-	
+
 	OrderGoodsEntity queryObject(Integer id);
-	
+
 	List<OrderGoodsEntity> queryList(Map<String, Object> map);
-	
+
 	int queryTotal(Map<String, Object> map);
-	
+
 	void save(OrderGoodsEntity orderGoods);
-	
+
 	void update(OrderGoodsEntity orderGoods);
-	
+
 	void delete(Integer id);
-	
+
 	void deleteBatch(Integer[] ids);
 
 	List<OrderGoodsEntity> queryListByOrderId(Integer orderId);
+
+	/**
+	 * 查询税单
+	 * @param format
+	 * @return
+	 */
+	List<OrderGoodsDto> queryYesterdayTax(String format);
 }

+ 19 - 2
kmall-admin/src/main/java/com/kmall/admin/service/OrderService.java

@@ -10,7 +10,9 @@ import com.kmall.manager.manager.wechat.wxglobal.dto.WechatGlobalRefundApiResult
 import com.kmall.common.utils.print.ticket.item.Ticket;
 import com.kmall.common.utils.wechat.WechatRefundApiResult;
 import net.sf.json.JSONObject;
+import org.apache.ibatis.annotations.Param;
 
+import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 
@@ -151,7 +153,7 @@ public interface OrderService {
 
     OrderEntity queryObjectByOrderSn(String orderSn);
 
-    R orderRefund(OrderEntity orderInfo, String sessionId) throws Exception;
+    R orderRefund(OrderEntity orderInfo, String sessionId, SysUserEntity user) throws Exception;
 
     int queryOffilineOrderTotal(Query query);
 
@@ -187,7 +189,7 @@ public interface OrderService {
      */
     List<SystemFormatDto> queryExportSystemFormatList(Map<String, Object> params);
 
-    List<OrderEntity> queryLastDayOrder();
+    List<OrderEntity> queryLastDayOrder( String comparedDate);
 
     /**
      * 查询CW保税+新零售销售报表第一个sheet
@@ -200,4 +202,19 @@ public interface OrderService {
     Map<String,List<OrderEntity>> querySaleOrderList(String billDate, String storeId);
 
     Map<String, List<TaxDetailDto>> queryTaxDetailList(String billDate, String storeId);
+
+
+    List<String> queryInveResponse(String orderSn) throws IOException;
+
+    /**
+     * 查询所有状态为201的订单。且下单时间超过5分钟的订单
+     * @return
+     */
+    List<OrderEntity> queryAll201Order();
+
+    /**
+     * 恢复kmall退单冻结的库存
+     * @param orderSn
+     */
+    void toBeRestored(String orderSn);
 }

+ 13 - 0
kmall-admin/src/main/java/com/kmall/admin/service/ProductStoreRelaService.java

@@ -133,4 +133,17 @@ public interface ProductStoreRelaService {
      * @return
      */
     List<ProductStoreRelaEntity> queryExportList(Map<String, Object> params);
+
+    /**
+     * 根据sku批量修改价格
+     * @param updatePrice
+     * @param sku
+     */
+    void updatePriceBySku(String updatePrice, String sku);
+
+    /**
+     * 查询所有门店数据
+     * @return
+     */
+    List<ProductStoreRelaEntity> queryAllList();
 }

+ 73 - 0
kmall-admin/src/main/java/com/kmall/admin/service/compared/ImportPayOrderRecordService.java

@@ -0,0 +1,73 @@
+package com.kmall.admin.service.compared;
+
+
+import com.kmall.admin.entity.compared.ImportPayOrderRecordEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 导入支付单记录表Service接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-12 16:26:45
+ */
+public interface ImportPayOrderRecordService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param iporId 主键
+     * @return 实体
+     */
+    ImportPayOrderRecordEntity queryObject(Long iporId);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<ImportPayOrderRecordEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param importPayOrderRecord 实体
+     * @return 保存条数
+     */
+    int save(ImportPayOrderRecordEntity importPayOrderRecord);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param importPayOrderRecord 实体
+     * @return 更新条数
+     */
+    int update(ImportPayOrderRecordEntity importPayOrderRecord);
+
+    /**
+     * 根据主键删除
+     *
+     * @param iporId
+     * @return 删除条数
+     */
+    int delete(Long iporId);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param iporIds
+     * @return 删除条数
+     */
+    int deleteBatch(Long[]iporIds);
+}

+ 73 - 0
kmall-admin/src/main/java/com/kmall/admin/service/compared/ImportTaxOrderRecordService.java

@@ -0,0 +1,73 @@
+package com.kmall.admin.service.compared;
+
+
+import com.kmall.admin.entity.compared.ImportTaxOrderRecordEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 导入税单记录表Service接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-12 16:26:45
+ */
+public interface ImportTaxOrderRecordService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param itorId 主键
+     * @return 实体
+     */
+    ImportTaxOrderRecordEntity queryObject(Long itorId);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<ImportTaxOrderRecordEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param importTaxOrderRecord 实体
+     * @return 保存条数
+     */
+    int save(ImportTaxOrderRecordEntity importTaxOrderRecord);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param importTaxOrderRecord 实体
+     * @return 更新条数
+     */
+    int update(ImportTaxOrderRecordEntity importTaxOrderRecord);
+
+    /**
+     * 根据主键删除
+     *
+     * @param itorId
+     * @return 删除条数
+     */
+    int delete(Long itorId);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param itorIds
+     * @return 删除条数
+     */
+    int deleteBatch(Long[]itorIds);
+}

+ 2 - 1
kmall-admin/src/main/java/com/kmall/admin/service/compared/OrderComparedErrorService.java

@@ -73,6 +73,7 @@ public interface OrderComparedErrorService {
 
     /**
      * 对比订单
+     * @param comparedDate
      */
-    String comparedOrder();
+    String comparedOrder(String comparedDate);
 }

+ 2 - 1
kmall-admin/src/main/java/com/kmall/admin/service/compared/PayOrderInfoService.java

@@ -76,8 +76,9 @@ public interface PayOrderInfoService {
 
     /**
      * 查询所有未对比的订单
+     * @param comparedDate
      */
-    List<PayOrderInfoEntity> queryNoComparedOrder();
+    List<PayOrderInfoEntity> queryNoComparedOrder(String comparedDate);
 
     /**
      * 批量修改数据

+ 80 - 0
kmall-admin/src/main/java/com/kmall/admin/service/compared/TaxComparedErrorService.java

@@ -0,0 +1,80 @@
+package com.kmall.admin.service.compared;
+
+
+import com.kmall.admin.entity.compared.TaxComparedErrorEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Service接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-12-29 14:11:24
+ */
+public interface TaxComparedErrorService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param id 主键
+     * @return 实体
+     */
+    TaxComparedErrorEntity queryObject(Integer mtceId);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<TaxComparedErrorEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param taxComparedError 实体
+     * @return 保存条数
+     */
+    int save(TaxComparedErrorEntity taxComparedError);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param taxComparedError 实体
+     * @return 更新条数
+     */
+    int update(TaxComparedErrorEntity taxComparedError);
+
+    /**
+     * 根据主键删除
+     *
+     * @param mtceId
+     * @return 删除条数
+     */
+    int delete(Integer mtceId);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param mtceIds
+     * @return 删除条数
+     */
+    int deleteBatch(Integer[]mtceIds);
+
+    /**
+     * 税单对比
+     * @return
+     * @param comparedDate
+     */
+    String comparedTaxOrder(String comparedDate);
+}

+ 88 - 0
kmall-admin/src/main/java/com/kmall/admin/service/compared/TaxInfoService.java

@@ -0,0 +1,88 @@
+package com.kmall.admin.service.compared;
+
+
+import com.kmall.admin.dto.TaxOrderDto;
+import com.kmall.admin.entity.compared.TaxInfoEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Service接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-12-29 14:11:24
+ */
+public interface TaxInfoService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param mtiId 主键
+     * @return 实体
+     */
+    TaxInfoEntity queryObject(Integer mtiId);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<TaxInfoEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param taxInfo 实体
+     * @return 保存条数
+     */
+    int save(TaxInfoEntity taxInfo);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param taxInfo 实体
+     * @return 更新条数
+     */
+    int update(TaxInfoEntity taxInfo);
+
+    /**
+     * 根据主键删除
+     *
+     * @param mtiId
+     * @return 删除条数
+     */
+    int delete(Integer mtiId);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param mtiIds
+     * @return 删除条数
+     */
+    int deleteBatch(Integer[]mtiIds);
+
+    /**
+     * 上传税单
+     * @param taxOrderDtoList
+     * @return
+     */
+    boolean uploadExcel(List<TaxOrderDto> taxOrderDtoList);
+
+    void updateBatch(List<TaxInfoEntity> taxInfoEntities);
+
+    /**
+     * 逻辑删除全部数据
+     */
+    void deleteAll();
+}

+ 68 - 6
kmall-admin/src/main/java/com/kmall/admin/service/impl/BrandServiceImpl.java

@@ -10,13 +10,13 @@ import com.kmall.common.utils.MapBeanUtil;
 import com.kmall.common.utils.R;
 import com.kmall.common.utils.RRException;
 import com.kmall.common.utils.ValidatorUtil;
+import com.kmall.manager.manager.express.sf.ServiceException;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * Service实现类
@@ -35,6 +35,8 @@ public class BrandServiceImpl implements BrandService {
     private StoreDao storeDao;
     @Autowired
     private CategoryDao categoryDao;
+    @Autowired
+    private MerchDao merchDao;
 
     @Override
     public BrandEntity queryObject(Integer id) {
@@ -187,11 +189,71 @@ public class BrandServiceImpl implements BrandService {
      */
     @Override
     public String queryBrandName(String prodBarcode, String storeId) {
-        return brandDao.queryBrandName(prodBarcode,storeId);
+        return brandDao.queryBrandName(prodBarcode, storeId);
     }
 
     @Override
     public BrandEntity queryByCategoryIdAndBrandNameAndMerchSn(Integer categoryId, String name, String merchSn) {
-        return brandDao.queryByCategoryIdAndBrandNameAndMerchSn(categoryId,name,merchSn);
+        return brandDao.queryByCategoryIdAndBrandNameAndMerchSn(categoryId, name, merchSn);
+    }
+
+    @Override
+    public List<BrandEntity> queryExportList(Map<String, Object> params) {
+        return brandDao.queryExportList(params);
+    }
+
+    @Override
+    @Transactional
+    public void uploadExcel(List<BrandEntity> brandEntityList) {
+        if (brandEntityList != null && brandEntityList.size() > 0) {
+            for (int i = 0; i < brandEntityList.size(); i++) {
+                BrandEntity brandEntity = brandEntityList.get(i);
+                Integer brandId = brandEntity.getId();
+                String merchSn = brandEntity.getMerchSn();
+                Integer categoryId = brandEntity.getCategoryId();
+                Integer isShow = brandEntity.getIsShow();
+                Integer isNew = brandEntity.getIsNew();
+                MerchEntity merchEntity = merchDao.findByMerchSn(merchSn);
+
+                if (isShow.intValue() != 0 && isShow.intValue() != 1 && isNew.intValue() != 0 && isNew != 1) {
+                    throw new ServiceException("第" + (i + 1) + "行的是否显示或者是否新品牌只可填(0:否 1:是)");
+                }
+
+                if (Objects.isNull(merchEntity)) {
+                    throw new ServiceException("第" + (i + 1) + "行的该商户编号:【" + merchSn + "】不存在!");
+                }
+                CategoryEntity categoryEntity = categoryDao.queryObject(categoryId);
+                if (Objects.isNull(categoryEntity)) {
+                    throw new ServiceException("第" + (i + 1) + "行的所属分类id" +
+                            ":【" + categoryId + "】不存在!");
+                }
+
+
+                // 如果是0就添加数据
+                if (brandId.intValue() == 0) {
+                    BrandEntity queryBrandEntity = brandDao.queryByCategoryIdAndBrandNameAndMerchSn(categoryId, brandEntity.getName(), merchSn);
+                    if (Objects.nonNull(queryBrandEntity)){
+                        throw new ServiceException("第" + (i + 1) + "行的该品牌:【" + queryBrandEntity.getName() + "】已存在!");
+                    }
+                    BrandEntity insertBrandEntity = new BrandEntity();
+                    insertBrandEntity.setName(brandEntity.getName());
+                    insertBrandEntity.setSimpleDesc(brandEntity.getSimpleDesc());
+                    insertBrandEntity.setIsShow(isShow);
+                    insertBrandEntity.setIsNew(isNew);
+                    insertBrandEntity.setMerchSn(merchSn);
+                    insertBrandEntity.setCategoryId(categoryId);
+                    insertBrandEntity.setCategoryLevel(categoryEntity.getLevel());
+                    brandDao.save(insertBrandEntity);
+                } else {
+                    BrandEntity updateBrandEntity = brandDao.queryObject(brandId);
+                    if (Objects.isNull(updateBrandEntity)) {
+                        throw new ServiceException("第" + (i + 1) + "行的该品牌编号:【" + brandId + "】不存在!");
+                    }
+                    BeanUtils.copyProperties(brandEntity,updateBrandEntity);
+                    updateBrandEntity.setCategoryLevel(categoryEntity.getLevel());
+                    brandDao.update(updateBrandEntity);
+                }
+            }
+        }
     }
 }

+ 245 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsProductServiceImpl.java

@@ -0,0 +1,245 @@
+package com.kmall.admin.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.google.gson.Gson;
+import com.kmall.admin.dao.GoodsProductDao;
+import com.kmall.admin.dto.GoodsProductDto;
+import com.kmall.admin.dto.PdProductDtoInfo;
+import com.kmall.admin.entity.GoodsProductEntity;
+import com.kmall.admin.service.GoodsProductService;
+import com.kmall.admin.utils.OkHttpUtils;
+import com.kmall.admin.utils.ShiroUtils;
+import com.kmall.admin.utils.data.response.ResponseMessage;
+import com.kmall.admin.utils.oms.OmsSign;
+import com.kmall.common.utils.RRException;
+import com.kmall.manager.manager.merch.OmsMerchProperties;
+import okhttp3.Request;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * 产品信息备案表Service实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-28 16:26:42
+ */
+@Service("goodsProductService")
+public class GoodsProductServiceImpl implements GoodsProductService {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(GoodsProductServiceImpl.class);
+    @Autowired
+    private GoodsProductDao goodsProductDao;
+
+    @Autowired
+    private OmsMerchProperties omsMerchProperties;
+
+    @Override
+    public GoodsProductEntity queryObject(Integer mallGoodsProductSn) {
+        return goodsProductDao.queryObject(mallGoodsProductSn);
+    }
+
+    @Override
+    public List<GoodsProductEntity> queryList(Map<String, Object> map) {
+        return goodsProductDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        return goodsProductDao.queryTotal(map);
+    }
+
+    @Override
+    public int save(GoodsProductEntity goodsProduct) {
+        return goodsProductDao.save(goodsProduct);
+    }
+
+    @Override
+    public int update(GoodsProductEntity goodsProduct) {
+        return goodsProductDao.update(goodsProduct);
+    }
+
+    @Override
+    public int delete(Integer mallGoodsProductSn) {
+        return goodsProductDao.delete(mallGoodsProductSn);
+    }
+
+    @Override
+    public int deleteBatch(Integer[]mallGoodsProductSns) {
+        return goodsProductDao.deleteBatch(mallGoodsProductSns);
+    }
+
+    @Override
+    @Transactional
+    public void uploadExcel(List<GoodsProductDto> goodsProductDtoList) {
+        if (Objects.nonNull(goodsProductDtoList) && goodsProductDtoList.size()>0){
+            int count =1;
+            for (GoodsProductDto goodsProductDto : goodsProductDtoList) {
+                if (StringUtils.isEmpty(goodsProductDto.getMerchSn())) {
+                    throw new RRException("第" + count + "行的商户编号为空!");
+                }
+                if (StringUtils.isEmpty(goodsProductDto.getSku())) {
+                    throw new RRException("第" + count + "行的SKU为空!");
+                }
+                if (StringUtils.isEmpty(goodsProductDto.getProdBarcode())) {
+                    throw new RRException("第" + count + "行的商品条形码为空!");
+                }
+                if (StringUtils.isEmpty(goodsProductDto.getProdName())) {
+                    throw new RRException("第" + count + "行的品名为空!");
+                }
+                if (StringUtils.isEmpty(goodsProductDto.getProdBrand())) {
+                    throw new RRException("第" + count + "行的品牌为空!");
+                }
+                if (StringUtils.isEmpty(goodsProductDto.getUnitCode())) {
+                    throw new RRException("第" + count + "行的计量单位为空!");
+                }
+                if (StringUtils.isEmpty(goodsProductDto.getCusGoodsCode())) {
+                    throw new RRException("第" + count + "行的海关商品编码为空!");
+                }
+                if (StringUtils.isEmpty(goodsProductDto.getCusDeclEle())) {
+                    throw new RRException("第" + count + "行的申报要素为空!");
+                }
+                if (StringUtils.isEmpty(goodsProductDto.getOriCntCode())) {
+                    throw new RRException("第" + count + "行的原产国代码为空!");
+                }
+                if (StringUtils.isEmpty(goodsProductDto.getCiqProdModel())) {
+                    throw new RRException("第" + count + "行的规格型号为空!");
+                }
+                if (StringUtils.isEmpty(goodsProductDto.getCiqMainEle())) {
+                    throw new RRException("第" + count + "行的主要成分为空!");
+                }
+                if (StringUtils.isEmpty(goodsProductDto.getDeclCurrencyCode())) {
+                    throw new RRException("第" + count + "行的申报币种代码为空!");
+                }
+                if (StringUtils.isEmpty(goodsProductDto.getNetWeight())) {
+                    throw new RRException("第" + count + "行的单个净重为空!");
+                }
+                if (StringUtils.isEmpty(goodsProductDto.getDeclPrice())) {
+                    throw new RRException("第" + count + "行的申报价格为空!");
+                }
+                if (StringUtils.isEmpty(goodsProductDto.getLegalUnit1Qty())) {
+                    throw new RRException("第" + count + "行的第一法定单位数量为空!");
+                }
+                if (StringUtils.isEmpty(goodsProductDto.getLegalUnit2Qty())) {
+                    throw new RRException("第" + count + "行的第二法定单位数量为空!");
+                }
+                GoodsProductEntity queryProduct = goodsProductDao.selectByParams(goodsProductDto.getSku(), goodsProductDto.getMerchSn(),goodsProductDto.getThirdMerchSn());
+                if (Objects.nonNull(queryProduct)){
+                    throw new RRException("该sku:"+queryProduct.getSku()+"已存在!");
+                }
+                GoodsProductEntity goodsProductEntity = new GoodsProductEntity();
+                BeanUtils.copyProperties(goodsProductDto,goodsProductEntity);
+                goodsProductEntity.setCreateTime(new Date());
+                goodsProductEntity.setCreaterSn(ShiroUtils.getUserId().toString());
+                goodsProductDao.save(goodsProductEntity);
+                count ++;
+            }
+        }
+    }
+
+    @Override
+    @Transactional
+    public String sendSelectProduct(Integer[] mallGoodsProductSns) {
+        List<GoodsProductEntity> goodsProductEntityList = goodsProductDao.selectByMallGoodsProductSns(mallGoodsProductSns);
+        List<GoodsProductDto> goodsProductDtoList = new ArrayList<>();
+        for (GoodsProductEntity goodsProductEntity : goodsProductEntityList) {
+            GoodsProductDto dto = new GoodsProductDto();
+            BeanUtils.copyProperties(goodsProductEntity,dto);
+            dto.setLegalUnit1Qty(goodsProductEntity.getLegalUnit1Qty().toString());
+            dto.setLegalUnit2Qty(goodsProductEntity.getLegalUnit2Qty().toString());
+            dto.setNetWeight(goodsProductEntity.getNetWeight().toString());
+            dto.setGrossWeight(goodsProductEntity.getGrossWeight().toString());
+            dto.setDeclPrice(goodsProductEntity.getDeclPrice().toString());
+            goodsProductDtoList.add(dto);
+        }
+        try {
+            ResponseMessage result = requestOmsProduct(goodsProductDtoList);
+            return result.getMsg();
+        }catch (Exception e){
+            e.printStackTrace();
+            LOGGER.error(e.getMessage());
+        }
+
+        return "请求失败,请联系管理员";
+    }
+
+    @Override
+    @Transactional
+    public String sendAllProduct() {
+        List<GoodsProductEntity> goodsProductEntityList = goodsProductDao.queryList(new HashMap<>());// 查询所有
+        if (goodsProductEntityList == null || goodsProductEntityList.size()==0){
+            return "无数据,请添加数据";
+        }
+        List<GoodsProductDto> goodsProductDtoList = new ArrayList<>();
+        for (GoodsProductEntity goodsProductEntity : goodsProductEntityList) {
+            GoodsProductDto dto = new GoodsProductDto();
+            BeanUtils.copyProperties(goodsProductEntity,dto);
+            dto.setLegalUnit1Qty(goodsProductEntity.getLegalUnit1Qty().toString());
+            dto.setLegalUnit2Qty(goodsProductEntity.getLegalUnit2Qty().toString());
+            dto.setNetWeight(goodsProductEntity.getNetWeight().toString());
+            dto.setGrossWeight(goodsProductEntity.getGrossWeight().toString());
+            dto.setDeclPrice(goodsProductEntity.getDeclPrice().toString());
+            goodsProductDtoList.add(dto);
+        }
+        try {
+            ResponseMessage result = requestOmsProduct(goodsProductDtoList);
+            return result.getMsg();
+        }catch (Exception e){
+            e.printStackTrace();
+            LOGGER.error(e.getMessage());
+        }
+        return "请求失败,请联系管理员";
+    }
+
+
+    private ResponseMessage requestOmsProduct(List<GoodsProductDto> goodsProductDtoList){
+        Map<String, String> sParaTemp = new TreeMap<String, String>();
+        PdProductDtoInfo pdProductDtoInfo = new PdProductDtoInfo();
+        pdProductDtoInfo.setPdProductDtoList(goodsProductDtoList);
+        sParaTemp.put("data", JSON.toJSONString(pdProductDtoInfo));
+        LOGGER.info("请求omsdata数据:" + sParaTemp.get("data"));
+        sParaTemp.put("merchId",omsMerchProperties.getMerchSn());
+        String timestamp = String.valueOf(System.currentTimeMillis()/1000);
+        sParaTemp.put("timestamp", timestamp);
+        //生成要请求给oms秘钥
+//        String sign = OmsSign.sign(sParaTemp,cus.getWaybill().get("secret-key"));
+        LOGGER.info("md5混淆码参数:" + omsMerchProperties.getMd5Salt());
+        String sign = OmsSign.sign(sParaTemp,omsMerchProperties.getMd5Salt());
+        sParaTemp.put("sign", sign);
+        //构建Request
+        String  url = omsMerchProperties.getAddPdProductListUrl();
+        Request request = com.kmall.admin.utils.oms.OkHttpUtils.buildRequest(url, JSON.toJSONString(sParaTemp));
+        LOGGER.info("oms的请求报文:" + request);
+        // 同步访问,返回结果字符串
+        String responseString = null;
+        try {
+
+            responseString = com.kmall.admin.utils.oms.OkHttpUtils.post(request);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        LOGGER.info("oms的响应报文"+responseString);
+        //解析响应数据
+        Gson gson = new Gson();
+        ResponseMessage result = gson.fromJson(responseString, ResponseMessage.class);
+        if(result == null){
+            String info = "解析响应数据Result失败";
+            LOGGER.error("--- {}", info);
+            throw new RuntimeException(info);
+        }
+       return result;
+    }
+
+
+
+}

+ 336 - 12
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java

@@ -1,20 +1,25 @@
 package com.kmall.admin.service.impl;
 
 import cn.hutool.http.HttpUtil;
-import com.alibaba.druid.support.json.JSONUtils;
 import com.alibaba.fastjson.JSON;
 import com.google.common.collect.ImmutableBiMap;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.google.gson.Gson;
 import com.kmall.admin.dao.*;
 import com.kmall.admin.dto.GoodsDetailsDto;
 import com.kmall.admin.dto.GoodsDto;
 import com.kmall.admin.dto.GoodsPanoramaDto;
 import com.kmall.admin.entity.*;
+import com.kmall.admin.entity.kmall2eccs.KtoEccsEntity;
 import com.kmall.admin.entity.mk.MkActivitiesEntity;
+import com.kmall.admin.entity.shop.ShopErrorPriceRecordEntity;
 import com.kmall.admin.service.*;
+import com.kmall.admin.service.kmall2eccs.KtoEccsService;
 import com.kmall.admin.service.mk.MkActivitiesService;
 import com.kmall.admin.service.mk.MkActivityFormService;
 import com.kmall.admin.service.GoodsService;
+import com.kmall.admin.service.shop.ShopErrorPriceRecordService;
 import com.kmall.admin.utils.CalculateTax;
 import com.kmall.admin.utils.GoodsUtils;
 import com.kmall.admin.utils.ShiroUtils;
@@ -22,8 +27,6 @@ import com.kmall.api.entity.exportpdf.PDFGoodsDto;
 import com.kmall.common.constant.Dict;
 import com.kmall.admin.fromcomm.entity.SysUserEntity;
 import com.kmall.common.utils.*;
-import com.kmall.common.utils.print.ticket.item.Goods;
-import org.apache.poi.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -110,6 +113,11 @@ public class GoodsServiceImpl implements GoodsService {
     @Autowired
     private BrandService brandService;
 
+    @Autowired
+    private ShopErrorPriceRecordService shopErrorPriceRecordService;
+
+    @Autowired
+    private KtoEccsService ktoEccsService;
 
     @Override
     public GoodsEntity queryObject(Integer id) {
@@ -763,6 +771,20 @@ public class GoodsServiceImpl implements GoodsService {
         List<String> failGoodsSnList = new ArrayList<>();
         List<String> failGoodsTypeList = new ArrayList<>();
 //        List<String> failFreightList = new ArrayList<>();
+
+
+        // 定义需要批量插入的list
+        List<ProductEntity> insertProductList = new LinkedList<>();
+        List<GoodsSpecificationEntity> insertSpecificationList = new LinkedList<>();
+        List<MngChangeEntity> insertMngChangeList = new LinkedList<>();
+        List<GoodsEntity> insertGoodsList = new LinkedList<>();
+        List<SupplierEntity> insertSupplierList = new LinkedList<>();
+
+        // 定义需要批量修改的list
+        List<ProductEntity> updateProductList = new LinkedList<>();
+        List<GoodsSpecificationEntity> updateSpecificationList = new LinkedList<>();
+        List<GoodsEntity> updateGoodsList = new LinkedList<>();
+
         if (goodsEntityList != null && goodsEntityList.size() > 0) {
             for (int i = 0; i < goodsEntityList.size(); i++) {
                 GoodsDto goodsDto = goodsEntityList.get(i);
@@ -879,7 +901,10 @@ public class GoodsServiceImpl implements GoodsService {
                         supplierEntity.setChildSupplierFlag(goodsDto.getSupplierFlag());
                         supplierEntity.setIsShow("0");
 
-                        supplierDao.save(supplierEntity);
+                        // TODO 这里改成批量插入 SupplierEntity
+                        insertSupplierList.add(supplierEntity);
+
+//                        supplierDao.save(supplierEntity);
 //                        supplierEntity = supplierDao.queryObjectByName(goodsDto.getSupplierName(), thirdMerchantBizEntity.getMerchSn(),thirdMerchantBizEntity.getThirdPartyMerchCode());
                         goodsEntity.setSupplierId(supplierEntity.getId());
                     } else {
@@ -935,9 +960,11 @@ public class GoodsServiceImpl implements GoodsService {
 
                     if(goodsDto.getGoodsRate().indexOf("%") != -1){
                         goodsDto.setGoodsRate(goodsDto.getGoodsRate().substring(0, goodsDto.getGoodsRate().indexOf("%")));
+                        goodsEntity.setGoodsRate(BigDecimal.valueOf(Double.valueOf(goodsDto.getGoodsRate())).divide(new BigDecimal(100), 4, BigDecimal.ROUND_HALF_UP));
+                    }else{
+                        goodsEntity.setGoodsRate(BigDecimal.valueOf(Double.valueOf(goodsDto.getGoodsRate())));
                     }
 
-                    goodsEntity.setGoodsRate(BigDecimal.valueOf(Double.valueOf(goodsDto.getGoodsRate())).divide(new BigDecimal(100), 4, BigDecimal.ROUND_HALF_UP));
                 }
 
                 goodsEntity.setIsOnSale(Integer.parseInt(goodsDto.getIsOnSaleStr()));
@@ -983,25 +1010,32 @@ public class GoodsServiceImpl implements GoodsService {
                         mngChangeEntity.setValidNum(goods.getGoodsNumber() + Integer.parseInt(goodsDto.getGoodsNumber()));//可用数
                         mngChangeEntity.setChangeNum(Integer.parseInt(goodsDto.getGoodsNumber()));//变化数
                         mngChangeEntity.setChangeType(Dict.changeType.item_3.getItem());
-                        mngChangeEntity.setGoodsId(Integer.parseInt(String.valueOf(goods.getId())));
+                        mngChangeEntity.setGoodsId(goods.getId().intValue());
 
                         goodsEntity.setId(goods.getId());
                         goodsEntity.setGoodsNumber(goods.getGoodsNumber()+Integer.parseInt(goodsDto.getGoodsNumber()));
-                        goodsDao.update(goodsEntity);
+
+                        // TODO 这里改成批量修改 GoodsEntity
+                        updateGoodsList.add(goodsEntity);
+//                        goodsDao.update(goodsEntity);
                     }else{
                         mngChangeEntity.setOriginalNum(0);//原库存数
                         mngChangeEntity.setValidNum(Integer.parseInt(goodsDto.getGoodsNumber()));//可用数
                         mngChangeEntity.setChangeNum(Integer.parseInt(goodsDto.getGoodsNumber()));//变化数
                         mngChangeEntity.setChangeType(Dict.changeType.item_2.getItem());
 
+                        // TODO 这里改成批量插入 GoodsEntity
+
                         goodsDao.save(goodsEntity);
+                        insertGoodsList.add(goodsEntity);
                         mngChangeEntity.setGoodsId(goodsEntity.getId().intValue());
                     }
 
 
+                    // TODO 这里改成批量插入 MngChangeEntity
 
-
-                    mngChangeDao.save(mngChangeEntity);
+//                    mngChangeDao.save(mngChangeEntity);
+                    insertMngChangeList.add(mngChangeEntity);
 //                    // 保税商品修改各个门店商品价格
 //                    if (!Dict.orderBizType.item_11.getItem().equals(goodsDto.getGoodsBizType())) {
 //                        List<ProductStoreRelaEntity> productStoreRelaEntityList = productStoreRelaDao.queryByGoodsId(goodsDto.getId());
@@ -1025,11 +1059,18 @@ public class GoodsServiceImpl implements GoodsService {
                             goodsSpecification.setGoodsId(goodsEntity.getId());
                             goodsSpecification.setValue(goodsEntity.getCiqProdModel());
                             goodsSpecification.setSpecificationId(1);
+
+
+                            // TODO 这里改成批量插入 GoodsSpecificationEntity
                             goodsSpecificationDao.save(goodsSpecification);
+//                            insertSpecificationList.add(goodsSpecification);
                         }else {
                             goodsSpecification.setValue(goodsDto.getCiqProdModel());
                             goodsSpecification.setId(specificationEntity.getId());
-                            goodsSpecificationDao.update(goodsSpecification);
+
+                            // TODO 这里改成批量更新 GoodsSpecificationEntity
+//                            goodsSpecificationDao.update(goodsSpecification);
+                            updateSpecificationList.add(goodsSpecification);
                         }
                         if(product == null){
                             product = new ProductEntity();
@@ -1039,15 +1080,98 @@ public class GoodsServiceImpl implements GoodsService {
                             product.setGoodsNumber(goodsEntity.getGoodsNumber());
                             product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
                             product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
-                            productDao.save(product);
+
+                            // TODO 这里改成批量插入 ProductEntity
+                            insertProductList.add(product);
+//                            productDao.save(product);
                         }else{
                             product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
                             product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
-                            productDao.update(product);
+
+                            // TODO 这里改成批量更新 ProductEntity
+                            updateProductList.add(product);
+//                            productDao.update(product);
                         }
                     }
                 }
             }
+
+            // 批量插入数据
+            if(insertProductList != null && insertProductList.size() > 0) {
+                // 长度限制,如果大于50,就分多次插入
+                if(insertProductList.size() > 50){
+                    List<List<ProductEntity>> partition = Lists.partition(insertProductList, 50);
+                    for (List<ProductEntity> productEntities : partition) {
+                        productDao.saveBatch(productEntities);
+                    }
+                }else{
+                    productDao.saveBatch(insertProductList);;
+
+                }
+            }
+//            if(insertSpecificationList != null && insertSpecificationList.size() > 0) {
+//                goodsSpecificationDao.saveBatch(insertSpecificationList);
+//            }
+            if(insertMngChangeList != null && insertMngChangeList.size() > 0 ){
+                if(insertMngChangeList.size() > 50){
+                    List<List<MngChangeEntity>> partition = Lists.partition(insertMngChangeList, 50);
+                    for (List<MngChangeEntity> mngChangeEntities : partition) {
+                        mngChangeDao.saveBatch(mngChangeEntities);
+                    }
+                }else{
+                    mngChangeDao.saveBatch(insertMngChangeList);
+
+                }
+            }
+//            if(insertGoodsList != null && insertGoodsList.size() > 0 ){
+//                goodsDao.saveBatch(insertGoodsList);
+//            }
+            if(insertSupplierList != null && insertSupplierList.size() > 0 ){
+                if(insertSupplierList.size() > 50){
+                    List<List<SupplierEntity>> partition = Lists.partition(insertSupplierList, 50);
+                    for (List<SupplierEntity> supplierEntities : partition) {
+                        supplierDao.saveBatch(supplierEntities);
+                    }
+                }else{
+                    supplierDao.saveBatch(insertSupplierList);
+
+                }
+            }
+            // 批量更新数据
+            if(updateProductList != null && updateProductList.size() > 0 ){
+
+                if(updateProductList.size() > 50){
+                    List<List<ProductEntity>> partition = Lists.partition(updateProductList, 50);
+                    for (List<ProductEntity> productEntities : partition) {
+                        productDao.updateBatch(productEntities);
+                    }
+                }else{
+                    productDao.updateBatch(updateProductList);
+                }
+            }
+            if(updateSpecificationList != null && updateSpecificationList.size() > 0 ){
+                if(updateSpecificationList.size() > 50){
+                    List<List<GoodsSpecificationEntity>> partition = Lists.partition(updateSpecificationList, 50);
+                    for (List<GoodsSpecificationEntity> goodsSpecificationEntities : partition) {
+                        goodsSpecificationDao.updateBatch(goodsSpecificationEntities);
+                    }
+                }else{
+                    goodsSpecificationDao.updateBatch(updateSpecificationList);
+                }
+            }
+            if(updateGoodsList != null && updateGoodsList.size() > 0 ){
+                if(updateGoodsList.size() > 50){
+                    List<List<GoodsEntity>> partition = Lists.partition(updateGoodsList, 50);
+                    for (List<GoodsEntity> goodsEntities : partition) {
+                        goodsDao.updateBatch(goodsEntities);
+                    }
+                }else{
+                    goodsDao.updateBatch(updateGoodsList);
+                }
+            }
+
+
+
             ExportExceptionDataEntity exportExceptionDataEntity = new ExportExceptionDataEntity();
             exportExceptionDataEntity.setCreaterSn(user.getUserId().toString());
             exportExceptionDataEntity.setUserId(user.getUserId().intValue());
@@ -1134,6 +1258,38 @@ public class GoodsServiceImpl implements GoodsService {
                 goodsUtils.save(exportExceptionDataEntity);
                 throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
             }
+
+
+            // 将插入的商品和更新的商品放到一个list中
+            List<GoodsEntity> goodsEntities = new LinkedList<>();
+            goodsEntities.addAll(insertGoodsList);
+            goodsEntities.addAll(updateGoodsList);
+
+            List<KtoEccsEntity> ktoEccsEntities = new LinkedList<>();
+            if(goodsEntities.size() > 0){
+                for (GoodsEntity goodsEntity : goodsEntities) {
+                    KtoEccsEntity ktoEccsEntity = new KtoEccsEntity();
+                    ktoEccsEntity.setRequestData(JSON.toJSONString(goodsEntity));
+                    ktoEccsEntity.setRequestType("01");
+                    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);
+                }
+            }
+
         }else{
             throw new RRException("导入数据为空,或者检查商品编码数据是否为空");
         }
@@ -1901,5 +2057,173 @@ public class GoodsServiceImpl implements GoodsService {
         goodsDao.update(updateGoods);
     }
 
+    @Override
+    public void checkGoodsPrice(SysUserEntity user) {
+
+
+        Map<String, BigDecimal> hsCodeMap = CalculateTax.hsCodeMap;
+        Set<String> hdCodeSet = hsCodeMap.keySet();
+
+        List<Map<String,String>> errorPriceSkuList = new LinkedList<>();
+
+        // 保存各种异常价格对象集合
+        List<ShopErrorPriceRecordEntity> shopErrorPriceRecordEntities = new LinkedList<>();
+
+
+        // 查询所有特殊化妆品的商品
+        List<GoodsEntity> queryGoodsDetails = goodsDao.querySpecialCosmetics(hdCodeSet);
+        for (GoodsEntity goodsEntity : queryGoodsDetails) {
+            calculateShopPrice(user,goodsEntity,errorPriceSkuList,shopErrorPriceRecordEntities);
+            calculateDailyPrice(user,goodsEntity,errorPriceSkuList,shopErrorPriceRecordEntities);
+            calculeatePromotion(user,goodsEntity,errorPriceSkuList,shopErrorPriceRecordEntities);
+        }
+
+        if(shopErrorPriceRecordEntities.size() != 0){
+            shopErrorPriceRecordService.saveBatch(shopErrorPriceRecordEntities);
+        }
+
+
+    }
+
+    @Override
+    public List<GoodsEntity> queryAllList() {
+        return goodsDao.queryAllList();
+    }
+
+    private void calculeatePromotion(SysUserEntity user, GoodsEntity goods, List<Map<String, String>> errorPriceSkuList, List<ShopErrorPriceRecordEntity> shopErrorPriceRecordEntities) {
+        String prodBarcode = goods.getProdBarcode();
+        String storeId = goods.getStoreId()+"";
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        /**
+         * 2.查询当前时间,该门店是否有活动,如果有活动,查询开启了哪些营销方式
+         * 参数: 当前时间  门店id
+         */
+        MkActivitiesPromotionEntity promotionEntity = promotionService.queryByDateAndBarcode(storeId,format.format(new Date()),"lscx",prodBarcode);
+
+
+        // 如果该商品存在临时促销,直接替换活动价格
+        if(promotionEntity == null){
+            return ;
+        }
+        goods.setActualPaymentAmount(promotionEntity.getActivityPrice());
+        goods.setRetailPrice(promotionEntity.getActivityPrice());
+        goods.setActivity("临时促销");
+        try {
+            CalculateTax.calculateFinalTax(goods,goods.getActualPaymentAmount(),this).setScale(3,RoundingMode.HALF_UP);
+        } catch (Exception e) {
+            ShopErrorPriceRecordEntity shopErrorPriceRecordEntity = new ShopErrorPriceRecordEntity();
+            shopErrorPriceRecordEntity.setMerchSn(goods.getMerchSn());
+            shopErrorPriceRecordEntity.setThirdMerchSn(goods.getThirdPartyMerchCode());
+            shopErrorPriceRecordEntity.setShopSn(goods.getStoreId()+"");
+            shopErrorPriceRecordEntity.setPriceType(3); // 3 是临时促销
+            shopErrorPriceRecordEntity.setSku(goods.getSku());
+            shopErrorPriceRecordEntity.setBarcode(goods.getProdBarcode());
+            shopErrorPriceRecordEntity.setVerifier(user.getUserId()+"");
+            shopErrorPriceRecordEntity.setCheckTime(new Date());
+            shopErrorPriceRecordEntity.setCreaterSn(user.getUserId()+"");
+            shopErrorPriceRecordEntity.setCreateTime(new Date());
+            shopErrorPriceRecordEntity.setCurrentPrice(goods.getActualPaymentAmount().toString());
+            if(e.getMessage().contains("-")){
+                String suggestPrice = e.getMessage().split("-")[0];
+                String highestPrice = e.getMessage().split("-")[1];
+                String lowestPrice = e.getMessage().split("-")[2];
+                shopErrorPriceRecordEntity.setSuggestedPrice(suggestPrice);
+                shopErrorPriceRecordEntity.setLowestPrice(lowestPrice);
+                shopErrorPriceRecordEntity.setHighestPrice(highestPrice);
+            }
+            shopErrorPriceRecordEntity.setMkaId(promotionEntity.getMkaId());
+            shopErrorPriceRecordEntities.add(shopErrorPriceRecordEntity);
+        }
+
+    }
+
+    private void calculateDailyPrice(SysUserEntity user, GoodsEntity goods, List<Map<String, String>> errorPriceSkuList, List<ShopErrorPriceRecordEntity> shopErrorPriceRecordEntities) {
+        String prodBarcode = goods.getProdBarcode();
+        String storeId = goods.getStoreId()+"";
+        /**
+         * 2.查询当前时间,该门店是否有活动,如果有活动,查询开启了哪些营销方式
+         * 参数: 当前时间  门店id
+         */
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+        /**
+         * 日常活动跟着条形码走,优先级比临时促销低,但是高于正常价格
+         */
+        MkDailyActivitiesEntity dailyActivitiesEntity = dailyActivitiesService.queryByDateAndBarcode(storeId,format.format(new Date()),"rchd",prodBarcode);
+        if(dailyActivitiesEntity == null){
+            return ;
+        }
+        goods.setActualPaymentAmount(dailyActivitiesEntity.getActivityPrice());
+        goods.setRetailPrice(dailyActivitiesEntity.getActivityPrice());
+        goods.setActivity("日常活动");
+        // 计算税费
+        try {
+            CalculateTax.calculateFinalTax(goods,goods.getActualPaymentAmount(),this).setScale(3,RoundingMode.HALF_UP);
+        } catch (Exception e) {
+            // 记录有异常的sku
+            ShopErrorPriceRecordEntity shopErrorPriceRecordEntity = new ShopErrorPriceRecordEntity();
+            shopErrorPriceRecordEntity.setMerchSn(goods.getMerchSn());
+            shopErrorPriceRecordEntity.setThirdMerchSn(goods.getThirdPartyMerchCode());
+            shopErrorPriceRecordEntity.setShopSn(goods.getStoreId()+"");
+            shopErrorPriceRecordEntity.setPriceType(2); // 2 是日常活动
+            shopErrorPriceRecordEntity.setSku(goods.getSku());
+            shopErrorPriceRecordEntity.setBarcode(goods.getProdBarcode());
+            shopErrorPriceRecordEntity.setVerifier(user.getUserId()+"");
+            shopErrorPriceRecordEntity.setCheckTime(new Date());
+            shopErrorPriceRecordEntity.setCreaterSn(user.getUserId()+"");
+            shopErrorPriceRecordEntity.setCreateTime(new Date());
+            shopErrorPriceRecordEntity.setCurrentPrice(goods.getActualPaymentAmount().toString());
+            if(e.getMessage().contains("-")){
+                String suggestPrice = e.getMessage().split("-")[0];
+                String highestPrice = e.getMessage().split("-")[1];
+                String lowestPrice = e.getMessage().split("-")[2];
+                shopErrorPriceRecordEntity.setSuggestedPrice(suggestPrice);
+                shopErrorPriceRecordEntity.setLowestPrice(lowestPrice);
+                shopErrorPriceRecordEntity.setHighestPrice(highestPrice);
+            }
+            shopErrorPriceRecordEntity.setMkaId(dailyActivitiesEntity.getMkaId());
+            shopErrorPriceRecordEntities.add(shopErrorPriceRecordEntity);
+        }
+
+    }
+
+    private void calculateShopPrice(SysUserEntity user, GoodsEntity goods, List<Map<String, String>> errorPriceSkuList, List<ShopErrorPriceRecordEntity> shopErrorPriceRecordEntities) {
+
+
+        goods.setDiscountedPrice(new BigDecimal(0));
+        BigDecimal retailPrice = goods.getRetailPrice();
+        goods.setActualPaymentAmount(retailPrice.setScale(2,RoundingMode.HALF_UP));
+
+        // 计算税费
+        try {
+            CalculateTax.calculateFinalTax(goods,goods.getActualPaymentAmount(),this).setScale(3,RoundingMode.HALF_UP);
+        } catch (Exception e) {
+            // 记录有异常的sku
+            ShopErrorPriceRecordEntity shopErrorPriceRecordEntity = new ShopErrorPriceRecordEntity();
+            shopErrorPriceRecordEntity.setMerchSn(goods.getMerchSn());
+            shopErrorPriceRecordEntity.setThirdMerchSn(goods.getThirdPartyMerchCode());
+            shopErrorPriceRecordEntity.setShopSn(goods.getStoreId()+"");
+            shopErrorPriceRecordEntity.setPriceType(1); // 1 门店商品价格
+            shopErrorPriceRecordEntity.setSku(goods.getSku());
+            shopErrorPriceRecordEntity.setBarcode(goods.getProdBarcode());
+            shopErrorPriceRecordEntity.setVerifier(user.getUserId()+"");
+            shopErrorPriceRecordEntity.setCheckTime(new Date());
+            shopErrorPriceRecordEntity.setCreaterSn(user.getUserId()+"");
+            shopErrorPriceRecordEntity.setCreateTime(new Date());
+            shopErrorPriceRecordEntity.setCurrentPrice(goods.getActualPaymentAmount().toString());
+            if(e.getMessage().contains("-")){
+                String suggestPrice = e.getMessage().split("-")[0];
+                String highestPrice = e.getMessage().split("-")[1];
+                String lowestPrice = e.getMessage().split("-")[2];
+                shopErrorPriceRecordEntity.setSuggestedPrice(suggestPrice);
+                shopErrorPriceRecordEntity.setLowestPrice(lowestPrice);
+                shopErrorPriceRecordEntity.setHighestPrice(highestPrice);
+            }
+
+            shopErrorPriceRecordEntities.add(shopErrorPriceRecordEntity);
+        }
+
+    }
+
 
 }

+ 26 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/MkActivitiesPromotionServiceImpl.java

@@ -130,4 +130,30 @@ public class MkActivitiesPromotionServiceImpl implements MkActivitiesPromotionSe
     public MkActivitiesPromotionEntity queryByBarCode(String mkaId, String prodBarcode) {
         return mkActivitiesPromotionDao.queryByBarCode(mkaId,prodBarcode);
     }
+
+    /**
+     * 根据条码,门店,当前时间查询
+     *
+     * @param storeId
+     * @param format
+     * @param lscx
+     * @param prodBarcode
+     * @return
+     */
+    @Override
+    public MkActivitiesPromotionEntity queryByDateAndBarcode(String storeId, String format, String lscx, String prodBarcode) {
+        return mkActivitiesPromotionDao.queryByDateAndBarcode(storeId,format,lscx,prodBarcode);
+    }
+
+    /**
+     * 根据sku和活动id批量修改价格
+     *
+     * @param updatePrice
+     * @param sku
+     * @param mkaId
+     */
+    @Override
+    public void updatePriceBySku(String updatePrice, String sku, Long mkaId) {
+        mkActivitiesPromotionDao.updatePriceBySku(updatePrice,sku,mkaId);
+    }
 }

+ 26 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/MkDailyActivitiesServiceImpl.java

@@ -131,4 +131,30 @@ public class MkDailyActivitiesServiceImpl implements MkDailyActivitiesService {
     public MkDailyActivitiesEntity queryByBarCode(String mkaId, String prodBarcode) {
         return mkDailyActivitiesDao.queryByBarCode(mkaId,prodBarcode);
     }
+
+    /**
+     * 根据条码,门店,当前时间查询
+     *
+     * @param storeId
+     * @param format
+     * @param topic
+     * @param prodBarcode
+     * @return
+     */
+    @Override
+    public MkDailyActivitiesEntity queryByDateAndBarcode(String storeId, String format, String topic, String prodBarcode) {
+        return mkDailyActivitiesDao.queryByDateAndBarcode(storeId,format,topic,prodBarcode);
+    }
+
+    /**
+     * 根据sku和活动id批量修改价格
+     *
+     * @param updatePrice
+     * @param sku
+     * @param mkaId
+     */
+    @Override
+    public void updatePriceBySku(String updatePrice, String sku, Long mkaId) {
+        mkDailyActivitiesDao.updatePriceBySku(updatePrice,sku,mkaId);
+    }
 }

+ 20 - 8
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderGoodsServiceImpl.java

@@ -1,6 +1,7 @@
 package com.kmall.admin.service.impl;
 
 import com.kmall.admin.dao.OrderGoodsDao;
+import com.kmall.admin.dto.OrderGoodsDto;
 import com.kmall.admin.entity.OrderGoodsEntity;
 import com.kmall.admin.service.OrderGoodsService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,37 +16,37 @@ import java.util.Map;
 public class OrderGoodsServiceImpl implements OrderGoodsService {
 	@Autowired
 	private OrderGoodsDao orderGoodsDao;
-	
+
 	@Override
 	public OrderGoodsEntity queryObject(Integer id){
 		return orderGoodsDao.queryObject(id);
 	}
-	
+
 	@Override
 	public List<OrderGoodsEntity> queryList(Map<String, Object> map){
 		return orderGoodsDao.queryList(map);
 	}
-	
+
 	@Override
 	public int queryTotal(Map<String, Object> map){
 		return orderGoodsDao.queryTotal(map);
 	}
-	
+
 	@Override
 	public void save(OrderGoodsEntity orderGoods){
 		orderGoodsDao.save(orderGoods);
 	}
-	
+
 	@Override
 	public void update(OrderGoodsEntity orderGoods){
 		orderGoodsDao.update(orderGoods);
 	}
-	
+
 	@Override
 	public void delete(Integer id){
 		orderGoodsDao.delete(id);
 	}
-	
+
 	@Override
 	public void deleteBatch(Integer[] ids){
 		orderGoodsDao.deleteBatch(ids);
@@ -57,5 +58,16 @@ public class OrderGoodsServiceImpl implements OrderGoodsService {
 		map.put("orderId", orderId);
 		return orderGoodsDao.queryListByOrderId(map);
 	}
-	
+
+	/**
+	 * 查询税单
+	 *
+	 * @param format
+	 * @return
+	 */
+	@Override
+	public List<OrderGoodsDto> queryYesterdayTax(String format) {
+		return orderGoodsDao.queryYesterdayTax(format);
+	}
+
 }

+ 7 - 2
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderRefundServiceImpl.java

@@ -52,12 +52,17 @@ public class OrderRefundServiceImpl implements OrderRefundService {
     @Override
     public int update(OrderRefundEntity orderRefund) {
         SysUserEntity user = ShiroUtils.getUserEntity();
+        String username = "system";
+        if(user != null){
+            username =  user.getUsername();
+
+        }
         if (StringUtils.isNotEmpty(orderRefund.getApprovalRemark())) {
             orderRefund.setApprovalTime(new Date());
-            orderRefund.setApprover(user.getUsername());
+            orderRefund.setApprover(username);
             orderRefund.setRefundStatus(3);
         }
-        orderRefund.setModerSn(user.getUsername());
+        orderRefund.setModerSn(username);
         orderRefund.setModTime(new Date());
         return orderRefundDao.update(orderRefund);
     }

+ 405 - 62
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java

@@ -1,8 +1,12 @@
 package com.kmall.admin.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.google.common.collect.ImmutableBiMap;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.google.gson.Gson;
+import com.google.gson.internal.LinkedTreeMap;
 import com.kmall.admin.dao.*;
 import com.kmall.admin.dao.alarm.Mall2LowPriceWarningDao;
 import com.kmall.admin.dao.mk.Mk2GoodsTopicPriceDao;
@@ -16,20 +20,22 @@ import com.kmall.admin.dao.vip.Mall2PointsRulesDao;
 import com.kmall.admin.dto.*;
 import com.kmall.admin.entity.*;
 import com.kmall.admin.entity.OrderProcessRecordEntity;
-import com.kmall.admin.entity.alarm.Mall2LowPriceWarningEntity;
-import com.kmall.admin.entity.mk.Mk2GoodsTopicPriceEntity;
+import com.kmall.admin.entity.kmall2eccs.KtoEccsEntity;
 import com.kmall.admin.entity.mk.store.*;
 import com.kmall.admin.entity.vip.Mall2MemberConsumptionRecordsEntity;
 import com.kmall.admin.entity.vip.Mall2MemberPointsEntity;
 import com.kmall.admin.entity.vip.Mall2PointsRulesEntity;
 import com.kmall.admin.fromcomm.dao.SysConfigDao;
 import com.kmall.admin.service.*;
+import com.kmall.admin.service.kmall2eccs.KtoEccsService;
 import com.kmall.admin.service.mk.store.MkStoreCampMinusService;
 import com.kmall.admin.service.mk.store.MkStoreTicketDiscountService;
 import com.kmall.admin.utils.CalculateTax;
+import com.kmall.admin.utils.data.response.ResponseMessage;
+import com.kmall.admin.utils.data.response.ResponseMessageData;
+import com.kmall.admin.utils.oms.OmsSign;
 import com.kmall.admin.websocket.WebSocketServer;
 import com.kmall.api.entity.*;
-import com.kmall.api.entity.mk.MkStoreTicketDiscountVo;
 import com.kmall.common.utils.ResponseData;
 import com.kmall.common.utils.wechat.WechatMicropayApiResult;
 import com.kmall.common.utils.wechat.WechatReverseApiResult;
@@ -41,6 +47,7 @@ import com.kmall.manager.manager.express.sf.properties.SFUtil;
 import com.kmall.manager.manager.express.sf.entity.SfRouteServiceResponseEntity;
 import com.kmall.manager.manager.express.sf.entity.RouteEntity;
 import com.kmall.manager.manager.express.sf.entity.RouteResponseEntity;
+import com.kmall.manager.manager.merch.OmsMerchProperties;
 import com.kmall.manager.manager.print.ticket.TicketPrintUtil;
 import com.kmall.manager.manager.wechat.WechatUtil;
 import com.kmall.manager.manager.wechat.wxglobal.dto.WechatGlobalRefundApiResult;
@@ -54,7 +61,7 @@ import com.kmall.common.utils.*;
 import com.kmall.common.utils.print.ticket.item.*;
 import com.kmall.manager.manager.express.kdn.KdniaoUtil;
 import com.kmall.common.utils.wechat.WechatRefundApiResult;
-import com.mysql.cj.util.TimeUtil;
+import okhttp3.Request;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -62,18 +69,13 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
-import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.net.InetAddress;
 import java.net.URLDecoder;
-import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
 import java.util.*;
-import java.util.concurrent.TimeUnit;
 
 
 @Service("orderService")
@@ -82,6 +84,9 @@ public class OrderServiceImpl implements OrderService {
     private final Logger LOGGER = LoggerFactory.getLogger(OrderServiceImpl.class);
 
     @Autowired
+    private OmsMerchProperties omsMerchProperties;
+
+    @Autowired
     private OrderDao orderDao;
     @Autowired
     private ShippingDao shippingDao;
@@ -171,6 +176,11 @@ public class OrderServiceImpl implements OrderService {
     private OrderExceptionRecordService orderExceptionRecordService;
 
 
+    @Autowired
+    private KtoEccsService ktoEccsService;
+
+
+
     @Override
     public OrderEntity queryObject(Long id) {
         return orderDao.queryObject(id);
@@ -710,7 +720,61 @@ public class OrderServiceImpl implements OrderService {
         queryStorePromRealUpdateIsScan(order);
     }
 
-    private void updateStock(OrderEntity order, String changeReason) {
+
+    private synchronized void restoreInventory(OrderEntity order, String changeReason) {
+        Map<String, Object> map = new HashMap();
+        SysUserEntity user = ShiroUtils.getUserEntity();
+        map.put("orderId", order.getId());
+        List<OrderGoodsEntity> orderGoodsVoList = orderGoodsDao.queryList(map);
+
+        // TODO 退单的库存明细存入表中,准备发送到中控
+        List<KtoEccsEntity> ktoEccsEntities = new LinkedList<>();
+        for (OrderGoodsEntity orderGoodsEntity : orderGoodsVoList) {
+            ProductStoreRelaEntity storeRelaEntity = productStoreRelaDao
+                    .queryByGoodsIdAndStoreId(order.getStoreId().longValue(), orderGoodsEntity.getGoodsId().longValue());
+            if (null == storeRelaEntity || null == storeRelaEntity.getSellVolume()) {
+                storeRelaEntity.setSellVolume(0);
+            }
+            BigDecimal sellVolume = new BigDecimal(storeRelaEntity.getSellVolume() - orderGoodsEntity.getNumber());//销售量
+            if (sellVolume.compareTo(Constant.ZERO) < 0) {
+                sellVolume = Constant.ZERO;
+            }
+
+            Integer stockNum = 0;
+            GoodsEntity goodsEntity = goodsDao.queryObject(orderGoodsEntity.getGoodsId());
+            if (goodsEntity != null) {
+                stockNum = goodsEntity.getGoodsNumber();
+                //还原商户商品库存
+                resetGoodsStock(stockNum, storeRelaEntity, orderGoodsEntity, sellVolume, changeReason, user);
+            }
+            if (null != storeRelaEntity.getStockNum()) {
+                stockNum = storeRelaEntity.getStockNum();
+                resetStoreGoodsStock(stockNum, storeRelaEntity, orderGoodsEntity, sellVolume, changeReason, user);//还原门店库存
+            }
+
+
+//            orderGoodsVoList
+            KtoEccsEntity ktoEccsEntity = new KtoEccsEntity();
+            ktoEccsEntity.setRequestData(JSON.toJSONString(orderGoodsEntity));
+            ktoEccsEntity.setRequestType("04");
+            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);
+            }
+        }
+    }
+
+    private synchronized void updateStock(OrderEntity order, String changeReason) {
         Map<String, Object> map = new HashMap();
         SysUserEntity user = ShiroUtils.getUserEntity();
         map.put("orderId", order.getId());
@@ -785,10 +849,17 @@ public class OrderServiceImpl implements OrderService {
         if (goodsEntity != null) {
             goodsEntity.setGoodsNumber(stockNum + orderGoodsEntity.getNumber());
 //                        goodsEntity.setSellVolume(Integer.parseInt(goodsSellVolume.toString()));
+            if("oms退单成功,恢复库存".equals(changeReason)){
+                goodsEntity.setToBeRestored(goodsEntity.getToBeRestored() - orderGoodsEntity.getNumber());
+            }
             goodsDao.update(goodsEntity);
 
 //            storeRelaEntity.setSellVolume(Integer.parseInt(sellVolume.toString()));
 //            productStoreRelaDao.update(storeRelaEntity);
+            String username = "system";
+            if(user != null){
+                username = user.getUsername();
+            }
 
             MngChangeEntity mngChangeEntity = new MngChangeEntity();
             mngChangeEntity.setGoodsId(Integer.parseInt(String.valueOf(goodsEntity.getId())));
@@ -800,8 +871,8 @@ public class OrderServiceImpl implements OrderService {
             mngChangeEntity.setValidNum(stockNum + orderGoodsEntity.getNumber());//可用数
             mngChangeEntity.setCreateTime(new Date());
             mngChangeEntity.setModTime(new Date());
-            mngChangeEntity.setCreaterSn(user.getUsername());
-            mngChangeEntity.setModerSn(user.getUsername());
+            mngChangeEntity.setCreaterSn(username);
+            mngChangeEntity.setModerSn(username);
             mngChangeEntity.setIsValid(0);
             mngChangeEntity.setMerchSn(goodsEntity.getMerchSn());
             mngChangeDao.save(mngChangeEntity);
@@ -822,8 +893,16 @@ public class OrderServiceImpl implements OrderService {
                                       OrderGoodsEntity orderGoodsEntity, BigDecimal sellVolume, String changeReason, SysUserEntity user) {
         storeRelaEntity.setSellVolume(Integer.parseInt(sellVolume.toString())); // 减退库存
         storeRelaEntity.setStockNum(stockNum + orderGoodsEntity.getNumber());//库存数量
+        if("oms退单成功,恢复库存".equals(changeReason)){
+            storeRelaEntity.setToBeRestored(storeRelaEntity.getToBeRestored() - orderGoodsEntity.getNumber());
+        }
         productStoreRelaDao.update(storeRelaEntity);
 
+
+        String username = "system";
+        if(user != null){
+            username = user.getUsername();
+        }
         StoreMngChangeEntity storeMngChangeEntity = new StoreMngChangeEntity();
         storeMngChangeEntity.setChangeType(Dict.changeType.item_0.getItem());
         storeMngChangeEntity.setChangeReason(changeReason);
@@ -835,8 +914,8 @@ public class OrderServiceImpl implements OrderService {
         storeMngChangeEntity.setStoreValidNum(stockNum + orderGoodsEntity.getNumber());
         storeMngChangeEntity.setCreateTime(new Date());
         storeMngChangeEntity.setModTime(new Date());
-        storeMngChangeEntity.setCreaterSn(user.getUsername());
-        storeMngChangeEntity.setModerSn(user.getUsername());
+        storeMngChangeEntity.setCreaterSn(username);
+        storeMngChangeEntity.setModerSn(username);
         storeMngChangeEntity.setIsValid(0);
         storeMngChangeDao.save(storeMngChangeEntity);
     }
@@ -2020,11 +2099,15 @@ public class OrderServiceImpl implements OrderService {
                 resultObj.put("errmsg", "订单提交失败");
                 return resultObj;
             }
+
+            List<OrderGoodsVo> orderGoodsVoList = new ArrayList<>();
+
             for (GoodsEntity goodsDto : goodsEntities) {
 
                 OrderGoodsVo orderGoodsVo = setOrderGoodsVo(order, goodsDto);
                 //新增订单详情
                 orderGoodsDao.saveOrderGoodsVo(orderGoodsVo);
+                orderGoodsVoList.add(orderGoodsVo);
             }
             //清空预订单商品临时表
             Map orderInfoMap = Maps.newHashMap();
@@ -2061,8 +2144,11 @@ public class OrderServiceImpl implements OrderService {
                 }
             }
 
-            OrderEntity orderEntity = queryObject(order.getId());
-            orderDao.update(orderEntity);
+//            OrderEntity orderEntity = queryObject(order.getId());
+//             TODO 到时候要注释掉,测试用而已
+//            orderEntity.setOrderStatus(Integer.parseInt(Dict.orderStatus.item_201.getItem()));
+//            orderEntity.setPayStatus(Integer.parseInt(Dict.payStatus.item_2.getItem()));
+//            orderDao.update(orderEntity);
             resultObj.put("shopName", store.getStoreName()); // 根据门店编号查询
             resultObj.put("userName", user.getUsername());
 
@@ -2137,6 +2223,32 @@ public class OrderServiceImpl implements OrderService {
             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;
         } catch (Exception e) {
             e.printStackTrace();
@@ -2522,17 +2634,13 @@ public class OrderServiceImpl implements OrderService {
         return orderDao.queryObjectByOrderSn(orderSn);
     }
 
-    // TODO  退款的代码
+    // 收银端退款的代码
     @Override
     @Transactional
-    public synchronized R orderRefund(OrderEntity order, String sessionId) throws Exception {
+    public synchronized R orderRefund(OrderEntity order, String sessionId, SysUserEntity user) throws Exception {
         String payFlag = order.getPayFlag();
 
-        boolean needUpdateStock = true;
-        if (Dict.payFlag.item_cash.getItem().equals(payFlag)) {
-            order.setPayStatus(Integer.parseInt(Dict.payStatus.item_4.getItem()));
-            // TODO 微信的退款代码
-        } else if (Dict.payFlag.item_weixin.getItem().equals(payFlag)) {
+        if (Dict.payFlag.item_weixin.getItem().equals(payFlag)) {
             OrderEntity orderInfo = order;
             if (null == orderInfo) {
                 return R.error("订单不存在");
@@ -2548,33 +2656,80 @@ public class OrderServiceImpl implements OrderService {
             String refundResult = "";
             if (orderInfo.getOrderStatus() != Integer.parseInt(Dict.orderStatus.item_0.getItem())) {
                 LOGGER.info("微信退款开始");
-                refundResult = wxRefund(orderInfo, totalActualPrice);
-                if (org.apache.commons.lang3.StringUtils.isNotBlank(refundResult)) {
-                    return R.error(refundResult);
+
+                WechatRefundApiResult result = WechatUtil.wxRefund(orderInfo.getOrderSn().toString(), totalActualPrice,
+                        orderInfo.getActualPrice().doubleValue());
+                OrderRefundEntity orderRefund = new OrderRefundEntity();
+                orderRefund.setRefundId(result.getRefund_id());
+                orderRefund.setOutRefundNo(result.getOut_trade_no());
+                orderRefund.setRefundMoney(BigDecimal.valueOf(Long.valueOf(result.getRefund_fee())).divide(Constant.ONE_HUNDRED));
+                orderRefund.setRefundStatus(Integer.parseInt(Dict.RefundStatus.item_2.getItem()));//退款处理中
+                orderRefund.setModTime(new Date());
+                orderRefund.setRefundTime(new Date());
+                orderRefund.setOrderId(Integer.parseInt(order.getId() + ""));
+                orderRefund.setUserId(user.getUserId().intValue());
+                orderRefund.setRefundId(order.getUserId() + "");
+                orderRefund.setCreateTime(new Date());
+                List<OrderEntity> list = orderDao.queryObjectByMerchOrderSn(order.getMerchOrderSn());
+                if (list.size() > 1) {//多条订单
+                    orderRefund.setRefundType(Integer.parseInt(Dict.RefundType.item_2.getItem()));//部分退款
+                } else {
+                    orderRefund.setRefundType(Integer.parseInt(Dict.RefundType.item_1.getItem()));//用户全额退款
                 }
+
+
                 order.setPayStatus(Integer.parseInt(Dict.payStatus.item_5.getItem()));
                 order.setOrderStatus(Integer.parseInt(Dict.orderStatus.item_401.getItem()));
                 LOGGER.info("微信退款");
+
+                orderDao.update(order);//修改为退款成功
+                // 修改取货码
+                PickUpCodeEntity pickUpCodeEntity = pickUpCodeService.queryObject(order.getOrderSn());
+                pickUpCodeEntity.setPickUpCodeStatus("3");
+                pickUpCodeService.update(pickUpCodeEntity);
+
+                // 判断该订单是否进入oms系统
+                if(!arrivedOms(order.getOrderSn())){
+                    // oms无该订单,则直接退款
+                    restoreInventory(order, "收银端退款");
+                    orderRefund.setRestore(1);
+                } else{
+                    // 如果oms有订单,统一进入锁库存情况
+                    orderRefund.setRestore(0);
+                    toBeRestoreInventory(order);
+                }
+
+                orderRefundDao.save(orderRefund);//退款记录
             }
             // 支付宝的退款代码
         } else if (Dict.payFlag.item_alipay.getItem().equals(payFlag)) {
 
+            OrderEntity orderInfo = order;
+            if (null == orderInfo) {
+                return R.error("订单不存在");
+            }
+            if (orderInfo.getOrderStatus() == Integer.parseInt(Dict.orderStatus.item_401.getItem()) ||
+                    orderInfo.getOrderStatus() == Integer.parseInt(Dict.orderStatus.item_402.getItem())) {
+                return R.error("订单已退款");
+            }
+
             AliPayMicropayApiResult userRefund = AliPayUtil.aliTradeRefund(order.getOrderSn(), order.getActualPrice().toString(),
                     "用户退款", order.getStoreId() + "");
 
             LOGGER.info(userRefund.getSubMsg());
-            order.setPayStatus(Integer.parseInt(Dict.payStatus.item_5.getItem()));
-            order.setOrderStatus(Integer.parseInt(Dict.orderStatus.item_401.getItem()));
+
             OrderRefundEntity orderRefund = new OrderRefundEntity();
             orderRefund.setRefundId(userRefund.getTradeNo());
             orderRefund.setOutRefundNo(userRefund.getOutTradeNo());
-            orderRefund
-                    .setRefundMoney(new BigDecimal(userRefund.getRefundFee()));
+            orderRefund.setRefundMoney(new BigDecimal(userRefund.getRefundFee()));
+
+
             orderRefund.setRefundStatus(Integer.parseInt(Dict.RefundStatus.item_2.getItem()));//退款成功
             orderRefund.setModTime(new Date());
             orderRefund.setRefundTime(new Date());
             orderRefund.setOrderId(Integer.parseInt(order.getId() + ""));
-            orderRefund.setUserId(Integer.parseInt(order.getUserId() + ""));
+            orderRefund.setUserId(user.getUserId().intValue());
+            orderRefund.setRefundId(order.getUserId() + "");
             orderRefund.setCreateTime(new Date());
             List<OrderEntity> list = orderDao.queryObjectByMerchOrderSn(order.getMerchOrderSn());
             if (list.size() > 1) {//多条订单
@@ -2582,17 +2737,114 @@ public class OrderServiceImpl implements OrderService {
             } else {
                 orderRefund.setRefundType(Integer.parseInt(Dict.RefundType.item_1.getItem()));//用户全额退款
             }
+
+
+            order.setPayStatus(Integer.parseInt(Dict.payStatus.item_5.getItem()));
+            order.setOrderStatus(Integer.parseInt(Dict.orderStatus.item_401.getItem()));
+            orderDao.update(order);//修改为退款成功
+            // 修改取货码
+            PickUpCodeEntity pickUpCodeEntity = pickUpCodeService.queryObject(order.getOrderSn());
+            pickUpCodeEntity.setPickUpCodeStatus("3");
+            pickUpCodeService.update(pickUpCodeEntity);
+            // 判断该订单是否进入oms系统
+            if(!arrivedOms(order.getOrderSn())){
+                // oms无该订单,则直接退款
+                restoreInventory(order, "收银端退款");
+                orderRefund.setRestore(1);
+            } else{
+                // 如果oms有订单,统一进入锁库存情况
+                orderRefund.setRestore(0);
+                toBeRestoreInventory(order);
+            }
+
             orderRefundDao.save(orderRefund);//退款记录
         }
-        orderDao.update(order);//修改为退款成功
-        // 修改取货码
-        PickUpCodeEntity pickUpCodeEntity = pickUpCodeService.queryObject(order.getOrderSn());
-        pickUpCodeEntity.setPickUpCodeStatus("3");
-        pickUpCodeService.update(pickUpCodeEntity);
-        updateStock(order, "收银端退款");
+
         return R.ok("退款成功");
     }
 
+    @Transactional
+    public void toBeRestoreInventory(OrderEntity order) {
+
+        Map<String, Object> map = new HashMap();
+        SysUserEntity user = ShiroUtils.getUserEntity();
+        map.put("orderId", order.getId());
+        List<OrderGoodsEntity> orderGoodsVoList = orderGoodsDao.queryList(map);
+        for (OrderGoodsEntity orderGoodsEntity : orderGoodsVoList) {
+            Integer restoreNumber = orderGoodsEntity.getNumber();
+            ProductStoreRelaEntity storeRelaEntity = productStoreRelaDao
+                    .queryByGoodsIdAndStoreId(order.getStoreId().longValue(), orderGoodsEntity.getGoodsId().longValue());
+            Integer toBeRestored = storeRelaEntity.getToBeRestored();
+            if(toBeRestored == null){
+                toBeRestored = 0;
+            }
+            // 修改待退款的数量
+            storeRelaEntity.setToBeRestored(toBeRestored +restoreNumber);
+
+            GoodsEntity goodsEntity = goodsDao.queryObject(orderGoodsEntity.getGoodsId());
+
+            toBeRestored = goodsEntity.getToBeRestored();
+            if(toBeRestored == null){
+                toBeRestored = 0;
+            }
+            goodsEntity.setToBeRestored(toBeRestored+restoreNumber);
+
+
+            productStoreRelaDao.update(storeRelaEntity);
+            goodsDao.update(goodsEntity);
+        }
+
+    }
+
+    /**
+     * 查询oms系统是否有该订单
+     * @param orderSn
+     * @return
+     */
+    private boolean arrivedOms(String orderSn) {
+
+        Map<String, String> sParaTemp = new TreeMap<String, String>();
+//        sParaTemp.put("data","ZWCW2020122749351849");
+        sParaTemp.put("data",orderSn);
+        sParaTemp.put("merchId",omsMerchProperties.getMerchSn());
+        String timestamp = String.valueOf(System.currentTimeMillis()/1000);
+        sParaTemp.put("timestamp", timestamp);
+        //生成要请求给oms秘钥
+//        String sign = OmsSign.sign(sParaTemp,cus.getWaybill().get("secret-key"));
+        LOGGER.info("md5混淆码参数:" + omsMerchProperties.getMd5Salt());
+        String sign = OmsSign.sign(sParaTemp,omsMerchProperties.getMd5Salt());
+        sParaTemp.put("sign", sign);
+        //构建Request
+        String  url = omsMerchProperties.getQueryInveResponseUrl();
+        Request request = com.kmall.admin.utils.oms.OkHttpUtils.buildRequest(url, JSON.toJSONString(sParaTemp));
+        LOGGER.info("oms的请求报文:" + request);
+        // 同步访问,返回结果字符串
+        String responseString = null;
+        try {
+
+            responseString = com.kmall.admin.utils.oms.OkHttpUtils.post(request);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        LOGGER.info("oms的响应报文"+responseString);
+        //解析响应数据
+        Gson gson = new Gson();
+        ResponseMessage result = gson.fromJson(responseString, ResponseMessage.class);
+        if(result == null){
+            String info = "解析响应数据Result失败";
+            LOGGER.error("--- {}", info);
+            throw new RuntimeException(info);
+        }
+        if("oms无该订单".equals(result.getMsg())){
+            return false;
+        }
+
+        return true;
+
+    }
+
 
     private String wxRefund(OrderEntity orderInfo, Double totalActualPrice) {
         WechatRefundApiResult result = WechatUtil.wxRefund(orderInfo.getOrderSn().toString(), totalActualPrice,
@@ -2670,30 +2922,28 @@ public class OrderServiceImpl implements OrderService {
     }
 
     @Override
-    public List<OrderEntity> queryLastDayOrder() {
+    public List<OrderEntity> queryLastDayOrder(String comparedDate) {
 
         Map<String, Object> map = new HashMap<>();
+//
+//        DateFormat dateFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//格式化一下时间
+//
+//        Date dNow = new Date(); //当前时间
+//
+//        Date dBefore = new Date();
+//
+//        Calendar calendar = Calendar.getInstance(); //得到日历
+//
+//        calendar.setTime(dNow);//把当前时间赋给日历
+//
+//        calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天
+//
+//        dBefore = calendar.getTime(); //得到前一天的时间
 
-        DateFormat dateFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//格式化一下时间
-
-        Date dNow = new Date(); //当前时间
-
-        Date dBefore = new Date();
-
-        Calendar calendar = Calendar.getInstance(); //得到日历
-
-        calendar.setTime(dNow);//把当前时间赋给日历
-
-        calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天
-
-        dBefore = calendar.getTime(); //得到前一天的时间
-
-        String defaultStartDate = dateFmt.format(dBefore); //格式化前一天
-
-        defaultStartDate = defaultStartDate.substring(0, 10) + " 00:00:00";
+        String defaultStartDate =  comparedDate + " 00:00:00";
 
 
-        String defaultEndDate = defaultStartDate.substring(0, 10) + " 23:59:59";
+        String defaultEndDate = comparedDate + " 23:59:59";
 
 
         map.put("startTime", defaultStartDate);
@@ -2812,16 +3062,16 @@ public class OrderServiceImpl implements OrderService {
                 // 获取实际支付价格
                 String postTaxPrice = taxDetailDto.getPostTaxPrice();
                 // 获取总税额
-                String  taxStr = taxDetailDto.getTax();
+                String  taxStr = taxDetailDto.getPreTax();
                 // 税前金额
                 BigDecimal tax = new BigDecimal(taxStr);
                 BigDecimal pretaxPrice = new BigDecimal(postTaxPrice).subtract(tax).setScale(2, RoundingMode.HALF_UP);
                 // 计算综合税率
                 BigDecimal taxRate = tax.divide(pretaxPrice, 4, RoundingMode.HALF_UP);
                 // 消费税率
-                BigDecimal saleTaxRate = new BigDecimal(taxDetailDto.getSaleTaxRate()).divide(new BigDecimal(100),2,RoundingMode.HALF_UP);
+                BigDecimal saleTaxRate = new BigDecimal(taxDetailDto.getPreSaleTax()).divide(new BigDecimal(100),2,RoundingMode.HALF_UP);
                 // 综合税率
-                BigDecimal vatRate = new BigDecimal(taxDetailDto.getVatRate()).divide(new BigDecimal(100),2,RoundingMode.HALF_UP);
+                BigDecimal vatRate = new BigDecimal(taxDetailDto.getPreVat()).divide(new BigDecimal(100),2,RoundingMode.HALF_UP);
 //              消费税 = (明细商品总价 / (1-消费税税率)) * 消费税税率
 //              增值税 = (明细商品总价 + 消费税) * 增值税税率
 //              订单该商品总税费 = (商品消费税 + 商品增值税)* 0.7
@@ -2838,8 +3088,8 @@ public class OrderServiceImpl implements OrderService {
                     // 不需要算消费税,增值税计算
                     vat = pretaxPrice.multiply(vatRate).multiply(discountRate).setScale(2, RoundingMode.HALF_UP);
                 }
-                taxDetailDto.setPreSaleTax(saleTax.toString());
-                taxDetailDto.setPreVat(vat.toString());
+                taxDetailDto.setPreSaleTax(saleTax.compareTo(BigDecimal.ZERO)==0?saleTax.toString():"-"+saleTax.toString());
+                taxDetailDto.setPreVat(vat.compareTo(BigDecimal.ZERO)==0?vat.toString():"-"+vat.toString());
             }
         }
 
@@ -2848,6 +3098,99 @@ public class OrderServiceImpl implements OrderService {
         return result;
     }
 
+    @Override
+    public List<String> queryInveResponse(String orderSn) throws IOException {
+        Map<String, String> sParaTemp = new TreeMap<String, String>();
+        sParaTemp.put("data",orderSn);
+        sParaTemp.put("merchId",omsMerchProperties.getMerchSn());
+        String timestamp = String.valueOf(System.currentTimeMillis()/1000);
+        sParaTemp.put("timestamp", timestamp);
+        //生成要请求给oms秘钥
+//        String sign = OmsSign.sign(sParaTemp,cus.getWaybill().get("secret-key"));
+        LOGGER.info("md5混淆码参数:" + omsMerchProperties.getMd5Salt());
+        String sign = OmsSign.sign(sParaTemp,omsMerchProperties.getMd5Salt());
+        sParaTemp.put("sign", sign);
+        //构建Request
+        String  url = omsMerchProperties.getQueryInveResponseUrl();
+        Request request = com.kmall.admin.utils.oms.OkHttpUtils.buildRequest(url, JSON.toJSONString(sParaTemp));
+        LOGGER.info("oms的请求报文:" + request);
+        // 同步访问,返回结果字符串
+        String responseString = null;
+        try {
+
+            responseString = com.kmall.admin.utils.oms.OkHttpUtils.post(request);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw e;
+        }
+
+        LOGGER.info("oms的响应报文"+responseString);
+        //解析响应数据
+        Gson gson = new Gson();
+        ResponseMessage result = gson.fromJson(responseString, ResponseMessage.class);
+        if(result == null){
+            String info = "解析响应数据Result失败";
+            LOGGER.error("--- {}", info);
+            throw new RuntimeException(info);
+        }
+        ResponseMessageData data = result.getData();
+        List rows = data.getRows();
+        List<String> resultMessage = new LinkedList<>();
+        for (Object row : rows) {
+            if(row instanceof ArrayList){
+                for (Object o : ((ArrayList<?>) row)) {
+                    if(o instanceof LinkedTreeMap){
+                        String cusReturnInfo = (String) ((LinkedTreeMap<?, ?>) o).get("cusReturnInfo");
+                        resultMessage.add(cusReturnInfo);
+                    }
+                }
+            }
+        }
+//        cusReturnInfo -> [Code:2600;Desc:放行]
+        return resultMessage;
+    }
+
+    /**
+     * 查询所有状态为201的订单。且下单时间超过5分钟的订单
+     *
+     * @return
+     */
+    @Override
+    public List<OrderEntity> queryAll201Order() {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        String date = format.format(new Date());
+        return orderDao.queryAll201Order(date);
+
+    }
+
+    /**
+     * 恢复kmall退单冻结的库存
+     *
+     * @param orderSn
+     */
+    @Override
+    @Transactional
+    public void toBeRestored(String orderSn) {
+
+        // 查询该订单在库存是否已经释放过,避免重复恢复库存
+        OrderEntity orderInfo = orderDao.queryObjectByOrderSn(orderSn);
+        OrderRefundEntity orderRefundEntity = orderRefundService.queryObjectByOrderId(orderInfo.getId());
+        if(orderRefundEntity == null){
+            LOGGER.error("该订单无退款记录,订单号{}",orderSn);
+            throw new RuntimeException("该订单无退款记录,订单号:"+orderSn);
+        }
+        Integer restore = orderRefundEntity.getRestore();
+        if(restore == 1){
+            LOGGER.error("该订单库存记录已恢复过,订单号{}",orderSn);
+            throw new RuntimeException("该订单库存记录已恢复过,订单号:"+orderSn);
+        }
+        restoreInventory(orderInfo,"oms退单成功,恢复库存");
+        orderRefundEntity.setRestore(1);
+        orderRefundService.update(orderRefundEntity);
+
+    }
+
 
     /**
      * 设置订单数据
@@ -3003,7 +3346,7 @@ public class OrderServiceImpl implements OrderService {
 
         // 计算税费
         GoodsEntity goodsEntity = goodsService.queryObject(goodsDto.getId().intValue());
-        BigDecimal goodsTax = CalculateTax.calculateFinalTax(goodsEntity,goodsDto.getActualPaymentAmount().divide(number,2,RoundingMode.HALF_UP),goodsService).setScale(3,RoundingMode.HALF_UP);
+        BigDecimal goodsTax = CalculateTax.calculateFinalTax(goodsEntity,goodsDto.getStoreRetailPrice(),goodsService).setScale(3,RoundingMode.HALF_UP);
         goodsTax = goodsTax.multiply(number).setScale(2,RoundingMode.HALF_UP);
         orderGoodsVo.setTaxPrice(goodsTax);
 

+ 71 - 16
kmall-admin/src/main/java/com/kmall/admin/service/impl/ProductStoreRelaServiceImpl.java

@@ -1,14 +1,18 @@
 package com.kmall.admin.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.google.common.collect.ImmutableBiMap;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.kmall.admin.dao.*;
 import com.kmall.admin.dao.mk.dist.MkDistSellAllocationDao;
 import com.kmall.admin.dto.StoreGoodsDto;
 import com.kmall.admin.entity.*;
+import com.kmall.admin.entity.kmall2eccs.KtoEccsEntity;
 import com.kmall.admin.entity.mk.dist.MkDistSellAllocationEntity;
 import com.kmall.admin.fromcomm.entity.SysUserEntity;
 import com.kmall.admin.service.ProductStoreRelaService;
+import com.kmall.admin.service.kmall2eccs.KtoEccsService;
 import com.kmall.admin.utils.ShiroUtils;
 import com.kmall.api.util.StockUtil;
 import com.kmall.common.constant.Dict;
@@ -70,6 +74,9 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
     @Autowired
     private GoodsBatchDao goodsBatchDao;
 
+    @Autowired
+    private KtoEccsService ktoEccsService;
+
     @Override
     public ProductStoreRelaEntity queryObject(Integer id) {
         ProductStoreRelaEntity productStoreRelaEntity = productStoreRelaDao.queryObject(id);
@@ -259,6 +266,7 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
         productStoreRela.setModerSn(user.getUserId().toString());
         productStoreRela.setModTime(new Date());
         productStoreRela.setGoodsBizType(goodsEntity.getGoodsBizType());
+        productStoreRela.setSellVolume(0);
         return productStoreRelaDao.save(productStoreRela);
     }
 
@@ -362,22 +370,22 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
 //        goods.setMarketPrice(productStoreRela.getMarketPrice());
 //        goods.setId(goodsEntity.getId());
 //        goodsDao.update(goods);
-        ProductEntity product = productDao.queryObjectByGoodsIdAndStoreId(goodsId, storeId);
-        if(product == null){
-            throw new RRException("该商品规格信息为空!请完善商品数据");
-        }
-        productStoreRela.setProductId(product.getId());
-        if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
-            // 添加商品规格
-            GoodsSpecificationEntity goodsSpecification = goodsSpecificationDao.queryByGoodsId(goodsEntity.getId());
-            goodsSpecification.setValue(productStoreRela.getSpecification());
-            goodsSpecificationDao.update(goodsSpecification);
-
-            // 修改产品
-            product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
-            product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
-            productDao.update(product);
-        }
+//        ProductEntity product = productDao.queryObjectByGoodsIdAndStoreId(goodsId, storeId);
+//        if(product == null){
+//            throw new RRException("该商品规格信息为空!请完善商品数据");
+//        }
+//        productStoreRela.setProductId(product.getId());
+//        if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
+//            // 添加商品规格
+//            GoodsSpecificationEntity goodsSpecification = goodsSpecificationDao.queryByGoodsId(goodsEntity.getId());
+//            goodsSpecification.setValue(productStoreRela.getSpecification());
+//            goodsSpecificationDao.update(goodsSpecification);
+//
+//            // 修改产品
+//            product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
+//            product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
+//            productDao.update(product);
+//        }
 
         // 修改商品参数
         List<GoodsAttributeEntity> attributeEntityList = productStoreRela.getAttributeEntityList();
@@ -830,11 +838,37 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
         return productStoreRelaDao.queryExportList(params);
     }
 
+    /**
+     * 根据sku批量修改价格
+     *
+     * @param updatePrice
+     * @param sku
+     */
+    @Override
+    public void updatePriceBySku(String updatePrice, String sku) {
+        productStoreRelaDao.updatePriceBySku(updatePrice,sku);
+    }
+
+    /**
+     * 查询所有门店数据
+     *
+     * @return
+     */
+    @Override
+    public List<ProductStoreRelaEntity> queryAllList() {
+        return productStoreRelaDao.queryAllList();
+    }
+
 
     @Override
     @Transactional
     public int uploadExcel(List<StoreGoodsDto> storeGoodsDtoList) {
         if (storeGoodsDtoList != null && storeGoodsDtoList.size() > 0) {
+
+
+            SysUserEntity user = ShiroUtils.getUserEntity();
+            List<KtoEccsEntity> ktoEccsEntities = new LinkedList<>();
+
             for (int i = 0; i < storeGoodsDtoList.size(); i++) {
                 StoreGoodsDto storeGoodsDto = storeGoodsDtoList.get(i);
                 ProductStoreRelaEntity storeRelaEntity = new ProductStoreRelaEntity();
@@ -913,7 +947,28 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
                     storeRelaEntity.setStockNum(productStoreRelaEntity.getStockNum()+Integer.valueOf(storeGoodsDto.getStockNum()));
                     update(storeRelaEntity);
                 }
+
+
+                KtoEccsEntity ktoEccsEntity = new KtoEccsEntity();
+                ktoEccsEntity.setRequestData(JSON.toJSONString(storeRelaEntity));
+                ktoEccsEntity.setRequestType("02");
+                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);
+                }
             }
+
         }else{
             throw new RRException("导入数据为空,或者检查数据是否为空");
         }

+ 59 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/compared/ImportPayOrderRecordServiceImpl.java

@@ -0,0 +1,59 @@
+package com.kmall.admin.service.impl.compared;
+
+import com.kmall.admin.dao.compared.ImportPayOrderRecordDao;
+import com.kmall.admin.entity.compared.ImportPayOrderRecordEntity;
+import com.kmall.admin.service.compared.ImportPayOrderRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 导入支付单记录表Service实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-12 16:26:45
+ */
+@Service("importPayOrderRecordService")
+public class ImportPayOrderRecordServiceImpl implements ImportPayOrderRecordService {
+    @Autowired
+    private ImportPayOrderRecordDao importPayOrderRecordDao;
+
+    @Override
+    public ImportPayOrderRecordEntity queryObject(Long iporId) {
+        return importPayOrderRecordDao.queryObject(iporId);
+    }
+
+    @Override
+    public List<ImportPayOrderRecordEntity> queryList(Map<String, Object> map) {
+        return importPayOrderRecordDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        return importPayOrderRecordDao.queryTotal(map);
+    }
+
+    @Override
+    public int save(ImportPayOrderRecordEntity importPayOrderRecord) {
+        return importPayOrderRecordDao.save(importPayOrderRecord);
+    }
+
+    @Override
+    public int update(ImportPayOrderRecordEntity importPayOrderRecord) {
+        return importPayOrderRecordDao.update(importPayOrderRecord);
+    }
+
+    @Override
+    public int delete(Long iporId) {
+        return importPayOrderRecordDao.delete(iporId);
+    }
+
+    @Override
+    public int deleteBatch(Long[]iporIds) {
+        return importPayOrderRecordDao.deleteBatch(iporIds);
+    }
+}

+ 59 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/compared/ImportTaxOrderRecordServiceImpl.java

@@ -0,0 +1,59 @@
+package com.kmall.admin.service.impl.compared;
+
+import com.kmall.admin.dao.compared.ImportTaxOrderRecordDao;
+import com.kmall.admin.entity.compared.ImportTaxOrderRecordEntity;
+import com.kmall.admin.service.compared.ImportTaxOrderRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 导入税单记录表Service实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-12 16:26:45
+ */
+@Service("importTaxOrderRecordService")
+public class ImportTaxOrderRecordServiceImpl implements ImportTaxOrderRecordService {
+    @Autowired
+    private ImportTaxOrderRecordDao importTaxOrderRecordDao;
+
+    @Override
+    public ImportTaxOrderRecordEntity queryObject(Long itorId) {
+        return importTaxOrderRecordDao.queryObject(itorId);
+    }
+
+    @Override
+    public List<ImportTaxOrderRecordEntity> queryList(Map<String, Object> map) {
+        return importTaxOrderRecordDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        return importTaxOrderRecordDao.queryTotal(map);
+    }
+
+    @Override
+    public int save(ImportTaxOrderRecordEntity importTaxOrderRecord) {
+        return importTaxOrderRecordDao.save(importTaxOrderRecord);
+    }
+
+    @Override
+    public int update(ImportTaxOrderRecordEntity importTaxOrderRecord) {
+        return importTaxOrderRecordDao.update(importTaxOrderRecord);
+    }
+
+    @Override
+    public int delete(Long itorId) {
+        return importTaxOrderRecordDao.delete(itorId);
+    }
+
+    @Override
+    public int deleteBatch(Long[]itorIds) {
+        return importTaxOrderRecordDao.deleteBatch(itorIds);
+    }
+}

+ 80 - 24
kmall-admin/src/main/java/com/kmall/admin/service/impl/compared/OrderComparedErrorServiceImpl.java

@@ -1,11 +1,10 @@
 package com.kmall.admin.service.impl.compared;
 
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
 import com.google.gson.internal.LinkedTreeMap;
 import com.kmall.admin.dao.compared.OrderComparedErrorDao;
+import com.kmall.admin.dto.QueryOrderDto;
 import com.kmall.admin.entity.OrderEntity;
 import com.kmall.admin.entity.compared.OrderComparedErrorEntity;
 import com.kmall.admin.entity.compared.PayOrderInfoEntity;
@@ -13,7 +12,6 @@ import com.kmall.admin.service.OrderService;
 import com.kmall.admin.service.compared.OrderComparedErrorService;
 import com.kmall.admin.service.compared.PayOrderInfoService;
 import com.kmall.admin.utils.data.response.ResponseMessage;
-import com.kmall.admin.utils.data.response.ResponseMessageData;
 import com.kmall.admin.utils.oms.OkHttpUtils;
 import com.kmall.admin.utils.oms.OmsSign;
 import com.kmall.common.utils.R;
@@ -28,6 +26,8 @@ import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import java.io.IOException;
+import java.text.DateFormat;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -56,6 +56,8 @@ public class OrderComparedErrorServiceImpl implements OrderComparedErrorService
     @Autowired
     private OmsMerchProperties omsMerchProperties;
 
+    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
 
     @Override
     public OrderComparedErrorEntity queryObject(Integer moceId) {
@@ -94,22 +96,23 @@ public class OrderComparedErrorServiceImpl implements OrderComparedErrorService
 
     /**
      * 对比订单
+     * @param comparedDate
      */
     @Override
     @Transactional
-    public String comparedOrder() {
+    public String comparedOrder(String comparedDate) {
 
         try {
             // 查询所有为对比的订单
-            List<PayOrderInfoEntity> payOrderInfoEntities = payOrderInfoService.queryNoComparedOrder();
+            List<PayOrderInfoEntity> payOrderInfoEntities = payOrderInfoService.queryNoComparedOrder(comparedDate);
             if(payOrderInfoEntities == null || payOrderInfoEntities.size() == 0){
                 return "暂无需要对比的订单";
             }
 
             // 对比中网的订单数据
-            comparedKmallOrder(payOrderInfoEntities);
+            comparedKmallOrder(payOrderInfoEntities,comparedDate);
             // 对比oms的订单数据
-            comparedOmsOrder(payOrderInfoEntities);
+            comparedOmsOrder(payOrderInfoEntities,comparedDate);
 
             // 批量修改支付单对比状态跟对比时间
             payOrderInfoService.updateBatch(payOrderInfoEntities);
@@ -121,13 +124,20 @@ public class OrderComparedErrorServiceImpl implements OrderComparedErrorService
         return "对比成功";
      }
 
-    private void comparedOmsOrder(List<PayOrderInfoEntity> payOrderInfoEntities) throws IOException {
+    private void comparedOmsOrder(List<PayOrderInfoEntity> payOrderInfoEntities, String comparedDate) throws IOException {
         // 查询oms系统前一天的订单
         List<OrderEntity> orderEntities = new ArrayList<>();
         List<String> merchOrderSns = payOrderInfoEntities.stream().map(PayOrderInfoEntity::getMerchOrderSn).collect(Collectors.toList());
 
+        QueryOrderDto queryOrderDto = new QueryOrderDto();
+//        queryOrderDto.setQueryDate("2021-02-01");
+        queryOrderDto.setQueryDate(comparedDate);
+        queryOrderDto.setThirdSn(omsMerchProperties.getThirdSn());
+
+
+
         Map<String, String> sParaTemp = new TreeMap<String, String>();
-        sParaTemp.put("data",omsMerchProperties.getThirdSn());
+        sParaTemp.put("data",JSON.toJSONString(queryOrderDto));
         sParaTemp.put("merchId",omsMerchProperties.getMerchSn());
         String timestamp = String.valueOf(System.currentTimeMillis()/1000);
         sParaTemp.put("timestamp", timestamp);
@@ -138,7 +148,7 @@ public class OrderComparedErrorServiceImpl implements OrderComparedErrorService
         sParaTemp.put("sign", sign);
         //构建Request
         String  url = omsMerchProperties.getQueryOrderUrl();
-        url = "http://127.0.0.1:8680/al/shop/order/query";
+//        url = "http://127.0.0.1:8680/al/shop/order/query";
         Request request = OkHttpUtils.buildRequest(url, JSON.toJSONString(sParaTemp));
         LOGGER.info("oms的请求报文:" + request);
         // 同步访问,返回结果字符串
@@ -169,16 +179,33 @@ public class OrderComparedErrorServiceImpl implements OrderComparedErrorService
 
         Map<String,OrderComparedErrorEntity> inconsistentMap = new HashMap<>();
 
-
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
         for(PayOrderInfoEntity parOrderInfo : payOrderInfoEntities){
 
             String merchOrderSn = parOrderInfo.getMerchOrderSn();
             // 将订单号插入到表中
             OrderComparedErrorEntity orderComparedErrorEntity = new OrderComparedErrorEntity();
-            orderComparedErrorEntity.setMerchOrderSn(merchOrderSn);
-            orderComparedErrorEntity.setOrderSource("OMS");
-            orderComparedErrorEntity.setReason("oms无订单");
-            inconsistentMap.put(merchOrderSn,orderComparedErrorEntity);
+
+            try {
+                // 获取前一天日期
+                String yesterday = getYesterday();
+
+
+                if(!format.format(format.parse(parOrderInfo.getPayTime())).equals(yesterday)){
+                    orderComparedErrorEntity.setMerchOrderSn(merchOrderSn);
+                    orderComparedErrorEntity.setOrderSource("OMS");
+                    orderComparedErrorEntity.setReason("oms无订单");
+                    orderComparedErrorEntity.setCreateTime(parOrderInfo.getPayTime());
+                    inconsistentMap.put(merchOrderSn,orderComparedErrorEntity);
+                }
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+
+//            orderComparedErrorEntity.setOrderSource("OMS");
+//            orderComparedErrorEntity.setReason("oms无订单");
+//            orderComparedErrorEntity.setCreateTime(format);
+//            inconsistentMap.put(merchOrderSn,orderComparedErrorEntity);
 
             for(int i = 0 ; i < rows.size() ; i ++){
                 LinkedTreeMap<String,Object> treeMap = (LinkedTreeMap<String, Object>) rows.get(i);
@@ -189,14 +216,21 @@ public class OrderComparedErrorServiceImpl implements OrderComparedErrorService
                         orderStatus = "300";
                     }
                     // 判断订单状态 不等于支付单状态
-                    if(!orderStatus.equals(Integer.parseInt(parOrderInfo.getOrderStatus()))){
-
+                    if(!orderStatus.equals(parOrderInfo.getOrderStatus())){
+                        orderComparedErrorEntity.setMerchOrderSn(merchOrderSn);
                         orderComparedErrorEntity.setOrderSource("OMS");
-                        orderComparedErrorEntity.setReason("订单状态不一致");
-//                        inconsistentMap.put(orderSn,orderComparedErrorEntity);
+                        if(orderStatus.equals("52")){
+                            orderComparedErrorEntity.setReason("订单状态不一致,oms需要调减");
+
+                        }else{
+                            orderComparedErrorEntity.setReason("订单状态不一致,需要查询oms系统");
+                        }
+                        orderComparedErrorEntity.setCreateTime(parOrderInfo.getPayTime());
+                        inconsistentMap.put(orderSn,orderComparedErrorEntity);
                         continue;
                     }
-                    // 如果状态一直,然后map中有数据,则证明是当天退款的订单( 支付单:收费  退费 2条 订单 : 退 1条)
+
+                    // 如果状态一致,然后map中有数据,则证明是当天退款的订单( 支付单:收费  退费 2条 订单 : 退 1条)
                     if(orderComparedErrorEntity != null){
                         inconsistentMap.remove(orderSn);
                     }
@@ -207,7 +241,7 @@ public class OrderComparedErrorServiceImpl implements OrderComparedErrorService
 
 
             parOrderInfo.setCompared("1");
-            parOrderInfo.setComparedTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
+            parOrderInfo.setComparedTime(dateFormat.format(new Date()));
 
         }
 
@@ -218,9 +252,29 @@ public class OrderComparedErrorServiceImpl implements OrderComparedErrorService
         }
     }
 
-    private void comparedKmallOrder(List<PayOrderInfoEntity> payOrderInfoEntities) {
-        // 查询前一天的订单
-        List<OrderEntity> orderEntities = orderService.queryLastDayOrder();
+    private String getYesterday() {
+        Map<String, Object> map = new HashMap<>();
+
+        DateFormat dateFmt = new SimpleDateFormat("yyyy-MM-dd");//格式化一下时间
+
+        Date dNow = new Date(); //当前时间
+
+        Date dBefore = new Date();
+
+        Calendar calendar = Calendar.getInstance(); //得到日历
+
+        calendar.setTime(dNow);//把当前时间赋给日历
+
+        calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天
+
+        dBefore = calendar.getTime(); //得到前一天的时间
+
+        return dateFmt.format(dBefore); //格式化前一天
+    }
+
+    private void comparedKmallOrder(List<PayOrderInfoEntity> payOrderInfoEntities, String comparedDate) {
+        // 查询导入日期的的订单
+        List<OrderEntity> orderEntities = orderService.queryLastDayOrder(comparedDate);
         // 要插入的异常订单集合
         List<OrderComparedErrorEntity> insertList = new ArrayList<>();
 
@@ -229,6 +283,7 @@ public class OrderComparedErrorServiceImpl implements OrderComparedErrorService
         Map<String,OrderComparedErrorEntity> inconsistentMap = new HashMap<>();
 
 
+        String format = dateFormat.format(new Date());
         for(PayOrderInfoEntity parOrderInfo : payOrderInfoEntities){
 
             String merchOrderSn = parOrderInfo.getMerchOrderSn();
@@ -237,6 +292,7 @@ public class OrderComparedErrorServiceImpl implements OrderComparedErrorService
             orderComparedErrorEntity.setMerchOrderSn(merchOrderSn);
             orderComparedErrorEntity.setOrderSource("Kmall");
             orderComparedErrorEntity.setReason("kmall无订单");
+            orderComparedErrorEntity.setCreateTime(format);
             inconsistentMap.put(merchOrderSn,orderComparedErrorEntity);
 
             for(OrderEntity order : orderEntities){

+ 3 - 2
kmall-admin/src/main/java/com/kmall/admin/service/impl/compared/PayOrderInfoServiceImpl.java

@@ -152,10 +152,11 @@ public class PayOrderInfoServiceImpl implements PayOrderInfoService {
 
     /**
      * 查询所有未对比的订单
+     * @param comparedDate
      */
     @Override
-    public List<PayOrderInfoEntity> queryNoComparedOrder() {
-        return payOrderInfoDao.queryNoComparedOrder();
+    public List<PayOrderInfoEntity> queryNoComparedOrder(String comparedDate) {
+        return payOrderInfoDao.queryNoComparedOrder(comparedDate);
     }
 
     /**

+ 166 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/compared/TaxComparedErrorServiceImpl.java

@@ -0,0 +1,166 @@
+package com.kmall.admin.service.impl.compared;
+
+import com.kmall.admin.dao.compared.TaxComparedErrorDao;
+import com.kmall.admin.dto.OrderGoodsDto;
+import com.kmall.admin.entity.compared.TaxComparedErrorEntity;
+import com.kmall.admin.entity.compared.TaxInfoEntity;
+import com.kmall.admin.service.OrderGoodsService;
+import com.kmall.admin.service.compared.TaxComparedErrorService;
+import com.kmall.admin.service.compared.TaxInfoService;
+import com.kmall.common.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+
+/**
+ * Service实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-12-29 14:11:24
+ */
+@Service("taxComparedErrorService")
+public class TaxComparedErrorServiceImpl implements TaxComparedErrorService {
+    @Autowired
+    private TaxComparedErrorDao taxComparedErrorDao;
+
+    @Autowired
+    private TaxInfoService taxInfoService;
+    @Autowired
+    private OrderGoodsService orderGoodsService;
+
+    @Override
+    public TaxComparedErrorEntity queryObject(Integer mtceId) {
+        return taxComparedErrorDao.queryObject(mtceId);
+    }
+
+    @Override
+    public List<TaxComparedErrorEntity> queryList(Map<String, Object> map) {
+        return taxComparedErrorDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        return taxComparedErrorDao.queryTotal(map);
+    }
+
+    @Override
+    public int save(TaxComparedErrorEntity taxComparedError) {
+        return taxComparedErrorDao.save(taxComparedError);
+    }
+
+    @Override
+    public int update(TaxComparedErrorEntity taxComparedError) {
+        return taxComparedErrorDao.update(taxComparedError);
+    }
+
+    @Override
+    public int delete(Integer mtceId) {
+        return taxComparedErrorDao.delete(mtceId);
+    }
+
+    @Override
+    public int deleteBatch(Integer[]mtceIds) {
+        return taxComparedErrorDao.deleteBatch(mtceIds);
+    }
+
+    /**
+     * 税单对比
+     *
+     * @return
+     * @param comparedDate
+     */
+    @Override
+    @Transactional
+    public String comparedTaxOrder(String comparedDate) {
+        Map<String,Object> param = new HashMap<>();
+        param.put("compared","0");
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+
+
+//        DateFormat dateFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//格式化一下时间
+//        Date dNow = new Date(); //当前时间
+//        Date dBefore = new Date();
+//        Calendar calendar = Calendar.getInstance(); //得到日历
+//        calendar.setTime(dNow);//把当前时间赋给日历
+//        calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天
+//        dBefore = calendar.getTime(); //得到前一天的时间
+//        String defaultStartDate = dateFmt.format(dBefore); //格式化前一天
+//        defaultStartDate = defaultStartDate.substring(0, 10);
+
+        // 查询导入的税单
+        List<TaxInfoEntity> taxInfoEntities = taxInfoService.queryList(param);
+        // 查询昨天的订单明细的税单
+        List<OrderGoodsDto> orderGoodsEntities = orderGoodsService.queryYesterdayTax(comparedDate);
+
+        Map<String, String> map = orderGoodsEntities.stream()
+                .collect(Collectors.toMap(OrderGoodsDto::getOrderSn, OrderGoodsDto::getTax , (key1,key2)->key2));
+
+        List<TaxComparedErrorEntity> taxComparedErrorEntities = new LinkedList<>();
+
+        // 对比两个结果集的税
+        for (TaxInfoEntity taxInfoEntity : taxInfoEntities) {
+
+            // 获取订单号
+            String merchOrderSn = taxInfoEntity.getMerchOrderSn();
+            BigDecimal tax = taxInfoEntity.getTax();
+
+            taxInfoEntity.setCompared("1");
+            taxInfoEntity.setComparedTime(format.format(new Date()));
+            String kmallTax = map.get(merchOrderSn);
+            if(StringUtils.isNullOrEmpty(kmallTax)){
+                // 如果为空,证明kmall这个订单是异常订单
+                TaxComparedErrorEntity taxComparedErrorEntity = new TaxComparedErrorEntity();
+                taxComparedErrorEntity.setMerchOrderSn(merchOrderSn);
+                taxComparedErrorEntity.setCreateTime(format.format(new Date()));
+                taxComparedErrorEntity.setOmsTax(tax);
+                taxComparedErrorEntity.setKmallTax(new BigDecimal(0));
+                taxComparedErrorEntities.add(taxComparedErrorEntity);
+            }else{
+                // 获取kmall的税
+                BigDecimal kmall = new BigDecimal(kmallTax);
+                // 对比oms跟kmall的税,如果不一致,生成异常信息
+                if(kmall.compareTo(tax) != 0){
+                    TaxComparedErrorEntity taxComparedErrorEntity = new TaxComparedErrorEntity();
+                    taxComparedErrorEntity.setMerchOrderSn(merchOrderSn);
+                    taxComparedErrorEntity.setCreateTime(format.format(new Date()));
+                    taxComparedErrorEntity.setOmsTax(tax);
+                    taxComparedErrorEntity.setKmallTax(kmall);
+                    taxComparedErrorEntities.add(taxComparedErrorEntity);
+                }
+            }
+            // 交验完后从map中删除这个key
+            map.remove(merchOrderSn);
+        }
+
+        // 判断是否还有未生成的异常订单,循环map
+        Iterator<String> iterator = map.keySet().iterator();
+        while(iterator.hasNext()){
+            String orderSn = iterator.next();
+            String kmallTax = map.get(orderSn);
+            TaxComparedErrorEntity taxComparedErrorEntity = new TaxComparedErrorEntity();
+            taxComparedErrorEntity.setMerchOrderSn(orderSn);
+            taxComparedErrorEntity.setCreateTime(format.format(new Date()));
+            taxComparedErrorEntity.setOmsTax(new BigDecimal(0));
+            taxComparedErrorEntity.setKmallTax(new BigDecimal(kmallTax));
+            taxComparedErrorEntities.add(taxComparedErrorEntity);
+        }
+
+        // 批量插入
+        if(taxComparedErrorEntities != null && taxComparedErrorEntities.size() > 0){
+            taxComparedErrorDao.saveBatch(taxComparedErrorEntities);
+        }
+        if(taxInfoEntities != null && taxInfoEntities.size() > 0){
+            taxInfoService.updateBatch(taxInfoEntities);
+        }
+
+        return "对比成功";
+    }
+}

+ 120 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/compared/TaxInfoServiceImpl.java

@@ -0,0 +1,120 @@
+package com.kmall.admin.service.impl.compared;
+
+import com.kmall.admin.dao.compared.TaxInfoDao;
+import com.kmall.admin.dto.TaxOrderDto;
+import com.kmall.admin.entity.compared.TaxInfoEntity;
+import com.kmall.admin.fromcomm.entity.SysUserEntity;
+import com.kmall.admin.service.compared.TaxInfoService;
+import com.kmall.admin.utils.ShiroUtils;
+import org.apache.poi.ss.formula.functions.T;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+
+/**
+ * Service实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-12-29 14:11:24
+ */
+@Service("taxInfoService")
+public class TaxInfoServiceImpl implements TaxInfoService {
+    @Autowired
+    private TaxInfoDao taxInfoDao;
+
+    @Override
+    public TaxInfoEntity queryObject(Integer mtiId) {
+        return taxInfoDao.queryObject(mtiId);
+    }
+
+    @Override
+    public List<TaxInfoEntity> queryList(Map<String, Object> map) {
+        return taxInfoDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        return taxInfoDao.queryTotal(map);
+    }
+
+    @Override
+    public int save(TaxInfoEntity taxInfo) {
+        return taxInfoDao.save(taxInfo);
+    }
+
+    @Override
+    public int update(TaxInfoEntity taxInfo) {
+        return taxInfoDao.update(taxInfo);
+    }
+
+    @Override
+    public int delete(Integer mtiId) {
+        return taxInfoDao.delete(mtiId);
+    }
+
+    @Override
+    public int deleteBatch(Integer[]mtiIds) {
+        return taxInfoDao.deleteBatch(mtiIds);
+    }
+
+    /**
+     * 上传税单
+     *
+     * @param taxOrderDtoList
+     * @return
+     */
+    @Override
+    @Transactional
+    public boolean uploadExcel(List<TaxOrderDto> taxOrderDtoList) {
+
+        if(taxOrderDtoList != null && taxOrderDtoList.size() > 0){
+
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            SysUserEntity user = ShiroUtils.getUserEntity();
+            List<TaxInfoEntity> taxInfoEntities = new LinkedList<>();
+
+            Map<String,TaxInfoEntity> importTax = new HashMap<>();
+
+            for (TaxOrderDto taxOrderDto : taxOrderDtoList) {
+                TaxInfoEntity taxInfoEntity = new TaxInfoEntity();
+                taxInfoEntity.setMerchOrderSn(taxOrderDto.getOrderSn());
+                taxInfoEntity.setPreTaxPrice(new BigDecimal(taxOrderDto.getPreTaxPrice()));
+                taxInfoEntity.setTax(new BigDecimal(taxOrderDto.getTax()));
+                taxInfoEntity.setImportTime(format.format(new Date()));
+                taxInfoEntity.setImporter(user.getUserId()+"");
+                taxInfoEntity.setCompared("0");
+
+                TaxInfoEntity entity = importTax.get(taxOrderDto.getOrderSn());
+                if(entity != null){
+                    entity.setTax(entity.getTax().add(new BigDecimal(taxOrderDto.getTax())));
+                    continue;
+                }
+                importTax.put(taxOrderDto.getOrderSn(),taxInfoEntity);
+                taxInfoEntities.add(taxInfoEntity);
+            }
+            taxInfoDao.saveBatch(taxInfoEntities);
+            return true;
+        }else{
+            return false;
+        }
+    }
+
+    @Override
+    public void updateBatch(List<TaxInfoEntity> taxInfoEntities) {
+        taxInfoDao.updateBatch(taxInfoEntities);
+    }
+
+    /**
+     * 逻辑删除全部数据
+     */
+    @Override
+    public void deleteAll() {
+        taxInfoDao.deleteAll();
+    }
+}

+ 267 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/kmall2eccs/KtoEccsServiceImpl.java

@@ -0,0 +1,267 @@
+package com.kmall.admin.service.impl.kmall2eccs;
+
+import com.alibaba.fastjson.JSON;
+import com.google.gson.Gson;
+import com.kmall.admin.dao.kmall2eccs.KtoEccsDao;
+import com.kmall.admin.entity.kmall2eccs.KtoEccsEntity;
+import com.kmall.admin.properties.EccsProperties;
+import com.kmall.admin.service.kmall2eccs.KtoEccsService;
+import com.kmall.admin.utils.data.response.ResponseMessage;
+import com.kmall.admin.utils.oms.OmsSign;
+import com.kmall.common.constant.Dict;
+import com.kmall.common.utils.R;
+import com.kmall.common.utils.StringUtils;
+import okhttp3.Request;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+
+
+/**
+ * Service实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-12 15:50:45
+ */
+@Service("ktoEccsService")
+public class KtoEccsServiceImpl implements KtoEccsService {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(KtoEccsServiceImpl.class);
+
+    @Autowired
+    private KtoEccsDao ktoEccsDao;
+
+    @Autowired
+    private EccsProperties eccsProperties;
+
+
+    @Override
+    public KtoEccsEntity queryObject(Long kteId) {
+        return ktoEccsDao.queryObject(kteId);
+    }
+
+    @Override
+    public List<KtoEccsEntity> queryList(Map<String, Object> map) {
+        return ktoEccsDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        return ktoEccsDao.queryTotal(map);
+    }
+
+    @Override
+    public int save(KtoEccsEntity ktoEccs) {
+        return ktoEccsDao.save(ktoEccs);
+    }
+
+    @Override
+    public int update(KtoEccsEntity ktoEccs) {
+        return ktoEccsDao.update(ktoEccs);
+    }
+
+    @Override
+    public int delete(Long kteId) {
+        return ktoEccsDao.delete(kteId);
+    }
+
+    @Override
+    public int deleteBatch(Long[]kteIds) {
+        return ktoEccsDao.deleteBatch(kteIds);
+    }
+
+    @Override
+    public void saveBatch(List<KtoEccsEntity> ktoEccsEntities) {
+        ktoEccsDao.saveBatch(ktoEccsEntities);
+    }
+
+    /**
+     * 中网向中控发送数据请求
+     *
+     * @return
+     */
+    @Override
+    public R sendToEccs(Map<String,String> param,String type) {
+
+        String returnUrl = "";
+        Integer page = null;
+        Integer pageSize = null;
+
+        // 判断是接口调用还是定时器调用
+        if(Dict.sendToEccsType.inter.getItem().equals(type)){
+
+            // 参数校验
+            R paramCheck = checkParam(param);
+            if(Integer.valueOf(paramCheck.get("code").toString()) != 0){
+                LOGGER.info("校验校验失败,原参数:"+param);
+                return R.error("参数校验失败");
+            }
+
+            // 校验签名
+            boolean check = checkSign(param);
+            if(!check){
+                return R.error("签名校验失败");
+            }
+            // 获取回调地址
+            returnUrl = param.get("returnUrl");
+            // 获取需要的页数
+            page = Integer.valueOf(param.get("page"));
+            // 获取需要的条数
+            pageSize = Integer.valueOf(param.get("pageSize"));
+        }
+
+
+        // 查询数据库中的记录
+        List<KtoEccsEntity> queryList = ktoEccsDao.queryNotSendRecord(page,pageSize);
+
+        List<KtoEccsEntity> sendList = new LinkedList<>();
+
+        if(queryList != null && queryList.size() > 0){
+
+            // 判断查询的记录中,是否大于100条,如果大于100条,分批次发送
+            if(queryList.size() > 100){
+                for (int i = 0; i < queryList.size(); i++) {
+                    sendList.add(queryList.get(i));
+                    // 每一百条组装成一个json串,发送一次
+                    if(i != 0 && i % 100 == 0){
+                        // 发送
+                        ResponseMessage responseMessage = sendHttpToEccs(returnUrl, sendList);
+                        // 记录这一百条的发送状态
+                        handleReturnMsg(queryList, responseMessage);
+                        sendList = new LinkedList<>();
+                    }else if(i == (queryList.size() - 1)){
+                        // 发送
+                        ResponseMessage responseMessage = sendHttpToEccs(returnUrl, sendList);
+                        // 记录这一百条的发送状态
+                        handleReturnMsg(queryList, responseMessage);
+                    }
+                }
+
+            }else{
+            // 如果没有大于100条,直接发送
+                for (int i = 0; i < queryList.size(); i++) {
+                    sendList.add(queryList.get(i));
+                }
+                // 发送
+                ResponseMessage responseMessage = sendHttpToEccs(returnUrl, sendList);
+                // 记录这一百条的发送状态
+                handleReturnMsg(queryList, responseMessage);
+            }
+        }
+
+
+        return R.ok("发送成功");
+    }
+
+    private R checkParam(Map<String, String> param) {
+
+        if(param.get("sign") == null){
+            return R.error("签名参数不存在");
+        }
+        if(param.get("data") == null){
+            return R.error("data参数不存在");
+        }
+        if(param.get("page") == null){
+            return R.error("page参数不存在");
+        }
+        if(param.get("pageSize") == null){
+            return R.error("pageSize参数不存在");
+        }
+        if(param.get("returnUrl") == null){
+            return R.error("returnUrl参数不存在");
+        }
+        return R.ok();
+    }
+
+    private boolean checkSign(Map<String, String> param) {
+
+        Map<String, String> sParaTemp = new TreeMap<>();
+        sParaTemp.put("data",param.get("data"));
+
+        //生成要请求给oms秘钥
+        LOGGER.info("md5混淆码参数:" + eccsProperties.getMd5Salt());
+        String sign = OmsSign.sign(sParaTemp,eccsProperties.getMd5Salt());
+
+        String checkSign = param.get("sign");
+
+        if(!sign.equals(checkSign))
+            return false;
+        return true;
+
+    }
+
+    /**
+     * 处理返回的结果集,并修改状态
+     * @param queryList
+     * @param responseMessage
+     */
+    private void handleReturnMsg(List<KtoEccsEntity> queryList, ResponseMessage responseMessage) {
+        // 如果是成功代码,
+        if ("0".equals(responseMessage.getCode())) {
+            // 修改为成功
+            queryList.forEach(ktoEccsEntity -> {
+                ktoEccsEntity.setSendStatus("01");
+                ktoEccsEntity.setRequestTime(new Date());
+            });
+        } else {
+            // 修改为发送失败
+            queryList.forEach(ktoEccsEntity -> {
+                ktoEccsEntity.setSendStatus("02");
+                ktoEccsEntity.setFailReason(responseMessage.getMsg());
+            });
+        }
+        // 批量修改记录状态
+        ktoEccsDao.updateBatch(queryList);
+    }
+
+    /**
+     * 发送请求个中控系统
+     * @param returnUrl 请求的地址
+     * @param sendList 发送的数据鞂
+     * @return
+     */
+    private ResponseMessage sendHttpToEccs(String returnUrl, List<KtoEccsEntity> sendList) {
+        String jsonParam = JSON.toJSONString(sendList);
+        // 发送请求向中控系统
+        Map<String, String> sParaTemp = new TreeMap<>();
+        sParaTemp.put("data",jsonParam);
+        String timestamp = String.valueOf(System.currentTimeMillis()/1000);
+        sParaTemp.put("timestamp", timestamp);
+        //生成要请求给oms秘钥
+        LOGGER.info("md5混淆码参数:" + eccsProperties.getMd5Salt());
+        String sign = OmsSign.sign(sParaTemp,eccsProperties.getMd5Salt());
+        sParaTemp.put("sign", sign);
+
+        if(StringUtils.isNullOrEmpty(returnUrl)){
+            returnUrl = eccsProperties.getRequestUrl();
+        }
+        //构建Request
+        Request request = com.kmall.admin.utils.oms.OkHttpUtils.buildRequest(returnUrl, JSON.toJSONString(sParaTemp));
+        LOGGER.info("发送中控的请求报文:" + request);
+        // 同步访问,返回结果字符串
+        String responseString = null;
+        try {
+
+            responseString = com.kmall.admin.utils.oms.OkHttpUtils.post(request);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        LOGGER.info("中控的响应报文"+responseString);
+        //解析响应数据
+        Gson gson = new Gson();
+        ResponseMessage result = gson.fromJson(responseString, ResponseMessage.class);
+        if(result == null){
+            String info = "解析响应数据Result失败";
+            LOGGER.error("--- {}", info);
+            throw new RuntimeException(info);
+        }
+
+        return result;
+    }
+}

+ 5 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/mk/MkActivitiesServiceImpl.java

@@ -114,4 +114,9 @@ public class MkActivitiesServiceImpl implements MkActivitiesService {
     public List<MkActivitiesEntity> queryByNow(String storeId, String currentTime) {
         return mkActivitiesDao.queryByNow(storeId,currentTime);
     }
+
+    @Override
+    public List<MkActivitiesEntity> queryByTopic(String storeId, String currentTime, String topic) {
+        return mkActivitiesDao.queryByTopic(storeId,currentTime,topic);
+    }
 }

+ 59 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/shop/PriceModificationRecordServiceImpl.java

@@ -0,0 +1,59 @@
+package com.kmall.admin.service.impl.shop;
+
+import com.kmall.admin.dao.shop.PriceModificationRecordDao;
+import com.kmall.admin.entity.shop.PriceModificationRecordEntity;
+import com.kmall.admin.service.shop.PriceModificationRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 价格修改记录表Service实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-22 09:07:06
+ */
+@Service("priceModificationRecordService")
+public class PriceModificationRecordServiceImpl implements PriceModificationRecordService {
+    @Autowired
+    private PriceModificationRecordDao priceModificationRecordDao;
+
+    @Override
+    public PriceModificationRecordEntity queryObject(Integer mpmrId) {
+        return priceModificationRecordDao.queryObject(mpmrId);
+    }
+
+    @Override
+    public List<PriceModificationRecordEntity> queryList(Map<String, Object> map) {
+        return priceModificationRecordDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        return priceModificationRecordDao.queryTotal(map);
+    }
+
+    @Override
+    public int save(PriceModificationRecordEntity priceModificationRecord) {
+        return priceModificationRecordDao.save(priceModificationRecord);
+    }
+
+    @Override
+    public int update(PriceModificationRecordEntity priceModificationRecord) {
+        return priceModificationRecordDao.update(priceModificationRecord);
+    }
+
+    @Override
+    public int delete(Integer mpmrId) {
+        return priceModificationRecordDao.delete(mpmrId);
+    }
+
+    @Override
+    public int deleteBatch(Integer[]mpmrIds) {
+        return priceModificationRecordDao.deleteBatch(mpmrIds);
+    }
+}

+ 177 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/shop/ShopErrorPriceRecordServiceImpl.java

@@ -0,0 +1,177 @@
+package com.kmall.admin.service.impl.shop;
+
+import com.kmall.admin.dao.shop.ShopErrorPriceRecordDao;
+import com.kmall.admin.dto.UpdateGoodPriceDto;
+import com.kmall.admin.entity.shop.PriceModificationRecordEntity;
+import com.kmall.admin.entity.shop.ShopErrorPriceRecordEntity;
+import com.kmall.admin.fromcomm.entity.SysUserEntity;
+import com.kmall.admin.service.MkActivitiesPromotionService;
+import com.kmall.admin.service.MkDailyActivitiesService;
+import com.kmall.admin.service.ProductStoreRelaService;
+import com.kmall.admin.service.shop.PriceModificationRecordService;
+import com.kmall.admin.service.shop.ShopErrorPriceRecordService;
+import com.kmall.admin.utils.ShiroUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 门店价格异常记录表Service实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-19 16:03:52
+ */
+@Service("shopErrorPriceRecordService")
+public class ShopErrorPriceRecordServiceImpl implements ShopErrorPriceRecordService {
+    @Autowired
+    private ShopErrorPriceRecordDao shopErrorPriceRecordDao;
+
+    @Autowired
+    private ProductStoreRelaService productStoreRelaService;
+    @Autowired
+    private MkActivitiesPromotionService mkActivitiesPromotionService;
+    @Autowired
+    private MkDailyActivitiesService dailyActivitiesService;
+
+    @Autowired
+    private PriceModificationRecordService priceModificationRecordService;
+
+
+    @Override
+    public ShopErrorPriceRecordEntity queryObject(Integer mseprId) {
+        return shopErrorPriceRecordDao.queryObject(mseprId);
+    }
+
+    @Override
+    public List<ShopErrorPriceRecordEntity> queryList(Map<String, Object> map) {
+        return shopErrorPriceRecordDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        return shopErrorPriceRecordDao.queryTotal(map);
+    }
+
+    @Override
+    public int save(ShopErrorPriceRecordEntity shopErrorPriceRecord) {
+        return shopErrorPriceRecordDao.save(shopErrorPriceRecord);
+    }
+
+    @Override
+    public int update(ShopErrorPriceRecordEntity shopErrorPriceRecord) {
+        return shopErrorPriceRecordDao.update(shopErrorPriceRecord);
+    }
+
+    @Override
+    public int delete(Integer mseprId) {
+        return shopErrorPriceRecordDao.delete(mseprId);
+    }
+
+    @Override
+    public int deleteBatch(Integer[]mseprIds) {
+        return shopErrorPriceRecordDao.deleteBatch(mseprIds);
+    }
+
+    /**
+     * 批量插入
+     *
+     * @param shopErrorPriceRecordEntities
+     */
+    @Override
+    public void saveBatch(List<ShopErrorPriceRecordEntity> shopErrorPriceRecordEntities) {
+        shopErrorPriceRecordDao.saveBatch(shopErrorPriceRecordEntities);
+    }
+
+    /**
+     * 修改价格
+     *
+     * @param updateGoodPriceDto
+     */
+    @Override
+    @Transactional
+    public void updateGoodsPrice(UpdateGoodPriceDto updateGoodPriceDto) {
+        ShopErrorPriceRecordEntity shopErrorPriceRecordEntity = queryObject(Integer.valueOf(updateGoodPriceDto.getMseprId()));
+
+        // 价格异常类型
+        Integer priceType = shopErrorPriceRecordEntity.getPriceType();
+        // 修改价格类型
+        String type = updateGoodPriceDto.getType();
+
+        // 确认是最高价还是最低价
+        String updatePrice = "";
+        if("highest".equals(type)){
+            updatePrice = shopErrorPriceRecordEntity.getHighestPrice();
+        }else if("lowest".equals(type)){
+            updatePrice = shopErrorPriceRecordEntity.getLowestPrice();
+        }else if("custom".equals(type)){
+            updatePrice = updateGoodPriceDto.getCustomPriceInput();
+        }
+
+        // 根据类型决定是什么操作
+        // 门店商品
+        if(priceType == 1){
+//        productStoreRelaService;
+            handlePrice(updatePrice,productStoreRelaService,shopErrorPriceRecordEntity);
+        // 日常活动
+        }else if(priceType == 2){
+//        dailyActivitiesService;
+            handlePrice(updatePrice,dailyActivitiesService,shopErrorPriceRecordEntity);
+        // 临时促销
+        }else if(priceType == 3){
+//        mkActivitiesPromotionService;
+            handlePrice(updatePrice,mkActivitiesPromotionService,shopErrorPriceRecordEntity);
+
+        }
+    }
+
+    private void handlePrice(String updatePrice,Object service,ShopErrorPriceRecordEntity shopErrorPriceRecordEntity){
+        // 获取当前登录用户
+        SysUserEntity user = ShiroUtils.getUserEntity();
+
+        String sku = shopErrorPriceRecordEntity.getSku();
+
+        PriceModificationRecordEntity p = new PriceModificationRecordEntity();
+
+        // 修改门店商品价格
+        if(service instanceof ProductStoreRelaService){
+            ProductStoreRelaService productStoreRelaService = (ProductStoreRelaService) service;
+            productStoreRelaService.updatePriceBySku(updatePrice,sku);
+
+            p.setModifySource(1);
+        // 修改日常活动价格
+        }else if(service instanceof MkActivitiesPromotionService){
+            MkActivitiesPromotionService mkActivitiesPromotionService = (MkActivitiesPromotionService) service;
+            mkActivitiesPromotionService.updatePriceBySku(updatePrice,sku,shopErrorPriceRecordEntity.getMkaId());
+
+            p.setModifySource(2);
+        // 修改临时促销价格
+        }else if(service instanceof MkDailyActivitiesService){
+            MkDailyActivitiesService mkDailyActivitiesService = (MkDailyActivitiesService)service;
+            mkDailyActivitiesService.updatePriceBySku(updatePrice,sku,shopErrorPriceRecordEntity.getMkaId());
+
+            p.setModifySource(3);
+        }
+
+
+        p.setBarcode(shopErrorPriceRecordEntity.getBarcode());
+        p.setCurrentPrice(shopErrorPriceRecordEntity.getCurrentPrice());
+        p.setModifyPrice(updatePrice);
+        p.setMerchSn(shopErrorPriceRecordEntity.getMerchSn());
+        p.setShopSn(shopErrorPriceRecordEntity.getShopSn());
+        p.setSku(shopErrorPriceRecordEntity.getSku());
+        p.setThirdMerchSn(shopErrorPriceRecordEntity.getThirdMerchSn());
+        p.setModerSn(user.getUserId()+"");
+        p.setModTime(new Date());
+
+        p.setModifyType(1);
+
+        priceModificationRecordService.save(p);
+
+    }
+}

+ 82 - 0
kmall-admin/src/main/java/com/kmall/admin/service/kmall2eccs/KtoEccsService.java

@@ -0,0 +1,82 @@
+package com.kmall.admin.service.kmall2eccs;
+
+
+import com.kmall.admin.entity.kmall2eccs.KtoEccsEntity;
+import com.kmall.common.utils.R;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Service接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-12 15:50:45
+ */
+public interface KtoEccsService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param kteId 主键
+     * @return 实体
+     */
+    KtoEccsEntity queryObject(Long kteId);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<KtoEccsEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param ktoEccs 实体
+     * @return 保存条数
+     */
+    int save(KtoEccsEntity ktoEccs);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param ktoEccs 实体
+     * @return 更新条数
+     */
+    int update(KtoEccsEntity ktoEccs);
+
+    /**
+     * 根据主键删除
+     *
+     * @param kteId
+     * @return 删除条数
+     */
+    int delete(Long kteId);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param kteIds
+     * @return 删除条数
+     */
+    int deleteBatch(Long[]kteIds);
+
+    void saveBatch(List<KtoEccsEntity> ktoEccsEntities);
+
+    /**
+     * 中网向中控发送数据请求
+     * @return
+     */
+    R sendToEccs(Map<String,String> param,String type);
+}

+ 2 - 0
kmall-admin/src/main/java/com/kmall/admin/service/mk/MkActivitiesService.java

@@ -78,4 +78,6 @@ public interface MkActivitiesService {
      * @return
      */
     List<MkActivitiesEntity> queryByNow(String storeId, String currentTime);
+
+    List<MkActivitiesEntity> queryByTopic(String storeId, String format, String topic);
 }

+ 73 - 0
kmall-admin/src/main/java/com/kmall/admin/service/shop/PriceModificationRecordService.java

@@ -0,0 +1,73 @@
+package com.kmall.admin.service.shop;
+
+
+import com.kmall.admin.entity.shop.PriceModificationRecordEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 价格修改记录表Service接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-22 09:07:06
+ */
+public interface PriceModificationRecordService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param mpmrId 主键
+     * @return 实体
+     */
+    PriceModificationRecordEntity queryObject(Integer mpmrId);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<PriceModificationRecordEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param priceModificationRecord 实体
+     * @return 保存条数
+     */
+    int save(PriceModificationRecordEntity priceModificationRecord);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param priceModificationRecord 实体
+     * @return 更新条数
+     */
+    int update(PriceModificationRecordEntity priceModificationRecord);
+
+    /**
+     * 根据主键删除
+     *
+     * @param mpmrId
+     * @return 删除条数
+     */
+    int delete(Integer mpmrId);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param mpmrIds
+     * @return 删除条数
+     */
+    int deleteBatch(Integer[]mpmrIds);
+}

+ 86 - 0
kmall-admin/src/main/java/com/kmall/admin/service/shop/ShopErrorPriceRecordService.java

@@ -0,0 +1,86 @@
+package com.kmall.admin.service.shop;
+
+
+import com.kmall.admin.dto.UpdateGoodPriceDto;
+import com.kmall.admin.entity.shop.ShopErrorPriceRecordEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 门店价格异常记录表Service接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-01-19 16:03:52
+ */
+public interface ShopErrorPriceRecordService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param mseprId 主键
+     * @return 实体
+     */
+    ShopErrorPriceRecordEntity queryObject(Integer mseprId);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<ShopErrorPriceRecordEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param shopErrorPriceRecord 实体
+     * @return 保存条数
+     */
+    int save(ShopErrorPriceRecordEntity shopErrorPriceRecord);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param shopErrorPriceRecord 实体
+     * @return 更新条数
+     */
+    int update(ShopErrorPriceRecordEntity shopErrorPriceRecord);
+
+    /**
+     * 根据主键删除
+     *
+     * @param mseprId
+     * @return 删除条数
+     */
+    int delete(Integer mseprId);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param mseprIds
+     * @return 删除条数
+     */
+    int deleteBatch(Integer[]mseprIds);
+
+    /**
+     * 批量插入
+     * @param shopErrorPriceRecordEntities
+     */
+    void saveBatch(List<ShopErrorPriceRecordEntity> shopErrorPriceRecordEntities);
+
+    /**
+     * 修改价格
+     * @param params
+     */
+    void updateGoodsPrice(UpdateGoodPriceDto params);
+}

+ 51 - 0
kmall-admin/src/main/java/com/kmall/admin/task/SendToEccsTask.java

@@ -0,0 +1,51 @@
+package com.kmall.admin.task;
+
+import com.kmall.admin.service.GoodsService;
+import com.kmall.admin.service.kmall2eccs.KtoEccsService;
+import com.kmall.common.constant.Dict;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author zhangchuangbiao
+ * @version 1.0
+ * 2021-01-28 14:59
+ */
+
+
+@Component("sendToEccsTask")
+@EnableScheduling
+@EnableAsync
+public class SendToEccsTask {
+
+
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private KtoEccsService ktoEccsService;
+
+
+    /**
+     * 发送数据给中控系统
+     * 每天1个小时执行1次
+     */
+    @Scheduled(cron = "0 0/1 * * * ?")
+//    @Scheduled(cron = "0 0 0/1 * * ?")
+    public void syncOmsHsCode() {
+        logger.info("同步所有商品表海关备案编码数据开始-----------------");
+        try {
+            ktoEccsService.sendToEccs(null, Dict.sendToEccsType.task.getItem());
+        } catch (Exception e) {
+            e.printStackTrace();
+            logger.info("同步所有商品表海关备案编码数据异常-----------------原因:" + e.getMessage());
+        }
+        logger.info("同步所有商品表海关备案编码数据结束-----------");
+
+    }
+
+}

+ 50 - 14
kmall-admin/src/main/java/com/kmall/admin/utils/CalculateTax.java

@@ -1,10 +1,6 @@
 package com.kmall.admin.utils;
 
 
-import com.kmall.admin.dao.GoodsDao;
-import com.kmall.admin.dao.TaxErrorRecordDao;
-import com.kmall.admin.dto.GoodsDetailsDto;
-import com.kmall.admin.dto.GoodsDto;
 import com.kmall.admin.entity.GoodsEntity;
 import com.kmall.admin.entity.TaxErrorRecordEntity;
 import com.kmall.admin.service.GoodsService;
@@ -16,8 +12,6 @@ import org.slf4j.LoggerFactory;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 /**
  * xwh
@@ -28,7 +22,7 @@ public class CalculateTax {
 
     private static List<String> hsCodeList = new ArrayList<>();
 
-    private static Map<String,BigDecimal> hsCodeMap = new HashMap<String,BigDecimal>();
+    public static Map<String,BigDecimal> hsCodeMap = new HashMap<>();
 
     private static BigDecimal consumerGoodsRate = new BigDecimal("0.2306");
     private static BigDecimal noConsumerGoodsRate = new BigDecimal("0.091");
@@ -57,7 +51,7 @@ public class CalculateTax {
 
     static {
         hsCodeMap.put("3304990029",new BigDecimal("10"));
-        hsCodeMap.put("3304910000",new BigDecimal("10"));
+        hsCodeMap.put("3304910090",new BigDecimal("10"));
         hsCodeMap.put("3303000010",new BigDecimal("10"));
         hsCodeMap.put("3303000020",new BigDecimal("10"));
         hsCodeMap.put("3304100091",new BigDecimal("10"));
@@ -290,8 +284,11 @@ public class CalculateTax {
                                 // 如果用23.06去计算,还是大于阈值,那就是用23.06去计税
                                 return getTax(retailPrice, consumerGoodsRate);
                             }else{
-                                BigDecimal tax = getFinalTax(goods, retailPrice, goodsService, cusGoodsName, qty1, qty2);
-                                return tax;
+                                throwPriceException(goods, retailPrice, cosmThresholdValue, cusGoodsName, qty1, qty2);
+//                                throw new RuntimeException("商品价格有误!");
+                                // 这块需要报错
+//                                BigDecimal tax = getFinalTax(goods, retailPrice, goodsService, cusGoodsName, qty1, qty2);
+//                                return tax;
                             }
                         }
 
@@ -305,8 +302,11 @@ public class CalculateTax {
                             // 如果不是,重新用0.091计算一次
                             gramOrMlUnitPrice = getUnitPrice(retailPrice, noConsumerGoodsRate, cusGoodsName, qty1, qty2);
                             if (gramOrMlUnitPrice.compareTo(cosmThresholdValue) >= 0) {
-                                BigDecimal tax = getFinalTax(goods, retailPrice, goodsService, cusGoodsName, qty1, qty2);
-                                return tax;
+                                throwPriceException(goods, retailPrice, cosmThresholdValue, cusGoodsName, qty1, qty2);
+//                                throw new RuntimeException("商品价格有误!");
+                                // 这块需要报错
+//                                BigDecimal tax = getFinalTax(goods, retailPrice, goodsService, cusGoodsName, qty1, qty2);
+//                                return tax;
 
                             }else{
                                 GoodsEntity updateGoods = new GoodsEntity();
@@ -353,6 +353,43 @@ public class CalculateTax {
         }
     }
 
+    /**
+     * 计算商品的最大值跟最小值
+     * @param goods
+     * @param retailPrice
+     * @param cosmThresholdValue
+     * @param cusGoodsName
+     * @param qty1
+     * @param qty2
+     */
+    private static void throwPriceException(GoodsEntity goods, BigDecimal retailPrice, BigDecimal cosmThresholdValue, String cusGoodsName, BigDecimal qty1, BigDecimal qty2) {
+
+        BigDecimal maxPrice = null;
+        BigDecimal minPrice = null;
+        BigDecimal goodsRate = goods.getGoodsRate();
+        // 根据税后价计算出税前价
+        BigDecimal productUnitPrice = retailPrice
+                .divide(new BigDecimal(1).add(goodsRate),10, RoundingMode.HALF_DOWN) ; // TODO 需要得到公式计算出税前价
+
+        if (StringUtils.isNotBlank(cusGoodsName) && (cusGoodsName.contains("“片”") || cusGoodsName.contains("“张”") || cusGoodsName.contains("片") || cusGoodsName.contains("张"))) {
+            //片、张的单价
+            if (qty2 != null) {
+
+                // 计算最高价格  法二 * 阈值 * (1+税率)
+                maxPrice = qty2.multiply(cosmThresholdValue).multiply(new BigDecimal(1).add(consumerGoodsRate)).subtract(new BigDecimal("0.2")).setScale(2,RoundingMode.HALF_UP);
+                minPrice = qty2.multiply(cosmThresholdValue).multiply(new BigDecimal(1).add(noConsumerGoodsRate)).setScale(2,RoundingMode.HALF_UP);
+            }
+        } else {
+            //毫升、克的单价
+            if (qty1 != null) {
+                BigDecimal gramOrMl = qty1.multiply(new BigDecimal(1000));
+//                unit1Price = productUnitPrice.divide(gramOrMl, 5, BigDecimal.ROUND_HALF_UP);
+                maxPrice = gramOrMl.multiply(cosmThresholdValue).multiply(new BigDecimal(1).add(consumerGoodsRate)).subtract(new BigDecimal("0.2")).setScale(2,RoundingMode.HALF_UP);
+                minPrice = gramOrMl.multiply(cosmThresholdValue).multiply(new BigDecimal(1).add(noConsumerGoodsRate)).setScale(2,RoundingMode.HALF_UP);
+            }
+        }
+        throw new RuntimeException("商品:"+goods.getSku()+" 定价有误,导致无法清关!定价应介于大于"+maxPrice+"元或小于"+minPrice+"元。-"+maxPrice+"-"+minPrice);
+    }
 
 
     private static BigDecimal getFinalTax(GoodsEntity goods, BigDecimal retailPrice, GoodsService goodsService, String cusGoodsName, BigDecimal qty1, BigDecimal qty2) {
@@ -362,8 +399,7 @@ public class CalculateTax {
         BigDecimal noConsumerTaxPrice = retailPrice.divide(BigDecimal.ONE.add(noConsumerGoodsRate),10,RoundingMode.HALF_UP).setScale(2,RoundingMode.HALF_UP);
         BigDecimal tax1 = noConsumerTaxPrice.multiply(consumerGoodsRate).setScale(10,RoundingMode.HALF_UP);
         BigDecimal finalPrice1 = tax1.add(noConsumerTaxPrice);
-// 394.78
-// 310.29
+
 
         BigDecimal consumerTaxPrice = retailPrice.divide(BigDecimal.ONE.add(consumerGoodsRate),10,RoundingMode.HALF_UP).setScale(2,RoundingMode.HALF_UP);
         BigDecimal tax2 = consumerTaxPrice.multiply(noConsumerGoodsRate).setScale(10,RoundingMode.HALF_UP);

+ 128 - 0
kmall-admin/src/main/java/com/kmall/admin/utils/OkHttpUtils.java

@@ -0,0 +1,128 @@
+package com.kmall.admin.utils;
+
+import okhttp3.*;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author Scott Chen
+ * @date 2017/3/13
+ */
+public class OkHttpUtils {
+
+    public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
+    public static final int CONNEC_TIME = 20;
+    public static final int READ_TIME = 30;
+    public static final int WRITE_TIME = 30;
+
+    private static OkHttpClient okHttpClient = null;
+    static{
+        okHttpClient = new OkHttpClient.Builder()
+                .connectTimeout(CONNEC_TIME, TimeUnit.SECONDS)
+                .readTimeout(READ_TIME, TimeUnit.SECONDS)
+                .writeTimeout(WRITE_TIME, TimeUnit.SECONDS)
+                .build();
+    }
+
+    /**
+     * 构造RequestBody
+     *
+     * @param params
+     * @return
+     */
+    public static RequestBody buildRequestBody(Map<String, String> params) {
+        FormBody.Builder builder = new FormBody.Builder();
+        Iterator<Map.Entry<String, String>> iterator = params.entrySet().iterator();
+        while (iterator.hasNext()) {
+            Map.Entry<String, String> entry = iterator.next();
+            builder.add(entry.getKey(), entry.getValue());
+        }
+        return builder.build();
+    }
+
+    /**
+     * 以字符串数据构建Request(未使用)
+     * @param url
+     * @param json
+     * @return
+     */
+    public static Request buildRequest(String url, String json) {
+        RequestBody body = RequestBody.create(JSON, json);
+        return buildRequest(url, body);
+    }
+
+    /**
+     * 构建Request
+     * @param url
+     * @param body
+     * @return
+     */
+    public static Request buildRequest(String url, RequestBody body) {
+        return new Request.Builder()
+                .url(url)
+                .post(body)
+                .build();
+    }
+
+    /**
+     * 同步访问,返回结果字符串
+     * 可能超时
+     *
+     * @param request
+     * @return
+     * @throws IOException
+     */
+    public static String post(Request request) throws IOException {
+        Response response = okHttpClient.newCall(request).execute();
+        String result = "";
+        if (response.isSuccessful()) {
+            result = response.body().string();
+        }else {
+            throw new IOException("okhttp3 post exception: " + response);
+        }
+        return result;
+    }
+
+    /**
+     * 同步访问,返回Response
+     * 可能超时
+     *
+     * @param request
+     * @return
+     * @throws IOException
+     */
+    public static Response postReturnResponse(Request request)  throws IOException {
+        return okHttpClient.newCall(request).execute();
+    }
+
+    /**
+     * 异步访问,回调结果
+     * @param request
+     * @param responseCallback
+     */
+    public static void asyncPostCallback(Request request, Callback responseCallback) {
+        okHttpClient.newCall(request).enqueue(responseCallback);
+    }
+
+    /**
+     * 异步访问,无结果返回
+     * @param request
+     */
+    public static void asyncPost(Request request) {
+        okHttpClient.newCall(request).enqueue(new Callback() {
+            @Override
+            public void onFailure(Call call, IOException e) {
+
+            }
+
+            @Override
+            public void onResponse(Call call, Response response) throws IOException {
+
+            }
+        });
+    }
+
+}

+ 1 - 0
kmall-admin/src/main/java/com/kmall/admin/utils/oms/OmsSign.java

@@ -50,4 +50,5 @@ public class OmsSign {
     }
 
 
+
 }

+ 56 - 0
kmall-admin/src/main/java/com/kmall/admin/utils/sign/OutRequestMessage.java

@@ -0,0 +1,56 @@
+package com.kmall.admin.utils.sign;
+
+import java.io.Serializable;
+
+/**
+ * 外部请求消息结构
+ * 由外部系统发起
+ *
+ * @author Scott Chen
+ * @since 1.0
+ * 2018-03-28
+ */
+public class OutRequestMessage implements Serializable {
+    private static final long serialVersionUID = -3044821399294307105L;
+
+    //消息发起者编号
+    private String merchId;
+    //业务数据
+    private String data;
+    //时间戳
+    private String timestamp;
+    //签名
+    private String sign;
+
+    public String getMerchId() {
+        return merchId;
+    }
+
+    public void setMerchId(String merchId) {
+        this.merchId = merchId;
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+
+    public String getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(String timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public String getSign() {
+        return sign;
+    }
+
+    public void setSign(String sign) {
+        this.sign = sign;
+    }
+}

+ 43 - 9
kmall-admin/src/main/java/com/kmall/admin/websocket/WebSocketServer.java

@@ -1,8 +1,12 @@
 package com.kmall.admin.websocket;
 
 import com.alibaba.fastjson.JSONObject;
+import com.kmall.admin.entity.OrderEntity;
 import com.kmall.admin.entity.PickUpCodeEntity;
+import com.kmall.admin.service.OrderService;
 import com.kmall.admin.service.PickUpCodeService;
+import com.kmall.api.util.SendMsgUtil;
+import com.kmall.common.utils.R;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,30 +43,27 @@ public class WebSocketServer {
     private static Map<String, List<PickUpCodeEntity>> pickUpCodeMap ;
 
     private static List<PickUpCodeEntity> pickUpList ;
+    static SimpleDateFormat sdf = null;
     static {
         // concurrent包的线程安全Set,用来存放每个客户端对应的Session对象。
         SessionSet = new CopyOnWriteArraySet<Session>();
         pickUpCodeMap = new HashMap<>();
         pickUpList = new ArrayList<>();
+        sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     }
 
 
 
 
-
     private static PickUpCodeService pickUpCodeService;
+    private static OrderService orderService;
     @Autowired
-    public void setOptionService(PickUpCodeService pickUpCodeService) {
+    public void setOptionService(PickUpCodeService pickUpCodeService,OrderService orderService) {
         WebSocketServer.pickUpCodeService = pickUpCodeService;
+        WebSocketServer.orderService = orderService;
     }
 
     public static void delete(String sessionId, Integer storeId, PickUpCodeEntity pickUpCodeEntity) throws IOException {
-//        List<PickUpCodeEntity> pickUpCodeEntities = pickUpCodeMap.get(storeId+"");
-//        for(PickUpCodeEntity pick : pickUpList){
-//            if(pick.getPickUpCodeSn().equalsIgnoreCase(pickUpCodeEntity.getPickUpCodeSn())){
-//                pickUpList.remove(pick);
-//            }
-//        }
 
         sendMessage(sessionId,"delete",storeId+"");
 
@@ -79,7 +80,7 @@ public class WebSocketServer {
             // 查询所有的取货码
         Map<String,Object> dataParam = new HashMap<>();
         dataParam.put("pickUpCodeCreatetime",new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
-//        dataParam.put("pickUpCodeStatus","0");
+        dataParam.put("storeId",param);
         pickUpList = pickUpCodeService.queryList(dataParam);
         pickUpCodeMap.put(param,pickUpList);
 //        }
@@ -143,6 +144,39 @@ public class WebSocketServer {
 //                pickUpCodeEntities = pickUpCodeMap.get(picNo);
 //            }
             Map<String,Object> data = new HashMap<>();
+
+
+            data.put("delayResponse",false);
+            /**
+             * 查询是否有卡单的情况
+             * 步骤:
+             *  1.查询所有状态为201且下单时间超过5分钟的订单
+             *  2.判断订单数是否超过10个,如果超过10个,则去查询oms是否有该订单,如果有该订单,是否存在回执
+             *  3.循环查询,如果第一个有回执,则查询第二个,直到查询到最后一个,如果都有回执,则无异常,如果其中有一个单无回执,则证明海关可能卡单
+             *  4.如果海关卡单,给页面一个卡单提示,并且发送短信给客服相关人员
+             */
+            try{
+                // 1.查询所有状态为201且下单时间超过5分钟的订单
+//                List<OrderEntity> all201Order = orderService.queryAll201Order();
+//                if(all201Order != null && all201Order.size() >= 10){
+//                    // 循环查询oms是否有回执
+//                    for (OrderEntity orderEntity : all201Order) {
+//                        List<String> resultMessage = orderService.queryInveResponse(orderEntity.getOrderSn());
+//                        if(resultMessage == null || resultMessage.size() == 0){
+//                            String sendTemplate = "【CW惠州门店】时间:" + sdf.format(new Date()) + ",订单出现卡单情况!";
+////
+////                            SendMsgUtil.sendMsg("18825104165", sendTemplate);
+////                            SendMsgUtil.sendMsg("", sendTemplate);
+//
+//                            // 如果能进这里,证明卡回执了
+//                            data.put("delayResponse",true);
+//                        }
+//                    }
+//                }
+            }catch (Exception e){
+
+            }
+
             if("服务端返回WebSocket连接成功".equalsIgnoreCase(message)){
 
                 data.put("sessionId",session.getId());

+ 23 - 0
kmall-admin/src/main/resources/XmlTemplate/BrandDtoList.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workbook>
+    <worksheet name="Sheet1">
+        <section startRow="0" endRow="1"/>
+        <loop startRow="1" endRow="1" items="BrandEntityList" var="BrandEntity"
+              varType="com.kmall.admin.entity.BrandEntity">
+            <section startRow="1" endRow="1">
+                <mapping row="1" col="0">BrandEntity.id</mapping>
+                <mapping row="1" col="1">BrandEntity.merchSn</mapping>
+                <mapping row="1" col="2">BrandEntity.categoryId</mapping>
+                <mapping row="1" col="3">BrandEntity.name</mapping>
+                <mapping row="1" col="4">BrandEntity.simpleDesc</mapping>
+                <mapping row="1" col="5">BrandEntity.isShow</mapping>
+                <mapping row="1" col="6">BrandEntity.isNew</mapping>
+            </section>
+            <loopbreakcondition>
+                <rowcheck offset="0">
+                    <cellcheck offset="0"></cellcheck>
+                </rowcheck>
+            </loopbreakcondition>
+        </loop>
+    </worksheet>
+</workbook>

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff