认证清单-分页查询排序、删除与批量删除处理历史数据。编辑增加修改历史。

This commit is contained in:
wangzhijiang
2023-03-14 11:01:10 +08:00
parent 0dcc9ea2ac
commit e6182a8b8d
7 changed files with 227 additions and 1 deletions
@@ -350,6 +350,7 @@ CREATE TABLE `project_certification_inventory_log` (
`sys_org_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属部门',
`content_cn` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作内容-中文',
`content_en` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作内容-英文',
`operator_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作类型',
`project_certification_inventory_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '认证清单数据id',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '项目库-认证清单-修改历史表' ROW_FORMAT = Dynamic;
@@ -59,6 +59,7 @@ public class ProjectCertificationInventoryEOController extends JeroController<Pr
@RequestParam(name="cut", defaultValue="cn") String cut,
HttpServletRequest req) {
QueryWrapper<ProjectCertificationInventoryEO> queryWrapper = QueryGenerator.initQueryWrapper(projectCertificationInventoryEO, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
Page<ProjectCertificationInventoryEO> page = new Page<ProjectCertificationInventoryEO>(pageNo, pageSize);
IPage<ProjectCertificationInventoryEO> pageList = this.projectCertificationInventoryEOService.queryPage(queryWrapper,page,projectCertificationInventoryEO,cut);
return Result.OK(cut,pageList);
@@ -72,6 +72,11 @@ public class ProjectCertificationInventoryLogEO implements Serializable {
@ApiModelProperty(value = "操作内容-英文")
private java.lang.String contentEn;
/**操作类型*/
@Excel(name = "操作类型", width = 15)
@ApiModelProperty(value = "操作类型")
private String operatorType;
/**认证清单数据id*/
@Excel(name = "认证清单数据id", width = 15)
@ApiModelProperty(value = "认证清单数据id")
@@ -83,4 +88,8 @@ public class ProjectCertificationInventoryLogEO implements Serializable {
/**操作内容回显**/
@TableField(exist = false)
private String content;
/**操作类型名称**/
@TableField(exist = false)
private String operatorTypeName;
}
@@ -55,6 +55,9 @@ public enum OperatorTypeEnum {
CERTIFICATION_INVENTORY_SDT_EXPEDITING("认证清单-接口人催办","certificationInventorySdtExpediting"),
CERTIFICATION_INVENTORY_STUDIO_WITHDRAW("认证清单-studio撤回","certificationInventoryStudioWithdraw"),
CERTIFICATION_INVENTORY_STUDIO_RESET("认证清单-studio重置流程","certificationInventoryStudioReset"),
CERTIFICATION_INVENTORY_EDIT("认证清单-编辑","certificationInventoryEdit"),
CERTIFICATION_INVENTORY_ADD("认证清单-添加","certificationInventoryAdd"),
CERTIFICATION_INVENTORY_CALL("认证清单-调取","certificationInventoryCall"),
;
String name;
@@ -73,4 +73,10 @@ public interface IProjectCertificationInventoryLogEOService extends IService<Pro
* @param cut
*/
void disposeData(List<ProjectCertificationInventoryLogEO> datas, String cut);
/**
* 根据认证清单idList删除历史数据
* @param projectCertificationInventoryIdList
*/
void deleteByProjectCertificationInventoryIdList(List<String> projectCertificationInventoryIdList);
}
@@ -139,11 +139,173 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
*/
@Override
public void editById(ProjectCertificationInventoryEO projectCertificationInventoryEO) {
Date now = new Date();
List<ProjectCertificationInventoryEO> editBeforeList = new ArrayList<>();
ProjectCertificationInventoryEO editBefore = this.queryById(projectCertificationInventoryEO.getId());
editBeforeList.add(editBefore);
List<ProjectCertificationInventoryEO> editAfterList = new ArrayList<>();
editAfterList.add(projectCertificationInventoryEO);
this.setEditProjectCertificationInventoryLogEO(editBeforeList,editAfterList);
Date now = new Date();
projectCertificationInventoryEO.setUpdateTime(now);
saveOrUpdate(projectCertificationInventoryEO);
}
/**
* 对比编辑前后 认证清单信息,设置修改历史日志
* @param editBeforeList 编辑前
* @param editAfterList 编辑后
*/
public void setEditProjectCertificationInventoryLogEO(List<ProjectCertificationInventoryEO> editBeforeList,List<ProjectCertificationInventoryEO> editAfterList){
if(CollectionUtils.isNotEmpty(editBeforeList) && CollectionUtils.isNotEmpty(editAfterList)){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<ProjectCertificationInventoryLogEO> projectCertificationInventoryLogEOList = new ArrayList<>();
for (ProjectCertificationInventoryEO editAfter : editAfterList) {
ProjectCertificationInventoryEO editBeforeById = editBeforeList.stream().filter(editBefore -> {
boolean flag = false;
if (StringUtils.equals(editBefore.getId(), editAfter.getId())) {
flag = true;
}
return flag;
}).collect(Collectors.toList()).get(0);
if(!ObjectUtils.isEmpty(editBeforeById)){
StringBuilder contentCnSb = new StringBuilder();
StringBuilder contentEnSb = new StringBuilder();
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append("");
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" changes ");
boolean saveFlag = false;
if(!StringUtils.equals(editBeforeById.getSerialNumber(),editAfter.getSerialNumber())){
contentCnSb.append("\"").append("法规编号").append("\"");
contentCnSb.append("");
contentCnSb.append(editBeforeById.getSerialNumber()).append(" 修改为 ").append(editAfter.getSerialNumber()).append("");
contentEnSb.append("\"").append("Regulation No").append("\"");
contentEnSb.append(editBeforeById.getSerialNumber()).append(" to ").append(editAfter.getSerialNumber()).append("");
saveFlag = true;
}
if(!StringUtils.equals(editBeforeById.getWvtaId(),editAfter.getWvtaId())){
contentCnSb.append("\"").append("WVTA ID").append("\"");
contentCnSb.append("");
contentCnSb.append(editBeforeById.getWvtaId()).append(" 修改为 ").append(editAfter.getWvtaId()).append("");
contentEnSb.append("\"").append("WVTA ID").append("\"");
contentEnSb.append(editBeforeById.getWvtaId()).append(" to ").append(editAfter.getWvtaId()).append("");
saveFlag = true;
}
if(!StringUtils.equals(editBeforeById.getCategory(),editAfter.getCategory())){
contentCnSb.append("\"").append("类别").append("\"");
contentCnSb.append("");
contentCnSb.append(editBeforeById.getCategory()).append(" 修改为 ").append(editAfter.getCategory()).append("");
contentEnSb.append("\"").append("Category").append("\"");
contentEnSb.append(editBeforeById.getCategory()).append(" to ").append(editAfter.getCategory()).append("");
saveFlag = true;
}
if(!StringUtils.equals(editBeforeById.getInspectionItem(),editAfter.getInspectionItem())){
contentCnSb.append("\"").append("检验项目").append("\"");
contentCnSb.append("");
contentCnSb.append(editBeforeById.getInspectionItem()).append(" 修改为 ").append(editAfter.getInspectionItem()).append("");
contentEnSb.append("\"").append("Inspection Items").append("\"");
contentEnSb.append(editBeforeById.getInspectionItem()).append(" to ").append(editAfter.getInspectionItem()).append("");
saveFlag = true;
}
if(!StringUtils.equals(editBeforeById.getConfigItem(),editAfter.getConfigItem())){
contentCnSb.append("\"").append("配置项").append("\"");
contentCnSb.append("");
contentCnSb.append(editBeforeById.getConfigItem()).append(" 修改为 ").append(editAfter.getConfigItem()).append("");
contentEnSb.append("\"").append("Configuration Item").append("\"");
contentEnSb.append(editBeforeById.getConfigItem()).append(" to ").append(editAfter.getConfigItem()).append("");
saveFlag = true;
}
if(!StringUtils.equals(editBeforeById.getDutyTerritory(),editAfter.getDutyTerritory())){
contentCnSb.append("\"").append("责任领域").append("\"");
contentCnSb.append("");
contentCnSb.append(editBeforeById.getDutyTerritory()).append(" 修改为 ").append(editAfter.getDutyTerritory()).append("");
contentEnSb.append("\"").append("Responsible Field").append("\"");
contentEnSb.append(editBeforeById.getDutyTerritory()).append(" to ").append(editAfter.getDutyTerritory()).append("");
saveFlag = true;
}
if(!StringUtils.equals(editBeforeById.getDeliverableType(),editAfter.getDeliverableType())){
contentCnSb.append("\"").append("交付物类型").append("\"");
contentCnSb.append("");
contentCnSb.append(editBeforeById.getDeliverableType()).append(" 修改为 ").append(editAfter.getDeliverableType()).append("");
contentEnSb.append("\"").append("Deliverable Type").append("\"");
contentEnSb.append(editBeforeById.getDeliverableType()).append(" to ").append(editAfter.getDeliverableType()).append("");
saveFlag = true;
}
if(!StringUtils.equals(editBeforeById.getDeliverableTemplate(),editAfter.getDeliverableTemplate())){
contentCnSb.append("\"").append("交付物模板").append("\"");
contentCnSb.append("");
contentCnSb.append(editBeforeById.getDeliverableTemplate()).append(" 修改为 ").append(editAfter.getDeliverableTemplate()).append("");
contentEnSb.append("\"").append("Deliverable Template").append("\"");
contentEnSb.append(editBeforeById.getDeliverableTemplate()).append(" to ").append(editAfter.getDeliverableTemplate()).append("");
saveFlag = true;
}
if(!StringUtils.equals(editBeforeById.getSdt(),editAfter.getSdt())){
contentCnSb.append("\"").append("工程接口人").append("\"");
contentCnSb.append("");
contentCnSb.append(editBeforeById.getSdt()).append(" 修改为 ").append(editAfter.getSdt()).append("");
contentEnSb.append("\"").append("Eng. Interface").append("\"");
contentEnSb.append(editBeforeById.getSdt()).append(" to ").append(editAfter.getSdt()).append("");
saveFlag = true;
}
String editBeforeEndTime = DateUtils.formatDate(editBeforeById.getEndTime());
String editAfterEndTime = DateUtils.formatDate(editAfter.getEndTime());
if(!StringUtils.equals(editBeforeEndTime,editAfterEndTime)){
contentCnSb.append("\"").append("截止时间").append("\"");
contentCnSb.append("");
contentCnSb.append(editBeforeEndTime).append(" 修改为 ").append(editAfterEndTime).append("");
contentEnSb.append("\"").append("Due Date").append("\"");
contentEnSb.append(editBeforeEndTime).append(" to ").append(editAfterEndTime).append("");
saveFlag = true;
}
if(!StringUtils.equals(editBeforeById.getDutyPerson(),editAfter.getDutyPerson())){
contentCnSb.append("\"").append("责任人").append("\"");
contentCnSb.append("");
contentCnSb.append(editBeforeById.getDutyPerson()).append(" 修改为 ").append(editAfter.getDutyPerson()).append("");
contentEnSb.append("\"").append("Assignee").append("\"");
contentEnSb.append(editBeforeById.getDutyPerson()).append(" to ").append(editAfter.getDutyPerson()).append("");
saveFlag = true;
}
String contentCn = "";
if(StringUtils.isNotEmpty(contentCnSb.toString())){
contentCn = contentCnSb.toString().substring(0,contentCnSb.toString().length()-1);
}
String contentEn = "";
if(StringUtils.isNotEmpty(contentEnSb.toString())){
contentEn = contentEnSb.toString().substring(0,contentEnSb.toString().length()-1);
}
if(saveFlag){
ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO();
projectCertificationInventoryLogEO.setProjectCertificationInventoryId(editAfter.getId());
projectCertificationInventoryLogEO.setContentCn(contentCn);
projectCertificationInventoryLogEO.setContentEn(contentEn);
projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_EDIT.getValue());
projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO);
}
}
}
if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){
this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList);
}
}
}
/**
* 通过id删除
*
@@ -157,6 +319,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
QueryWrapper<ProcessInfoDetailEO> detailRemoveWrap = new QueryWrapper<>();
detailRemoveWrap.lambda().eq(ProcessInfoDetailEO::getProjectLawsInventoryId,id);
this.processInfoDetailEOService.remove(detailRemoveWrap);
this.projectCertificationInventoryLogEOService.deleteByProjectCertificationInventoryIdList(Arrays.asList(id.split(",")));
}
/**
@@ -176,6 +340,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
detailRemoveWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId,ids);
detailRemoveWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId,list.get(0).getProjectLibraryId());
this.processInfoDetailEOService.remove(detailRemoveWrap);
this.projectCertificationInventoryLogEOService.deleteByProjectCertificationInventoryIdList(ids);
}
/**
@@ -245,6 +411,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
projectCertificationInventoryLogEO.setProjectCertificationInventoryId(certificationInventoryEO.getId());
projectCertificationInventoryLogEO.setContentCn(contentCnSb.toString());
projectCertificationInventoryLogEO.setContentEn(contentEnSb.toString());
projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_ADD.getValue());
projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO);
}
this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList);
@@ -1844,6 +2011,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
List<AuthDummyInventoryInfoEO> authDummyInventoryInfoEOList = this.authDummyInventoryInfoEOService.list(authDummyInfoQueryWrap);
if(CollectionUtils.isNotEmpty(authDummyInventoryInfoEOList)){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList = new ArrayList<>();
for (AuthDummyInventoryInfoEO authDummyInventoryInfoEO : authDummyInventoryInfoEOList) {
ProjectCertificationInventoryEO projectCertificationInventoryEOTemp = new ProjectCertificationInventoryEO();
@@ -1852,9 +2021,39 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
projectCertificationInventoryEOTemp.setId(UUID.randomUUID().toString().replace("-", ""));
projectCertificationInventoryEOTemp.setProjectLibraryId(projectLibraryId);
projectCertificationInventoryEOTemp.setFlowStatus(CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue());
projectCertificationInventoryEOTemp.setCreateTime(new Date());
projectCertificationInventoryEOTemp.setCreateBy(currentUser.getUsername());
projectCertificationInventoryEOTemp.setSysOrgCode(currentUser.getOrgCode());
projectCertificationInventoryEOTemp.setUpdateTime(null);
projectCertificationInventoryEOTemp.setUpdateBy(null);
projectCertificationInventoryEOList.add(projectCertificationInventoryEOTemp);
}
this.saveBatch(projectCertificationInventoryEOList);
List<ProjectCertificationInventoryLogEO> projectCertificationInventoryLogEOList = new ArrayList<>();
for (ProjectCertificationInventoryEO certificationInventoryEO : projectCertificationInventoryEOList) {
StringBuilder contentCnSb = new StringBuilder();
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" 添加了 ");
contentCnSb.append("\"").append(certificationInventoryEO.getCategory()).append("\"").append(" ");
contentCnSb.append("\"").append(certificationInventoryEO.getInspectionItem()).append("\"").append(" ");
contentCnSb.append("\"").append(certificationInventoryEO.getConfigItem()).append("\"").append(" ");
contentCnSb.append("\"").append(certificationInventoryEO.getSerialNumber()).append("\"").append(" ");
StringBuilder contentEnSb = new StringBuilder();
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" added ");
contentEnSb.append("\"").append(certificationInventoryEO.getCategory()).append("\"").append(" ");
contentEnSb.append("\"").append(certificationInventoryEO.getInspectionItem()).append("\"").append(" ");
contentEnSb.append("\"").append(certificationInventoryEO.getConfigItem()).append("\"").append(" ");
contentEnSb.append("\"").append(certificationInventoryEO.getSerialNumber()).append("\"");
ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO();
projectCertificationInventoryLogEO.setProjectCertificationInventoryId(certificationInventoryEO.getId());
projectCertificationInventoryLogEO.setContentCn(contentCnSb.toString());
projectCertificationInventoryLogEO.setContentEn(contentEnSb.toString());
projectCertificationInventoryLogEO.setOperatorType(OperatorTypeEnum.CERTIFICATION_INVENTORY_CALL.getValue());
projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO);
}
this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList);
}
return Result.OK("调取成功!");
@@ -115,4 +115,11 @@ public class ProjectCertificationInventoryLogEOServiceImpl extends ServiceImpl<P
}
}
}
@Override
public void deleteByProjectCertificationInventoryIdList(List<String> projectCertificationInventoryIdList) {
QueryWrapper<ProjectCertificationInventoryLogEO> removeWrap = new QueryWrapper<>();
removeWrap.lambda().in(ProjectCertificationInventoryLogEO::getProjectCertificationInventoryId,projectCertificationInventoryIdList);
this.remove(removeWrap);
}
}