瀏覽代碼

Merge remote-tracking branch 'origin/master'

24282 2 年之前
父節點
當前提交
5f208141f0
共有 20 個文件被更改,包括 298 次插入57 次删除
  1. 4 4
      hx-common/src/main/java/com/fjhx/common/entity/corporation/po/Corporation.java
  2. 16 11
      hx-customer/src/main/java/com/fjhx/customer/controller/customer/CustomerController.java
  3. 18 5
      hx-customer/src/main/java/com/fjhx/customer/controller/customer/CustomerFollowRecordsController.java
  4. 6 1
      hx-customer/src/main/java/com/fjhx/customer/entity/customer/dto/CustomerFollowRecordsSelectDto.java
  5. 11 2
      hx-customer/src/main/java/com/fjhx/customer/entity/customer/po/CustomerUser.java
  6. 7 1
      hx-customer/src/main/java/com/fjhx/customer/entity/customer/vo/CustomerFollowRecordsVo.java
  7. 4 0
      hx-customer/src/main/java/com/fjhx/customer/service/customer/CustomerFollowRecordsService.java
  8. 2 0
      hx-customer/src/main/java/com/fjhx/customer/service/customer/CustomerService.java
  9. 59 12
      hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerFollowRecordsServiceImpl.java
  10. 20 16
      hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerServiceImpl.java
  11. 46 2
      hx-item/src/main/java/com/fjhx/item/service/product/impl/ProductInfoServiceImpl.java
  12. 5 0
      hx-purchase/src/main/java/com/fjhx/purchase/entity/purchase/po/Purchase.java
  13. 5 0
      hx-purchase/src/main/java/com/fjhx/purchase/entity/subscribe/po/Subscribe.java
  14. 1 0
      hx-purchase/src/main/java/com/fjhx/purchase/flow/SubscribeFlow.java
  15. 16 1
      hx-purchase/src/main/java/com/fjhx/purchase/flow/SubscribeFlowByWdly.java
  16. 29 1
      hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/impl/PurchaseServiceImpl.java
  17. 30 0
      hx-sale/src/main/java/com/fjhx/sale/entity/contract/po/Contract.java
  18. 1 0
      hx-sale/src/main/java/com/fjhx/sale/flow/PurchaseFlow.java
  19. 16 0
      hx-sale/src/main/java/com/fjhx/sale/flow/PurchaseFlowByWdly.java
  20. 2 1
      hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockWaitServiceImpl.java

+ 4 - 4
hx-common/src/main/java/com/fjhx/common/entity/corporation/po/Corporation.java

@@ -53,14 +53,14 @@ public class Corporation extends BasePo {
     /**
      * 营业开始日期
      */
-    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
-    private Date startDate;
+//    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    private String startDate;
 
     /**
      * 营业结束日期
      */
-    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
-    private Date stopDate;
+//    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    private String stopDate;
 
     /**
      * 纳税人资质

+ 16 - 11
hx-customer/src/main/java/com/fjhx/customer/controller/customer/CustomerController.java

@@ -1,18 +1,18 @@
 package com.fjhx.customer.controller.customer;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
-import com.fjhx.common.constant.SourceConstant;
-import org.springframework.web.bind.annotation.*;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.customer.entity.customer.vo.CustomerVo;
-import com.fjhx.customer.entity.customer.dto.CustomerSelectDto;
+import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.customer.entity.customer.dto.CustomerDto;
-import com.ruoyi.common.core.domain.BaseSelectDto;
+import com.fjhx.customer.entity.customer.dto.CustomerSelectDto;
+import com.fjhx.customer.entity.customer.vo.CustomerVo;
 import com.fjhx.customer.service.customer.CustomerService;
+import com.ruoyi.common.core.domain.BaseSelectDto;
 import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.List;
-import java.util.Map;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * <p>
@@ -85,9 +85,14 @@ public class CustomerController {
      */
     @PostMapping("/CustomerAllocation")
     public void CustomerAllocation(@RequestBody CustomerDto dto) {
-            customerService.updateById(dto);
+        customerService.updateById(dto);
     }
 
-
-
+    /**
+     * 修改客户标签
+     */
+    @PostMapping("/editTag")
+    public void editTag(@RequestBody CustomerDto customerDto) {
+        customerService.editTag(customerDto);
+    }
 }

+ 18 - 5
hx-customer/src/main/java/com/fjhx/customer/controller/customer/CustomerFollowRecordsController.java

@@ -1,13 +1,18 @@
 package com.fjhx.customer.controller.customer;
 
-import org.springframework.web.bind.annotation.*;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.customer.entity.customer.vo.CustomerFollowRecordsVo;
-import com.fjhx.customer.entity.customer.dto.CustomerFollowRecordsSelectDto;
 import com.fjhx.customer.entity.customer.dto.CustomerFollowRecordsDto;
-import com.ruoyi.common.core.domain.BaseSelectDto;
+import com.fjhx.customer.entity.customer.dto.CustomerFollowRecordsSelectDto;
+import com.fjhx.customer.entity.customer.vo.CustomerFollowRecordsVo;
 import com.fjhx.customer.service.customer.CustomerFollowRecordsService;
+import com.ruoyi.common.core.domain.BaseSelectDto;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
 
 
 /**
@@ -15,7 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
  * 客户跟进记录 前端控制器
  * </p>
  *
- * @author 
+ * @author
  * @since 2023-05-05
  */
 @RestController
@@ -65,4 +70,12 @@ public class CustomerFollowRecordsController {
         customerFollowRecordsService.delete(dto.getId());
     }
 
+    /**
+     * 跟进记录列表
+     */
+    @PostMapping("/followList")
+    public List<CustomerFollowRecordsVo> followList(@RequestBody CustomerFollowRecordsSelectDto dto) {
+        return customerFollowRecordsService.followList(dto.getCustomerId());
+    }
+
 }

+ 6 - 1
hx-customer/src/main/java/com/fjhx/customer/entity/customer/dto/CustomerFollowRecordsSelectDto.java

@@ -7,11 +7,16 @@ import lombok.Setter;
 /**
  * 客户跟进记录列表查询入参实体
  *
- * @author 
+ * @author
  * @since 2023-05-05
  */
 @Getter
 @Setter
 public class CustomerFollowRecordsSelectDto extends BaseSelectDto {
 
+    /**
+     * 客户id
+     */
+    private Long customerId;
+
 }

+ 11 - 2
hx-customer/src/main/java/com/fjhx/customer/entity/customer/po/CustomerUser.java

@@ -1,8 +1,7 @@
 package com.fjhx.customer.entity.customer.po;
 
-import com.ruoyi.common.core.domain.BasePo;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.util.Date;
+import com.ruoyi.common.core.domain.BasePo;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -34,4 +33,14 @@ public class CustomerUser extends BasePo {
      */
     private String phone;
 
+    /**
+     * 电子邮箱
+     */
+    private String email;
+
+    /**
+     * 更多联系方式
+     */
+    private String contactJson;
+
 }

+ 7 - 1
hx-customer/src/main/java/com/fjhx/customer/entity/customer/vo/CustomerFollowRecordsVo.java

@@ -1,9 +1,12 @@
 package com.fjhx.customer.entity.customer.vo;
 
 import com.fjhx.customer.entity.customer.po.CustomerFollowRecords;
+import com.fjhx.file.entity.ObsFile;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.List;
+
 /**
  * 客户跟进记录列表查询返回值实体
  *
@@ -13,5 +16,8 @@ import lombok.Setter;
 @Getter
 @Setter
 public class CustomerFollowRecordsVo extends CustomerFollowRecords {
-
+    /**
+     * 文件列表
+     */
+    List<ObsFile> fileList;
 }

+ 4 - 0
hx-customer/src/main/java/com/fjhx/customer/service/customer/CustomerFollowRecordsService.java

@@ -7,6 +7,8 @@ import com.fjhx.customer.entity.customer.vo.CustomerFollowRecordsVo;
 import com.fjhx.customer.entity.customer.dto.CustomerFollowRecordsSelectDto;
 import com.fjhx.customer.entity.customer.dto.CustomerFollowRecordsDto;
 
+import java.util.List;
+
 
 /**
  * <p>
@@ -23,6 +25,8 @@ public interface CustomerFollowRecordsService extends BaseService<CustomerFollow
      */
     Page<CustomerFollowRecordsVo> getPage(CustomerFollowRecordsSelectDto dto);
 
+    List<CustomerFollowRecordsVo> followList(Long id);
+
     /**
      * 客户跟进记录明细
      */

+ 2 - 0
hx-customer/src/main/java/com/fjhx/customer/service/customer/CustomerService.java

@@ -66,4 +66,6 @@ public interface CustomerService extends BaseService<Customer> {
      * @return
      */
     List<CustomerVo> sourceIncrement(QueryWrapper<Object> query);
+
+    void editTag(CustomerDto customerDto);
 }

+ 59 - 12
hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerFollowRecordsServiceImpl.java

@@ -1,20 +1,30 @@
 package com.fjhx.customer.service.customer.impl;
 
-import com.baomidou.dynamic.datasource.annotation.DS;
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
+import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.common.constant.SourceConstant;
+import com.fjhx.customer.entity.customer.dto.CustomerFollowRecordsDto;
+import com.fjhx.customer.entity.customer.dto.CustomerFollowRecordsSelectDto;
 import com.fjhx.customer.entity.customer.po.CustomerFollowRecords;
+import com.fjhx.customer.entity.customer.vo.CustomerFollowRecordsVo;
 import com.fjhx.customer.mapper.customer.CustomerFollowRecordsMapper;
 import com.fjhx.customer.service.customer.CustomerFollowRecordsService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.file.entity.FileInfo;
+import com.fjhx.file.entity.ObsFile;
+import com.fjhx.file.service.FileInfoService;
 import com.fjhx.file.utils.ObsFileUtil;
-import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.customer.entity.customer.vo.CustomerFollowRecordsVo;
-import com.fjhx.customer.entity.customer.dto.CustomerFollowRecordsSelectDto;
+import com.obs.services.internal.ServiceException;
 import com.ruoyi.common.utils.wrapper.IWrapper;
-import com.fjhx.customer.entity.customer.dto.CustomerFollowRecordsDto;
-import cn.hutool.core.bean.BeanUtil;
-import oshi.util.FileUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 
 /**
@@ -22,21 +32,58 @@ import oshi.util.FileUtil;
  * 客户跟进记录 服务实现类
  * </p>
  *
- * @author 
+ * @author
  * @since 2023-05-05
  */
 @Service
 public class CustomerFollowRecordsServiceImpl extends ServiceImpl<CustomerFollowRecordsMapper, CustomerFollowRecords> implements CustomerFollowRecordsService {
 
+    @Autowired
+    FileInfoService fileInfoService;
+
     @Override
     public Page<CustomerFollowRecordsVo> getPage(CustomerFollowRecordsSelectDto dto) {
         IWrapper<CustomerFollowRecords> wrapper = getWrapper();
+        wrapper.eq("cfr",CustomerFollowRecords::getCustomerId,dto.getCustomerId());//根据客户id过滤
         wrapper.orderByDesc("cfr", CustomerFollowRecords::getId);
         Page<CustomerFollowRecordsVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        List<CustomerFollowRecordsVo> records = page.getRecords();
+        //赋值文件列表信息
+        List<Long> ids = records.stream().map(CustomerFollowRecordsVo::getId).filter(ObjectUtil::isNotNull).distinct().collect(Collectors.toList());
+        if (ObjectUtil.isNotEmpty(ids)) {
+            DynamicDataSourceContextHolder.push(SourceConstant.BASE);
+            Map<Long, List<FileInfo>> longListMap = fileInfoService.mapKGroup(FileInfo::getBusinessId, q -> q.in(FileInfo::getBusinessId, ids));
+            for (CustomerFollowRecordsVo record : records) {
+                List<ObsFile> obsFiles = BeanUtil.copyToList(longListMap.get(record.getId()), ObsFile.class);
+                record.setFileList(obsFiles);
+            }
+        }
+
         return page;
     }
 
     @Override
+    public List<CustomerFollowRecordsVo> followList(Long customerId){
+        if(ObjectUtil.isEmpty(customerId)){
+            throw new ServiceException("客户id不能为空");
+        }
+        List<CustomerFollowRecords> customerFollowRecords = list(q->q.eq(CustomerFollowRecords::getCustomerId,customerId)
+                .orderByDesc(CustomerFollowRecords::getDate));
+        List<CustomerFollowRecordsVo> customerFollowRecordsVos = BeanUtil.copyToList(customerFollowRecords, CustomerFollowRecordsVo.class);
+        //赋值文件列表信息
+        List<Long> ids = customerFollowRecordsVos.stream().map(CustomerFollowRecordsVo::getId).filter(ObjectUtil::isNotNull).distinct().collect(Collectors.toList());
+        if (ObjectUtil.isNotEmpty(ids)) {
+            DynamicDataSourceContextHolder.push(SourceConstant.BASE);
+            Map<Long, List<FileInfo>> longListMap = fileInfoService.mapKGroup(FileInfo::getBusinessId, q -> q.in(FileInfo::getBusinessId, ids));
+            for (CustomerFollowRecordsVo record : customerFollowRecordsVos) {
+                List<ObsFile> obsFiles = BeanUtil.copyToList(longListMap.get(record.getId()), ObsFile.class);
+                record.setFileList(obsFiles);
+            }
+        }
+        return customerFollowRecordsVos;
+    }
+
+    @Override
     public CustomerFollowRecordsVo detail(Long id) {
         CustomerFollowRecords CustomerFollowRecords = this.getById(id);
         CustomerFollowRecordsVo result = BeanUtil.toBean(CustomerFollowRecords, CustomerFollowRecordsVo.class);
@@ -47,14 +94,14 @@ public class CustomerFollowRecordsServiceImpl extends ServiceImpl<CustomerFollow
     @Override
     public void add(CustomerFollowRecordsDto customerFollowRecordsDto) {
         this.save(customerFollowRecordsDto);
-        ObsFileUtil.saveFile(customerFollowRecordsDto.getFileList(),customerFollowRecordsDto.getId());
+        ObsFileUtil.saveFile(customerFollowRecordsDto.getFileList(), customerFollowRecordsDto.getId());
     }
 
     @DSTransactional
     @Override
     public void edit(CustomerFollowRecordsDto customerFollowRecordsDto) {
         this.updateById(customerFollowRecordsDto);
-        ObsFileUtil.editFile(customerFollowRecordsDto.getFileList(),customerFollowRecordsDto.getId());
+        ObsFileUtil.editFile(customerFollowRecordsDto.getFileList(), customerFollowRecordsDto.getId());
     }
 
     @DSTransactional

+ 20 - 16
hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerServiceImpl.java

@@ -26,8 +26,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -76,14 +74,13 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
         List<CustomerVo> records = page.getRecords();
         AreaUtil.setAreaName(records);
         //赋值客户跟进记录
-        List<Long> customerIds = records.stream().map(Customer::getId).collect(Collectors.toList());
-        if (ObjectUtil.isNotEmpty(customerIds)) {
-            Map<Long, List<CustomerFollowRecords>> longListMap = customerFollowRecordsService.mapKGroup(CustomerFollowRecords::getCustomerId,
-                    q -> q.in(CustomerFollowRecords::getCustomerId, customerIds));
-            for (CustomerVo record : records) {
-                record.setCustomerFollowRecordsList(longListMap.get(record.getId()));
-            }
+        for (CustomerVo record : records) {
+            List<CustomerFollowRecords> customerFollowRecordsList = customerFollowRecordsService.list(q ->
+                    q.eq(CustomerFollowRecords::getCustomerId, record.getId())
+                            .orderByDesc(CustomerFollowRecords::getDate).last("limit 3"));
+            record.setCustomerFollowRecordsList(customerFollowRecordsList);
         }
+
         return page;
     }
 
@@ -173,13 +170,11 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
         List<CustomerVo> records = page.getRecords();
         AreaUtil.setAreaName(records);
         //赋值客户跟进记录
-        List<Long> customerIds = records.stream().map(Customer::getId).collect(Collectors.toList());
-        if (ObjectUtil.isNotEmpty(customerIds)) {
-            Map<Long, List<CustomerFollowRecords>> longListMap = customerFollowRecordsService.mapKGroup(CustomerFollowRecords::getCustomerId,
-                    q -> q.in(CustomerFollowRecords::getCustomerId, customerIds));
-            for (CustomerVo record : records) {
-                record.setCustomerFollowRecordsList(longListMap.get(record.getId()));
-            }
+        for (CustomerVo record : records) {
+            List<CustomerFollowRecords> customerFollowRecordsList = customerFollowRecordsService.list(q ->
+                    q.eq(CustomerFollowRecords::getCustomerId, record.getId())
+                            .orderByDesc(CustomerFollowRecords::getDate).last("limit 3"));
+            record.setCustomerFollowRecordsList(customerFollowRecordsList);
         }
         return page;
     }
@@ -211,8 +206,17 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
     private void saveCustomerUse(CustomerDto customerDto) {
         List<CustomerUser> customerUserDtoList = customerDto.getCustomerUserList();
         customerUserDtoList.forEach(customerUserDto -> customerUserDto.setCustomerId(customerDto.getId()));
+        customerUserDtoList.forEach(customerUserDto -> customerUserDto.setId(null));//防止传id过来导致key冲突
         customerUserService.saveBatch(customerUserDtoList);
     }
 
+    /**
+     * 修改客户标签
+     */
+    @Override
+    public void editTag(CustomerDto customerDto) {
+        this.updateById(customerDto);
+    }
+
 
 }

+ 46 - 2
hx-item/src/main/java/com/fjhx/item/service/product/impl/ProductInfoServiceImpl.java

@@ -123,8 +123,48 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
 
     @Override
     public Page<ProductInfoVo> getPageByWdly(ProductInfoSelectDto dto) {
-        Page<ProductInfoVo> page = getPage(dto);
+        IWrapper<ProductInfo> wrapper = getWrapper();
+        wrapper.orderByDesc("pi", ProductInfo::getId);
+        wrapper.eq("pi", ProductInfo::getType, dto.getType());
+        wrapper.eq("pi", ProductInfo::getDefinition, dto.getDefinition());
+        wrapper.eq("pi", ProductInfo::getProductClassifyId, dto.getProductClassifyId());
+        wrapper.keyword(dto,
+                new SqlField("pi", ProductInfo::getName),
+                new SqlField("pi", ProductInfo::getCustomCode)
+        );
+        //计算并根据生命周期过滤
+        wrapper.eq("IF(DATEDIFF(now(),pi.create_time)> json_unquote( victoriatourist_json -> '$.growUpDay' ),3,IF( DATEDIFF(now(),pi.create_time)> json_unquote( victoriatourist_json -> '$.newProductsDay' ), 2, 1 ))", dto.getLifeCycle());
+        wrapper.eq("json_unquote( victoriatourist_json -> '$.combination' )", dto.getCombination());
+        Page<ProductInfoVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+
         List<ProductInfoVo> records = page.getRecords();
+
+        if (records.size() == 0) {
+            return page;
+        }
+
+        List<ProductClassify> productClassifyList = productClassifyService.list();
+        Map<Long, ProductClassify> productClassifyMap = productClassifyList.stream().collect(Collectors.toMap(BaseIdPo::getId, Function.identity()));
+
+        for (ProductInfoVo record : records) {
+            Long productClassifyId = record.getProductClassifyId();
+            ProductClassify productClassify = productClassifyMap.get(productClassifyId);
+            if (productClassify == null) {
+                continue;
+            }
+
+            record.setClassifyName(productClassify.getName());
+
+            List<String> classifyNameGroup = new ArrayList<>();
+
+            while (productClassify != null) {
+                classifyNameGroup.add(0, productClassify.getName());
+                productClassify = productClassifyMap.get(productClassify.getParentId());
+            }
+            record.setClassifyNameGroup(classifyNameGroup);
+
+        }
+//--------------------------------------------------
         //赋值维多利亚扩展部门名称
         List<Long> ids = new ArrayList<>();
         for (ProductInfoVo record : records) {
@@ -238,6 +278,8 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         productInfoDto.setCode(CodeEnum.PRODUCT.getCode());
         // 排除名称重复
         this.nameDuplication(ProductInfo::getName, productInfoDto.getName(), "产品名称重复");
+        // 排除自定义编码重复
+        this.nameDuplication(ProductInfo::getCustomCode, productInfoDto.getCustomCode(), "产品自定义编码重复");
         this.save(productInfoDto);
         ObsFileUtil.saveFile(productInfoDto.getFileList(), productInfoDto.getId());
     }
@@ -327,7 +369,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
             //产品分类名称转id
             ProductClassify productClassify = productClassifyService.getOne(q -> q.eq(ProductClassify::getName, productInfoEhsdExcel.getProductClassifyName()));
             if (ObjectUtil.isEmpty(productClassify)) {
-                throw new ServiceException("未知产品分类"+ productInfoEhsdExcel.getProductClassifyName());
+                throw new ServiceException("未知产品分类" + productInfoEhsdExcel.getProductClassifyName());
             }
             productInfo.setProductClassifyId(productClassify.getId());
             //单位名称转字典key
@@ -392,6 +434,8 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         productInfoDto.setCode(null);
         // 排除名称重复
         this.nameDuplication(ProductInfo::getName, productInfoDto.getName(), productInfoDto.getId(), "产品名称重复");
+        // 排除自定义编码重复
+        this.nameDuplication(ProductInfo::getCustomCode, productInfoDto.getCustomCode(), "产品自定义编码重复");
         this.updateById(productInfoDto);
         ObsFileUtil.editFile(productInfoDto.getFileList(), productInfoDto.getId());
     }

+ 5 - 0
hx-purchase/src/main/java/com/fjhx/purchase/entity/purchase/po/Purchase.java

@@ -110,4 +110,9 @@ public class Purchase extends BasePo {
      * 维多利亚扩展json
      */
     private String victoriatouristJson;
+
+    /**
+     * 流程实例
+     */
+    private Long flowId;
 }

+ 5 - 0
hx-purchase/src/main/java/com/fjhx/purchase/entity/subscribe/po/Subscribe.java

@@ -87,4 +87,9 @@ public class Subscribe extends BasePo {
     /**维多利亚扩展json*/
     private String victoriatouristJson;
 
+    /**
+     * 流程实例
+     */
+    private Long flowId;
+
 }

+ 1 - 0
hx-purchase/src/main/java/com/fjhx/purchase/flow/SubscribeFlow.java

@@ -48,6 +48,7 @@ public class SubscribeFlow extends FlowDelegate {
         Subscribe subscribe = submitData.toJavaObject(Subscribe.class);
         subscribe.setCode(CodeEnum.SUBSCRIBE.getCode());
         subscribe.setSubcribeStatus(SubscribeStatusEnum.UNDER_REVIEW.getKey());
+        subscribe.setFlowId(flowId);
         subscribeService.save(subscribe);
         List<SubscribeDetail> SubscribeDetails = subscribe.getSubscribeDetailList();
         if(CollectionUtils.isNotEmpty(SubscribeDetails)){

+ 16 - 1
hx-purchase/src/main/java/com/fjhx/purchase/flow/SubscribeFlowByWdly.java

@@ -47,7 +47,22 @@ public class SubscribeFlowByWdly extends FlowDelegate {
      */
     @Override
     public Long start(Long flowId, JSONObject submitData) {
-        return subscribeFlow.start(flowId,submitData);
+        SubscribeService subscribeService = SpringUtil.getBean(SubscribeService.class);
+        SubscribeDetailService subscribeDetailService = SpringUtil.getBean(SubscribeDetailService.class);
+        Subscribe subscribe = submitData.toJavaObject(Subscribe.class);
+        subscribe.setCode(CodeEnum.SUBSCRIBE.getCode());
+        subscribe.setProcessInstanceId("wdly_apply_purchase");
+        subscribe.setFlowId(flowId);
+        subscribe.setSubcribeStatus(SubscribeStatusEnum.UNDER_REVIEW.getKey());
+        subscribeService.save(subscribe);
+        List<SubscribeDetail> SubscribeDetails = subscribe.getSubscribeDetailList();
+        if(CollectionUtils.isNotEmpty(SubscribeDetails)){
+            for(SubscribeDetail s : SubscribeDetails){
+                s.setSubscribeId(subscribe.getId());
+            }
+            subscribeDetailService.saveBatch(SubscribeDetails);
+        }
+        return subscribe.getId();
     }
 
     /**

+ 29 - 1
hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/impl/PurchaseServiceImpl.java

@@ -130,9 +130,37 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
 
     @Override
     public Page<PurchaseVo> getPageByWdly(PurchaseSelectDto dto) {
-        Page<PurchaseVo> page = getPage(dto);
+        IWrapper<Purchase> wrapper = getWrapper();
+
+        //过滤维多利亚数据
+        wrapper.isNotNull("p.victoriatourist_json");
+
+        wrapper.orderByDesc("p", Purchase::getCreateTime);
+        if (ObjectUtils.isNotEmpty(dto.getPurchaseStatus())) {
+            wrapper.eq("p", Purchase::getPurchaseStatus, dto.getPurchaseStatus());
+        }
+        if (ObjectUtils.isNotEmpty(dto.getArrivalStatus())) {
+            wrapper.eq("p", Purchase::getArrivalStatus, dto.getArrivalStatus());
+        }
+        if (ObjectUtils.isNotEmpty(dto.getPayStatus())) {
+            wrapper.eq("p", Purchase::getPayStatus, dto.getPayStatus());
+        }
+        wrapper.eq("p", Purchase::getCode, dto.getKeyword());//根据采购单号关键字搜索
+        Page<PurchaseVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         List<PurchaseVo> list = page.getRecords();
         if (CollectionUtils.isNotEmpty(list)) {
+            List<Long> supplyIds = list.stream().map(PurchaseVo::getSupplyId).collect(Collectors.toList());
+            List<SupplierInfo> supplierInfoList = supplierInfoService.list(Wrappers.<SupplierInfo>query().lambda().in(SupplierInfo::getId, supplyIds));
+            Map<Long, List<SupplierInfo>> supplyMap = supplierInfoList.stream().distinct().collect(Collectors.groupingBy(SupplierInfo::getId));
+            if (MapUtils.isNotEmpty(supplyMap)) {
+                for (PurchaseVo p : list) {
+                    List<SupplierInfo> supplys = supplyMap.getOrDefault(p.getSupplyId(), null);
+                    p.setSupplyName(supplys == null ? null : supplys.get(0).getName());
+                }
+            }
+        }
+        //-------------------------------------------------
+        if (CollectionUtils.isNotEmpty(list)) {
             //维多利亚 赋值收货仓库名称
             List<Long> wids = new ArrayList<>();
             for (PurchaseVo purchaseVo : list) {

+ 30 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/contract/po/Contract.java

@@ -222,6 +222,36 @@ public class Contract extends BasePo {
     private String ehsdJson;
 
     /**
+     * beneficiaryName
+     */
+    private String beneficiaryName;
+
+    /**
+     * beneficiaryBank
+     */
+    private String beneficiaryBank;
+
+    /**
+     * beneficiaryBankAddress
+     */
+    private String beneficiaryBankAddress;
+
+    /**
+     * beneficiaryAddress
+     */
+    private String beneficiaryAddress;
+
+    /**
+     * beneficiaryName
+     */
+    private String swiftCode;
+
+    /**
+     * beneficiaryAccountNumber
+     */
+    private String beneficiaryAccountNumber;
+
+    /**
      * 版本号
      */
     @TableField(fill = FieldFill.INSERT)

+ 1 - 0
hx-sale/src/main/java/com/fjhx/sale/flow/PurchaseFlow.java

@@ -61,6 +61,7 @@ public class PurchaseFlow extends FlowDelegate {
         Purchase purchase = submitData.toJavaObject(Purchase.class);
         purchase.setCode(CodeEnum.PURCHASE.getCode());
         purchase.setPurchaseStatus(PurchaseStatusEnum.UNDER_REVIEW.getKey());
+        purchase.setFlowId(flowId);
         purchaseService.save(purchase);
         List<PurchaseDetail> purchaseDetailList = purchase.getPurchaseDetailList();
         if(CollectionUtils.isNotEmpty(purchaseDetailList)){

+ 16 - 0
hx-sale/src/main/java/com/fjhx/sale/flow/PurchaseFlowByWdly.java

@@ -74,11 +74,27 @@ public class PurchaseFlowByWdly extends FlowDelegate {
             Purchase purchase = submitData.toJavaObject(Purchase.class);
             purchase.setCode(CodeEnum.PURCHASE.getCode());
             purchase.setPurchaseStatus(PurchaseStatusEnum.UNDER_REVIEW.getKey());
+            purchase.setProcessInstanceId("wdly_purchase");
+            purchase.setFlowId(flowId);
             purchaseService.save(purchase);
             List<PurchaseDetail> purchaseDetailList = purchase.getPurchaseDetailList();
             if (CollectionUtils.isNotEmpty(purchaseDetailList)) {
                 for (PurchaseDetail s : purchaseDetailList) {
                     s.setPurchaseId(purchase.getId());
+                    //计算采购数量是否大于申购数量
+                    List<PurchaseDetail> purchaseDetailList1 = purchaseDetailService.list(q -> q.eq(PurchaseDetail::getSubscribeDetailId,
+                            s.getSubscribeDetailId()));
+                    //求和
+                    BigDecimal purchaseCount = purchaseDetailList1.stream()
+                            .map(PurchaseDetail::getCount)
+                            .reduce(BigDecimal.ZERO, BigDecimal::add);
+                    //计算历史采购数量+本次采购数量之和
+                    BigDecimal count = purchaseCount.add(s.getCount());
+                    //判断采购数量是否大于申购数量
+                    SubscribeDetail subscribeDetail = subscribeDetailService.getById(s.getSubscribeDetailId());
+                    if (count.compareTo(subscribeDetail.getCount()) > 0) {
+                        throw new ServiceException("采购数量不能大于申购数量");
+                    }
                 }
                 purchaseDetailService.saveBatch(purchaseDetailList);
             }

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

@@ -178,7 +178,8 @@ public class StockWaitServiceImpl extends ServiceImpl<StockWaitMapper, StockWait
     @Override
     public void add(StockWaitDto stockWaitDto) {
         //更新已入库数量 根据明细id
-        StockWaitDetails stockWaitDetails = stockWaitDetailsService.getOne(q->q.eq(StockWaitDetails::getStockWaitId,stockWaitDto.getId()));
+        StockWaitDetails stockWaitDetails = stockWaitDetailsService.getOne(q->q.eq(StockWaitDetails::getStockWaitId,stockWaitDto.getId())
+                .or().eq(StockWaitDetails::getId,stockWaitDto.getId()));
         stockWaitDetails.setReceiptQuantity(stockWaitDetails.getReceiptQuantity().add(stockWaitDto.getQuantity()));
         if (stockWaitDetails.getReceiptQuantity().compareTo(stockWaitDetails.getQuantity()) > 0) {
             throw new ServiceException("入库数量+已入库数量不能大于待采购数量");