Przeglądaj źródła

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-server-mdm

songyang 1 rok temu
rodzic
commit
b137ff31f9

+ 3 - 0
src/main/java/com/dk/mdm/mapper/common/CommonMapper.xml

@@ -449,6 +449,9 @@
         <if test="skuName != null">
             AND tmgs.sku_name LIKE concat('%',my_ex.likequery(#{skuName}),'%')
         </if>
+        <if test="brandId != null">
+            AND tmgs.brand_id  = #{brandId} ::uuid
+        </if>
     </select>
 
     <!-- 获取商品个数 -->

+ 4 - 0
src/main/java/com/dk/mdm/mapper/ivt/InboundMapper.xml

@@ -471,6 +471,9 @@
         ,tmo.org_name as "orgName"
         ,tms.staff_name as "staffName"
         ,tms1.staff_name as "makeStaffName"
+        ,tmc.cus_name    as "cusName"
+        ,tmc.cus_phone   as "cusPhone"
+        ,tmc.cus_from    as "cusFrom"
         ,tmp.sup_name as "supplierName"
         ,tmw.wh_name as "whName"
         ,tmd.data_value  as into_reason_name
@@ -482,6 +485,7 @@
         Left join dkic_b.t_psi_purchase tpp on tpp.pur_id = tpi.from_id
         Left join dkic_b.t_mst_org tmo on tmo.org_id = tpi.org_id
         Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = tpi.sup_id
+        left join dkic_b.t_mst_customer tmc on tpi.cus_id = tmc.cus_id
         Left join dkic_b.t_mst_staff tms on tms.staff_id = tpi.staff_id
         Left join dkic_b.t_mst_staff tms1 on tms1.staff_id = tpi.make_staff
         Left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = tpi.wh_id

+ 3 - 3
src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.xml

@@ -323,7 +323,7 @@
         SELECT
         <include refid="Base_Column_List"/>
         FROM dkic_b.t_mst_customer
-        WHERE cus_id = #{cusId}
+        WHERE cus_id = #{id} ::uuid
         for update
     </select>
 
@@ -416,7 +416,7 @@
     <update id="updateFollowStaffs">
         update dkic_b.t_mst_customer
         set
-            follow_staffs = null
-        where cus_id = #{id}::uuid
+            follow_staffs = #{followStaffs,typeHandler=UuidListTypeHandler}
+        where cus_id = #{cusId}::uuid
     </update>
 </mapper>

+ 7 - 2
src/main/java/com/dk/mdm/mapper/report/ReportMapper.xml

@@ -29,6 +29,7 @@
         tpi.inv_qty as "invQty",
         tpi.outing_qty as "outingQty",
         tpi.usable_qty as "usableQty",
+        tpi.freeze_qty as "freezeQty",
         tpi.wh_id as "whId",
         tmw.wh_code as "whCode",
         tmw.wh_name as "whName",
@@ -828,6 +829,7 @@
     <!-- 出库明细报表主表 -->
     <select id="getOutboundReport" resultType="java.util.Map">
         SELECT
+        t.out_id as "outId",
         t.out_no as "outNo",
         t.from_no as "fromNo",
         tmo.org_name as "orgName",
@@ -884,7 +886,8 @@
     <!-- 出库明细报表明细 -->
     <select id="getOutboundDetailReport" resultType="java.util.Map">
         select
-        t.out_no as "outNo"
+        t.out_id as "outId"
+        ,t.out_no as "outNo"
         ,t.from_no as "fromNo"
         ,tmo.org_name as "orgName"
         ,tms.staff_name as "staffName"
@@ -966,6 +969,7 @@
     <!-- 入库明细报表主表 -->
     <select id="getInboundlReport" resultType="java.util.Map">
         SELECT
+        t.into_id as "intoId",
         t.into_no as "intoNo",
         t.from_no as "fromNo",
         tmo.org_name as "orgName",
@@ -1025,7 +1029,8 @@
     <!-- 入库明细报表明细 -->
     <select id="getInboundDetailReport" resultType="java.util.Map">
         select
-        t.into_no as "intoNo"
+        t.into_id as "intoId"
+        ,t.into_no as "intoNo"
         ,t.from_no as "fromNo"
         ,tmo.org_name as "orgName"
         ,tms.staff_name as "staffName"

+ 16 - 0
src/main/java/com/dk/mdm/service/ivt/outbound/OutCommon.java

@@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -57,15 +58,29 @@ public class OutCommon {
             // 创建客户,获取编码和主键UuId
             Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.CUSTOMER.getName(), true);
             Customer customer = new Customer();
+            // 增加跟进人,用于权限分配
+            List<String> followStaffs = new ArrayList<>();
+            followStaffs.add(outboundVO.getMakeStaff());
             customer.setCusId(codeMap.get("outId").toString()).setCusCode(codeMap.get("outNote").toString()).setCusName(outboundVO.getCusName())
                     .setCusPhone(outboundVO.getCusPhone()).setAddressArea(outboundVO.getAddressArea()).setAddressName(outboundVO.getAddressName())
                     .setAddressNo(outboundVO.getAddressNo()).setAddressGcj02(outboundVO.getAddressGcj02()).setAddressFull(outboundVO.getAddressFull())
                     .setContactName(outboundVO.getContactName()).setContactPhone(outboundVO.getContactPhone()).setCusFrom(outboundVO.getCusFrom())
                     .setChannelId(outboundVO.getSalesChannel()).setOrgId(outboundVO.getOrgId()).setStaffId(outboundVO.getStaffId())
+                    .setFollowStaffs(followStaffs)
                     .setReportStaff(outboundVO.getMakeStaff()).setSaleStatus(Constant.SaleStatus.CHENGJIAO.getName()).setCpId(outboundVO.getCpId());
             customerMapper.insert(customer);
             outboundVO.setCusId(customer.getCusId());
         }else {
+            // 如果当前跟进人
+            Customer cus = customerMapper.selectByIdForUpdate(outboundVO.getCusId());
+            List<String> followStaffs = cus.getFollowStaffs();
+            if(followStaffs == null ){
+                followStaffs.add(outboundVO.getMakeStaff());
+            }else{
+                if(!followStaffs.contains(outboundVO.getMakeStaff())){
+                    followStaffs.add(outboundVO.getMakeStaff());
+                }
+            }
             //编辑客户
             Customer customer = new Customer();
             customer.setCusName(outboundVO.getCusName()).setCusId(outboundVO.getCusId())
@@ -73,6 +88,7 @@ public class OutCommon {
                     .setAddressNo(outboundVO.getAddressNo()).setAddressGcj02(outboundVO.getAddressGcj02()).setAddressFull(outboundVO.getAddressFull())
                     .setContactName(outboundVO.getContactName()).setContactPhone(outboundVO.getContactPhone()).setCusFrom(outboundVO.getCusFrom())
                     .setChannelId(outboundVO.getSalesChannel()).setOrgId(outboundVO.getOrgId()).setStaffId(outboundVO.getStaffId())
+                    .setFollowStaffs(followStaffs)
                     .setSaleStatus(Constant.SaleStatus.CHENGJIAO.getName());
             customerService.updateByUuid(customer);
         }

+ 0 - 3
src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleOrderService.java

@@ -261,9 +261,6 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
     @Transactional(rollbackFor = {Exception.class})
     public ResponseResultVO<?> saleOrderOutboundInsert(OutboundVO outboundVO) {
         //region 如果没有客户id,要新建
-//        if (outboundVO.getCusId() == null) {
-//
-//        }
         outboundVO = outCommon.insertCustomer(outboundVO);
         //endregion
 

+ 1 - 3
src/main/java/com/dk/mdm/service/mst/CusFollowService.java

@@ -475,10 +475,8 @@ public class CusFollowService extends BaseService<CusFollow> {
         if (cusFollowVO.getSaleStatus() != null && (cusFollowVO.getSaleStatus().equals(Constant.saleCustomerStatusConstant.SALE_STATUS_INTE.getName()) || cusFollowVO.getSaleStatus().equals(Constant.saleCustomerStatusConstant.SALE_STATUS_LOST.getName()))) {
             //公海客户清空跟进人
             if (cusFollowVO.getSaleStatus().equals(Constant.saleCustomerStatusConstant.SALE_STATUS_INTE.getName())) {
-                customerMapper.updateFollowStaffs(new Customer().setCusId(cusFollowVO.getCusId()));
+                customerMapper.updateFollowStaffs(new Customer().setCusId(cusFollowVO.getCusId()).setFollowStaffs(null));
             }
-
-
         }
         if (cusFollowVO.getCusId() != null) {
             Customer customer = new Customer();

+ 23 - 0
src/main/java/com/dk/mdm/service/sale/OrderService.java

@@ -216,14 +216,37 @@ public class OrderService extends BaseService<Order> {
             // 创建客户,获取编码和主键UuId
             Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.CUSTOMER.getName(), true);
             Customer customer = new Customer();
+            // 增加跟进人,用于权限分配
+            List<String> followStaffs = new ArrayList<>();
+            followStaffs.add(orderVO.getMakeStaff());
             customer.setCusId(codeMap.get("outId").toString()).setCusCode(codeMap.get("outNote").toString()).setCusName(orderVO.getCusName())
                     .setCusPhone(orderVO.getCusPhone()).setAddressArea(orderVO.getAddressArea()).setAddressName(orderVO.getAddressName())
                     .setAddressNo(orderVO.getAddressNo()).setAddressGcj02(orderVO.getAddressGcj02()).setAddressFull(orderVO.getAddressFull())
                     .setContactName(orderVO.getContactName()).setContactPhone(orderVO.getContactPhone()).setCusFrom(orderVO.getCusFrom())
                     .setChannelId(orderVO.getSalesChannel()).setOrgId(orderVO.getOrgId()).setStaffId(orderVO.getStaffId())
+                    .setFollowStaffs(followStaffs)
                     .setReportStaff(orderVO.getMakeStaff()).setSaleStatus(Constant.SaleStatus.CHENGJIAO.getName()).setCpId(orderVO.getCpId());
             customerMapper.insert(customer);
             orderVO.setCusId(customer.getCusId());
+        }else{
+            // 如果当前跟进人
+            Customer cus = customerMapper.selectByIdForUpdate(orderVO.getCusId());
+            List<String> followStaffs = cus.getFollowStaffs();
+            Boolean updateFollowFlag = false;
+            if(followStaffs == null ){
+                followStaffs.add(orderVO.getMakeStaff());
+                updateFollowFlag = true;
+            }else{
+                if(!followStaffs.contains(orderVO.getMakeStaff())){
+                    followStaffs.add(orderVO.getMakeStaff());
+                    updateFollowFlag = true;
+                }
+            }
+            if(updateFollowFlag){
+                // 更新当前跟进人
+                customerMapper.updateFollowStaffs(new Customer().setCusId(orderVO.getCusId())
+                                                    .setFollowStaffs(followStaffs));
+            }
         }
 
         // 获取单号