测试问题修改

This commit is contained in:
ys.git 2025-12-09 16:01:06 +08:00
parent 017ad491dc
commit 5de199b6b2
13 changed files with 167 additions and 91 deletions

View File

@ -3,6 +3,7 @@ package com.xdap.self_development.controller;
import com.definesys.mpaas.common.http.Response;
import com.xdap.self_development.controller.request.ApprovalNodeRequest;
import com.xdap.self_development.controller.request.EngineReviewListRequest;
import com.xdap.self_development.pojo.dto.*;
import com.xdap.self_development.service.ActivitiProcessService;
import com.xdap.self_development.service.EngineReviewListService;
@ -52,11 +53,9 @@ public class ActivitiProcessController {
return Response.ok().data(msg);
};
//查看审批
@GetMapping(value = "/showEngReview")
public Response showEngReview(@RequestParam(value = "userID") String userID,
@RequestParam(value = "page") Integer page,@RequestParam(value = "size") Integer size
,@RequestParam(value = "ycOrOth") String ycOrOth) {
PageResultDTO msg = engineReviewListService.selectEngineReviewListByUserId(userID,page,size,ycOrOth);
@PostMapping(value = "/showEngReview")
public Response showEngReview(@RequestBody EngineReviewListRequest engineReviewListRequest) {
PageResultDTO msg = engineReviewListService.selectEngineReviewListByUserId(engineReviewListRequest);
return Response.ok().data(msg);
};
//申请人退回审批

View File

@ -14,6 +14,7 @@ import com.xdap.self_development.service.ModelMenuPermissionService;
import com.xdap.self_development.service.ModelRoleService;
import com.xdap.self_development.service.ParameterService;
import com.xdap.self_development.service.TemplateService;
import org.apache.commons.lang3.ObjectUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -36,18 +37,18 @@ public class PermissionController {
//添加角色
@PostMapping("/addRoles")
Response addRoles(@RequestBody ModelRolesRequest request){
Response addRoles(@RequestBody ModelRolesRequest request) {
try {
modelRoleService.addRoles(request);
} catch (Exception e) {
throw new RuntimeException("添加失败:检查是否存在重复角色(名称+代码)" +e.getMessage());
throw new RuntimeException("添加失败:检查是否存在重复角色(名称+代码)" + e.getMessage());
}
return Response.ok();
}
//查看角色
@GetMapping("/selectRoles")
Response selectRoles(){
Response selectRoles() {
try {
List<ModelRolesPojo> modelRolesPojos = modelRoleService.selectRoles();
return Response.ok().data(modelRolesPojos);
@ -55,11 +56,12 @@ public class PermissionController {
throw new RuntimeException(e.getMessage());
}
}
//删除角色
@GetMapping("/removeRoles")
Response removeRoles(@RequestParam String roleID,String userID){
Response removeRoles(@RequestParam String roleID, String userID) {
try {
modelRoleService.removeRoles(roleID,userID);
modelRoleService.removeRoles(roleID, userID);
return Response.ok();
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
@ -69,26 +71,27 @@ public class PermissionController {
//获取用户权限
@GetMapping("/selectPersByUser")
Response selectPersByUser(@RequestParam String userOrDepID){
try {
Response selectPersByUser(@RequestParam String userOrDepID) {
List<MenuParamView> views = modelRoleService.selectPersByUser(userOrDepID);
return Response.ok().data(views);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
//获取角色权限
@GetMapping("/selectPersByRole")
Response selectPersByRole(@RequestParam String roleID){
Response selectPersByRole(@RequestParam String roleID) {
List<MenuParamView> views = modelRoleService.selectPersByRole(roleID);
if (ObjectUtils.isEmpty(views)) {
return Response.ok().data("角色无权限");
}
return Response.ok().data(views);
}
//为用户绑定角色
@PostMapping("/userRoleBinding")
public Response userRoleBinding(@RequestBody List<UserRoleBindingRequest> userRoleBindingRequest){
public Response userRoleBinding(@RequestBody UserRoleBindingRequest userRoleBindingRequest) {
try {
modelRoleService.userRoleBinding(userRoleBindingRequest);
return Response.ok();
@ -100,7 +103,7 @@ public class PermissionController {
//修改角色权限(关联权限修改 增加修改删除)
@PostMapping("/updatePerForRole")
public Response updatePerForRole(@RequestBody List<RolePerJoinRequest> request){
public Response updatePerForRole(@RequestBody List<RolePerJoinRequest> request) {
try {
modelRoleService.updatePerForRole(request);
return Response.ok();
@ -108,17 +111,18 @@ public class PermissionController {
throw new RuntimeException(e.getMessage());
}
}
// 修改单个角色信息(基础信息)
// 修改单个角色信息(基础信息)
@PostMapping("/updateRole")
public Response updateRole(@RequestBody ModelRolesPojo modelRolesPojo,@RequestParam String userID){
modelRoleService.updateRole(modelRolesPojo,userID);
public Response updateRole(@RequestBody ModelRolesPojo modelRolesPojo, @RequestParam String userID) {
modelRoleService.updateRole(modelRolesPojo, userID);
return Response.ok();
}
//菜单查询
@GetMapping("/selectMenus")
Response selectMenus(){
Response selectMenus() {
try {
List<MenuListView> modelRolesPojos = modelMenuPermissionService.selectMenus();
return Response.ok().data(modelRolesPojos);

View File

@ -0,0 +1,79 @@
package com.xdap.self_development.controller.request;
import com.alibaba.excel.annotation.ExcelProperty;
import com.definesys.mpaas.query.annotation.RowID;
import com.definesys.mpaas.query.annotation.RowIDType;
import com.definesys.mpaas.query.annotation.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 发动机审核列表
* </p>
*
* @author Lys111
* @since 2025-11-26
*/
@Data
public class EngineReviewListRequest implements Serializable {
/**
* 流程主题
*/
private String processTopic;
/**
* 本品或竞品
*/
@ExcelProperty("本品或竞品")
private String ycOrOth;
/**
* 机型ID
*/
private String modelId;
/**
* 产品型号
*/
private String modelName;
/**
* 状态代号
*/
private Integer statusCode;
/**
* 子系统
*/
private String subsystemName;
/**
* 申请人ID
*/
private String applicant;
/**
* 当前状态
*/
private String statusDescription;
/**
* 当前审批人
*/
private String approverPersons;
/**
* 申请时间
*/
private Date creationDate;
private Integer page;
private Integer size;
private String userID;
}

View File

@ -2,10 +2,12 @@ package com.xdap.self_development.controller.request;
import lombok.Data;
import java.util.List;
@Data
public class UserRoleBindingRequest {
//角色ID 用户ID 用户是否是部门0:用户 1部门
private String roleId;
private String userOrDeptId;
private List<String> userOrDeptIds;
private Integer isDept;
}

View File

@ -21,6 +21,8 @@ public class ModelDepUserRolePojo {
private String roleId ;
/** 是否是部门,0个人1部门,; */
private int isDep ;
/** 是否启用*/
private int isEnable ;
/** 创建人,; */
private String createdBy ;
/** 创建时间,; */

View File

@ -25,6 +25,10 @@ public class ActivitiRecordDTO {
* 节点顺序
*/
private Integer nodeOrder;
/**
* 操作时间
*/
private String operate;
/**
* 操作时间
*/

View File

@ -1,12 +1,13 @@
package com.xdap.self_development.service;
import com.xdap.self_development.controller.request.EngineReviewListRequest;
import com.xdap.self_development.pojo.EngineReviewListPojo;
import com.xdap.self_development.pojo.dto.PageResultDTO;
public interface EngineReviewListService {
//查看机型审批列表
PageResultDTO<EngineReviewListPojo> selectEngineReviewListByUserId(String userId,Integer page,Integer size,String ycOrOth);
PageResultDTO<EngineReviewListPojo> selectEngineReviewListByUserId(EngineReviewListRequest engineReviewListRequest);
//撤回审批只有发起人在没有被人审批时可以撤回
String returnApproval(String approvalId);

View File

@ -29,5 +29,5 @@ public interface ModelRoleService {
void removeRoles(String roleID, String userID);
void userRoleBinding(List<UserRoleBindingRequest> userRoleBindingRequest);
void userRoleBinding(UserRoleBindingRequest userRoleBindingRequest);
}

View File

@ -466,6 +466,7 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
if (reviewListPojo == null) {
throw new RuntimeException("无效的审批记录");
}
ActivitiDataAndRecordDTO activitiDataAndRecordDTO = new ActivitiDataAndRecordDTO();
//查找审批数据
ArrayList<ActivitiDataDTO> activitiDataDTOS = new ArrayList<>();
@ -501,6 +502,7 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
activitiRecordDTO.setCommon(paramApprovalRecordPojo.getApprovalComment());
activitiRecordDTO.setNodeOrder(paramApprovalRecordPojo.getNodeOrder());
activitiRecordDTO.setOperateTime(paramApprovalRecordPojo.getOperateTime());
activitiRecordDTO.setOperate(paramApprovalRecordPojo.getOperator());
activitiRecordDTOS.add(activitiRecordDTO);
}
//找到下一级审批人

View File

@ -119,21 +119,6 @@ public class DataEntryEngineModelServiceImpl implements DataEntryEngineModelServ
}
log.info("查找到的责任人:{}", resPerIds);
List<DataEntryEngineModelPojo> modelPojos = sw
.buildFromDatasource("xdap_app_223770822127386625")
.eq("yc_or_oth", request.getYcOrOth())
.like("model_name", request.getModelName())
.like("product_number", request.getProductNumber())
.like("plate", request.getPlate())
.like("platform", request.getPlatform())
.like("series", request.getSeries())
.like("market_segment", request.getMarketSegment())
.like("project_name", request.getProjectName())
.like("project_number", request.getProjectNumber())
.like("brand", request.getBrand())
.in("responsible_person_id", resPerIds)
.like("distribute_status", request.getDistributeStatus())
.doQuery(DataEntryEngineModelPojo.class);
PageQueryResult<DataEntryEngineModelPojo> pageQueryResult = sw
.buildFromDatasource("xdap_app_223770822127386625")
.eq("yc_or_oth", request.getYcOrOth())
@ -149,6 +134,7 @@ public class DataEntryEngineModelServiceImpl implements DataEntryEngineModelServ
.in("responsible_person_id", resPerIds)
.like("distribute_status", request.getDistributeStatus())
.doPageQuery(page, size, DataEntryEngineModelPojo.class);
for (DataEntryEngineModelPojo modelPojo : pageQueryResult.getResult()) {
DataEntryEngineModelDto dataEntryEngineModelDto = new DataEntryEngineModelDto();
BeanUtils.copyProperties(modelPojo, dataEntryEngineModelDto);
@ -168,7 +154,7 @@ public class DataEntryEngineModelServiceImpl implements DataEntryEngineModelServ
dataEntryEngineModelDtos.add(dataEntryEngineModelDto);
}
tPageResultDTO.setList(dataEntryEngineModelDtos);
tPageResultDTO.setTotalCount(modelPojos.size());
tPageResultDTO.setTotalCount(pageQueryResult.getCount());
return tPageResultDTO;
}

View File

@ -1,7 +1,9 @@
package com.xdap.self_development.service.impl;
import com.definesys.mpaas.query.MpaasQueryFactory;
import com.definesys.mpaas.query.db.PageQueryResult;
import com.xdap.api.moudle.user.pojo.XdapUsers;
import com.xdap.self_development.controller.request.EngineReviewListRequest;
import com.xdap.self_development.enums.ParamValueVersionEnum;
import com.xdap.self_development.pojo.ApprovalConfigPojo;
import com.xdap.self_development.pojo.EngineReviewListPojo;
@ -32,26 +34,20 @@ public class EngineReviewListServiceImpl implements EngineReviewListService {
private XdapDeptUsersService xdapDeptUsersService;
@Override
public PageResultDTO<EngineReviewListPojo> selectEngineReviewListByUserId(String userId, Integer page, Integer size, String ycOrOth) {
if (ObjectUtils.isEmpty(userId)) {
throw new RuntimeException("查看用户为空");
}
//todo 如果user是管理员则全部查看否则只能查看他所提交该他审批的数据
Integer totalCount = sw.buildFromDatasource("xdap_app_223770822127386625")
.eq("yc_or_oth", ycOrOth)
.conjuctionAnd()
.eq("applicant", userId)
.or()
.like("approver_persons", userId)
.doQuery(EngineReviewListPojo.class).size();
public PageResultDTO<EngineReviewListPojo> selectEngineReviewListByUserId(EngineReviewListRequest engineReviewListRequest) {
List<EngineReviewListPojo> engineReviewListPojos = sw.buildFromDatasource("xdap_app_223770822127386625")
.eq("yc_or_oth", ycOrOth)
.conjuctionAnd()
.eq("applicant", userId)
.or()
.like("approver_persons", userId)
.doPageQuery(page, size, EngineReviewListPojo.class).getResult();
Integer page = engineReviewListRequest.getPage();
Integer size = engineReviewListRequest.getSize();
PageQueryResult<EngineReviewListPojo> engineReviewListPojoPageQueryResult = sw.buildFromDatasource("xdap_app_223770822127386625")
.like("model_name", engineReviewListRequest.getModelName())
.like("process_topic", engineReviewListRequest.getProcessTopic())
.like("subsystem_name", engineReviewListRequest.getSubsystemName())
.like("status_description", engineReviewListRequest.getStatusDescription())
.eq("yc_or_oth", engineReviewListRequest.getYcOrOth())
.eq("applicant", engineReviewListRequest.getApplicant())
.doPageQuery(page, size, EngineReviewListPojo.class);
List<EngineReviewListPojo> engineReviewListPojos = engineReviewListPojoPageQueryResult.getResult();
//将engineReviewListPojosID改为姓名
ArrayList<EngineReviewListPojo> engineReviewListPojos1 = new ArrayList<>();
@ -74,7 +70,7 @@ public class EngineReviewListServiceImpl implements EngineReviewListService {
PageResultDTO<EngineReviewListPojo> pageResultDTO = new PageResultDTO();
pageResultDTO.setList(engineReviewListPojos1);
pageResultDTO.setTotalCount(totalCount);
pageResultDTO.setTotalCount(engineReviewListPojoPageQueryResult.getCount());
return pageResultDTO;
}

View File

@ -125,10 +125,10 @@ public class ModelRoleServiceImpl implements ModelRoleService {
modelRolesPojo.setLastUpdatedBy(userID);
modelRolesPojo.setLastUpdateDate(new Date());
businessDatabase.getBusinessDatabase()
.update("role_name",modelRolesPojo.getRoleName())
.update("role_code",modelRolesPojo.getRoleCode())
.update("role_description",modelRolesPojo.getRoleDescription())
.rowid("id",modelRolesPojo.getId())
.update("role_name", modelRolesPojo.getRoleName())
.update("role_code", modelRolesPojo.getRoleCode())
.update("role_description", modelRolesPojo.getRoleDescription())
.rowid("id", modelRolesPojo.getId())
.doUpdate(ModelRolesPojo.class);
}
@ -139,6 +139,7 @@ public class ModelRoleServiceImpl implements ModelRoleService {
}
List<ModelDepUserRolePojo> userOrDeps = businessDatabase.getBusinessDatabase()
.eq("user_or_dep", userOrDepID)
.eq("is_enable", 1)
.doQuery(ModelDepUserRolePojo.class);
List<MenuParamView> paramViews = new ArrayList<>();
for (ModelDepUserRolePojo userOrDep : userOrDeps) {
@ -161,7 +162,8 @@ public class ModelRoleServiceImpl implements ModelRoleService {
.doQuery(ModelRolePermissionPojo.class);
List<String> perids = role.stream().map(x -> x.getPerId()).distinct().collect(Collectors.toList());
if (ObjectUtils.isEmpty(role)) {
throw new RuntimeException("该角色没有权限:"+roleID);
log.warn("该角色没有权限");
return null;
}
List<ModelMenuParameterPojo> menuParameters = businessDatabase.getBusinessDatabase()
.in("id", perids)
@ -215,29 +217,27 @@ public class ModelRoleServiceImpl implements ModelRoleService {
}
@Override
public void userRoleBinding(List<UserRoleBindingRequest> userRoleBindingRequest) {
@Transactional(rollbackFor = Exception.class)
public void userRoleBinding(UserRoleBindingRequest userRoleBindingRequest) {
//将角色绑定的老版本人员置为未启用
List<String> roleids = userRoleBindingRequest.stream().map(x -> x.getRoleId()).distinct().collect(Collectors.toList());
for (String roleId : roleids) {
String roleId = userRoleBindingRequest.getRoleId();
Integer isDept = userRoleBindingRequest.getIsDept();
if (ObjectUtils.isNotEmpty(roleId)) {
businessDatabase.getBusinessDatabase()
.update("is_enable", 0)
.eq("role_id", roleId)
.doUpdate(ModelDepUserRolePojo.class);
}
}
for (UserRoleBindingRequest roleBindingRequest : userRoleBindingRequest) {
String roleId = roleBindingRequest.getRoleId();
String userOrDeptId = roleBindingRequest.getUserOrDeptId();
Integer isDept = roleBindingRequest.getIsDept();
for (String userOrDeptId : userRoleBindingRequest.getUserOrDeptIds()) {
ModelDepUserRolePojo modelDepUserRolePojo = new ModelDepUserRolePojo();
modelDepUserRolePojo.setRoleId(roleId);
modelDepUserRolePojo.setUserOrDep(userOrDeptId);
modelDepUserRolePojo.setIsEnable(1);
if (isDept != 0 && isDept != 1) {
throw new RuntimeException("用户定位异常,非用户或部门");
}
modelDepUserRolePojo.setIsDep(isDept);
modelDepUserRolePojo.setCreationDate(new Date());
businessDatabase.getBusinessDatabase()
.doInsert(modelDepUserRolePojo);
}

View File

@ -91,6 +91,7 @@ CREATE TABLE yfsjglpt_model_dep_user_role(
`user_or_dep` VARCHAR(64) COMMENT '用户或部门ID',
`role_id` VARCHAR(64) COMMENT '角色ID',
`is_dep` INT COMMENT '是否是部门;0个人1部门',
`is_enable` INT COMMENT '是否启用;0未启用1启用',
`created_by` VARCHAR(64) COMMENT '创建人',
`creation_date` DATETIME COMMENT '创建时间',
`last_updated_by` VARCHAR(64) COMMENT '最后更新人',