Explorar o código

更新一键生成账号,添加生成大走访的挂钩干部账号

yin_yu820 hai 4 días
pai
achega
437c197368

+ 3 - 23
jp-console/jeeplus-module/ly/src/main/java/com/jeeplus/enterpriseinfo/controller/EnterpriseInfoController.java

@@ -155,16 +155,8 @@ public class EnterpriseInfoController {
 	public ResponseEntity<IPage<EnterpriseInfoDTO>> Loginlist(EnterpriseInfoDTO enterpriseInfoDTO, Page<EnterpriseInfoDTO> page) throws Exception {
 		QueryWrapper queryWrapper = QueryWrapperGenerator.buildQueryCondition (enterpriseInfoDTO, EnterpriseInfoDTO.class);
 
-		UserDTO userDTO = UserUtils.getCurrentUserDTO();
-		List<HashMap<String, Object>> map=new ArrayList<>();
-
 		IPage<EnterpriseInfoDTO> result = enterpriseInfoService.findList3 (page, queryWrapper,enterpriseInfoDTO.getName());
-//		//未登录限制
-//		if(userDTO.getLoginName()==null){
-//			for(int i=0;i<result.getRecords().size();i++){
-//				result.getRecords().set(i,nologindel(result.getRecords().get(i)));
-//			}
-//		}
+
 		return ResponseEntity.ok (result);
 	}
 
@@ -710,23 +702,11 @@ public class EnterpriseInfoController {
 
 				EnterpriseInfoDTO ef=enterpriseInfoWrapper.toDTO ( enterpriseInfoService.getById ( id ) );
 				int re=enterpriseInfoService.generateAccount ( ef);
-				if(re==1){
-					a++;
-				}else if(re==2){
-					b++;
-				}else if(re==3){
-					c++;
-				}
+				a=a+re;
 
 			}
 		}
-		String res=c+" 家企业账号已生成!";
-		if(a!=0){
-			res=res+" 其中"+a+" 家 企业联系电话未填写!";
-		}
-		if(b!=0){
-			res=res+" 其中"+b+" 家 企业账号已经生成过!";
-		}
+		String res=a+"个账号已生成!";
 
 		return ResponseEntity.ok( res );
 	}

+ 1 - 1
jp-console/jeeplus-module/ly/src/main/java/com/jeeplus/enterpriseinfo/mapper/xml/EnterpriseInfoMapper.xml

@@ -226,7 +226,7 @@
     </select>
 
     <select id="getHyList" resultType="map">
-        SELECT industry FROM `ly_enterprise_info` where del_flag=0 group By industry
+        SELECT industry FROM `ly_enterprise_info` where del_flag=0 AND industry IS NOT NULL group By industry
     </select>
 
     <select id="getIndustryChainList" resultType="map">

+ 59 - 92
jp-console/jeeplus-module/ly/src/main/java/com/jeeplus/enterpriseinfo/service/EnterpriseInfoService.java

@@ -196,108 +196,75 @@ public class EnterpriseInfoService extends ServiceImpl<EnterpriseInfoMapper, Ent
 
 
     public int generateAccount(EnterpriseInfoDTO ef){
-        //1:企业联系电话未填写;    2:已经生成过;   3:正常生成;
-
-        //判断是否已经生成过挂钩干部账号
-        if(ef.getDes10()==null||!ef.getDes10().equals("1")){
-            if(ef.getBz6()!=null&&!ef.getBz6().equals("")){
-
-                String pp=ef.getBz6();
-                UserDTO gb=userService.getUserByLoginName(pp);
-                if(gb==null){
-                    //生成用户
-                    UserDTO userDTO2=new UserDTO();
-                    userDTO2.setLoginName(pp);
-                    String password="Dzf@"+pp.substring(pp.length()-4,pp.length());//固定格式
-                    userDTO2.setPassword ( SecurityUtils.encryptPassword ( password ) );
-
-                    userDTO2.setName(ef.getBz5());
-                    userDTO2.setRemarks("");
-                    userDTO2.setMobile(pp);
-
-                    OfficeDTO of=new OfficeDTO();
-                    of.setId("1910166518827778049");//挂钩干部
-                    userDTO2.setCompanyDTO(of);
-                    userDTO2.setOfficeDTO(of);
-
-                    userDTO2.setNo("001");
-                    RoleDTO ro=new RoleDTO();
-                    ro.setId("1910141956174053377");//挂钩干部
-                    List<RoleDTO> ros=new ArrayList<>();
-                    ros.add(ro);
-                    userDTO2.setRoleDTOList(ros);
-                    userDTO2.setLoginFlag("1");
-                    userService.saveOrUpdate ( userDTO2 );
-
-                    //更新企业信息
-                    ef.setDes10("1");
-                    saveOrUpdate(enterpriseInfoWrapper.toEntity (ef));
-
-                }else{
-
-                }
-
-
-                //正常生成
-                //return 3;
-            }else{
-                //企业联系电话未填写
-                //return 1;
-            }
-        }else{
-            //已经生成过
-            //return 2;
+        //返回生成账号总数
+        int ccb=0;
+        //都企供需-挂钩干部
+        if(ef.getBz6()!=null&&!ef.getBz6().equals("")){
+            String pp=ef.getBz6();
+            String password="Dzf@"+pp.substring(pp.length()-4,pp.length());//固定格式
+            int res=addUserBy(pp,password,ef.getBz5(),ef.getName(),"1910166518827778049","1910141956174053377");
+            ccb=ccb+res;
         }
 
-
-
-
-
-        //判断是否已经生成过账号
-        if(ef.getDes6()==null||!ef.getDes6().equals("1")){
-            if(ef.getPhone()!=null&&!ef.getPhone().equals("")){
-
-                //生成用户
-                UserDTO userDTO=new UserDTO();
-                userDTO.setLoginName(ef.getPhone());
-                String password=generateRandomString(8);//随机生成初始密码
-                userDTO.setPassword ( SecurityUtils.encryptPassword ( password ) );
-
-                userDTO.setName(ef.getLxr());
-                userDTO.setRemarks(ef.getName());
-                userDTO.setMobile(ef.getPhone());
-
-                OfficeDTO of=new OfficeDTO();
-                of.setId("1890304178267557890");//规上企业
-                userDTO.setCompanyDTO(of);
-                userDTO.setOfficeDTO(of);
-
-                userDTO.setNo("001");
-                RoleDTO ro=new RoleDTO();
-                ro.setId("38a14f1f42ed424eab4cb5d489596b0d");//企业用户
-                List<RoleDTO> ros=new ArrayList<>();
-                ros.add(ro);
-                userDTO.setRoleDTOList(ros);
-                userDTO.setLoginFlag("1");
-                userService.saveOrUpdate ( userDTO );
-
+        //企业用户
+        if(ef.getPhone()!=null&&!ef.getPhone().equals("")){
+            String pp=ef.getPhone();
+            String password=generateRandomString(8);//随机生成初始密码
+            int res=addUserBy(pp,password,ef.getLxr(),ef.getName(),"1890304178267557890","38a14f1f42ed424eab4cb5d489596b0d");
+            if(res==1){
                 //更新企业信息
                 ef.setDes5(password);
                 ef.setDes6("1");
                 saveOrUpdate(enterpriseInfoWrapper.toEntity (ef));
-
-                //正常生成
-                return 3;
-            }else{
-                //企业联系电话未填写
-                return 1;
             }
-        }else{
-            //已经生成过
-            return 2;
+            ccb=ccb+res;
+        }
+
+        //大走访-挂钩干部
+        if(ef.getDes13()!=null&&!ef.getDes13().equals("")){
+            String pp=ef.getDes13();
+            String password="Dzf@"+pp.substring(pp.length()-4,pp.length());//固定格式
+            int res=addUserBy(pp,password,ef.getDes14(),ef.getName(),"1910166518827778049","1915280292672946177");
+            ccb=ccb+res;
         }
 
+        return ccb;
+
+    }
 
+    private int addUserBy(String loginname,String password,String truename,String remarks,String officeid,String roleid){
+        //1:企业联系电话未填写;    2:已经生成过;   3:正常生成;
+        //1:正常生成;    0:已经生成过;
+        UserDTO gb=userService.getUserByLoginName(loginname);
+        if(gb==null){
+            //生成用户
+            UserDTO userDTO=new UserDTO();
+            userDTO.setLoginName(loginname);
+            userDTO.setPassword ( SecurityUtils.encryptPassword ( password ) );
+
+            userDTO.setName(truename);
+            userDTO.setRemarks(remarks);
+            userDTO.setMobile(loginname);
+
+            OfficeDTO of=new OfficeDTO();
+            of.setId(officeid);
+            userDTO.setCompanyDTO(of);
+            userDTO.setOfficeDTO(of);
+
+            userDTO.setNo("001");
+            RoleDTO ro=new RoleDTO();
+            ro.setId(roleid);
+            List<RoleDTO> ros=new ArrayList<>();
+            ros.add(ro);
+            userDTO.setRoleDTOList(ros);
+            userDTO.setLoginFlag("1");
+            userService.saveOrUpdate ( userDTO );
+
+
+            return 1;
+        }else{
+            return 0;
+        }
     }
 
     public static String generateRandomString(int length) {

+ 4 - 4
jp-console/jeeplus-module/ly/src/main/java/com/jeeplus/enterpriseinfo/service/dto/EnterpriseInfoDTO.java

@@ -44,7 +44,6 @@ public class EnterpriseInfoDTO extends BaseDTO {
 	/**
      * 企业类型
      */
-	@NotNull(message="所属行业不能为空")
 	@ExcelProperty("所属行业")
 	@Query(type = QueryType.LIKE)
 	private String industry;
@@ -111,7 +110,8 @@ public class EnterpriseInfoDTO extends BaseDTO {
 	private String qyDes;
 	@ExcelIgnore
 	private String businessContent;
-	@ExcelIgnore
+	@ExcelProperty("是否都企供需企业(是:1;否:0)")
+	@Query(type = QueryType.EQ)
 	private Long totalNumber;
 	@ExcelIgnore
 	private Long securityNumber;
@@ -155,9 +155,9 @@ public class EnterpriseInfoDTO extends BaseDTO {
 	private String des11;
 	@ExcelIgnore
 	private String des12;
-	@ExcelIgnore
+	@ExcelProperty("大走访挂钩干部联系电话")
 	private String des13;
-	@ExcelIgnore
+	@ExcelProperty("大走访挂钩干部姓名")
 	private String des14;
 	@ExcelIgnore
 	private String des15;