导入企业 导入企业法人岗位及用户 岗位清单 岗位任务

This commit is contained in:
79493 2022-12-29 18:02:27 +08:00
parent aaea59af89
commit f38739bab3
13 changed files with 329 additions and 8 deletions

View File

@ -27,4 +27,28 @@ public interface EntPostDutyMapper extends BaseMapper<EntPostDuty> {
* */
List<EntPostDuty>selectEntUserPostDuty(@Param("enterpriseId") String enterpriseId, @Param("postId")String postId);
/**
* 企业岗位职责List插入
* @param list
* @return list
* */
int insertList(@Param("list") List<EntPostDuty>list);
/**
* 删除企业清单
* @param postId
* @return int
* */
int deleteByPostId(String postId);
/**
* 修改企业岗位职责
* @param entPostDuty
* @return int
* */
int updatePostDuty(EntPostDuty entPostDuty);
}

View File

@ -61,4 +61,11 @@ public interface EntPostMapper extends BaseMapper<EntPost> {
* */
int deletePostOfLegalPerson(@Param("legalPerson") String legalPerson,@Param("enterpriseId")String enterpriseId);
/**
* 查询没有岗位职责的岗位
* @return list
* */
List<EntPost>selectNoDutyPost();
}

View File

@ -1,10 +1,13 @@
package com.rzyc.model.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* 企业用户证件照Dto
@ -18,9 +21,85 @@ public class EntUserPostDutyDto {
@ApiModelProperty(value = "企业id",required = true)
private String enterpriseId;
@ApiModelProperty(value = "主键")
@TableId
private String dutyId;
@TableField("post_id")
@ApiModelProperty(value = "岗位id")
private String postId;
@TableField("duty_item")
@ApiModelProperty(value = "职责内容")
private String dutyItem;
@TableField("sort_id")
@ApiModelProperty(value = "排序")
private Integer sortId;
private String createBy;
private String modifyBy;
private Date createTime;
private Date modifyTime;
public String getDutyId() {
return dutyId;
}
public void setDutyId(String dutyId) {
this.dutyId = dutyId;
}
public String getDutyItem() {
return dutyItem;
}
public void setDutyItem(String dutyItem) {
this.dutyItem = dutyItem;
}
public Integer getSortId() {
return sortId;
}
public void setSortId(Integer sortId) {
this.sortId = sortId;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public String getModifyBy() {
return modifyBy;
}
public void setModifyBy(String modifyBy) {
this.modifyBy = modifyBy;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
@ApiModelProperty(value = "页码")
private Integer page;

View File

@ -1,6 +1,7 @@
package com.rzyc.model.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
@ -16,15 +17,15 @@ public class InListDto {
private String listId;
@ApiModelProperty(value = "清单名")
@TableId("name")
@TableField("name")
private String name;
@ApiModelProperty(value = "清单排序")
@TableId("sort_id")
@TableField("sort_id")
private Integer sortId;
@ApiModelProperty(value = "删除状态 1正常 2已删除")
@TableId("del_state")
@TableField("del_state")
private Integer delState;
public String getListId() {

View File

@ -20,8 +20,32 @@
duty_id, post_id, duty_item, sort_id, enterprise_id, create_time, create_by, modify_time, modify_by
</sql>
<update id="updatePostDuty">
update ent_post_duty set post_id = #{postId},dutyItem = #{dutyItem},sort_id = #{sortId},enterprise_id = #{enterpriseId},modify_by = #{modifyBy},modify_time = #{modifyTime}
where duty_id = #{dutyId}
</update>
<select id="selectEntUserPostDuty" resultMap="BaseResultMap">
select * from ent_post_duty where enterprise_id = #{enterpriseId} and post_id = #{postId}
</select>
<insert id="insertList">
insert into ent_post_duty (duty_id,post_id,duty_item,sort_id,enterprise_id,create_time,create_by) values
<foreach collection="list" item="list" separator=",">
(#{list.dutyId},
#{list.postId},
#{list.dutyItem},
#{list.sortId},
#{list.enterpriseId},
#{list.createTime},
#{list.createBy})
</foreach>
</insert>
<delete id="deleteByPostId">
delete from ent_post_duty where post_id = #{postId}
</delete>
</mapper>

View File

@ -50,8 +50,13 @@
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>
<select id="selectNoDutyPost" resultType="com.rzyc.model.ent.EntPost">
select ep.* from ent_post ep left join ent_post_duty epd on epd.post_id = ep.post_id where epd.duty_id is null
</select>
</mapper>

View File

@ -33,7 +33,7 @@
<select id="selectByEnterpriseId" resultMap="BaseResultMap">
select * from in_ent_list where enterprise_id = #{enterpriseId}
select * from in_ent_list where enterprise_id = #{enterpriseId} and del_state = 1
</select>
<insert id="insertList">

View File

@ -438,6 +438,7 @@
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.rzyc.model.ent.SysEnterprise">
update SysEnterprise
<set>
@ -2584,5 +2585,42 @@
select sysent.EntName,sysent.state,sysent.SysEnterpriseId,sysent.EntName from ent_user eu left join sysenterprise sysent on eu.enterprise_id = sysent.SysEnterpriseId where eu.mobile = #{entUserPhone}
</select>
<insert id="insertList">
insert into sysenterprise (SysEnterpriseId,EntName,OrgPassNo,area_code,area_path,area_name,SysAddress,work_class_id,LegalRepre,LRLinkTel,
SafeManager,SafeTelephone,PersonCount,EstablishDate,ManageType,IsHide,`State`,CreatedOn,CreatedBy)values
<foreach collection="list" item="list" separator=",">
(#{list.SysEnterpriseId},
#{list.EntName},
#{list.OrgPassNo},
#{list.areaCode},
#{list.areaPath},
#{list.areaName},
#{list.address},
#{list.industryId},
#{list.legalPerson},
#{list.legalPersonPhone},
#{list.safeChangePerson},
#{list.safeChangePersonPhone},
#{list.staffNumber},
#{list.establishTime},
#{list.businessScope},
'否',
'启用',
#{list.CreatedOn},
#{list.CreatedBy})
</foreach>
</insert>
<select id="selectNoEntList" resultType="com.rzyc.model.ent.SysEnterprise">
select s.BaseInClassId,s.SysEnterpriseId from sysenterprise s left join in_ent_list iel on s.SysEnterpriseId = iel.enterprise_id where iel.ent_list_id is null
</select>
<select id="selectNoLegalPersonPost" resultType="com.rzyc.model.ent.SysEnterprise">
select s.SysEnterpriseId,s.LegalRepre,s.LRLinkTel,s.EntName
from sysenterprise s
left join ent_post ep on s.SysEnterpriseId = ep.enterprise_id and ep.name = '法人'
where ep.post_id is null
</select>
</mapper>

View File

@ -562,9 +562,33 @@ public class PersonalController extends BaseController{
return pcBusinessService.generatePostListAndListTask();
}
/**
* 生成企业岗位职责
* @return list
* @throws Exception
*/
@ApiOperation(value = "生成企业岗位职责", notes = "生成企业岗位职责")
@GetMapping(value = "/generatePostDuty")
@ResponseBody
public SingleResult generatePostDuty()throws Exception{
return pcBusinessService.generatePostDuty();
}
/**
* 新增企业岗位职责
* @return
* @throws Exception
* */
@ApiOperation(value = "新增企业岗位职责", notes = "新增企业岗位职责")
@PostMapping(value = "/addEntPostDuty")
@ApiImplicitParams({
@ApiImplicitParam(name = "dutyId", value = "岗位职责id",required = false, dataType = "string")
})
@ResponseBody
public SingleResult addOrUpdateEntPostDuty(EntUserPostDutyDto duty)throws Exception{
return pcBusinessService.addOrUpdateEntPostDuty(duty);
}

View File

@ -63,7 +63,10 @@ public class AssignmentTaskThread implements Runnable{
public void run() {
//插入清单和任务
try {
//公共的企业清单
autoAssignmentTask(entUserId,enterpriseId,postId,createByUserId);
//对应岗位的履职清单
// autoAssignmentTaskOfPost(entUserId,enterpriseId,postId,createByUserId);
} catch (Exception e) {
e.printStackTrace();
}
@ -73,6 +76,7 @@ public class AssignmentTaskThread implements Runnable{
public void autoAssignmentTask(String userId,String enterpriseId,String postId,String createByUserId) throws Exception {
entPostListMapper.deleteEntPostList(userId);
entPostTaskMapper.deleteEntPostTaskList(userId);
//企业公共的清单
List<InEntList> inEntLists = inEntListMapper.selectByEnterpriseId(enterpriseId);
for (InEntList ie:inEntLists) {
AddOrUpdateEntUserPostListDto addOrUpdateEntUserPostTaskDto = new AddOrUpdateEntUserPostListDto();

View File

@ -0,0 +1,58 @@
package com.rzyc.service;
import com.common.utils.RandomNumber;
import com.rzyc.mapper.EntPostDutyMapper;
import com.rzyc.mapper.ent.InEntListMapper;
import com.rzyc.model.EntPostDuty;
import com.rzyc.model.ent.EntPost;
import com.rzyc.model.ent.InEntList;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 插入企业岗位职责
* @author xuwanxin
* @date 2022/12/22
* */
public class EntPostDutyThread implements Runnable{
private InEntListMapper inEntListMapper;
private EntPostDutyMapper entPostDutyMapper;
private List<EntPost>posts;
public EntPostDutyThread(InEntListMapper inEntListMapper, EntPostDutyMapper entPostDutyMapper,List<EntPost>posts) {
this.inEntListMapper = inEntListMapper;
this.entPostDutyMapper = entPostDutyMapper;
this.posts = posts;
}
@Override
public void run() {
List<EntPostDuty> duties = new ArrayList<>();
for (EntPost e:posts) {
List<InEntList> list = inEntListMapper.selectByEnterpriseId(e.getEnterpriseId());
for (InEntList s:list) {
EntPostDuty entPostDuty = new EntPostDuty();
entPostDuty.setDutyId(RandomNumber.getUUid());
entPostDuty.setPostId(e.getPostId());
entPostDuty.setDutyItem(s.getItemContent());
entPostDuty.setSortId(s.getSortId());
entPostDuty.setEnterpriseId(s.getEnterpriseId());
entPostDuty.setCreateBy("系统导入");
entPostDuty.setCreateTime(new Date());
duties.add(entPostDuty);
}
if (duties.size() > 0){
entPostDutyMapper.insertList(duties);
duties.clear();
}else {
System.out.println("err");
}
}
}
}

View File

@ -415,6 +415,23 @@ public class PcBusinessService extends BaseController {
singleResult.setData(posts);
//存redis
boolean insertRedisResult = redisUtil.set(redisUtil.appendSymbol(RedisKeys.DEVICE.getKey(),addOrUpdateEntPostDto.getEnterpriseId()),posts,0);
//生成岗位职责(企业全体员工都涉及的)
List<InEntList>list = inEntListMapper.selectByEnterpriseId(entPost.getEnterpriseId());
List<EntPostDuty> duties = new ArrayList<>();
for (InEntList s:list) {
EntPostDuty entPostDuty = new EntPostDuty();
entPostDuty.setDutyId(RandomNumber.getUUid());
entPostDuty.setPostId(entPost.getPostId());
entPostDuty.setDutyItem(s.getItemContent());
entPostDuty.setSortId(s.getSortId());
entPostDuty.setEnterpriseId(s.getEnterpriseId());
entPostDuty.setCreateBy(getUserId());
entPostDuty.setCreateTime(new Date());
duties.add(entPostDuty);
}
entPostDutyMapper.deleteByPostId(entPost.getPostId());
entPostDutyMapper.insertList(duties);
return singleResult;
}
@ -1232,7 +1249,9 @@ public class PcBusinessService extends BaseController {
//创建或者修改企业用户
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);
SaveEntPostAndUserThread SaveEntPostAndUserThread = new SaveEntPostAndUserThread(s.getSysenterpriseid(),getUserId(),entPostMapper,entUserMapper,constantsConfigure,s.getLegalrepre(),
s.getLrlinktel(),s.getEntname(),copyOnWriteArrayList,postId,userId);
executor.execute(SaveEntPostAndUserThread);
}
return singleResult;
@ -1248,4 +1267,33 @@ public class PcBusinessService extends BaseController {
return singleResult;
}
public SingleResult generatePostDuty(){
SingleResult singleResult = new SingleResult();
List<EntPost>posts = entPostMapper.selectNoDutyPost();
EntPostDutyThread entPostDutyThread = new EntPostDutyThread(inEntListMapper,entPostDutyMapper,posts);
executor.execute(entPostDutyThread);
return singleResult;
}
public SingleResult addOrUpdateEntPostDuty(EntUserPostDutyDto duty) throws Exception {
EntPostDuty entPostDuty = new EntPostDuty();
BeanUtils.copyProperties(duty,entPostDuty);
SingleResult singleResult = new SingleResult();
int result = 0;
if (null == duty){
entPostDuty.setCreateTime(new Date());
entPostDuty.setCreateBy(getUserId());
result = entPostDutyMapper.insert(entPostDuty);
}else {
entPostDuty.setModifyBy(getUserId());
entPostDuty.setModifyTime(new Date());
result = entPostDutyMapper.updatePostDuty(entPostDuty);
}
if (result <= 0){
singleResult.setCode(Code.ERROR.getCode());
singleResult.setMessage(Message.ERROR);
}
return singleResult;
}
}

View File

@ -3,12 +3,18 @@ package com.rzyc.service;
import com.common.utils.RandomNumber;
import com.common.utils.encryption.MD5;
import com.rzyc.config.ConstantsConfigure;
import com.rzyc.mapper.EntPostDutyMapper;
import com.rzyc.mapper.ent.EntPostMapper;
import com.rzyc.mapper.ent.EntUserMapper;
import com.rzyc.mapper.ent.InEntListMapper;
import com.rzyc.model.EntPostDuty;
import com.rzyc.model.ent.EntPost;
import com.rzyc.model.ent.EntUser;
import com.rzyc.model.ent.InEntList;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
/**
@ -46,8 +52,10 @@ public class SaveEntPostAndUserThread implements Runnable {
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) {
String name, String phone, String entName, CopyOnWriteArrayList copyOnWriteArrayList, String postId, String userId) {
this.enterpriseId = enterpriseId;
if (null != createBy){
this.createBy = createBy;
@ -85,6 +93,7 @@ public class SaveEntPostAndUserThread implements Runnable {
entPostMapper.deletePostOfLegalPerson(legalPerson,enterpriseId);
entPostMapper.insertEntPost(entPost);
//存企业用户
EntUser entUser = new EntUser();
entUser.setEntUserId(userId);