禅道BUG修改-部分功能接口

This commit is contained in:
79493 2023-03-24 17:11:55 +08:00
parent 0f3de011a3
commit 7d8017705b
35 changed files with 1161 additions and 81 deletions

View File

@ -3,6 +3,8 @@ package com.rzyc.bean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@Api("新增企业参数类")
public class SysEnterpriseDo {
private String sysenterpriseid;
@ -59,7 +61,7 @@ public class SysEnterpriseDo {
@ApiModelProperty("安全管理人员联系方式")
private String safeTelephone;
@ApiModelProperty("从业人员")
private String personcount;
private Integer personcount;
@ApiModelProperty("主管部门id")
private String managerDept;
@ApiModelProperty("管理部门")
@ -83,7 +85,7 @@ public class SysEnterpriseDo {
@ApiModelProperty("用户id")
private String userId;
private String establishdate;
private Date establishdate;
@ApiModelProperty("企业简介")
private String comments;
@ -112,11 +114,11 @@ public class SysEnterpriseDo {
this.workClassId = workClassId;
}
public String getEstablishdate() {
public Date getEstablishdate() {
return establishdate;
}
public void setEstablishdate(String establishdate) {
public void setEstablishdate(Date establishdate) {
this.establishdate = establishdate;
}
@ -272,11 +274,11 @@ public class SysEnterpriseDo {
this.safeTelephone = safeTelephone;
}
public String getPersoncount() {
public Integer getPersoncount() {
return personcount;
}
public void setPersoncount(String personcount) {
public void setPersoncount(Integer personcount) {
this.personcount = personcount;
}

View File

@ -0,0 +1,21 @@
package com.rzyc.enums;
public enum PostListType {
LIST_TYPE_IS(1),
LIST_TYPE_NO(2);
private Integer type;
PostListType(Integer type) {
this.type = type;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
}

View File

@ -54,7 +54,7 @@ public interface EntPostListMapper extends BaseMapper<EntPostList> {
/**
* 企业清单(类型)分组查询
* 企业清单(类型)分组查询公共
* @param enterpriseId 企业id
* @param listId 清单id
* @param userId 用户id
@ -62,6 +62,16 @@ public interface EntPostListMapper extends BaseMapper<EntPostList> {
*/
List<EntPostList>selectEntListGroupByListId(@Param("enterpriseId") String enterpriseId,@Param("listId")String listId,@Param("userId")String userId);
/**
* 企业清单(类型)分组查询岗位
* @param enterpriseId 企业id
* @param listId 清单id
* @param userId 用户id
* @return int 企业清单(类型)
*/
List<EntPostList>selectEntListGroupByPostListId(@Param("enterpriseId") String enterpriseId,@Param("listId")String listId,@Param("userId")String userId);
/**
* 删除企业用户岗位清单
@ -69,4 +79,13 @@ public interface EntPostListMapper extends BaseMapper<EntPostList> {
* @return int
*/
Integer deleteEntPostList(String entUserId);
/**
* 修改清单完成状态
* @param listId
* @param finishState
* @return int
*/
Integer updateFishState(@Param("listId") String listId,@Param("finishState")Integer finishState);
}

View File

@ -41,10 +41,11 @@ public interface RkSourcesMapper extends BaseMapper<RkSources> {
/**
* 危险源统计
* @param orgCode
* @param industryId
* @return RkSources
* */
List<RkSourceStatistic> sourcesEntStatistic(@Param("industryId") String industryId);
List<RkSourceStatistic> sourcesEntStatistic(@Param("industryId") String industryId,@Param("orgCode")String orgCode);
/**

View File

@ -20,7 +20,7 @@ import java.util.List;
public interface InEntListMapper extends BaseMapper<InEntList> {
/**
* 查询企业清单类型
* 查询企业清单类型(不查询出企业岗位的清单)
* @param enterpriseId 企业id
* @return list
* */

View File

@ -19,7 +19,8 @@ import java.util.List;
@Repository
public interface InListItemMapper extends BaseMapper<InListItem> {
List<InListItem> selectContents(@Param("industryId") String industryId, @Param("listId")String listId);
List<InListItem> selectContents(@Param("industryId") String industryId, @Param("listId")String listId,@Param("postList")Integer postList);
/*通过行业查询清单信息*/
List<InListItem> findByIndustryId(@Param("industryId") String industryId);

View File

@ -32,6 +32,9 @@ public class InPost implements Serializable {
this.publicPostLevel = publicPostLevel;
}
public InPost() {
}
@ApiModelProperty(value = "主键")
@TableId("public_post_id")
private String publicPostId;

View File

@ -7,7 +7,7 @@ package com.rzyc.model;
*/
public class RkSourceStatistic {
private String riskTypeCount;
private Integer riskTypeCount;
private long entCount;
@ -29,11 +29,11 @@ public class RkSourceStatistic {
this.industryClassName = industryClassName;
}
public String getRiskTypeCount() {
public Integer getRiskTypeCount() {
return riskTypeCount;
}
public void setRiskTypeCount(String riskTypeCount) {
public void setRiskTypeCount(Integer riskTypeCount) {
this.riskTypeCount = riskTypeCount;
}

View File

@ -52,6 +52,17 @@ public class InListItemAddDto {
@ApiModelProperty(value = "清单法律法规")
private String itemLaw;
@ApiModelProperty(value = "1.是岗位 2.是公共")
private Integer postList;
public Integer getPostList() {
return postList;
}
public void setPostList(Integer postList) {
this.postList = postList;
}
public String getItemTitle() {
return itemTitle;

View File

@ -0,0 +1,75 @@
package com.rzyc.model.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* @author Xuwanxin
* @date 2023/3/22
* */
public class InPostDto {
@ApiModelProperty(value = "岗位名")
@TableField("public_post_name")
private String publicPostName;
@ApiModelProperty(value = "岗位路径")
@TableField("public_post_path")
private String publicPostPath;
@ApiModelProperty(value = "岗位层级")
@TableField("public_post_level")
private Integer publicPostLevel = 1;
@ApiModelProperty("行业id")
@TableField("industry_id")
private String industryId;
@ApiModelProperty("行业名")
@TableField("industry_name")
private String industryName;
public String getIndustryName() {
return industryName;
}
public void setIndustryName(String industryName) {
this.industryName = industryName;
}
public String getPublicPostName() {
return publicPostName;
}
public void setPublicPostName(String publicPostName) {
this.publicPostName = publicPostName;
}
public String getPublicPostPath() {
return publicPostPath;
}
public void setPublicPostPath(String publicPostPath) {
this.publicPostPath = publicPostPath;
}
public Integer getPublicPostLevel() {
return publicPostLevel;
}
public void setPublicPostLevel(Integer publicPostLevel) {
this.publicPostLevel = publicPostLevel;
}
public String getIndustryId() {
return industryId;
}
public void setIndustryId(String industryId) {
this.industryId = industryId;
}
}

View File

@ -0,0 +1,98 @@
package com.rzyc.model.dto;
import io.swagger.annotations.ApiModelProperty;
/**
* @author Xuwanxin
* @date 2023/3/22
*
* */
public class InPostItemDto {
@ApiModelProperty(value = "公共岗位id")
private String postId;
@ApiModelProperty(value = "行业id")
private String industryId;
@ApiModelProperty("清单id")
private String itemId;
@ApiModelProperty(value = "清单标题")
private String itemTitle;
@ApiModelProperty(value = "清单内容")
private String itemContent;
@ApiModelProperty(value = "考核指标 1:每年 2每半年 4每季度 12:每月")
private Integer standard;
@ApiModelProperty(value = "频率")
private Integer frequency;
private Integer postList;
public Integer getPostList() {
return postList;
}
public void setPostList(Integer postList) {
this.postList = postList;
}
public String getPostId() {
return postId;
}
public void setPostId(String postId) {
this.postId = postId;
}
public String getIndustryId() {
return industryId;
}
public void setIndustryId(String industryId) {
this.industryId = industryId;
}
public String getItemId() {
return itemId;
}
public void setItemId(String itemId) {
this.itemId = itemId;
}
public String getItemTitle() {
return itemTitle;
}
public void setItemTitle(String itemTitle) {
this.itemTitle = itemTitle;
}
public String getItemContent() {
return itemContent;
}
public void setItemContent(String itemContent) {
this.itemContent = itemContent;
}
public Integer getStandard() {
return standard;
}
public void setStandard(Integer standard) {
this.standard = standard;
}
public Integer getFrequency() {
return frequency;
}
public void setFrequency(Integer frequency) {
this.frequency = frequency;
}
}

View File

@ -0,0 +1,97 @@
package com.rzyc.model.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
public class InPostListDto {
@ApiModelProperty(value = "岗位履职清单id")
@TableId("public_post_list_id")
private String publicPostListId;
@ApiModelProperty(value = "岗位id")
@TableField("public_post_id")
private String publicPostId;
@ApiModelProperty(value = "清单标题")
@TableField("public_item_title")
private String publicItemTitle;
@ApiModelProperty(value = "清单内容")
@TableField("public_item_content")
private String publicItemContent;
@ApiModelProperty(value = "排序")
@TableField("sort_id")
private Integer sortId;
@ApiModelProperty(value = "考核指标 1:每年 2每半年 4每季度 12:每月")
@TableField("standard")
private Integer standard;
@ApiModelProperty(value = "频率")
@TableField("frequency")
private Integer frequency;
public String getPublicPostListId() {
return publicPostListId;
}
public void setPublicPostListId(String publicPostListId) {
this.publicPostListId = publicPostListId;
}
public String getPublicPostId() {
return publicPostId;
}
public void setPublicPostId(String publicPostId) {
this.publicPostId = publicPostId;
}
public String getPublicItemTitle() {
return publicItemTitle;
}
public void setPublicItemTitle(String publicItemTitle) {
this.publicItemTitle = publicItemTitle;
}
public String getPublicItemContent() {
return publicItemContent;
}
public void setPublicItemContent(String publicItemContent) {
this.publicItemContent = publicItemContent;
}
public Integer getSortId() {
return sortId;
}
public void setSortId(Integer sortId) {
this.sortId = sortId;
}
public Integer getStandard() {
return standard;
}
public void setStandard(Integer standard) {
this.standard = standard;
}
public Integer getFrequency() {
return frequency;
}
public void setFrequency(Integer frequency) {
this.frequency = frequency;
}
}

View File

@ -81,7 +81,7 @@ public class EntPost implements Serializable {
private List<EntPost>children;
@ApiModelProperty(value = "公共岗位id")
@TableField(exist = false)
@TableField(exist = true)
private String publicPostId;
public String getPublicPostId() {

View File

@ -90,6 +90,17 @@ public class InListItem implements Serializable {
@TableField("modify_by")
private String modifyBy;
@ApiModelProperty(value = "1.是岗位 2.是公共")
@TableField("post_list")
private Integer postList;
public Integer getPostList() {
return postList;
}
public void setPostList(Integer postList) {
this.postList = postList;
}
public String getItemTitle() {
return itemTitle;

View File

@ -32,6 +32,10 @@
post_list_id, post_id, ent_user_id, enterprise_id, ent_list_id, list_id, item_title, item_content, sort_id, year_num, standard, frequency, finish_state, red_alert, yellow_alert, del_state, create_time, create_by, modify_time, modify_by
</sql>
<update id="updateFishState">
update ent_post_list set finish_state = #{finishState} where post_list_id = #{listId}
</update>
<delete id="deleteEntPostList">
delete from ent_post_list where ent_user_id = #{entUserId}
</delete>
@ -84,7 +88,7 @@
from ent_post_list epl
left join ent_post_task ept on epl.post_list_id = ept.ent_list_id
left join in_list il on epl.list_id = il.list_id
where epl.enterprise_id = #{enterpriseId}
where epl.enterprise_id = #{enterpriseId} and il.name is not null
<if test="null != userId and '' != userId">
and epl.ent_user_id = #{userId}
</if>
@ -93,6 +97,20 @@
</if>
group by il.list_id
</select>
<select id="selectEntListGroupByPostListId" resultType="com.rzyc.model.EntPostList">
select epl.list_id,ipi.in_list as item_title,count(ept.task_id)as totalTaskNumber,sum(case when task_state = 1 then 1 else 0 end)as haveInHand
from ent_post_list epl
left join ent_post_task ept on epl.post_list_id = ept.ent_list_id
left join in_post_item ipi on epl.list_id = ipi.in_post_item_id
where epl.enterprise_id = #{enterpriseId} and ipi.in_list is not null
<if test="null != userId and '' != userId">
and epl.ent_user_id = #{userId}
</if>
<if test="null != listId and '' != listId">
and epl.list_id = #{listId}
</if>
group by ipi.in_post_item_id
</select>
</mapper>

View File

@ -106,6 +106,9 @@
<if test="null != industryId and '' != industryId">
and rs.base_inclass_id = #{industryId}
</if>
<if test="null != orgCode and '' != orgCode">
and se.area_code = #{orgCode}
</if>
group by rs.base_inclass_id
</select>

View File

@ -47,6 +47,9 @@ item_basis, item_proof, item_law, sort_id, del_state,create_time, create_by, mod
<select id="selectContents" resultMap="BaseResultMap">
select * from in_list_item where del_state = 1
<if test="null != postList and '' != postList">
and post_list = #{postList}
</if>
<if test="null != industryId and '' != industryId">
and industry_id = #{industryId}
</if>

View File

@ -636,7 +636,7 @@
LegalRepre = #{legalrepre,jdbcType=VARCHAR},
LRIDCard = #{lridcard,jdbcType=VARCHAR},
LRLinkTel = #{lrlinktel,jdbcType=VARCHAR},
EstablishDate = #{establishdate,jdbcType=TIMESTAMP},
EstablishDate = #{establishdate},
RiskLevel = #{risklevel,jdbcType=VARCHAR},
Latitude = #{latitude,jdbcType=VARCHAR},
Longitude = #{longitude,jdbcType=VARCHAR},

View File

@ -1945,7 +1945,7 @@ public class BaseController {
* @throws Exception
*/
public void saveEntInList(String industryId,String companyId)throws Exception{
List<InListItem> inListItem = inListItemMapper.selectContents(industryId,null);
List<InListItem> inListItem = inListItemMapper.selectContents(industryId,null,PostListType.LIST_TYPE_IS.getType());
List<InEntList> entLists = ObjectConversion.copy(inListItem,InEntList.class);
if(null != entLists && entLists.size()>0){
for (InEntList in:entLists) {

View File

@ -1,18 +1,32 @@
package com.rzyc.controller;
import com.alibaba.fastjson.JSONArray;
import com.common.utils.RandomNumber;
import com.common.utils.StringUtils;
import com.common.utils.jwt.JwtUtil;
import com.common.utils.model.Code;
import com.common.utils.model.Message;
import com.common.utils.model.SingleResult;
import com.rzyc.model.check.BookEntCheck;
import com.rzyc.model.check.BookEntHT;
import com.rzyc.bean.ChkGovBillDo;
import com.rzyc.model.check.*;
import com.rzyc.model.ent.EntBillCon;
import com.rzyc.model.user.SysUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* @author dong
* @date 2022-09-28 15:30
@ -98,4 +112,7 @@ public class PcCheckController extends BaseController{
}
return singleResult;
}
}

View File

@ -21,6 +21,7 @@ import com.rzyc.config.MethodAnnotation;
import com.rzyc.model.Accident;
import com.rzyc.model.DangerStatistic;
import com.rzyc.model.EntCertificates;
import com.rzyc.model.SysOrg;
import com.rzyc.model.check.*;
import com.rzyc.model.ent.EntBillCon;
import com.rzyc.model.ent.InEntList;
@ -104,6 +105,7 @@ public class PcCompanyController extends BaseController{
sysEnterprises.get(0).setInClassName(JSONArray.toJSONString(incClass));
sysEnterprises.get(0).setSafeClassName(JSONArray.toJSONString(safeClass));
sysEnterprises.get(0).setWorkClassName(JSONArray.toJSONString(incClass));
sysEnterprises.get(0).setIndustryClassName(JSONArray.toJSONString(incClass));
String orgName = sysEnterprises.get(0).getOrgName();
if(StringUtils.isNotBlank(sysEnterprises.get(0).getStreetName())){
@ -547,6 +549,9 @@ public class PcCompanyController extends BaseController{
singleResult.setCode(Code.ERROR.getCode());
return singleResult;
}
getEntAreaCode(sysEnterpriseDo.getAreaCode(),sysEnterprise);
sysEnterprise.setCreatedon(new Date());
sysEnterprise.setModifiedon(new Date());
sysEnterprise.setSysenterpriseid(RandomNumber.getUUid());
@ -568,6 +573,8 @@ public class PcCompanyController extends BaseController{
sysEnterprise.setQrCode(entQrCode(sysEnterprise.getSysenterpriseid()));
}
getEntAreaCode(sysEnterpriseDo.getAreaCode(),sysEnterprise);
sysEnterprise.setModifiedon(new Date());
result = sysEnterpriseMapper.updateByPrimaryKey(sysEnterprise);
@ -1023,6 +1030,25 @@ public class PcCompanyController extends BaseController{
return singleResult;
}
/**
* 处理企业地区信息
* @version v1.0
* @author dong
* @date 2022/11/1 14:40
*/
public void getEntAreaCode(String areaCode,SysEnterprise enterprise)throws Exception{
if(StringUtils.isNotBlank(areaCode)){
SysOrg sysOrg = sysOrgMapper.selectById(areaCode);
if(null != sysOrg){
enterprise.setAreaCode(areaCode);
enterprise.setAreaPath(sysOrg.getParentPath());
enterprise.setAreaName(sysOrg.getParentName());
}
}
}

View File

@ -887,7 +887,11 @@ public class PcBusinessService extends BaseController {
public SingleResult entListGroupByListId(String enterpriseId,String listId,String userId){
SingleResult singleResult = new SingleResult();
List<EntPostList> list = entPostListMapper.selectEntListGroupByListId(enterpriseId,listId,userId);
List<EntPostList> list = new ArrayList<>();
List<EntPostList> listList = entPostListMapper.selectEntListGroupByListId(enterpriseId,listId,userId);
List<EntPostList> listPost = entPostListMapper.selectEntListGroupByPostListId(enterpriseId,listId,userId);
list.addAll(listList);
list.addAll(listPost);
singleResult.setData(list);
return singleResult;
}
@ -1221,8 +1225,9 @@ public class PcBusinessService extends BaseController {
//判断任务是否完成完成则修改为完成状态
if (null != entPostListDetailDto.getEntPostTaskId()){
EntPostTask entPostTask = entPostTaskMapper.verifyCompletion(entPostListDetailDto.getEntPostTaskId());
if (entPostTask.getNumberOfDutyPerformance().equals(entPostTask.getFrequency())){
if (entPostTask.getNumberOfDutyPerformance() > entPostTask.getFrequency()){
entPostTaskMapper.updateTaskState(entPostListDetailDto.getEntPostTaskId());
entPostListMapper.updateFishState(entPostListDetailDto.getListFactorId(),2);
}
}
return singleResult;

View File

@ -53,7 +53,7 @@ public class SaveEntListThread implements Runnable{
* @throws Exception
*/
public void saveEntInList(String industryId,String companyId)throws Exception{
List<InListItem> inListItem = inListItemMapper.selectContents(industryId,null);
List<InListItem> inListItem = inListItemMapper.selectContents(industryId,null,null);
List<InEntList> entLists = ObjectConversion.copy(inListItem,InEntList.class);
for (InEntList in:entLists) {
in.setEnterpriseId(companyId);

View File

@ -113,7 +113,7 @@ public class SaveIndustryPostThread implements Runnable {
InPostItem inPostItems = inPostItemMapper.selectByPostId(i.getPublicPostId());
//批量插入企业岗位职责
List<InListItem> list = inListItemMapper.selectContents(null,inPostItems.getInPostItemId());
List<InListItem> list = inListItemMapper.selectContents(null,inPostItems.getInPostItemId(),null);
for (InListItem ili:list) {
addEntPostDuty(ili,i.getUuid(),sysEnterpriseId);
}

View File

@ -544,6 +544,10 @@ public class BaseController {
@Autowired
protected RkCompanyDiagnosisMapper rkCompanyDiagnosisMapper;
//企业履职清单
@Autowired
protected EntPostListMapper entPostListMapper;
/**
* 岗位不需要的字符串
@ -2392,7 +2396,12 @@ public class BaseController {
private List<OATask> getMonthTask(ListFactor listFactor,String sysUserId)throws Exception{
List<OATask> oaTasks = new ArrayList<>();
List<OaTaskTime> taskTimes = this.getTaskTime(listFactor.getCheckstandard());
Integer year = Calendar.getInstance().get(Calendar.YEAR);
Integer year = null;
if (StringUtils.isBlank(listFactor.getSysyear())){
year = Calendar.getInstance().get(Calendar.YEAR);
}else {
year = Integer.parseInt(listFactor.getSysyear());
}
Integer index = 1;
for (OaTaskTime taskTime : taskTimes){
OATask oaTask = new OATask();
@ -2426,7 +2435,12 @@ public class BaseController {
private List<OATask> getQuarterTask(ListFactor listFactor,String sysUserId)throws Exception{
List<OATask> oaTasks = new ArrayList<>();
List<OaTaskTime> taskTimes = this.getTaskTime(listFactor.getCheckstandard());
Integer year = Calendar.getInstance().get(Calendar.YEAR);
Integer year = null;
if (StringUtils.isBlank(listFactor.getSysyear())){
year = Calendar.getInstance().get(Calendar.YEAR);
}else {
year = Integer.parseInt(listFactor.getSysyear());
}
Integer index = 1;
for (OaTaskTime taskTime : taskTimes){
OATask oaTask = new OATask();
@ -2460,7 +2474,12 @@ public class BaseController {
private List<OATask> getYearTask(ListFactor listFactor,String sysUserId)throws Exception{
List<OATask> oaTasks = new ArrayList<>();
OATask oaTask = new OATask();
Integer year = Calendar.getInstance().get(Calendar.YEAR);
Integer year = null;
if (StringUtils.isBlank(listFactor.getSysyear())){
year = Calendar.getInstance().get(Calendar.YEAR);
}else {
year = Integer.parseInt(listFactor.getSysyear());
}
String startTime = year + "-01-01 00:00:01";
String endTime = year + "-12-31 23:59:59";
String subject = year+"年工作任务:"+listFactor.getFactorcnt();
@ -2491,7 +2510,12 @@ public class BaseController {
private List<OATask> getHalfYearTask(ListFactor listFactor,String sysUserId)throws Exception{
List<OATask> oaTasks = new ArrayList<>();
List<OaTaskTime> taskTimes = this.getTaskTime(listFactor.getCheckstandard());
Integer year = Calendar.getInstance().get(Calendar.YEAR);
Integer year = null;
if (StringUtils.isBlank(listFactor.getSysyear())){
year = Calendar.getInstance().get(Calendar.YEAR);
}else {
year = Integer.parseInt(listFactor.getSysyear());
}
for (OaTaskTime taskTime : taskTimes){
OATask oaTask = new OATask();
String subject = year+"年工作任务:"+listFactor.getFactorcnt();
@ -2879,7 +2903,7 @@ public class BaseController {
* @throws Exception
*/
public void saveEntInList(String industryId,String companyId)throws Exception{
List<InListItem> inListItem = inListItemMapper.selectContents(industryId,null);
List<InListItem> inListItem = inListItemMapper.selectContents(industryId,null,null);
List<InEntList> entLists = ObjectConversion.copy(inListItem,InEntList.class);
for (InEntList in:entLists) {
in.setEnterpriseId(companyId);

View File

@ -673,9 +673,9 @@ public class BigdataController extends com.rzyc.controller.BaseController {
@ApiOperation(value = "企业重大危险源统计", notes = "企业重大危险源统计")
@GetMapping("/sourcesEntStatistic")
@ResponseBody
public SingleResult<List<RkSourceStatistic>> sourcesEntStatistic(String industryId) throws Exception {
public SingleResult<List<RkSourceStatistic>> sourcesEntStatistic(String industryId,String orgCode) throws Exception {
SingleResult<List<RkSourceStatistic>> result = new SingleResult<>();
List<RkSourceStatistic>source = rkSourcesMapper.sourcesEntStatistic(industryId);
List<RkSourceStatistic>source = rkSourcesMapper.sourcesEntStatistic(industryId,orgCode);
result.setData(source);
return result;
}

View File

@ -7,6 +7,7 @@ import com.common.utils.StringUtils;
import com.common.utils.model.*;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.rzyc.enums.PostListType;
import com.rzyc.model.InPost;
import com.rzyc.model.InPostItem;
import com.rzyc.model.InPostList;
@ -117,7 +118,7 @@ public class IndustryListController extends BaseController{
SingleResult<Pager<String>> result = new SingleResult<>();
Pager<String> pager = new Pager<>();
PageHelper.startPage(inListPageDto.getPage(),inListPageDto.getPageSize());
Page<InListItem> page = (Page<InListItem>)inListItemMapper.selectContents(inListPageDto.getIndustryId(),inListPageDto.getListId());
Page<InListItem> page = (Page<InListItem>)inListItemMapper.selectContents(inListPageDto.getIndustryId(),inListPageDto.getListId(),null);
getDatePage(pager,page);
result.setData(pager);
return result;
@ -222,6 +223,102 @@ public class IndustryListController extends BaseController{
return pcBusinessService.selectByIndustryId(industryId);
}
/**
* 添加行业公共岗位
* @param inpostDto
* @return
*/
@ApiOperation(value = "添加行业公共岗位", notes = "添加行业公共岗位")
@PostMapping("/addIndustryPost")
@ResponseBody
@Transactional
public SingleResult<InPost> addIndustryPost(@RequestBody InPostDto inpostDto)throws Exception{
return pcBusinessService.addIndustryPost(inpostDto);
}
/**
* 新增或修改清单项责任(岗位)
* @param InPostItemDto
* @return
*/
@ApiOperation(value = "新增或修改清单项责任(岗位)", notes = "新增或修改清单项责任(岗位)")
@PostMapping("/insertInListItemOnPostDuty")
@ResponseBody
public SingleResult<String> insertInListItemOnPostDuty(@Valid @RequestBody InPostItemDto InPostItemDto)throws Exception{
SingleResult<String> result = new SingleResult<>();
InPostItem inPostItem = inPostItemMapper.selectByPostId(InPostItemDto.getPostId());
InListItem inListItem = new InListItem();
BeanUtils.copyProperties(InPostItemDto,inListItem);
//清单id
inListItem.setListId(inPostItem.getInPostItemId());
if(null == inPostItem || null == inPostItem.getInPostItemId()){
result.setCode(0);
result.setMessage("清单不存在");
return result;
}
if(StringUtils.isBlank(inListItem.getItemId())){
//id为空就新增数据
inListItem.setItemId(RandomNumber.getUUid());
inListItem.setCreateTime(new Date());
inListItem.setCreateBy(getUserId());
inListItem.setDelState(1);
inListItemMapper.insert(inListItem);
}else {
//TODO修改id如何传入传谁问题
//不为空就修改
inListItem.setModifyTime(new Date());
inListItem.setModifyBy(getUserId());
//inListItem.setIndustryId(baseInClass.getBaseinclassid());
inListItemMapper.updateById(inListItem);
}
return result;
}
/**
* 新增或修改清单项履职(岗位)
* @param inPostListDto
* @return
*/
@ApiOperation(value = "新增或修改清单项履职(岗位)", notes = "新增或修改清单项履职(岗位)")
@PostMapping("/insertInListItemOnPostTask")
@ResponseBody
public SingleResult<String> insertInListItemOnPostTask(@Valid @RequestBody InPostListDto inPostListDto)throws Exception{
SingleResult<String> result = new SingleResult<>();
InPostItem inPostItem = inPostItemMapper.selectByPostId(inPostListDto.getPublicPostId());
InPostList inPostList = new InPostList();
BeanUtils.copyProperties(inPostListDto,inPostList);
inPostList.setListId(inPostItem.getInPostItemId());
if (StringUtils.isBlank(inPostListDto.getPublicPostListId())){
inPostList.setCreateTime(new Date());
inPostList.setCreateBy(getUserId());
inPostList.setPublicPostListId(RandomNumber.getUUid());
inPostListMapper.insert(inPostList);
}else {
inPostList.setModifyTime(new Date());
inPostList.setModifyBy(getUserId());
inPostListMapper.updateById(inPostList);
}
return result;
}
/**
* 删除岗位履职清单项
* @param keyId
* @return
*/
@ApiOperation(value = "删除岗位履职清单项", notes = "删除岗位履职清单项")
@PostMapping("/deleteListItemOnPost")
@ResponseBody
public SingleResult<String> deleteListItemOnPost(String keyId)throws Exception{
SingleResult<String> singleResult = new SingleResult<>();
int result = inPostListMapper.deleteById(keyId);
if (result != 1){
singleResult.setMessage(Message.ERROR);
singleResult.setCode(Code.ERROR.getCode());
}
return singleResult;
}
/**
* 读取行业公共岗位责任清单
@ -250,6 +347,8 @@ public class IndustryListController extends BaseController{
return pcBusinessService.getIndustryPostListTask(page,pageSize,industryId,inPostItem.getInPostItemId());
}
/**
* 将行业公共岗位的履职清单和岗位职责插入到对应企业
* @return
@ -259,7 +358,7 @@ public class IndustryListController extends BaseController{
@ResponseBody
@Transactional
public String insertEntDutyAndEntList()throws Exception{
SaveIndustryPostThread saveIndustryPost = new SaveIndustryPostThread(null,null,inPostMapper,inPostItemMapper,inPostListMapper,inListItemMapper,sysEnterpriseMapper,entPostMapper, entPostDutyMapper);
SaveIndustryPostThread saveIndustryPost = new SaveIndustryPostThread(null,null,inPostMapper,inPostItemMapper,inPostListMapper,inListItemMapper,sysEnterpriseMapper,entPostMapper, entPostDutyMapper,true);
Thread thread = new Thread(saveIndustryPost);
thread.start();
return "success";

View File

@ -27,6 +27,7 @@ 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.AssignmentTaskThread;
import com.rzyc.service.SaveEntListThread;
import com.rzyc.service.SaveEntPostAndUserThread;
import com.rzyc.service.SaveIndustryPostThread;
@ -2173,8 +2174,7 @@ public class MinWorkController extends BaseController{
@PostMapping("/addOrUpdateCompany")
@ResponseBody
@Transactional
public SingleResult<SysEnterpriseDo> addCompany(@Valid @RequestBody SysEnterpriseDo sysEnterpriseDo, HttpServletRequest servletRequest)throws Exception {
SingleResult singleResult = new SingleResult();
public SingleResult<SysEnterpriseDo> addCompany(@Valid @RequestBody SysEnterpriseDo sysEnterpriseDo, HttpServletRequest servletRequest)throws Exception { SingleResult singleResult = new SingleResult();
SysEnterprise sysEnterprise = new SysEnterprise();
/**
* .异常出现原因
@ -2183,8 +2183,6 @@ public class MinWorkController extends BaseController{
* */
ConvertUtils.register(new DateConverter(null), Date.class);
org.springframework.beans.BeanUtils.copyProperties(sysEnterpriseDo,sysEnterprise);
// sysEnterprise.setWorkClassId(sysEnterprise.getBaseinclassid());
sysEnterprise.setBaseinclassid("");
String token = servletRequest.getHeader("userToken");
String userId = JwtUtil.getTokenMsg(token);
if (StringUtils.isBlank(userId)){
@ -2201,19 +2199,21 @@ public class MinWorkController extends BaseController{
singleResult.setCode(Code.ERROR.getCode());
return singleResult;
}
getEntAreaCode(sysEnterpriseDo.getAreaCode(),sysEnterprise);
sysEnterprise.setCreatedon(new Date());
sysEnterprise.setModifiedon(new Date());
sysEnterprise.setSysenterpriseid(RandomNumber.getUUid());
sysEnterprise.setDynamicRiskLevel("100");//新建企业默认100分数
sysEnterprise.setQrCode(entQrCode(sysEnterprise.getSysenterpriseid()));
result = sysEnterpriseMapper.insert(sysEnterprise);
sysEnterpriseMapper.insert(sysEnterprise);
//创建多个行业岗位
SaveIndustryPostThread saveIndustryPost = new SaveIndustryPostThread(null,null,inPostMapper,inPostItemMapper,inPostListMapper,inListItemMapper,sysEnterpriseMapper,entPostMapper, entPostDutyMapper);
SaveIndustryPostThread saveIndustryPost = new SaveIndustryPostThread(sysEnterprise.getWorkClassId(),sysEnterprise.getSysenterpriseid(),inPostMapper,inPostItemMapper,inPostListMapper,inListItemMapper,sysEnterpriseMapper,entPostMapper, entPostDutyMapper,false);
Thread saveIndustryPostThread = new Thread(saveIndustryPost);
saveIndustryPostThread.start();
}else {
SysEnterprise verifyEnterprise = sysEnterpriseMapper.selectByName(sysEnterpriseDo.getEntname(),sysEnterpriseDo.getSysenterpriseid());
if (null != verifyEnterprise){
@ -2221,22 +2221,41 @@ public class MinWorkController extends BaseController{
singleResult.setCode(Code.ERROR.getCode());
return singleResult;
}
//如果二维码为空 则生成新的二维码
SysEnterprise enterprise = sysEnterpriseMapper.selectByPrimaryKey(sysEnterprise.getSysenterpriseid());
if(StringUtils.isBlank(enterprise.getQrCode())){
sysEnterprise.setQrCode(entQrCode(sysEnterprise.getSysenterpriseid()));
}
getEntAreaCode(sysEnterpriseDo.getAreaCode(),sysEnterprise);
sysEnterprise.setModifiedon(new Date());
result = sysEnterpriseMapper.changeEntWork(sysEnterprise);
sysEnterpriseMapper.updateByPrimaryKey(sysEnterprise);
}
//生成最小工作单元
saveEntWork(sysEnterprise.getSysenterpriseid());
//生成行业对应的企业责任清单
SaveEntListThread saveEntListThread = new SaveEntListThread(inListItemMapper,inEntListMapper,getUserId(),sysEnterprise.getBaseinclassid(),sysEnterprise.getSysenterpriseid());
//生成行业对应的企业责任清单不包括岗位的清单只包括行业公共
SaveEntListThread saveEntListThread = new SaveEntListThread(inListItemMapper,inEntListMapper,getUserId(),sysEnterprise.getWorkClassId(),sysEnterprise.getSysenterpriseid());
Thread thread = new Thread(saveEntListThread);
thread.start();
//创建法人账号用于判断手机号重复单加不影响
//创建法人账号用于判断手机号重复单加不影响没有生成履职清单和工作职责
CopyOnWriteArrayList copyOnWriteArrayList = new CopyOnWriteArrayList();
SaveEntPostAndUserThread SaveEntPostAndUserThread = new SaveEntPostAndUserThread(sysEnterprise.getSysenterpriseid(),getUserId(),entPostMapper,entUserMapper,constantsConfigure,sysEnterprise.getLegalrepre(),sysEnterprise.getLrlinktel(),sysEnterprise.getEntname(),copyOnWriteArrayList);
String entUserId = RandomNumber.getUUid();
String postId = RandomNumber.getUUid();
SaveEntPostAndUserThread SaveEntPostAndUserThread = new SaveEntPostAndUserThread(sysEnterprise.getSysenterpriseid(),getUserId(),sysEnterprise.getWorkClassId(),entPostMapper,entUserMapper,constantsConfigure,sysEnterprise.getLegalrepre(),sysEnterprise.getLrlinktel(),sysEnterprise.getEntname(),entUserId,postId,copyOnWriteArrayList,inListMapper,inListItemMapper,entPostDutyMapper);
Thread t = new Thread(SaveEntPostAndUserThread);
//法人履职清单和履职任务
AssignmentTaskThread textThread = new AssignmentTaskThread(entUserId,sysEnterprise.getSysenterpriseid(),postId,entPostListMapper,entPostTaskMapper,inEntListMapper,getUserId(),inPostListMapper,inPostItemMapper,entUserMapper,entPostMapper);
Thread ttThread=new Thread(textThread);
ttThread.start();
t.start();
if (result > 0){
singleResult.setMessage(Message.SUCCESS);
singleResult.setCode(Code.SUCCESS.getCode());
@ -2244,8 +2263,8 @@ public class MinWorkController extends BaseController{
singleResult.setMessage(Message.ERROR);
singleResult.setCode(Code.ERROR.getCode());
}
return singleResult;
}
/**
@ -2327,5 +2346,20 @@ public class MinWorkController extends BaseController{
return result;
}
/**
* 处理企业地区信息
* @version v1.0
* @author dong
* @date 2022/11/1 14:40
*/
public void getEntAreaCode(String areaCode,SysEnterprise enterprise)throws Exception{
if(StringUtils.isNotBlank(areaCode)){
SysOrg sysOrg = sysOrgMapper.selectById(areaCode);
if(null != sysOrg){
enterprise.setAreaCode(areaCode);
enterprise.setAreaPath(sysOrg.getParentPath());
enterprise.setAreaName(sysOrg.getParentName());
}
}
}
}

View File

@ -1146,4 +1146,6 @@ public class PcCheckController extends com.rzyc.controller.BaseController {
result.setData(notice);
return result;
}
}

View File

@ -22,6 +22,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.AssignmentTaskThread;
import com.rzyc.service.SaveEntListThread;
import com.rzyc.service.SaveEntPostAndUserThread;
import com.rzyc.service.SaveIndustryPostThread;
@ -248,6 +249,7 @@ public class PcCompanyController extends com.rzyc.controller.BaseController {
sysEnterprises.get(0).setInClassName(JSONArray.toJSONString(incClass));
sysEnterprises.get(0).setSafeClassName(JSONArray.toJSONString(safeClass));
sysEnterprises.get(0).setWorkClassName(JSONArray.toJSONString(incClass));
sysEnterprises.get(0).setIndustryClassName(JSONArray.toJSONString(incClass));
String orgName = sysEnterprises.get(0).getOrgName();
if(StringUtils.isNotBlank(sysEnterprises.get(0).getStreetName())){
@ -657,10 +659,10 @@ public class PcCompanyController extends com.rzyc.controller.BaseController {
sysEnterprise.setSysenterpriseid(RandomNumber.getUUid());
sysEnterprise.setDynamicRiskLevel("100");//新建企业默认100分数
sysEnterprise.setQrCode(entQrCode(sysEnterprise.getSysenterpriseid()));
sysEnterpriseMapper.insert(sysEnterprise);
result=sysEnterpriseMapper.insert(sysEnterprise);
//创建多个行业岗位
SaveIndustryPostThread saveIndustryPost = new SaveIndustryPostThread(null,null,inPostMapper,inPostItemMapper,inPostListMapper,inListItemMapper,sysEnterpriseMapper,entPostMapper, entPostDutyMapper);
SaveIndustryPostThread saveIndustryPost = new SaveIndustryPostThread(sysEnterprise.getWorkClassId(),sysEnterprise.getSysenterpriseid(),inPostMapper,inPostItemMapper,inPostListMapper,inListItemMapper,sysEnterpriseMapper,entPostMapper, entPostDutyMapper,false);
Thread saveIndustryPostThread = new Thread(saveIndustryPost);
saveIndustryPostThread.start();
}else {
@ -680,40 +682,31 @@ public class PcCompanyController extends com.rzyc.controller.BaseController {
getEntAreaCode(sysEnterpriseDo.getAreaCode(),sysEnterprise);
sysEnterprise.setModifiedon(new Date());
sysEnterpriseMapper.updateByPrimaryKey(sysEnterprise);
result=sysEnterpriseMapper.updateByPrimaryKey(sysEnterprise);
}
/** 注释时间2023/2/2 xuwanxin
* //生成最小工作单元
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());
//创建或者修改企业用户
createEntUser(sysEnterprise,sysUser.getChinaname(),sysUser);
//生成清单
handleEntList(sysEnterprise.getSysenterpriseid());*/
//生成最小工作单元
saveEntWork(sysEnterprise.getSysenterpriseid());
//生成行业对应的企业责任清单
SaveEntListThread saveEntListThread = new SaveEntListThread(inListItemMapper,inEntListMapper,getUserId(),sysEnterprise.getBaseinclassid(),sysEnterprise.getSysenterpriseid());
//生成行业对应的企业责任清单不包括岗位的清单只包括行业公共
SaveEntListThread saveEntListThread = new SaveEntListThread(inListItemMapper,inEntListMapper,getUserId(),sysEnterprise.getWorkClassId(),sysEnterprise.getSysenterpriseid());
Thread thread = new Thread(saveEntListThread);
thread.start();
//创建法人账号用于判断手机号重复单加不影响
//创建法人账号用于判断手机号重复单加不影响没有生成履职清单和工作职责
CopyOnWriteArrayList copyOnWriteArrayList = new CopyOnWriteArrayList();
SaveEntPostAndUserThread SaveEntPostAndUserThread = new SaveEntPostAndUserThread(sysEnterprise.getSysenterpriseid(),getUserId(),entPostMapper,entUserMapper,constantsConfigure,sysEnterprise.getLegalrepre(),sysEnterprise.getLrlinktel(),sysEnterprise.getEntname(),copyOnWriteArrayList);
String entUserId = RandomNumber.getUUid();
String postId = RandomNumber.getUUid();
SaveEntPostAndUserThread SaveEntPostAndUserThread = new SaveEntPostAndUserThread(sysEnterprise.getSysenterpriseid(),getUserId(),sysEnterprise.getWorkClassId(),entPostMapper,entUserMapper,constantsConfigure,sysEnterprise.getLegalrepre(),sysEnterprise.getLrlinktel(),sysEnterprise.getEntname(),entUserId,postId,copyOnWriteArrayList,inListMapper,inListItemMapper,entPostDutyMapper);
Thread t = new Thread(SaveEntPostAndUserThread);
//法人履职清单和履职任务
AssignmentTaskThread textThread = new AssignmentTaskThread(entUserId,sysEnterprise.getSysenterpriseid(),postId,entPostListMapper,entPostTaskMapper,inEntListMapper,getUserId(),inPostListMapper,inPostItemMapper,entUserMapper,entPostMapper);
Thread ttThread=new Thread(textThread);
ttThread.start();
t.start();
if (result > 0){
singleResult.setMessage(Message.SUCCESS);
singleResult.setCode(Code.SUCCESS.getCode());
@ -1303,4 +1296,7 @@ public class PcCompanyController extends com.rzyc.controller.BaseController {
}

View File

@ -0,0 +1,397 @@
package com.rzyc.service;
import com.common.utils.Constants;
import com.common.utils.DateUtils;
import com.common.utils.RandomNumber;
import com.common.utils.model.Code;
import com.common.utils.model.Message;
import com.common.utils.model.SingleResult;
import com.rzyc.bean.OaTaskTime;
import com.rzyc.enums.DelState;
import com.rzyc.mapper.EntPostListMapper;
import com.rzyc.mapper.EntPostTaskMapper;
import com.rzyc.mapper.InPostItemMapper;
import com.rzyc.mapper.InPostListMapper;
import com.rzyc.mapper.ent.EntPostMapper;
import com.rzyc.mapper.ent.EntUserMapper;
import com.rzyc.mapper.ent.InEntListMapper;
import com.rzyc.model.EntPostList;
import com.rzyc.model.EntPostTask;
import com.rzyc.model.InPostItem;
import com.rzyc.model.InPostList;
import com.rzyc.model.dto.AddOrUpdateEntUserPostListDto;
import com.rzyc.model.ent.EntPost;
import com.rzyc.model.ent.EntUser;
import com.rzyc.model.ent.InEntList;
import org.springframework.beans.BeanUtils;
import java.util.*;
/**
* 企业移动端业务 Service
* @author Xuwanxin
* @date 2022/12/8
* */
public class AssignmentTaskThread implements Runnable{
private String entUserId;
private String enterpriseId;
private String postId;
private String createByUserId;
private EntPostListMapper entPostListMapper;
private EntPostTaskMapper entPostTaskMapper;
private InEntListMapper inEntListMapper;
private EntUserMapper entUserMapper;
private InPostListMapper inPostListMapper;
private InPostItemMapper inPostItemMapper;
private EntPostMapper entPostMapper;
public AssignmentTaskThread(String entUser, String enterpriseId, String postId, EntPostListMapper entPostListMapper, EntPostTaskMapper entPostTaskMapper,
InEntListMapper inEntListMapper, String createByUserId, InPostListMapper inPostListMapper, InPostItemMapper inPostItemMapper, EntUserMapper entUserMapper, EntPostMapper entPostMapper) {
this.entUserId = entUser;
this.enterpriseId = enterpriseId;
this.postId = postId;
this.entPostListMapper = entPostListMapper;
this.entPostTaskMapper = entPostTaskMapper;
this.inEntListMapper = inEntListMapper;
this.createByUserId = createByUserId;
this.entUserMapper = entUserMapper;
this.inPostListMapper = inPostListMapper;
this.inPostItemMapper = inPostItemMapper;
this.entPostMapper = entPostMapper;
}
@Override
public void run() {
//插入清单和任务
try {
//公共的企业清单
autoAssignmentTask(entUserId,enterpriseId,postId,createByUserId);
//对应岗位的履职清单
// autoAssignmentTaskOfPost(entUserId,enterpriseId,postId,createByUserId);
} catch (Exception e) {
e.printStackTrace();
}
}
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();
addOrUpdateEntUserPostTaskDto.setEntUserId(userId);
addOrUpdateEntUserPostTaskDto.setEnterpriseId(enterpriseId);
addOrUpdateEntUserPostTaskDto.setPostId(postId);
addOrUpdateEntUserPostTaskDto.setEntListId(ie.getEntListId());
addOrUpdateEntUserPostTaskDto.setFrequency(ie.getFrequency());
addOrUpdateEntUserPostTaskDto.setItemContent(ie.getItemContent());
addOrUpdateEntUserPostTaskDto.setItemTitle(ie.getItemTitle());
addOrUpdateEntUserPostTaskDto.setListId(ie.getListId());
addOrUpdateEntUserPostTaskDto.setStandard(ie.getStandard());
insertListAndTask(addOrUpdateEntUserPostTaskDto,createByUserId);
}
//企业对应岗位的清单这里是法人不需要岗位履职
}
private SingleResult insertListAndTask(AddOrUpdateEntUserPostListDto addOrUpdateEntUserPostTaskDto,String createByUserId) throws Exception {
EntPostList entPostList = new EntPostList();
SingleResult singleResult = new SingleResult();
BeanUtils.copyProperties(addOrUpdateEntUserPostTaskDto,entPostList);
entPostList.setCreateBy(createByUserId);
entPostList.setCreateTime(new Date());
entPostList.setDelState(DelState.NOT_DEL.getState());
entPostList.setPostListId(RandomNumber.getUUid());
int result = entPostListMapper.insert(entPostList);
if (result != 1 ){
singleResult.setCode(Code.ERROR.getCode());
singleResult.setMessage(Message.ERROR);
}
//插入任务
addFactorTask(entPostList,createByUserId);
return singleResult;
}
/**
* 创建岗位任务
* @param entPostList
* @throws Exception
*/
public void addFactorTask(EntPostList entPostList,String entUserId)throws Exception{
//任务列表
List<EntPostTask> entTasks = new ArrayList<>();
if(1 == entPostList.getStandard()){
entTasks = this.getYearTask(entPostList,entUserId);
}else if(2 == entPostList.getStandard()){
entTasks = this.getHalfYearTask(entPostList,entUserId);
}else if(4 == entPostList.getStandard()){
entTasks = this.getQuarterTask(entPostList,entUserId);
}else if(12 == entPostList.getStandard()){
entTasks = this.getMonthTask(entPostList,entUserId);
}
if(null != entTasks && entTasks.size() > 0){
entPostTaskMapper.insertList(entTasks);
}
}
/**
* 获取年任务信息
* @return
* @throws Exception
*/
private List<EntPostTask> getYearTask(EntPostList entPostList, String entUserId)throws Exception{
List<EntPostTask> entPostTasks = new ArrayList<>();
EntPostTask ept = new EntPostTask();
EntUser entUser = entUserMapper.selectById(entUserId);
Integer year = Calendar.getInstance().get(Calendar.YEAR);
String startTime = year + "-01-01 00:00:01";
String endTime = year + "-12-31 23:59:59";
String subject = year+"年工作任务:"+entPostList.getItemTitle();
ept.setItemTitle(subject);
ept.setFrequency(entPostList.getFrequency());
ept.setTaskState(1);
ept.setEnterpriseId(entPostList.getEnterpriseId());
ept.setItemContent(entPostList.getItemContent());
ept.setPostId(entPostList.getPostId());
ept.setEntUserId(entPostList.getEntUserId());
ept.setListId(entPostList.getListId());
ept.setPostListId(entPostList.getPostListId());
ept.setEntListId(entPostList.getPostListId());
ept.setTaskId(RandomNumber.getUUid());
Date start = DateUtils.parseString2Date(startTime, Constants.DATA);
Date end = DateUtils.parseString2Date(endTime,Constants.DATA);
ept.setStartTime(start);
ept.setEntTime(end);
ept.setDelState(DelState.NOT_DEL.getState());
setCreateByAndModify(ept,entUser);
ept.setCreateTime(new Date());
ept.setModifyTime(new Date());
entPostTasks.add(ept);
return entPostTasks;
}
/**
* 获取半年任务信息
* @return
* @throws Exception
*/
private List<EntPostTask> getHalfYearTask(EntPostList entPostList,String entUserId)throws Exception{
List<EntPostTask> entPostTasks = new ArrayList<>();
List<OaTaskTime> taskTimes = this.getTaskTime(entPostList.getStandard());
Integer year = Calendar.getInstance().get(Calendar.YEAR);
EntUser entUser = entUserMapper.selectById(entUserId);
for (OaTaskTime taskTime : taskTimes){
EntPostTask ept = new EntPostTask();
String subject = year+"年工作任务:"+entPostList.getItemTitle();
ept.setItemTitle(subject);
ept.setFrequency(entPostList.getFrequency());
ept.setTaskState(1);
ept.setEnterpriseId(entPostList.getEnterpriseId());
ept.setItemContent(entPostList.getItemContent());
ept.setPostId(entPostList.getPostId());
ept.setEntUserId(entPostList.getEntUserId());
ept.setListId(entPostList.getListId());
ept.setPostListId(entPostList.getPostListId());
ept.setEntListId(entPostList.getPostListId());
ept.setTaskId(RandomNumber.getUUid());
Date start = DateUtils.parseString2Date(taskTime.getStartTime(),Constants.DATA);
Date end = DateUtils.parseString2Date(taskTime.getEndTime(),Constants.DATA);
ept.setStartTime(start);
ept.setEntTime(end);
ept.setDelState(DelState.NOT_DEL.getState());
setCreateByAndModify(ept,entUser);
ept.setCreateTime(new Date());
ept.setModifyTime(new Date());
entPostTasks.add(ept);
}
return entPostTasks;
}
/**
* 获取季度任务信息
* @return
* @throws Exception
*/
private List<EntPostTask> getQuarterTask(EntPostList entPostList,String entUserId)throws Exception{
List<EntPostTask> entPostTasks = new ArrayList<>();
List<OaTaskTime> taskTimes = this.getTaskTime(entPostList.getStandard());
Integer year = Calendar.getInstance().get(Calendar.YEAR);
Integer index = 1;
for (OaTaskTime taskTime : taskTimes){
EntPostTask ept = new EntPostTask();
EntUser entUser = entUserMapper.selectById(entUserId);
String subject = year+"年第"+index+"季度工作任务:"+entPostList.getItemTitle();
ept.setItemTitle(subject);
ept.setFrequency(entPostList.getFrequency());
ept.setTaskState(1);
ept.setEnterpriseId(entPostList.getEnterpriseId());
ept.setItemContent(entPostList.getItemContent());
ept.setPostId(entPostList.getPostId());
ept.setEntUserId(entPostList.getEntUserId());
ept.setListId(entPostList.getListId());
ept.setPostListId(entPostList.getPostListId());
ept.setEntListId(entPostList.getPostListId());
ept.setTaskId(RandomNumber.getUUid());
Date start = DateUtils.parseString2Date(taskTime.getStartTime(),Constants.DATA);
Date end = DateUtils.parseString2Date(taskTime.getEndTime(),Constants.DATA);
ept.setStartTime(start);
ept.setEntTime(end);
ept.setDelState(DelState.NOT_DEL.getState());
setCreateByAndModify(ept,entUser);
ept.setCreateTime(new Date());
ept.setModifyTime(new Date());
entPostTasks.add(ept);
index++;
}
return entPostTasks;
}
/**
* 获取月任务信息
* @return
* @throws Exception
*/
private List<EntPostTask> getMonthTask(EntPostList entPostList,String entUserId)throws Exception{
List<EntPostTask> entPostTasks = new ArrayList<>();
List<OaTaskTime> taskTimes = this.getTaskTime(entPostList.getStandard());
Integer year = Calendar.getInstance().get(Calendar.YEAR);
Integer index = 1;
for (OaTaskTime taskTime : taskTimes){
EntPostTask ept = new EntPostTask();
EntUser entUser = entUserMapper.selectById(entUserId);
String subject = year+"年第"+index+"月工作任务:"+entPostList.getFrequency();
ept.setItemTitle(subject);
ept.setItemContent(entPostList.getItemContent());
ept.setFrequency(entPostList.getFrequency());
ept.setTaskState(1);
ept.setEnterpriseId(entPostList.getEnterpriseId());
ept.setPostId(entPostList.getPostId());
ept.setEntUserId(entPostList.getEntUserId());
ept.setListId(entPostList.getListId());
ept.setPostListId(entPostList.getPostListId());
ept.setEntListId(entPostList.getPostListId());
ept.setTaskId(RandomNumber.getUUid());
Date start = DateUtils.parseString2Date(taskTime.getStartTime(),Constants.DATA);
Date end = DateUtils.parseString2Date(taskTime.getEndTime(),Constants.DATA);
ept.setStartTime(start);
ept.setEntTime(end);
ept.setDelState(DelState.NOT_DEL.getState());
setCreateByAndModify(ept,entUser);
ept.setCreateTime(new Date());
ept.setModifyTime(new Date());
entPostTasks.add(ept);
index++;
}
return entPostTasks;
}
/**
* 获取任务时间段
* @param checkstandard
* @return
* @throws Exception
*/
private List<OaTaskTime> getTaskTime(Integer checkstandard)throws Exception{
List<OaTaskTime> oaTaskTimes = new LinkedList<>();
List<Integer> months = new ArrayList<>();
Integer year = Calendar.getInstance().get(Calendar.YEAR);
if(2 == checkstandard){
months.add(1);
months.add(7);
for (Integer month : months){
Integer endMonth = month + 5;
Integer day = DateUtils.getMonthLastDay(year,endMonth);
OaTaskTime oaTaskTime = new OaTaskTime();
oaTaskTime.setStartTime(year+"-0"+month+"-01 00:00:01");
if(endMonth < 10){
oaTaskTime.setEndTime(year+"-0"+endMonth+"-"+day+" 23:59:59");
}else{
oaTaskTime.setEndTime(year+"-"+endMonth+"-"+day+" 23:59:59");
}
oaTaskTimes.add(oaTaskTime);
}
}else if(4 == checkstandard){
months.add(1);
months.add(4);
months.add(7);
months.add(10);
for (Integer month : months){
Integer entMonth = month + 2;
Integer day = DateUtils.getMonthLastDay(year,entMonth);
OaTaskTime oaTaskTime = new OaTaskTime();
String startMonthStr = "";
String endMonthStr = "";
if(month < 10){
startMonthStr = "0"+month;
}else{
startMonthStr = ""+month;
}
if(entMonth < 10){
endMonthStr = "0"+entMonth;
}else{
endMonthStr = entMonth+"";
}
oaTaskTime.setStartTime(year+"-"+startMonthStr+"-01 00:00:01");
oaTaskTime.setEndTime(year+"-"+endMonthStr+"-"+day+" 23:59:59");
oaTaskTimes.add(oaTaskTime);
}
}else if(12 == checkstandard){
months.add(1);
months.add(2);
months.add(3);
months.add(4);
months.add(5);
months.add(6);
months.add(7);
months.add(8);
months.add(9);
months.add(10);
months.add(11);
months.add(12);
for (Integer month : months){
Integer day = DateUtils.getMonthLastDay(year,month);
OaTaskTime oaTaskTime = new OaTaskTime();
String startMonthStr = "";
if(month < 10){
startMonthStr = "0"+month;
}else{
startMonthStr = ""+month;
}
oaTaskTime.setStartTime(year+"-"+startMonthStr+"-01 00:00:01");
oaTaskTime.setEndTime(year+"-"+startMonthStr+"-"+day+" 23:59:59");
oaTaskTimes.add(oaTaskTime);
}
}
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());
}
}
}

View File

@ -1,6 +1,9 @@
package com.rzyc.service;
import com.alibaba.excel.EasyExcel;
import com.common.utils.RandomNumber;
import com.common.utils.model.Code;
import com.common.utils.model.Message;
import com.common.utils.model.SingleResult;
import com.common.utils.pager.PageOperation;
import com.github.pagehelper.Page;
@ -8,8 +11,10 @@ import com.rzyc.config.RedisUtil;
import com.rzyc.controller.BaseController;
import com.rzyc.model.*;
import com.rzyc.model.EasyExcel.EasyExcelPostList;
import com.rzyc.model.dto.InPostDto;
import com.rzyc.model.ent.*;
import com.rzyc.utils.easyexcel.EntEnterprisePostListener;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@ -31,7 +36,6 @@ public class PcBusinessService extends BaseController {
@PageOperation
public SingleResult entEmEquipmentList(String enterpriseId,Integer page,Integer pageSize,String resourceType){
SingleResult singleResult = new SingleResult();
System.out.println("我的真实ip地址呢" + request.getRemoteAddr());
Page<EntEmEquipment> entEmEquipments = (Page<EntEmEquipment>) entEmEquipmentMapper.selectEntEmEquipmentList(enterpriseId,resourceType);
singleResult.setDataPager(entEmEquipments);
return singleResult;
@ -53,7 +57,7 @@ public class PcBusinessService extends BaseController {
@PageOperation
public SingleResult getIndustryPostDuty(Integer page , Integer pageSize ,String industryId,String listId){
SingleResult singleResult = new SingleResult();
Page<InListItem>posts = (Page<InListItem>) inListItemMapper.selectContents(industryId,listId);
Page<InListItem>posts = (Page<InListItem>) inListItemMapper.selectContents(industryId,listId,null);
singleResult.setDataPager(posts);
return singleResult;
}
@ -73,5 +77,26 @@ public class PcBusinessService extends BaseController {
return singleResult;
}
public SingleResult addIndustryPost(InPostDto inPostDto) throws Exception {
SingleResult singleResult = new SingleResult();
InPost inPost = new InPost();
BeanUtils.copyProperties(inPostDto,inPost);
inPost.setPublicPostId(RandomNumber.getUUid());
int result = inPostMapper.insert(inPost);
InPostItem inPostItem = new InPostItem();
inPostItem.setInPostItemId(RandomNumber.getUUid());
StringBuilder stringBuilder = new StringBuilder();
inPostItem.setInList(stringBuilder.append(inPostDto.getIndustryName()).append(inPostDto.getPublicPostName()).append("岗位清单").toString());
inPostItem.setPublicPostId(inPost.getPublicPostId());
inPostItem.setCreateTime(new Date());
inPostItem.setCreateBy(getUserId());
inPostItemMapper.insert(inPostItem);
if (result != 1){
singleResult.setCode(Code.ERROR.getCode());
singleResult.setMessage(Message.ERROR);
}
return singleResult;
}
}

View File

@ -2,6 +2,7 @@ package com.rzyc.service;
import com.common.utils.RandomNumber;
import com.common.utils.copy.ObjectConversion;
import com.rzyc.enums.PostListType;
import com.rzyc.mapper.ent.InEntListMapper;
import com.rzyc.mapper.ent.InListItemMapper;
import com.rzyc.model.ent.InEntList;
@ -53,7 +54,7 @@ public class SaveEntListThread implements Runnable{
* @throws Exception
*/
public void saveEntInList(String industryId,String companyId)throws Exception{
List<InListItem> inListItem = inListItemMapper.selectContents(industryId,null);
List<InListItem> inListItem = inListItemMapper.selectContents(industryId,null, PostListType.LIST_TYPE_NO.getType());
List<InEntList> entLists = ObjectConversion.copy(inListItem,InEntList.class);
for (InEntList in:entLists) {
in.setEnterpriseId(companyId);

View File

@ -1,15 +1,26 @@
package com.rzyc.service;
import com.alibaba.excel.util.ListUtils;
import com.common.utils.RandomNumber;
import com.common.utils.encryption.MD5;
import com.rzyc.config.ConstantsConfigure;
import com.rzyc.enums.PostListType;
import com.rzyc.mapper.EntPostDutyMapper;
import com.rzyc.mapper.ent.EntPostMapper;
import com.rzyc.mapper.ent.EntUserMapper;
import com.rzyc.mapper.ent.InListItemMapper;
import com.rzyc.mapper.ent.InListMapper;
import com.rzyc.model.EntPostDuty;
import com.rzyc.model.InPost;
import com.rzyc.model.InPostItem;
import com.rzyc.model.ent.EntPost;
import com.rzyc.model.ent.EntUser;
import com.rzyc.model.ent.InList;
import com.rzyc.model.ent.InListItem;
import com.rzyc.utils.SpringUtil;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
/**
@ -40,14 +51,39 @@ public class SaveEntPostAndUserThread implements Runnable {
private String entName;
private String userId;
private String industryId;
private String postId;
private CopyOnWriteArrayList copyOnWriteArrayList;
private InListMapper inListMapper;
public SaveEntPostAndUserThread(String enterpriseId, String createBy, EntPostMapper entPostMapper, EntUserMapper entUserMapper, ConstantsConfigure constantsConfigure, String name, String phone, String entName, CopyOnWriteArrayList copyOnWriteArrayList) {
private InListItemMapper inListItemMapper;
private EntPostDutyMapper entPostDutyMapper;
/**
* 每隔5条存储数据库实际使用中可以100条然后清理list 方便内存回收
*/
private static final int BATCH_COUNT = 100;
/**
* 企业岗位职责-缓存数据
* */
private List<EntPostDuty>entPostDutyList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
public SaveEntPostAndUserThread(String enterpriseId, String createBy, String industryId,EntPostMapper entPostMapper, EntUserMapper entUserMapper, ConstantsConfigure constantsConfigure,
String name, String phone, String entName,String userId,String postId, CopyOnWriteArrayList copyOnWriteArrayList,
InListMapper inListMapper,InListItemMapper inListItemMapper,EntPostDutyMapper entPostDutyMapper) {
this.enterpriseId = enterpriseId;
if (null != createBy){
this.createBy = createBy;
}
this.industryId = industryId;
this.entPostMapper = entPostMapper;
this.entUserMapper = entUserMapper;
this.constantsConfigure = constantsConfigure;
@ -55,6 +91,11 @@ public class SaveEntPostAndUserThread implements Runnable {
this.phone = phone;
this.entName = entName;
this.copyOnWriteArrayList = copyOnWriteArrayList;
this.userId = userId;
this.postId = postId;
this.inListMapper = inListMapper;
this.inListItemMapper = inListItemMapper;
this.entPostDutyMapper = entPostDutyMapper;
}
@Override
@ -70,7 +111,6 @@ public class SaveEntPostAndUserThread implements Runnable {
private void save(String enterpriseId) throws Exception {
//存岗位
EntPost entPost = new EntPost();
String postId = RandomNumber.getUUid();
entPost.setPostId(postId);
entPost.setEnterpriseId(enterpriseId);
entPost.setName(legalPerson);
@ -82,7 +122,6 @@ public class SaveEntPostAndUserThread implements Runnable {
//存企业用户
EntUser entUser = new EntUser();
String userId = RandomNumber.getUUid();
entUser.setEntUserId(userId);
entUser.setPostId(postId);
entUser.setEnterpriseId(enterpriseId);
@ -105,5 +144,45 @@ public class SaveEntPostAndUserThread implements Runnable {
copyOnWriteArrayList.add(phone);
entUserMapper.deleteLegalPerson(legalPerson,enterpriseId);
entUserMapper.insert(entUser);
doing();
}
public void doing(){
List<InList> inLists = inListMapper.findAll(industryId);
for (InList i:inLists) {
//批量插入企业岗位职责
List<InListItem> list = inListItemMapper.selectContents(null,i.getListId(), PostListType.LIST_TYPE_NO.getType());
for (InListItem ili:list) {
addEntPostDuty(ili,postId,enterpriseId);
}
}
finishLastList();
}
private void addEntPostDuty(InListItem ili,String postId,String sysEnterpriseId){
if (entPostDutyList.size() == BATCH_COUNT){
entPostDutyMapper.insertList(entPostDutyList);
entPostDutyList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}else {
EntPostDuty entPostDuty = new EntPostDuty();
entPostDuty.setDutyId(RandomNumber.getUUid());
entPostDuty.setPostId(postId);
entPostDuty.setDutyItem(ili.getItemContent());
entPostDuty.setSortId(ili.getSortId());
entPostDuty.setEnterpriseId(sysEnterpriseId);
entPostDuty.setCreateTime(new Date());
entPostDuty.setCreateBy("导入");
entPostDutyList.add(entPostDuty);
}
}
private void finishLastList(){
if (null != entPostDutyList && entPostDutyList.size() > 0){
entPostDutyMapper.insertList(entPostDutyList);
entPostDutyList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
}

View File

@ -3,6 +3,7 @@ package com.rzyc.service;
import com.alibaba.excel.util.ListUtils;
import com.common.utils.RandomNumber;
import com.rzyc.enums.PostListType;
import com.rzyc.mapper.*;
import com.rzyc.mapper.ent.EntPostMapper;
import com.rzyc.mapper.ent.InListItemMapper;
@ -10,6 +11,7 @@ import com.rzyc.mapper.ent.SysEnterpriseMapper;
import com.rzyc.model.*;
import com.rzyc.model.EasyExcel.EasyExcelEnterprise;
import com.rzyc.model.ent.InEntList;
import com.rzyc.model.ent.InList;
import com.rzyc.model.ent.InListItem;
import com.rzyc.model.ent.SysEnterprise;
import org.springframework.beans.factory.annotation.Autowired;
@ -75,6 +77,8 @@ public class SaveIndustryPostThread implements Runnable {
* */
private String sysEnterpriseId;
private boolean batch;
/**
* 每隔5条存储数据库实际使用中可以100条然后清理list 方便内存回收
*/
@ -87,7 +91,7 @@ public class SaveIndustryPostThread implements Runnable {
@Autowired
public SaveIndustryPostThread(String industryId,String sysEnterpriseId,InPostMapper inPostMapper, InPostItemMapper inPostItemMapper, InPostListMapper inPostListMapper,
InListItemMapper inListItemMapper, SysEnterpriseMapper sysEnterpriseMapper, EntPostMapper entPostMapper, EntPostDutyMapper entPostDutyMapper) {
InListItemMapper inListItemMapper, SysEnterpriseMapper sysEnterpriseMapper, EntPostMapper entPostMapper, EntPostDutyMapper entPostDutyMapper,boolean batch) {
this.industryId = industryId;
this.inPostMapper = inPostMapper;
this.inPostItemMapper = inPostItemMapper;
@ -97,6 +101,7 @@ public class SaveIndustryPostThread implements Runnable {
this.entPostMapper = entPostMapper;
this.entPostDutyMapper = entPostDutyMapper;
this.sysEnterpriseId = sysEnterpriseId;
this.batch = batch;
}
@ -113,7 +118,7 @@ public class SaveIndustryPostThread implements Runnable {
InPostItem inPostItems = inPostItemMapper.selectByPostId(i.getPublicPostId());
//批量插入企业岗位职责
List<InListItem> list = inListItemMapper.selectContents(null,inPostItems.getInPostItemId());
List<InListItem> list = inListItemMapper.selectContents(null,inPostItems.getInPostItemId(), PostListType.LIST_TYPE_IS.getType());
for (InListItem ili:list) {
addEntPostDuty(ili,i.getUuid(),s.getSysenterpriseid());
}
@ -133,13 +138,15 @@ public class SaveIndustryPostThread implements Runnable {
InPostItem inPostItems = inPostItemMapper.selectByPostId(i.getPublicPostId());
//批量插入企业岗位职责
List<InListItem> list = inListItemMapper.selectContents(null,inPostItems.getInPostItemId());
List<InListItem> list = inListItemMapper.selectContents(null,inPostItems.getInPostItemId(), PostListType.LIST_TYPE_IS.getType());
for (InListItem ili:list) {
addEntPostDuty(ili,i.getUuid(),sysEnterpriseId);
}
}
finishLastList();
}
private void addEntPostDuty(InListItem ili,String postId,String sysEnterpriseId){
if (entPostDutyList.size() == BATCH_COUNT){
entPostDutyMapper.insertList(entPostDutyList);
@ -165,6 +172,11 @@ public class SaveIndustryPostThread implements Runnable {
@Override
public void run() {
batchSave();
if (batch == true){
batchSave();
}else {
doing();
}
}
}