Browse Source

经销商自动上线

njs 2 years ago
parent
commit
306d1b1ab7

+ 10 - 3
suishenbang-admin/src/test/java/com/qxp/myTest.java

@@ -1,3 +1,4 @@
+/*
 package com.qxp;
 
 import com.dgtly.DgtlyApplication;
@@ -11,26 +12,31 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 import java.util.*;
 
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes=DgtlyApplication.class)
+
 public class myTest {
 
 
 
     @Test
     public void test(){
+        Calendar calendar = Calendar.getInstance();
+        //昨日
+        calendar.add(Calendar.DATE,-1);
+        System.out.println(calendar.getTime());
         String CustomerManager="0,1,2,3";
         String[] manager = CustomerManager.split(",");
         List<String> resultList = new ArrayList<>(manager.length);
 
         Collections.addAll(resultList,manager);
         //List<String> resultList = new ArrayList<>(manager.length);
+*/
 /*
         for (String s : manager) {
 
             resultList.add(s);
 
-        }*/
+        }*//*
+
         int i=2;
         Object x=i;
         resultList.remove(x.toString());
@@ -40,3 +46,4 @@ public class myTest {
     }
 
 }
+*/

+ 18 - 0
suishenbang-quartz/src/main/java/com/dgtly/quartz/task/RyTask.java

@@ -111,7 +111,25 @@ public class RyTask
         sysUserOrderAuthorService.unionCustomerUser();
     }
 
+    /**
+     * @description: 无tms工厂的交货单更新状态和订单
+     * @param: []
+     * @return: void
+     * @author: njs
+     * @date: 2023/2/23 13:16
+     */
     public void tmsPlantByOrder(){
         sysUserOrderAuthorService.tmsPlantByOrder();
     }
+
+    /**
+     * @description: 经销商自动上线
+     * @param:
+     * @return:
+     * @author: njs
+     * @date: 2023/2/23 13:16
+     */
+    public void customersStart(){
+        sysUserOrderAuthorService.customersStart();
+    }
 }

+ 96 - 0
suishenbang-system/src/main/java/com/dgtly/system/domain/CustomersVo.java

@@ -0,0 +1,96 @@
+package com.dgtly.system.domain;
+
+import com.dgtly.common.annotation.Excel;
+import com.dgtly.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.util.Date;
+
+/**
+ * 经销商启用对象 customers_start
+ * 
+ * @author nsy
+ * @date 2021-01-18
+ */
+public class CustomersVo extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 经销商编号 */
+    @Excel(name = "经销商编号")
+    private String customersCode;
+
+    /** 经销商名称 */
+    @Excel(name = "经销商名称")
+    private String customersName;
+
+    /** 经销商名称 */
+    @Excel(name = "上线日期")
+    private Date onlineTime;
+
+    /** 上线事业部 DIY/厨卫/ALL*/
+    private Integer customerType;
+
+    @Excel(name = "上线事业部")
+    private String customerTypeFormat;
+
+    public void setCustomersCode(String customersCode) 
+    {
+        this.customersCode = customersCode;
+    }
+
+    public String getCustomersCode() 
+    {
+        return customersCode;
+    }
+    public void setCustomersName(String customersName) 
+    {
+        this.customersName = customersName;
+    }
+
+    public String getCustomersName() 
+    {
+        return customersName;
+    }
+
+    public Date getOnlineTime() {
+        return onlineTime;
+    }
+
+    public void setOnlineTime(Date onlineTime) {
+        this.onlineTime = onlineTime;
+    }
+
+    public Integer getCustomerType() {
+        return customerType;
+    }
+
+    public void setCustomerType(Integer customerType) {
+        this.customerType = customerType;
+    }
+
+    public String getCustomerTypeFormat() {
+        return customerTypeFormat;
+    }
+
+    public void setCustomerTypeFormat() {
+        if (customerType != null && customerType == 1) {
+            this.customerTypeFormat = "DIY";
+        } else if (customerType != null && customerType == 2) {
+            this.customerTypeFormat = "厨卫";
+        } else if (customerType != null && customerType == 3) {
+            this.customerTypeFormat = "DIY+厨卫";
+        } else {
+            this.customerTypeFormat = "";
+        }
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("customersCode", getCustomersCode())
+            .append("customersName", getCustomersName())
+            .toString();
+    }
+}

+ 13 - 0
suishenbang-system/src/main/java/com/dgtly/system/domain/DataMasterCustomerVO.java

@@ -0,0 +1,13 @@
+package com.dgtly.system.domain;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class DataMasterCustomerVO implements Serializable {
+
+    private String CustomerCode;
+
+    private String CustomerName;
+}

+ 11 - 0
suishenbang-system/src/main/java/com/dgtly/system/mapper/CustomerMapper.java

@@ -2,6 +2,8 @@ package com.dgtly.system.mapper;
 
 
 import com.dgtly.system.domain.Customer;
+import com.dgtly.system.domain.CustomersVo;
+import com.dgtly.system.domain.DataMasterCustomerVO;
 import org.apache.ibatis.annotations.MapKey;
 
 import java.util.List;
@@ -71,4 +73,13 @@ public interface CustomerMapper
     @MapKey("chainsCode")
     public Map<String, Customer> selectCustomerMapByChainsCode();
 
+   public List<DataMasterCustomerVO> selectCustomerCodeByNotStart();
+
+    /**
+     * 新增经销商启用
+     *
+     * @param customersVo 经销商启用
+     * @return 结果
+     */
+    public int insertCustomersStart(CustomersVo customersVo);
 }

+ 9 - 0
suishenbang-system/src/main/java/com/dgtly/system/service/ISysUserOrderAuthorService.java

@@ -106,5 +106,14 @@ public interface ISysUserOrderAuthorService
      * 无tms工厂的交货单更新状态和订单
      */
     void tmsPlantByOrder();
+    
+    /**
+     * @description: 经销商自动上线
+     * @param: []
+     * @return: void
+     * @author: njs     
+     * @date: 2023/2/23 13:28
+     */
+    void customersStart();
 
 }

+ 27 - 0
suishenbang-system/src/main/java/com/dgtly/system/service/impl/SysUserOrderAuthorServiceImpl.java

@@ -711,6 +711,33 @@ public class SysUserOrderAuthorServiceImpl implements ISysUserOrderAuthorService
              /*   for (MetaHanaDeliverOrder deliver : deliverOrderListstatusYes
                 ) {*/
     }
+
+    /**
+     * @description: 经销商自动上线
+     * @param: []
+     * @return: void
+     * @author: njs
+     * @date: 2023/2/23 13:17
+     */
+    @Override
+    public void customersStart() {
+        List<DataMasterCustomerVO> customerVOS = customersMapper.selectCustomerCodeByNotStart();
+        if(customerVOS !=null && customerVOS.size()>0){
+            customerVOS.forEach(customer->{
+                Calendar calendar = Calendar.getInstance();
+                //昨日
+                calendar.add(Calendar.DATE,-1);
+                CustomersVo customersStart=new CustomersVo();
+                customersStart.setCustomersCode(customer.getCustomerCode());
+                customersStart.setCustomersName(customer.getCustomerName());
+                customersStart.setOnlineTime(calendar.getTime());
+                //all
+                customersStart.setCustomerType(3);
+                customersMapper.insertCustomersStart(customersStart);
+            });
+        }
+    }
+
     public Set<String> getConfigValueSet(String dictType){
             Set<String> res = new HashSet<>();
             List<SysDictData> dictDatas = sysDictDataService.selectSimpleDictDataByType(dictType);

+ 32 - 0
suishenbang-system/src/main/resources/mapper/system/CustomerMapper.xml

@@ -141,4 +141,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where chains_code = #{chainsCode} limit 1
     </select>
     
+    <select id="selectCustomerCodeByNotStart" resultType="com.dgtly.system.domain.DataMasterCustomerVO">
+        SELECT DISTINCT
+            CustomerCode,
+            CustomerName
+        FROM
+            data_master_customer
+        WHERE
+            1 = 1
+          AND CustomerTypeCode5 = 'SSB'
+          AND CustomerCode NOT IN (
+            SELECT
+                customers_code
+            FROM
+                customers_start)
+    </select>
+
+    <insert id="insertCustomersStart" >
+        insert into customers_start
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="customersCode != null  and customersCode != ''">customers_code,</if>
+            <if test="customersName != null  and customersName != ''">customers_name,</if>
+            <if test="onlineTime != null">online_time,</if>
+            <if test="customerType !=null and customerType !='' ">customer_type,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="customersCode != null  and customersCode != ''">#{customersCode},</if>
+            <if test="customersName != null  and customersName != ''">#{customersName},</if>
+            <if test="onlineTime != null">#{onlineTime},</if>
+            <if test="customerType !=null and customerType != '' ">#{customerType},</if>
+        </trim>
+    </insert>
+    
 </mapper>