瀏覽代碼

Merge remote-tracking branch 'origin/master'

24282 2 年之前
父節點
當前提交
46f70f5f73

+ 41 - 0
hx-customer/src/main/java/com/fjhx/customer/controller/customer/CustomerTopController.java

@@ -0,0 +1,41 @@
+package com.fjhx.customer.controller.customer;
+
+import org.springframework.web.bind.annotation.*;
+import com.fjhx.customer.entity.customer.dto.CustomerTopDto;
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import com.fjhx.customer.service.customer.CustomerTopService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+/**
+ * <p>
+ * 客户置顶表 前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2023-05-09
+ */
+@RestController
+@RequestMapping("/customerTop")
+public class CustomerTopController {
+
+    @Autowired
+    private CustomerTopService customerTopService;
+
+    /**
+     * 客户置顶表新增
+     */
+    @PostMapping("/add")
+    public void add(@RequestBody CustomerTopDto customerTopDto) {
+        customerTopService.add(customerTopDto);
+    }
+
+    /**
+     * 客户置顶表删除
+     */
+    @PostMapping("/delete")
+    public void delete(@RequestBody CustomerTopDto dto) {
+        customerTopService.delete(dto.getCustomerId());
+    }
+
+}

+ 17 - 0
hx-customer/src/main/java/com/fjhx/customer/entity/customer/dto/CustomerTopDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.customer.entity.customer.dto;
+
+import com.fjhx.customer.entity.customer.po.CustomerTop;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 客户置顶表新增编辑入参实体
+ *
+ * @author 
+ * @since 2023-05-09
+ */
+@Getter
+@Setter
+public class CustomerTopDto extends CustomerTop {
+
+}

+ 17 - 0
hx-customer/src/main/java/com/fjhx/customer/entity/customer/dto/CustomerTopSelectDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.customer.entity.customer.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 客户置顶表列表查询入参实体
+ *
+ * @author 
+ * @since 2023-05-09
+ */
+@Getter
+@Setter
+public class CustomerTopSelectDto extends BaseSelectDto {
+
+}

+ 32 - 0
hx-customer/src/main/java/com/fjhx/customer/entity/customer/po/CustomerTop.java

@@ -0,0 +1,32 @@
+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 lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 客户置顶表
+ * </p>
+ *
+ * @author 
+ * @since 2023-05-09
+ */
+@Getter
+@Setter
+@TableName("customer_top")
+public class CustomerTop extends BasePo {
+
+    /**
+     * 用户id
+     */
+    private Long userId;
+
+    /**
+     * 客户id
+     */
+    private Long customerId;
+
+}

+ 17 - 0
hx-customer/src/main/java/com/fjhx/customer/entity/customer/vo/CustomerTopVo.java

@@ -0,0 +1,17 @@
+package com.fjhx.customer.entity.customer.vo;
+
+import com.fjhx.customer.entity.customer.po.CustomerTop;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 客户置顶表列表查询返回值实体
+ *
+ * @author 
+ * @since 2023-05-09
+ */
+@Getter
+@Setter
+public class CustomerTopVo extends CustomerTop {
+
+}

+ 4 - 0
hx-customer/src/main/java/com/fjhx/customer/entity/customer/vo/CustomerVo.java

@@ -48,5 +48,9 @@ public class CustomerVo extends Customer implements ISetAreaName {
      */
     private List<CustomerFollowRecords> customerFollowRecordsList;
 
+    /**
+     * 是否置顶
+     */
+    private Integer isTop;
 
 }

+ 1 - 1
hx-customer/src/main/java/com/fjhx/customer/mapper/customer/CustomerMapper.java

@@ -30,7 +30,7 @@ public interface CustomerMapper extends BaseMapper<Customer> {
     /**
      * 客户表分页
      */
-    Page<CustomerVo> getPage(@Param("page") Page<Object> page, @Param("ew")LambdaQueryWrapper<Customer> wrapper);
+    Page<CustomerVo> getPage(@Param("page") Page<Object> page, @Param("ew")IWrapper<CustomerVo> wrapper);
 
 
     /**

+ 17 - 0
hx-customer/src/main/java/com/fjhx/customer/mapper/customer/CustomerTopMapper.java

@@ -0,0 +1,17 @@
+package com.fjhx.customer.mapper.customer;
+
+import com.fjhx.customer.entity.customer.po.CustomerTop;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+
+/**
+ * <p>
+ * 客户置顶表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2023-05-09
+ */
+public interface CustomerTopMapper extends BaseMapper<CustomerTop> {
+
+}

+ 28 - 0
hx-customer/src/main/java/com/fjhx/customer/service/customer/CustomerTopService.java

@@ -0,0 +1,28 @@
+package com.fjhx.customer.service.customer;
+
+import com.fjhx.customer.entity.customer.po.CustomerTop;
+import com.ruoyi.common.core.service.BaseService;
+import com.fjhx.customer.entity.customer.dto.CustomerTopDto;
+
+
+/**
+ * <p>
+ * 客户置顶表 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2023-05-09
+ */
+public interface CustomerTopService extends BaseService<CustomerTop> {
+
+    /**
+     * 客户置顶表新增
+     */
+    void add(CustomerTopDto customerTopDto);
+
+    /**
+     * 客户置顶表删除
+     */
+    void delete(Long id);
+
+}

+ 46 - 9
hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerServiceImpl.java

@@ -2,7 +2,6 @@ package com.fjhx.customer.service.customer.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,15 +11,19 @@ import com.fjhx.customer.entity.customer.dto.CustomerDto;
 import com.fjhx.customer.entity.customer.dto.CustomerSelectDto;
 import com.fjhx.customer.entity.customer.po.Customer;
 import com.fjhx.customer.entity.customer.po.CustomerFollowRecords;
+import com.fjhx.customer.entity.customer.po.CustomerTop;
 import com.fjhx.customer.entity.customer.po.CustomerUser;
 import com.fjhx.customer.entity.customer.vo.CustomerVo;
 import com.fjhx.customer.mapper.customer.CustomerMapper;
 import com.fjhx.customer.service.customer.CustomerFollowRecordsService;
 import com.fjhx.customer.service.customer.CustomerService;
+import com.fjhx.customer.service.customer.CustomerTopService;
 import com.fjhx.customer.service.customer.CustomerUserService;
 import com.fjhx.customer.utils.code.CodeEnum;
 import com.obs.services.internal.ServiceException;
 import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.wrapper.IWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -41,6 +44,8 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
     private CustomerUserService customerUserService;
     @Autowired
     private CustomerFollowRecordsService customerFollowRecordsService;
+    @Autowired
+    private CustomerTopService customerTopService;
 
 
     /**
@@ -51,23 +56,34 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
      */
     @Override
     public Page<CustomerVo> getPage(CustomerSelectDto dto) {
-        LambdaQueryWrapper<Customer> wrapper = Wrappers.<Customer>lambdaQuery();
-        wrapper.eq(ObjectUtil.isNotEmpty(dto.getSource()), Customer::getSource, dto.getSource());
-        wrapper.eq(ObjectUtil.isNotEmpty(dto.getStatus()), Customer::getStatus, dto.getStatus());
+//        LambdaQueryWrapper<Customer> wrapper = Wrappers.<Customer>lambdaQuery();
+        IWrapper<CustomerVo> wrapper = IWrapper.getWrapper();
+        wrapper.eq("c", Customer::getSource, dto.getSource());
+        wrapper.eq(Customer::getStatus, dto.getStatus());
         //客户状态(0:公海客户  1:私海客户)(业务员ID为null为公海客户,业务员ID不为null为私海客户)
         if (ObjectUtil.isNotEmpty(dto.getType())) {
             //私海客户查询
             if (dto.getType().equals("1")) {
-                wrapper.isNotNull(Customer::getUserId);
+                wrapper.isNotNull("c.user_id");
             } else if (dto.getType().equals("0")) {
-                wrapper.and(wrapper1 -> wrapper1.isNull(Customer::getUserId).or().eq(Customer::getUserId, ""));
+                wrapper.and(wrapper1 -> wrapper1.isNull("c.user_id").or().eq(Customer::getUserId, ""));
             }
         }
         if (ObjectUtil.isNotEmpty(dto.getKeyword())) {
             //查询客户名称或者客户编码
             wrapper.and(wrapper1 -> wrapper1.like(Customer::getName, dto.getKeyword()).or().eq(Customer::getCode, dto.getKeyword()));
         }
+
+        //置顶条件
+        List<Long> customerIds = customerTopService.listObject(CustomerTop::getCustomerId, q -> q.eq(CustomerTop::getUserId,
+                SecurityUtils.getUserId()));
+        if (ObjectUtil.isNotEmpty(customerIds)) {
+            String join = StringUtils.join(customerIds, ",");
+            wrapper.orderByDesc("id IN ( " + join + " )");
+        }
+
         wrapper.orderByDesc(Customer::getCreateTime);
+
         Page<CustomerVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
 
         //复制城市信息
@@ -81,6 +97,11 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
             record.setCustomerFollowRecordsList(customerFollowRecordsList);
         }
 
+        //赋值是否置顶
+        for (CustomerVo record : records) {
+            record.setIsTop(customerIds.contains(record.getId()) ? 1 : 0);
+        }
+
         return page;
     }
 
@@ -155,15 +176,25 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
      */
     @Override
     public Page<CustomerVo> privateSeaPage(CustomerSelectDto dto) {
-        LambdaQueryWrapper<Customer> wrapper = Wrappers.<Customer>lambdaQuery();
-        wrapper.eq(ObjectUtil.isNotEmpty(dto.getSource()), Customer::getSource, dto.getSource());
-        wrapper.eq(ObjectUtil.isNotEmpty(dto.getStatus()), Customer::getStatus, dto.getStatus());
+//        LambdaQueryWrapper<Customer> wrapper = Wrappers.<Customer>lambdaQuery();
+        IWrapper<CustomerVo> wrapper = IWrapper.getWrapper();
+        wrapper.eq("c", Customer::getSource, dto.getSource());
+        wrapper.eq("c", Customer::getStatus, dto.getStatus());
         if (ObjectUtil.isNotEmpty(dto.getKeyword())) {
             //查询客户名称或者客户编码
             wrapper.and(wrapper1 -> wrapper1.like(Customer::getName, dto.getKeyword()).or().eq(Customer::getCode, dto.getKeyword()));
         }
         //添加权限(自己看自己)
         wrapper.eq(Customer::getUserId, SecurityUtils.getUserId());
+
+        //置顶条件
+        List<Long> customerIds = customerTopService.listObject(CustomerTop::getCustomerId, q -> q.eq(CustomerTop::getUserId,
+                SecurityUtils.getUserId()));
+        if (ObjectUtil.isNotEmpty(customerIds)) {
+            String join = StringUtils.join(customerIds, ",");
+            wrapper.orderByDesc("id IN ( " + join + " )");
+        }
+
         wrapper.orderByDesc(Customer::getCreateTime);
         Page<CustomerVo> page = baseMapper.getPage(dto.getPage(), wrapper);
         //复制城市信息
@@ -176,6 +207,12 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
                             .orderByDesc(CustomerFollowRecords::getDate).last("limit 3"));
             record.setCustomerFollowRecordsList(customerFollowRecordsList);
         }
+
+        //赋值是否置顶
+        for (CustomerVo record : records) {
+            record.setIsTop(customerIds.contains(record.getId()) ? 1 : 0);
+        }
+
         return page;
     }
 

+ 35 - 0
hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerTopServiceImpl.java

@@ -0,0 +1,35 @@
+package com.fjhx.customer.service.customer.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.customer.entity.customer.dto.CustomerTopDto;
+import com.fjhx.customer.entity.customer.po.CustomerTop;
+import com.fjhx.customer.mapper.customer.CustomerTopMapper;
+import com.fjhx.customer.service.customer.CustomerTopService;
+import com.ruoyi.common.utils.SecurityUtils;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * <p>
+ * 客户置顶表 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-05-09
+ */
+@Service
+public class CustomerTopServiceImpl extends ServiceImpl<CustomerTopMapper, CustomerTop> implements CustomerTopService {
+
+    @Override
+    public void add(CustomerTopDto customerTopDto) {
+        customerTopDto.setUserId(SecurityUtils.getUserId());
+        this.save(customerTopDto);
+    }
+
+    @Override
+    public void delete(Long id) {
+        CustomerTop customerTop = getOne(q -> q.eq(CustomerTop::getUserId, SecurityUtils.getUserId()).eq(CustomerTop::getCustomerId, id));
+        this.removeById(customerTop.getId());
+    }
+
+}

+ 4 - 0
hx-customer/src/main/resources/mapper/customer/CustomerTopMapper.xml

@@ -0,0 +1,4 @@
+<?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.customer.mapper.customer.CustomerTopMapper">
+</mapper>

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

@@ -64,4 +64,9 @@ public class ProductInfoSelectDto extends BaseSelectDto {
      * 10 正序  20 倒序
      */
     private Integer orderBy;
+
+    /**
+     * 客户id
+     */
+    private Long customerId;
 }

+ 4 - 1
hx-item/src/main/java/com/fjhx/item/service/product/impl/ProductInfoServiceImpl.java

@@ -239,8 +239,11 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
                     .or().like("pi", ProductInfo::getCode, dto.getKeyword())//产品编号
                     .or().like("c.name", dto.getKeyword()));//客户名称
         }
+        //根据客户id过滤
+        wrapper.eq("c.id", dto.getCustomerId());
         //根据产品分类id过滤
         wrapper.eq("pi", ProductInfo::getProductClassifyId, dto.getProductClassifyId());
+        wrapper.orderByDesc("pi", ProductInfo::getCreateTime);
 
         Page<ProductInfoVo> page = baseMapper.getCustomerProductList(dto.getPage(), wrapper);
         List<ProductInfoVo> records = page.getRecords();
@@ -435,7 +438,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         // 排除名称重复
         this.nameDuplication(ProductInfo::getName, productInfoDto.getName(), productInfoDto.getId(), "产品名称重复");
         // 排除自定义编码重复
-        this.nameDuplication(ProductInfo::getCustomCode, productInfoDto.getCustomCode(), "产品自定义编码重复");
+        this.nameDuplication(ProductInfo::getCustomCode, productInfoDto.getCustomCode(), productInfoDto.getId(), "产品自定义编码重复");
         this.updateById(productInfoDto);
         ObsFileUtil.editFile(productInfoDto.getFileList(), productInfoDto.getId());
     }

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

@@ -277,6 +277,7 @@ public class StockWaitServiceImpl extends ServiceImpl<StockWaitMapper, StockWait
 
         //创建出入库记录
         StockJournal stockJournal = new StockJournal();
+        stockJournal.setOpType(stockWaitDto.getType() == 1 ? 1 : 2);
         stockJournal.setType(stockWaitDto.getType() == 1 ? 4 : 5);
         stockJournal.setCode(stockWait.getType() == 1 ? CodeEnum.SIN_CODE.getCode() : CodeEnum.SOUT_CODE.getCode());
         stockJournal.setWarehouseId(stockWaitDto.getWarehouseId());