Browse Source

fix:签约等

master
wang 2 months ago
parent
commit
f8f9e3401b
  1. 22
      yun-admin/src/main/java/net/lab1024/sa/admin/module/letter/sql/LetterMenu.sql
  2. 2
      yun-admin/src/main/java/net/lab1024/sa/admin/module/penalty/controller/PenaltyApplyController.java
  3. 12
      yun-admin/src/main/java/net/lab1024/sa/admin/module/penalty/domain/entity/PenaltyApplyEntity.java
  4. 16
      yun-admin/src/main/java/net/lab1024/sa/admin/module/penalty/domain/form/PenaltyApplyQueryForm.java
  5. 4
      yun-admin/src/main/java/net/lab1024/sa/admin/module/penalty/domain/form/PenaltyApplyUpdateForm.java
  6. 6
      yun-admin/src/main/java/net/lab1024/sa/admin/module/penalty/domain/vo/PenaltyApplyVO.java
  7. 74
      yun-admin/src/main/java/net/lab1024/sa/admin/module/penalty/service/PenaltyApplyService.java
  8. 2
      yun-admin/src/main/java/net/lab1024/sa/admin/module/service/domain/form/ServiceApplicationsUpdateForm.java
  9. 6
      yun-admin/src/main/java/net/lab1024/sa/admin/module/service/service/ServiceApplicationsService.java
  10. 12
      yun-admin/src/main/resources/mapper/penaltyapply/PenaltyApplyMapper.xml
  11. 13
      yun-admin/src/main/resources/mapper/service/ServiceApplicationsMapper.xml

22
yun-admin/src/main/java/net/lab1024/sa/admin/module/letter/sql/LetterMenu.sql

@ -1,22 +0,0 @@
# 默认是按前端工程文件的 /views/business 文件夹的路径作为前端组件路径,如果你没把生成的 .vue 前端代码放在 /views/business 下,
# 那就根据自己实际情况修改下面 SQL 的 path,component 字段值,避免执行 SQL 后菜单无法访问。
# 如果你一切都是按照默认,那么下面的 SQL 基本不用改
INSERT INTO t_menu ( menu_name, menu_type, parent_id, path, component, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, create_user_id )
VALUES ( '承诺书签订表', 2, 0, '/letter/list', '/business/letter/letter-list.vue', false, false, true, false, 1, 1 );
# 按菜单名称查询该菜单的 menu_id 作为按钮权限的 父菜单ID 与 功能点关联菜单ID
SET @parent_id = NULL;
SELECT t_menu.menu_id INTO @parent_id FROM t_menu WHERE t_menu.menu_name = '承诺书签订表';
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '查询', 3, @parent_id, false, false, true, false, 1, 'letter:query', 'letter:query', @parent_id, 1 );
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '添加', 3, @parent_id, false, false, true, false, 1, 'letter:add', 'letter:add', @parent_id, 1 );
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '更新', 3, @parent_id, false, false, true, false, 1, 'letter:update', 'letter:update', @parent_id, 1 );
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '删除', 3, @parent_id, false, false, true, false, 1, 'letter:delete', 'letter:delete', @parent_id, 1 );

2
yun-admin/src/main/java/net/lab1024/sa/admin/module/penalty/controller/PenaltyApplyController.java

@ -73,7 +73,7 @@ public class PenaltyApplyController {
//审核
@Operation(summary = "审核 @author wzh")
@PostMapping("/penaltyApply/review")
@SaCheckPermission("penaltyApply:review")
//@SaCheckPermission("penaltyApply:review")
public ResponseDTO<String> review(@RequestBody @Valid PenaltyApplyUpdateForm updateForm) {
return penaltyApplyService.review(updateForm);
}

12
yun-admin/src/main/java/net/lab1024/sa/admin/module/penalty/domain/entity/PenaltyApplyEntity.java

@ -32,6 +32,11 @@ public class PenaltyApplyEntity {
*/
private Long userId;
/**
* 部门ID
*/
private Long departmentId;
/**
* 申请日期
*/
@ -43,10 +48,15 @@ public class PenaltyApplyEntity {
private String usePurpose;
/**
* 状态0-未提交1-已提交2-审核中3-已批准5-已驳回
* 律所审核状态0-未提交1-已提交2-审核中3-已批准5-已驳回
*/
private Integer status;
/**
* 律协审核状态0-未提交1-已提交2-审核中3-已批准5-已驳回
*/
private Integer auditStatus;
/**
* 创建时间
*/

16
yun-admin/src/main/java/net/lab1024/sa/admin/module/penalty/domain/form/PenaltyApplyQueryForm.java

@ -30,9 +30,23 @@ public class PenaltyApplyQueryForm extends PageParam {
private String userName;
/**
* 状态0-未提交1-已提交2-审核中3-已批准5-已驳回
* 律所审核状态0-未提交1-已提交2-审核中3-已批准5-已驳回
*/
private Integer status;
/**
* 律协审核状态0-未提交1-已提交2-审核中3-已批准5-已驳回
*/
private Integer auditStatus;
/**
* 部门ID
*/
private Long departmentId;
/**
* 用户角色代码
*/
private String userType;
private Long userId;
}

4
yun-admin/src/main/java/net/lab1024/sa/admin/module/penalty/domain/form/PenaltyApplyUpdateForm.java

@ -19,7 +19,9 @@ public class PenaltyApplyUpdateForm {
@NotNull(message = "申请ID 不能为空")
private Long id;
@Schema(description = "状态(0-未提交,1-已提交,2-审核中,3-已批准,5-已驳回)")
@Schema(description = "律所审批状态(0-未提交,1-已提交,2-审核中,3-已批准,5-已驳回)")
private Integer status;
@Schema(description = "律协审批状态(0-未提交,1-已提交,2-审核中,3-已批准,5-已驳回)")
private Integer auditStatus;
}

6
yun-admin/src/main/java/net/lab1024/sa/admin/module/penalty/domain/vo/PenaltyApplyVO.java

@ -23,6 +23,9 @@ public class PenaltyApplyVO {
@Schema(description = "申请人ID")
private Long userId;
@Schema(description = "部门ID")
private Long departmentId;
@Schema(description = "申请人名称")
private String userName;
@ -35,6 +38,9 @@ public class PenaltyApplyVO {
@Schema(description = "状态(0-未提交,1-已提交,2-审核中,3-已批准,5-已驳回)")
private Integer status;
@Schema(description = "状态(0-未提交,1-已提交,2-审核中,3-已批准,5-已驳回)")
private Integer auditStatus;
@Schema(description = "创建时间")
private LocalDateTime createTime;

74
yun-admin/src/main/java/net/lab1024/sa/admin/module/penalty/service/PenaltyApplyService.java

@ -4,6 +4,7 @@ import java.time.LocalDateTime;
import java.util.List;
import net.lab1024.sa.admin.common.enums.ReviewEnum;
import net.lab1024.sa.admin.module.letter.service.LetterService;
import net.lab1024.sa.admin.module.penalty.dao.PenaltyApplyDao;
import net.lab1024.sa.admin.module.penalty.domain.entity.PenaltyApplyEntity;
import net.lab1024.sa.admin.module.penalty.domain.form.PenaltyApplyAddForm;
@ -30,6 +31,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.validation.Valid;
import lombok.extern.slf4j.Slf4j;
/**
* 无处罚证明申请主表 Service
*
@ -39,6 +42,7 @@ import javax.validation.Valid;
*/
@Service
@Slf4j
public class PenaltyApplyService {
@Resource
@ -49,16 +53,25 @@ public class PenaltyApplyService {
private EmployeeService employeeService;
@Resource
private RoleEmployeeService roleEmployeeService;
@Resource
private LetterService letterService;
/**
* 分页查询
*/
public PageResult<PenaltyApplyVO> queryPage(PenaltyApplyQueryForm queryForm) {
Page<?> page = SmartPageUtil.convert2PageQuery(queryForm);
RequestEmployee requestUser = AdminRequestUtil.getRequestUser();
List<RoleVO> roleIdList = roleEmployeeService.getRoleIdList(requestUser.getEmployeeId());
if (!UserTypeEnum.CEO.getDesc().equals(roleIdList.get(0).getRoleCode())) {
queryForm.setUserId(requestUser.getEmployeeId());
// 安全获取角色代码,避免NPE
String roleCode = getUserRoleCode(requestUser);
if (roleCode.equals(UserTypeEnum.CEO.getDesc())) {
queryForm.setUserType(roleCode);
}else if(roleCode.equals(UserTypeEnum.CTO.getDesc())){
queryForm.setDepartmentId(requestUser.getDepartmentId());
}else {
queryForm.setUserId(requestUser.getUserId());
}
List<PenaltyApplyVO> list = penaltyApplyDao.queryPage(page, queryForm);
return SmartPageUtil.convert2PageResult(page, list);
}
@ -76,7 +89,15 @@ public class PenaltyApplyService {
}
PenaltyApplyEntity penaltyApplyEntity = SmartBeanUtil.copy(addForm, PenaltyApplyEntity.class);
penaltyApplyEntity.setUserId(userId);
penaltyApplyEntity.setStatus(ReviewEnum.APPROVAL.getValue());
String roleCode = letterService.getRoleCode();
//判断类型
if (roleCode.equals(UserTypeEnum.CTO.getDesc())){
penaltyApplyEntity.setStatus(ReviewEnum.PASS.getValue());
penaltyApplyEntity.setAuditStatus(ReviewEnum.APPROVAL.getValue());
}else {
penaltyApplyEntity.setStatus(ReviewEnum.APPROVAL.getValue());
}
penaltyApplyEntity.setDepartmentId(entity.getDepartmentId());
penaltyApplyEntity.setApplyDate(LocalDateTime.now());
penaltyApplyDao.insert(penaltyApplyEntity);
return ResponseDTO.ok();
@ -118,7 +139,17 @@ public class PenaltyApplyService {
public ResponseDTO<String> review(@Valid PenaltyApplyUpdateForm updateForm) {
PenaltyApplyEntity penaltyApplyEntity = penaltyApplyDao.selectById(updateForm.getId());
penaltyApplyEntity.setStatus(updateForm.getStatus());
String roleCode = letterService.getRoleCode();
//判断类型
if (roleCode.equals(UserTypeEnum.CTO.getDesc())){
//审核通过,则下一个为律协审核
if (ReviewEnum.PASS.getValue().equals(updateForm.getAuditStatus())){
penaltyApplyEntity.setAuditStatus(ReviewEnum.APPROVAL.getValue());
}
penaltyApplyEntity.setStatus(updateForm.getAuditStatus());
}else{
penaltyApplyEntity.setAuditStatus(updateForm.getAuditStatus());
}
penaltyApplyDao.updateById(penaltyApplyEntity);
return ResponseDTO.ok();
}
@ -126,4 +157,37 @@ public class PenaltyApplyService {
public PenaltyApplyEntity selectOne(Integer id) {
return penaltyApplyDao.selectById(id);
}
/**
* 安全获取用户角色代码避免NPE
* @param requestUser 请求用户信息
* @return 用户角色代码如果获取失败则返回USER默认角色
*/
private String getUserRoleCode(RequestEmployee requestUser) {
try {
if (requestUser == null) {
log.warn("请求用户信息为空,返回默认用户角色");
return UserTypeEnum.USER.getDesc();
}
List<RoleVO> roleIdList = roleEmployeeService.getRoleIdList(requestUser.getEmployeeId());
if (roleIdList == null || roleIdList.isEmpty()) {
log.warn("用户ID {} 的角色列表为空,返回默认用户角色", requestUser.getEmployeeId());
return UserTypeEnum.USER.getDesc();
}
RoleVO roleVO = roleIdList.get(0);
if (roleVO == null || roleVO.getRoleCode() == null) {
log.warn("角色信息为空或角色代码为空,返回默认用户角色");
return UserTypeEnum.USER.getDesc();
}
String roleCode = roleVO.getRoleCode();
log.debug("用户ID {} 的角色代码: {}", requestUser.getEmployeeId(), roleCode);
return roleCode;
} catch (Exception e) {
log.error("获取用户角色代码时发生异常", e);
return UserTypeEnum.USER.getDesc();
}
}
}

2
yun-admin/src/main/java/net/lab1024/sa/admin/module/service/domain/form/ServiceApplicationsUpdateForm.java

@ -75,7 +75,7 @@ public class ServiceApplicationsUpdateForm{
private Long associationAuditUser;
@Schema(description = "协会审核意见")
private String associationAuditOpinion;
private Integer auditResult;
/**
* 职务id
*/

6
yun-admin/src/main/java/net/lab1024/sa/admin/module/service/service/ServiceApplicationsService.java

@ -711,7 +711,7 @@ public class ServiceApplicationsService {
// 根据不同角色执行不同的审核操作
if (UserTypeEnum.CEO.getDesc().equals(roleCode)) {
// CEO角色:修改协会审核状态
serviceApplicationsEntity.setAssociationAuditStatus(updateForm.getAssociationAuditStatus());
serviceApplicationsEntity.setAssociationAuditStatus(updateForm.getFirmAuditStatus());
serviceApplicationsEntity.setAssociationAuditUser(requestUser.getEmployeeId());
serviceApplicationsEntity.setAssociationAuditTime(LocalDateTime.now());
serviceApplicationsEntity.setAssociationAuditOpinion(updateForm.getAssociationAuditOpinion());
@ -878,10 +878,10 @@ public class ServiceApplicationsService {
// 根据不同角色执行不同的审核操作
if (UserTypeEnum.CEO.getDesc().equals(roleCode)) {
// CEO角色:修改协会审核状态
serviceApplicationsDao.batchReviewAsAssociation(fileKeyList, ReviewEnum.PASS.getValue(), requestUser.getUserId(), reviewTime);
serviceApplicationsDao.batchReviewAsAssociation(fileKeyList, updateForm.getAuditResult(), requestUser.getUserId(), reviewTime);
} else {
// 其他角色(如律所管理员):修改律所审核状态
serviceApplicationsDao.batchReviewAsFirm(fileKeyList, ReviewEnum.PASS.getValue(), requestUser.getUserId(), reviewTime);
serviceApplicationsDao.batchReviewAsFirm(fileKeyList, updateForm.getAuditResult(), requestUser.getUserId(), reviewTime);
}
return ResponseDTO.ok();

12
yun-admin/src/main/resources/mapper/penaltyapply/PenaltyApplyMapper.xml

@ -11,7 +11,9 @@
t_penalty_apply.status,
t_penalty_apply.create_time,
t_penalty_apply.update_time,
t_penalty_apply.deleted_flag
t_penalty_apply.deleted_flag,
t_penalty_apply.department_id,
t_penalty_apply.audit_status
</sql>
<!-- 分页查询 -->
@ -25,6 +27,8 @@
tp_apply.create_time as createTime,
tp_apply.update_time as updateTime,
tp_apply.deleted_flag as deletedFlag,
tp_apply.audit_status as auditStatus,
tp_apply.department_id as departmentId,
te_employee.actual_name AS userName
FROM t_penalty_apply tp_apply left join t_employee te_employee on tp_apply.user_id = te_employee.employee_id
<where>
@ -45,6 +49,12 @@
<if test="queryForm.userId != null">
AND tp_apply.user_id = #{queryForm.userId}
</if>
<if test="queryForm.departmentId != null">
AND tp_apply.department_id = #{queryForm.departmentId}
</if>
<if test="queryForm.userType == 'ceo' ">
AND tp_apply.audit_status > 0
</if>
</if>
</where>
ORDER BY tp_apply.status, tp_apply.create_time DESC

13
yun-admin/src/main/resources/mapper/service/ServiceApplicationsMapper.xml

@ -276,7 +276,7 @@
AND tsa.firm_id = #{queryForm.firmId}
</if>
</where>
GROUP BY tsa.user_id
GROUP BY tsa.user_id, tsa.certificate_number
ORDER BY e.actual_name
</select>
<select id="getLawyerStatisticsWithParamYear"
@ -311,7 +311,7 @@
AND d.department_id = #{queryForm.firmId}
</if>
</where>
GROUP BY tsa.user_id
GROUP BY tsa.user_id, tsa.certificate_number
</select>
<select id="getLawyerStatistic"
resultType="net.lab1024.sa.admin.module.service.domain.vo.LawyerStatisticsVO">
@ -335,6 +335,7 @@
and tsa.user_id = #{queryForm.userId}
</if>
</where>
GROUP BY tsa.user_id, tsa.certificate_number
</select>
<select id="getdepartmentStatistics"
resultType="net.lab1024.sa.admin.module.service.domain.vo.LawyerStatisticsVO">
@ -360,6 +361,7 @@
and d.department_id = #{queryForm.firmId}
</if>
</where>
GROUP BY d.department_id, d.department_name
</select>
<select id="getdepartmentMothStatistic"
resultType="net.lab1024.sa.admin.module.service.domain.vo.LawyerStatisticsVO">
@ -385,6 +387,7 @@
and d.department_id = #{queryForm.firmId}
</if>
</where>
GROUP BY d.department_id, d.department_name
</select>
<select id="getDepartmentStatisticsWithParam"
resultType="net.lab1024.sa.admin.module.service.domain.form.ServiceDepartmentImportForm">
@ -439,6 +442,11 @@
<if test="queryForm.endTime != null">
AND tsa.association_audit_time &lt;= #{queryForm.endTime}
</if>
where
1 =1
<if test="queryForm.firmId != null">
and d.department_id = #{queryForm.firmId}
</if>
GROUP BY
d.department_id,
d.department_name
@ -485,6 +493,7 @@
and d.department_id = #{queryForm.firmId}
</if>
</where>
GROUP BY d.department_id, d.department_name
</select>
<select id="getServiceApplicationsAmount" resultType="java.math.BigDecimal">
SELECT

Loading…
Cancel
Save