企业端设备模块->和前端调试接口
This commit is contained in:
parent
0db404563a
commit
a279ce4315
|
|
@ -23,10 +23,8 @@ public interface EntPostDutyMapper extends BaseMapper<EntPostDuty> {
|
||||||
* 企业用户岗位职责
|
* 企业用户岗位职责
|
||||||
* @param enterpriseId 企业id
|
* @param enterpriseId 企业id
|
||||||
* @param postId 岗位id
|
* @param postId 岗位id
|
||||||
* @param page 页码
|
|
||||||
* @param pageSize 条数
|
|
||||||
* @return EntPostTask 企业用户岗位职责
|
* @return EntPostTask 企业用户岗位职责
|
||||||
* */
|
* */
|
||||||
List<EntPostDuty>selectEntUserPostDuty(@Param("enterpriseId") String enterpriseId, @Param("postId")String postId,@Param("page") Integer page,@Param("pageSize")Integer pageSize);
|
List<EntPostDuty>selectEntUserPostDuty(@Param("enterpriseId") String enterpriseId, @Param("postId")String postId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,27 +24,41 @@ public interface EntPostListMapper extends BaseMapper<EntPostList> {
|
||||||
*
|
*
|
||||||
* @param enterpriseId 企业id
|
* @param enterpriseId 企业id
|
||||||
* @param entUserId 企业用户id
|
* @param entUserId 企业用户id
|
||||||
|
* @param finishedState 完成状态
|
||||||
* @param postId 岗位id
|
* @param postId 岗位id
|
||||||
* @param page 页码
|
* @param page 页码
|
||||||
* @param pageSize 条数
|
* @param pageSize 条数
|
||||||
* @return EntPostList 企业用户工作要务
|
* @return EntPostList 企业用户工作要务
|
||||||
*/
|
*/
|
||||||
List<EntPostList> selectEntPostList(@Param("enterpriseId") String enterpriseId, @Param("entUserId") String entUserId, @Param("postId") String postId, Integer page, Integer pageSize);
|
List<EntPostList> 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 enterpriseId 企业id
|
||||||
* @param listId 企业用户id
|
* @param listId 企业用户id
|
||||||
|
* @param year 年份
|
||||||
* @return int 企业岗位条数
|
* @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 enterpriseId 企业id
|
||||||
* @param listId 企业用户id
|
* @param listId 企业用户id
|
||||||
* @param state 状态
|
* @param state 状态
|
||||||
|
* @param year 年份
|
||||||
* @return int 企业清单完成条数
|
* @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 企业清单(类型)
|
||||||
|
*/
|
||||||
|
List<EntPostList>selectEntListGroupByListId(@Param("enterpriseId") String enterpriseId,@Param("listId")String listId,@Param("userId")String userId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.rzyc.mapper;
|
||||||
|
|
||||||
import com.rzyc.model.EntPostTask;
|
import com.rzyc.model.EntPostTask;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.rzyc.model.EntPostTaskStatistic;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
|
@ -27,14 +28,11 @@ public interface EntPostTaskMapper extends BaseMapper<EntPostTask> {
|
||||||
* @param listId 清单id
|
* @param listId 清单id
|
||||||
* @param content 内容模糊搜索
|
* @param content 内容模糊搜索
|
||||||
* @param taskState 任务状态
|
* @param taskState 任务状态
|
||||||
* @param page 页码
|
|
||||||
* @param pageSize 条数
|
|
||||||
* @return EntPostTask 企业用户清单任务
|
* @return EntPostTask 企业用户清单任务
|
||||||
* */
|
* */
|
||||||
List<EntPostTask>selectEntUserPostTask(@Param("enterpriseId") String enterpriseId, @Param("entUserId")String entUserId,
|
List<EntPostTask>selectEntUserPostTask(@Param("enterpriseId") String enterpriseId, @Param("entUserId")String entUserId,
|
||||||
@Param("postId")String postId, @Param("listId")String listId,
|
@Param("postId")String postId, @Param("listId")String listId,
|
||||||
@Param("content")String content,@Param("taskState") Integer taskState,
|
@Param("content")String content,@Param("taskState") Integer taskState);
|
||||||
@Param("page") Integer page,@Param("pageSize") Integer pageSize);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -50,7 +48,22 @@ public interface EntPostTaskMapper extends BaseMapper<EntPostTask> {
|
||||||
@Param("page") Integer page,@Param("pageSize") Integer pageSize);
|
@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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,10 @@ public interface EntUserMapper extends BaseMapper<EntUser> {
|
||||||
* @param keyContent 关键字
|
* @param keyContent 关键字
|
||||||
* @param page 页码
|
* @param page 页码
|
||||||
* @param pageSize 条数
|
* @param pageSize 条数
|
||||||
|
* @param postId 岗位id
|
||||||
* @return EntUser 企业用户实体
|
* @return EntUser 企业用户实体
|
||||||
* */
|
* */
|
||||||
List<EntUser>selectEntUserList(@Param("keyContent") String keyContent,@Param("page")Integer page,@Param("pageSize")Integer pageSize);
|
List<EntUser>selectEntUserList(@Param("keyContent") String keyContent,@Param("page")Integer page,@Param("pageSize")Integer pageSize,@Param("postId")String postId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.rzyc.mapper.ent;
|
||||||
|
|
||||||
import com.rzyc.model.ent.InEntList;
|
import com.rzyc.model.ent.InEntList;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -17,5 +18,11 @@ import java.util.List;
|
||||||
@Repository
|
@Repository
|
||||||
public interface InEntListMapper extends BaseMapper<InEntList> {
|
public interface InEntListMapper extends BaseMapper<InEntList> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询企业清单类型
|
||||||
|
* @param enterpriseId 企业id
|
||||||
|
* @return list
|
||||||
|
* */
|
||||||
|
List<InEntList> selectByEnterpriseId(@Param("enterpriseId") String enterpriseId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,8 +103,33 @@ public class EntPostList implements Serializable {
|
||||||
private String modifyBy;
|
private String modifyBy;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
|
@ApiModelProperty(value = "已完成数")
|
||||||
private Integer finishCount;
|
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() {
|
public Integer getFinishCount() {
|
||||||
return finishCount;
|
return finishCount;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,6 +14,7 @@ import javax.validation.constraints.NotNull;
|
||||||
* */
|
* */
|
||||||
public class AddOrUpdateEntPostDto {
|
public class AddOrUpdateEntPostDto {
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@ApiModelProperty(value = "企业岗位id")
|
@ApiModelProperty(value = "企业岗位id")
|
||||||
private String postId;
|
private String postId;
|
||||||
|
|
||||||
|
|
@ -37,6 +38,16 @@ public class AddOrUpdateEntPostDto {
|
||||||
@ApiModelProperty(value = "岗位层级")
|
@ApiModelProperty(value = "岗位层级")
|
||||||
private Integer postLevel;
|
private Integer postLevel;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序字段")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
public Integer getSort() {
|
||||||
|
return sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSort(Integer sort) {
|
||||||
|
this.sort = sort;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPostId() {
|
public String getPostId() {
|
||||||
return postId;
|
return postId;
|
||||||
|
|
|
||||||
|
|
@ -15,18 +15,17 @@ import javax.validation.constraints.NotNull;
|
||||||
public class EntUserPostDutyDto {
|
public class EntUserPostDutyDto {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@ApiModelProperty(value = "企业id")
|
@ApiModelProperty(value = "企业id",required = true)
|
||||||
private String enterpriseId;
|
private String enterpriseId;
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@ApiModelProperty(value = "岗位id")
|
@ApiModelProperty(value = "岗位id")
|
||||||
private String postId;
|
private String postId;
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@ApiModelProperty(value = "页码")
|
@ApiModelProperty(value = "页码")
|
||||||
private Integer page;
|
private Integer page;
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@ApiModelProperty(value = "条数")
|
@ApiModelProperty(value = "条数")
|
||||||
private Integer pageSize;
|
private Integer pageSize;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,25 +14,36 @@ import javax.validation.constraints.NotNull;
|
||||||
@ApiModel(value = "企业用户岗位要务Dto",description = "企业用户岗位要务Dto")
|
@ApiModel(value = "企业用户岗位要务Dto",description = "企业用户岗位要务Dto")
|
||||||
public class EntUserPostListDto {
|
public class EntUserPostListDto {
|
||||||
@NotNull
|
@NotNull
|
||||||
@ApiModelProperty(value = "企业id")
|
@ApiModelProperty(value = "企业id",required = true)
|
||||||
String enterpriseId;
|
String enterpriseId;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@ApiModelProperty(value = "企业用户id")
|
@ApiModelProperty(value = "企业用户id",required = true)
|
||||||
String entUserId;
|
String entUserId;
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "岗位id")
|
@ApiModelProperty(value = "岗位id")
|
||||||
String postId;
|
String postId;
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@ApiModelProperty(value = "页码")
|
@ApiModelProperty(value = "页码")
|
||||||
Integer page;
|
Integer page;
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@ApiModelProperty(value = "条数")
|
@ApiModelProperty(value = "条数")
|
||||||
Integer pageSize;
|
Integer pageSize;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "完成状态")
|
||||||
|
Integer finishedState;
|
||||||
|
|
||||||
|
public Integer getFinishedState() {
|
||||||
|
return finishedState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFinishedState(Integer finishedState) {
|
||||||
|
this.finishedState = finishedState;
|
||||||
|
}
|
||||||
|
|
||||||
public String getEnterpriseId() {
|
public String getEnterpriseId() {
|
||||||
return enterpriseId;
|
return enterpriseId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,11 @@ import javax.validation.constraints.NotNull;
|
||||||
public class EntUserPostTaskDto {
|
public class EntUserPostTaskDto {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@ApiModelProperty(value = "企业id")
|
@ApiModelProperty(value = "企业id",required = true)
|
||||||
String enterpriseId;
|
String enterpriseId;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@ApiModelProperty(value = "企业用户id")
|
@ApiModelProperty(value = "企业用户id",required = true)
|
||||||
String entUserId;
|
String entUserId;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -34,15 +34,15 @@ public class EntUserPostTaskDto {
|
||||||
@ApiModelProperty(value = "模糊内容")
|
@ApiModelProperty(value = "模糊内容")
|
||||||
String content;
|
String content;
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@ApiModelProperty(value = "任务状态")
|
@ApiModelProperty(value = "任务状态")
|
||||||
Integer taskState;
|
Integer taskState;
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@ApiModelProperty(value = "页码")
|
@ApiModelProperty(value = "页码")
|
||||||
Integer page;
|
Integer page;
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@ApiModelProperty(value = "条数")
|
@ApiModelProperty(value = "条数")
|
||||||
Integer pageSize;
|
Integer pageSize;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,17 +112,31 @@ public class EntUser implements Serializable {
|
||||||
@ApiModelProperty(value = "工号")
|
@ApiModelProperty(value = "工号")
|
||||||
private String jobNumber;
|
private String jobNumber;
|
||||||
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private LocalTime localTime;
|
private String token;
|
||||||
|
|
||||||
public LocalTime getLocalTime() {
|
@ApiModelProperty(value = "岗位名字")
|
||||||
return localTime;
|
@TableField(exist = false)
|
||||||
|
private String entPostName;
|
||||||
|
|
||||||
|
public String getEntPostName() {
|
||||||
|
return entPostName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLocalTime(LocalTime localTime) {
|
public void setEntPostName(String entPostName) {
|
||||||
this.localTime = localTime;
|
this.entPostName = entPostName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getToken() {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToken(String token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getJobNumber() {
|
public String getJobNumber() {
|
||||||
return jobNumber;
|
return jobNumber;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectEntUserPostDuty" resultMap="BaseResultMap">
|
<select id="selectEntUserPostDuty" resultMap="BaseResultMap">
|
||||||
select * from ent_post_duty where enterprise_id = #{enterpriseId} and post_id = #{postId} limit #{page},#{pageSize}
|
select * from ent_post_duty where enterprise_id = #{enterpriseId} and post_id = #{postId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,9 @@
|
||||||
<select id="selectEntPostList" resultMap="BaseResultMap">
|
<select id="selectEntPostList" resultMap="BaseResultMap">
|
||||||
select epl.*,sum(case when task_state = 2 then 1 else 0 end)as finishCount from ent_post_list epl left join ent_post_task ept on epl.post_list_id = ept.post_list_id
|
select epl.*,sum(case when task_state = 2 then 1 else 0 end)as finishCount from ent_post_list epl left join ent_post_task ept on epl.post_list_id = ept.post_list_id
|
||||||
where epl.enterprise_id = #{enterpriseId} and epl.ent_user_id = #{entUserId}
|
where epl.enterprise_id = #{enterpriseId} and epl.ent_user_id = #{entUserId}
|
||||||
|
<if test="null != finishedState and '' != finishedState">
|
||||||
|
and epl.finish_state = #{finishedState}
|
||||||
|
</if>
|
||||||
<if test="null !=postId and '' != postId">
|
<if test="null !=postId and '' != postId">
|
||||||
and epl.post_id = #{postId}
|
and epl.post_id = #{postId}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -42,11 +45,45 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectEntPostListCount" resultType="java.lang.Integer">
|
<select id="selectEntPostListCount" resultType="java.lang.Integer">
|
||||||
select * from ent_post_list where enterprise_id = #{enterpriseId} and list_id = #{listId}
|
select count(post_list_id) from ent_post_list where enterprise_id = #{enterpriseId}
|
||||||
|
<if test="null != listId and '' != listId">
|
||||||
|
and list_id = #{listId}
|
||||||
|
</if>
|
||||||
|
<if test="null != year">
|
||||||
|
and `year_num` = #{year}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectEntPostListFinishedCount" resultType="java.lang.Integer">
|
<select id="selectEntPostListFinishedCount" resultType="java.lang.Integer">
|
||||||
select * from ent_post_list where enterprise_id = #{enterpriseId} and list_id = #{listId} and finish_satte = #{state}
|
select count(post_list_id) from ent_post_list where enterprise_id = #{enterpriseId}
|
||||||
|
<if test="null != listId and '' != listId">
|
||||||
|
and list_id = #{listId}
|
||||||
|
</if>
|
||||||
|
<if test="null != state and '' != state">
|
||||||
|
and finish_state = #{state}
|
||||||
|
</if>
|
||||||
|
<if test="null != year">
|
||||||
|
and `year` = #{year}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<resultMap id="EntListGroupMap" type="com.rzyc.model.EntPostList">
|
||||||
|
<result column="list_id" property="listId" />
|
||||||
|
<result column="item_title" property="itemTitle" />
|
||||||
|
<result column="totalTaskNumber" property="totalTaskNumber"/>
|
||||||
|
<result column="haveInHand" property="haveInHand"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="selectEntListGroupByListId" resultMap="EntListGroupMap">
|
||||||
|
select epl.list_id,epl.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
|
||||||
|
|
||||||
|
where epl.enterprise_id = #{enterpriseId} and epl.ent_user_id = #{userId}
|
||||||
|
<if test="null != listId and '' != listId">
|
||||||
|
and epl.list_id = #{listId}
|
||||||
|
</if>
|
||||||
|
group by epl.list_id,epl.item_title
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,10 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectEntUserPostTask" resultMap="BaseResultMap">
|
<select id="selectEntUserPostTask" resultMap="BaseResultMap">
|
||||||
select * from ent_post_task where ent_user_id = #{entUserId} and enterprise_id = #{enterpriseId} and list_id = #{listId}
|
select * from ent_post_task where ent_user_id = #{entUserId} and enterprise_id = #{enterpriseId}
|
||||||
|
<if test="listId != null and '' != listId">
|
||||||
|
and list_id = #{listId}
|
||||||
|
</if>
|
||||||
<if test="null != postId and '' != postId">
|
<if test="null != postId and '' != postId">
|
||||||
and post_id = #{postId}
|
and post_id = #{postId}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -53,6 +56,48 @@
|
||||||
limit #{page},#{pageSize}
|
limit #{page},#{pageSize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEntPostTaskTotal" resultType="java.lang.Long">
|
||||||
|
select count(ept.task_id) from ent_post_task ept
|
||||||
|
left join ent_post_list epl on ept.ent_list_id = epl.post_list_id
|
||||||
|
where epl.enterprise_id = #{enterpriseId}
|
||||||
|
<if test="null != year">
|
||||||
|
and epl.year_num = #{year}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEntPostTaskTotal" resultType="java.lang.Long">
|
||||||
|
select count(ept.task_id) from ent_post_task ept
|
||||||
|
left join ent_post_list epl on ept.ent_list_id = epl.post_list_id
|
||||||
|
where epl.enterprise_id = #{enterpriseId}
|
||||||
|
<if test="null != year">
|
||||||
|
and epl.year_num = #{year}
|
||||||
|
</if>
|
||||||
|
<if test="null != listId and '' != listId">
|
||||||
|
and epl.post_list_id = #{listId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<resultMap id="entPostTaskByStateMap" type="com.rzyc.model.EntPostTaskStatistic">
|
||||||
|
<result column="haveInHand" property="haveInHand" />
|
||||||
|
<result column="finished" property="finished" />
|
||||||
|
<result column="overtime" property="overtime" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="selectEntPostTaskByState" resultMap="entPostTaskByStateMap">
|
||||||
|
select sum(case when task_state = 1 then 1 else 0 end)as haveInHand,
|
||||||
|
sum(case when task_state = 2 then 1 else 0 end)as finished,
|
||||||
|
sum(case when task_state = 3 then 1 else 0 end)as overtime
|
||||||
|
from ent_post_task ept
|
||||||
|
left join ent_post_list epl on ept.ent_list_id = epl.post_list_id
|
||||||
|
where epl.enterprise_id = #{enterpriseId}
|
||||||
|
<if test="null != year">
|
||||||
|
and epl.year_num = #{year}
|
||||||
|
</if>
|
||||||
|
<if test="null != listId and '' != listId">
|
||||||
|
and epl.post_list_id = #{listId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -30,19 +30,19 @@
|
||||||
<if test="null != postId and '' != postId">
|
<if test="null != postId and '' != postId">
|
||||||
and post_path like concat('%',#{postId},'%')
|
and post_path like concat('%',#{postId},'%')
|
||||||
</if>
|
</if>
|
||||||
order by post_level asc
|
order by post_level,sort asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="updateEntPost">
|
<update id="updateEntPost">
|
||||||
update set name = #{data.name},parent_id = #{data.parentId},post_path = #{data.postPath},parent_name = #{data.parentName},post_level = #{postLevel},
|
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 = #{modifyTime} , modify_by = #{modifyBy}
|
modify_time = #{data.modifyTime} , modify_by = #{data.modifyBy}
|
||||||
where post_id = #{postId},enterprise_id = #{enterpriseId}
|
where post_id = #{data.postId} and enterprise_id = #{data.enterpriseId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<insert id="insertEntPost">
|
<insert id="insertEntPost">
|
||||||
insert into ent_post (post_id,enterprise_id,name,parent_id,post_path,parent_name,post_level,completion_rate,subordinates,create_time,create_by)
|
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},
|
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})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,12 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="selectEntUserList" resultMap="entUserListStatistic">
|
<select id="selectEntUserList" resultMap="entUserListStatistic">
|
||||||
select eu.*,ep.name postName,sum(case when credential_state = 1 then 1 else 0 end)as noTimeout,sum(case when credential_state = 2 then 1 else 0 end)as overtime ,
|
select eu.*,ep.name postName,
|
||||||
sum(case when task_state = 1 then 1 else 0 end) as ongoingTask,sum(case when task_state = 2 then 1 else 0 end) as finishTask,sum(case when task_state = 3 then 1 else 0 end) as overTimeTask
|
sum(case when credential_state = 1 then 1 else 0 end)as noTimeout,
|
||||||
|
sum(case when credential_state = 2 then 1 else 0 end)as overtime ,
|
||||||
|
sum(case when task_state = 1 then 1 else 0 end) as ongoingTask,
|
||||||
|
sum(case when task_state = 2 then 1 else 0 end) as finishTask,
|
||||||
|
sum(case when task_state = 3 then 1 else 0 end) as overTimeTask
|
||||||
from ent_user eu
|
from ent_user eu
|
||||||
left join ent_post ep on eu.post_id = ep.post_id
|
left join ent_post ep on eu.post_id = ep.post_id
|
||||||
left join ent_user_credential euc on eu.ent_user_id = euc.ent_user_id
|
left join ent_user_credential euc on eu.ent_user_id = euc.ent_user_id
|
||||||
|
|
@ -65,6 +69,9 @@
|
||||||
or eu.job_number like concat('%',#{keyContent},'%')
|
or eu.job_number like concat('%',#{keyContent},'%')
|
||||||
or ep.name like concat('%',#{keyContent},'%')
|
or ep.name like concat('%',#{keyContent},'%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="null != postId and '' != postId">
|
||||||
|
and eu.post_path like concat('%',#{postId},'%')
|
||||||
|
</if>
|
||||||
limit #{page},#{pageSize}
|
limit #{page},#{pageSize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,4 +30,8 @@
|
||||||
item_basis, item_proof, item_law, sort_id,del_state, create_time, create_by, modify_time, modify_by
|
item_basis, item_proof, item_law, sort_id,del_state, create_time, create_by, modify_time, modify_by
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectByEnterpriseId" resultMap="BaseResultMap">
|
||||||
|
select * from in_ent_list where enterprise_id = #{enterpriseId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,63 @@
|
||||||
where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR}
|
where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<insert id="insert" parameterType="com.rzyc.model.ent.SysEnterprise">
|
||||||
|
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>
|
||||||
<insert id="insertSelective" parameterType="com.rzyc.model.ent.SysEnterprise">
|
<insert id="insertSelective" parameterType="com.rzyc.model.ent.SysEnterprise">
|
||||||
insert into SysEnterprise
|
insert into SysEnterprise
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
@ -2500,7 +2556,7 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findEnterpriseByName" resultMap="BaseResultMap">
|
<select id="findEnterpriseByName" resultMap="BaseResultMap">
|
||||||
select sysent.EntName,sysent.state from ent_user eu left join sysenterprise sysent on eu.enterprise_id = sysent.SysEnterpriseId where eu.name = #{entUserName}
|
select sysent.EntName,sysent.state,sysent.SysEnterpriseId from ent_user eu left join sysenterprise sysent on eu.enterprise_id = sysent.SysEnterpriseId where eu.name = #{entUserName}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,16 +40,11 @@ public class PageAspect {
|
||||||
Pager pager = new Pager();
|
Pager pager = new Pager();
|
||||||
pager.setRows(page.getResult());
|
pager.setRows(page.getResult());
|
||||||
pager.setTotal(page.getTotal());
|
pager.setTotal(page.getTotal());
|
||||||
return packageData(pager);
|
return pager;
|
||||||
}
|
}
|
||||||
return proceed;
|
return proceed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SingleResult packageData( Pager pager){
|
|
||||||
SingleResult singleResult = new SingleResult();
|
|
||||||
singleResult.setData(pager);
|
|
||||||
return singleResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置参数,返回是否分页
|
* 设置参数,返回是否分页
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,23 @@ import java.util.Collection;
|
||||||
|
|
||||||
public class UserDetailsAndId extends User {
|
public class UserDetailsAndId extends User {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
* */
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业岗位id
|
||||||
|
* */
|
||||||
|
private String postId;
|
||||||
|
|
||||||
|
public String getPostId() {
|
||||||
|
return postId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPostId(String postId) {
|
||||||
|
this.postId = postId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
|
@ -28,9 +42,10 @@ public class UserDetailsAndId extends User {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public UserDetailsAndId(String username, String password, Collection<? extends GrantedAuthority> authorities, String id) {
|
public UserDetailsAndId(String username, String password, Collection<? extends GrantedAuthority> authorities, String id,String postId) {
|
||||||
super(username, password, authorities);
|
super(username, password, authorities);
|
||||||
setId(id);
|
setId(id);
|
||||||
|
setPostId(postId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,16 @@ import com.rzyc.bean.check.dto.LawAddDto;
|
||||||
import com.rzyc.bean.check.dto.TalkAddDto;
|
import com.rzyc.bean.check.dto.TalkAddDto;
|
||||||
import com.rzyc.bean.ent.*;
|
import com.rzyc.bean.ent.*;
|
||||||
import com.rzyc.bean.user.dto.LoginDto;
|
import com.rzyc.bean.user.dto.LoginDto;
|
||||||
|
import com.rzyc.config.MethodAnnotation;
|
||||||
import com.rzyc.model.Accident;
|
import com.rzyc.model.Accident;
|
||||||
import com.rzyc.model.EntCertificates;
|
import com.rzyc.model.EntCertificates;
|
||||||
import com.rzyc.model.check.*;
|
import com.rzyc.model.check.*;
|
||||||
import com.rzyc.model.ent.EntBillCon;
|
import com.rzyc.model.ent.EntBillCon;
|
||||||
|
import com.rzyc.model.ent.InEntList;
|
||||||
import com.rzyc.model.ent.SysEnterprise;
|
import com.rzyc.model.ent.SysEnterprise;
|
||||||
import com.rzyc.model.user.SysUnit;
|
import com.rzyc.model.user.SysUnit;
|
||||||
import com.rzyc.model.user.SysUser;
|
import com.rzyc.model.user.SysUser;
|
||||||
|
import com.rzyc.service.PcBusinessService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
|
@ -37,6 +40,7 @@ import org.apache.commons.beanutils.ConvertUtils;
|
||||||
import org.apache.commons.beanutils.converters.DateConverter;
|
import org.apache.commons.beanutils.converters.DateConverter;
|
||||||
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -64,7 +68,8 @@ import java.util.List;
|
||||||
@Controller
|
@Controller
|
||||||
@Validated
|
@Validated
|
||||||
public class PcCompanyController extends BaseController{
|
public class PcCompanyController extends BaseController{
|
||||||
|
@Autowired
|
||||||
|
PcBusinessService pcBusinessService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PC企业详细
|
* PC企业详细
|
||||||
|
|
@ -185,8 +190,8 @@ public class PcCompanyController extends BaseController{
|
||||||
result.setMessage(Message.PASSWORD_ERROR);
|
result.setMessage(Message.PASSWORD_ERROR);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
result.setCode(Code.PASSWORD_ERROR.getCode());
|
result.setCode(Code.ERROR.getCode());
|
||||||
result.setMessage(Message.PASSWORD_ERROR);
|
result.setMessage(Message.ERROR);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
result.setCode(Code.CODE_ERROT.getCode());
|
result.setCode(Code.CODE_ERROT.getCode());
|
||||||
|
|
@ -764,7 +769,7 @@ public class PcCompanyController extends BaseController{
|
||||||
@ApiOperation(value = "证照分页新增或者修改", notes = "证照分页新增或者修改")
|
@ApiOperation(value = "证照分页新增或者修改", notes = "证照分页新增或者修改")
|
||||||
@PostMapping("/certificatesAdd")
|
@PostMapping("/certificatesAdd")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public SingleResult<String> certificatesAdd(@Valid CertificatesAddDto certificatesAddDto)throws Exception{
|
public SingleResult<String> certificatesAdd(@RequestBody @Valid CertificatesAddDto certificatesAddDto)throws Exception{
|
||||||
SingleResult<String> result = new SingleResult<>();
|
SingleResult<String> result = new SingleResult<>();
|
||||||
|
|
||||||
String userId = getUserId();
|
String userId = getUserId();
|
||||||
|
|
@ -827,4 +832,85 @@ public class PcCompanyController extends BaseController{
|
||||||
return "SysEnterpriseId";
|
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<List<InEntList>> 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,12 @@ import com.common.utils.model.SingleResult;
|
||||||
import com.rzyc.bean.user.dto.LoginDto;
|
import com.rzyc.bean.user.dto.LoginDto;
|
||||||
import com.rzyc.config.MethodAnnotation;
|
import com.rzyc.config.MethodAnnotation;
|
||||||
import com.rzyc.config.RedisUtil;
|
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.dto.*;
|
||||||
|
import com.rzyc.model.ent.EntPost;
|
||||||
import com.rzyc.model.ent.EntUser;
|
import com.rzyc.model.ent.EntUser;
|
||||||
import com.rzyc.service.PcBusinessService;
|
import com.rzyc.service.PcBusinessService;
|
||||||
import com.rzyc.service.UserLoginService;
|
import com.rzyc.service.UserLoginService;
|
||||||
|
|
@ -21,13 +26,14 @@ import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
@ -53,6 +59,11 @@ public class PersonalController extends BaseController{
|
||||||
|
|
||||||
RedisUtil redisUtil;
|
RedisUtil redisUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*只允许使用page注解的使用此静态包装
|
||||||
|
*/
|
||||||
|
final static SingleResult singleResult = new SingleResult();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public PersonalController(UserLoginService userLoginService, PcBusinessService pcBusinessService, RedisUtil redisUtil) {
|
public PersonalController(UserLoginService userLoginService, PcBusinessService pcBusinessService, RedisUtil redisUtil) {
|
||||||
this.userLoginService = userLoginService;
|
this.userLoginService = userLoginService;
|
||||||
|
|
@ -66,15 +77,15 @@ public class PersonalController extends BaseController{
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "用户登录", notes = "用户登录")
|
@ApiOperation(value = "用户登录", notes = "用户登录")
|
||||||
@PostMapping(value = "/login")
|
@PostMapping(value = "/login")
|
||||||
public SingleResult<String> login(@Valid LoginDto loginDto)throws Exception{
|
public SingleResult<EntUser> login(@Valid LoginDto loginDto)throws Exception{
|
||||||
SingleResult<String> result = new SingleResult<>();
|
SingleResult<EntUser> result = new SingleResult<>();
|
||||||
|
|
||||||
String generateCode = request.getSession().getAttribute(constantsConfigure.getGenerateCodeKey())+"";
|
String generateCode = request.getSession().getAttribute(constantsConfigure.getGenerateCodeKey())+"";
|
||||||
//验证码只能使用一次
|
//验证码只能使用一次
|
||||||
request.getSession().removeAttribute(constantsConfigure.getGenerateCodeKey());
|
request.getSession().removeAttribute(constantsConfigure.getGenerateCodeKey());
|
||||||
|
|
||||||
if(loginDto.getGenerateCode().equals(generateCode)) {
|
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)) {
|
if (Objects.isNull(loginResult)) {
|
||||||
result.setCode(Code.PASSWORD_OR_ACCOUNT_ERROR.getCode());
|
result.setCode(Code.PASSWORD_OR_ACCOUNT_ERROR.getCode());
|
||||||
result.setMessage(Message.PASSWORD_OR_ACCOUNT_ERROR);
|
result.setMessage(Message.PASSWORD_OR_ACCOUNT_ERROR);
|
||||||
|
|
@ -89,6 +100,10 @@ public class PersonalController extends BaseController{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 企业登录
|
* 企业登录
|
||||||
* @param loginDto
|
* @param loginDto
|
||||||
|
|
@ -170,7 +185,7 @@ public class PersonalController extends BaseController{
|
||||||
@PreAuthorize("hasAnyAuthority('entUserTree','entUserTree:update')")
|
@PreAuthorize("hasAnyAuthority('entUserTree','entUserTree:update')")
|
||||||
@MethodAnnotation(authorizations = {"entUserTree","entUserTree:update"},name = "企业用户组织树")
|
@MethodAnnotation(authorizations = {"entUserTree","entUserTree:update"},name = "企业用户组织树")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public SingleResult<List<EntUser>> entUserTree(@NotNull(message = "公司id不能为null") String enterpriseId, String postId)throws Exception{
|
public SingleResult<List<EntPost>> entUserTree(@RequestParam(required = true) String enterpriseId, String postId)throws Exception{
|
||||||
return pcBusinessService.entUserTree(enterpriseId,postId);
|
return pcBusinessService.entUserTree(enterpriseId,postId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -182,12 +197,13 @@ public class PersonalController extends BaseController{
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "企业用户工作要务", notes = "企业用户工作要务")
|
@ApiOperation(value = "企业用户工作要务", notes = "企业用户工作要务")
|
||||||
@GetMapping(value = "/entUserPostList")
|
@PostMapping(value = "/entUserPostList")
|
||||||
@PreAuthorize("hasAnyAuthority('entUserPostList','entUserPostList:update')")
|
@PreAuthorize("hasAnyAuthority('entUserPostList','entUserPostList:update')")
|
||||||
@MethodAnnotation(authorizations = {"entUserPostList","entUserPostList:update"},name = "企业用户工作要务")
|
@MethodAnnotation(authorizations = {"entUserPostList","entUserPostList:update"},name = "企业用户工作要务")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public SingleResult entUserPostList(@RequestBody EntUserPostListDto entUserPostListDto)throws Exception{
|
public SingleResult<List<EntPostList>> entUserPostList(@RequestBody EntUserPostListDto entUserPostListDto)throws Exception{
|
||||||
return pcBusinessService.entUserPostList(entUserPostListDto);
|
singleResult.setData(pcBusinessService.entUserPostList(entUserPostListDto));
|
||||||
|
return singleResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -196,13 +212,14 @@ public class PersonalController extends BaseController{
|
||||||
* @return 企业用户工作清单
|
* @return 企业用户工作清单
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "企业用户工作清单", notes = "企业用户工作清单")
|
@ApiOperation(value = "企业用户日常工作清单", notes = "企业用户日常工作清单")
|
||||||
@GetMapping(value = "/entUserPostTask")
|
@PostMapping(value = "/entUserPostTask")
|
||||||
@PreAuthorize("hasAnyAuthority('entUserPostTask','entUserPostTask:update')")
|
@PreAuthorize("hasAnyAuthority('entUserPostTask','entUserPostTask:update')")
|
||||||
@MethodAnnotation(authorizations = {"entUserPostTask","entUserPostTask:update"},name = "企业用户工作清单")
|
@MethodAnnotation(authorizations = {"entUserPostTask","entUserPostTask:update"},name = "企业用户日常工作清单")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public SingleResult entUserPostTask(@RequestBody EntUserPostTaskDto entUserPostTaskDto)throws Exception{
|
public SingleResult<List<EntPostTask>> entUserPostTask(@RequestBody EntUserPostTaskDto entUserPostTaskDto)throws Exception{
|
||||||
return pcBusinessService.entUserPostTask(entUserPostTaskDto);
|
singleResult.setData(pcBusinessService.entUserPostTask(entUserPostTaskDto));
|
||||||
|
return singleResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -213,12 +230,13 @@ public class PersonalController extends BaseController{
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "企业用户岗位职责", notes = "企业用户岗位职责")
|
@ApiOperation(value = "企业用户岗位职责", notes = "企业用户岗位职责")
|
||||||
@GetMapping(value = "/entUserPostDuty")
|
@PostMapping(value = "/entUserPostDuty")
|
||||||
@PreAuthorize("hasAnyAuthority('entUserPostDuty','entUserPostDuty:update')")
|
@PreAuthorize("hasAnyAuthority('entUserPostDuty','entUserPostDuty:update')")
|
||||||
@MethodAnnotation(authorizations = {"entUserPostDuty","entUserPostDuty:update"},name = "企业用户岗位职责")
|
@MethodAnnotation(authorizations = {"entUserPostDuty","entUserPostDuty:update"},name = "企业用户岗位职责")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public SingleResult entUserPostDuty(@RequestBody EntUserPostDutyDto entUserPostDutyDto)throws Exception{
|
public SingleResult<List<EntPostDuty>> entUserPostDuty(@RequestBody EntUserPostDutyDto entUserPostDutyDto)throws Exception{
|
||||||
return pcBusinessService.entUserPostDuty(entUserPostDutyDto);
|
singleResult.setData(pcBusinessService.entUserPostDuty(entUserPostDutyDto));
|
||||||
|
return singleResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -237,7 +255,7 @@ public class PersonalController extends BaseController{
|
||||||
@PreAuthorize("hasAnyAuthority('entUserCredential','entUserCredential:update')")
|
@PreAuthorize("hasAnyAuthority('entUserCredential','entUserCredential:update')")
|
||||||
@MethodAnnotation(authorizations = {"entUserCredential","entUserCredential:update"},name = "企业用户证照表")
|
@MethodAnnotation(authorizations = {"entUserCredential","entUserCredential:update"},name = "企业用户证照表")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public SingleResult entUserCredential(@NotNull(message = "企业用户id不能为null") String entUserId, @NotNull(message = "页码不能为null") Integer page, @NotNull(message = "条数不能为null")Integer pageSize)throws Exception{
|
public SingleResult<List<EntUserCredential>> 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);
|
return pcBusinessService.entUserCredential(null,entUserId,page,pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -256,9 +274,9 @@ public class PersonalController extends BaseController{
|
||||||
@MethodAnnotation(authorizations = {"entUserCredentialUpdate:update"},name = "企业用户证照表-新增,修改")
|
@MethodAnnotation(authorizations = {"entUserCredentialUpdate:update"},name = "企业用户证照表-新增,修改")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public SingleResult entUserCredentialUpdate(@RequestBody EntUserCredentialUpdateDto entUserCredentialUpdateDto)throws Exception{
|
public SingleResult entUserCredentialUpdate(@RequestBody EntUserCredentialUpdateDto entUserCredentialUpdateDto)throws Exception{
|
||||||
List<EntUserCredentialUpdateDto>entUserCredentialUpdateDtos = new ArrayList<>();
|
List<EntUserCredentialUpdateDto>entUserCredentialUpdateDtoList= new ArrayList<>();
|
||||||
entUserCredentialUpdateDtos.add(entUserCredentialUpdateDto);
|
entUserCredentialUpdateDtoList.add(entUserCredentialUpdateDto);
|
||||||
return pcBusinessService.entUserCredentialUpdate(entUserCredentialUpdateDtos);
|
return pcBusinessService.entUserCredentialUpdate(entUserCredentialUpdateDtoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -276,31 +294,33 @@ public class PersonalController extends BaseController{
|
||||||
@PreAuthorize("hasAnyAuthority('entUserCredentialDelete')")
|
@PreAuthorize("hasAnyAuthority('entUserCredentialDelete')")
|
||||||
@MethodAnnotation(authorizations = {"entUserCredentialDelete"},name = "企业用户证照表-删除")
|
@MethodAnnotation(authorizations = {"entUserCredentialDelete"},name = "企业用户证照表-删除")
|
||||||
@ResponseBody
|
@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);
|
return pcBusinessService.entUserCredentialDelete(credentialId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 企业岗位总体信息列表
|
* 企业岗位人员总体信息列表
|
||||||
* @param keyContent
|
* @param keyContent
|
||||||
* @return list
|
* @return list
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "企业岗位总体信息列表", notes = "企业岗位总体信息列表")
|
@ApiOperation(value = "企业岗位人员总体信息列表", notes = "企业岗位人员总体信息列表")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "keyContent", value = "搜索关键字",required = true, dataType = "string"),
|
@ApiImplicitParam(name = "keyContent", value = "搜索关键字",required = true, dataType = "string"),
|
||||||
@ApiImplicitParam(name = "page", value = "page",required = true, dataType = "int"),
|
@ApiImplicitParam(name = "page", value = "page",required = true, dataType = "int"),
|
||||||
@ApiImplicitParam(name = "pageSize", value = "pageSize",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")
|
@GetMapping(value = "/entUserList")
|
||||||
@PreAuthorize("hasAnyAuthority('entUserList','entUserList:update')")
|
@PreAuthorize("hasAnyAuthority('entUserList','entUserList:update')")
|
||||||
@MethodAnnotation(authorizations = {"entUserList","entUserList:update"},name = "企业岗位总体信息列表")
|
@MethodAnnotation(authorizations = {"entUserList","entUserList:update"},name = "企业岗位人员总体信息列表")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public SingleResult entUserList(@NotNull(message = "搜索关键字不能为null") String keyContent,
|
public SingleResult<List<EntUser>> entUserList(@RequestParam(required = true) String keyContent,
|
||||||
@NotNull(message = "页码不能为null") Integer page,
|
@RequestParam(required = false) String postId,
|
||||||
@NotNull(message = "条数不能为null") Integer pageSize)throws Exception{
|
@RequestParam(required = true) Integer page,
|
||||||
return pcBusinessService.entUserList(keyContent,page,pageSize);
|
@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
|
* @return list
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "企业清单统计", notes = "企业清单统计")
|
@ApiOperation(value = "企业清单(类型)分组查询", notes = "企业清单(类型)分组查询")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "listId", value = "清单Id",required = true, dataType = "string"),
|
@ApiImplicitParam(name = "enterpriseId", value = "企业id",required = true, dataType = "string"),
|
||||||
@ApiImplicitParam(name = "keyWord", value = "关键字",required = true, dataType = "string"),
|
@ApiImplicitParam(name = "listId", value = "清单id",required = false, dataType = "string"),
|
||||||
@ApiImplicitParam(name = "page", value = "page",required = true, dataType = "int"),
|
@ApiImplicitParam(name = "userId", value = "用户id",required = true, dataType = "string"),
|
||||||
@ApiImplicitParam(name = "pageSize", value = "pageSize",required = true, dataType = "int"),
|
|
||||||
})
|
})
|
||||||
@GetMapping(value = "/inListStatistic")
|
@GetMapping(value = "/entListGroupByListId")
|
||||||
@PreAuthorize("hasAnyAuthority('inListStatistic')")
|
@PreAuthorize("hasAnyAuthority('entListGroupByListId')")
|
||||||
@MethodAnnotation(authorizations = {"inListStatistic"},name = "企业清单统计")
|
@MethodAnnotation(authorizations = {"entListGroupByListId"},name = "企业清单(类型)分组查询")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public SingleResult entUserList(String listId,
|
public SingleResult<List<EntPostList>> entListGroupByListId(@RequestParam(required = true) String enterpriseId,
|
||||||
@NotNull(message = "企业Id") String enterpriseId,
|
String listId,
|
||||||
String keyWord,
|
@RequestParam(required = true) String userId
|
||||||
@NotNull(message = "页码不能为null") Integer page,
|
)throws Exception{
|
||||||
@NotNull(message = "条数不能为null") Integer pageSize)throws Exception{
|
return pcBusinessService.entListGroupByListId(enterpriseId,listId,userId);
|
||||||
return pcBusinessService.inListStatistic(enterpriseId,listId,keyWord,page,pageSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -391,4 +410,5 @@ public class PersonalController extends BaseController{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.rzyc.filter;
|
||||||
|
|
||||||
import com.common.utils.jwt.JwtUtil;
|
import com.common.utils.jwt.JwtUtil;
|
||||||
import com.rzyc.advice.CustomException;
|
import com.rzyc.advice.CustomException;
|
||||||
|
import com.rzyc.config.RedisUtil;
|
||||||
import com.rzyc.mapper.AuthorityKeyMapper;
|
import com.rzyc.mapper.AuthorityKeyMapper;
|
||||||
import com.rzyc.model.AuthorityKey;
|
import com.rzyc.model.AuthorityKey;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -31,11 +32,18 @@ import java.util.List;
|
||||||
* */
|
* */
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
|
||||||
public class JwtAuthenticationTokenFiler extends OncePerRequestFilter {
|
public class JwtAuthenticationTokenFiler extends OncePerRequestFilter {
|
||||||
@Autowired
|
|
||||||
AuthorityKeyMapper authorityKeyMapper;
|
AuthorityKeyMapper authorityKeyMapper;
|
||||||
|
|
||||||
|
RedisUtil redisUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public JwtAuthenticationTokenFiler(AuthorityKeyMapper authorityKeyMapper, RedisUtil redisUtil) {
|
||||||
|
this.authorityKeyMapper = authorityKeyMapper;
|
||||||
|
this.redisUtil = redisUtil;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||||
//获取token
|
//获取token
|
||||||
|
|
@ -56,23 +64,24 @@ public class JwtAuthenticationTokenFiler extends OncePerRequestFilter {
|
||||||
throw new RuntimeException("token非法");
|
throw new RuntimeException("token非法");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
//这里是要去拿角色权限的
|
||||||
List<AuthorityKey>authorizations = authorityKeyMapper.allAuthorizations();
|
List<AuthorityKey>authorizations = (List<AuthorityKey>) redisUtil.get("allKeys");
|
||||||
List<GrantedAuthority> authority= new ArrayList<GrantedAuthority>();
|
List<GrantedAuthority> authority= new ArrayList<GrantedAuthority>();
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
if (null != authorizations && authorizations.size() > 0 ){
|
||||||
for (AuthorityKey s:authorizations) {
|
|
||||||
stringBuilder.append(s.getAuthKey());
|
|
||||||
authority.add(new SimpleGrantedAuthority(stringBuilder.toString()));
|
|
||||||
stringBuilder.setLength(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
for (AuthorityKey s:authorizations) {
|
||||||
|
stringBuilder.append(s.getAuthKey());
|
||||||
|
authority.add(new SimpleGrantedAuthority(stringBuilder.toString()));
|
||||||
|
stringBuilder.setLength(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
// 获取权限信息封装到Authentication中
|
// 获取权限信息封装到Authentication中
|
||||||
UsernamePasswordAuthenticationToken authenticationToken =
|
UsernamePasswordAuthenticationToken authenticationToken =
|
||||||
new UsernamePasswordAuthenticationToken(null,null,authority);
|
new UsernamePasswordAuthenticationToken(null,null,authority);
|
||||||
SecurityContextHolder.getContext().setAuthentication(authenticationToken);
|
SecurityContextHolder.getContext().setAuthentication(authenticationToken);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
filterChain.doFilter(request, response);
|
filterChain.doFilter(request, response);
|
||||||
}catch (AccessDeniedException e){
|
}catch (AccessDeniedException e){
|
||||||
System.out.println("权限失败");
|
System.out.println("权限失败");
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import com.rzyc.model.dto.*;
|
||||||
import com.rzyc.model.ent.EntPost;
|
import com.rzyc.model.ent.EntPost;
|
||||||
import com.rzyc.model.ent.EntUser;
|
import com.rzyc.model.ent.EntUser;
|
||||||
import com.rzyc.model.dto.SparePartDto;
|
import com.rzyc.model.dto.SparePartDto;
|
||||||
|
import com.rzyc.model.ent.InEntList;
|
||||||
import com.rzyc.model.ent.SysEnterprise;
|
import com.rzyc.model.ent.SysEnterprise;
|
||||||
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
@ -68,15 +69,17 @@ public class PcBusinessService extends BaseController {
|
||||||
* sql里进行了order by,如果传入postId就是查询非全部的数结构,需要加入一个公司,所以把第一个最大权限设置为company,这样公司才会在树的最上面
|
* sql里进行了order by,如果传入postId就是查询非全部的数结构,需要加入一个公司,所以把第一个最大权限设置为company,这样公司才会在树的最上面
|
||||||
* 相反不穿postId就是查询全部,默认会有company打头就不用再修改list的0对象
|
* 相反不穿postId就是查询全部,默认会有company打头就不用再修改list的0对象
|
||||||
*/
|
*/
|
||||||
if (null != postId){
|
|
||||||
list.get(0).setParentId("company");
|
|
||||||
}
|
|
||||||
//加入公司为第一个树结构
|
//加入公司为第一个树结构
|
||||||
EntPost entPost = new EntPost();
|
EntPost entPost = new EntPost();
|
||||||
entPost.setName(sysEnterprise.getEntname());
|
entPost.setName(sysEnterprise.getEntname());
|
||||||
entPost.setPostId("company");
|
entPost.setPostId("company");
|
||||||
list.add(entPost);
|
list.add(entPost);
|
||||||
|
|
||||||
|
if (null != postId){
|
||||||
|
list.get(0).setParentId("company");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
JSONArray jsonArray = handleEntUserTree(list);
|
JSONArray jsonArray = handleEntUserTree(list);
|
||||||
List<EntPost>posts = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),EntPost.class);
|
List<EntPost>posts = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),EntPost.class);
|
||||||
singleResult.setData(posts);
|
singleResult.setData(posts);
|
||||||
|
|
@ -113,35 +116,34 @@ public class PcBusinessService extends BaseController {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<EntPostList> entUserPostList(EntUserPostListDto entUserPostListDto) throws Exception {
|
||||||
|
entUserPostListDto.setPostId(getUserPostId());
|
||||||
|
|
||||||
public SingleResult entUserPostList(EntUserPostListDto entUserPostListDto){
|
List<EntPostList>list = entPostListMapper.selectEntPostList(entUserPostListDto.getEnterpriseId(),entUserPostListDto.getEntUserId(),entUserPostListDto.getFinishedState(),
|
||||||
SingleResult singleResult = new SingleResult();
|
|
||||||
entUserPostListDto.setPage(entUserPostListDto.getPageSize() * (entUserPostListDto.getPage() - 1));
|
|
||||||
List<EntPostList>list = entPostListMapper.selectEntPostList(entUserPostListDto.getEnterpriseId(),entUserPostListDto.getEntUserId(),
|
|
||||||
entUserPostListDto.getPostId(),entUserPostListDto.getPage(),entUserPostListDto.getPageSize());
|
entUserPostListDto.getPostId(),entUserPostListDto.getPage(),entUserPostListDto.getPageSize());
|
||||||
singleResult.setData(list);
|
|
||||||
return singleResult;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public SingleResult entUserPostTask(EntUserPostTaskDto entUserPostTaskDto){
|
public List<EntPostTask> entUserPostTask(EntUserPostTaskDto entUserPostTaskDto) throws Exception {
|
||||||
SingleResult singleResult = new SingleResult();
|
entUserPostTaskDto.setPostId(getUserPostId());
|
||||||
entUserPostTaskDto.setPage(entUserPostTaskDto.getPageSize() * (entUserPostTaskDto.getPage() - 1));
|
//当listId为null时,默认第一个日常清单,查询所有正在进行中的任务
|
||||||
|
if (null == entUserPostTaskDto.getListId()){
|
||||||
|
//2为正在进行中
|
||||||
|
entUserPostTaskDto.setTaskState(1);
|
||||||
|
}
|
||||||
//EntPostTask
|
//EntPostTask
|
||||||
List<EntPostTask>list = entPostTaskMapper.selectEntUserPostTask(entUserPostTaskDto.getEnterpriseId(),entUserPostTaskDto.getEntUserId(),entUserPostTaskDto.getPostId()
|
List<EntPostTask>list = entPostTaskMapper.selectEntUserPostTask(entUserPostTaskDto.getEnterpriseId(),entUserPostTaskDto.getEntUserId(),entUserPostTaskDto.getPostId()
|
||||||
,entUserPostTaskDto.getListId(),entUserPostTaskDto.getContent(),entUserPostTaskDto.getTaskState(),
|
,entUserPostTaskDto.getListId(),entUserPostTaskDto.getContent(),entUserPostTaskDto.getTaskState());
|
||||||
entUserPostTaskDto.getPage(),entUserPostTaskDto.getPageSize());
|
return list;
|
||||||
singleResult.setData(list);
|
|
||||||
return singleResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SingleResult entUserPostDuty(EntUserPostDutyDto entUserPostDutyDto){
|
public List entUserPostDuty(EntUserPostDutyDto entUserPostDutyDto) throws Exception {
|
||||||
SingleResult singleResult = new SingleResult();
|
entUserPostDutyDto.setPostId(getUserPostId());
|
||||||
entUserPostDutyDto.setPage( entUserPostDutyDto.getPageSize() * (entUserPostDutyDto.getPage() - 1));
|
|
||||||
//EntPostDuty
|
//EntPostDuty
|
||||||
List<EntPostDuty>list = entPostDutyMapper.selectEntUserPostDuty(entUserPostDutyDto.getEnterpriseId(),entUserPostDutyDto.getPostId(),entUserPostDutyDto.getPage(),entUserPostDutyDto.getPageSize());
|
List<EntPostDuty>list = entPostDutyMapper.selectEntUserPostDuty(entUserPostDutyDto.getEnterpriseId(),entUserPostDutyDto.getPostId());
|
||||||
singleResult.setData(list);
|
return list;
|
||||||
return singleResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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();
|
SingleResult singleResult = new SingleResult();
|
||||||
page = pageSize * (page - 1);
|
page = pageSize * (page - 1);
|
||||||
List<EntUser>users = entUserMapper.selectEntUserList(keyContent,page,pageSize);
|
List<EntUser>users = entUserMapper.selectEntUserList(keyContent,page,pageSize,postId);
|
||||||
//计算履职百分比,后期这里使用redis来读取履职进度
|
//计算履职百分比,后期这里使用redis来读取履职进度
|
||||||
for (EntUser e:users) {
|
for (EntUser e:users) {
|
||||||
Integer total = e.getFinishTask() + e.getOngoingTask() + e.getOverTimeTask();
|
Integer total = e.getFinishTask() + e.getOngoingTask() + e.getOverTimeTask();
|
||||||
|
|
@ -232,7 +234,10 @@ public class PcBusinessService extends BaseController {
|
||||||
singleResult.setMessage(Message.ERROR);
|
singleResult.setMessage(Message.ERROR);
|
||||||
}
|
}
|
||||||
//插入证件图
|
//插入证件图
|
||||||
singleResult = this.entUserCredentialUpdate(addOrUpdateEntUserDto.getEntUserCredentialUpdateDtos());
|
if (null != addOrUpdateEntUserDto.getEntUserCredentialUpdateDtos() && addOrUpdateEntUserDto.getEntUserCredentialUpdateDtos().size() > 0 ){
|
||||||
|
singleResult = this.entUserCredentialUpdate(addOrUpdateEntUserDto.getEntUserCredentialUpdateDtos());
|
||||||
|
}
|
||||||
|
|
||||||
return singleResult;
|
return singleResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -325,8 +330,9 @@ public class PcBusinessService extends BaseController {
|
||||||
entPost.setModifyTime(new Date());
|
entPost.setModifyTime(new Date());
|
||||||
result = entPostMapper.updateEntPost(entPost);
|
result = entPostMapper.updateEntPost(entPost);
|
||||||
}else {
|
}else {
|
||||||
entPost.setCreateBy(getUserId());
|
entPost.setPostId(RandomNumber.getUUid());
|
||||||
entPost.setCreateTime(new Date());
|
entPost.setCreateTime(new Date());
|
||||||
|
entPost.setCreateBy(getUserId());
|
||||||
result = entPostMapper.insertEntPost(entPost);
|
result = entPostMapper.insertEntPost(entPost);
|
||||||
}
|
}
|
||||||
if (result != 1 ){
|
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){
|
public SingleResult inListStatistic(String enterpriseId,String listId,String keyWord,Integer page,Integer pageSize){
|
||||||
SingleResult singleResult = new SingleResult();
|
SingleResult singleResult = new SingleResult();
|
||||||
HashMap map = new HashMap();
|
HashMap map = new HashMap();
|
||||||
Integer total = entPostListMapper.selectEntPostListCount(enterpriseId,listId);
|
Integer total = entPostListMapper.selectEntPostListCount(enterpriseId,listId,null);
|
||||||
//2代表已完成状态
|
//2代表已完成状态
|
||||||
Integer finishCount = entPostListMapper.selectEntPostListFinishedCount(enterpriseId,listId,2);
|
Integer finishCount = entPostListMapper.selectEntPostListFinishedCount(enterpriseId,listId,2,null);
|
||||||
double finishPercent = Arith.div(total,finishCount) * 100;
|
double finishPercent = Arith.div(total,finishCount) * 100;
|
||||||
map.put("finishPercent",finishPercent);
|
map.put("finishPercent",finishPercent);
|
||||||
List<EntPostTask>tasks = entPostTaskMapper.selectEntUserPostTaskByListId(enterpriseId,listId,keyWord,page,pageSize);
|
List<EntPostTask>tasks = entPostTaskMapper.selectEntUserPostTaskByListId(enterpriseId,listId,keyWord,page,pageSize);
|
||||||
|
|
@ -631,6 +637,67 @@ public class PcBusinessService extends BaseController {
|
||||||
return singleResult;
|
return singleResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SingleResult inListTypes(String enterpriseId){
|
||||||
|
SingleResult singleResult = new SingleResult();
|
||||||
|
List<InEntList>list = 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<EntPostList> list = entPostListMapper.selectEntListGroupByListId(enterpriseId,listId,userId);
|
||||||
|
singleResult.setData(list);
|
||||||
|
return singleResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.rzyc.service;
|
package com.rzyc.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.rzyc.advice.CustomException;
|
||||||
import com.rzyc.config.RedisUtil;
|
import com.rzyc.config.RedisUtil;
|
||||||
import com.rzyc.config.UserDetailsAndId;
|
import com.rzyc.config.UserDetailsAndId;
|
||||||
import com.rzyc.enums.SysEnterpriseState;
|
import com.rzyc.enums.SysEnterpriseState;
|
||||||
|
|
@ -74,17 +75,18 @@ public class UserDetailsServiceImpl implements UserDetailsService {
|
||||||
EntUser entUser = entUserMapper.selectByName(name);
|
EntUser entUser = entUserMapper.selectByName(name);
|
||||||
|
|
||||||
if (Objects.isNull(entUser)){
|
if (Objects.isNull(entUser)){
|
||||||
throw new UsernameNotFoundException("用户名不存在");
|
throw new CustomException("用户名不存在");
|
||||||
}
|
}
|
||||||
List<GrantedAuthority> authority= new ArrayList<GrantedAuthority>();
|
List<GrantedAuthority> authority= new ArrayList<GrantedAuthority>();
|
||||||
List<AuthorityKey>authorizations = authorityKeyMapper.allAuthorizations();
|
List<AuthorityKey>authorizations = authorityKeyMapper.allAuthorizations();
|
||||||
|
redisUtil.set("allKeys",authorizations);
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
for (AuthorityKey s:authorizations) {
|
for (AuthorityKey s:authorizations) {
|
||||||
stringBuilder.append(s.getAuthKey());
|
stringBuilder.append(s.getAuthKey());
|
||||||
authority.add(new SimpleGrantedAuthority(stringBuilder.toString()));
|
authority.add(new SimpleGrantedAuthority(stringBuilder.toString()));
|
||||||
stringBuilder.setLength(0);
|
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());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,10 @@ import com.common.utils.jwt.JwtUtil;
|
||||||
import com.rzyc.advice.CustomException;
|
import com.rzyc.advice.CustomException;
|
||||||
import com.rzyc.config.UserDetailsAndId;
|
import com.rzyc.config.UserDetailsAndId;
|
||||||
import com.rzyc.enums.SysEnterpriseState;
|
import com.rzyc.enums.SysEnterpriseState;
|
||||||
|
import com.rzyc.mapper.ent.EntPostMapper;
|
||||||
import com.rzyc.mapper.ent.SysEnterpriseMapper;
|
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 com.rzyc.model.ent.SysEnterprise;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.authentication.BadCredentialsException;
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
|
|
@ -46,20 +49,26 @@ public class UserLoginService {
|
||||||
* */
|
* */
|
||||||
private SysEnterpriseMapper sysEnterpriseMapper;
|
private SysEnterpriseMapper sysEnterpriseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业端岗位
|
||||||
|
* */
|
||||||
|
private EntPostMapper entPostMapper;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@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.userDetailsService = userDetailsService;
|
||||||
this.passwordEncoder = passwordEncoder;
|
this.passwordEncoder = passwordEncoder;
|
||||||
this.sysEnterpriseMapper= sysEnterpriseMapper;
|
this.sysEnterpriseMapper= sysEnterpriseMapper;
|
||||||
|
this.entPostMapper = entPostMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String login(String username, String password)throws Exception {
|
public EntUser login(String username, String password)throws Exception {
|
||||||
String token = null;
|
EntUser entUser = new EntUser();
|
||||||
try {
|
String token = null;
|
||||||
UserDetails userDetails = userDetailsService.loadUserByUsername(username);
|
UserDetails userDetails = userDetailsService.loadUserByUsername(username);
|
||||||
if (Objects.isNull(userDetails)) {
|
if (Objects.isNull(userDetails)) {
|
||||||
throw new UsernameNotFoundException("账号不存在");
|
throw new CustomException("账号不存在");
|
||||||
}
|
}
|
||||||
SysEnterprise sysEnterprise = sysEnterpriseMapper.findEnterpriseByName(username);
|
SysEnterprise sysEnterprise = sysEnterpriseMapper.findEnterpriseByName(username);
|
||||||
if (Objects.isNull(sysEnterprise) || sysEnterprise.getState().equals(SysEnterpriseState.DISABLE)){
|
if (Objects.isNull(sysEnterprise) || sysEnterprise.getState().equals(SysEnterpriseState.DISABLE)){
|
||||||
|
|
@ -67,7 +76,7 @@ public class UserLoginService {
|
||||||
}
|
}
|
||||||
//这里可能会不对,因为我们是MD5,这个是spring security 中的 encoder加密
|
//这里可能会不对,因为我们是MD5,这个是spring security 中的 encoder加密
|
||||||
if (!passwordEncoder.matches(MD5.md5(password), userDetails.getPassword())) {
|
if (!passwordEncoder.matches(MD5.md5(password), userDetails.getPassword())) {
|
||||||
throw new BadCredentialsException("密码不正确");
|
throw new CustomException("密码不正确");
|
||||||
}
|
}
|
||||||
//spring security context insert
|
//spring security context insert
|
||||||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
|
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
|
||||||
|
|
@ -75,9 +84,14 @@ public class UserLoginService {
|
||||||
//企业用户id
|
//企业用户id
|
||||||
String id = ((UserDetailsAndId)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getId();
|
String id = ((UserDetailsAndId)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getId();
|
||||||
token = JwtUtil.createToken(id);
|
token = JwtUtil.createToken(id);
|
||||||
} catch (AuthenticationException e) {
|
String postId = ((UserDetailsAndId)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getPostId();
|
||||||
e.printStackTrace();
|
EntPost entPost = entPostMapper.selectById(postId);
|
||||||
}
|
//封装返回数据
|
||||||
return token;
|
entUser.setName(userDetails.getUsername());
|
||||||
|
entUser.setEntUserId(id);
|
||||||
|
entUser.setEnterpriseId(sysEnterprise.getSysenterpriseid());
|
||||||
|
entUser.setToken(token);
|
||||||
|
entUser.setEntPostName(entPost.getName());
|
||||||
|
return entUser;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ public class StringEncryptorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test(){
|
public void test(){
|
||||||
String text = "你的盐";
|
String text = "rzyc2022";
|
||||||
String password = "你的密码";
|
String password = "123qqq...A";
|
||||||
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
|
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
|
||||||
//加密配置
|
//加密配置
|
||||||
EnvironmentStringPBEConfig config = new EnvironmentStringPBEConfig();
|
EnvironmentStringPBEConfig config = new EnvironmentStringPBEConfig();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user