导入企业 导入企业法人岗位及用户 岗位清单 岗位任务
This commit is contained in:
parent
ae1a148e1b
commit
6a6ac91f89
20
inventory-dao/src/main/java/com/rzyc/enums/SysOrgCode.java
Normal file
20
inventory-dao/src/main/java/com/rzyc/enums/SysOrgCode.java
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package com.rzyc.enums;
|
||||
|
||||
public enum SysOrgCode {
|
||||
|
||||
GARZE("513300");
|
||||
|
||||
private String orgCode;
|
||||
|
||||
SysOrgCode(String orgCode) {
|
||||
this.orgCode = orgCode;
|
||||
}
|
||||
|
||||
public String getOrgCode() {
|
||||
return orgCode;
|
||||
}
|
||||
|
||||
public void setOrgCode(String orgCode) {
|
||||
this.orgCode = orgCode;
|
||||
}
|
||||
}
|
||||
|
|
@ -51,4 +51,14 @@ public interface EntPostMapper extends BaseMapper<EntPost> {
|
|||
* */
|
||||
EntPost getParentPost(@Param("postId") String postId);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除法人岗位
|
||||
* @param legalPerson
|
||||
* @param enterpriseId
|
||||
* @return int
|
||||
* */
|
||||
int deletePostOfLegalPerson(@Param("legalPerson") String legalPerson,@Param("enterpriseId")String enterpriseId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,14 @@ public interface EntUserMapper extends BaseMapper<EntUser> {
|
|||
* */
|
||||
EntUser validMobile(@Param("mobile") String mobile,@Param("entUserId")String entUserId);
|
||||
|
||||
/**
|
||||
* 验证用户账号
|
||||
* @param account 电话
|
||||
* @param entUserId 用户id
|
||||
* @return int 成功或失败
|
||||
* */
|
||||
EntUser validAccount(@Param("account") String account,@Param("entUserId")String entUserId);
|
||||
|
||||
/**
|
||||
* 验证用户电话和名字
|
||||
* @param name 名字
|
||||
|
|
@ -71,4 +79,19 @@ public interface EntUserMapper extends BaseMapper<EntUser> {
|
|||
* @return list
|
||||
* */
|
||||
List<EntUser> selectEntUserListNoPage(@Param("name") String name,@Param("enterpriseId")String enterpriseId);
|
||||
|
||||
/**
|
||||
* 删除企业法人
|
||||
* @param legalPerson
|
||||
* @param enterpriseId
|
||||
* @return int
|
||||
* */
|
||||
int deleteLegalPerson(@Param("legalPerson") String legalPerson,@Param("enterpriseId")String enterpriseId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询企业用户中不存在清单的用户
|
||||
* @return list
|
||||
* */
|
||||
List<EntUser>selectNoEntPostListUser();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,4 +34,12 @@ public interface InEntListMapper extends BaseMapper<InEntList> {
|
|||
* */
|
||||
int insertList(@Param("list")List<InEntList>inListItems);
|
||||
|
||||
|
||||
/**
|
||||
* 删除企业清单项通过企业id
|
||||
* @param enterpriseId
|
||||
* @return int
|
||||
* */
|
||||
int deleteByEnterpriseId(String enterpriseId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ import com.rzyc.bean.organization.dto.ManageEnterpriseListDto;
|
|||
import com.rzyc.bean.organization.vo.AreaEntNum;
|
||||
import com.rzyc.bean.organization.vo.EnterpriseVo;
|
||||
import com.rzyc.bean.organization.vo.OrganizationNum;
|
||||
import com.rzyc.model.EasyExcel.EasyExcelEnterprise;
|
||||
import com.rzyc.model.EasyExcel.EasyExcelInList;
|
||||
import com.rzyc.model.SysOrg;
|
||||
import com.rzyc.model.ent.SysEnterprise;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -357,4 +359,25 @@ public interface SysEnterpriseMapper extends BaseMapper<SysEnterprise> {
|
|||
* @return SysEnterprise 企业表
|
||||
* */
|
||||
SysEnterprise findEnterpriseByPhoneNumber(@Param("entUserPhone")String entUserPhone);
|
||||
|
||||
/**
|
||||
* 插入企业list
|
||||
* @param list
|
||||
* @date 2022/12/19
|
||||
* @return int
|
||||
* */
|
||||
int insertList(@Param("list") List<EasyExcelEnterprise> list);
|
||||
|
||||
/**
|
||||
*查询未生成企业责任清单的企业
|
||||
* @return list
|
||||
* */
|
||||
List<SysEnterprise>selectNoEntList();
|
||||
|
||||
|
||||
/**
|
||||
* 查询没有法人岗位的企业
|
||||
* @return list
|
||||
* */
|
||||
List<SysEnterprise>selectNoLegalPersonPost();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
package com.rzyc.model.EasyExcel;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
|
|
@ -15,6 +18,16 @@ import lombok.Setter;
|
|||
* */
|
||||
public class EasyExcelEnterprise {
|
||||
|
||||
private Integer sortId;
|
||||
|
||||
/**企业名*/
|
||||
private String EntName;
|
||||
|
||||
/**企业信用代码*/
|
||||
private String OrgPassNo;
|
||||
|
||||
private String OrgName;
|
||||
|
||||
private String address;
|
||||
|
||||
private String industry;
|
||||
|
|
@ -27,9 +40,31 @@ public class EasyExcelEnterprise {
|
|||
|
||||
private String safeChangePersonPhone;
|
||||
|
||||
private Integer staffNumber;
|
||||
private String staffNumber = null;
|
||||
|
||||
private String dateOfIncorporation;
|
||||
|
||||
private String businessScope;
|
||||
|
||||
/*
|
||||
---------------------
|
||||
*/
|
||||
|
||||
/**企业代码*/
|
||||
private String areaCode;
|
||||
|
||||
private String areaPath;
|
||||
|
||||
private String industryId;
|
||||
|
||||
private String CreatedBy;
|
||||
|
||||
private Date CreatedOn;
|
||||
|
||||
private String SysEnterpriseId;
|
||||
|
||||
private Date establishTime;
|
||||
|
||||
private String areaName;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ public class EntUser implements Serializable {
|
|||
@TableField("mobile")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "账号")
|
||||
@TableField("account")
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty(value = "人员类型")
|
||||
@TableField("user_type")
|
||||
private Integer userType;
|
||||
|
|
@ -133,6 +137,14 @@ public class EntUser implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private String enterpriseName;
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public String getEnterpriseName() {
|
||||
return enterpriseName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@
|
|||
</select>
|
||||
|
||||
<update id="updateTaskState">
|
||||
update ent_post_task set task_state = 2 where ent_post_task_id = #{entPostTaskId}
|
||||
update ent_post_task set task_state = 2 where task_id = #{entPostTaskId}
|
||||
</update>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
post_id, enterprise_id, name, parent_id, post_path, parent_name, post_level, completion_rate, create_time, create_by, modify_time, modify_by
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectEntUserTree" resultMap="BaseResultMap">
|
||||
select * from ent_post
|
||||
where enterprise_id = #{enterpriseId}
|
||||
|
|
@ -49,4 +50,8 @@
|
|||
select ep2.* from ent_post ep inner join ent_post ep2 on ep2.post_id = ep.parent_id where ep.post_id = #{postId}
|
||||
</select>
|
||||
|
||||
<delete id="deletePostOfLegalPerson">
|
||||
delete from ent_post where `name` = #{legalPerson} and enterprise_id = #{enterpriseId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
ent_user_id, post_id, enterprise_id, name, mobile, user_type, age, work_time, password, post_path, post_path_name, create_time, create_by, modify_time, modify_by
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectByName" resultMap="BaseResultMap">
|
||||
select * from ent_user where name = #{name}
|
||||
</select>
|
||||
|
|
@ -120,7 +121,22 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="validAccount" resultMap="BaseResultMap">
|
||||
select ent_user_id,name,mobile,password,post_id from ent_user where account = #{account}
|
||||
<if test="null != entUserId and '' != entUserId" >
|
||||
and ent_user_id != #{entUserId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="validName" resultMap="BaseResultMap">
|
||||
select ent_user_id,name,mobile from ent_user where name = #{name}
|
||||
</select>
|
||||
|
||||
<delete id="deleteLegalPerson">
|
||||
delete from ent_user where post_path_name = #{legalPerson} and enterprise_id = #{enterpriseId}
|
||||
</delete>
|
||||
|
||||
<select id="selectNoEntPostListUser" resultMap="BaseResultMap">
|
||||
select eu.* from ent_user eu left join ent_post_list epl on eu.ent_user_id = epl.ent_user_id and epl.post_list_id is null
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
</sql>
|
||||
|
||||
|
||||
|
||||
<select id="selectByEnterpriseId" resultMap="BaseResultMap">
|
||||
select * from in_ent_list where enterprise_id = #{enterpriseId}
|
||||
</select>
|
||||
|
|
@ -52,4 +53,8 @@
|
|||
#{list.enterpriseId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByEnterpriseId">
|
||||
delete from in_ent_list where enterprise_id = #{enterpriseId}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
package com.rzyc.config;
|
||||
|
||||
import org.apache.tomcat.util.threads.ThreadPoolExecutor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author Xuwanxin
|
||||
* @date 2022/12/21
|
||||
* */
|
||||
@Configuration
|
||||
public class MyThreadConfig {
|
||||
|
||||
@Bean
|
||||
public ThreadPoolExecutor threadPoolExecutor() {
|
||||
//@param corePoolSize: 池中一直保持的线程的数量,即使线程空闲。除非设置了 allowCoreThreadTimeOut
|
||||
return new ThreadPoolExecutor(20,
|
||||
//@param maximumPoolSize: 池中允许的最大的线程数
|
||||
200,
|
||||
//@param keepAliveTime: 当线程数大于核心线程数的时候,线程在最大多长时间没有接到新任务就会终止释放, 最终线程池维持在 corePoolSize 大小
|
||||
10,
|
||||
//@param 时间单位
|
||||
TimeUnit.SECONDS,
|
||||
//@param workQueue: 阻塞队列,用来存储等待执行的任务,如果当前对线程的需求超过了 corePoolSize 大小,就会放在这里等待空闲线程执行。
|
||||
new LinkedBlockingDeque<>(100000),
|
||||
//@param threadFactory: 创建线程的工厂,比如指定线程名等
|
||||
Executors.defaultThreadFactory(),
|
||||
//@param handler: 拒绝策略,如果线程满了,线程池就会使用拒绝策略。
|
||||
new ThreadPoolExecutor.AbortPolicy()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.rzyc.controller;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.common.utils.*;
|
||||
import com.common.utils.copy.ObjectConversion;
|
||||
import com.common.utils.encryption.MD5;
|
||||
import com.common.utils.encryption.PasswdFactory;
|
||||
import com.common.utils.jpush.Jpush;
|
||||
|
|
@ -1906,6 +1907,27 @@ public class BaseController {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成企业责任清单
|
||||
* @author Xu wanxin
|
||||
* @param industryId
|
||||
* @param companyId
|
||||
* @throws Exception
|
||||
*/
|
||||
public void saveEntInList(String industryId,String companyId)throws Exception{
|
||||
List<InListItem> inListItem = inListItemMapper.SelectContents(industryId,null);
|
||||
List<InEntList> entLists = ObjectConversion.copy(inListItem,InEntList.class);
|
||||
if(null != entLists && entLists.size()>0){
|
||||
for (InEntList in:entLists) {
|
||||
in.setEnterpriseId(companyId);
|
||||
in.setEntListId(RandomNumber.getUUid());
|
||||
in.setCreateBy(getUserId());
|
||||
in.setCreateTime(new Date());
|
||||
}
|
||||
int result = inEntListMapper.insertList(entLists);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,15 @@
|
|||
package com.rzyc.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.common.utils.StringUtils;
|
||||
import com.common.utils.TypeConversion;
|
||||
import com.common.utils.model.Code;
|
||||
import com.common.utils.model.Message;
|
||||
import com.common.utils.model.MultiResult;
|
||||
import com.common.utils.model.SingleResult;
|
||||
import com.common.utils.verification.Verification;
|
||||
import com.rzyc.model.SysOrg;
|
||||
import com.rzyc.service.PcBusinessService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -16,6 +24,10 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import javax.validation.constraints.NotNull;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Xuwanxin
|
||||
|
|
@ -83,4 +95,66 @@ public class CommonController extends BaseController{
|
|||
return pcBusinessService.validEntUserName(name,entUserId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 地区树形
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@ApiOperation(value = "地区树形", notes = "地区树形")
|
||||
@GetMapping(value = "/areaTree")
|
||||
@ResponseBody
|
||||
public MultiResult<SysOrg> areaTree(String userId)throws Exception{
|
||||
System.out.println("userId -> "+userId);
|
||||
|
||||
MultiResult<SysOrg> result = new MultiResult<>();
|
||||
|
||||
//获取用户低
|
||||
if(StringUtils.isBlank(userId)){
|
||||
userId = getUserId();
|
||||
}
|
||||
|
||||
//获取用户的地区id
|
||||
String userArea = getUserArea(userId);
|
||||
if(StringUtils.isBlank(userArea)){
|
||||
userArea = constantsConfigure.getSuperiorOrgCode();
|
||||
}
|
||||
|
||||
List<SysOrg> sysOrgs = sysOrgMapper.findUserArea(userArea);
|
||||
|
||||
if(sysOrgs.size() > 0){
|
||||
|
||||
//处理树形结构
|
||||
JSONArray jsonArray = handleAreaTree(sysOrgs);
|
||||
List<SysOrg> areas = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),SysOrg.class);
|
||||
result.setData(areas);
|
||||
}else{
|
||||
result.setCode(Code.NO_DATA.getCode());
|
||||
result.setMessage(Message.NO_DATA);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 地区树形结构
|
||||
* @param sysOrgs
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private JSONArray handleAreaTree(List<SysOrg> sysOrgs)throws Exception{
|
||||
List<Map<String,Object>> data = new ArrayList<>();
|
||||
for(SysOrg sysOrg : sysOrgs){
|
||||
if(StringUtils.isBlank(sysOrg.getSuperiororgcode())){
|
||||
sysOrg.setSuperiororgcode("");
|
||||
}
|
||||
Map<String,Object> entUserMap = new HashMap<String,Object>();
|
||||
entUserMap.put("orgcode",sysOrg.getOrgcode());
|
||||
entUserMap.put("orgname",sysOrg.getOrgname());
|
||||
entUserMap.put("superiororgcode",sysOrg.getSuperiororgcode());
|
||||
|
||||
data.add(entUserMap);
|
||||
}
|
||||
JSONArray result = TypeConversion.listToTree(JSONArray.parseArray(JSON.toJSONString(data)),"orgcode","superiororgcode","children");
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.rzyc.controller;
|
|||
|
||||
import com.common.utils.model.MultiResult;
|
||||
import com.rzyc.model.ent.BaseInClass;
|
||||
import com.rzyc.model.ent.SysEnterprise;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
@ -45,4 +46,21 @@ public class IndustryListController extends BaseController {
|
|||
result.setData(nameList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成企业行业清单(未生成的企业)
|
||||
*
|
||||
* */
|
||||
@ApiOperation(value = "生成企业行业清单(未生成的企业)", notes = "生成企业行业清单(未生成的企业)")
|
||||
@GetMapping("/importInEntList")
|
||||
@ResponseBody
|
||||
public String importInEntList() throws Exception {
|
||||
List<SysEnterprise>enterprises = sysEnterpriseMapper.selectNoEntList();
|
||||
for (SysEnterprise s:enterprises) {
|
||||
saveEntInList(s.getBaseinclassid(),s.getSysenterpriseid());
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -537,6 +537,35 @@ public class PersonalController extends BaseController{
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* 生成企业法人岗位和法人用户(未生产的企业)
|
||||
* @return list
|
||||
* @throws Exception
|
||||
*/
|
||||
@ApiOperation(value = "生成企业法人岗位和法人用户(未生产的企业)", notes = "生成企业法人岗位和法人用户(未生产的企业)")
|
||||
@GetMapping(value = "/generateLegalPersonPostAndUser")
|
||||
@ResponseBody
|
||||
public SingleResult generateLegalPersonPostAndUser()throws Exception{
|
||||
return pcBusinessService.generateLegalPersonPostAndUser();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成企业岗位清单和岗位任务
|
||||
* @return list
|
||||
* @throws Exception
|
||||
*/
|
||||
@ApiOperation(value = "生成企业岗位清单和岗位任务", notes = "生成企业岗位清单和岗位任务")
|
||||
@GetMapping(value = "/generatePostListAndListTask")
|
||||
@ResponseBody
|
||||
public SingleResult generatePostListAndListTask()throws Exception{
|
||||
return pcBusinessService.generatePostListAndListTask();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
|||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
|
@ -326,6 +327,7 @@ public class UploadController extends com.rzyc.controller.BaseController {
|
|||
@ApiOperation(value = "EasyExcel读取企业", notes = "EasyExcel读取企业")
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/readEasyExcelOfEnterprise", method = RequestMethod.GET)
|
||||
@Transactional
|
||||
public String readEasyExcelOfEnterprise(MultipartFile file)throws Exception{
|
||||
pcBusinessService.readEasyExcelOfEnterprise(file);
|
||||
return "success";
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import java.util.*;
|
|||
public class AssignmentTaskThread implements Runnable{
|
||||
|
||||
|
||||
private String entUser;
|
||||
private String entUserId;
|
||||
|
||||
private String enterpriseId;
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ public class AssignmentTaskThread implements Runnable{
|
|||
private EntUserMapper entUserMapper;
|
||||
|
||||
public AssignmentTaskThread(String entUser, String enterpriseId, String postId, EntPostListMapper entPostListMapper, EntPostTaskMapper entPostTaskMapper,InEntListMapper inEntListMapper,String createByUserId,EntUserMapper entUserMapper) {
|
||||
this.entUser = entUser;
|
||||
this.entUserId = entUser;
|
||||
this.enterpriseId = enterpriseId;
|
||||
this.postId = postId;
|
||||
this.entPostListMapper = entPostListMapper;
|
||||
|
|
@ -63,7 +63,7 @@ public class AssignmentTaskThread implements Runnable{
|
|||
public void run() {
|
||||
//插入清单和任务
|
||||
try {
|
||||
autoAssignmentTask(entUser,enterpriseId,postId,createByUserId);
|
||||
autoAssignmentTask(entUserId,enterpriseId,postId,createByUserId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -158,9 +158,8 @@ public class AssignmentTaskThread implements Runnable{
|
|||
ept.setStartTime(start);
|
||||
ept.setEntTime(end);
|
||||
ept.setDelState(DelState.NOT_DEL.getState());
|
||||
ept.setCreateBy(entUser.getName());
|
||||
setCreateByAndModify(ept,entUser);
|
||||
ept.setCreateTime(new Date());
|
||||
ept.setModifyBy(entUser.getName());
|
||||
ept.setModifyTime(new Date());
|
||||
entPostTasks.add(ept);
|
||||
return entPostTasks;
|
||||
|
|
@ -195,9 +194,8 @@ public class AssignmentTaskThread implements Runnable{
|
|||
ept.setStartTime(start);
|
||||
ept.setEntTime(end);
|
||||
ept.setDelState(DelState.NOT_DEL.getState());
|
||||
ept.setCreateBy(entUser.getName());
|
||||
setCreateByAndModify(ept,entUser);
|
||||
ept.setCreateTime(new Date());
|
||||
ept.setModifyBy(entUser.getName());
|
||||
ept.setModifyTime(new Date());
|
||||
entPostTasks.add(ept);
|
||||
}
|
||||
|
|
@ -235,9 +233,8 @@ public class AssignmentTaskThread implements Runnable{
|
|||
ept.setStartTime(start);
|
||||
ept.setEntTime(end);
|
||||
ept.setDelState(DelState.NOT_DEL.getState());
|
||||
ept.setCreateBy(entUser.getName());
|
||||
setCreateByAndModify(ept,entUser);
|
||||
ept.setCreateTime(new Date());
|
||||
ept.setModifyBy(entUser.getName());
|
||||
ept.setModifyTime(new Date());
|
||||
entPostTasks.add(ept);
|
||||
index++;
|
||||
|
|
@ -277,9 +274,8 @@ public class AssignmentTaskThread implements Runnable{
|
|||
ept.setStartTime(start);
|
||||
ept.setEntTime(end);
|
||||
ept.setDelState(DelState.NOT_DEL.getState());
|
||||
ept.setCreateBy(entUser.getName());
|
||||
setCreateByAndModify(ept,entUser);
|
||||
ept.setCreateTime(new Date());
|
||||
ept.setModifyBy(entUser.getName());
|
||||
ept.setModifyTime(new Date());
|
||||
entPostTasks.add(ept);
|
||||
index++;
|
||||
|
|
@ -369,4 +365,14 @@ public class AssignmentTaskThread implements Runnable{
|
|||
}
|
||||
return oaTaskTimes;
|
||||
}
|
||||
|
||||
private void setCreateByAndModify(EntPostTask entPostTask,EntUser entUser){
|
||||
if (null == entUser){
|
||||
entPostTask.setCreateBy("系统导入");
|
||||
entPostTask.setModifyBy("系统导入");
|
||||
}else {
|
||||
entPostTask.setCreateBy(entUser.getName());
|
||||
entPostTask.setModifyBy(entUser.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import com.rzyc.controller.BaseController;
|
|||
import com.rzyc.enums.DelState;
|
||||
import com.rzyc.enums.RedisKeys;
|
||||
import com.rzyc.model.*;
|
||||
import com.rzyc.model.EasyExcel.EasyExcelEnterprise;
|
||||
import com.rzyc.model.EasyExcel.EasyExcelInList;
|
||||
import com.rzyc.model.dto.*;
|
||||
import com.rzyc.model.ent.EntPost;
|
||||
|
|
@ -24,7 +25,9 @@ import com.rzyc.model.dto.SparePartDto;
|
|||
import com.rzyc.model.ent.InEntList;
|
||||
import com.rzyc.model.ent.SysEnterprise;
|
||||
|
||||
import com.rzyc.utils.easyexcel.EntEnterpriseListener;
|
||||
import com.rzyc.utils.easyexcel.InListListener;
|
||||
import org.apache.commons.collections.list.SynchronizedList;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -32,6 +35,8 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
|
@ -45,11 +50,14 @@ import java.util.regex.Pattern;
|
|||
@Service
|
||||
public class PcBusinessService extends BaseController {
|
||||
|
||||
RedisUtil redisUtil;
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
private ThreadPoolExecutor executor;
|
||||
|
||||
@Autowired
|
||||
public PcBusinessService(RedisUtil redisUtil) {
|
||||
public PcBusinessService(RedisUtil redisUtil,ThreadPoolExecutor executor) {
|
||||
this.redisUtil = redisUtil;
|
||||
this.executor = executor;
|
||||
}
|
||||
|
||||
public SingleResult entUserTree(String enterpriseId, String postId){
|
||||
|
|
@ -376,7 +384,11 @@ public class PcBusinessService extends BaseController {
|
|||
entPost.setModifyBy(getUserId());
|
||||
entPost.setModifyTime(new Date());
|
||||
EntPost post = entPostMapper.getParentPost(addOrUpdateEntPostDto.getPostId());
|
||||
entPost.setPostPath(post.getPostPath() + "," + addOrUpdateEntPostDto.getPostId());
|
||||
if (null != post && null != post.getPostPath()){
|
||||
entPost.setPostPath(post.getPostPath() + "," + addOrUpdateEntPostDto.getPostId());
|
||||
}else {
|
||||
entPost.setPostPath(addOrUpdateEntPostDto.getPostId());
|
||||
}
|
||||
result = entPostMapper.updateEntPost(entPost);
|
||||
}else {
|
||||
String uuid = RandomNumber.getUUid();
|
||||
|
|
@ -384,7 +396,11 @@ public class PcBusinessService extends BaseController {
|
|||
entPost.setCreateTime(new Date());
|
||||
entPost.setCreateBy(getUserId());
|
||||
EntPost post = entPostMapper.getParentPost(addOrUpdateEntPostDto.getParentId());
|
||||
entPost.setPostPath(post.getPostPath() + "," + uuid);
|
||||
if (null != post && null != post.getPostPath()){
|
||||
entPost.setPostPath(post.getPostPath() + "," + uuid);
|
||||
}else {
|
||||
entPost.setPostPath(uuid);
|
||||
}
|
||||
result = entPostMapper.insertEntPost(entPost);
|
||||
}
|
||||
if (result != 1 ){
|
||||
|
|
@ -1204,7 +1220,31 @@ public class PcBusinessService extends BaseController {
|
|||
|
||||
public SingleResult readEasyExcelOfEnterprise(MultipartFile file)throws IOException{
|
||||
SingleResult singleResult = new SingleResult();
|
||||
EasyExcel.read(file.getInputStream(), EasyExcelInList.class, new InListListener(inListMapper,inListItemMapper,baseInClassMapper)).doReadAll();
|
||||
EasyExcel.read(file.getInputStream(), EasyExcelEnterprise.class, new EntEnterpriseListener(sysEnterpriseMapper,baseInClassMapper,sysOrgMapper)).doReadAll();
|
||||
return singleResult;
|
||||
}
|
||||
|
||||
public SingleResult generateLegalPersonPostAndUser()throws Exception{
|
||||
SingleResult singleResult = new SingleResult();
|
||||
List<SysEnterprise>sysEnterprises = sysEnterpriseMapper.selectNoLegalPersonPost();
|
||||
CopyOnWriteArrayList copyOnWriteArrayList = new CopyOnWriteArrayList();
|
||||
for (SysEnterprise s:sysEnterprises) {
|
||||
//创建或者修改企业用户
|
||||
String userId = RandomNumber.getUUid();
|
||||
String postId = RandomNumber.getUUid();
|
||||
SaveEntPostAndUserThread SaveEntPostAndUserThread = new SaveEntPostAndUserThread(s.getSysenterpriseid(),getUserId(),entPostMapper,entUserMapper,constantsConfigure,s.getLegalrepre(),s.getLrlinktel(),s.getEntname(),copyOnWriteArrayList,postId,userId);
|
||||
executor.execute(SaveEntPostAndUserThread);
|
||||
}
|
||||
return singleResult;
|
||||
}
|
||||
|
||||
public SingleResult generatePostListAndListTask()throws Exception{
|
||||
SingleResult singleResult = new SingleResult();
|
||||
List<EntUser>selectNoEntPostListUser = entUserMapper.selectNoEntPostListUser();
|
||||
for (EntUser e:selectNoEntPostListUser) {
|
||||
AssignmentTaskThread assignmentTaskThread = new AssignmentTaskThread(e.getEntUserId(),e.getEnterpriseId(),e.getPostId(),entPostListMapper,entPostTaskMapper,inEntListMapper,getUserId(),entUserMapper);
|
||||
executor.execute(assignmentTaskThread);
|
||||
}
|
||||
return singleResult;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
package com.rzyc.service;
|
||||
|
||||
import com.common.utils.RandomNumber;
|
||||
import com.common.utils.copy.ObjectConversion;
|
||||
import com.rzyc.mapper.ent.InEntListMapper;
|
||||
import com.rzyc.mapper.ent.InListItemMapper;
|
||||
import com.rzyc.model.ent.InEntList;
|
||||
import com.rzyc.model.ent.InListItem;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 保存企业清单
|
||||
* @author Xuwanxin
|
||||
* @date 2022/12/21
|
||||
* */
|
||||
public class SaveEntListThread implements Runnable{
|
||||
|
||||
private InListItemMapper inListItemMapper;
|
||||
|
||||
private InEntListMapper inEntListMapper;
|
||||
|
||||
private String userId;
|
||||
|
||||
private String industryId;
|
||||
|
||||
private String companyId;
|
||||
|
||||
public SaveEntListThread(InListItemMapper inListItemMapper, InEntListMapper inEntListMapper, String userId, String industryId, String companyId) {
|
||||
this.inListItemMapper = inListItemMapper;
|
||||
this.inEntListMapper = inEntListMapper;
|
||||
this.userId = userId;
|
||||
this.industryId = industryId;
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
saveEntInList(industryId,companyId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成企业责任清单
|
||||
* @author Xu wanxin
|
||||
* @param industryId
|
||||
* @param companyId
|
||||
* @throws Exception
|
||||
*/
|
||||
public void saveEntInList(String industryId,String companyId)throws Exception{
|
||||
List<InListItem> inListItem = inListItemMapper.SelectContents(industryId,null);
|
||||
List<InEntList> entLists = ObjectConversion.copy(inListItem,InEntList.class);
|
||||
for (InEntList in:entLists) {
|
||||
in.setEnterpriseId(companyId);
|
||||
in.setEntListId(RandomNumber.getUUid());
|
||||
in.setCreateBy(userId);
|
||||
in.setCreateTime(new Date());
|
||||
}
|
||||
int deleteNumber = inEntListMapper.deleteByEnterpriseId(companyId);
|
||||
int result = inEntListMapper.insertList(entLists);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
package com.rzyc.service;
|
||||
|
||||
import com.common.utils.RandomNumber;
|
||||
import com.common.utils.encryption.MD5;
|
||||
import com.rzyc.config.ConstantsConfigure;
|
||||
import com.rzyc.mapper.ent.EntPostMapper;
|
||||
import com.rzyc.mapper.ent.EntUserMapper;
|
||||
import com.rzyc.model.ent.EntPost;
|
||||
import com.rzyc.model.ent.EntUser;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* 创建企业法人岗位和用户
|
||||
* @author Xuwanxin
|
||||
* @date 2022/12/21
|
||||
*
|
||||
* */
|
||||
public class SaveEntPostAndUserThread implements Runnable {
|
||||
|
||||
|
||||
|
||||
private String enterpriseId;
|
||||
|
||||
private String createBy = "系统导入";
|
||||
|
||||
private String legalPerson = "法人";
|
||||
|
||||
private EntPostMapper entPostMapper;
|
||||
|
||||
private EntUserMapper entUserMapper;
|
||||
|
||||
private ConstantsConfigure constantsConfigure;
|
||||
|
||||
private String name;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String entName;
|
||||
|
||||
private CopyOnWriteArrayList copyOnWriteArrayList;
|
||||
|
||||
private String userId;
|
||||
|
||||
private String postId;
|
||||
|
||||
|
||||
public SaveEntPostAndUserThread(String enterpriseId, String createBy, EntPostMapper entPostMapper, EntUserMapper entUserMapper, ConstantsConfigure constantsConfigure,
|
||||
String name, String phone, String entName, CopyOnWriteArrayList copyOnWriteArrayList,String postId,String userId) {
|
||||
this.enterpriseId = enterpriseId;
|
||||
if (null != createBy){
|
||||
this.createBy = createBy;
|
||||
}
|
||||
this.entPostMapper = entPostMapper;
|
||||
this.entUserMapper = entUserMapper;
|
||||
this.constantsConfigure = constantsConfigure;
|
||||
this.name = name;
|
||||
this.phone = phone;
|
||||
this.entName = entName;
|
||||
this.copyOnWriteArrayList = copyOnWriteArrayList;
|
||||
this.postId = postId;
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
save(enterpriseId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void save(String enterpriseId) throws Exception {
|
||||
//存岗位
|
||||
EntPost entPost = new EntPost();
|
||||
entPost.setPostId(postId);
|
||||
entPost.setEnterpriseId(enterpriseId);
|
||||
entPost.setName(legalPerson);
|
||||
entPost.setPostPath(postId);
|
||||
entPost.setCreateBy(createBy);
|
||||
entPost.setCreateTime(new Date());
|
||||
entPostMapper.deletePostOfLegalPerson(legalPerson,enterpriseId);
|
||||
entPostMapper.insertEntPost(entPost);
|
||||
|
||||
//存企业用户
|
||||
EntUser entUser = new EntUser();
|
||||
entUser.setEntUserId(userId);
|
||||
entUser.setPostId(postId);
|
||||
entUser.setEnterpriseId(enterpriseId);
|
||||
if (copyOnWriteArrayList.contains(phone)){
|
||||
entUser.setAccount(entName);
|
||||
}else {
|
||||
entUser.setAccount(phone);
|
||||
}
|
||||
entUser.setName(name);
|
||||
entUser.setMobile(phone);
|
||||
entUser.setPostPath(postId);
|
||||
entUser.setPostPathName(legalPerson);
|
||||
entUser.setCreateBy(createBy);
|
||||
entUser.setCreateTime(new Date());
|
||||
if (null == phone){
|
||||
entUser.setPasswd(MD5.md5(constantsConfigure.getDefaultPasswd()));
|
||||
}else {
|
||||
entUser.setPasswd(MD5.md5(phone));
|
||||
}
|
||||
copyOnWriteArrayList.add(phone);
|
||||
entUserMapper.deleteLegalPerson(legalPerson,enterpriseId);
|
||||
entUserMapper.insert(entUser);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -70,11 +70,10 @@ public class UserDetailsServiceImpl implements UserDetailsService {
|
|||
|
||||
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String name){
|
||||
//判断数据库手机号
|
||||
EntUser entUser = entUserMapper.validMobile(name,null);
|
||||
|
||||
if (Objects.isNull(entUser)){
|
||||
public UserDetails loadUserByUsername(String mobileNumber){
|
||||
//判断用户是否存在
|
||||
EntUser user = entUserMapper.validAccount(mobileNumber,null);
|
||||
if (Objects.isNull(user)){
|
||||
throw new CustomException("用户名不存在");
|
||||
}
|
||||
List<GrantedAuthority> authority= new ArrayList<GrantedAuthority>();
|
||||
|
|
@ -86,7 +85,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
|
|||
authority.add(new SimpleGrantedAuthority(stringBuilder.toString()));
|
||||
stringBuilder.setLength(0);
|
||||
}
|
||||
return new UserDetailsAndId(entUser.getName(), passwordEncoder.encode(entUser.getPasswd()), authority,entUser.getEntUserId(),entUser.getPostId());
|
||||
return new UserDetailsAndId(user.getName(), passwordEncoder.encode(user.getPasswd()), authority,user.getEntUserId(),user.getPostId());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public class UserLoginService {
|
|||
String token = null;
|
||||
UserDetails userDetails = userDetailsService.loadUserByUsername(username);
|
||||
if (Objects.isNull(userDetails)) {
|
||||
throw new CustomException("账号不存在");
|
||||
throw new CustomException("账号不存在,请填入企业名或企业绑定的手机号");
|
||||
}
|
||||
SysEnterprise sysEnterprise = sysEnterpriseMapper.findEnterpriseByPhoneNumber(username);
|
||||
if (Objects.isNull(sysEnterprise) || sysEnterprise.getState().equals(SysEnterpriseState.DISABLE)){
|
||||
|
|
|
|||
|
|
@ -0,0 +1,189 @@
|
|||
package com.rzyc.utils.easyexcel;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.metadata.CellExtra;
|
||||
import com.alibaba.excel.metadata.data.ReadCellData;
|
||||
import com.alibaba.excel.read.listener.ReadListener;
|
||||
import com.alibaba.excel.util.ListUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.common.utils.RandomNumber;
|
||||
import com.common.utils.StringUtils;
|
||||
import com.common.utils.copy.ObjectConversion;
|
||||
import com.mysql.cj.x.protobuf.MysqlxExpr;
|
||||
import com.rzyc.mapper.SysOrgMapper;
|
||||
import com.rzyc.mapper.ent.BaseInClassMapper;
|
||||
import com.rzyc.mapper.ent.InListItemMapper;
|
||||
import com.rzyc.mapper.ent.SysEnterpriseMapper;
|
||||
import com.rzyc.model.EasyExcel.EasyExcelEnterprise;
|
||||
import com.rzyc.model.EasyExcel.EasyExcelInList;
|
||||
import com.rzyc.model.SysOrg;
|
||||
import com.rzyc.model.ent.BaseInClass;
|
||||
import com.rzyc.model.ent.InEntList;
|
||||
import com.rzyc.model.ent.InListItem;
|
||||
import com.rzyc.model.ent.SysEnterprise;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import static com.rzyc.enums.SysOrgCode.GARZE;
|
||||
|
||||
/**
|
||||
* @author Xuwanxin
|
||||
* @date 2022/12/19
|
||||
* */
|
||||
@Slf4j
|
||||
public class EntEnterpriseListener implements ReadListener<EasyExcelEnterprise> {
|
||||
|
||||
private SysEnterpriseMapper sysEnterpriseMapper;
|
||||
|
||||
private BaseInClassMapper baseInClassMapper;
|
||||
|
||||
private SysOrgMapper sysOrgMapper;
|
||||
|
||||
/**
|
||||
* 每隔5条存储数据库,实际使用中可以100条,然后清理list ,方便内存回收
|
||||
*/
|
||||
private static final int BATCH_COUNT = 100;
|
||||
/**
|
||||
* 缓存的数据
|
||||
*/
|
||||
private List<EasyExcelEnterprise> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
||||
|
||||
private List<EasyExcelEnterprise>industryErrorDataList = new ArrayList<>();
|
||||
|
||||
private List<EasyExcelEnterprise>areaErrorDataList = new ArrayList<>();
|
||||
|
||||
private List<EasyExcelEnterprise>repeatErrorDataList = new ArrayList<>();
|
||||
|
||||
|
||||
public EntEnterpriseListener(SysEnterpriseMapper sysEnterpriseMapper, BaseInClassMapper baseInClassMapper,SysOrgMapper sysOrgMapper) {
|
||||
this.sysEnterpriseMapper = sysEnterpriseMapper;
|
||||
this.baseInClassMapper = baseInClassMapper;
|
||||
this.sysOrgMapper = sysOrgMapper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 这个每一条数据解析都会来调用
|
||||
*
|
||||
* @param data one row value. Is is same as {@link AnalysisContext#readRowHolder()}
|
||||
* @param context
|
||||
*/
|
||||
@Override
|
||||
public void invoke(EasyExcelEnterprise data, AnalysisContext context) {
|
||||
log.info("解析到一条数据:{}", JSON.toJSONString(data));
|
||||
BaseInClass industry = null ;
|
||||
SysEnterprise sysEnterprise = sysEnterpriseMapper.selectByName(data.getEntName(),null);
|
||||
if (null == sysEnterprise){
|
||||
SysOrg sysOrg = sysOrgMapper.findByName(data.getOrgName(),null);
|
||||
if (null != sysOrg && null != sysOrg.getParentPath()){
|
||||
String [] orgCode = sysOrg.getParentPath().split(",");
|
||||
List<String> codeList = Arrays.asList(orgCode);
|
||||
//如果是甘孜州下的地区id则存入,否则不存
|
||||
if (codeList.contains(GARZE.getOrgCode())){
|
||||
industry = baseInClassMapper.selectBaseInClassByName(data.getIndustry());
|
||||
if (null == industry){
|
||||
//不存在行业,则归纳到其他行业
|
||||
BaseInClass idy = baseInClassMapper.selectBaseInClassByName("其他行业");
|
||||
cachedDataList.add(saveEnterprise(data,sysOrg,idy));
|
||||
}else {
|
||||
//合格数据
|
||||
cachedDataList.add(saveEnterprise(data,sysOrg,industry));
|
||||
}
|
||||
}else {
|
||||
//地区异常集合保存,方便复查
|
||||
areaErrorDataList.add(data);
|
||||
}
|
||||
}else {
|
||||
//不存在地区则归纳到康定市
|
||||
if (null == industry) {
|
||||
if (null == sysOrg ){
|
||||
SysOrg org = sysOrgMapper.findByName("康定市",null);
|
||||
//不存在行业,则归纳到其他行业
|
||||
BaseInClass idy = baseInClassMapper.selectBaseInClassByName("其他行业");
|
||||
cachedDataList.add(saveEnterprise(data, org, idy));
|
||||
}else {
|
||||
//不存在行业,则归纳到其他行业
|
||||
BaseInClass idy = baseInClassMapper.selectBaseInClassByName("其他行业");
|
||||
cachedDataList.add(saveEnterprise(data, sysOrg, idy));
|
||||
}
|
||||
}else {
|
||||
BaseInClass idy = baseInClassMapper.selectBaseInClassByName(data.getIndustry());
|
||||
SysOrg org = sysOrgMapper.findByName("康定市",null);
|
||||
cachedDataList.add(saveEnterprise(data,org,idy));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
//重复企业名字
|
||||
repeatErrorDataList.add(data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (cachedDataList.size() >= BATCH_COUNT) {
|
||||
saveEntEnterprise();
|
||||
// 存储完成清理 list
|
||||
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Date parse(String date) {
|
||||
if (StringUtils.isEmpty(date)) {
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
return (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).parse(date);
|
||||
} catch (ParseException var2) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//打包
|
||||
public EasyExcelEnterprise saveEnterprise(EasyExcelEnterprise data,SysOrg sysOrg,BaseInClass industry){
|
||||
data.setAreaCode(sysOrg.getOrgcode());
|
||||
data.setAreaPath(sysOrg.getParentPath());
|
||||
data.setAreaName(sysOrg.getParentName());
|
||||
data.setIndustryId(industry.getBaseinclassid());
|
||||
data.setCreatedBy("系统导入");
|
||||
data.setCreatedOn(new Date());
|
||||
data.setSysEnterpriseId(RandomNumber.getUUid());
|
||||
data.setEstablishTime(parse(data.getDateOfIncorporation()));
|
||||
if (null != data.getStaffNumber()){
|
||||
data.setStaffNumber(data.getStaffNumber().replaceAll("[^0-9]", ""));
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有数据解析完成了 都会来调用
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext context) {
|
||||
if (cachedDataList.size()>0){
|
||||
saveEntEnterprise();
|
||||
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
||||
}
|
||||
}
|
||||
|
||||
private void saveEntEnterprise(){
|
||||
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
|
||||
|
||||
log.info("存储数据库成功!");
|
||||
|
||||
if (industryErrorDataList.size()>0 || areaErrorDataList.size() >0 ||repeatErrorDataList.size() >0){
|
||||
System.out.println("err");
|
||||
}
|
||||
//插入企业
|
||||
sysEnterpriseMapper.insertList(cachedDataList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -122,6 +122,10 @@ public class InListListener implements ReadListener<EasyExcelInList> {
|
|||
// 存储完成清理 list
|
||||
queryList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
||||
log.info("所有数据解析完成!");
|
||||
|
||||
saveListItem();
|
||||
// 存储完成清理 list
|
||||
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.rzyc.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.common.utils.*;
|
||||
import com.common.utils.encryption.MD5;
|
||||
|
|
@ -33,11 +32,8 @@ import com.rzyc.model.check.BookEntHT;
|
|||
import com.rzyc.model.check.ChkPerson;
|
||||
import com.rzyc.model.ent.*;
|
||||
import com.rzyc.model.user.*;
|
||||
import com.rzyc.utils.ObjectConversion;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.common.utils.copy.ObjectConversion;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
|
|
@ -482,6 +478,15 @@ public class BaseController {
|
|||
//政府智能预警
|
||||
@Autowired
|
||||
protected GovWarningMapper govWarningMapper;
|
||||
|
||||
//企业岗位
|
||||
@Autowired
|
||||
protected EntPostMapper entPostMapper;
|
||||
|
||||
//企业用户
|
||||
@Autowired
|
||||
protected EntUserMapper entUserMapper;
|
||||
|
||||
/**
|
||||
* 岗位不需要的字符串
|
||||
*/
|
||||
|
|
@ -2727,6 +2732,7 @@ public class BaseController {
|
|||
|
||||
|
||||
/**
|
||||
* 生成企业责任清单
|
||||
* @author Xu wanxin
|
||||
* @param industryId
|
||||
* @param companyId
|
||||
|
|
@ -2740,7 +2746,6 @@ public class BaseController {
|
|||
in.setEntListId(RandomNumber.getUUid());
|
||||
in.setCreateBy(getUserId());
|
||||
in.setCreateTime(new Date());
|
||||
in.setEnterpriseId(companyId);
|
||||
}
|
||||
int result = inEntListMapper.insertList(entLists);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ import com.rzyc.model.user.ListFactor;
|
|||
import com.rzyc.model.user.ListPerform;
|
||||
import com.rzyc.model.user.SysUnit;
|
||||
import com.rzyc.model.user.SysUser;
|
||||
import com.rzyc.service.SaveEntListThread;
|
||||
import com.rzyc.service.SaveEntPostAndUserThread;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
|
@ -46,6 +48,7 @@ import javax.validation.Valid;
|
|||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
@Api(tags = "最小工作单元和小程序")
|
||||
@CrossOrigin("*")
|
||||
|
|
@ -2086,7 +2089,7 @@ public class MinWorkController extends BaseController{
|
|||
* 报错No value specified for Date
|
||||
* */
|
||||
ConvertUtils.register(new DateConverter(null), Date.class);
|
||||
BeanUtils.copyProperties(sysEnterprise,sysEnterpriseDo);
|
||||
org.springframework.beans.BeanUtils.copyProperties(sysEnterpriseDo,sysEnterprise);
|
||||
// sysEnterprise.setWorkClassId(sysEnterprise.getBaseinclassid());
|
||||
sysEnterprise.setBaseinclassid("");
|
||||
String token = servletRequest.getHeader("userToken");
|
||||
|
|
@ -2127,9 +2130,15 @@ public class MinWorkController extends BaseController{
|
|||
//生成最小工作单元
|
||||
saveEntWork(sysEnterprise.getSysenterpriseid());
|
||||
//生成行业对应的企业责任清单
|
||||
saveEntInList(sysEnterprise.getBaseinclassid(),sysEnterprise.getSysenterpriseid());
|
||||
SaveEntListThread saveEntListThread = new SaveEntListThread(inListItemMapper,inEntListMapper,getUserId(),sysEnterprise.getBaseinclassid(),sysEnterprise.getSysenterpriseid());
|
||||
Thread thread = new Thread(saveEntListThread);
|
||||
thread.start();
|
||||
//创建或者修改企业用户
|
||||
createEntUser(sysEnterprise,sysUser.getChinaname(),sysUser);
|
||||
//用于判断手机号重复,单加不影响
|
||||
CopyOnWriteArrayList copyOnWriteArrayList = new CopyOnWriteArrayList();
|
||||
SaveEntPostAndUserThread SaveEntPostAndUserThread = new SaveEntPostAndUserThread(sysEnterprise.getSysenterpriseid(),getUserId(),entPostMapper,entUserMapper,constantsConfigure,sysEnterprise.getLegalrepre(),sysEnterprise.getLrlinktel(),sysEnterprise.getEntname(),copyOnWriteArrayList);
|
||||
Thread t = new Thread(SaveEntPostAndUserThread);
|
||||
t.start();
|
||||
if (result > 0){
|
||||
singleResult.setMessage(Message.SUCCESS);
|
||||
singleResult.setCode(Code.SUCCESS.getCode());
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.rzyc.model.ent.EntPromise;
|
|||
import com.rzyc.model.ent.SysEnterprise;
|
||||
import com.rzyc.model.user.SysUnit;
|
||||
import com.rzyc.model.user.SysUser;
|
||||
import com.rzyc.service.SaveEntListThread;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
|
@ -596,6 +597,12 @@ public class PcCompanyController extends com.rzyc.controller.BaseController {
|
|||
|
||||
//生成最小工作单元
|
||||
saveEntWork(sysEnterprise.getSysenterpriseid());
|
||||
//生成行业对应的企业责任清单
|
||||
SaveEntListThread saveEntListThread = new SaveEntListThread(inListItemMapper,inEntListMapper,getUserId(),sysEnterprise.getBaseinclassid(),sysEnterprise.getSysenterpriseid());
|
||||
Thread thread = new Thread(saveEntListThread);
|
||||
thread.start();
|
||||
//生成法人岗位和法人企业用户
|
||||
|
||||
//生成行业对应的企业责任清单
|
||||
saveEntInList(sysEnterprise.getWorkClassId(),sysEnterprise.getSysenterpriseid());
|
||||
//创建或者修改企业用户
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
package com.rzyc.service;
|
||||
|
||||
import com.common.utils.RandomNumber;
|
||||
import com.common.utils.copy.ObjectConversion;
|
||||
import com.rzyc.mapper.ent.InEntListMapper;
|
||||
import com.rzyc.mapper.ent.InListItemMapper;
|
||||
import com.rzyc.model.ent.InEntList;
|
||||
import com.rzyc.model.ent.InListItem;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 保存企业清单
|
||||
* @author Xuwanxin
|
||||
* @date 2022/12/21
|
||||
* */
|
||||
public class SaveEntListThread implements Runnable{
|
||||
|
||||
private InListItemMapper inListItemMapper;
|
||||
|
||||
private InEntListMapper inEntListMapper;
|
||||
|
||||
private String userId;
|
||||
|
||||
private String industryId;
|
||||
|
||||
private String companyId;
|
||||
|
||||
public SaveEntListThread(InListItemMapper inListItemMapper, InEntListMapper inEntListMapper, String userId, String industryId, String companyId) {
|
||||
this.inListItemMapper = inListItemMapper;
|
||||
this.inEntListMapper = inEntListMapper;
|
||||
this.userId = userId;
|
||||
this.industryId = industryId;
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
saveEntInList(industryId,companyId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成企业责任清单
|
||||
* @author Xu wanxin
|
||||
* @param industryId
|
||||
* @param companyId
|
||||
* @throws Exception
|
||||
*/
|
||||
public void saveEntInList(String industryId,String companyId)throws Exception{
|
||||
List<InListItem> inListItem = inListItemMapper.SelectContents(industryId,null);
|
||||
List<InEntList> entLists = ObjectConversion.copy(inListItem,InEntList.class);
|
||||
for (InEntList in:entLists) {
|
||||
in.setEnterpriseId(companyId);
|
||||
in.setEntListId(RandomNumber.getUUid());
|
||||
in.setCreateBy(userId);
|
||||
in.setCreateTime(new Date());
|
||||
}
|
||||
int deleteNumber = inEntListMapper.deleteByEnterpriseId(companyId);
|
||||
int result = inEntListMapper.insertList(entLists);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
package com.rzyc.service;
|
||||
|
||||
import com.common.utils.RandomNumber;
|
||||
import com.common.utils.encryption.MD5;
|
||||
import com.rzyc.config.ConstantsConfigure;
|
||||
import com.rzyc.mapper.ent.EntPostMapper;
|
||||
import com.rzyc.mapper.ent.EntUserMapper;
|
||||
import com.rzyc.model.ent.EntPost;
|
||||
import com.rzyc.model.ent.EntUser;
|
||||
import com.rzyc.utils.SpringUtil;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* 创建企业法人岗位和用户
|
||||
* @author Xuwanxin
|
||||
* @date 2022/12/21
|
||||
*
|
||||
* */
|
||||
public class SaveEntPostAndUserThread implements Runnable {
|
||||
|
||||
|
||||
|
||||
private String enterpriseId;
|
||||
|
||||
private String createBy = "系统导入";
|
||||
|
||||
private String legalPerson = "法人";
|
||||
|
||||
private EntPostMapper entPostMapper;
|
||||
|
||||
private EntUserMapper entUserMapper;
|
||||
|
||||
private ConstantsConfigure constantsConfigure;
|
||||
|
||||
private String name;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String entName;
|
||||
|
||||
private CopyOnWriteArrayList copyOnWriteArrayList;
|
||||
|
||||
|
||||
public SaveEntPostAndUserThread(String enterpriseId, String createBy, EntPostMapper entPostMapper, EntUserMapper entUserMapper, ConstantsConfigure constantsConfigure, String name, String phone, String entName, CopyOnWriteArrayList copyOnWriteArrayList) {
|
||||
this.enterpriseId = enterpriseId;
|
||||
if (null != createBy){
|
||||
this.createBy = createBy;
|
||||
}
|
||||
this.entPostMapper = entPostMapper;
|
||||
this.entUserMapper = entUserMapper;
|
||||
this.constantsConfigure = constantsConfigure;
|
||||
this.name = name;
|
||||
this.phone = phone;
|
||||
this.entName = entName;
|
||||
this.copyOnWriteArrayList = copyOnWriteArrayList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
save(enterpriseId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void save(String enterpriseId) throws Exception {
|
||||
//存岗位
|
||||
EntPost entPost = new EntPost();
|
||||
String postId = RandomNumber.getUUid();
|
||||
entPost.setPostId(postId);
|
||||
entPost.setEnterpriseId(enterpriseId);
|
||||
entPost.setName(legalPerson);
|
||||
entPost.setPostPath(postId);
|
||||
entPost.setCreateBy(createBy);
|
||||
entPost.setCreateTime(new Date());
|
||||
entPostMapper.deletePostOfLegalPerson(legalPerson,enterpriseId);
|
||||
entPostMapper.insertEntPost(entPost);
|
||||
|
||||
//存企业用户
|
||||
EntUser entUser = new EntUser();
|
||||
String userId = RandomNumber.getUUid();
|
||||
entUser.setEntUserId(userId);
|
||||
entUser.setPostId(postId);
|
||||
entUser.setEnterpriseId(enterpriseId);
|
||||
if (copyOnWriteArrayList.contains(phone)){
|
||||
entUser.setAccount(entName);
|
||||
}else {
|
||||
entUser.setAccount(phone);
|
||||
}
|
||||
entUser.setName(name);
|
||||
entUser.setMobile(phone);
|
||||
entUser.setPostPath(postId);
|
||||
entUser.setPostPathName(legalPerson);
|
||||
entUser.setCreateBy(createBy);
|
||||
entUser.setCreateTime(new Date());
|
||||
if (null == phone){
|
||||
entUser.setPasswd(MD5.md5(constantsConfigure.getDefaultPasswd()));
|
||||
}else {
|
||||
entUser.setPasswd(MD5.md5(phone));
|
||||
}
|
||||
copyOnWriteArrayList.add(phone);
|
||||
entUserMapper.deleteLegalPerson(legalPerson,enterpriseId);
|
||||
entUserMapper.insert(entUser);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.rzyc.utils;
|
||||
package com.common.utils.copy;
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user