소스 검색

特殊关联经销商后台维护进经销商表

njs 3 년 전
부모
커밋
0c111374e7

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

@@ -86,4 +86,12 @@ public class RyTask
     public void quitUser()throws Exception {
         sysUserOrderAuthorService.quitUser();
     }
+
+    /**
+     *
+     * 维护经销商表
+     * **/
+    public void updateCustomers()throws Exception {
+        sysUserOrderAuthorService.updateCustomers();
+    }
 }

+ 210 - 0
suishenbang-system/src/main/java/com/dgtly/system/domain/Customer.java

@@ -0,0 +1,210 @@
+package com.dgtly.system.domain;
+
+import com.dgtly.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 经销商 对象 customers
+ * 
+ * @author dgtly
+ * @date 2020-08-27
+ */
+public class Customer extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private Long id;
+
+    /** 是否删除 */
+
+    private String isDelete;
+
+    /** 经销商 */
+    private String chainsName;
+
+    /** 经销商代号 */
+    private String chainsCode;
+
+    /** 省份 */
+    private String stateName;
+
+    /** 市 */
+    private String cityName;
+
+    /** 区 */
+    private String districtName;
+
+    /** 用户账号 */
+    private String userAccount;
+
+    /** 用户名称 */
+    private String userName;
+
+    /** 用户号 */
+    private String userNo;
+
+    /** 信用分 */
+    private Long creditScore;
+
+    /** 当前信用分 */
+    private Long currentScore;
+
+    /** $column.columnComment */
+    private String code;
+
+    /** $column.columnComment */
+    private String lineId;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setIsDelete(String isDelete)
+    {
+        this.isDelete = isDelete;
+    }
+
+    public String getIsDelete()
+    {
+        return isDelete;
+    }
+    public void setChainsName(String chainsName) 
+    {
+        this.chainsName = chainsName;
+    }
+
+    public String getChainsName() 
+    {
+        return chainsName;
+    }
+    public void setChainsCode(String chainsCode) 
+    {
+        this.chainsCode = chainsCode;
+    }
+
+    public String getChainsCode() 
+    {
+        return chainsCode;
+    }
+    public void setStateName(String stateName) 
+    {
+        this.stateName = stateName;
+    }
+
+    public String getStateName() 
+    {
+        return stateName;
+    }
+    public void setCityName(String cityName) 
+    {
+        this.cityName = cityName;
+    }
+
+    public String getCityName() 
+    {
+        return cityName;
+    }
+    public void setDistrictName(String districtName) 
+    {
+        this.districtName = districtName;
+    }
+
+    public String getDistrictName() 
+    {
+        return districtName;
+    }
+    public void setUserAccount(String userAccount) 
+    {
+        this.userAccount = userAccount;
+    }
+
+    public String getUserAccount() 
+    {
+        return userAccount;
+    }
+    public void setUserName(String userName) 
+    {
+        this.userName = userName;
+    }
+
+    public String getUserName() 
+    {
+        return userName;
+    }
+    public void setUserNo(String userNo) 
+    {
+        this.userNo = userNo;
+    }
+
+    public String getUserNo() 
+    {
+        return userNo;
+    }
+    public void setCreditScore(Long creditScore) 
+    {
+        this.creditScore = creditScore;
+    }
+
+    public Long getCreditScore() 
+    {
+        return creditScore;
+    }
+    public void setCurrentScore(Long currentScore) 
+    {
+        this.currentScore = currentScore;
+    }
+
+    public Long getCurrentScore() 
+    {
+        return currentScore;
+    }
+    public void setCode(String code) 
+    {
+        this.code = code;
+    }
+
+    public String getCode() 
+    {
+        return code;
+    }
+    public void setLineId(String lineId) 
+    {
+        this.lineId = lineId;
+    }
+
+    public String getLineId() 
+    {
+        return lineId;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("isDelete", getIsDelete())
+            .append("chainsName", getChainsName())
+            .append("chainsCode", getChainsCode())
+            .append("stateName", getStateName())
+            .append("cityName", getCityName())
+            .append("districtName", getDistrictName())
+            .append("userAccount", getUserAccount())
+            .append("userName", getUserName())
+            .append("userNo", getUserNo())
+            .append("creditScore", getCreditScore())
+            .append("currentScore", getCurrentScore())
+            .append("code", getCode())
+            .append("lineId", getLineId())
+            .toString();
+    }
+}

+ 1 - 0
suishenbang-system/src/main/java/com/dgtly/system/mapper/AssRelcustomerinfoMapper.java

@@ -72,4 +72,5 @@ public interface AssRelcustomerinfoMapper
     String selectCustomerName(@Param("customerId") String customerId);
 
     List<AssRelcustomerinfo> selectRelcustomerinfoByKunnr(@Param("kunnr") String kunnr,@Param("userId") String userId);
+    List<AssRelcustomerinfo> selectCustomerNameAndCode();
 }

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

@@ -0,0 +1,74 @@
+package com.dgtly.system.mapper;
+
+
+import com.dgtly.system.domain.Customer;
+import org.apache.ibatis.annotations.MapKey;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 经销商 Mapper接口
+ * 
+ * @author dgtly
+ * @date 2020-08-27
+ */
+public interface CustomerMapper
+{
+    /**
+     * 查询经销商 
+     * 
+     * @param id 经销商 ID
+     * @return 经销商 
+     */
+    public Customer selectCustomersById(Long id);
+
+    public Customer selectCustomersByChainsCode(String chainsCode);
+
+    /**
+     * 查询经销商 列表
+     * 
+     * @param customers 经销商 
+     * @return 经销商 集合
+     */
+    public List<Customer> selectCustomersList(Customer customers);
+
+    /**
+     * 新增经销商 
+     * 
+     * @param customers 经销商 
+     * @return 结果
+     */
+    public int insertCustomers(Customer customers);
+
+    /**
+     * 修改经销商 
+     * 
+     * @param customers 经销商 
+     * @return 结果
+     */
+    public int updateCustomers(Customer customers);
+
+    /**
+     * 删除经销商 
+     * 
+     * @param id 经销商 ID
+     * @return 结果
+     */
+    public int deleteCustomersById(Long id);
+
+    /**
+     * 批量删除经销商 
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteCustomersByIds(String[] ids);
+
+    @MapKey("code")
+    public Map<String, Customer> selectCustomerMapByCode();
+
+    @MapKey("chainsCode")
+    public Map<String, Customer> selectCustomerMapByChainsCode();
+
+}

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

@@ -94,4 +94,6 @@ public interface ISysUserOrderAuthorService
      * 离职用户标识
      * **/
     void quitUser();
+
+    void updateCustomers();
 }

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

@@ -2,7 +2,6 @@ package com.dgtly.system.service.impl;
 
 import java.util.*;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 import com.dgtly.common.core.domain.Ztree;
 import com.dgtly.common.utils.DateUtils;
@@ -16,8 +15,6 @@ import com.dgtly.system.service.ISysUserOrderAuthorService;
 import com.dgtly.common.core.text.Convert;
 import org.springframework.transaction.annotation.Transactional;
 
-import static java.util.stream.Collectors.toList;
-
 /**
  * 权限Service业务层处理
  * 
@@ -40,6 +37,10 @@ public class SysUserOrderAuthorServiceImpl implements ISysUserOrderAuthorService
     private SysUserMapper userMapper;
     @Autowired
     private SysUserQuitMapper userQuitMapper;
+    @Autowired
+    private AssRelcustomerinfoMapper relcustomerinfoMapper;
+    @Autowired
+    private CustomerMapper customersMapper;
 
     /**
      * 查询权限
@@ -368,5 +369,28 @@ public class SysUserOrderAuthorServiceImpl implements ISysUserOrderAuthorService
 
     }
 
+    @Override
+    public void updateCustomers() {
+            List<AssRelcustomerinfo> list=relcustomerinfoMapper.selectCustomerNameAndCode();
+            List<Customer> customersList=new ArrayList<>();
+            if(list != null && list.size()>0){
+                for (AssRelcustomerinfo info:list
+                     ) {
+                   Customer customers= customersMapper.selectCustomersByChainsCode(info.getMainkunnr());
+                   if(customers==null){
+                       Customer customer=new Customer();
+                       customer.setChainsName(info.getMainname1());
+                       customer.setChainsCode(info.getMainkunnr());
+                       customer.setIsDelete("0");
+                       customer.setCreateTime(DateUtils.getNowDate());
+                       customersList.add(customer);
+                   }
+                }
+                customersList.forEach(customers ->{
+                    customersMapper.insertCustomers(customers);
+                } );
+            }
+    }
+
 }
 

+ 4 - 0
suishenbang-system/src/main/resources/mapper/system/AssRelcustomerinfoMapper.xml

@@ -202,4 +202,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             and customer_id=#{customerId}
         </if> LIMIT 1
     </select>
+    <select id="selectCustomerNameAndCode" resultMap="AssRelcustomerinfoResult">
+        select  mainkunnr as mainkunnr,mainname1 as mainname1 FROM `ass_relcustomerinfo`
+        UNION select  kunnr as mainkunnr,name1 as mainname1 FROM `ass_relcustomerinfo`
+    </select>
 </mapper>

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

@@ -0,0 +1,145 @@
+<?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.dgtly.system.mapper.CustomerMapper">
+    
+    <resultMap type="Customer" id="CustomersResult">
+        <result property="id"    column="id"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="isDelete"    column="is_delete"    />
+        <result property="chainsName"    column="chains_name"    />
+        <result property="chainsCode"    column="chains_code"    />
+        <result property="stateName"    column="state_name"    />
+        <result property="cityName"    column="city_name"    />
+        <result property="districtName"    column="district_name"    />
+        <result property="userAccount"    column="user_account"    />
+        <result property="userName"    column="user_name"    />
+        <result property="userNo"    column="user_no"    />
+        <result property="creditScore"    column="credit_score"    />
+        <result property="currentScore"    column="current_score"    />
+        <result property="code"    column="code"    />
+        <result property="lineId"    column="line_id"    />
+    </resultMap>
+
+    <sql id="selectCustomersVo">
+        select id, create_by, create_time, update_by, update_time, is_delete, chains_name, chains_code, state_name, city_name, district_name, user_account, user_name, user_no, credit_score, current_score, code, line_id from customers
+    </sql>
+
+    <select id="selectCustomersList" parameterType="Customers" resultMap="CustomersResult">
+        <include refid="selectCustomersVo"/>
+        <where>  
+            <if test="isDelete != null "> and is_delete = #{isDelete}</if>
+            <if test="chainsName != null  and chainsName != ''"> and chains_name like concat('%', #{chainsName}, '%')</if>
+            <if test="chainsCode != null  and chainsCode != ''"> and chains_code = #{chainsCode}</if>
+            <if test="stateName != null  and stateName != ''"> and state_name like concat('%', #{stateName}, '%')</if>
+            <if test="cityName != null  and cityName != ''"> and city_name like concat('%', #{cityName}, '%')</if>
+            <if test="districtName != null  and districtName != ''"> and district_name like concat('%', #{districtName}, '%')</if>
+            <if test="userAccount != null  and userAccount != ''"> and user_account = #{userAccount}</if>
+            <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
+            <if test="userNo != null  and userNo != ''"> and user_no = #{userNo}</if>
+            <if test="creditScore != null "> and credit_score = #{creditScore}</if>
+            <if test="currentScore != null "> and current_score = #{currentScore}</if>
+            <if test="code != null  and code != ''"> and code = #{code}</if>
+            <if test="lineId != null  and lineId != ''"> and line_id = #{lineId}</if>
+        </where>
+    </select>
+    
+    <select id="selectCustomersById" parameterType="Long" resultMap="CustomersResult">
+        <include refid="selectCustomersVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertCustomers" parameterType="Customers" useGeneratedKeys="true" keyProperty="id">
+        insert into customers
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="createBy != null  and createBy != ''">create_by,</if>
+            <if test="createTime != null ">create_time,</if>
+            <if test="updateBy != null  and updateBy != ''">update_by,</if>
+            <if test="updateTime != null ">update_time,</if>
+            <if test="isDelete != null ">is_delete,</if>
+            <if test="chainsName != null  and chainsName != ''">chains_name,</if>
+            <if test="chainsCode != null  and chainsCode != ''">chains_code,</if>
+            <if test="stateName != null  and stateName != ''">state_name,</if>
+            <if test="cityName != null  and cityName != ''">city_name,</if>
+            <if test="districtName != null  and districtName != ''">district_name,</if>
+            <if test="userAccount != null  and userAccount != ''">user_account,</if>
+            <if test="userName != null  and userName != ''">user_name,</if>
+            <if test="userNo != null  and userNo != ''">user_no,</if>
+            <if test="creditScore != null ">credit_score,</if>
+            <if test="currentScore != null ">current_score,</if>
+           s
+            <if test="lineId != null  and lineId != ''">line_id,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="createBy != null  and createBy != ''">#{createBy},</if>
+            <if test="createTime != null ">#{createTime},</if>
+            <if test="updateBy != null  and updateBy != ''">#{updateBy},</if>
+            <if test="updateTime != null ">#{updateTime},</if>
+            <if test="isDelete != null ">#{isDelete},</if>
+            <if test="chainsName != null  and chainsName != ''">#{chainsName},</if>
+            <if test="chainsCode != null  and chainsCode != ''">#{chainsCode},</if>
+            <if test="stateName != null  and stateName != ''">#{stateName},</if>
+            <if test="cityName != null  and cityName != ''">#{cityName},</if>
+            <if test="districtName != null  and districtName != ''">#{districtName},</if>
+            <if test="userAccount != null  and userAccount != ''">#{userAccount},</if>
+            <if test="userName != null  and userName != ''">#{userName},</if>
+            <if test="userNo != null  and userNo != ''">#{userNo},</if>
+            <if test="creditScore != null ">#{creditScore},</if>
+            <if test="currentScore != null ">#{currentScore},</if>
+            <if test="code != null  and code != ''">#{code},</if>
+            <if test="lineId != null  and lineId != ''">#{lineId},</if>
+         </trim>
+    </insert>
+
+    <update id="updateCustomers" parameterType="Customers">
+        update customers
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="createBy != null  and createBy != ''">create_by = #{createBy},</if>
+            <if test="createTime != null ">create_time = #{createTime},</if>
+            <if test="updateBy != null  and updateBy != ''">update_by = #{updateBy},</if>
+            <if test="updateTime != null ">update_time = #{updateTime},</if>
+            <if test="isDelete != null ">is_delete = #{isDelete},</if>
+            <if test="chainsName != null  and chainsName != ''">chains_name = #{chainsName},</if>
+            <if test="chainsCode != null  and chainsCode != ''">chains_code = #{chainsCode},</if>
+            <if test="stateName != null  and stateName != ''">state_name = #{stateName},</if>
+            <if test="cityName != null  and cityName != ''">city_name = #{cityName},</if>
+            <if test="districtName != null  and districtName != ''">district_name = #{districtName},</if>
+            <if test="userAccount != null  and userAccount != ''">user_account = #{userAccount},</if>
+            <if test="userName != null  and userName != ''">user_name = #{userName},</if>
+            <if test="userNo != null  and userNo != ''">user_no = #{userNo},</if>
+            <if test="creditScore != null ">credit_score = #{creditScore},</if>
+            <if test="currentScore != null ">current_score = #{currentScore},</if>
+            <if test="code != null  and code != ''">code = #{code},</if>
+            <if test="lineId != null  and lineId != ''">line_id = #{lineId},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteCustomersById" parameterType="Long">
+        delete from customers where id = #{id}
+    </delete>
+
+    <delete id="deleteCustomersByIds" parameterType="String">
+        delete from customers where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="selectCustomerMapByCode" resultMap="CustomersResult">
+       select code ,chains_name,chains_code from customers where code is not null
+    </select>
+    <select id="selectCustomerMapByChainsCode" resultMap="CustomersResult">
+       select chains_code ,chains_name  from customers where chains_code is not null
+    </select>
+
+    <select id="selectCustomersByChainsCode" parameterType="String" resultMap="CustomersResult">
+        <include refid="selectCustomersVo"/>
+        where chains_code = #{chainsCode} limit 1
+    </select>
+    
+</mapper>

suishenbang-wxportal/suishenbang-wxportal-common/src/main/resources/mapper/wxportal/WxBannerMapper.xml → suishenbang-wxportal/suishenbang-wxportal-common/src/main/resources/mapper/wxportal/CustomerMapper.xml