Просмотр исходного кода

开单选择渠道客户开发中

anderx лет назад: 4
Родитель
Сommit
90d3e087d0
29 измененных файлов с 1737 добавлено и 69 удалено
  1. 1 1
      GeneratorConfig.xml
  2. 3 0
      src/main/java/com/goafanti/common/dao/OrganizationContactBookMapper.java
  3. 3 0
      src/main/java/com/goafanti/common/dao/OrganizationIdentityMapper.java
  4. 65 0
      src/main/java/com/goafanti/common/dao/UserChannelMapper.java
  5. 7 0
      src/main/java/com/goafanti/common/dao/UserMapper.java
  6. 3 0
      src/main/java/com/goafanti/common/dao/UserTransferLogMapper.java
  7. 75 0
      src/main/java/com/goafanti/common/enums/SocietyTag.java
  8. 9 0
      src/main/java/com/goafanti/common/mapper/OrganizationContactBookMapper.xml
  9. 9 0
      src/main/java/com/goafanti/common/mapper/OrganizationIdentityMapper.xml
  10. 165 0
      src/main/java/com/goafanti/common/mapper/UserChannelMapper.xml
  11. 6 0
      src/main/java/com/goafanti/common/mapper/UserMapper.xml
  12. 71 1
      src/main/java/com/goafanti/common/mapper/UserMapperExt.xml
  13. 13 0
      src/main/java/com/goafanti/common/mapper/UserTransferLogMapper.xml
  14. 235 0
      src/main/java/com/goafanti/common/model/UserChannel.java
  15. 1 1
      src/main/java/com/goafanti/common/task/ExpiredUserMemberTask.java
  16. 17 5
      src/main/java/com/goafanti/common/utils/ExcelUtils.java
  17. 10 0
      src/main/java/com/goafanti/customer/bo/CustomerListIn.java
  18. 11 0
      src/main/java/com/goafanti/customer/bo/CustomerListOut.java
  19. 56 0
      src/main/java/com/goafanti/customer/bo/InputListChannel.java
  20. 19 0
      src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java
  21. 5 0
      src/main/java/com/goafanti/customer/service/CustomerService.java
  22. 43 1
      src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java
  23. 9 59
      src/main/java/com/goafanti/order/service/impl/OrderReceivablesServiceImpl.java
  24. 111 0
      src/main/java/com/goafanti/user/bo/InputUserChannel.java
  25. 298 0
      src/main/java/com/goafanti/user/bo/OutUserChannel.java
  26. 90 0
      src/main/java/com/goafanti/user/controller/UserChannelApiController.java
  27. 21 0
      src/main/java/com/goafanti/user/service/UserChannelService.java
  28. 380 0
      src/main/java/com/goafanti/user/service/impl/UserChannelServiceImpl.java
  29. 1 1
      src/main/resources/props/config_local.properties

+ 1 - 1
GeneratorConfig.xml

@@ -43,7 +43,7 @@
     <property name="enableSubPackages" value="false"/>
      <property name="nullCatalogMeansCurrent" value="true"/>
     </javaClientGenerator>
-    <table schema="aft" tableName="t_order_task"   enableCountByExample="false"
+    <table schema="aft" tableName="user_channel"   enableCountByExample="false"
                enableUpdateByExample="false"
                enableDeleteByExample="false"
                enableSelectByExample="false"

+ 3 - 0
src/main/java/com/goafanti/common/dao/OrganizationContactBookMapper.java

@@ -2,6 +2,7 @@ package com.goafanti.common.dao;
 
 import com.goafanti.common.model.OrganizationContactBook;
 import com.goafanti.common.model.OrganizationContactBookExample;
+import com.goafanti.user.bo.InputUserChannel;
 
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
@@ -85,4 +86,6 @@ public interface OrganizationContactBookMapper {
 	void updateDimissionTransfer(@Param("aid")String aid, @Param("transferId")String transferId);
 
 	void updateAdmin(@Param("uid")String uid, @Param("aid")String aid);
+
+	void insertBatch(List<InputUserChannel> list);
 }

+ 3 - 0
src/main/java/com/goafanti/common/dao/OrganizationIdentityMapper.java

@@ -3,6 +3,7 @@ package com.goafanti.common.dao;
 import com.goafanti.common.model.OrganizationIdentity;
 import com.goafanti.common.model.OrganizationIdentityExample;
 import com.goafanti.user.bo.AuditorOrgIdentityDetailBo;
+import com.goafanti.user.bo.InputUserChannel;
 import com.goafanti.user.bo.OrgBasicInfoBo;
 import com.goafanti.user.bo.OrgIdentityBo;
 import com.goafanti.user.bo.OrgIdentityDetailBo;
@@ -73,4 +74,6 @@ public interface OrganizationIdentityMapper {
     List<OrgUnitNames> selectAchievementOrgOwner(@Param("aid")String aid, @Param("name")String name);
 
 	int updateServiceByUid(OrganizationIdentity org);
+
+	void insertBatch(List<InputUserChannel> list);
 }

+ 65 - 0
src/main/java/com/goafanti/common/dao/UserChannelMapper.java

@@ -0,0 +1,65 @@
+package com.goafanti.common.dao;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.goafanti.common.model.UserChannel;
+import com.goafanti.user.bo.InputUserChannel;
+import com.goafanti.user.bo.OutUserChannel;
+
+public interface UserChannelMapper {
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table user_channel
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    int deleteByPrimaryKey(Integer id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table user_channel
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    int insert(UserChannel record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table user_channel
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    int insertSelective(UserChannel record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table user_channel
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    UserChannel selectByPrimaryKey(Integer id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table user_channel
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    int updateByPrimaryKeySelective(UserChannel record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table user_channel
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    int updateByPrimaryKey(UserChannel record);
+
+	void insertBatch(List<InputUserChannel> list);
+
+	List<OutUserChannel> selectByAidAndstatus(@Param("aid")String aid, @Param("status")Integer status);
+
+
+}

+ 7 - 0
src/main/java/com/goafanti/common/dao/UserMapper.java

@@ -10,6 +10,7 @@ import com.goafanti.app.bo.UserBasicInfo;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.OrganizationContactBook;
 import com.goafanti.common.model.User;
+import com.goafanti.user.bo.InputUserChannel;
 import com.goafanti.user.bo.OrgPartnerDetailBo;
 import com.goafanti.user.bo.UserDownLoadBo;
 import com.goafanti.user.bo.UserInterestBo;
@@ -278,6 +279,12 @@ public interface UserMapper {
 
 	String checkRoleMax(String aid);
 
+	void insertBatch(List<InputUserChannel> list);
+
+	User selectByName(String userName);
+
+	int updatechannelCustomerDeliver(@Param("list")List<String> list, @Param("aid")String aid);
+
 	
 	
 }

+ 3 - 0
src/main/java/com/goafanti/common/dao/UserTransferLogMapper.java

@@ -3,6 +3,7 @@ package com.goafanti.common.dao;
 import com.goafanti.common.model.UserTransferLog;
 import com.goafanti.common.model.UserTransferLogExample;
 import com.goafanti.customer.bo.transferListBo;
+import com.goafanti.user.bo.InputUserChannel;
 
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
@@ -99,4 +100,6 @@ public interface UserTransferLogMapper {
 	List<transferListBo> selectByUidGetList(String uid);
 
 	void insertList(List<UserTransferLog> utfList);
+
+	void insertBatch(List<InputUserChannel> list);
 }

+ 75 - 0
src/main/java/com/goafanti/common/enums/SocietyTag.java

@@ -0,0 +1,75 @@
+package com.goafanti.common.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+public enum SocietyTag {
+	SHQY(0, "社会企业"), KYDW(1, "科研单位"), 
+	GDWX(2, "高等院校"), KYZJ(3, "科研专家"),
+	KJDR(4, "科技达人"),
+	FWJG(5, "服务机构"), ZFBM(6, "政府部门"), 
+	SH(7, "商会"), XH(8, "协会"),
+	QTZZ(9, "其他组织"),
+	QTGR(10, "其他个人");
+
+	private SocietyTag(Integer code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	private static Map<Integer, SocietyTag> status = new HashMap<Integer, SocietyTag>();
+
+	static {
+		for (SocietyTag value : SocietyTag.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+
+	public static SocietyTag getStatus(Integer code) {
+		if (containsType(code)) {
+			return status.get(code);
+		}
+		return SHQY;
+	}
+	
+	public static String getValueByCode(Integer code){
+        for(SocietyTag societyTag:SocietyTag.values()){
+            if(code.equals(societyTag.getCode())){
+                return societyTag.getDesc();
+            }
+        }
+        return  SHQY.getDesc();
+    }
+	public static Integer getCodeByValue(String  value){
+        for(SocietyTag societyTag:SocietyTag.values()){
+            if(value.equals(societyTag.getDesc())){
+                return societyTag.getCode();
+            }
+        }
+        return  SHQY.getCode();
+    }
+
+	public static SocietyTag getStatus(String code) {
+		if (StringUtils.isNumeric(code)) {
+			return getStatus(Integer.parseInt(code));
+		}
+		return SHQY;
+	}
+
+	public static boolean containsType(Integer code) {
+		return status.containsKey(code);
+	}
+
+	private Integer	code;
+	private String	desc;
+
+	public Integer getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+}

+ 9 - 0
src/main/java/com/goafanti/common/mapper/OrganizationContactBookMapper.xml

@@ -466,4 +466,13 @@
   <update id="updateAdmin">
   	 update organization_contact_book set aid = #{aid,jdbcType=VARCHAR} where uid = #{uid,jdbcType=VARCHAR}
   </update>
+  
+  <insert id="insertBatch" parameterType="com.goafanti.user.bo.InputUserChannel">
+    INSERT INTO organization_contact_book
+		(id, uid, name, mobile,major)VALUES
+      <foreach item="item" index="index" collection="list" separator=",">
+      (UUID(), #{item.uid,jdbcType=VARCHAR}, #{item.userName,jdbcType=VARCHAR}, 
+      #{item.contactMobile,jdbcType=VARCHAR},1)
+    </foreach>
+  </insert>
 </mapper>

+ 9 - 0
src/main/java/com/goafanti/common/mapper/OrganizationIdentityMapper.xml

@@ -1419,4 +1419,13 @@
     </set>
     where uid = #{uid,jdbcType=VARCHAR}
   </update>
+  
+  <insert id="insertBatch" parameterType="com.goafanti.user.bo.InputUserChannel">
+    INSERT INTO organization_identity
+	(id, uid, contacts, contact_mobile,location_province,location_city)VALUES
+      <foreach item="item" index="index" collection="list" separator=",">
+      (UUID(), #{item.uid,jdbcType=VARCHAR}, #{item.contacts,jdbcType=VARCHAR}, 
+      #{item.contactMobile,jdbcType=VARCHAR}, #{item.province,jdbcType=TIMESTAMP}, #{item.city,jdbcType=TIMESTAMP})
+    </foreach>
+  </insert>
 </mapper>

+ 165 - 0
src/main/java/com/goafanti/common/mapper/UserChannelMapper.xml

@@ -0,0 +1,165 @@
+<?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.goafanti.common.dao.UserChannelMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.UserChannel">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Apr 22 09:06:45 CST 2021.
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="uid" jdbcType="VARCHAR" property="uid" />
+    <result column="aid" jdbcType="VARCHAR" property="aid" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="distribution_time" jdbcType="TIMESTAMP" property="distributionTime" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Apr 22 09:06:45 CST 2021.
+    -->
+    id, `uid`, aid, `status`, distribution_time, create_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Apr 22 09:06:45 CST 2021.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from user_channel
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Apr 22 09:06:45 CST 2021.
+    -->
+    delete from user_channel
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.UserChannel">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Apr 22 09:06:45 CST 2021.
+    -->
+    insert into user_channel (id, `uid`, aid, 
+      `status`, distribution_time, create_time
+      )
+    values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, 
+      #{status,jdbcType=INTEGER}, #{distributionTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.UserChannel">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Apr 22 09:06:45 CST 2021.
+    -->
+    insert into user_channel
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="uid != null">
+        `uid`,
+      </if>
+      <if test="aid != null">
+        aid,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="distributionTime != null">
+        distribution_time,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=INTEGER},
+      </if>
+      <if test="uid != null">
+        #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="aid != null">
+        #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="distributionTime != null">
+        #{distributionTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.UserChannel">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Apr 22 09:06:45 CST 2021.
+    -->
+    update user_channel
+    <set>
+      <if test="uid != null">
+        `uid` = #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="aid != null">
+        aid = #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        `status` = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="distributionTime != null">
+        distribution_time = #{distributionTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.UserChannel">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Apr 22 09:06:45 CST 2021.
+    -->
+    update user_channel
+    set `uid` = #{uid,jdbcType=VARCHAR},
+      aid = #{aid,jdbcType=VARCHAR},
+      `status` = #{status,jdbcType=INTEGER},
+      distribution_time = #{distributionTime,jdbcType=TIMESTAMP},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  
+    <insert id="insertBatch" parameterType="com.goafanti.user.bo.InputUserChannel">
+       insert into user_channel ( `uid`, aid, 
+      `status`)VALUES
+      <foreach item="item" index="index" collection="list" separator=",">
+      (#{item.uid,jdbcType=VARCHAR}, #{item.aid,jdbcType=VARCHAR},#{item.status}
+      )
+    </foreach>
+    </insert>
+    
+    <select id="selectByAidAndstatus" resultType="com.goafanti.user.bo.OutUserChannel">
+ 	   select a.id,a.uid,b.nickname userName,a.aid,a.status,date_format(a.distribution_time,'%Y-%m-%d %H:%i:%S')distributionTimes,
+ 	date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimes ,c.contacts ,c.contact_mobile contactMobile,
+ 	b.society_tag societyTag ,d1.name province,d2.name city from user_channel a
+    left join user b on a.uid=b.id  left join organization_identity c on a.uid =c.uid 
+    left join district_glossory d1 on c.location_province =d1.id 
+    left join district_glossory d2 on c.location_city =d2.id
+    where a.aid= #{aid} and a.status =#{status};
+    </select>
+</mapper>

+ 6 - 0
src/main/java/com/goafanti/common/mapper/UserMapper.xml

@@ -1645,5 +1645,11 @@
        #{item}
      </foreach>
   </update>
+  <select id="selectByName" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from user
+    where nickname  = #{name}
+  </select>
   
 </mapper>

+ 71 - 1
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -593,7 +593,7 @@
 		</if>
 	</select>
 	<select id="selectSignOrganizationCustomerList" resultType="com.goafanti.customer.bo.CustomerListOut">
-		select 	
+			select 	
 			a.id as uid,
 			a.society_tag as societyTag,
 			a.identify_name as name,
@@ -603,6 +603,7 @@
 			dg2.name as city, 
 			dg3.name as area,
 			c.name as industry,
+			if(isnull(uc.status),0,1) channel,
 			d.name as adminName
 		from user a 
 		left join organization_identity b on a.id = b.uid
@@ -610,6 +611,7 @@
 		left join district_glossory dg2 on b.location_city = dg2.id
 		left join district_glossory dg3 on b.location_area = dg3.id
 		left join industry_category c on b.industry = c.id
+		left join user_channel uc on a.id=uc.uid 
 		left join admin d on a.aid = d.id where a.share_type =2
 		<if test="aid != null and aid != ''">
 			and a.aid = #{aid}
@@ -2061,4 +2063,72 @@ inner join(
 	update user set share_type =2,sign_bills =1,aid = #{aid}
 	where id= #{uid}
 	</update>
+	
+	<insert id="insertBatch" parameterType="com.goafanti.user.bo.InputUserChannel">
+    INSERT INTO `user` (id, mobile, password, nickname,share_type,type,society_tag)VALUES
+      <foreach item="item" index="index" collection="list" separator=",">
+      (#{item.uid,jdbcType=VARCHAR}, #{item.contactMobile,jdbcType=VARCHAR}, #{item.password,jdbcType=VARCHAR}, 
+      #{item.userName,jdbcType=DECIMAL}, #{item.shareType,jdbcType=TIMESTAMP}, 1,#{item.societyTag})
+    </foreach>
+  </insert>
+  
+  <select id="selectChannelCustomerList" resultType="com.goafanti.user.bo.OutUserChannel">
+   select a.id,a.uid,b.nickname userName,a.aid,a.status,date_format(a.distribution_time,'%Y-%m-%d %H:%i:%S')distributionTimes,
+ 	date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimes ,c.contacts ,c.contact_mobile contactMobile,e.name aName,
+ 	b.society_tag societyTag ,d1.name province,d2.name city from user_channel a
+    left join user b on a.uid=b.id  left join organization_identity c on a.uid =c.uid 
+    left join district_glossory d1 on c.location_province =d1.id 
+    left join district_glossory d2 on c.location_city =d2.id
+    left join admin e on a.aid =e.id
+    where a.status in(0,2)
+    <if test="aid!=null">
+    and a.aid= #{aid}
+    </if>
+    <if test="province !=null">
+    and  c.location_province= #{province}
+    </if>
+    <if test="city!=null">
+    and c.location_city= #{city}
+    </if>
+    <if test="name!=null">
+  and b.nickname like concat('%',#{name},'%')
+  </if>
+  <if test="startTime!=null and endTime !=null">
+ 	and a.create_time between #{startTime} and #{endTime}
+ 	</if>
+ 	<if test="page_sql != null">
+    		${page_sql}
+   		 </if>
+  </select>
+  <select id="selectChannelCustomerCount" resultType="java.lang.Integer">
+   select count(*) from user_channel a
+    left join user b on a.uid=b.id  left join organization_identity c on a.uid =c.uid 
+    left join district_glossory d1 on c.location_province =d1.id 
+    left join district_glossory d2 on c.location_city =d2.id
+    left join admin e on a.aid =e.id
+     where a.status in(0,2)
+    <if test="aid!=null">
+    and a.aid= #{aid}
+    </if>
+    <if test="province !=null">
+    and  c.location_province= #{province}
+    </if>
+    <if test="city!=null">
+    and c.location_city= #{city}
+    </if>
+    <if test="name!=null">
+  and b.nickname like concat('%',#{name},'%')
+  </if>
+  <if test="startTime!=null and endTime !=null">
+ 	and a.create_time between #{startTime} and #{endTime}
+ 	</if>
+  </select>
+  <update id="updatechannelCustomerDeliver">
+  	update user set aid = #{aid}
+	where id in( 
+	<foreach item="item" collection="list" separator="," index="">
+     #{item}
+     </foreach>
+     )
+  </update>
 </mapper>

+ 13 - 0
src/main/java/com/goafanti/common/mapper/UserTransferLogMapper.xml

@@ -336,4 +336,17 @@
       #{item.createTime,jdbcType=TIMESTAMP})
      </foreach>
   </insert>
+  
+     <insert id="insertBatch">
+    insert into user_transfer_log ( uid, aid, 
+      type, 
+      create_time)
+    values 
+    <foreach item="item" collection="list" separator="," index="">
+    ( #{item.uid,jdbcType=VARCHAR}, #{item.aid,jdbcType=VARCHAR}, 
+     1, 
+      #{item.createTime,jdbcType=TIMESTAMP})
+     </foreach>
+  </insert>
+  
 </mapper>

+ 235 - 0
src/main/java/com/goafanti/common/model/UserChannel.java

@@ -0,0 +1,235 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class UserChannel implements Serializable {
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column user_channel.id
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    private Integer id;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column user_channel.uid
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    private String uid;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column user_channel.aid
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    private String aid;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column user_channel.status
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    private Integer status;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column user_channel.distribution_time
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    private Date distributionTime;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column user_channel.create_time
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    private Date createTime;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table user_channel
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column user_channel.id
+     *
+     * @return the value of user_channel.id
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column user_channel.id
+     *
+     * @param id the value for user_channel.id
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column user_channel.uid
+     *
+     * @return the value of user_channel.uid
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public String getUid() {
+        return uid;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column user_channel.uid
+     *
+     * @param uid the value for user_channel.uid
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public void setUid(String uid) {
+        this.uid = uid == null ? null : uid.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column user_channel.aid
+     *
+     * @return the value of user_channel.aid
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public String getAid() {
+        return aid;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column user_channel.aid
+     *
+     * @param aid the value for user_channel.aid
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public void setAid(String aid) {
+        this.aid = aid == null ? null : aid.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column user_channel.status
+     *
+     * @return the value of user_channel.status
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public Integer getStatus() {
+        return status;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column user_channel.status
+     *
+     * @param status the value for user_channel.status
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column user_channel.distribution_time
+     *
+     * @return the value of user_channel.distribution_time
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public Date getDistributionTime() {
+        return distributionTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column user_channel.distribution_time
+     *
+     * @param distributionTime the value for user_channel.distribution_time
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public void setDistributionTime(Date distributionTime) {
+        this.distributionTime = distributionTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column user_channel.create_time
+     *
+     * @return the value of user_channel.create_time
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column user_channel.create_time
+     *
+     * @param createTime the value for user_channel.create_time
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table user_channel
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", uid=").append(uid);
+        sb.append(", aid=").append(aid);
+        sb.append(", status=").append(status);
+        sb.append(", distributionTime=").append(distributionTime);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 1 - 1
src/main/java/com/goafanti/common/task/ExpiredUserMemberTask.java

@@ -17,7 +17,7 @@ public class ExpiredUserMemberTask {
 	/**
 	 * "0 0 1 * * ?" 每天1点触发一次
 	 */
-	@Scheduled(cron = "0 0 1 * * ?")
+//	@Scheduled(cron = "0 0 1 * * ?")
 	public void exprireRun() {
 		LoggerUtils.debug(getClass(), "开始检查会员到期");
 		memberOrderService.updateExpiredUser();

+ 17 - 5
src/main/java/com/goafanti/common/utils/ExcelUtils.java

@@ -15,11 +15,9 @@ import java.util.Set;
 import java.util.regex.Pattern;
 
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.CellType;
-import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.web.multipart.MultipartFile;
 
 import com.goafanti.customer.bo.CustomerExcelBo;
 import com.goafanti.order.bo.OrderReportBo;
@@ -741,7 +739,7 @@ public class ExcelUtils {
      * @param cell
      * @return
      */
-    public String getCellValue(Cell cell) {
+    public static String  getCellValue(Cell cell) {
         String value = "";
         if (cell != null) {
             switch (cell.getCellTypeEnum()) {
@@ -779,5 +777,19 @@ public class ExcelUtils {
     }
 
 	
-	
+    public static Workbook getWorkBook(MultipartFile file) {
+        //创建Workbook工作薄对象,表示整个excel
+        Workbook workbook = null;
+        try {
+        //获取excel文件的io流
+        InputStream is = file.getInputStream();
+        //如果是xls,使用HSSFWorkbook;如果是xlsx,使用XSSFWorkbook
+        if(file.getOriginalFilename().matches("^.+\\.(?i)(xls)$"))workbook = new HSSFWorkbook(is);
+        if(file.getOriginalFilename().matches("^.+\\.(?i)(xlsx)$"))workbook = new XSSFWorkbook(is);
+        } catch (IOException e) {
+        }
+        return workbook;
+        }
+    
+      
 }

+ 10 - 0
src/main/java/com/goafanti/customer/bo/CustomerListIn.java

@@ -67,6 +67,8 @@ public class CustomerListIn {
 	 * 	排序 0否 1转换倒序 2转换正序
 	 */
 	private Integer sort;
+	/** 渠道 0否 1是 */
+	private Integer channel;
 	
 	
 	
@@ -254,4 +256,12 @@ public class CustomerListIn {
 	public void setSort(Integer sort) {
 		this.sort = sort;
 	}
+
+	public Integer getChannel() {
+		return channel;
+	}
+
+	public void setChannel(Integer channel) {
+		this.channel = channel;
+	}
 }

+ 11 - 0
src/main/java/com/goafanti/customer/bo/CustomerListOut.java

@@ -62,6 +62,17 @@ public class CustomerListOut extends CustomerListIn{
 	 */
 	private Integer signBills;
 	
+	/** 渠道 0否 1是 */
+	private Integer channel;
+	
+	public Integer getChannel() {
+		return channel;
+	}
+
+	public void setChannel(Integer channel) {
+		this.channel = channel;
+	}
+
 	public String getAuditOpinion() {
 		return auditOpinion;
 	}

+ 56 - 0
src/main/java/com/goafanti/customer/bo/InputListChannel.java

@@ -0,0 +1,56 @@
+package com.goafanti.customer.bo;
+
+public class InputListChannel {
+
+	private String name ;
+	private Integer province;
+	private Integer city;
+	private String startTime;
+	private String endTime;
+	private Integer pageNo;
+	private Integer pageSize;
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public Integer getProvince() {
+		return province;
+	}
+	public void setProvince(Integer province) {
+		this.province = province;
+	}
+	public Integer getCity() {
+		return city;
+	}
+	public void setCity(Integer city) {
+		this.city = city;
+	}
+	public String getStartTime() {
+		return startTime;
+	}
+	public void setStartTime(String startTime) {
+		this.startTime = startTime;
+	}
+	public String getEndTime() {
+		return endTime;
+	}
+	public void setEndTime(String endTime) {
+		this.endTime = endTime;
+	}
+	public Integer getPageNo() {
+		return pageNo;
+	}
+	public void setPageNo(Integer pageNo) {
+		this.pageNo = pageNo;
+	}
+	public Integer getPageSize() {
+		return pageSize;
+	}
+	public void setPageSize(Integer pageSize) {
+		this.pageSize = pageSize;
+	}
+	
+	
+}

+ 19 - 0
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -49,6 +49,7 @@ import com.goafanti.customer.bo.CustomerListOut;
 import com.goafanti.customer.bo.CustomerOrganizationDetailBo;
 import com.goafanti.customer.bo.CustomerPersonalDetailBo;
 import com.goafanti.customer.bo.FollowBusinessBo;
+import com.goafanti.customer.bo.InputListChannel;
 import com.goafanti.customer.bo.UserDetailBo;
 import com.goafanti.customer.service.CustomerService;
 import com.goafanti.customer.service.impl.AdminOrgAnnualReportServiceImpl;
@@ -124,6 +125,16 @@ public class AdminCustomerApiController extends BaseApiController{
 		return res;
 	}
 	
+	/**
+	 *  渠道客户列表
+	 **/
+	@RequestMapping(value = "/listChannelCustomer" , method = RequestMethod.POST)
+	public Result listChannelCustomer(InputListChannel in){
+		Result res = new Result();
+		res.setData(customerService.listChannelCustomer(in));
+		return res;
+	}
+	
 	/** 跟进管理列表
 	 *  跟进列表
 	 **/
@@ -211,6 +222,13 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.customerHandOver( userIds , receiveId));
 		return res;
 	}
+	/** 渠道客户转交 **/
+	@RequestMapping(value = "/channelCustomerDeliver", method = RequestMethod.POST)
+	public Result channelCustomerDeliver(String userIds ,String receiveId,String remarks){
+		Result res = new Result();
+		res.setData(customerService.pushChannelDeliver( userIds , receiveId,remarks));
+		return res;
+	}
 	
 	/** 客户即时检索 **/
 	@RequestMapping(value = "/findCustomerByName",method = RequestMethod.GET)
@@ -231,6 +249,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		if(name.length()<2) return res;
 		if(type == 0) res.setData(customerService.getPrivateCustomerByName(name));
 		if(type == 1) res.setData(customerService.getSignedCustomerByName(name));
+		if(type == 3) res.setData(customerService.getChannelCustomerByName(name));
 		return res;
 	}
 	

+ 5 - 0
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -24,9 +24,11 @@ import com.goafanti.customer.bo.CustomerPersonalDetailBo;
 import com.goafanti.customer.bo.CustomerSimpleBo;
 import com.goafanti.customer.bo.FollowBusinessBo;
 import com.goafanti.customer.bo.FollowListBo;
+import com.goafanti.customer.bo.InputListChannel;
 import com.goafanti.customer.bo.LockingReleaseBo;
 import com.goafanti.customer.bo.StatisticBo;
 import com.goafanti.customer.bo.transferListBo;
+import com.goafanti.user.bo.OutUserChannel;
 
 public interface CustomerService {
 	/**
@@ -532,5 +534,8 @@ public interface CustomerService {
 	 * @throws InterruptedException 
 	 */
 	void pushReleaseLog(List<LockingReleaseBo> list,Integer type) throws InterruptedException;
+	Object listChannelCustomer(InputListChannel in);
+	Object pushChannelDeliver(String userIds, String receiveId, String remarks);
+	Object getChannelCustomerByName(String name);
 	
 }

+ 43 - 1
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -83,6 +83,7 @@ import com.goafanti.customer.bo.CustomerPersonalDetailBo;
 import com.goafanti.customer.bo.CustomerSimpleBo;
 import com.goafanti.customer.bo.FollowBusinessBo;
 import com.goafanti.customer.bo.FollowListBo;
+import com.goafanti.customer.bo.InputListChannel;
 import com.goafanti.customer.bo.LockingReleaseBo;
 import com.goafanti.customer.bo.StatisticBo;
 import com.goafanti.customer.bo.transferListBo;
@@ -278,6 +279,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		if(null!=cli.getDataGrade()) params.put("dataGrade", cli.getDataGrade());
 		if(null!=cli.getLevel())params.put("level", cli.getLevel());
 		if(null!=cli.getSort())params.put("sort", cli.getSort());
+		if(null!=cli.getChannel())params.put("channel", cli.getChannel());
 		return params;
 	}
 
@@ -1580,7 +1582,10 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 	public List<CustomerSimpleBo> getSignedCustomerByName(String name) {
 		return userMapper.selectSignedCustomerByName(name,TokenManager.getAdminId());
 	}
-	
+	@Override
+	public List<CustomerSimpleBo> getChannelCustomerByName(String name) {
+		return userMapper.selectSignedCustomerByName(name,TokenManager.getAdminId());
+	}
 	private int updateUserLock(String uid,String aid,Integer oldStatus,Integer newStatus){
 		return userLockReleaseMapper.updateUserLock(uid,aid,oldStatus,newStatus);
 	}
@@ -1899,5 +1904,42 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		
 	}
 
+	@Override
+	public Object listChannelCustomer(InputListChannel in) {
+		Map<String,Object> params = new HashMap<>();
+		if (StringUtils.isNotBlank(in.getName()))params.put("name", in.getName());
+		if(in.getProvince()!=null)params.put("province", in.getProvince());
+		if(in.getCity()!=null)params.put("city", in.getCity());
+		if(StringUtils.isNotBlank(in.getStartTime()))params.put("startTime", in.getStartTime());
+		if(StringUtils.isNotBlank(in.getEndTime()))params.put("endTime", in.getEndTime()+" 23:59:59");
+		if(!TokenManager.hasRole(AFTConstants.SALESMAN_DIRECTOR)&&!TokenManager.hasRole(AFTConstants.SUPERADMIN)){
+			params.put("aid", TokenManager.getAdminId());
+		}
+		return  findPage("selectChannelCustomerList","selectChannelCustomerCount",params,in.getPageNo(),in.getPageSize());
+		
+	}
+
+	@Override
+	public Object pushChannelDeliver(String userIds, String receiveId,String remarks) {
+		String [] str=userIds.split(",");
+		List<String> uids=Arrays.asList(str);
+		Date date=new Date();
+		int  i=userMapper.updatechannelCustomerDeliver(uids, receiveId);
+		if (i>0) {
+			List<UserTransferLog> l=new ArrayList<UserTransferLog>();
+			for (String string : uids) {
+				UserTransferLog u=new UserTransferLog();
+				u.setAid(TokenManager.getAdminId());
+				u.setTakeAid(receiveId);
+				u.setUid(string);
+				u.setType(8);
+				u.setCreateTime(date);
+				l.add(u);
+			}
+			userTransferLogMapper.insertList(l);
+		}
+		return i;
+	}
+
 
 }

+ 9 - 59
src/main/java/com/goafanti/order/service/impl/OrderReceivablesServiceImpl.java

@@ -1,7 +1,5 @@
 package com.goafanti.order.service.impl;
 
-import java.io.IOException;
-import java.io.InputStream;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
@@ -13,7 +11,6 @@ import java.util.UUID;
 import javax.annotation.Resource;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
@@ -46,6 +43,7 @@ import com.goafanti.common.model.TOrderNew;
 import com.goafanti.common.model.TOrderTask;
 import com.goafanti.common.model.TemporaryReceivables;
 import com.goafanti.common.utils.DateUtils;
+import com.goafanti.common.utils.ExcelUtils;
 import com.goafanti.common.utils.ExportExcelUtil;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
@@ -338,7 +336,7 @@ public class OrderReceivablesServiceImpl extends BaseMybatisDao<TemporaryReceiva
 	@Override
 	public void batchListReceivables(MultipartFile file) {
 		 //获得Workbook工作薄对象
-        Workbook workbook = getWorkBook(file);
+        Workbook workbook = ExcelUtils.getWorkBook(file);
         //创建一个对象,用来存储数据
         List<TemporaryReceivablesBo> list=new ArrayList<>();
         if(workbook != null){
@@ -399,22 +397,22 @@ public class OrderReceivablesServiceImpl extends BaseMybatisDao<TemporaryReceiva
 			    	try {
 			        switch (cellNum) {
 					case 0:
-						trb.setFinancialPayNo(getCellValue(cell));
+						trb.setFinancialPayNo(ExcelUtils.getCellValue(cell));
 						break;
 					case 1:
-						trb.setOrderNo(getCellValue(cell).trim());
+						trb.setOrderNo(ExcelUtils.getCellValue(cell).trim());
 						break;
 					case 2:
-						trb.setCorporateName(getCellValue(cell));
+						trb.setCorporateName(ExcelUtils.getCellValue(cell));
 						break;
 					case 3:
-						trb.setAmount(new BigDecimal((getCellValue(cell).equals("")?"0":getCellValue(cell))));
+						trb.setAmount(new BigDecimal((ExcelUtils.getCellValue(cell).equals("")?"0":ExcelUtils.getCellValue(cell))));
 						break;
 					case 4:
-						trb.setReceivablesTime(DateUtils.StringToDate(getCellValue(cell), AFTConstants.YYYYMMDD));
+						trb.setReceivablesTime(DateUtils.StringToDate(ExcelUtils.getCellValue(cell), AFTConstants.YYYYMMDD));
 						break;
 					case 5:
-						trb.setRemarks(getCellValue(cell));
+						trb.setRemarks(ExcelUtils.getCellValue(cell));
 						break;
 					}
 			    	} catch (Exception e) {
@@ -432,55 +430,7 @@ public class OrderReceivablesServiceImpl extends BaseMybatisDao<TemporaryReceiva
         	temporaryReceivablesMapper.updateRepeatOrderNo(TokenManager.getAdminId());
         
     }
-      	public static Workbook getWorkBook(MultipartFile file) {
-        //创建Workbook工作薄对象,表示整个excel
-        Workbook workbook = null;
-        try {
-        //获取excel文件的io流
-        InputStream is = file.getInputStream();
-        //如果是xls,使用HSSFWorkbook;如果是xlsx,使用XSSFWorkbook
-        if(file.getOriginalFilename().matches("^.+\\.(?i)(xls)$"))workbook = new HSSFWorkbook(is);
-        if(file.getOriginalFilename().matches("^.+\\.(?i)(xlsx)$"))workbook = new XSSFWorkbook(is);
-        } catch (IOException e) {
-        }
-        return workbook;
-        }
-        @SuppressWarnings("deprecation")
-		public static String getCellValue(Cell cell){
-        	String cellValue = "";
-        	if(cell == null){
-        		return cellValue;
-        	}
-        	        //把数字当成String来读,避免出现1读成1.0的情况
-        	        if(cell.getCellType() == Cell.CELL_TYPE_NUMERIC){
-        	        cell.setCellType(Cell.CELL_TYPE_STRING);
-        	        }
-        	        //判断数据的类型
-        	        switch (cell.getCellType()){
-        	        case Cell.CELL_TYPE_NUMERIC: //数字
-        	        cellValue = String.valueOf(cell.getNumericCellValue());
-        	        break;
-        	        case Cell.CELL_TYPE_STRING: //字符串
-        	        cellValue = String.valueOf(cell.getStringCellValue());
-        	        break;
-        	        case Cell.CELL_TYPE_BOOLEAN: //Boolean
-        	        cellValue = String.valueOf(cell.getBooleanCellValue());
-        	        break;
-        	        case Cell.CELL_TYPE_FORMULA: //公式
-        	        cellValue = String.valueOf(cell.getCellFormula());
-        	        break;
-        	        case Cell.CELL_TYPE_BLANK: //空值
-        	        cellValue = "";
-        	        break;
-        	        case Cell.CELL_TYPE_ERROR: //故障
-        	        cellValue = "非法字符";
-        	        break;
-        	        default:
-        	        cellValue = "未知类型";
-        	        break;
-        	        }
-        	        return cellValue;
-	}
+      	
         
 		
 		

+ 111 - 0
src/main/java/com/goafanti/user/bo/InputUserChannel.java

@@ -0,0 +1,111 @@
+package com.goafanti.user.bo;
+
+import com.goafanti.common.model.UserChannel;
+
+public class InputUserChannel extends UserChannel{
+
+	/**  */
+	private static final long serialVersionUID = 1L;
+	/**  名称*/
+	private String userName;
+	/**  省*/
+	private String province;
+	/**  市*/
+	private String city;
+	/**  社会性质*/
+	private String societyTag;
+	/**  联系人*/
+	private String contacts;
+	/**  联系人电话*/
+	private String contactMobile;
+	private Integer shareType;
+	
+	private String password;
+	
+
+
+	public String getUserName() {
+		return userName;
+	}
+
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
+
+
+	public String getProvince() {
+		return province;
+	}
+
+
+	public void setProvince(String province) {
+		this.province = province;
+	}
+
+
+	public String getCity() {
+		return city;
+	}
+
+
+	public void setCity(String city) {
+		this.city = city;
+	}
+
+
+	public String getSocietyTag() {
+		return societyTag;
+	}
+
+
+	public void setSocietyTag(String societyTag) {
+		this.societyTag = societyTag;
+	}
+
+
+	public String getContacts() {
+		return contacts;
+	}
+
+
+	public void setContacts(String contacts) {
+		this.contacts = contacts;
+	}
+
+
+	public String getContactMobile() {
+		return contactMobile;
+	}
+
+
+	public void setContactMobile(String contactMobile) {
+		this.contactMobile = contactMobile;
+	}
+
+
+	public Integer getShareType() {
+		return shareType;
+	}
+
+
+	public void setShareType(Integer shareType) {
+		this.shareType = shareType;
+	}
+
+
+	public String getPassword() {
+		return password;
+	}
+
+
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+
+	
+
+	
+
+}

+ 298 - 0
src/main/java/com/goafanti/user/bo/OutUserChannel.java

@@ -0,0 +1,298 @@
+package com.goafanti.user.bo;
+
+import java.util.Date;
+
+import com.goafanti.common.utils.excel.Excel;
+
+
+public class OutUserChannel  {
+
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column user_channel.id
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+	
+    private Integer id;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column user_channel.uid
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    private String uid;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column user_channel.aid
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    private String aid;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column user_channel.status
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    private Integer status;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column user_channel.distribution_time
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    private Date distributionTime;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column user_channel.create_time
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    private Date createTime;
+
+    private String aName;
+    @Excel(name = "客户名称")
+	private String userName;
+    @Excel(name = "省")
+    private String province;
+    @Excel(name = "市")
+    private String city;
+    @Excel(name = "社会性质",readConverterExp = "0=社会企业,1=科研单位,2=高等院校,3=科研专家,4=科技达人,5=服务机构,6=政府部门,7=商会,8=协会,9=其他组织,10其他个人")
+    private String societyTag;
+	public String getSocietyTag() {
+		return societyTag;
+	}
+
+	public void setSocietyTag(String societyTag) {
+		this.societyTag = societyTag;
+	}
+
+	private String createTimes;
+	private String distributionTimes;
+	@Excel(name = "联系人")
+	private String contacts;
+	@Excel(name = "联系人电话")
+	private String contactMobile;
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column user_channel.id
+     *
+     * @return the value of user_channel.id
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column user_channel.id
+     *
+     * @param id the value for user_channel.id
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column user_channel.uid
+     *
+     * @return the value of user_channel.uid
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public String getUid() {
+        return uid;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column user_channel.uid
+     *
+     * @param uid the value for user_channel.uid
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public void setUid(String uid) {
+        this.uid = uid == null ? null : uid.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column user_channel.aid
+     *
+     * @return the value of user_channel.aid
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public String getAid() {
+        return aid;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column user_channel.aid
+     *
+     * @param aid the value for user_channel.aid
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public void setAid(String aid) {
+        this.aid = aid == null ? null : aid.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column user_channel.status
+     *
+     * @return the value of user_channel.status
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public Integer getStatus() {
+        return status;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column user_channel.status
+     *
+     * @param status the value for user_channel.status
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column user_channel.distribution_time
+     *
+     * @return the value of user_channel.distribution_time
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public Date getDistributionTime() {
+        return distributionTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column user_channel.distribution_time
+     *
+     * @param distributionTime the value for user_channel.distribution_time
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public void setDistributionTime(Date distributionTime) {
+        this.distributionTime = distributionTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column user_channel.create_time
+     *
+     * @return the value of user_channel.create_time
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column user_channel.create_time
+     *
+     * @param createTime the value for user_channel.create_time
+     *
+     * @mbg.generated Thu Apr 22 09:06:45 CST 2021
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+	public String getUserName() {
+		return userName;
+	}
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
+
+	public String getCreateTimes() {
+		return createTimes;
+	}
+
+	public void setCreateTimes(String createTimes) {
+		this.createTimes = createTimes;
+	}
+
+	public String getDistributionTimes() {
+		return distributionTimes;
+	}
+
+	public void setDistributionTimes(String distributionTimes) {
+		this.distributionTimes = distributionTimes;
+	}
+
+	public String getProvince() {
+		return province;
+	}
+
+	public void setProvince(String province) {
+		this.province = province;
+	}
+
+	public String getCity() {
+		return city;
+	}
+
+	public void setCity(String city) {
+		this.city = city;
+	}
+
+	public String getContacts() {
+		return contacts;
+	}
+
+	public void setContacts(String contacts) {
+		this.contacts = contacts;
+	}
+
+	public String getContactMobile() {
+		return contactMobile;
+	}
+
+	public void setContactMobile(String contactMobile) {
+		this.contactMobile = contactMobile;
+	}
+
+	public String getaName() {
+		return aName;
+	}
+
+	public void setaName(String aName) {
+		this.aName = aName;
+	}
+
+}

+ 90 - 0
src/main/java/com/goafanti/user/controller/UserChannelApiController.java

@@ -0,0 +1,90 @@
+package com.goafanti.user.controller;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.common.utils.excel.NewExcelUtil;
+import com.goafanti.user.bo.InputUserChannel;
+import com.goafanti.user.bo.OutUserChannel;
+import com.goafanti.user.service.UserChannelService;
+
+@RestController
+@RequestMapping(value = "/api/user/channel")
+public class UserChannelApiController  extends CertifyApiController{
+	
+	@Resource
+	private UserChannelService 	userChannelService;
+	
+	
+	/**
+	 * 	新增渠道
+	 * 
+	 * @param uid
+	 * @return
+	 */
+	@RequestMapping(value = "/add", method = RequestMethod.POST)
+	public Result add(InputUserChannel in) {
+		Result res = new Result();
+		if (StringUtils.isBlank(in.getUserName())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "用户名称"));
+		}
+		res.setData(userChannelService.add(in));
+		return res;
+	}
+	
+
+	
+	/**
+	 * 	Excel批量导入渠道客户
+     * 
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/import" , method = RequestMethod.POST)
+    public Result importTemplate(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request) {
+    	Result res=new Result();
+    	//判断文件是否存在
+        if(null == file){
+      	  res.getError().add(buildError("文件不存在!","文件不存在!"));
+      	  return res;
+        }
+    	String fileName = file.getOriginalFilename();
+    	if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) {
+        	  res.getError().add(buildError("格式不正确","格式不正确"));
+        	  return res;
+          }
+    	
+         res.data(userChannelService.batchListReceivables(file)); 
+    	return res;
+    }
+    
+    
+    /**
+  	 * 	导出已存在渠道客户
+       * 
+       * @param response
+       * @return
+       */
+      @RequestMapping(value = "/export" , method = RequestMethod.GET)
+      public Result exportReceivables(HttpServletResponse response)  {
+    	  List<OutUserChannel> list =userChannelService.getErorrList();
+      	NewExcelUtil<OutUserChannel>excel=new NewExcelUtil<>(OutUserChannel.class);
+  		 return  excel.exportExcel(list,"渠道客户",response);
+      	}
+	
+	
+
+}

+ 21 - 0
src/main/java/com/goafanti/user/service/UserChannelService.java

@@ -0,0 +1,21 @@
+package com.goafanti.user.service;
+
+import java.util.List;
+
+import org.springframework.web.multipart.MultipartFile;
+
+import com.goafanti.user.bo.InputUserChannel;
+import com.goafanti.user.bo.OutUserChannel;
+
+public interface UserChannelService {
+
+	Object add(InputUserChannel in);
+
+	int batchImport();
+
+	List<OutUserChannel> batchListReceivables(MultipartFile file);
+
+	List<OutUserChannel> getErorrList();
+
+
+}

+ 380 - 0
src/main/java/com/goafanti/user/service/impl/UserChannelServiceImpl.java

@@ -0,0 +1,380 @@
+package com.goafanti.user.service.impl;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.UUID;
+
+import javax.annotation.Resource;
+
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellType;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.goafanti.common.bo.CityBo;
+import com.goafanti.common.bo.Error;
+import com.goafanti.common.bo.ProvinceBo;
+import com.goafanti.common.dao.DistrictGlossoryMapper;
+import com.goafanti.common.dao.OrganizationContactBookMapper;
+import com.goafanti.common.dao.OrganizationIdentityMapper;
+import com.goafanti.common.dao.UserCareerMapper;
+import com.goafanti.common.dao.UserChannelMapper;
+import com.goafanti.common.dao.UserMapper;
+import com.goafanti.common.dao.UserTransferLogMapper;
+import com.goafanti.common.enums.SocietyTag;
+import com.goafanti.common.error.BusinessException;
+import com.goafanti.common.model.User;
+import com.goafanti.common.utils.ExcelUtils;
+import com.goafanti.common.utils.PasswordUtil;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.user.bo.InputUserChannel;
+import com.goafanti.user.bo.OutUserChannel;
+import com.goafanti.user.service.UserChannelService;
+
+@Service
+public class UserChannelServiceImpl extends BaseMybatisDao<UserCareerMapper> implements UserChannelService{
+
+	@Autowired
+	private UserMapper userMapper;
+	@Autowired
+	private OrganizationIdentityMapper organizationIdentityMapper;
+	@Autowired
+	private OrganizationContactBookMapper organizationContactBookMapper;
+	@Autowired
+	private DistrictGlossoryMapper	districtGlossoryMapper;
+	@Autowired
+	private UserTransferLogMapper userTransferLogMapper;
+	@Autowired
+	private UserChannelMapper userChannelMapper;
+	@Resource(name = "passwordUtil")
+	private PasswordUtil	passwordUtil;
+	
+	@Override
+	public Object add(InputUserChannel in) {
+		String uid=UUID.randomUUID().toString();
+		Calendar now = Calendar.getInstance();
+		now.set(Calendar.MILLISECOND, 0);
+		in.setAid(TokenManager.getAdminId());
+		in.setStatus(0);
+		in.setUid(uid);
+		User u=new User();
+		u.setId(uid);
+		u.setNickname(in.getUserName());
+		u.setCreateTime(now.getTime());
+		u.setPassword(passwordUtil.getEncryptPwd("123456", now.getTime()));
+		userChannelMapper.insertSelective(in);
+		userMapper.insertSelective(u);
+		return 1;
+	}
+
+	@Override
+	public int batchImport() {
+//		List<TemporaryReceivables> list=userChannelMapper.selectByaid(TokenManager.getAdminId());
+//		if(list.size()>99)throw new BusinessException(new Error("数量过大,建议不超过99。"));
+//		List<TOrderBillNew> listBull=new ArrayList<>();
+//		for (TemporaryReceivables tr : list) {
+//			TOrderBillNew tbn=new TOrderBillNew(); 
+//			//获取已收款
+//			BigDecimal bill = tOrderBillNewMapper.getAmountByOid(tr.getOrderNo());
+//			//获取总金额
+//			TOrderNewBo t=tOrderNewMapper.getOrderNewDetail(tr.getOrderNo());
+//			//订单匹配不到
+//			 if(t==null||t.getOrderNo()==null) {
+//				tr.setStatus(ReceivablesStatus.DDYC.getCode());
+//				temporaryReceivablesMapper.updateByPrimaryKeySelective(tr);
+//				continue;
+//			}else if(t.getDeleteSign()==2||t.getDeleteSign()==3) {
+//				tr.setStatus(ReceivablesStatus.BGSD.getCode());
+//				temporaryReceivablesMapper.updateByPrimaryKeySelective(tr);
+//				continue;
+//			}else if(!tr.getCorporateName().equals(t.getUserName())) {
+//				tr.setStatus(ReceivablesStatus.MCYC.getCode());
+//				temporaryReceivablesMapper.updateByPrimaryKeySelective(tr);
+//				continue;
+//			}else if(temporaryReceivablesMapper.selectReceivablesNumberRepeats(tr)>0) {
+//				tr.setStatus(ReceivablesStatus.YSK.getCode());
+//				temporaryReceivablesMapper.updateByPrimaryKeySelective(tr);
+//				continue;
+//			}
+//			//计算收款结果
+//			BigDecimal bd = bill.add(tr.getAmount());
+//			//判断表中数据
+//			BigDecimal count = new BigDecimal(0).add(bd);
+//			for (TOrderBillNew tBill : listBull) {
+//				if (tBill.getOrderNo().equals(tr.getOrderNo())) {
+//					count=count.add(tBill.getTransactionAmount());
+//					continue;
+//				}
+//			}
+//			TOrderBonus bonus = new TOrderBonus();
+//			bonus.setId(UUID.randomUUID().toString());
+//			bonus.setOrderNo(tr.getOrderNo());
+//			bonus.setGrantBy(TokenManager.getAdminId());
+//			int lstaus = 0;//如果订单流水小于首付 lstaus 0
+//			if(count.compareTo(t.getTotalAmount()) == 1){//如果订单流水总额大于总金额 return -1
+//				tr.setStatus(ReceivablesStatus.JEYC.getCode());
+//				temporaryReceivablesMapper.updateByPrimaryKeySelective(tr);
+//				continue;
+//			}else if (count.compareTo(t.getTotalAmount()) == 0) {//等于总额
+//				//付完款//如果订单流水等于于总金额 lstaus 2
+//				lstaus = 2;
+//				bonus.setBonusSubject(BonusSubject.WK.getCode());//12
+//				//发放给技术员如果付完款所有参与这个项目任务的人都会有结算奖
+//				//获得所有的任务负责人
+//				List<TOrderTask> l = tOrderTaskMapper.getReceiverByOid(tr.getOrderNo());
+//				for (TOrderTask tOrderTask : l) {
+//					if(null != tOrderTask &&null != tOrderTask.getTaskReceiver()){
+//						bonus.setTaskId(tOrderTask.getId());//任务id
+//						bonus.setGrantTarget(tOrderTask.getTaskReceiver());
+//						bonus.setGrantType(1);
+//						int c = tOrderBonusMapper.checkByOnoAndSub(bonus);
+//						//不存在就设置
+//						if(c==0){
+//							bonus.setId(UUID.randomUUID().toString());
+//							tOrderBonusMapper.insertSelective(bonus);
+//						}
+//					}
+//				}
+//				if(tr.getStatus()==2) {
+//					tr.setStatus(0);
+//					temporaryReceivablesMapper.updateByPrimaryKeySelective(tr);
+//				}
+//				addOrderLog(tr.getOrderNo(), OrderLogProcess.CWQK.getCode());	
+//			}else if (count.compareTo(t.getTotalAmount()) == -1) {//小于总额
+//				//如果订单流水小于总金额
+//				if(bd.compareTo(t.getFirstAmount()) == 0 || bd.compareTo(t.getFirstAmount()) == 1){//首付完成
+//					//查看首付奖是否存在
+//					TOrderBonus b = new TOrderBonus();
+//					b.setOrderNo(tr.getOrderNo());
+//					b.setBonusSubject(11);
+//					b.setGrantType(0);
+//					b.setGrantTarget(t.getSalesmanId());
+//					int c = tOrderBonusMapper.checkByOnoAndSub(b);
+//					//不存在就设置
+//					if(c==0){
+//						bonus.setBonusSubject(BonusSubject.SF.getCode());//11
+//					}
+//					lstaus = 1;
+//					
+//					addOrderLog(tr.getOrderNo(), OrderLogProcess.CWSF.getCode());
+//				}
+//				
+//			}
+//			if(tr.getStatus()==2) {
+//				tr.setStatus(0);
+//				temporaryReceivablesMapper.updateByPrimaryKeySelective(tr);
+//			}
+//			//否则新增流水信息
+//			Date date=new Date();
+//			tbn.setBillNo(UUID.randomUUID().toString().replaceAll("-", ""));
+//			tbn.setCreater(TokenManager.getAdminId());
+//			tbn.setType(1);//批量
+//			tbn.setOrderNo(t.getOrderNo());
+//			tbn.setCreateTime(date);
+//			tbn.setPayeeId("0");//默认设置0
+//			tbn.setPayerId(t.getBuyerId());
+//			tbn.setTransactionSubject(0);
+//			tbn.setTransactionChannel(2);
+//			tbn.setConfirmSign(0);
+//			tbn.setTransactionAmount(tr.getAmount());
+//			tbn.setDeleteSign((new Byte("0")));
+//			tbn.setFinancialPayTime(tr.getReceivablesTime());
+//			tbn.setFinancialPayNo(tr.getFinancialPayNo());
+//			tbn.setRemarks(tr.getRemarks());
+//			tOrderMidMapper.updatefinalReceivables(t.getOrderNo(),tr.getAmount(),date);
+//			//修改订单结算金额和结算状态
+//			//如果已经首付并且流程状态是没有派给咨询师的修改流程状态为4
+//			TOrderNew orderNew = new TOrderNew();
+//			orderNew.setOrderNo(tr.getOrderNo());
+//			//这里的已收金额是以前收的所有金额加上本次收的金额
+//			orderNew.setSettlementAmount(count);
+//			orderNew.setLiquidationStatus(lstaus);
+//			tOrderNewMapper.updateByPrimaryKeySelective(orderNew);
+//				//如果达到奖金发放要求新增奖金信息
+//				if(null != bonus.getBonusSubject()){
+//					bonus.setId(UUID.randomUUID().toString());
+//					bonus.setGrantTarget(t.getSalesmanId());
+//					//设置发放人类型
+//					bonus.setGrantType(0);
+//					tOrderBonusMapper.insertSelective(bonus);
+//			}
+//				
+//				listBull.add(tbn);
+//		}
+//		if(!listBull.isEmpty()) {
+//			tOrderBillNewMapper.insertBatch(listBull);
+//			temporaryReceivablesMapper.deleteNormalByaid(TokenManager.getAdminId());
+//		}else {
+//			return -1;
+//		}
+//		LoggerUtils.debug(getClass(), "=========================批量导入结束===================");
+		return 1;
+	}
+
+	@Override
+	public List<OutUserChannel> batchListReceivables(MultipartFile file) {
+		 //获得Workbook工作薄对象
+        Workbook workbook = ExcelUtils.getWorkBook(file);
+        //创建一个对象,用来存储数据
+        List<InputUserChannel> list=new ArrayList<>();
+        List<InputUserChannel> list2=new ArrayList<>();
+        String aid=TokenManager.getAdminId();
+    	Calendar now = Calendar.getInstance();
+    	now.set(Calendar.MILLISECOND, 0);
+        if(workbook != null){
+        	//获得当前sheet工作表
+    		Sheet sheet = workbook.getSheetAt(0);
+    		if(sheet == null){
+    			return null;
+    		}
+    		
+    		//获得当前sheet的开始行
+    		int firstRowNum = sheet.getFirstRowNum();
+    		//获得当前sheet的结束行
+    		int lastRowNum = sheet.getLastRowNum();
+    		//处理空白行
+    		for (int i = firstRowNum; i <= sheet.getLastRowNum();i++) {
+    			Row r = sheet.getRow(i);
+    			if(r == null){
+    				// 如果是空行(即没有任何数据、格式),直接把它以下的数据往上移动
+    				sheet.shiftRows(i+1, sheet.getLastRowNum(),-1);
+    				continue;
+    			}
+    			boolean flag = false;
+    			for(Cell c:r){
+    				if(c.getCellTypeEnum() != CellType.BLANK){
+    					flag = true;
+    					break;
+    				}
+    			}
+    			if(flag){
+    				i++;
+    				continue;
+    			} else{//如果是空白行(即可能没有数据,但是有一定格式)
+    				if(i == sheet.getLastRowNum())//如果到了最后一行,直接将那一行remove掉
+    					sheet.removeRow(r);
+    				else//如果还没到最后一行,则数据往上移一行
+    				    sheet.shiftRows(i+1, sheet.getLastRowNum(),-1);
+    			}
+    		}
+    		lastRowNum=sheet.getLastRowNum();
+    		if (lastRowNum<2) {
+    			throw new BusinessException(new Error("未找到正确的参数。"));
+			}
+    		
+    		//循环第2行后的所有行
+    		for(int rowNum = firstRowNum+2;rowNum <= lastRowNum;rowNum++){
+        		//获得当前行
+				Row row = sheet.getRow(rowNum);
+				if(row == null){
+					continue;
+				}
+	        	//获得当前行的开始列
+	        	int firstCellNum = row.getFirstCellNum();
+	        	//获得当前行的列数
+	        	int lastCellNum = row.getLastCellNum();
+		        //循环当前行 cellNum = (firstCellNum+1) 则是除开第一例
+	        	InputUserChannel in=new InputUserChannel();
+	        	
+	        	List<CityBo> cList=districtGlossoryMapper.getCity();
+	        	List<ProvinceBo>pList=districtGlossoryMapper.getProvince();
+		        for(int cellNum = (firstCellNum); cellNum < lastCellNum;cellNum++){
+			        Cell cell = row.getCell(cellNum);
+			    	try {
+			        switch (cellNum) {
+					case 0:
+						in.setUserName(ExcelUtils.getCellValue(cell));
+						break;
+					case 1:
+						in.setProvince(getProvinceId(pList,ExcelUtils.getCellValue(cell)));
+						break;
+					case 2:
+						in.setCity(getCityId(cList,ExcelUtils.getCellValue(cell)));
+						break;
+					case 3:
+						in.setSocietyTag(SocietyTag.getCodeByValue(ExcelUtils.getCellValue(cell)).toString());
+						break;
+					case 4:
+						in.setContacts(ExcelUtils.getCellValue(cell));
+						break;
+					case 5:
+						in.setContactMobile(ExcelUtils.getCellValue(cell));
+						break;
+					}
+			    	} catch (Exception e) {
+			    		throw new BusinessException(new Error("表格第"+(rowNum+1)+"行输入内容不正确。"));
+					}
+		        }
+		        String uid=UUID.randomUUID().toString();
+		        in.setAid(aid);
+		        in.setCreateTime(now.getTime());
+		        in.setShareType(3);
+		        in.setPassword(passwordUtil.getEncryptPwd("123456", now.getTime()));
+		        User u=userMapper.selectByName(in.getUserName());
+		        if (u!=null) {
+					in.setStatus(1);
+					in.setUid(u.getId());
+					list2.add(in);
+				}else {
+					in.setStatus(0);
+					in.setUid(uid);
+					list.add(in);
+				}
+		        
+    		}
+        }
+        for (InputUserChannel in : list) {
+        	int i=0;
+			for (InputUserChannel in2 : list) {
+				if (in.getUserName().equals(in2.getUserName())) {
+					i++;
+					if (i>1) {
+						throw new BusinessException(String.format("客户名称:%s 重复录入", in.getUserName()));
+					}
+				}
+			}
+			
+		}
+        if (!list.isEmpty()) {
+        	userMapper.insertBatch(list);
+        	organizationIdentityMapper.insertBatch(list);
+        	organizationContactBookMapper.insertBatch(list);
+        	userChannelMapper.insertBatch(list);
+        	userTransferLogMapper.insertBatch(list);
+		}
+    	if(!list2.isEmpty())userChannelMapper.insertBatch(list2);
+    	return userChannelMapper.selectByAidAndstatus(aid,1);
+    }
+
+	
+
+	private String getCityId(List<CityBo> cList, String cellValue) {
+		for (CityBo cityBo : cList) {
+			if (cityBo.getName().contains(cellValue)) {
+				return cityBo.getId().toString();
+			}
+		}
+		return null;
+	}
+
+	private String getProvinceId(List<ProvinceBo> pList, String cellValue) {
+		for (ProvinceBo provinceBo : pList) {
+			if (provinceBo.getName().contains(cellValue)) {
+				return provinceBo.getId().toString();
+			}
+		}
+		return null;
+	}
+
+	@Override
+	public List<OutUserChannel> getErorrList() {
+		return userChannelMapper.selectByAidAndstatus(TokenManager.getAdminId(),1);
+	}
+
+}

+ 1 - 1
src/main/resources/props/config_local.properties

@@ -1,7 +1,7 @@
 #Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #本地
-jdbc.url=jdbc\:mysql://localhost:3306/aft20210315?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 jdbc.username=root
 jdbc.password=123456
 #测试