From a279ce431565e9c2ac1fd82a89e7d756df4ff418 Mon Sep 17 00:00:00 2001 From: 79493 <794930212@qq.com> Date: Mon, 7 Nov 2022 17:47:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E7=AB=AF=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=A8=A1=E5=9D=97->=E5=92=8C=E5=89=8D=E7=AB=AF=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/rzyc/mapper/EntPostDutyMapper.java | 4 +- .../com/rzyc/mapper/EntPostListMapper.java | 20 ++- .../com/rzyc/mapper/EntPostTaskMapper.java | 23 +++- .../com/rzyc/mapper/ent/EntUserMapper.java | 3 +- .../com/rzyc/mapper/ent/InEntListMapper.java | 7 + .../main/java/com/rzyc/model/EntPostList.java | 25 ++++ .../com/rzyc/model/EntPostTaskStatistic.java | 47 +++++++ .../rzyc/model/dto/AddOrUpdateEntPostDto.java | 11 ++ .../rzyc/model/dto/EntUserPostDutyDto.java | 7 +- .../rzyc/model/dto/EntUserPostListDto.java | 19 ++- .../rzyc/model/dto/EntUserPostTaskDto.java | 10 +- .../main/java/com/rzyc/model/ent/EntUser.java | 24 +++- .../resources/mapper/EntPostDutyMapper.xml | 2 +- .../resources/mapper/EntPostListMapper.xml | 41 +++++- .../resources/mapper/EntPostTaskMapper.xml | 47 ++++++- .../resources/mapper/ent/EntPostMapper.xml | 10 +- .../resources/mapper/ent/EntUserMapper.xml | 11 +- .../resources/mapper/ent/InEntListMapper.xml | 4 + .../mapper/ent/SysEnterpriseMapper.xml | 58 ++++++++- .../main/java/com/rzyc/config/PageAspect.java | 7 +- .../com/rzyc/config/UserDetailsAndId.java | 19 ++- .../rzyc/controller/PcCompanyController.java | 94 ++++++++++++- .../rzyc/controller/PersonalController.java | 108 ++++++++------- .../filter/JwtAuthenticationTokenFiler.java | 35 +++-- .../com/rzyc/service/PcBusinessService.java | 123 ++++++++++++++---- .../rzyc/service/UserDetailsServiceImpl.java | 6 +- .../com/rzyc/service/UserLoginService.java | 34 +++-- .../com/rzyc/utils/StringEncryptorTest.java | 4 +- 28 files changed, 650 insertions(+), 153 deletions(-) create mode 100644 inventory-dao/src/main/java/com/rzyc/model/EntPostTaskStatistic.java diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/EntPostDutyMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/EntPostDutyMapper.java index 2df4875..b52e32d 100644 --- a/inventory-dao/src/main/java/com/rzyc/mapper/EntPostDutyMapper.java +++ b/inventory-dao/src/main/java/com/rzyc/mapper/EntPostDutyMapper.java @@ -23,10 +23,8 @@ public interface EntPostDutyMapper extends BaseMapper { * 企业用户岗位职责 * @param enterpriseId 企业id * @param postId 岗位id - * @param page 页码 - * @param pageSize 条数 * @return EntPostTask 企业用户岗位职责 * */ - ListselectEntUserPostDuty(@Param("enterpriseId") String enterpriseId, @Param("postId")String postId,@Param("page") Integer page,@Param("pageSize")Integer pageSize); + ListselectEntUserPostDuty(@Param("enterpriseId") String enterpriseId, @Param("postId")String postId); } diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/EntPostListMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/EntPostListMapper.java index 4b62cc3..29913db 100644 --- a/inventory-dao/src/main/java/com/rzyc/mapper/EntPostListMapper.java +++ b/inventory-dao/src/main/java/com/rzyc/mapper/EntPostListMapper.java @@ -24,27 +24,41 @@ public interface EntPostListMapper extends BaseMapper { * * @param enterpriseId 企业id * @param entUserId 企业用户id + * @param finishedState 完成状态 * @param postId 岗位id * @param page 页码 * @param pageSize 条数 * @return EntPostList 企业用户工作要务 */ - List selectEntPostList(@Param("enterpriseId") String enterpriseId, @Param("entUserId") String entUserId, @Param("postId") String postId, Integer page, Integer pageSize); + List selectEntPostList(@Param("enterpriseId") String enterpriseId, @Param("entUserId") String entUserId,@Param("finishedState") Integer finishedState ,@Param("postId") String postId, Integer page, Integer pageSize); /** * 企业清单条数 * @param enterpriseId 企业id * @param listId 企业用户id + * @param year 年份 * @return int 企业岗位条数 */ - Integer selectEntPostListCount(@Param("enterpriseId") String enterpriseId,@Param("listId")String listId); + Integer selectEntPostListCount(@Param("enterpriseId") String enterpriseId,@Param("listId")String listId,@Param("year") Integer year); /** * 企业清单完成条数 * @param enterpriseId 企业id * @param listId 企业用户id * @param state 状态 + * @param year 年份 * @return int 企业清单完成条数 */ - Integer selectEntPostListFinishedCount(@Param("enterpriseId") String enterpriseId,@Param("listId")String listId,@Param("state")Integer state); + Integer selectEntPostListFinishedCount(@Param("enterpriseId") String enterpriseId,@Param("listId")String listId,@Param("state")Integer state,@Param("year") Integer year); + + + + /** + * 企业清单(类型)分组查询 + * @param enterpriseId 企业id + * @param listId 清单id + * @param userId 用户id + * @return int 企业清单(类型) + */ + ListselectEntListGroupByListId(@Param("enterpriseId") String enterpriseId,@Param("listId")String listId,@Param("userId")String userId); } diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/EntPostTaskMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/EntPostTaskMapper.java index 4959f71..5f262e7 100644 --- a/inventory-dao/src/main/java/com/rzyc/mapper/EntPostTaskMapper.java +++ b/inventory-dao/src/main/java/com/rzyc/mapper/EntPostTaskMapper.java @@ -2,6 +2,7 @@ package com.rzyc.mapper; import com.rzyc.model.EntPostTask; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.rzyc.model.EntPostTaskStatistic; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @@ -27,14 +28,11 @@ public interface EntPostTaskMapper extends BaseMapper { * @param listId 清单id * @param content 内容模糊搜索 * @param taskState 任务状态 - * @param page 页码 - * @param pageSize 条数 * @return EntPostTask 企业用户清单任务 * */ ListselectEntUserPostTask(@Param("enterpriseId") String enterpriseId, @Param("entUserId")String entUserId, @Param("postId")String postId, @Param("listId")String listId, - @Param("content")String content,@Param("taskState") Integer taskState, - @Param("page") Integer page,@Param("pageSize") Integer pageSize); + @Param("content")String content,@Param("taskState") Integer taskState); /** @@ -50,7 +48,22 @@ public interface EntPostTaskMapper extends BaseMapper { @Param("page") Integer page,@Param("pageSize") Integer pageSize); + /** + * 查询企业岗位履职数 + * @param enterpriseId 企业id + * @param listId 清单id + * @param year 年份 + * @return EntPostTaskStatistic 统计对象 + * */ + EntPostTaskStatistic selectEntPostTaskByState(@Param("enterpriseId") String enterpriseId,@Param("listId") String listId,@Param("year") Integer year); - + /** + * 查询企业岗位履职总数 + * @param enterpriseId 企业id + * @param listId 清单id + * @param year 年份 + * @return long 统计总条数 + * */ + long selectEntPostTaskTotal(@Param("enterpriseId") String enterpriseId,@Param("listId")String listId,@Param("year") Integer year); } diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntUserMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntUserMapper.java index 1aefdc1..7ab78cb 100644 --- a/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntUserMapper.java +++ b/inventory-dao/src/main/java/com/rzyc/mapper/ent/EntUserMapper.java @@ -31,9 +31,10 @@ public interface EntUserMapper extends BaseMapper { * @param keyContent 关键字 * @param page 页码 * @param pageSize 条数 + * @param postId 岗位id * @return EntUser 企业用户实体 * */ - ListselectEntUserList(@Param("keyContent") String keyContent,@Param("page")Integer page,@Param("pageSize")Integer pageSize); + ListselectEntUserList(@Param("keyContent") String keyContent,@Param("page")Integer page,@Param("pageSize")Integer pageSize,@Param("postId")String postId); /** diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/ent/InEntListMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/ent/InEntListMapper.java index 4b62c9d..53205dc 100644 --- a/inventory-dao/src/main/java/com/rzyc/mapper/ent/InEntListMapper.java +++ b/inventory-dao/src/main/java/com/rzyc/mapper/ent/InEntListMapper.java @@ -2,6 +2,7 @@ package com.rzyc.mapper.ent; import com.rzyc.model.ent.InEntList; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @@ -17,5 +18,11 @@ import java.util.List; @Repository public interface InEntListMapper extends BaseMapper { + /** + * 查询企业清单类型 + * @param enterpriseId 企业id + * @return list + * */ + List selectByEnterpriseId(@Param("enterpriseId") String enterpriseId); } diff --git a/inventory-dao/src/main/java/com/rzyc/model/EntPostList.java b/inventory-dao/src/main/java/com/rzyc/model/EntPostList.java index 98b4de9..9ceae67 100644 --- a/inventory-dao/src/main/java/com/rzyc/model/EntPostList.java +++ b/inventory-dao/src/main/java/com/rzyc/model/EntPostList.java @@ -103,8 +103,33 @@ public class EntPostList implements Serializable { private String modifyBy; @TableField(exist = false) + @ApiModelProperty(value = "已完成数") private Integer finishCount; + @TableField(exist = false) + @ApiModelProperty(value = "进行中数") + private Integer haveInHand; + + @TableField(exist = false) + @ApiModelProperty(value = "任务总数") + private Integer totalTaskNumber; + + public Integer getHaveInHand() { + return haveInHand; + } + + public void setHaveInHand(Integer haveInHand) { + this.haveInHand = haveInHand; + } + + public Integer getTotalTaskNumber() { + return totalTaskNumber; + } + + public void setTotalTaskNumber(Integer totalTaskNumber) { + this.totalTaskNumber = totalTaskNumber; + } + public Integer getFinishCount() { return finishCount; } diff --git a/inventory-dao/src/main/java/com/rzyc/model/EntPostTaskStatistic.java b/inventory-dao/src/main/java/com/rzyc/model/EntPostTaskStatistic.java new file mode 100644 index 0000000..b581ec7 --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/model/EntPostTaskStatistic.java @@ -0,0 +1,47 @@ +package com.rzyc.model; + +/** + * 企业岗位任务履职统计 + * @author Xuwanxin + * @date 2022/11/1 + * */ +public class EntPostTaskStatistic { + /** + * 进行中 + * */ + private long haveInHand = 0; + + /** + * 已完成 + * */ + private long finished = 0 ; + + /** + * 超时 + * */ + private long overtime = 0; + + public long getHaveInHand() { + return haveInHand; + } + + public void setHaveInHand(long haveInHand) { + this.haveInHand = haveInHand; + } + + public long getFinished() { + return finished; + } + + public void setFinished(long finished) { + this.finished = finished; + } + + public long getOvertime() { + return overtime; + } + + public void setOvertime(long overtime) { + this.overtime = overtime; + } +} diff --git a/inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntPostDto.java b/inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntPostDto.java index a8d3d5a..3c0c094 100644 --- a/inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntPostDto.java +++ b/inventory-dao/src/main/java/com/rzyc/model/dto/AddOrUpdateEntPostDto.java @@ -14,6 +14,7 @@ import javax.validation.constraints.NotNull; * */ public class AddOrUpdateEntPostDto { + @NotNull @ApiModelProperty(value = "企业岗位id") private String postId; @@ -37,6 +38,16 @@ public class AddOrUpdateEntPostDto { @ApiModelProperty(value = "岗位层级") private Integer postLevel; + @ApiModelProperty(value = "排序字段") + private Integer sort; + + public Integer getSort() { + return sort; + } + + public void setSort(Integer sort) { + this.sort = sort; + } public String getPostId() { return postId; diff --git a/inventory-dao/src/main/java/com/rzyc/model/dto/EntUserPostDutyDto.java b/inventory-dao/src/main/java/com/rzyc/model/dto/EntUserPostDutyDto.java index 479e59b..6a3456f 100644 --- a/inventory-dao/src/main/java/com/rzyc/model/dto/EntUserPostDutyDto.java +++ b/inventory-dao/src/main/java/com/rzyc/model/dto/EntUserPostDutyDto.java @@ -15,18 +15,17 @@ import javax.validation.constraints.NotNull; public class EntUserPostDutyDto { @NotNull - @ApiModelProperty(value = "企业id") + @ApiModelProperty(value = "企业id",required = true) private String enterpriseId; - @NotNull @ApiModelProperty(value = "岗位id") private String postId; - @NotNull + @ApiModelProperty(value = "页码") private Integer page; - @NotNull + @ApiModelProperty(value = "条数") private Integer pageSize; diff --git a/inventory-dao/src/main/java/com/rzyc/model/dto/EntUserPostListDto.java b/inventory-dao/src/main/java/com/rzyc/model/dto/EntUserPostListDto.java index 12343b1..c67af47 100644 --- a/inventory-dao/src/main/java/com/rzyc/model/dto/EntUserPostListDto.java +++ b/inventory-dao/src/main/java/com/rzyc/model/dto/EntUserPostListDto.java @@ -14,25 +14,36 @@ import javax.validation.constraints.NotNull; @ApiModel(value = "企业用户岗位要务Dto",description = "企业用户岗位要务Dto") public class EntUserPostListDto { @NotNull - @ApiModelProperty(value = "企业id") + @ApiModelProperty(value = "企业id",required = true) String enterpriseId; @NotNull - @ApiModelProperty(value = "企业用户id") + @ApiModelProperty(value = "企业用户id",required = true) String entUserId; @ApiModelProperty(value = "岗位id") String postId; - @NotNull + @ApiModelProperty(value = "页码") Integer page; - @NotNull + @ApiModelProperty(value = "条数") Integer pageSize; + @ApiModelProperty(value = "完成状态") + Integer finishedState; + + public Integer getFinishedState() { + return finishedState; + } + + public void setFinishedState(Integer finishedState) { + this.finishedState = finishedState; + } + public String getEnterpriseId() { return enterpriseId; } diff --git a/inventory-dao/src/main/java/com/rzyc/model/dto/EntUserPostTaskDto.java b/inventory-dao/src/main/java/com/rzyc/model/dto/EntUserPostTaskDto.java index 9d595d9..8cc8cf2 100644 --- a/inventory-dao/src/main/java/com/rzyc/model/dto/EntUserPostTaskDto.java +++ b/inventory-dao/src/main/java/com/rzyc/model/dto/EntUserPostTaskDto.java @@ -15,11 +15,11 @@ import javax.validation.constraints.NotNull; public class EntUserPostTaskDto { @NotNull - @ApiModelProperty(value = "企业id") + @ApiModelProperty(value = "企业id",required = true) String enterpriseId; @NotNull - @ApiModelProperty(value = "企业用户id") + @ApiModelProperty(value = "企业用户id",required = true) String entUserId; @@ -34,15 +34,15 @@ public class EntUserPostTaskDto { @ApiModelProperty(value = "模糊内容") String content; - @NotNull + @ApiModelProperty(value = "任务状态") Integer taskState; - @NotNull + @ApiModelProperty(value = "页码") Integer page; - @NotNull + @ApiModelProperty(value = "条数") Integer pageSize; diff --git a/inventory-dao/src/main/java/com/rzyc/model/ent/EntUser.java b/inventory-dao/src/main/java/com/rzyc/model/ent/EntUser.java index 9b6f523..3eef317 100644 --- a/inventory-dao/src/main/java/com/rzyc/model/ent/EntUser.java +++ b/inventory-dao/src/main/java/com/rzyc/model/ent/EntUser.java @@ -112,17 +112,31 @@ public class EntUser implements Serializable { @ApiModelProperty(value = "工号") private String jobNumber; + @TableField(exist = false) - private LocalTime localTime; + private String token; - public LocalTime getLocalTime() { - return localTime; + @ApiModelProperty(value = "岗位名字") + @TableField(exist = false) + private String entPostName; + + public String getEntPostName() { + return entPostName; } - public void setLocalTime(LocalTime localTime) { - this.localTime = localTime; + public void setEntPostName(String entPostName) { + this.entPostName = entPostName; } + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getJobNumber() { return jobNumber; } diff --git a/inventory-dao/src/main/resources/mapper/EntPostDutyMapper.xml b/inventory-dao/src/main/resources/mapper/EntPostDutyMapper.xml index cfd0032..3a6e1f3 100644 --- a/inventory-dao/src/main/resources/mapper/EntPostDutyMapper.xml +++ b/inventory-dao/src/main/resources/mapper/EntPostDutyMapper.xml @@ -21,7 +21,7 @@ diff --git a/inventory-dao/src/main/resources/mapper/EntPostListMapper.xml b/inventory-dao/src/main/resources/mapper/EntPostListMapper.xml index 4cc5469..88ab46c 100644 --- a/inventory-dao/src/main/resources/mapper/EntPostListMapper.xml +++ b/inventory-dao/src/main/resources/mapper/EntPostListMapper.xml @@ -35,6 +35,9 @@ + + + + + + + + + diff --git a/inventory-dao/src/main/resources/mapper/EntPostTaskMapper.xml b/inventory-dao/src/main/resources/mapper/EntPostTaskMapper.xml index c567a77..dc8f911 100644 --- a/inventory-dao/src/main/resources/mapper/EntPostTaskMapper.xml +++ b/inventory-dao/src/main/resources/mapper/EntPostTaskMapper.xml @@ -30,7 +30,10 @@ + + + + + + + + + + + + diff --git a/inventory-dao/src/main/resources/mapper/ent/EntPostMapper.xml b/inventory-dao/src/main/resources/mapper/ent/EntPostMapper.xml index a3b6375..8f59e62 100644 --- a/inventory-dao/src/main/resources/mapper/ent/EntPostMapper.xml +++ b/inventory-dao/src/main/resources/mapper/ent/EntPostMapper.xml @@ -30,19 +30,19 @@ and post_path like concat('%',#{postId},'%') - order by post_level asc + order by post_level,sort asc - update set name = #{data.name},parent_id = #{data.parentId},post_path = #{data.postPath},parent_name = #{data.parentName},post_level = #{postLevel}, - modify_time = #{modifyTime} , modify_by = #{modifyBy} - where post_id = #{postId},enterprise_id = #{enterpriseId} + update ent_post set name = #{data.name},parent_id = #{data.parentId},post_path = #{data.postPath},parent_name = #{data.parentName},post_level = #{data.postLevel}, + modify_time = #{data.modifyTime} , modify_by = #{data.modifyBy} + where post_id = #{data.postId} and enterprise_id = #{data.enterpriseId} insert into ent_post (post_id,enterprise_id,name,parent_id,post_path,parent_name,post_level,completion_rate,subordinates,create_time,create_by) values(#{data.postId},#{data.enterpriseId},#{data.name},#{data.parentId},#{data.postPath},#{data.parentName},#{data.postLevel},#{data.completionRate},#{data.subordinates}, - ,#{data.createTime},#{data.createBy}) + #{data.createTime},#{data.createBy}) diff --git a/inventory-dao/src/main/resources/mapper/ent/EntUserMapper.xml b/inventory-dao/src/main/resources/mapper/ent/EntUserMapper.xml index 8c8a424..b687cab 100644 --- a/inventory-dao/src/main/resources/mapper/ent/EntUserMapper.xml +++ b/inventory-dao/src/main/resources/mapper/ent/EntUserMapper.xml @@ -54,8 +54,12 @@ diff --git a/inventory-dao/src/main/resources/mapper/ent/InEntListMapper.xml b/inventory-dao/src/main/resources/mapper/ent/InEntListMapper.xml index 28984c8..b0b3774 100644 --- a/inventory-dao/src/main/resources/mapper/ent/InEntListMapper.xml +++ b/inventory-dao/src/main/resources/mapper/ent/InEntListMapper.xml @@ -30,4 +30,8 @@ item_basis, item_proof, item_law, sort_id,del_state, create_time, create_by, modify_time, modify_by + + diff --git a/inventory-dao/src/main/resources/mapper/ent/SysEnterpriseMapper.xml b/inventory-dao/src/main/resources/mapper/ent/SysEnterpriseMapper.xml index 94d759f..572a555 100644 --- a/inventory-dao/src/main/resources/mapper/ent/SysEnterpriseMapper.xml +++ b/inventory-dao/src/main/resources/mapper/ent/SysEnterpriseMapper.xml @@ -92,7 +92,63 @@ where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR} + + insert into SysEnterprise (SysEnterpriseId, + OrgCode, + street_code, + community_code, + net_code, + + SuperiorEnterpriseId, + LowOrgCode, EntName,isHide, State,complite,sysUnitId,ManagerDept,dynamicRiskLevel,inherentRisk,manageType,EntType, + EntSection, BaseSafeClassId, BaseInClassId,work_class_id, + PinYin, Principal, + SysAddress, + safeTelephone, + safeManager, + PostCode, EcoType, PersonCount, + EntLogoPic, MaleCode, OrgPassNo, + LegalRepre, LRIDCard, LRLinkTel, + EstablishDate, RiskLevel, Latitude, + Longitude, IsBlackList, Comments, + ISMaleCode, EntScore, EntHouseNum, + CreatedOn, CreatedBy, ModifiedOn, + ModifiedBy,qr_code) + values ( + #{sysenterpriseid,jdbcType=VARCHAR}, + #{orgcode,jdbcType=VARCHAR}, + #{streetCode,jdbcType=VARCHAR}, + #{communityCode,jdbcType=VARCHAR}, + #{netCode,jdbcType=VARCHAR}, + #{superiorenterpriseid,jdbcType=VARCHAR}, + #{loworgcode,jdbcType=VARCHAR}, + #{entname,jdbcType=VARCHAR}, + #{isHide,jdbcType=VARCHAR}, + #{state,jdbcType=VARCHAR}, + #{complite,jdbcType=VARCHAR}, + #{sysUnitId,jdbcType=VARCHAR}, + #{managerDept,jdbcType=VARCHAR}, + #{dynamicRiskLevel,jdbcType=VARCHAR}, + #{inherentRisk,jdbcType=VARCHAR}, + #{manageType,jdbcType=VARCHAR}, + #{enttype,jdbcType=VARCHAR}, + #{entsection,jdbcType=VARCHAR}, #{basesafeclassid,jdbcType=VARCHAR}, + #{baseinclassid,jdbcType=VARCHAR}, + #{workClassId,jdbcType=VARCHAR}, + #{pinyin,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, + #{sysaddress,jdbcType=VARCHAR}, + #{safeTelephone,jdbcType=VARCHAR}, + #{safeManager,jdbcType=VARCHAR}, + #{postcode,jdbcType=VARCHAR}, #{ecotype,jdbcType=VARCHAR}, #{personcount,jdbcType=INTEGER}, + #{entlogopic,jdbcType=VARCHAR}, #{malecode,jdbcType=VARCHAR}, #{orgpassno,jdbcType=VARCHAR}, + #{legalrepre,jdbcType=VARCHAR}, #{lridcard,jdbcType=VARCHAR}, #{lrlinktel,jdbcType=VARCHAR}, + #{establishdate,jdbcType=TIMESTAMP}, #{risklevel,jdbcType=VARCHAR}, #{latitude,jdbcType=VARCHAR}, + #{longitude,jdbcType=VARCHAR}, #{isblacklist,jdbcType=VARCHAR}, #{comments,jdbcType=VARCHAR}, + #{ismalecode,jdbcType=VARCHAR}, #{entscore,jdbcType=VARCHAR}, #{enthousenum,jdbcType=VARCHAR}, + #{createdon,jdbcType=TIMESTAMP}, #{createdby,jdbcType=VARCHAR}, #{modifiedon,jdbcType=TIMESTAMP}, + #{modifiedby,jdbcType=VARCHAR},#{qrCode}) + insert into SysEnterprise @@ -2500,7 +2556,7 @@ diff --git a/inventory-ent/src/main/java/com/rzyc/config/PageAspect.java b/inventory-ent/src/main/java/com/rzyc/config/PageAspect.java index 2cb904e..66d704a 100644 --- a/inventory-ent/src/main/java/com/rzyc/config/PageAspect.java +++ b/inventory-ent/src/main/java/com/rzyc/config/PageAspect.java @@ -40,16 +40,11 @@ public class PageAspect { Pager pager = new Pager(); pager.setRows(page.getResult()); pager.setTotal(page.getTotal()); - return packageData(pager); + return pager; } return proceed; } - private SingleResult packageData( Pager pager){ - SingleResult singleResult = new SingleResult(); - singleResult.setData(pager); - return singleResult; - } /** * 设置参数,返回是否分页 diff --git a/inventory-ent/src/main/java/com/rzyc/config/UserDetailsAndId.java b/inventory-ent/src/main/java/com/rzyc/config/UserDetailsAndId.java index ed99d1e..15e2a63 100644 --- a/inventory-ent/src/main/java/com/rzyc/config/UserDetailsAndId.java +++ b/inventory-ent/src/main/java/com/rzyc/config/UserDetailsAndId.java @@ -14,9 +14,23 @@ import java.util.Collection; public class UserDetailsAndId extends User { - + /** + * 用户id + * */ private String id; + /** + * 企业岗位id + * */ + private String postId; + + public String getPostId() { + return postId; + } + + public void setPostId(String postId) { + this.postId = postId; + } public String getId() { return id; @@ -28,9 +42,10 @@ public class UserDetailsAndId extends User { - public UserDetailsAndId(String username, String password, Collection authorities, String id) { + public UserDetailsAndId(String username, String password, Collection authorities, String id,String postId) { super(username, password, authorities); setId(id); + setPostId(postId); } } diff --git a/inventory-ent/src/main/java/com/rzyc/controller/PcCompanyController.java b/inventory-ent/src/main/java/com/rzyc/controller/PcCompanyController.java index a0ad48a..e686fc9 100644 --- a/inventory-ent/src/main/java/com/rzyc/controller/PcCompanyController.java +++ b/inventory-ent/src/main/java/com/rzyc/controller/PcCompanyController.java @@ -20,13 +20,16 @@ import com.rzyc.bean.check.dto.LawAddDto; import com.rzyc.bean.check.dto.TalkAddDto; import com.rzyc.bean.ent.*; import com.rzyc.bean.user.dto.LoginDto; +import com.rzyc.config.MethodAnnotation; import com.rzyc.model.Accident; import com.rzyc.model.EntCertificates; import com.rzyc.model.check.*; import com.rzyc.model.ent.EntBillCon; +import com.rzyc.model.ent.InEntList; import com.rzyc.model.ent.SysEnterprise; import com.rzyc.model.user.SysUnit; import com.rzyc.model.user.SysUser; +import com.rzyc.service.PcBusinessService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -37,6 +40,7 @@ import org.apache.commons.beanutils.ConvertUtils; import org.apache.commons.beanutils.converters.DateConverter; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; @@ -64,7 +68,8 @@ import java.util.List; @Controller @Validated public class PcCompanyController extends BaseController{ - + @Autowired + PcBusinessService pcBusinessService; /** * PC企业详细 @@ -185,8 +190,8 @@ public class PcCompanyController extends BaseController{ result.setMessage(Message.PASSWORD_ERROR); } }else{ - result.setCode(Code.PASSWORD_ERROR.getCode()); - result.setMessage(Message.PASSWORD_ERROR); + result.setCode(Code.ERROR.getCode()); + result.setMessage(Message.ERROR); } }else{ result.setCode(Code.CODE_ERROT.getCode()); @@ -764,7 +769,7 @@ public class PcCompanyController extends BaseController{ @ApiOperation(value = "证照分页新增或者修改", notes = "证照分页新增或者修改") @PostMapping("/certificatesAdd") @ResponseBody - public SingleResult certificatesAdd(@Valid CertificatesAddDto certificatesAddDto)throws Exception{ + public SingleResult certificatesAdd(@RequestBody @Valid CertificatesAddDto certificatesAddDto)throws Exception{ SingleResult result = new SingleResult<>(); String userId = getUserId(); @@ -827,4 +832,85 @@ public class PcCompanyController extends BaseController{ return "SysEnterpriseId"; } + /** + * @author Xuwanxin + * 企业清单统计 + * @param listId + * @throws Exception + */ + @ApiOperation(value = "企业清单统计", notes = "企业清单统计") + @ApiImplicitParams({ + @ApiImplicitParam(name = "listId", value = "清单Id",required = true, dataType = "string"), + @ApiImplicitParam(name = "keyWord", value = "关键字",required = true, dataType = "string"), + @ApiImplicitParam(name = "page", value = "page",required = true, dataType = "int"), + @ApiImplicitParam(name = "pageSize", value = "pageSize",required = true, dataType = "int"), + }) + @GetMapping(value = "/inListStatistic") + @PreAuthorize("hasAnyAuthority('inListStatistic')") + @MethodAnnotation(authorizations = {"inListStatistic"},name = "企业清单统计") + @ResponseBody + public SingleResult entUserList(String listId, + @RequestParam(required = true) String enterpriseId, + String keyWord, + @RequestParam(required = true) Integer page, + @RequestParam(required = true) Integer pageSize)throws Exception{ + return pcBusinessService.inListStatistic(enterpriseId,listId,keyWord,page,pageSize); + } + + /** + * 企业清单类型 + * @return list + * @throws Exception + */ + @ApiOperation(value = "企业清单类型", notes = "企业清单类型") + @GetMapping(value = "/inListTypes") + @PreAuthorize("hasAnyAuthority('inListTypes')") + @MethodAnnotation(authorizations = {"inListTypes"},name = "企业清单类型") + @ResponseBody + public SingleResult> entUserList(@RequestParam(required = true) String enterpriseId)throws Exception{ + return pcBusinessService.inListTypes(enterpriseId); + } + + /** + * 企业工作要务总进度 + * @return list + * @throws Exception + */ + @ApiOperation(value = "企业工作要务总进度", notes = "企业工作要务总进度") + @GetMapping(value = "/entPostListFinishedPercent") + @ApiImplicitParams({ + @ApiImplicitParam(name = "enterpriseId", value = "企业id",required = true, dataType = "string"), + @ApiImplicitParam(name = "year", value = "年份",required = false, dataType = "string"), + @ApiImplicitParam(name = "listId", value = "清单id",required = false, dataType = "string"), + }) + @PreAuthorize("hasAnyAuthority('entPostListFinishedPercent')") + @MethodAnnotation(authorizations = {"entPostListFinishedPercent"},name = "企业工作要务总进度") + @ResponseBody + public SingleResult entPostListFinishedPercent(@RequestParam(required = true) String enterpriseId,Integer year,String listId)throws Exception{ + return pcBusinessService.entPostProcessStatistic(enterpriseId,listId,year); + } + + + /** + * 企业清单履职总统计 + * @return list + * @throws Exception + */ + @ApiOperation(value = "企业清单履职总统计", notes = "企业清单履职总统计") + @GetMapping(value = "/entPostListPercentStatistic") + @ApiImplicitParams({ + @ApiImplicitParam(name = "enterpriseId", value = "企业id",required = true, dataType = "string"), + @ApiImplicitParam(name = "year", value = "年份",required = false, dataType = "string"), + @ApiImplicitParam(name = "listId", value = "清单id",required = false, dataType = "string"), + }) + @PreAuthorize("hasAnyAuthority('entPostListPercentStatistic')") + @MethodAnnotation(authorizations = {"entPostListPercentStatistic"},name = "企业清单履职总统计") + @ResponseBody + public SingleResult entPostListPercentStatistic(@RequestParam(required = true)String enterpriseId,Integer year,String listId)throws Exception{ + return pcBusinessService.entPostListPercentStatistic(enterpriseId,listId,year); + } + + + + } diff --git a/inventory-ent/src/main/java/com/rzyc/controller/PersonalController.java b/inventory-ent/src/main/java/com/rzyc/controller/PersonalController.java index cf5b978..61e7f41 100644 --- a/inventory-ent/src/main/java/com/rzyc/controller/PersonalController.java +++ b/inventory-ent/src/main/java/com/rzyc/controller/PersonalController.java @@ -10,7 +10,12 @@ import com.common.utils.model.SingleResult; import com.rzyc.bean.user.dto.LoginDto; import com.rzyc.config.MethodAnnotation; import com.rzyc.config.RedisUtil; +import com.rzyc.model.EntPostDuty; +import com.rzyc.model.EntPostList; +import com.rzyc.model.EntPostTask; +import com.rzyc.model.EntUserCredential; import com.rzyc.model.dto.*; +import com.rzyc.model.ent.EntPost; import com.rzyc.model.ent.EntUser; import com.rzyc.service.PcBusinessService; import com.rzyc.service.UserLoginService; @@ -21,13 +26,14 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.apache.poi.ss.formula.functions.T; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; -import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -53,6 +59,11 @@ public class PersonalController extends BaseController{ RedisUtil redisUtil; + /** + *只允许使用page注解的使用此静态包装 + */ + final static SingleResult singleResult = new SingleResult(); + @Autowired public PersonalController(UserLoginService userLoginService, PcBusinessService pcBusinessService, RedisUtil redisUtil) { this.userLoginService = userLoginService; @@ -66,15 +77,15 @@ public class PersonalController extends BaseController{ */ @ApiOperation(value = "用户登录", notes = "用户登录") @PostMapping(value = "/login") - public SingleResult login(@Valid LoginDto loginDto)throws Exception{ - SingleResult result = new SingleResult<>(); + public SingleResult login(@Valid LoginDto loginDto)throws Exception{ + SingleResult result = new SingleResult<>(); String generateCode = request.getSession().getAttribute(constantsConfigure.getGenerateCodeKey())+""; //验证码只能使用一次 request.getSession().removeAttribute(constantsConfigure.getGenerateCodeKey()); if(loginDto.getGenerateCode().equals(generateCode)) { - String loginResult = userLoginService.login(loginDto.sysusername, loginDto.getSyspassword()); + EntUser loginResult = userLoginService.login(loginDto.sysusername, loginDto.getSyspassword()); if (Objects.isNull(loginResult)) { result.setCode(Code.PASSWORD_OR_ACCOUNT_ERROR.getCode()); result.setMessage(Message.PASSWORD_OR_ACCOUNT_ERROR); @@ -89,6 +100,10 @@ public class PersonalController extends BaseController{ return result; } + + + + /** * 企业登录 * @param loginDto @@ -170,7 +185,7 @@ public class PersonalController extends BaseController{ @PreAuthorize("hasAnyAuthority('entUserTree','entUserTree:update')") @MethodAnnotation(authorizations = {"entUserTree","entUserTree:update"},name = "企业用户组织树") @ResponseBody - public SingleResult> entUserTree(@NotNull(message = "公司id不能为null") String enterpriseId, String postId)throws Exception{ + public SingleResult> entUserTree(@RequestParam(required = true) String enterpriseId, String postId)throws Exception{ return pcBusinessService.entUserTree(enterpriseId,postId); } @@ -182,12 +197,13 @@ public class PersonalController extends BaseController{ * @throws Exception */ @ApiOperation(value = "企业用户工作要务", notes = "企业用户工作要务") - @GetMapping(value = "/entUserPostList") + @PostMapping(value = "/entUserPostList") @PreAuthorize("hasAnyAuthority('entUserPostList','entUserPostList:update')") @MethodAnnotation(authorizations = {"entUserPostList","entUserPostList:update"},name = "企业用户工作要务") @ResponseBody - public SingleResult entUserPostList(@RequestBody EntUserPostListDto entUserPostListDto)throws Exception{ - return pcBusinessService.entUserPostList(entUserPostListDto); + public SingleResult> entUserPostList(@RequestBody EntUserPostListDto entUserPostListDto)throws Exception{ + singleResult.setData(pcBusinessService.entUserPostList(entUserPostListDto)); + return singleResult; } @@ -196,13 +212,14 @@ public class PersonalController extends BaseController{ * @return 企业用户工作清单 * @throws Exception */ - @ApiOperation(value = "企业用户工作清单", notes = "企业用户工作清单") - @GetMapping(value = "/entUserPostTask") + @ApiOperation(value = "企业用户日常工作清单", notes = "企业用户日常工作清单") + @PostMapping(value = "/entUserPostTask") @PreAuthorize("hasAnyAuthority('entUserPostTask','entUserPostTask:update')") - @MethodAnnotation(authorizations = {"entUserPostTask","entUserPostTask:update"},name = "企业用户工作清单") + @MethodAnnotation(authorizations = {"entUserPostTask","entUserPostTask:update"},name = "企业用户日常工作清单") @ResponseBody - public SingleResult entUserPostTask(@RequestBody EntUserPostTaskDto entUserPostTaskDto)throws Exception{ - return pcBusinessService.entUserPostTask(entUserPostTaskDto); + public SingleResult> entUserPostTask(@RequestBody EntUserPostTaskDto entUserPostTaskDto)throws Exception{ + singleResult.setData(pcBusinessService.entUserPostTask(entUserPostTaskDto)); + return singleResult; } @@ -213,12 +230,13 @@ public class PersonalController extends BaseController{ * @throws Exception */ @ApiOperation(value = "企业用户岗位职责", notes = "企业用户岗位职责") - @GetMapping(value = "/entUserPostDuty") + @PostMapping(value = "/entUserPostDuty") @PreAuthorize("hasAnyAuthority('entUserPostDuty','entUserPostDuty:update')") @MethodAnnotation(authorizations = {"entUserPostDuty","entUserPostDuty:update"},name = "企业用户岗位职责") @ResponseBody - public SingleResult entUserPostDuty(@RequestBody EntUserPostDutyDto entUserPostDutyDto)throws Exception{ - return pcBusinessService.entUserPostDuty(entUserPostDutyDto); + public SingleResult> entUserPostDuty(@RequestBody EntUserPostDutyDto entUserPostDutyDto)throws Exception{ + singleResult.setData(pcBusinessService.entUserPostDuty(entUserPostDutyDto)); + return singleResult; } /** @@ -237,7 +255,7 @@ public class PersonalController extends BaseController{ @PreAuthorize("hasAnyAuthority('entUserCredential','entUserCredential:update')") @MethodAnnotation(authorizations = {"entUserCredential","entUserCredential:update"},name = "企业用户证照表") @ResponseBody - public SingleResult entUserCredential(@NotNull(message = "企业用户id不能为null") String entUserId, @NotNull(message = "页码不能为null") Integer page, @NotNull(message = "条数不能为null")Integer pageSize)throws Exception{ + public SingleResult> entUserCredential(@RequestParam(required = true) String entUserId, @RequestParam(required = true) Integer page, @RequestParam(required = true)Integer pageSize)throws Exception{ return pcBusinessService.entUserCredential(null,entUserId,page,pageSize); } @@ -256,9 +274,9 @@ public class PersonalController extends BaseController{ @MethodAnnotation(authorizations = {"entUserCredentialUpdate:update"},name = "企业用户证照表-新增,修改") @ResponseBody public SingleResult entUserCredentialUpdate(@RequestBody EntUserCredentialUpdateDto entUserCredentialUpdateDto)throws Exception{ - ListentUserCredentialUpdateDtos = new ArrayList<>(); - entUserCredentialUpdateDtos.add(entUserCredentialUpdateDto); - return pcBusinessService.entUserCredentialUpdate(entUserCredentialUpdateDtos); + ListentUserCredentialUpdateDtoList= new ArrayList<>(); + entUserCredentialUpdateDtoList.add(entUserCredentialUpdateDto); + return pcBusinessService.entUserCredentialUpdate(entUserCredentialUpdateDtoList); } @@ -276,31 +294,33 @@ public class PersonalController extends BaseController{ @PreAuthorize("hasAnyAuthority('entUserCredentialDelete')") @MethodAnnotation(authorizations = {"entUserCredentialDelete"},name = "企业用户证照表-删除") @ResponseBody - public SingleResult entUserCredentialDelete(@NotNull(message = "证件照id不能为null") String credentialId)throws Exception{ + public SingleResult entUserCredentialDelete(@RequestParam(required = true) String credentialId)throws Exception{ return pcBusinessService.entUserCredentialDelete(credentialId); } /** - * 企业岗位总体信息列表 + * 企业岗位人员总体信息列表 * @param keyContent * @return list * @throws Exception */ - @ApiOperation(value = "企业岗位总体信息列表", notes = "企业岗位总体信息列表") + @ApiOperation(value = "企业岗位人员总体信息列表", notes = "企业岗位人员总体信息列表") @ApiImplicitParams({ @ApiImplicitParam(name = "keyContent", value = "搜索关键字",required = true, dataType = "string"), @ApiImplicitParam(name = "page", value = "page",required = true, dataType = "int"), @ApiImplicitParam(name = "pageSize", value = "pageSize",required = true, dataType = "int"), + @ApiImplicitParam(name = "postId", value = "postId",required = false, dataType = "string"), }) @GetMapping(value = "/entUserList") @PreAuthorize("hasAnyAuthority('entUserList','entUserList:update')") - @MethodAnnotation(authorizations = {"entUserList","entUserList:update"},name = "企业岗位总体信息列表") + @MethodAnnotation(authorizations = {"entUserList","entUserList:update"},name = "企业岗位人员总体信息列表") @ResponseBody - public SingleResult entUserList(@NotNull(message = "搜索关键字不能为null") String keyContent, - @NotNull(message = "页码不能为null") Integer page, - @NotNull(message = "条数不能为null") Integer pageSize)throws Exception{ - return pcBusinessService.entUserList(keyContent,page,pageSize); + public SingleResult> entUserList(@RequestParam(required = true) String keyContent, + @RequestParam(required = false) String postId, + @RequestParam(required = true) Integer page, + @RequestParam(required = true) Integer pageSize)throws Exception{ + return pcBusinessService.entUserList(keyContent,page,pageSize,postId); } @@ -356,29 +376,28 @@ public class PersonalController extends BaseController{ } + /** - * 企业清单统计 - * @param listId + * 企业清单(类型)分组查询 + * @param enterpriseId * @return list * @throws Exception */ - @ApiOperation(value = "企业清单统计", notes = "企业清单统计") + @ApiOperation(value = "企业清单(类型)分组查询", notes = "企业清单(类型)分组查询") @ApiImplicitParams({ - @ApiImplicitParam(name = "listId", value = "清单Id",required = true, dataType = "string"), - @ApiImplicitParam(name = "keyWord", value = "关键字",required = true, dataType = "string"), - @ApiImplicitParam(name = "page", value = "page",required = true, dataType = "int"), - @ApiImplicitParam(name = "pageSize", value = "pageSize",required = true, dataType = "int"), + @ApiImplicitParam(name = "enterpriseId", value = "企业id",required = true, dataType = "string"), + @ApiImplicitParam(name = "listId", value = "清单id",required = false, dataType = "string"), + @ApiImplicitParam(name = "userId", value = "用户id",required = true, dataType = "string"), }) - @GetMapping(value = "/inListStatistic") - @PreAuthorize("hasAnyAuthority('inListStatistic')") - @MethodAnnotation(authorizations = {"inListStatistic"},name = "企业清单统计") + @GetMapping(value = "/entListGroupByListId") + @PreAuthorize("hasAnyAuthority('entListGroupByListId')") + @MethodAnnotation(authorizations = {"entListGroupByListId"},name = "企业清单(类型)分组查询") @ResponseBody - public SingleResult entUserList(String listId, - @NotNull(message = "企业Id") String enterpriseId, - String keyWord, - @NotNull(message = "页码不能为null") Integer page, - @NotNull(message = "条数不能为null") Integer pageSize)throws Exception{ - return pcBusinessService.inListStatistic(enterpriseId,listId,keyWord,page,pageSize); + public SingleResult> entListGroupByListId(@RequestParam(required = true) String enterpriseId, + String listId, + @RequestParam(required = true) String userId + )throws Exception{ + return pcBusinessService.entListGroupByListId(enterpriseId,listId,userId); } @@ -391,4 +410,5 @@ public class PersonalController extends BaseController{ + } diff --git a/inventory-ent/src/main/java/com/rzyc/filter/JwtAuthenticationTokenFiler.java b/inventory-ent/src/main/java/com/rzyc/filter/JwtAuthenticationTokenFiler.java index c2c8642..abf5034 100644 --- a/inventory-ent/src/main/java/com/rzyc/filter/JwtAuthenticationTokenFiler.java +++ b/inventory-ent/src/main/java/com/rzyc/filter/JwtAuthenticationTokenFiler.java @@ -2,6 +2,7 @@ package com.rzyc.filter; import com.common.utils.jwt.JwtUtil; import com.rzyc.advice.CustomException; +import com.rzyc.config.RedisUtil; import com.rzyc.mapper.AuthorityKeyMapper; import com.rzyc.model.AuthorityKey; import lombok.extern.slf4j.Slf4j; @@ -31,11 +32,18 @@ import java.util.List; * */ @Component -@Slf4j public class JwtAuthenticationTokenFiler extends OncePerRequestFilter { - @Autowired + AuthorityKeyMapper authorityKeyMapper; + RedisUtil redisUtil; + + @Autowired + public JwtAuthenticationTokenFiler(AuthorityKeyMapper authorityKeyMapper, RedisUtil redisUtil) { + this.authorityKeyMapper = authorityKeyMapper; + this.redisUtil = redisUtil; + } + @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { //获取token @@ -56,23 +64,24 @@ public class JwtAuthenticationTokenFiler extends OncePerRequestFilter { throw new RuntimeException("token非法"); } try { - - Listauthorizations = authorityKeyMapper.allAuthorizations(); + //这里是要去拿角色权限的 + Listauthorizations = (List) redisUtil.get("allKeys"); List authority= new ArrayList(); - StringBuilder stringBuilder = new StringBuilder(); - for (AuthorityKey s:authorizations) { - stringBuilder.append(s.getAuthKey()); - authority.add(new SimpleGrantedAuthority(stringBuilder.toString())); - stringBuilder.setLength(0); - } + if (null != authorizations && authorizations.size() > 0 ){ + StringBuilder stringBuilder = new StringBuilder(); + for (AuthorityKey s:authorizations) { + stringBuilder.append(s.getAuthKey()); + authority.add(new SimpleGrantedAuthority(stringBuilder.toString())); + stringBuilder.setLength(0); + } + + + } // 获取权限信息封装到Authentication中 UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(null,null,authority); SecurityContextHolder.getContext().setAuthentication(authenticationToken); - - - filterChain.doFilter(request, response); }catch (AccessDeniedException e){ System.out.println("权限失败"); diff --git a/inventory-ent/src/main/java/com/rzyc/service/PcBusinessService.java b/inventory-ent/src/main/java/com/rzyc/service/PcBusinessService.java index 6c00c96..dcb6e36 100644 --- a/inventory-ent/src/main/java/com/rzyc/service/PcBusinessService.java +++ b/inventory-ent/src/main/java/com/rzyc/service/PcBusinessService.java @@ -17,6 +17,7 @@ import com.rzyc.model.dto.*; import com.rzyc.model.ent.EntPost; import com.rzyc.model.ent.EntUser; import com.rzyc.model.dto.SparePartDto; +import com.rzyc.model.ent.InEntList; import com.rzyc.model.ent.SysEnterprise; import org.springframework.beans.BeanUtils; @@ -68,15 +69,17 @@ public class PcBusinessService extends BaseController { * sql里进行了order by,如果传入postId就是查询非全部的数结构,需要加入一个公司,所以把第一个最大权限设置为company,这样公司才会在树的最上面 * 相反不穿postId就是查询全部,默认会有company打头就不用再修改list的0对象 */ - if (null != postId){ - list.get(0).setParentId("company"); - } //加入公司为第一个树结构 EntPost entPost = new EntPost(); entPost.setName(sysEnterprise.getEntname()); entPost.setPostId("company"); list.add(entPost); + if (null != postId){ + list.get(0).setParentId("company"); + } + + JSONArray jsonArray = handleEntUserTree(list); Listposts = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),EntPost.class); singleResult.setData(posts); @@ -113,35 +116,34 @@ public class PcBusinessService extends BaseController { return result; } + public List entUserPostList(EntUserPostListDto entUserPostListDto) throws Exception { + entUserPostListDto.setPostId(getUserPostId()); - public SingleResult entUserPostList(EntUserPostListDto entUserPostListDto){ - SingleResult singleResult = new SingleResult(); - entUserPostListDto.setPage(entUserPostListDto.getPageSize() * (entUserPostListDto.getPage() - 1)); - Listlist = entPostListMapper.selectEntPostList(entUserPostListDto.getEnterpriseId(),entUserPostListDto.getEntUserId(), + Listlist = entPostListMapper.selectEntPostList(entUserPostListDto.getEnterpriseId(),entUserPostListDto.getEntUserId(),entUserPostListDto.getFinishedState(), entUserPostListDto.getPostId(),entUserPostListDto.getPage(),entUserPostListDto.getPageSize()); - singleResult.setData(list); - return singleResult; + + return list; } - public SingleResult entUserPostTask(EntUserPostTaskDto entUserPostTaskDto){ - SingleResult singleResult = new SingleResult(); - entUserPostTaskDto.setPage(entUserPostTaskDto.getPageSize() * (entUserPostTaskDto.getPage() - 1)); + public List entUserPostTask(EntUserPostTaskDto entUserPostTaskDto) throws Exception { + entUserPostTaskDto.setPostId(getUserPostId()); + //当listId为null时,默认第一个日常清单,查询所有正在进行中的任务 + if (null == entUserPostTaskDto.getListId()){ + //2为正在进行中 + entUserPostTaskDto.setTaskState(1); + } //EntPostTask Listlist = entPostTaskMapper.selectEntUserPostTask(entUserPostTaskDto.getEnterpriseId(),entUserPostTaskDto.getEntUserId(),entUserPostTaskDto.getPostId() - ,entUserPostTaskDto.getListId(),entUserPostTaskDto.getContent(),entUserPostTaskDto.getTaskState(), - entUserPostTaskDto.getPage(),entUserPostTaskDto.getPageSize()); - singleResult.setData(list); - return singleResult; + ,entUserPostTaskDto.getListId(),entUserPostTaskDto.getContent(),entUserPostTaskDto.getTaskState()); + return list; } - public SingleResult entUserPostDuty(EntUserPostDutyDto entUserPostDutyDto){ - SingleResult singleResult = new SingleResult(); - entUserPostDutyDto.setPage( entUserPostDutyDto.getPageSize() * (entUserPostDutyDto.getPage() - 1)); + public List entUserPostDuty(EntUserPostDutyDto entUserPostDutyDto) throws Exception { + entUserPostDutyDto.setPostId(getUserPostId()); //EntPostDuty - Listlist = entPostDutyMapper.selectEntUserPostDuty(entUserPostDutyDto.getEnterpriseId(),entUserPostDutyDto.getPostId(),entUserPostDutyDto.getPage(),entUserPostDutyDto.getPageSize()); - singleResult.setData(list); - return singleResult; + Listlist = entPostDutyMapper.selectEntUserPostDuty(entUserPostDutyDto.getEnterpriseId(),entUserPostDutyDto.getPostId()); + return list; } @@ -188,10 +190,10 @@ public class PcBusinessService extends BaseController { } - public SingleResult entUserList(String keyContent,Integer page,Integer pageSize){ + public SingleResult entUserList(String keyContent,Integer page,Integer pageSize,String postId){ SingleResult singleResult = new SingleResult(); page = pageSize * (page - 1); - Listusers = entUserMapper.selectEntUserList(keyContent,page,pageSize); + Listusers = entUserMapper.selectEntUserList(keyContent,page,pageSize,postId); //计算履职百分比,后期这里使用redis来读取履职进度 for (EntUser e:users) { Integer total = e.getFinishTask() + e.getOngoingTask() + e.getOverTimeTask(); @@ -232,7 +234,10 @@ public class PcBusinessService extends BaseController { singleResult.setMessage(Message.ERROR); } //插入证件图 - singleResult = this.entUserCredentialUpdate(addOrUpdateEntUserDto.getEntUserCredentialUpdateDtos()); + if (null != addOrUpdateEntUserDto.getEntUserCredentialUpdateDtos() && addOrUpdateEntUserDto.getEntUserCredentialUpdateDtos().size() > 0 ){ + singleResult = this.entUserCredentialUpdate(addOrUpdateEntUserDto.getEntUserCredentialUpdateDtos()); + } + return singleResult; } @@ -325,8 +330,9 @@ public class PcBusinessService extends BaseController { entPost.setModifyTime(new Date()); result = entPostMapper.updateEntPost(entPost); }else { - entPost.setCreateBy(getUserId()); + entPost.setPostId(RandomNumber.getUUid()); entPost.setCreateTime(new Date()); + entPost.setCreateBy(getUserId()); result = entPostMapper.insertEntPost(entPost); } if (result != 1 ){ @@ -620,9 +626,9 @@ public class PcBusinessService extends BaseController { public SingleResult inListStatistic(String enterpriseId,String listId,String keyWord,Integer page,Integer pageSize){ SingleResult singleResult = new SingleResult(); HashMap map = new HashMap(); - Integer total = entPostListMapper.selectEntPostListCount(enterpriseId,listId); + Integer total = entPostListMapper.selectEntPostListCount(enterpriseId,listId,null); //2代表已完成状态 - Integer finishCount = entPostListMapper.selectEntPostListFinishedCount(enterpriseId,listId,2); + Integer finishCount = entPostListMapper.selectEntPostListFinishedCount(enterpriseId,listId,2,null); double finishPercent = Arith.div(total,finishCount) * 100; map.put("finishPercent",finishPercent); Listtasks = entPostTaskMapper.selectEntUserPostTaskByListId(enterpriseId,listId,keyWord,page,pageSize); @@ -631,6 +637,67 @@ public class PcBusinessService extends BaseController { return singleResult; } + public SingleResult inListTypes(String enterpriseId){ + SingleResult singleResult = new SingleResult(); + Listlist = inEntListMapper.selectByEnterpriseId(enterpriseId); + singleResult.setData(list); + return singleResult; + } + + public SingleResult entPostProcessStatistic(String enterpriseId,String listId,Integer year){ + SingleResult singleResult = new SingleResult(); + Integer total = entPostListMapper.selectEntPostListCount(enterpriseId,listId,year); + //2代表已完成状态 + Integer finishCount = entPostListMapper.selectEntPostListFinishedCount(enterpriseId,listId,2,year); + double finishPercent = Arith.div(finishCount,total) * 100; + singleResult.setData(finishPercent); + return singleResult; + } + + + + public SingleResult entPostListPercentStatistic(String enterpriseId,String listId,Integer year){ + SingleResult singleResult = new SingleResult(); + HashMap map = new HashMap(); + long total = entPostTaskMapper.selectEntPostTaskTotal(enterpriseId,listId,year); + //2代表已完成状态 + EntPostTaskStatistic entPostTaskStatistic = entPostTaskMapper.selectEntPostTaskByState(enterpriseId,listId,year); + double finishPercent = Arith.div(entPostTaskStatistic.getFinished(),total) * 100; + map.put("finished",finishPercent); + double unfinishedPercent = Arith.div(entPostTaskStatistic.getOvertime(),total) * 100; + map.put("unfinished",unfinishedPercent); + double haveInHand = Arith.div(entPostTaskStatistic.getHaveInHand(),total) * 100; + map.put("haveInHand",haveInHand); + singleResult.setData(map); + return singleResult; + } + + + /** + * 获取用户岗位id + * 如果redis不存在,就查询再存放到redis + * */ + private String getUserPostId() throws Exception { + String userId = getUserId(); + Object object = redisUtil.get("postId:userId"+userId); + if (null == object){ + EntUser entUser = entUserMapper.selectById(userId); + redisUtil.set("postId:userId"+userId,entUser.getPostId()); + return entUser.getPostId(); + }else { + return (String)object; + } + } + + public SingleResult entListGroupByListId(String enterpriseId,String listId,String userId){ + SingleResult singleResult = new SingleResult(); + List list = entPostListMapper.selectEntListGroupByListId(enterpriseId,listId,userId); + singleResult.setData(list); + return singleResult; + } + + + } diff --git a/inventory-ent/src/main/java/com/rzyc/service/UserDetailsServiceImpl.java b/inventory-ent/src/main/java/com/rzyc/service/UserDetailsServiceImpl.java index 90d4c74..d7c73a7 100644 --- a/inventory-ent/src/main/java/com/rzyc/service/UserDetailsServiceImpl.java +++ b/inventory-ent/src/main/java/com/rzyc/service/UserDetailsServiceImpl.java @@ -1,6 +1,7 @@ package com.rzyc.service; +import com.rzyc.advice.CustomException; import com.rzyc.config.RedisUtil; import com.rzyc.config.UserDetailsAndId; import com.rzyc.enums.SysEnterpriseState; @@ -74,17 +75,18 @@ public class UserDetailsServiceImpl implements UserDetailsService { EntUser entUser = entUserMapper.selectByName(name); if (Objects.isNull(entUser)){ - throw new UsernameNotFoundException("用户名不存在"); + throw new CustomException("用户名不存在"); } List authority= new ArrayList(); Listauthorizations = authorityKeyMapper.allAuthorizations(); + redisUtil.set("allKeys",authorizations); StringBuilder stringBuilder = new StringBuilder(); for (AuthorityKey s:authorizations) { stringBuilder.append(s.getAuthKey()); authority.add(new SimpleGrantedAuthority(stringBuilder.toString())); stringBuilder.setLength(0); } - return new UserDetailsAndId(entUser.getName(), passwordEncoder.encode(entUser.getPasswd()), authority,entUser.getEntUserId()); + return new UserDetailsAndId(entUser.getName(), passwordEncoder.encode(entUser.getPasswd()), authority,entUser.getEntUserId(),entUser.getPostId()); } } diff --git a/inventory-ent/src/main/java/com/rzyc/service/UserLoginService.java b/inventory-ent/src/main/java/com/rzyc/service/UserLoginService.java index 65fff23..d0bc977 100644 --- a/inventory-ent/src/main/java/com/rzyc/service/UserLoginService.java +++ b/inventory-ent/src/main/java/com/rzyc/service/UserLoginService.java @@ -7,7 +7,10 @@ import com.common.utils.jwt.JwtUtil; import com.rzyc.advice.CustomException; import com.rzyc.config.UserDetailsAndId; import com.rzyc.enums.SysEnterpriseState; +import com.rzyc.mapper.ent.EntPostMapper; import com.rzyc.mapper.ent.SysEnterpriseMapper; +import com.rzyc.model.ent.EntPost; +import com.rzyc.model.ent.EntUser; import com.rzyc.model.ent.SysEnterprise; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.BadCredentialsException; @@ -46,20 +49,26 @@ public class UserLoginService { * */ private SysEnterpriseMapper sysEnterpriseMapper; + /** + * 企业端岗位 + * */ + private EntPostMapper entPostMapper; + @Autowired - public void UserLoginServiceFinder(UserDetailsService userDetailsService,PasswordEncoder passwordEncoder,SysEnterpriseMapper sysEnterpriseMapper){ + public void UserLoginServiceFinder(UserDetailsService userDetailsService,PasswordEncoder passwordEncoder,SysEnterpriseMapper sysEnterpriseMapper,EntPostMapper entPostMapper){ this.userDetailsService = userDetailsService; this.passwordEncoder = passwordEncoder; this.sysEnterpriseMapper= sysEnterpriseMapper; + this.entPostMapper = entPostMapper; } - public String login(String username, String password)throws Exception { - String token = null; - try { + public EntUser login(String username, String password)throws Exception { + EntUser entUser = new EntUser(); + String token = null; UserDetails userDetails = userDetailsService.loadUserByUsername(username); if (Objects.isNull(userDetails)) { - throw new UsernameNotFoundException("账号不存在"); + throw new CustomException("账号不存在"); } SysEnterprise sysEnterprise = sysEnterpriseMapper.findEnterpriseByName(username); if (Objects.isNull(sysEnterprise) || sysEnterprise.getState().equals(SysEnterpriseState.DISABLE)){ @@ -67,7 +76,7 @@ public class UserLoginService { } //这里可能会不对,因为我们是MD5,这个是spring security 中的 encoder加密 if (!passwordEncoder.matches(MD5.md5(password), userDetails.getPassword())) { - throw new BadCredentialsException("密码不正确"); + throw new CustomException("密码不正确"); } //spring security context insert UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); @@ -75,9 +84,14 @@ public class UserLoginService { //企业用户id String id = ((UserDetailsAndId)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getId(); token = JwtUtil.createToken(id); - } catch (AuthenticationException e) { - e.printStackTrace(); - } - return token; + String postId = ((UserDetailsAndId)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getPostId(); + EntPost entPost = entPostMapper.selectById(postId); + //封装返回数据 + entUser.setName(userDetails.getUsername()); + entUser.setEntUserId(id); + entUser.setEnterpriseId(sysEnterprise.getSysenterpriseid()); + entUser.setToken(token); + entUser.setEntPostName(entPost.getName()); + return entUser; } } diff --git a/inventory-ent/src/main/java/com/rzyc/utils/StringEncryptorTest.java b/inventory-ent/src/main/java/com/rzyc/utils/StringEncryptorTest.java index 8e0992d..2216e4d 100644 --- a/inventory-ent/src/main/java/com/rzyc/utils/StringEncryptorTest.java +++ b/inventory-ent/src/main/java/com/rzyc/utils/StringEncryptorTest.java @@ -17,8 +17,8 @@ public class StringEncryptorTest { @Test public void test(){ - String text = "你的盐"; - String password = "你的密码"; + String text = "rzyc2022"; + String password = "123qqq...A"; StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); //加密配置 EnvironmentStringPBEConfig config = new EnvironmentStringPBEConfig();