Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

24282 2 лет назад
Родитель
Сommit
02cb05e93b
27 измененных файлов с 894 добавлено и 265 удалено
  1. 17 0
      code/src/test/java/ehsdDataSource.java
  2. 33 0
      hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountManagement.java
  3. 1 10
      hx-account/src/main/resources/mapper/account/AccountManagementMapper.xml
  4. 68 0
      hx-ehsd/src/main/java/com/fjhx/ehsd/controller/freight/FreightForwarderController.java
  5. 17 0
      hx-ehsd/src/main/java/com/fjhx/ehsd/entity/freight/dto/FreightForwarderDto.java
  6. 17 0
      hx-ehsd/src/main/java/com/fjhx/ehsd/entity/freight/dto/FreightForwarderSelectDto.java
  7. 82 0
      hx-ehsd/src/main/java/com/fjhx/ehsd/entity/freight/po/FreightForwarder.java
  8. 17 0
      hx-ehsd/src/main/java/com/fjhx/ehsd/entity/freight/vo/FreightForwarderVo.java
  9. 26 0
      hx-ehsd/src/main/java/com/fjhx/ehsd/mapper/freight/FreightForwarderMapper.java
  10. 46 0
      hx-ehsd/src/main/java/com/fjhx/ehsd/service/freight/FreightForwarderService.java
  11. 58 0
      hx-ehsd/src/main/java/com/fjhx/ehsd/service/freight/impl/FreightForwarderServiceImpl.java
  12. 27 0
      hx-ehsd/src/main/resources/mapper/freight/FreightForwarderMapper.xml
  13. 16 5
      hx-item/src/main/java/com/fjhx/item/controller/product/ProductInfoController.java
  14. 0 13
      hx-item/src/main/java/com/fjhx/item/entity/product/dto/ProductInfoDto.java
  15. 0 17
      hx-item/src/main/java/com/fjhx/item/entity/product/dto/ProductInfoSelectDto.java
  16. 46 0
      hx-item/src/main/java/com/fjhx/item/entity/product/po/ProductInfoEhsdExcel.java
  17. 86 88
      hx-item/src/main/java/com/fjhx/item/entity/product/po/ProductInfoEhsdJson.java
  18. 1 1
      hx-item/src/main/java/com/fjhx/item/mapper/product/ProductInfoMapper.java
  19. 7 2
      hx-item/src/main/java/com/fjhx/item/service/product/ProductInfoService.java
  20. 245 74
      hx-item/src/main/java/com/fjhx/item/service/product/impl/ProductInfoServiceImpl.java
  21. 53 48
      hx-sale/src/main/java/com/fjhx/sale/flow/PurchaseFlowByWdly.java
  22. 1 1
      hx-supply/src/main/java/com/fjhx/supply/service/supplier/impl/SupplierPriceServiceImpl.java
  23. 9 4
      hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/stock/impl/StockTransferServiceImpl.java
  24. 5 0
      hx-wms/src/main/java/com/fjhx/wms/entity/stock/vo/StockWaitVo.java
  25. 13 0
      hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockWaitDetailsServiceImpl.java
  26. 2 2
      hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockWaitServiceImpl.java
  27. 1 0
      hx-wms/src/main/resources/mapper/stock/StockWaitMapper.xml

+ 17 - 0
code/src/test/java/ehsdDataSource.java

@@ -0,0 +1,17 @@
+import fly.generator.GeneratorApplication;
+
+public class ehsdDataSource {
+
+    public static void main(String[] args) {
+        GeneratorApplication.builder()
+                .url("jdbc:mysql://36.134.91.96:17330/bytesailing_ehsd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true")
+                .username("fjhx2012mysql")
+                .password("3PN-Mzn#vnP&q6d")
+                .port(9989)
+                .module("hx-ehsd")
+                .parent("com.fjhx.ehsd")
+                .superServiceClass("com.ruoyi.common.core.service.BaseService")
+                .build();
+    }
+
+}

+ 33 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountManagement.java

@@ -48,4 +48,37 @@ public class AccountManagement extends BasePo {
      */
     private String interbankNumber;
 
+
+
+    /**
+     * 账户名称(外汇信息)
+     */
+    private String beneficiaryName;
+
+    /**
+     * 开户银行(外汇信息)
+     */
+    private String beneficiaryBank;
+
+    /**
+     * 开户银行地址(外汇信息)
+     */
+    private String beneficiaryBankAddress;
+
+    /**
+     * 账号(外汇信息)
+     */
+    private String beneficiaryAccountNumber;
+
+    /**
+     * 银行代码(外汇信息)
+     */
+    private String swiftCode;
+
+    /**
+     * 收款人地址(外汇信息)
+     */
+    private String beneficiaryAddress;
+
+
 }

+ 1 - 10
hx-account/src/main/resources/mapper/account/AccountManagementMapper.xml

@@ -3,16 +3,7 @@
 <mapper namespace="com.fjhx.account.mapper.account.AccountManagementMapper">
     <select id="getPage" resultType="com.fjhx.account.entity.account.vo.AccountManagementVo">
         select
-            am.id,
-            am.alias,
-            am.name,
-            am.opening_bank,
-            am.account_opening,
-            am.interbank_number,
-            am.create_user,
-            am.create_time,
-            am.update_user,
-            am.update_time
+           am.*
         from account_management am
             ${ew.customSqlSegment}
     </select>

+ 68 - 0
hx-ehsd/src/main/java/com/fjhx/ehsd/controller/freight/FreightForwarderController.java

@@ -0,0 +1,68 @@
+package com.fjhx.ehsd.controller.freight;
+
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.ehsd.entity.freight.vo.FreightForwarderVo;
+import com.fjhx.ehsd.entity.freight.dto.FreightForwarderSelectDto;
+import com.fjhx.ehsd.entity.freight.dto.FreightForwarderDto;
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import com.fjhx.ehsd.service.freight.FreightForwarderService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+/**
+ * <p>
+ * 货代公司管理 前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2023-05-05
+ */
+@RestController
+@RequestMapping("/freightForwarder")
+public class FreightForwarderController {
+
+    @Autowired
+    private FreightForwarderService freightForwarderService;
+
+    /**
+     * 货代公司管理分页
+     */
+    @PostMapping("/page")
+    public Page<FreightForwarderVo> page(@RequestBody FreightForwarderSelectDto dto) {
+        return freightForwarderService.getPage(dto);
+    }
+
+    /**
+     * 货代公司管理明细
+     */
+    @PostMapping("/detail")
+    public FreightForwarderVo detail(@RequestBody BaseSelectDto dto) {
+        return freightForwarderService.detail(dto.getId());
+    }
+
+    /**
+     * 货代公司管理新增
+     */
+    @PostMapping("/add")
+    public void add(@RequestBody FreightForwarderDto freightForwarderDto) {
+        freightForwarderService.add(freightForwarderDto);
+    }
+
+    /**
+     * 货代公司管理编辑
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody FreightForwarderDto freightForwarderDto) {
+        freightForwarderService.edit(freightForwarderDto);
+    }
+
+    /**
+     * 货代公司管理删除
+     */
+    @PostMapping("/delete")
+    public void delete(@RequestBody BaseSelectDto dto) {
+        freightForwarderService.delete(dto.getId());
+    }
+
+}

+ 17 - 0
hx-ehsd/src/main/java/com/fjhx/ehsd/entity/freight/dto/FreightForwarderDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.ehsd.entity.freight.dto;
+
+import com.fjhx.ehsd.entity.freight.po.FreightForwarder;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 货代公司管理新增编辑入参实体
+ *
+ * @author 
+ * @since 2023-05-05
+ */
+@Getter
+@Setter
+public class FreightForwarderDto extends FreightForwarder {
+
+}

+ 17 - 0
hx-ehsd/src/main/java/com/fjhx/ehsd/entity/freight/dto/FreightForwarderSelectDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.ehsd.entity.freight.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 货代公司管理列表查询入参实体
+ *
+ * @author 
+ * @since 2023-05-05
+ */
+@Getter
+@Setter
+public class FreightForwarderSelectDto extends BaseSelectDto {
+
+}

+ 82 - 0
hx-ehsd/src/main/java/com/fjhx/ehsd/entity/freight/po/FreightForwarder.java

@@ -0,0 +1,82 @@
+package com.fjhx.ehsd.entity.freight.po;
+
+import com.ruoyi.common.core.domain.BasePo;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 货代公司管理
+ * </p>
+ *
+ * @author 
+ * @since 2023-05-05
+ */
+@Getter
+@Setter
+@TableName("freight_forwarder")
+public class FreightForwarder extends BasePo {
+
+    /**
+     * 公司名称
+     */
+    private String companyName;
+
+    /**
+     * 公司电话
+     */
+    private String companyTel;
+
+    /**
+     * 省份
+     */
+    private String province;
+
+    /**
+     * 城市
+     */
+    private String city;
+
+    /**
+     * 地址
+     */
+    private String address;
+
+    /**
+     * 联系人
+     */
+    private String personName;
+
+    /**
+     * 联系电话
+     */
+    private String personTel;
+
+    /**
+     * 联系人邮箱
+     */
+    private String personMail;
+
+    /**
+     * 统一社会信用代码
+     */
+    private String unifiedCode;
+
+    /**
+     * 银行
+     */
+    private String bankName;
+
+    /**
+     * 账户名
+     */
+    private String bankAccountName;
+
+    /**
+     * 账户
+     */
+    private String bankAccount;
+
+}

+ 17 - 0
hx-ehsd/src/main/java/com/fjhx/ehsd/entity/freight/vo/FreightForwarderVo.java

@@ -0,0 +1,17 @@
+package com.fjhx.ehsd.entity.freight.vo;
+
+import com.fjhx.ehsd.entity.freight.po.FreightForwarder;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 货代公司管理列表查询返回值实体
+ *
+ * @author 
+ * @since 2023-05-05
+ */
+@Getter
+@Setter
+public class FreightForwarderVo extends FreightForwarder {
+
+}

+ 26 - 0
hx-ehsd/src/main/java/com/fjhx/ehsd/mapper/freight/FreightForwarderMapper.java

@@ -0,0 +1,26 @@
+package com.fjhx.ehsd.mapper.freight;
+
+import com.fjhx.ehsd.entity.freight.po.FreightForwarder;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.ehsd.entity.freight.vo.FreightForwarderVo;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * <p>
+ * 货代公司管理 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2023-05-05
+ */
+public interface FreightForwarderMapper extends BaseMapper<FreightForwarder> {
+
+    /**
+     * 货代公司管理分页
+     */
+    Page<FreightForwarderVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<FreightForwarder> wrapper);
+
+}

+ 46 - 0
hx-ehsd/src/main/java/com/fjhx/ehsd/service/freight/FreightForwarderService.java

@@ -0,0 +1,46 @@
+package com.fjhx.ehsd.service.freight;
+
+import com.fjhx.ehsd.entity.freight.po.FreightForwarder;
+import com.ruoyi.common.core.service.BaseService;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.ehsd.entity.freight.vo.FreightForwarderVo;
+import com.fjhx.ehsd.entity.freight.dto.FreightForwarderSelectDto;
+import com.fjhx.ehsd.entity.freight.dto.FreightForwarderDto;
+
+
+/**
+ * <p>
+ * 货代公司管理 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2023-05-05
+ */
+public interface FreightForwarderService extends BaseService<FreightForwarder> {
+
+    /**
+     * 货代公司管理分页
+     */
+    Page<FreightForwarderVo> getPage(FreightForwarderSelectDto dto);
+
+    /**
+     * 货代公司管理明细
+     */
+    FreightForwarderVo detail(Long id);
+
+    /**
+     * 货代公司管理新增
+     */
+    void add(FreightForwarderDto freightForwarderDto);
+
+    /**
+     * 货代公司管理编辑
+     */
+    void edit(FreightForwarderDto freightForwarderDto);
+
+    /**
+     * 货代公司管理删除
+     */
+    void delete(Long id);
+
+}

+ 58 - 0
hx-ehsd/src/main/java/com/fjhx/ehsd/service/freight/impl/FreightForwarderServiceImpl.java

@@ -0,0 +1,58 @@
+package com.fjhx.ehsd.service.freight.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.ehsd.entity.freight.dto.FreightForwarderDto;
+import com.fjhx.ehsd.entity.freight.dto.FreightForwarderSelectDto;
+import com.fjhx.ehsd.entity.freight.po.FreightForwarder;
+import com.fjhx.ehsd.entity.freight.vo.FreightForwarderVo;
+import com.fjhx.ehsd.mapper.freight.FreightForwarderMapper;
+import com.fjhx.ehsd.service.freight.FreightForwarderService;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * <p>
+ * 货代公司管理 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-05-05
+ */
+@Service
+public class FreightForwarderServiceImpl extends ServiceImpl<FreightForwarderMapper, FreightForwarder> implements FreightForwarderService {
+
+    @Override
+    public Page<FreightForwarderVo> getPage(FreightForwarderSelectDto dto) {
+        IWrapper<FreightForwarder> wrapper = getWrapper();
+        wrapper.like("ff", FreightForwarder::getCompanyName, dto.getKeyword());
+        wrapper.orderByDesc("ff", FreightForwarder::getId);
+        Page<FreightForwarderVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        return page;
+    }
+
+    @Override
+    public FreightForwarderVo detail(Long id) {
+        FreightForwarder FreightForwarder = this.getById(id);
+        FreightForwarderVo result = BeanUtil.toBean(FreightForwarder, FreightForwarderVo.class);
+        return result;
+    }
+
+    @Override
+    public void add(FreightForwarderDto freightForwarderDto) {
+        this.save(freightForwarderDto);
+    }
+
+    @Override
+    public void edit(FreightForwarderDto freightForwarderDto) {
+        this.updateById(freightForwarderDto);
+    }
+
+    @Override
+    public void delete(Long id) {
+        this.removeById(id);
+    }
+
+}

+ 27 - 0
hx-ehsd/src/main/resources/mapper/freight/FreightForwarderMapper.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fjhx.ehsd.mapper.freight.FreightForwarderMapper">
+    <select id="getPage" resultType="com.fjhx.ehsd.entity.freight.vo.FreightForwarderVo">
+        select
+            ff.id,
+            ff.company_name,
+            ff.company_tel,
+            ff.province,
+            ff.city,
+            ff.address,
+            ff.person_name,
+            ff.person_tel,
+            ff.person_mail,
+            ff.unified_code,
+            ff.bank_name,
+            ff.bank_account_name,
+            ff.bank_account,
+            ff.create_user,
+            ff.create_time,
+            ff.update_user,
+            ff.update_time
+        from freight_forwarder ff
+            ${ew.customSqlSegment}
+    </select>
+
+</mapper>

+ 16 - 5
hx-item/src/main/java/com/fjhx/item/controller/product/ProductInfoController.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.item.entity.product.dto.ProductInfoDto;
 import com.fjhx.item.entity.product.dto.ProductInfoSelectDto;
-import com.fjhx.item.entity.product.po.ProductInfo;
 import com.fjhx.item.entity.product.vo.ProductInfoVo;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.ruoyi.common.core.domain.BaseSelectDto;
@@ -88,6 +87,7 @@ public class ProductInfoController {
     public void editByEhsd(@RequestBody ProductInfoDto productInfoDto) {
         productInfoService.editByEhsd(productInfoDto);
     }
+
     /**
      * 产品库明细 尔泓扩展
      */
@@ -97,6 +97,14 @@ public class ProductInfoController {
     }
 
     /**
+     * 产品库Excel导入 尔泓扩展
+     */
+    @PostMapping("/excelImportByEhsd")
+    public void excelImportByEhsd(@RequestParam("file") MultipartFile file) {
+        productInfoService.excelImportByEhsd(file);
+    }
+
+    /**
      * 产品库明细
      */
     @PostMapping("/detail")
@@ -152,6 +160,7 @@ public class ProductInfoController {
 
     /**
      * 产品统计(数据看板-产品分析页面)
+     *
      * @param productInfoDto
      */
     @PostMapping("/productStatistics")
@@ -161,24 +170,27 @@ public class ProductInfoController {
 
     /**
      * 产品分布(数据看板-产品分析页面)
+     *
      * @param productInfoDto
      */
     @PostMapping("/productDistribution")
-    public List<ProductInfo> productDistribution(@RequestBody ProductInfoDto productInfoDto) {
-       return productInfoService.productDistribution(productInfoDto);
+    public List<Map<String, Object>> productDistribution(@RequestBody ProductInfoDto productInfoDto) {
+        return productInfoService.productDistribution(productInfoDto);
     }
 
     /**
      * 产品类型排行(数据看板-产品分析页面)
+     *
      * @param productInfoDto
      */
     @PostMapping("/productTypeRanking")
-    public Page<ProductInfoVo> productTypeRanking(@RequestBody ProductInfoSelectDto productInfoDto) {
+    public List<Map<String, Object>> productTypeRanking(@RequestBody ProductInfoSelectDto productInfoDto) {
         return productInfoService.productTypeRanking(productInfoDto);
     }
 
     /**
      * 产品排行(数据看板-产品分析页面)
+     *
      * @param productInfoDto
      */
     @PostMapping("/productRanking")
@@ -187,5 +199,4 @@ public class ProductInfoController {
     }
 
 
-
 }

+ 0 - 13
hx-item/src/main/java/com/fjhx/item/entity/product/dto/ProductInfoDto.java

@@ -53,17 +53,4 @@ public class ProductInfoDto extends ProductInfo {
      * 10 正序  20 倒序
      */
     private  Integer orderBy;
-
-
-
-
-    /**
-     * 主图片列表
-     */
-    private List<ObsFile> imgList;
-    /**
-     * 副图片列表
-     */
-    private List<ObsFile> minorImgList;
-
 }

+ 0 - 17
hx-item/src/main/java/com/fjhx/item/entity/product/dto/ProductInfoSelectDto.java

@@ -64,21 +64,4 @@ public class ProductInfoSelectDto extends BaseSelectDto {
      * 10 正序  20 倒序
      */
     private Integer orderBy;
-
-
-    /**
-     * 产品编号 ehsd
-     */
-    private String code;
-    /**
-     * 产品名称 ehsd
-     */
-    private String name;
-
-    /**
-     * 客户名称
-     */
-    private String customerName;
-
-
 }

+ 46 - 0
hx-item/src/main/java/com/fjhx/item/entity/product/po/ProductInfoEhsdExcel.java

@@ -0,0 +1,46 @@
+package com.fjhx.item.entity.product.po;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+@Getter
+@Setter
+public class ProductInfoEhsdExcel {
+    /**
+     * 产品分类id
+     */
+    private Long productClassifyId;
+    @ExcelProperty("产品分类名称")
+    private String productClassifyName;
+    @ExcelProperty("产品名称")
+    private String name;
+    @ExcelProperty("产品英文名")
+    private String nameEnglish;
+    @ExcelProperty("单位")
+    private String unit;
+    @ExcelProperty("销售指导价")
+    private BigDecimal price;
+    @ExcelProperty("成本价")
+    private BigDecimal costPrice;
+    @ExcelProperty("规格型号")
+    private String spec;
+    @ExcelProperty("产品尺寸长")
+    private String productLong;
+    @ExcelProperty("产品尺寸宽")
+    private String productWide;
+    @ExcelProperty("产品尺寸高")
+    private String productHigh;
+    @ExcelProperty("内包装方式-英文逗号分隔")
+    private String innerPackMethod;
+    @ExcelProperty("外包装方式-英文逗号分隔")
+    private String outerPackMethod;
+    @ExcelProperty("净重")
+    private Double netWeight;
+    @ExcelProperty("海关编码")
+    private String hsCode;
+    @ExcelProperty("备注")
+    private String remark;
+}

+ 86 - 88
hx-item/src/main/java/com/fjhx/item/entity/product/po/ProductInfoEhsdJson.java

@@ -1,11 +1,9 @@
 package com.fjhx.item.entity.product.po;
 
-import com.fjhx.file.entity.ObsFile;
 import lombok.Getter;
 import lombok.Setter;
 
 import java.math.BigDecimal;
-import java.util.List;
 
 @Getter
 @Setter
@@ -22,18 +20,18 @@ public class ProductInfoEhsdJson {
      * 产品成本价
      */
     private BigDecimal costPrice;
-    /**
-     * 材质英文
-     */
-    private String material;
-    /**
-     * 材质中文
-     */
-    private String materialChinese;
-    /**
-     * 产品型号 英文
-     */
-    private String productModelEn;
+//    /**
+//     * 材质英文
+//     */
+//    private String material;
+//    /**
+//     * 材质中文
+//     */
+//    private String materialChinese;
+//    /**
+//     * 产品型号 英文
+//     */
+//    private String productModelEn;
     /**
      * 产品尺寸 长
      */
@@ -46,18 +44,18 @@ public class ProductInfoEhsdJson {
      * 产品尺寸 高
      */
     private String productHigh;
-    /**
-     * 装箱尺寸 长
-     */
-    private String packagLong;
-    /**
-     * 装箱尺寸 宽
-     */
-    private String packagWide;
-    /**
-     * 装箱尺寸 高
-     */
-    private String packagHigh;
+//    /**
+//     * 装箱尺寸 长
+//     */
+//    private String packagLong;
+//    /**
+//     * 装箱尺寸 宽
+//     */
+//    private String packagWide;
+//    /**
+//     * 装箱尺寸 高
+//     */
+//    private String packagHigh;
     /**
      * 内包装方式
      */
@@ -71,79 +69,79 @@ public class ProductInfoEhsdJson {
      */
     private Double netWeight;
 
-    /**
-     * 毛重(单位g)
-     */
-    private Double grossWeight;
+//    /**
+//     * 毛重(单位g)
+//     */
+//    private Double grossWeight;
 
     /**
      * 海关编码
      */
-    private String customsCode;
-    /**
-     * MOQ(最低订购量)
-     */
-    private Integer moq;
-    /**
-     * 销售单位
-     */
-    private String salesUnit;
-    /**
-     * 出入库单位
-     */
-    private String issueReceiptUnit;
-    /**
-     * 换算比例
-     */
-    private Double conversionScale;
-    /**
-     * 安全库存
-     */
-    private BigDecimal safetyStock;
-    /**
-     * 采购周期(单位:天)
-     */
-    private Integer procurementCycle;
-    /**
-     * 质检合格率
-     */
-    private BigDecimal qualityQualifiedRate;
-    /**
-     * (云仓)出入库规则:0、不启用;1、一物一码;2、一物一码&先入先出
-     */
-    private Integer firstInFirstOut;
-    /**
-     * 状态
-     */
-    private Integer status;
-    /**
-     * 评估状态
-     */
-    private Integer assessStatus;
-    /**
-     * 产品分类英文名
-     */
-    private String categoryEnName;
-    /**
-     * 分类中文名
-     */
-    private String categoryCnName;
+    private String hsCode;
+//    /**
+//     * MOQ(最低订购量)
+//     */
+//    private Integer moq;
+//    /**
+//     * 销售单位
+//     */
+//    private String salesUnit;
+//    /**
+//     * 出入库单位
+//     */
+//    private String issueReceiptUnit;
+//    /**
+//     * 换算比例
+//     */
+//    private Double conversionScale;
+//    /**
+//     * 安全库存
+//     */
+//    private BigDecimal safetyStock;
+//    /**
+//     * 采购周期(单位:天)
+//     */
+//    private Integer procurementCycle;
+//    /**
+//     * 质检合格率
+//     */
+//    private BigDecimal qualityQualifiedRate;
+//    /**
+//     * (云仓)出入库规则:0、不启用;1、一物一码;2、一物一码&先入先出
+//     */
+//    private Integer firstInFirstOut;
+//    /**
+//     * 状态
+//     */
+//    private Integer status;
+//    /**
+//     * 评估状态
+//     */
+//    private Integer assessStatus;
+//    /**
+//     * 产品分类英文名
+//     */
+//    private String categoryEnName;
+//    /**
+//     * 分类中文名
+//     */
+//    private String categoryCnName;
     /**
      * 客户id
      */
-    private Long customerId;
+    private String customerId;
     /**
      * 客户名称
      */
     private String customerName;
-    /**
-     * 图片列表
-     */
-    private List<ObsFile> imgList;
-    /**
-     * 附件列表
-     */
-    private List<ObsFile> attachmentList;
+//    /**
+//     * 图片列表
+//     */
+//    private List<ObsFile> imgList;
+//    /**
+//     * 附件列表
+//     */
+//    private List<ObsFile> attachmentList;
 
     /**
      * 产品类型 1公司产品 2客户产品

+ 1 - 1
hx-item/src/main/java/com/fjhx/item/mapper/product/ProductInfoMapper.java

@@ -43,7 +43,7 @@ public interface ProductInfoMapper extends BaseMapper<ProductInfo> {
      * 产品类型排行(数据看板-产品分析页面)
      * @param query
      */
-    Page<ProductInfoVo>  productTypeRanking(@Param("page") Page<Object> page,@Param("ew") QueryWrapper<Object> query);
+    List<ProductInfoVo>  productTypeRanking(@Param("ew") QueryWrapper<Object> query);
 
     /**
      * 产品排行(数据看板-产品分析页面)

+ 7 - 2
hx-item/src/main/java/com/fjhx/item/service/product/ProductInfoService.java

@@ -73,6 +73,11 @@ public interface ProductInfoService extends BaseService<ProductInfo> {
     ProductInfoVo detailByEhsd(Long id);
 
     /**
+     * 产品库Excel导入 尔泓扩展
+     */
+    void excelImportByEhsd(MultipartFile file);
+
+    /**
      * 产品库新增 维多利亚
      */
     void addByWdly(ProductInfoDto productInfoDto);
@@ -122,13 +127,13 @@ public interface ProductInfoService extends BaseService<ProductInfo> {
      * 产品分布(数据看板-产品分析页面)
      * @param productInfoDto
      */
-    List<ProductInfo> productDistribution(ProductInfoDto productInfoDto);
+    List<Map<String,Object>> productDistribution(ProductInfoDto productInfoDto);
 
     /**
      * 产品类型排行(数据看板-产品分析页面)
      * @param productInfoDto
      */
-    Page<ProductInfoVo> productTypeRanking(ProductInfoSelectDto productInfoDto);
+    List<Map<String,Object>> productTypeRanking(ProductInfoSelectDto productInfoDto);
 
     /**
      * 产品排行(数据看板-产品分析页面)

+ 245 - 74
hx-item/src/main/java/com/fjhx/item/service/product/impl/ProductInfoServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fjhx.item.service.product.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
@@ -18,13 +19,16 @@ import com.fjhx.item.entity.product.dto.ProductInfoDto;
 import com.fjhx.item.entity.product.dto.ProductInfoSelectDto;
 import com.fjhx.item.entity.product.po.ProductClassify;
 import com.fjhx.item.entity.product.po.ProductInfo;
+import com.fjhx.item.entity.product.po.ProductInfoEhsdExcel;
 import com.fjhx.item.entity.product.po.ProductInfoEhsdJson;
 import com.fjhx.item.entity.product.vo.ProductInfoVo;
 import com.fjhx.item.mapper.product.ProductInfoMapper;
 import com.fjhx.item.service.product.ProductClassifyService;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.item.util.CodeEnum;
+import com.fjhx.item.util.excel.util.ExcelUtil;
 import com.fjhx.tenant.entity.dict.dto.DictTenantDataSelectDto;
+import com.fjhx.tenant.entity.dict.po.DictTenantData;
 import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
 import com.fjhx.tenant.service.dict.DictTenantDataService;
 import com.obs.services.internal.ServiceException;
@@ -40,6 +44,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -172,55 +177,27 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
     @Override
     public Page<ProductInfoVo> getCustomerProductList(ProductInfoSelectDto dto) {
         IWrapper<ProductInfo> wrapper = getWrapper();
-        wrapper.eq("json_unquote(pi.ehsd_json -> '$.status')", 0);//状态 启用
-        wrapper.eq("json_unquote(pi.ehsd_json -> '$.assessStatus')", 3);//评估状态 具备
-//        wrapper.ne("json_unquote(pi.ehsd_json -> '$.customerId')", 0);//客户id不等于0
         wrapper.eq("json_unquote(pi.ehsd_json -> '$.type')", 2);//客户产品
-        //根据产品名称/产品编号过滤
-        wrapper.like("pi", ProductInfo::getCode, dto.getCode());
-        if (ObjectUtil.isNotEmpty(dto.getName())) {
-            wrapper.and(q -> q.like("pi", ProductInfo::getName, dto.getName()))
-                    .or().like("json_unquote(pi.ehsd_json -> '$.englishName')", dto.getName());
-        }
-        //根据产品分类id过滤
-        wrapper.eq("pi", ProductInfo::getProductClassifyId, dto.getProductClassifyId());
-        //客户名称过滤
-        wrapper.like("c.name", dto.getCustomerName());
-
-        Page<ProductInfoVo> page = baseMapper.getCustomerProductList(dto.getPage(), wrapper);
-        List<ProductInfoVo> records = page.getRecords();
-        //赋值客户名称
-        List<Long> customerIds = new ArrayList<>();
-        for (ProductInfoVo record : records) {
-            ProductInfoEhsdJson productInfoEhsdJson = JSONObject.parseObject(record.getEhsdJson(), ProductInfoEhsdJson.class);
-            customerIds.add(productInfoEhsdJson.getCustomerId());
-        }
-        if (ObjectUtil.isNotEmpty(customerIds)) {
-            Map<Long, String> customerMap = customerService.mapKV(Customer::getId, Customer::getName, q -> q.in(Customer::getId, customerIds));
-            for (ProductInfoVo record : records) {
-                ProductInfoEhsdJson productInfoEhsdJson = JSONObject.parseObject(record.getEhsdJson(), ProductInfoEhsdJson.class);
-                String customerName = customerMap.get(productInfoEhsdJson.getCustomerId());
-                productInfoEhsdJson.setCustomerName(customerName);
-                record.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson));
-            }
-        }
-        //赋值创建人名称
-        UserUtil.assignmentNickName(page.getRecords(), ProductInfo::getCreateUser, ProductInfoVo::setCreateUserName);
-        return page;
+        return getPageByEhsd(dto, wrapper);
     }
 
     @Override
     public Page<ProductInfoVo> getConditionProductList(ProductInfoSelectDto dto) {
         IWrapper<ProductInfo> wrapper = getWrapper();
-        wrapper.eq("json_unquote(pi.ehsd_json -> '$.status')", 0);//状态 启用
-        wrapper.eq("json_unquote(pi.ehsd_json -> '$.assessStatus')", 3);//评估状态 具备
-//        wrapper.eq("json_unquote(pi.ehsd_json -> '$.customerId')", 0);//客户id等于0
         wrapper.eq("json_unquote(pi.ehsd_json -> '$.type')", 1);//公司产品
+        return getPageByEhsd(dto, wrapper);
+    }
+
+    /**
+     * 尔泓产品库分页公共代码
+     */
+    public Page<ProductInfoVo> getPageByEhsd(ProductInfoSelectDto dto, IWrapper<ProductInfo> wrapper) {
         //根据产品名称/产品编号过滤
-        wrapper.like("pi", ProductInfo::getCode, dto.getCode());
-        if (ObjectUtil.isNotEmpty(dto.getName())) {
-            wrapper.and(q -> q.like("pi", ProductInfo::getName, dto.getName()))
-                    .or().like("json_unquote(pi.ehsd_json -> '$.englishName')", dto.getName());
+        if (ObjectUtil.isNotEmpty(dto.getKeyword())) {
+            wrapper.and(q -> q.like("pi", ProductInfo::getName, dto.getKeyword()))
+                    .or().like("json_unquote(pi.ehsd_json -> '$.nameEnglish')", dto.getKeyword())
+                    .or().like("pi", ProductInfo::getCode, dto.getKeyword())//产品编号
+                    .or().like("c.name", dto.getKeyword());//客户名称
         }
         //根据产品分类id过滤
         wrapper.eq("pi", ProductInfo::getProductClassifyId, dto.getProductClassifyId());
@@ -231,7 +208,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         List<Long> customerIds = new ArrayList<>();
         for (ProductInfoVo record : records) {
             ProductInfoEhsdJson productInfoEhsdJson = JSONObject.parseObject(record.getEhsdJson(), ProductInfoEhsdJson.class);
-            customerIds.add(productInfoEhsdJson.getCustomerId());
+            customerIds.add(Long.parseLong(productInfoEhsdJson.getCustomerId()));
         }
         if (ObjectUtil.isNotEmpty(customerIds)) {
             Map<Long, String> customerMap = customerService.mapKV(Customer::getId, Customer::getName, q -> q.in(Customer::getId, customerIds));
@@ -270,11 +247,9 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
     public void addByEhsd(ProductInfoDto productInfoDto) {
         //赋值初始状态
         ProductInfoEhsdJson productInfoEhsdJson = JSONObject.parseObject(productInfoDto.getEhsdJson(), ProductInfoEhsdJson.class);
-        productInfoEhsdJson.setStatus(0);
-        productInfoEhsdJson.setAssessStatus(3);
         if (ObjectUtil.isEmpty(productInfoEhsdJson.getCustomerId())) {
             //如果客户id为空就赋值为0 公司产品
-            productInfoEhsdJson.setCustomerId(0l);
+            productInfoEhsdJson.setCustomerId("0");
             productInfoEhsdJson.setType("1");//默认公司产品
         }
         productInfoDto.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson));
@@ -284,26 +259,28 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         // 排除名称重复
         this.nameDuplication(ProductInfo::getName, productInfoDto.getName(), "产品名称重复");
         this.save(productInfoDto);
-        //图片列表
-        ObsFileUtil.saveFile(productInfoDto.getImgList(), productInfoDto.getId(), 1);
         //附件列表
-        ObsFileUtil.saveFile(productInfoDto.getMinorImgList(), productInfoDto.getId(), 2);
-        //附件列表
-        ObsFileUtil.saveFile(productInfoDto.getFileList(), productInfoDto.getId(), 3);
+        ObsFileUtil.saveFile(productInfoDto.getFileList(), productInfoDto.getId());
     }
 
     @DSTransactional
     @Override
     public void editByEhsd(ProductInfoDto productInfoDto) {
-        // 禁止产品编号修改
-        productInfoDto.setCode(null);
-        // 排除名称重复
-        this.nameDuplication(ProductInfo::getName, productInfoDto.getName(), productInfoDto.getId(), "产品名称重复");
-        this.updateById(productInfoDto);
-        ObsFileUtil.editFile(productInfoDto.getImgList(), productInfoDto.getId(), 1);
-        ObsFileUtil.editFile(productInfoDto.getMinorImgList(), productInfoDto.getId(), 2);
-        ObsFileUtil.editFile(productInfoDto.getFileList(), productInfoDto.getId(), 3);
-
+        ProductInfoEhsdJson newProductInfoEhsdJson = JSONObject.parseObject(productInfoDto.getEhsdJson(), ProductInfoEhsdJson.class);
+        //只允许修改以下字段 销售指导价、成本价、净重、图片、备注
+        ProductInfo productInfo = getById(productInfoDto.getId());
+        if (ObjectUtil.isEmpty(productInfo)) {
+            throw new ServiceException("无法查询到改产品的产品信息,产品id" + productInfoDto.getId());
+        }
+        ProductInfoEhsdJson productInfoEhsdJson = JSONObject.parseObject(productInfo.getEhsdJson(), ProductInfoEhsdJson.class);
+        productInfoEhsdJson.setPrice(newProductInfoEhsdJson.getPrice());//销售指导价
+        productInfoEhsdJson.setCostPrice(newProductInfoEhsdJson.getCostPrice());//成本价
+        productInfoEhsdJson.setNetWeight(newProductInfoEhsdJson.getNetWeight());//净重
+        productInfo.setRemark(productInfoDto.getRemark());//备注
+        productInfo.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson));
+        this.updateById(productInfo);
+        //修改图片
+        ObsFileUtil.editFile(productInfoDto.getFileList(), productInfoDto.getId());
     }
 
     @Override
@@ -316,7 +293,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         if (ObjectUtil.isNotEmpty(productInfoEhsdJson) && ObjectUtil.isNotEmpty(productInfoEhsdJson.getCustomerId())) {
             //赋值客户名称
             Customer customer = customerService.getById(productInfoEhsdJson.getCustomerId());
-            if(ObjectUtil.isNotEmpty(customer)) {
+            if (ObjectUtil.isNotEmpty(customer)) {
                 productInfoEhsdJson.setCustomerName(customer.getName());
                 result.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson));
             }
@@ -328,6 +305,75 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
 
     @DSTransactional
     @Override
+    public void excelImportByEhsd(MultipartFile file) {
+        DynamicDataSourceContextHolder.push(SourceConstant.BASE);
+        Map<String, String> unitMap = dictTenantDataService.mapKV(DictTenantData::getDictValue,
+                DictTenantData::getDictKey, q -> q.eq(DictTenantData::getDictCode, "unit"));
+        Map<String, String> innerPackMethodMap = dictTenantDataService.mapKV(DictTenantData::getDictValue,
+                DictTenantData::getDictKey, q -> q.eq(DictTenantData::getDictCode, "inner_packaging_method_ehsd"));
+        Map<String, String> outsidePackMethodMap = dictTenantDataService.mapKV(DictTenantData::getDictValue,
+                DictTenantData::getDictKey, q -> q.eq(DictTenantData::getDictCode, "outside_packaging_method_ehsd"));
+        DynamicDataSourceContextHolder.poll();
+
+        List<ProductInfoEhsdExcel> read = ExcelUtil.read(file, ProductInfoEhsdExcel.class);
+        List<ProductInfo> productInfoList = new ArrayList<>();
+        for (ProductInfoEhsdExcel productInfoEhsdExcel : read) {
+            ProductInfo productInfo = BeanUtil.copyProperties(productInfoEhsdExcel, ProductInfo.class);
+            // 赋值产品编号
+            productInfo.setCode(CodeEnum.PRODUCT.getCode());
+            // 排除名称重复
+            this.nameDuplication(ProductInfo::getName, productInfo.getName(), "产品名称重复");
+
+            //产品分类名称转id
+            ProductClassify productClassify = productClassifyService.getOne(q -> q.eq(ProductClassify::getName, productInfoEhsdExcel.getProductClassifyName()));
+            if (ObjectUtil.isEmpty(productClassify)) {
+                throw new ServiceException("未知产品分类"+ productInfoEhsdExcel.getProductClassifyName());
+            }
+            productInfo.setProductClassifyId(productClassify.getId());
+            //单位名称转字典key
+            if (ObjectUtil.isNotEmpty(productInfo.getUnit())) {
+                String unit = unitMap.get(productInfo.getUnit());
+                if (ObjectUtil.isEmpty(unit)) {
+                    throw new ServiceException("未知单位" + productInfo.getUnit());
+                }
+                productInfo.setUnit(unit);
+            }
+            ProductInfoEhsdJson productInfoEhsdJson = BeanUtil.copyProperties(productInfoEhsdExcel, ProductInfoEhsdJson.class);
+            productInfoEhsdJson.setType("1");//公司产品
+            productInfoEhsdJson.setCustomerId("0");//客户id为0 公司产品
+            //内外包装方式名称转字典key
+            String innerPackMethod = productInfoEhsdJson.getInnerPackMethod();
+            if (ObjectUtil.isNotEmpty(innerPackMethod)) {
+                String[] split = innerPackMethod.split(",");
+                for (int i = 0; i < split.length; i++) {
+                    String key = innerPackMethodMap.get(split[i]);
+                    if (ObjectUtil.isEmpty(key)) {
+                        throw new ServiceException("未知内包装方式" + split[i]);
+                    }
+                    split[i] = key;
+                }
+                productInfoEhsdJson.setInnerPackMethod(String.join(",", split));
+            }
+            String outerPackMethod = productInfoEhsdJson.getOuterPackMethod();
+            if (ObjectUtil.isNotEmpty(outerPackMethod)) {
+                String[] split = outerPackMethod.split(",");
+                for (int i = 0; i < split.length; i++) {
+                    String key = outsidePackMethodMap.get(split[i]);
+                    if (ObjectUtil.isEmpty(key)) {
+                        throw new ServiceException("未知外包装方式" + split[i]);
+                    }
+                    split[i] = key;
+                }
+                productInfoEhsdJson.setOuterPackMethod(String.join(",", split));
+            }
+            productInfo.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson));
+            productInfoList.add(productInfo);
+        }
+        saveBatch(productInfoList);
+    }
+
+    @DSTransactional
+    @Override
     public void addByWdly(ProductInfoDto productInfoDto) {
         //处理维多利亚扩展
         String victoriatouristJson = productInfoDto.getVictoriatouristJson();
@@ -410,15 +456,12 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
 
         //存放产品类型数据
         List<Map<String, Object>> typeList = new ArrayList<>();
-
-
         QueryWrapper<ProductInfo> query = Wrappers.<ProductInfo>query();
         query.select("count(*) count,ifNull(type,999) type");
         query.groupBy("type");
         //查询每个类型的总计
         List<ProductInfo> productInfos = baseMapper.selectList(query);
         Map<String, List<ProductInfo>> productInfoTotalMap = productInfos.stream().collect(Collectors.groupingBy(ProductInfo::getType));
-
         query.ge("DATE_FORMAT(create_time,'%Y-%m-%d')", productInfoDto.getBeginTime());
         query.le("DATE_FORMAT(create_time,'%Y-%m-%d')", productInfoDto.getEndTime());
         //查询每个类型的新增数量
@@ -473,17 +516,49 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
      * @param productInfoDto
      */
     @Override
-    public List<ProductInfo> productDistribution(ProductInfoDto productInfoDto) {
+    public List<Map<String, Object>> productDistribution(ProductInfoDto productInfoDto) {
         if (ObjectUtil.isEmpty(productInfoDto) && ObjectUtil.isEmpty(productInfoDto.getBeginTime())
                 && StringUtils.isNotEmpty(productInfoDto.getEndTime())) {
             throw new ServiceException("参数缺失:开始时间,结束时间不能为null");
         }
+        //存放产品分布列表
+        List<Map<String, Object>> list = new ArrayList<>();
+
         QueryWrapper<ProductInfo> query = Wrappers.<ProductInfo>query();
-        query.select("count(*) count,type");
+        query.select("count(*) count,ifnull(type,999) type");
         query.groupBy("type");
+        query.ge("DATE_FORMAT(create_time,'%Y-%m-%d')", productInfoDto.getBeginTime());
+        query.le("DATE_FORMAT(create_time,'%Y-%m-%d')", productInfoDto.getEndTime());
         //查询每个类型的总计
         List<ProductInfo> productInfos = baseMapper.selectList(query);
-        return productInfos;
+        if (productInfos.size() == 0) {
+            new ArrayList<>();
+        }
+        Map<String, List<ProductInfo>> productInfoMap = productInfos.stream().collect(Collectors.groupingBy(ProductInfo::getType));
+        //获取产品类型的字典数据
+        DynamicDataSourceContextHolder.push(SourceConstant.BASE);
+        List<DictTenantDataVo> dictTenantDataVoList = getDict("product_type");
+        DynamicDataSourceContextHolder.poll();
+
+        if (dictTenantDataVoList.size() == 0) {
+            new ArrayList<>();
+        }
+
+        //赋值
+        for (DictTenantDataVo dictTenantDataVo : dictTenantDataVoList) {
+            Map<String, Object> map = new HashMap<>();
+            //初始化
+            map.put("type", dictTenantDataVo.getDictKey());
+            map.put("name", dictTenantDataVo.getDictValue());
+            map.put("count", 0);
+
+            List<ProductInfo> productInfoList = productInfoMap.get(dictTenantDataVo.getDictKey());
+            if (ObjectUtil.isNotEmpty(productInfoList)) {
+                map.put("count", productInfoList.get(0).getCount());
+            }
+            list.add(map);
+        }
+        return list;
     }
 
     /**
@@ -492,17 +567,57 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
      * @param productInfoDto
      */
     @Override
-    public Page<ProductInfoVo> productTypeRanking(ProductInfoSelectDto productInfoDto) {
+    public List<Map<String, Object>> productTypeRanking(ProductInfoSelectDto productInfoDto) {
+        //存放产品类型排行数据
+        List<Map<String, Object>> list = new ArrayList<>();
+
         QueryWrapper<Object> query = Wrappers.query();
-        query.ge("DATE_FORMAT(pc.create_time,'%Y-%m-%d')", productInfoDto.getBeginTime());
-        query.le("DATE_FORMAT(pc.create_time,'%Y-%m-%d')", productInfoDto.getEndTime());
+        String beginTime = DateUtil.format(productInfoDto.getBeginTime(), "yyyy-MM-dd");
+        String endTime = DateUtil.format(productInfoDto.getEndTime(), "yyyy-MM-dd");
+        query.ge("DATE_FORMAT(pc.create_time,'%Y-%m-%d')", beginTime);
+        query.le("DATE_FORMAT(pc.create_time,'%Y-%m-%d')", endTime);
         query.eq(ObjectUtil.isNotEmpty(productInfoDto.getCountryId()), "bc.buy_country_id", productInfoDto.getCountryId());
-        sort(query, productInfoDto);
+//        sort(query,productInfoDto);
         query.groupBy("pi.type");
-        Page<ProductInfoVo> productInfoVos = baseMapper.productTypeRanking(productInfoDto.getPage(), query);
-        return productInfoVos;
+        //查询产品类型排行数据
+        List<ProductInfoVo> productInfoVos = baseMapper.productTypeRanking(query);
+        if (productInfoVos.size() == 0) {
+            return list;
+        }
+        Map<String, List<ProductInfoVo>> productInfoVoMap = productInfoVos.stream().collect(Collectors.groupingBy(ProductInfoVo::getType));
+        //获取产品类型的字典数据
+        DynamicDataSourceContextHolder.push(SourceConstant.BASE);
+        List<DictTenantDataVo> dictTenantDataVoList = getDict("product_type");
+        DynamicDataSourceContextHolder.poll();
+
+        //赋值
+        for (DictTenantDataVo dictTenantDataVo : dictTenantDataVoList) {
+            //初始化
+            Map<String, Object> map = new HashMap<>();
+            map.put("type", dictTenantDataVo.getDictKey());
+            map.put("name", dictTenantDataVo.getDictValue());
+            map.put("contractAmount", new BigDecimal(0));
+            map.put("contractQuantity", new BigDecimal(0));
+            map.put("purchaseAmount", new BigDecimal(0));
+            map.put("purchaseQuantity", new BigDecimal(0));
+            //赋值
+            List<ProductInfoVo> productInfoVos1 = productInfoVoMap.get(dictTenantDataVo.getDictKey());
+            if (ObjectUtil.isNotEmpty(productInfoVos1)) {
+                map.put("contractAmount", productInfoVos1.get(0).getContractAmount());
+                map.put("contractQuantity", productInfoVos1.get(0).getContractQuantity());
+                map.put("purchaseAmount", productInfoVos1.get(0).getPurchaseAmount());
+                map.put("purchaseQuantity", productInfoVos1.get(0).getPurchaseQuantity());
+            }
+            list.add(map);
+        }
+        if (ObjectUtil.isNotEmpty(list)) {
+            //排序
+            list = typeSort(list, productInfoDto);
+        }
+        return list;
     }
 
+
     /**
      * 产品排行(数据看板-产品分析页面)
      *
@@ -511,8 +626,10 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
     @Override
     public Page<ProductInfoVo> productRanking(ProductInfoSelectDto productInfoDto) {
         QueryWrapper<Object> query = Wrappers.query();
-        query.ge("DATE_FORMAT(pc.create_time,'%Y-%m-%d')", productInfoDto.getBeginTime());
-        query.le("DATE_FORMAT(pc.create_time,'%Y-%m-%d')", productInfoDto.getEndTime());
+        String beginTime = DateUtil.format(productInfoDto.getBeginTime(), "yyyy-MM-dd");
+        String endTime = DateUtil.format(productInfoDto.getEndTime(), "yyyy-MM-dd");
+        query.ge("DATE_FORMAT(pc.create_time,'%Y-%m-%d')", beginTime);
+        query.le("DATE_FORMAT(pc.create_time,'%Y-%m-%d')", endTime);
         query.eq(ObjectUtil.isNotEmpty(productInfoDto.getCountryId()), "bc.buy_country_id", productInfoDto.getCountryId());
         sort(query, productInfoDto);
         query.groupBy("pi.name");
@@ -544,4 +661,58 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         }
     }
 
+    //产品类型排序
+    private List<Map<String, Object>> typeSort(List<Map<String, Object>> list, ProductInfoSelectDto productInfoSelectDto) {
+        if (productInfoSelectDto.getOrderBy() == 10) {
+            if (productInfoSelectDto.getSort() == 10) {
+                list = list.stream()
+                        .sorted(Comparator.comparing(m -> new BigDecimal(m.get("contractQuantity").toString())))
+                        .collect(Collectors.toList());
+                return list;
+            } else if (productInfoSelectDto.getSort() == 20) {
+                list = list.stream()
+                        .sorted(Comparator.comparing(m -> new BigDecimal(m.get("contractAmount").toString())))
+                        .collect(Collectors.toList());
+                return list;
+            } else if (productInfoSelectDto.getSort() == 30) {
+                list = list.stream()
+                        .sorted(Comparator.comparing(m -> new BigDecimal(m.get("purchaseQuantity").toString())))
+                        .collect(Collectors.toList());
+                return list;
+            } else if (productInfoSelectDto.getSort() == 40) {
+                list = list.stream()
+                        .sorted(Comparator.comparing(m -> new BigDecimal(m.get("purchaseAmount").toString())))
+                        .collect(Collectors.toList());
+                return list;
+            }
+        } else {
+            if (productInfoSelectDto.getSort() == 10) {
+                list = list.stream()
+                        .sorted(Comparator.comparing(m -> new BigDecimal(m.get("contractQuantity").toString())))
+                        .collect(Collectors.toList());
+                Collections.reverse(list);
+                return list;
+            } else if (productInfoSelectDto.getSort() == 20) {
+                list = list.stream()
+                        .sorted(Comparator.comparing(m -> new BigDecimal(m.get("contractAmount").toString())))
+                        .collect(Collectors.toList());
+                Collections.reverse(list);
+                return list;
+            } else if (productInfoSelectDto.getSort() == 30) {
+                list = list.stream()
+                        .sorted(Comparator.comparing(m -> new BigDecimal(m.get("purchaseQuantity").toString())))
+                        .collect(Collectors.toList());
+                Collections.reverse(list);
+                return list;
+            } else if (productInfoSelectDto.getSort() == 40) {
+                list = list.stream()
+                        .sorted(Comparator.comparing(m -> new BigDecimal(m.get("purchaseAmount").toString())))
+                        .collect(Collectors.toList());
+                Collections.reverse(list);
+                return list;
+            }
+        }
+        return list;
+    }
+
 }

+ 53 - 48
hx-sale/src/main/java/com/fjhx/sale/flow/PurchaseFlowByWdly.java

@@ -62,77 +62,82 @@ public class PurchaseFlowByWdly extends FlowDelegate {
 
     /**
      * 发起流程
-     * @param flowId 流程ID
+     *
+     * @param flowId     流程ID
      * @param submitData 采购数据
      * @return
      */
     @Override
     public Long start(Long flowId, JSONObject submitData) {
         DynamicDataSourceContextHolder.push(SourceConstant.PURCHASE);
-        Purchase purchase = submitData.toJavaObject(Purchase.class);
-        purchase.setCode(CodeEnum.PURCHASE.getCode());
-        purchase.setPurchaseStatus(PurchaseStatusEnum.UNDER_REVIEW.getKey());
-        purchaseService.save(purchase);
-        List<PurchaseDetail> purchaseDetailList = purchase.getPurchaseDetailList();
-        if(CollectionUtils.isNotEmpty(purchaseDetailList)){
-            for(PurchaseDetail s : purchaseDetailList){
-                s.setPurchaseId(purchase.getId());
+        try {
+            Purchase purchase = submitData.toJavaObject(Purchase.class);
+            purchase.setCode(CodeEnum.PURCHASE.getCode());
+            purchase.setPurchaseStatus(PurchaseStatusEnum.UNDER_REVIEW.getKey());
+            purchaseService.save(purchase);
+            List<PurchaseDetail> purchaseDetailList = purchase.getPurchaseDetailList();
+            if (CollectionUtils.isNotEmpty(purchaseDetailList)) {
+                for (PurchaseDetail s : purchaseDetailList) {
+                    s.setPurchaseId(purchase.getId());
+                }
+                purchaseDetailService.saveBatch(purchaseDetailList);
             }
-            purchaseDetailService.saveBatch(purchaseDetailList);
-        }
-        //根据申购明细id去申购单获取仓库id 名称
-        if(ObjectUtils.isEmpty(purchaseDetailList)){
-            return purchase.getId();
-        }
-        PurchaseDetail purchaseDetail = purchaseDetailList.get(0);
-        SubscribeDetail subscribeDetail = subscribeDetailService.getById(purchaseDetail.getSubscribeDetailId());
-        if(ObjectUtils.isEmpty(subscribeDetail)){
-            return purchase.getId();
-        }
-        Subscribe subscribe = subscribeService.getById(subscribeDetail.getSubscribeId());
-        if(ObjectUtils.isEmpty(subscribe)){
-            return purchase.getId();
-        }
-        String victoriatouristJson = subscribe.getVictoriatouristJson();
-        if(ObjectUtils.isNotEmpty(victoriatouristJson)) {
-            JSONObject json = JSONObject.parseObject(victoriatouristJson);
-            Long receiptWarehouseId = json.getLong("receiptWarehouseId");
+            //根据申购明细id去申购单获取仓库id 名称
+            if (ObjectUtils.isEmpty(purchaseDetailList)) {
+                return purchase.getId();
+            }
+            PurchaseDetail purchaseDetail = purchaseDetailList.get(0);
+            SubscribeDetail subscribeDetail = subscribeDetailService.getById(purchaseDetail.getSubscribeDetailId());
+            if (ObjectUtils.isEmpty(subscribeDetail)) {
+                return purchase.getId();
+            }
+            Subscribe subscribe = subscribeService.getById(subscribeDetail.getSubscribeId());
+            if (ObjectUtils.isEmpty(subscribe)) {
+                return purchase.getId();
+            }
+            String victoriatouristJson = subscribe.getVictoriatouristJson();
+            if (ObjectUtils.isNotEmpty(victoriatouristJson)) {
+                JSONObject json = JSONObject.parseObject(victoriatouristJson);
+                Long receiptWarehouseId = json.getLong("receiptWarehouseId");
 
-            String victoriatouristJson1 = purchase.getVictoriatouristJson();
-            JSONObject json1 = JSONObject.parseObject(victoriatouristJson1);
-            json1.put("receiptWarehouseId",receiptWarehouseId);
-            purchase.setVictoriatouristJson(json1.toJSONString());
-            purchaseService.updateById(purchase);
+                String victoriatouristJson1 = purchase.getVictoriatouristJson();
+                JSONObject json1 = JSONObject.parseObject(victoriatouristJson1);
+                json1.put("receiptWarehouseId", receiptWarehouseId);
+                purchase.setVictoriatouristJson(json1.toJSONString());
+                purchaseService.updateById(purchase);
+            }
+            return purchase.getId();
+        } finally {
+            DynamicDataSourceContextHolder.poll();
         }
-        DynamicDataSourceContextHolder.poll();
-        return purchase.getId();
     }
 
     /**
      * 结束流程
-     * @param flowId 流程ID
+     *
+     * @param flowId     流程ID
      * @param businessId 业务ID
      * @param submitData 数据
      */
     @Override
     public void end(Long flowId, Long businessId, JSONObject submitData) {
         //修改申购明细状态
-        List<PurchaseDetail> purchaseDetailList = purchaseDetailService.list(Wrappers.<PurchaseDetail>query().lambda().eq(PurchaseDetail::getPurchaseId,businessId));
+        List<PurchaseDetail> purchaseDetailList = purchaseDetailService.list(Wrappers.<PurchaseDetail>query().lambda().eq(PurchaseDetail::getPurchaseId, businessId));
         Map<Long, PurchaseDetail> purchaseDetailMap = purchaseDetailList.stream().collect(Collectors.toMap(PurchaseDetail::getSubscribeDetailId, Function.identity()));
         List<Long> subscribeDetailIds = purchaseDetailList.stream().map(PurchaseDetail::getSubscribeDetailId).collect(Collectors.toList());
         List<SubscribeDetail> subscribeDetails = subscribeDetailService.listByIds(subscribeDetailIds);
         for (SubscribeDetail subscribeDetail : subscribeDetails) {
             //获取申购明细下的所有采购记录 计算已采购数
             List<PurchaseDetail> purchaseDetails = purchaseDetailService.list(q -> q.eq(PurchaseDetail::getSubscribeDetailId,
-                    subscribeDetail.getId()).eq(PurchaseDetail::getBussinessId,subscribeDetail.getBussinessId()));
+                    subscribeDetail.getId()).eq(PurchaseDetail::getBussinessId, subscribeDetail.getBussinessId()));
             BigDecimal count = purchaseDetails.stream()
                     .map(PurchaseDetail::getCount)
                     .reduce(BigDecimal.ZERO, BigDecimal::add);
 //            PurchaseDetail purchaseDetail = purchaseDetailMap.get(subscribeDetail.getId());
-            if(count.compareTo(subscribeDetail.getCount())==0){
+            if (count.compareTo(subscribeDetail.getCount()) == 0) {
                 //修改为已采购
                 subscribeDetail.setStatus(SubscribeDetailStatusEnum.PURCHASED.getKey());
-            }else{
+            } else {
                 //修改为部分采购
                 subscribeDetail.setStatus(SubscribeDetailStatusEnum.LITT_PAID_AMOUNT.getKey());
             }
@@ -142,25 +147,25 @@ public class PurchaseFlowByWdly extends FlowDelegate {
 
         //通过业务ID查询采购数据
         Purchase purchase = purchaseService.getById(businessId);
-        if(ObjectUtils.isEmpty(purchase)){
+        if (ObjectUtils.isEmpty(purchase)) {
             throw new ServiceException("采购单不存在");
         }
         //查询采购产品
 //        List<PurchaseDetail> purchaseDetailList = purchaseDetailService.list(Wrappers.<PurchaseDetail>query().lambda().eq(PurchaseDetail::getPurchaseId,businessId));
         List<ContractProduct> upContractProduct = new ArrayList<>();
-        for(PurchaseDetail p:purchaseDetailList){
-            if(ObjectUtils.isNotEmpty(p.getDataResourceId())&&
-                    p.getDataResource()== PurchaseDataResourceEnum.DATA_RESOURCE_1.getKey()){//如果采购的是外销合同
+        for (PurchaseDetail p : purchaseDetailList) {
+            if (ObjectUtils.isNotEmpty(p.getDataResourceId()) &&
+                    p.getDataResource() == PurchaseDataResourceEnum.DATA_RESOURCE_1.getKey()) {//如果采购的是外销合同
                 ContractProduct contractProduct = contractProductService.getById(p.getDataResourceId());
                 BigDecimal expendQuantity = contractProduct.getExpendQuantity().subtract(p.getCount());
-                if(expendQuantity.compareTo(BigDecimal.ZERO)< 1){//小于0不让继续执行
+                if (expendQuantity.compareTo(BigDecimal.ZERO) < 1) {//小于0不让继续执行
                     throw new ServiceException("采购数量不得大于外销合同数量");
                 }
                 contractProduct.setExpendQuantity(expendQuantity);
                 upContractProduct.add(contractProduct);
             }
         }
-        if(CollectionUtils.isNotEmpty(upContractProduct)){//扣减销售合同数量
+        if (CollectionUtils.isNotEmpty(upContractProduct)) {//扣减销售合同数量
             contractProductService.updateBatchById(upContractProduct);
         }
         //修改采购状态为审批通过
@@ -170,8 +175,8 @@ public class PurchaseFlowByWdly extends FlowDelegate {
         //修改采购明细为待采购
         PurchaseDetail detail = new PurchaseDetail();
         detail.setStatus(PurchaseDetailStatusEnum.PASS.getKey());
-        purchaseDetailService.update(detail,Wrappers.<PurchaseDetail>query()
-                .lambda().eq(PurchaseDetail::getPurchaseId,purchase.getId()));
+        purchaseDetailService.update(detail, Wrappers.<PurchaseDetail>query()
+                .lambda().eq(PurchaseDetail::getPurchaseId, purchase.getId()));
     }
 
 }

+ 1 - 1
hx-supply/src/main/java/com/fjhx/supply/service/supplier/impl/SupplierPriceServiceImpl.java

@@ -166,7 +166,7 @@ public class SupplierPriceServiceImpl extends ServiceImpl<SupplierPriceMapper, S
             throw new ServiceException("供应商id不能为空");
         }
         List<Long> productIdList = dto.getProductIdList();
-        if (ObjectUtils.isEmpty(supplierId)) {
+        if (ObjectUtils.isEmpty(productIdList)) {
             throw new ServiceException("产品id数组不能为空");
         }
         List<SupplierPrice> list = list(q -> q.eq(SupplierPrice::getSupplierInfoId, supplierId).in(SupplierPrice::getProductInfoId, productIdList));

+ 9 - 4
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/stock/impl/StockTransferServiceImpl.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.victoriatourist.entity.abnormal.po.AbnormalInfo;
+import com.fjhx.victoriatourist.entity.jd.vo.JdBackVo;
 import com.fjhx.victoriatourist.entity.stock.dto.StockTransferDto;
 import com.fjhx.victoriatourist.entity.stock.dto.StockTransferSelectDto;
 import com.fjhx.victoriatourist.entity.stock.po.StockTransfer;
@@ -37,10 +38,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -99,6 +97,13 @@ public class StockTransferServiceImpl extends ServiceImpl<StockTransferMapper, S
     public StockTransferVo detail(Long id) {
         StockTransfer StockTransfer = this.getById(id);
         StockTransferVo result = BeanUtil.toBean(StockTransfer, StockTransferVo.class);
+        //赋值仓库名称信息
+        warehouseService.attributeAssign(Arrays.asList(result), StockTransferVo::getInWarehouseId, (item, warehouse) -> {
+            item.setInWarehouseName(warehouse.getName());
+        });
+        warehouseService.attributeAssign(Arrays.asList(result), StockTransferVo::getOutWarehouseId, (item, warehouse) -> {
+            item.setOutWarehouseName(warehouse.getName());
+        });
         List<StockTransferDetails> list = stockTransferDetailsService.list(q -> q.eq(StockTransferDetails::getStockTransferId, id));
         List<StockTransferDetailsVo> stockTransferDetailsVos = BeanUtil.copyToList(list, StockTransferDetailsVo.class);
         //赋值明细产品信息

+ 5 - 0
hx-wms/src/main/java/com/fjhx/wms/entity/stock/vo/StockWaitVo.java

@@ -67,4 +67,9 @@ public class StockWaitVo extends StockWait {
      */
     private String operatorName;
 
+    /**
+     * 待出入库明细id
+     */
+    private Long stockWaitDetailsId;
+
 }

+ 13 - 0
hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockWaitDetailsServiceImpl.java

@@ -2,6 +2,7 @@ package com.fjhx.wms.service.stock.impl;
 
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
+import com.fjhx.item.entity.product.po.ProductInfo;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.wms.entity.stock.emums.JournalType;
 import com.fjhx.wms.entity.stock.emums.StockWaitType;
@@ -83,6 +84,18 @@ public class StockWaitDetailsServiceImpl extends ServiceImpl<StockWaitDetailsMap
     public StockWaitDetailsVo detail(Long id) {
         StockWaitDetails StockWaitDetails = this.getById(id);
         StockWaitDetailsVo result = BeanUtil.toBean(StockWaitDetails, StockWaitDetailsVo.class);
+        //查询待入库信息
+        StockWait stockWait = stockWaitService.getById(result.getStockWaitId());
+        if(ObjectUtil.isEmpty(stockWait)){
+            throw new ServiceException("无法查询到待入库信息,待入库id"+result.getStockWaitId());
+        }
+        result.setBusinessType(stockWait.getBusinessType());
+        result.setBusinessCode(stockWait.getBusinessCode());;
+        ProductInfo byId = productInfoService.getById(StockWaitDetails.getProductId());
+        if(ObjectUtil.isEmpty(byId)){
+            throw new ServiceException("无法查询到产品信息,产品id"+StockWaitDetails.getProductId());
+        }
+        result.setProductName(byId.getName());
         return result;
     }
 

+ 2 - 2
hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockWaitServiceImpl.java

@@ -138,9 +138,9 @@ public class StockWaitServiceImpl extends ServiceImpl<StockWaitMapper, StockWait
 
     @Override
     public StockWaitVo detail(Long id) {
-        StockWaitDetails stockWaitDetails = stockWaitDetailsService.getById(id);
-        StockWait stockWait = this.getById(stockWaitDetails.getStockWaitId());
+        StockWait stockWait = this.getById(id);
         StockWaitVo result = BeanUtil.toBean(stockWait, StockWaitVo.class);
+        StockWaitDetails stockWaitDetails = stockWaitDetailsService.getOne(q -> q.eq(StockWaitDetails::getStockWaitId, id));
         ProductInfo byId = productInfoService.getById(stockWaitDetails.getProductId());
         result.setProductName(byId.getName());
         result.setQuantity(stockWaitDetails.getQuantity());

+ 1 - 0
hx-wms/src/main/resources/mapper/stock/StockWaitMapper.xml

@@ -4,6 +4,7 @@
     <select id="getPage" resultType="com.fjhx.wms.entity.stock.vo.StockWaitVo">
         SELECT
             sw.id,
+            swd.id stockWaitDetailsId,
             sw.type,
             sw.business_id,
             sw.business_code,