diff --git a/yun-admin/pom.xml b/yun-admin/pom.xml
index c81bc7f..65d7123 100644
--- a/yun-admin/pom.xml
+++ b/yun-admin/pom.xml
@@ -69,6 +69,17 @@
fr.opensagres.poi.xwpf.converter.pdf-gae
2.0.2
+
+
+ org.apache.pdfbox
+ pdfbox
+ 2.0.27
+
+
+ org.apache.pdfbox
+ fontbox
+ 2.0.27
+
diff --git a/yun-admin/src/main/java/net/lab1024/sa/admin/module/service/service/ServiceApplicationsService.java b/yun-admin/src/main/java/net/lab1024/sa/admin/module/service/service/ServiceApplicationsService.java
index 4e6c653..50cb1d2 100644
--- a/yun-admin/src/main/java/net/lab1024/sa/admin/module/service/service/ServiceApplicationsService.java
+++ b/yun-admin/src/main/java/net/lab1024/sa/admin/module/service/service/ServiceApplicationsService.java
@@ -101,6 +101,45 @@ public class ServiceApplicationsService {
@Resource
private DictService dictService;
+ /**
+ * 案号重复性校验(用于提交操作)
+ * @param addForm 提交表单
+ */
+ private void validateRecordNoUniquenessForSubmit(ServiceApplicationsAddForm addForm) {
+ // 只对TIME类型的服务进行案号校验
+ if (!"TIME".equals(addForm.getServiceType())) {
+ return;
+ }
+
+ String recordNo = addForm.getRecordNo();
+ if (recordNo == null || recordNo.trim().isEmpty()) {
+ return;
+ }
+
+ Long currentUserId = AdminRequestUtil.getRequestUser().getEmployeeId();
+
+ if (addForm.getApplicationId() == null) {
+ // 新增操作:检查案号是否已存在
+ List existingRecords = serviceApplicationsDao.selectByRecordNo(recordNo);
+ if (!existingRecords.isEmpty()) {
+ throw new BusinessException(UserErrorCode.HAS_EXIST.getMsg() + existingRecords.get(0).getUserName() + UserErrorCode.HAS_EXIST1.getMsg());
+ }
+ } else {
+ // 编辑操作:检查案号是否被其他用户使用并且本人也不能使用
+ List existingRecords = serviceApplicationsDao.selectByRecordNo(recordNo);
+ if (!existingRecords.isEmpty()) {
+ // 检查是否是当前用户的记录
+ boolean isCurrentUserRecord = existingRecords.stream()
+ .anyMatch(record -> record.getUserId().equals(currentUserId));
+
+ if (!isCurrentUserRecord || existingRecords.size() > 1) {
+ // 如果不是当前用户的记录,或者有多条记录(包括当前用户),则不允许
+ throw new BusinessException(UserErrorCode.HAS_EXIST.getMsg() + existingRecords.get(0).getUserName() + UserErrorCode.HAS_EXIST1.getMsg());
+ }
+ }
+ }
+ }
+
//查看详情
public ServiceApplicationsVO queryDetail(Long applicationId) {
ServiceApplicationsVO serviceApplicationsVO = new ServiceApplicationsVO();
@@ -168,7 +207,7 @@ public class ServiceApplicationsService {
}
queryForm.setEmployeeIdList(departmentEmployees);
- // 设置只查看firmAuditStatus为待审核、通过和拒绝的数据
+ // 律所管理员可以查看部门内所有已审核数据以及自己创建的所有数据(包括未提交的草稿)
queryForm.setIncludeFirmReviewed(true);
} else {
// 律所普通用户:只能看到自己提交的数据,包括所有firmAuditStatus状态
@@ -242,7 +281,19 @@ public class ServiceApplicationsService {
if("TIME".equals(addForm.getServiceType())) {
//当前登录人的ID
Long userId = AdminRequestUtil.getRequestUser().getEmployeeId();
- List applicationsVOS = serviceApplicationsDao.selectByRecordNoNotMy(userId,addForm.getRecordNo());
+
+ // 编辑操作:检查案号是否被其他用户使用并且本人也不能使用
+ List existingRecords = serviceApplicationsDao.selectByRecordNo(addForm.getRecordNo());
+ if (!existingRecords.isEmpty()) {
+ // 检查是否是当前用户的记录
+ boolean isCurrentUserRecord = existingRecords.stream()
+ .anyMatch(record -> record.getUserId().equals(userId));
+
+ if (!isCurrentUserRecord || existingRecords.size() > 1) {
+ // 如果不是当前用户的记录,或者有多条记录(包括当前用户),则不允许
+ throw new BusinessException(UserErrorCode.HAS_EXIST.getMsg() + existingRecords.get(0).getUserName() + UserErrorCode.HAS_EXIST1.getMsg());
+ }
+ }
}
serviceApplicationsDao.updateById(serviceApplicationsEntity);
}
@@ -258,10 +309,17 @@ public class ServiceApplicationsService {
if("TIME".equals(updateForm.getServiceType())) {
//当前登录人的ID
Long userId = AdminRequestUtil.getRequestUser().getEmployeeId();
- List serviceApplicationsEntity = serviceApplicationsDao.selectByRecordNoNotMy(userId, updateForm.getRecordNo());
-
- if (!serviceApplicationsEntity.isEmpty()){
- throw new BusinessException(UserErrorCode.HAS_EXIST.getMsg()+serviceApplicationsEntity.get(0).getUserName()+UserErrorCode.HAS_EXIST1.getMsg());
+ // 编辑操作:检查案号是否被其他用户使用并且本人也不能使用
+ List existingRecords = serviceApplicationsDao.selectByRecordNo(updateForm.getRecordNo());
+ if (!existingRecords.isEmpty()) {
+ // 检查是否是当前用户的记录
+ boolean isCurrentUserRecord = existingRecords.stream()
+ .anyMatch(record -> record.getUserId().equals(userId));
+
+ if (!isCurrentUserRecord || existingRecords.size() > 1) {
+ // 如果不是当前用户的记录,或者有多条记录(包括当前用户),则不允许
+ throw new BusinessException(UserErrorCode.HAS_EXIST.getMsg() + existingRecords.get(0).getUserName() + UserErrorCode.HAS_EXIST1.getMsg());
+ }
}
}
ServiceApplicationsEntity serviceApplicationsEntity = SmartBeanUtil.copy(updateForm, ServiceApplicationsEntity.class);
@@ -272,51 +330,26 @@ public class ServiceApplicationsService {
/**
* 提交
- *
*/
public ResponseDTO submit(ServiceApplicationsAddForm addForm) {
+ // 案号重复性校验
+ validateRecordNoUniquenessForSubmit(addForm);
- if("TIME".equals(addForm.getServiceType())) {
- //当前登录人的ID
- Long userId = AdminRequestUtil.getRequestUser().getEmployeeId();
- List serviceApplicationsEntity = serviceApplicationsDao.selectByRecordNoNotMy(userId, addForm.getRecordNo());
-
- if (!serviceApplicationsEntity.isEmpty()){
- throw new BusinessException(UserErrorCode.HAS_EXIST.getMsg()+serviceApplicationsEntity.get(0).getUserName()+UserErrorCode.HAS_EXIST1.getMsg());
- }
- }
-
- // 检查当前用户角色是否为CEO
- /*RequestUser requestUser = AdminRequestUtil.getRequestUser();
- List roles = roleEmployeeService.getRoleIdList(requestUser.getUserId());
- if (!roles.isEmpty()) {
- String roleCode = roles.get(0).getRoleCode();
- // 如果是CEO角色提交申报,默认通过律所审核和协会审核
- if (UserTypeEnum.CEO.getDesc().equals(roleCode)) {
- serviceApplicationsEntity.setFirmAuditStatus(ReviewEnum.PASS.getValue());
- serviceApplicationsEntity.setFirmAuditUser(requestUser.getUserId());
- serviceApplicationsEntity.setFirmAuditTime(LocalDateTime.now());
- serviceApplicationsEntity.setAssociationAuditStatus(ReviewEnum.PASS.getValue());
- serviceApplicationsEntity.setAssociationAuditUser(requestUser.getUserId());
- serviceApplicationsEntity.setAssociationAuditTime(LocalDateTime.now());
- }
- }else {*/
-
- //}
if (null == addForm.getApplicationId()){
+ // 新增提交
ServiceApplicationsEntity serviceApplications = new ServiceApplicationsEntity();
SmartBeanUtil.copyProperties(addForm, serviceApplications);
serviceApplications.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue());
serviceApplications.setReportTime(LocalDateTime.now());
serviceApplicationsDao.insert(serviceApplications);
}else {
+ // 编辑提交
ServiceApplicationsEntity serviceApplications = serviceApplicationsDao.selectById(addForm.getApplicationId());
SmartBeanUtil.copyProperties(addForm, serviceApplications);
serviceApplications.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue());
serviceApplications.setReportTime(LocalDateTime.now());
serviceApplicationsDao.updateById(serviceApplications);
}
- //serviceApplicationsDao.updateById(serviceApplications);
return ResponseDTO.ok();
}
/**
@@ -564,13 +597,7 @@ public class ServiceApplicationsService {
}
public ResponseDTO addSubmit(@Valid ServiceApplicationsAddForm addForm) {
- //判断活动类型查询案号有没有存在
- if("TIME".equals(addForm.getServiceType())) {
- List serviceApplicationsEntity = serviceApplicationsDao.selectByRecordNo(addForm.getRecordNo());
- if (!serviceApplicationsEntity.isEmpty()){
- throw new BusinessException(UserErrorCode.HAS_EXIST.getMsg()+serviceApplicationsEntity.get(0).getUserName()+UserErrorCode.HAS_EXIST1.getMsg());
- }
- }
+
//ServiceApplicationsEntity serviceApplicationsEntity = SmartBeanUtil.copy(addForm, ServiceApplicationsEntity.class);
//serviceApplicationsEntity.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue());
//serviceApplicationsEntity.setReportTime(LocalDateTime.now());
@@ -592,12 +619,35 @@ public class ServiceApplicationsService {
}*/
if (null == addForm.getApplicationId()){
+ //判断活动类型查询案号有没有存在
+ if("TIME".equals(addForm.getServiceType())) {
+ List serviceApplicationsEntity = serviceApplicationsDao.selectByRecordNo(addForm.getRecordNo());
+ if (!serviceApplicationsEntity.isEmpty()){
+ throw new BusinessException(UserErrorCode.HAS_EXIST.getMsg()+serviceApplicationsEntity.get(0).getUserName()+UserErrorCode.HAS_EXIST1.getMsg());
+ }
+ }
ServiceApplicationsEntity serviceApplications = new ServiceApplicationsEntity();
SmartBeanUtil.copyProperties(addForm, serviceApplications);
serviceApplications.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue());
serviceApplications.setReportTime(LocalDateTime.now());
serviceApplicationsDao.insert(serviceApplications);
}else {
+ //判断活动类型查询案号有没有存在
+ if("TIME".equals(addForm.getServiceType())) {
+ Long userId = AdminRequestUtil.getRequestUser().getEmployeeId();
+ // 编辑操作:检查案号是否被其他用户使用并且本人也不能使用
+ List existingRecords = serviceApplicationsDao.selectByRecordNo(addForm.getRecordNo());
+ if (!existingRecords.isEmpty()) {
+ // 检查是否是当前用户的记录
+ boolean isCurrentUserRecord = existingRecords.stream()
+ .anyMatch(record -> record.getUserId().equals(userId));
+
+ if (!isCurrentUserRecord || existingRecords.size() > 1) {
+ // 如果不是当前用户的记录,或者有多条记录(包括当前用户),则不允许
+ throw new BusinessException(UserErrorCode.HAS_EXIST.getMsg() + existingRecords.get(0).getUserName() + UserErrorCode.HAS_EXIST1.getMsg());
+ }
+ }
+ }
ServiceApplicationsEntity serviceApplications = serviceApplicationsDao.selectById(addForm.getApplicationId());
SmartBeanUtil.copyProperties(addForm, serviceApplications);
serviceApplications.setFirmAuditStatus(ReviewEnum.APPROVAL.getValue());
diff --git a/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/employee/domain/entity/EmployeeEntity.java b/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/employee/domain/entity/EmployeeEntity.java
index 07ce223..1652ec7 100644
--- a/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/employee/domain/entity/EmployeeEntity.java
+++ b/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/employee/domain/entity/EmployeeEntity.java
@@ -98,4 +98,9 @@ public class EmployeeEntity {
* 执业证号
*/
private String certificateNumber;
+
+ /**
+ * 是否有成本查看权限
+ */
+ private Boolean costVisibleFlag;
}
diff --git a/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/employee/domain/form/EmployeeAddForm.java b/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/employee/domain/form/EmployeeAddForm.java
index 699ba9f..e08484a 100644
--- a/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/employee/domain/form/EmployeeAddForm.java
+++ b/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/employee/domain/form/EmployeeAddForm.java
@@ -63,4 +63,9 @@ public class EmployeeAddForm {
@Schema(description = "职业证号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "职业证号 不能为空")
private String certificateNumber;
+
+ /**
+ * 是否有成本查看权限
+ */
+ private Boolean costVisibleFlag;
}
diff --git a/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/employee/domain/vo/EmployeeVO.java b/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/employee/domain/vo/EmployeeVO.java
index 0908d2c..c237b3a 100644
--- a/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/employee/domain/vo/EmployeeVO.java
+++ b/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/employee/domain/vo/EmployeeVO.java
@@ -61,4 +61,9 @@ public class EmployeeVO {
@Schema(description = "职业证号")
private String certificateNumber;
+
+ /**
+ * 是否有成本查看权限
+ */
+ private Boolean costVisibleFlag;
}
diff --git a/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/login/domain/RequestEmployee.java b/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/login/domain/RequestEmployee.java
index dea1ff5..552b309 100644
--- a/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/login/domain/RequestEmployee.java
+++ b/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/login/domain/RequestEmployee.java
@@ -65,6 +65,10 @@ public class RequestEmployee implements RequestUser, Serializable {
@Schema(description = "执业证号")
private String licenseNumber;
+ /**
+ * 是否有成本查看权限
+ */
+ private Boolean costVisibleFlag;
@Override
public Long getUserId() {
diff --git a/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/login/service/LoginService.java b/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/login/service/LoginService.java
index edfac29..4912006 100644
--- a/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/login/service/LoginService.java
+++ b/yun-admin/src/main/java/net/lab1024/sa/admin/module/system/login/service/LoginService.java
@@ -16,6 +16,7 @@ import net.lab1024.sa.admin.module.system.login.domain.LoginForm;
import net.lab1024.sa.admin.module.system.login.domain.LoginResultVO;
import net.lab1024.sa.admin.module.system.login.domain.RequestEmployee;
import net.lab1024.sa.admin.module.system.login.manager.LoginManager;
+import net.lab1024.sa.admin.module.system.menu.constant.MenuTypeEnum;
import net.lab1024.sa.admin.module.system.menu.domain.vo.MenuVO;
import net.lab1024.sa.admin.module.system.role.domain.vo.RoleVO;
import net.lab1024.sa.admin.module.system.role.service.RoleEmployeeService;
@@ -198,6 +199,9 @@ public class LoginService implements StpInterface {
String saTokenLoginId = UserTypeEnum.ADMIN_EMPLOYEE.getValue() + StringConst.COLON + employeeEntity.getEmployeeId();
+ // 强制踢掉该用户之前的登录会话,实现单点登录
+ //StpUtil.logout(saTokenLoginId, String.valueOf(loginDeviceEnum.getDesc()));
+
// 登录
StpUtil.login(saTokenLoginId, String.valueOf(loginDeviceEnum.getDesc()));
@@ -238,6 +242,13 @@ public class LoginService implements StpInterface {
// 前端菜单和功能点清单
List roleList = roleEmployeeService.getRoleIdList(requestEmployee.getEmployeeId());
List menuAndPointsList = roleMenuService.getMenuList(roleList.stream().map(RoleVO::getRoleId).collect(Collectors.toList()), requestEmployee.getAdministratorFlag());
+ if (null == requestEmployee.getCostVisibleFlag() || !requestEmployee.getCostVisibleFlag()){
+ // 移除成本管理相关的菜单项
+ menuAndPointsList = menuAndPointsList.stream()
+ .filter(menuVO ->
+ (menuVO.getMenuName() != null && !menuVO.getMenuName().contains("成本")))
+ .collect(Collectors.toList());
+ }
loginResultVO.setMenuList(menuAndPointsList);
// 上次登录信息
@@ -260,7 +271,9 @@ public class LoginService implements StpInterface {
}
//查询执业证号
- loginResultVO.setLicenseNumber(employeeService.getById(requestEmployee.getUserId()).getCertificateNumber());
+ EmployeeEntity byId = employeeService.getById(requestEmployee.getUserId());
+ loginResultVO.setLicenseNumber(byId.getCertificateNumber());
+ loginResultVO.setCostVisibleFlag(byId.getCostVisibleFlag());
//承诺书签订状态
loginResultVO.setAgreementSignFlag(letterService.isLetter(requestEmployee.getEmployeeId()));
//获取角色
diff --git a/yun-admin/src/main/java/net/lab1024/sa/admin/module/word/WordApplicationsController.java b/yun-admin/src/main/java/net/lab1024/sa/admin/module/word/WordApplicationsController.java
index 41de9ef..8e63701 100644
--- a/yun-admin/src/main/java/net/lab1024/sa/admin/module/word/WordApplicationsController.java
+++ b/yun-admin/src/main/java/net/lab1024/sa/admin/module/word/WordApplicationsController.java
@@ -69,14 +69,17 @@ public class WordApplicationsController {
// 生成Word文档
fileContent = wordCertificateService.generateCertificate(certificateData);
- fileName = "certificate.docx";
- contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
+ // fileName = "certificate.docx";
+ //contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
// 设置文档响应头
- response.setContentType(contentType);
- response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"; filename*=UTF-8''" + fileName);
-
+ //response.setContentType(contentType);
+ //response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"; filename*=UTF-8''" + fileName);
+ // 设置响应头
+ response.setContentType("image/png");
+ response.setHeader("Content-Disposition", "inline; filename=\"preview.png\"");
+ response.setHeader("Cache-Control", "max-age=3600");
response.setContentLength(fileContent.length);
// 将文件内容写入响应输出流
diff --git a/yun-admin/src/main/resources/mapper/penaltyapply/PenaltyApplyMapper.xml b/yun-admin/src/main/resources/mapper/penaltyapply/PenaltyApplyMapper.xml
index 6581d96..de83d58 100644
--- a/yun-admin/src/main/resources/mapper/penaltyapply/PenaltyApplyMapper.xml
+++ b/yun-admin/src/main/resources/mapper/penaltyapply/PenaltyApplyMapper.xml
@@ -47,6 +47,7 @@
+ ORDER BY tp_apply.status, tp_apply.create_time DESC
diff --git a/yun-admin/src/main/resources/mapper/penaltyapply/PenaltyLawyerMapper.xml b/yun-admin/src/main/resources/mapper/penaltyapply/PenaltyLawyerMapper.xml
index 2ab85dc..e5ebc1d 100644
--- a/yun-admin/src/main/resources/mapper/penaltyapply/PenaltyLawyerMapper.xml
+++ b/yun-admin/src/main/resources/mapper/penaltyapply/PenaltyLawyerMapper.xml
@@ -33,7 +33,7 @@
diff --git a/yun-admin/src/main/resources/mapper/service/ServiceApplicationsMapper.xml b/yun-admin/src/main/resources/mapper/service/ServiceApplicationsMapper.xml
index cb56da2..4e4a470 100644
--- a/yun-admin/src/main/resources/mapper/service/ServiceApplicationsMapper.xml
+++ b/yun-admin/src/main/resources/mapper/service/ServiceApplicationsMapper.xml
@@ -101,7 +101,7 @@
AND (
(t_service_applications.association_audit_status IS NOT NULL
AND t_service_applications.association_audit_status >= 1)
- OR t_service_applications.user_id = #{queryForm.currentUserId}
+ OR (t_service_applications.association_audit_status >= 1 and t_service_applications.user_id = #{queryForm.currentUserId})
)
@@ -115,19 +115,27 @@
-
+
AND (
(t_service_applications.firm_audit_status IS NOT NULL
- AND (t_service_applications.firm_audit_status = 1 OR t_service_applications.firm_audit_status = 3 OR t_service_applications.firm_audit_status = 4))
- OR t_service_applications.user_id = #{queryForm.currentUserId}
+ AND (t_service_applications.firm_audit_status = 1 OR t_service_applications.firm_audit_status = 3 OR t_service_applications.firm_audit_status = 4)
+ AND t_service_applications.user_id IN
+
+ #{item}
+ )
+ OR (t_service_applications.user_id = #{queryForm.currentUserId})
)
-
+
AND (
- (firm_audit_status = #{queryForm.firmAuditStatus})
- OR t_service_applications.user_id = #{queryForm.currentUserId}
+ (firm_audit_status = #{queryForm.firmAuditStatus}
+ AND t_service_applications.user_id IN
+
+ #{item}
+ )
+ OR (t_service_applications.user_id = #{queryForm.currentUserId})
)
@@ -478,7 +486,7 @@