anderx 4 years ago
parent
commit
b1d2b17291

+ 6 - 2
src/main/java/com/goafanti/common/enums/ChannelStatus.java

@@ -20,9 +20,13 @@ public enum ChannelStatus {
 	YCZQD(5,"已存在签单"),
 	/** 0回退 */ 
 	HT(6,"回退"),
-	/** 0已签单*/ 
+	/** 已签单*/ 
 	YQD(7,"已签单"),
-	NULL(9,"");
+	/** 已释放*/ 
+	YSF(8,"已释放"),
+	/** 非法名称*/ 
+	FFMC(9,"非法名称"),
+	NULL(10,"");
 	 
 	private Integer	code;
 	private String	desc;

+ 2 - 3
src/main/java/com/goafanti/common/mapper/UserChannelMapper.xml

@@ -208,7 +208,7 @@
     left join district_glossory d1 on c.location_province =d1.id 
     left join district_glossory d2 on c.location_city =d2.id
     where 1=1
-    and a.status > 2 and a.status < 6
+    and a.status in (3,4,5,9)
     <if test="aid !=null">
     and a.aid= #{aid} 
     </if>
@@ -223,8 +223,7 @@
     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 1=1
-    and a.status &gt; 2 and a.status &lt; 6
+    where 1=1 and a.status in (3,4,5,9)
     <if test="aid !=null">
     and a.aid= #{aid} 
     </if>

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

@@ -2072,12 +2072,12 @@ inner join(
 	<insert id="insertBatch" parameterType="com.goafanti.user.bo.InputUserChannel">
 	INSERT INTO `user` (id, mobile, password,
 	nickname,identify_name,aid,
-	share_type,type,society_tag,channel,source)VALUES
+	share_type,type,society_tag,channel,source,status)VALUES
 	<foreach item="item" index="index" collection="list"
 		separator=",">
 		(#{item.uid,jdbcType=VARCHAR}, #{item.contactMobile,jdbcType=VARCHAR},#{item.password,jdbcType=VARCHAR},
 		#{item.userName},#{item.userName},#{item.aid},
-		#{item.shareType,jdbcType=TIMESTAMP}, 1,#{item.societyTag},1,1)
+		#{item.shareType,jdbcType=TIMESTAMP}, 1,#{item.societyTag},1,1 ,#{item.userStatus})
     </foreach>
   </insert>
   

+ 2 - 1
src/main/java/com/goafanti/common/utils/ExcelUtils.java

@@ -17,6 +17,7 @@ import java.util.regex.Pattern;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.stereotype.Component;
 import org.springframework.web.multipart.MultipartFile;
 
 import com.goafanti.customer.bo.CustomerExcelBo;
@@ -37,7 +38,7 @@ import java.net.URLEncoder;
 import java.util.*;
 import java.util.regex.Matcher;
 
-
+@Component
 public class ExcelUtils {
 	private Set<Integer> vacantRows = new HashSet<Integer>(); //数据不完整的
 	private final String DEFAULT_MOBILE = "0000-0000000";

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

@@ -20,10 +20,15 @@ public class InputUserChannel extends UserChannel{
 	private String contactMobile;
 	private Integer shareType;
 	
+	private Integer userStatus;
+	
 	private String password;
 	
 
 
+
+
+
 	public String getUserName() {
 		return userName;
 	}
@@ -104,6 +109,16 @@ public class InputUserChannel extends UserChannel{
 	}
 
 
+	public Integer getUserStatus() {
+		return userStatus;
+	}
+
+
+	public void setUserStatus(Integer userStatus) {
+		this.userStatus = userStatus;
+	}
+
+
 	
 
 	

+ 27 - 5
src/main/java/com/goafanti/user/service/impl/UserChannelServiceImpl.java

@@ -86,6 +86,7 @@ public class UserChannelServiceImpl extends BaseMybatisDao<UserChannelMapper> im
         //创建一个对象,用来存储数据
         List<InputUserChannel> list=new ArrayList<>();
         List<InputUserChannel> list2=new ArrayList<>();
+        List<InputUserChannel> list3=new ArrayList<>();
         String aid=TokenManager.getAdminId();
     	Calendar now = Calendar.getInstance();
     	now.set(Calendar.MILLISECOND, 0);
@@ -95,7 +96,6 @@ public class UserChannelServiceImpl extends BaseMybatisDao<UserChannelMapper> im
     		if(sheet == null){
     			return null;
     		}
-    		
     		//获得当前sheet的开始行
     		int firstRowNum = sheet.getFirstRowNum();
     		//获得当前sheet的结束行
@@ -183,9 +183,16 @@ public class UserChannelServiceImpl extends BaseMybatisDao<UserChannelMapper> im
 		        in.setPassword(passwordUtil.getEncryptPwd("123456", now.getTime()));
 		        User u=userMapper.selectByName(in.getUserName());
 		        if (u==null) {
-		        	in.setStatus(ChannelStatus.WFP.getCode());
 					in.setUid(uid);
-					list.add(in);
+					if (checkUserName(in.getUserName())) {
+						in.setStatus(ChannelStatus.FFMC.getCode());
+						in.setUserStatus(1);
+						list3.add(in);
+					}else {
+						in.setUserStatus(0);
+						in.setStatus(ChannelStatus.WFP.getCode());
+						list.add(in);
+					}
 				}else {
 //					共享类型 0-私有 1-公共 2 签单
 					if(u.getShareType()==0)in.setStatus(ChannelStatus.YCZSY.getCode());
@@ -195,6 +202,7 @@ public class UserChannelServiceImpl extends BaseMybatisDao<UserChannelMapper> im
 					list2.add(in);
 				}
 		        
+		        
     		}
         }
         for (InputUserChannel in : list) {
@@ -216,17 +224,31 @@ public class UserChannelServiceImpl extends BaseMybatisDao<UserChannelMapper> im
         	userChannelMapper.insertBatch(list);
         	userTransferLogMapper.insertBatch(list);
 		}
-    	if(list2.isEmpty()) {
+    	if(list2.isEmpty()&&list3.isEmpty()) {
     		return 1;
     	}else {
+    		userMapper.insertBatch(list3);
+    		organizationIdentityMapper.insertBatch(list3);
+    		organizationContactBookMapper.insertBatch(list3);
+    		list2.addAll(list3);
     		userChannelMapper.insertBatch(list2);
-    		return getErorrList(1,10);
+    		return  getErorrList(1,10);
     	}
     	
+    	
     }
 
 	
 
+	private boolean checkUserName(String userName) {
+		if (userName.contains("房地产")) {
+			return true;
+		}
+		return false;
+	}
+
+
+
 	private String getCityId(List<CityBo> cList, String cellValue) {
 		for (CityBo cityBo : cList) {
 			if (cityBo.getName().contains(cellValue)) {