diff --git a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/controller/OrgApplyInfoController.java b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/controller/OrgApplyInfoController.java index fdad108..2671158 100644 --- a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/controller/OrgApplyInfoController.java +++ b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/controller/OrgApplyInfoController.java @@ -82,9 +82,9 @@ public class OrgApplyInfoController extends JeecgController> hisList(OrgApplyInfo orgApplyInfo, - @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, - HttpServletRequest req) { + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { // 自定义查询规则 Map customeRuleMap = new HashMap<>(); // 自定义多选的查询规则为:LIKE_WITH_OR @@ -96,6 +96,7 @@ public class OrgApplyInfoController extends JeecgController c.like("com_name", value).or().like("org_leader", value).or().like("org_leader_phone", value)); } + queryWrapper.in("status", "2,3".split(",")); IPage pageList = orgApplyInfoService.page(page, queryWrapper); return Result.OK(pageList); } @@ -126,7 +127,7 @@ public class OrgApplyInfoController extends JeecgController applyAudit(@RequestBody OrgAllInfoApiEntity dto) { OrgApplyInfo orgApplyInfo = new OrgApplyInfo(); - BeanUtils.copyProperties(dto,orgApplyInfo); + BeanUtils.copyProperties(dto, orgApplyInfo); orgApplyInfoService.applyAudit(orgApplyInfo); return Result.OK("审核完成!"); } @@ -142,7 +143,7 @@ public class OrgApplyInfoController extends JeecgController upInfoAudit(@RequestBody OrgAllInfoApiEntity dto) { OrgApplyInfo orgApplyInfo = new OrgApplyInfo(); - BeanUtils.copyProperties(dto,orgApplyInfo); + BeanUtils.copyProperties(dto, orgApplyInfo); orgApplyInfoService.upInfoAudit(orgApplyInfo); return Result.OK("审核完成!"); } @@ -257,6 +258,12 @@ public class OrgApplyInfoController extends JeecgController>> getHisModifyInfo(@RequestBody OrgApplyInfo orgApplyInfo) { + return Result.OK(orgApplyInfoService.getHisModifyInfo(orgApplyInfo)); + } + /** * 获取各机构详细信息 * diff --git a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/IOrgApplyInfoService.java b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/IOrgApplyInfoService.java index 346497f..8460244 100644 --- a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/IOrgApplyInfoService.java +++ b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/IOrgApplyInfoService.java @@ -20,6 +20,8 @@ public interface IOrgApplyInfoService extends IService { List> getModifyInfo(OrgApplyInfo orgApplyInfo); + List> getHisModifyInfo(OrgApplyInfo orgApplyInfo); + void applyAudit(OrgApplyInfo orgApplyInfo); void saveCg(OrgAllInfoApiEntity orgApplyInfo); diff --git a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/impl/OrgApplyInfoServiceImpl.java b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/impl/OrgApplyInfoServiceImpl.java index 7026383..dcf310c 100644 --- a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/impl/OrgApplyInfoServiceImpl.java +++ b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/impl/OrgApplyInfoServiceImpl.java @@ -80,7 +80,7 @@ public class OrgApplyInfoServiceImpl extends ServiceImpl> getHisModifyInfo(OrgApplyInfo hisData) { + // 1. 修改后的数据 + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("pk_id", hisData.getPkId()); + qw.eq("iz_history", "Y"); + qw.eq("status", "2"); + qw.lt("audit_time", hisData.getAuditTime()); + qw.orderByDesc("update_time"); + List list = baseMapper.selectList(qw); + OrgApplyInfo beforeData = list.get(0);// 修改前使用的数据 + + + // 2. 准备结果列表 + List> result = new ArrayList<>(); + + // 3. 获取所有字段 + Field[] fields = OrgApplyInfo.class.getDeclaredFields(); + + // 4. 遍历每个字段进行比较 + for (Field field : fields) { + try { + // 跳过序列化ID和不需要的字段 + if (field.getName().equals("serialVersionUID") || + field.isAnnotationPresent(TableField.class) && + !field.getAnnotation(TableField.class).exist()) { + continue; + } + + // 设置可访问以获取私有字段值 + field.setAccessible(true); + + // 创建结果map + Map fieldMap = new HashMap<>(); + + // 获取字段名和值 + String fieldName = field.getName(); + Object beforeValue = field.get(beforeData); + Object hisValue = field.get(hisData); + + // 处理特殊类型的值 + if (field.getType() == Date.class) { + beforeValue = beforeValue != null ? new SimpleDateFormat("yyyy-MM-dd").format((Date) beforeValue) : null; + hisValue = hisValue != null ? new SimpleDateFormat("yyyy-MM-dd").format((Date) hisValue) : null; + } + + // 填充结果map + fieldMap.put("d1", fieldName); // 字段名 + fieldMap.put("d2", beforeValue); // 修改前使用的值 + fieldMap.put("d3", hisValue); // 当次历史值 + fieldMap.put("d4", Objects.equals(hisValue, beforeValue) ? "相同" : "不同"); // 比较结果 + + result.add(fieldMap); + + } catch (IllegalAccessException e) { + // 忽略无法访问的字段 + continue; + } + } + + return result; + } + @Override public void applyAudit(OrgApplyInfo orgApplyInfo) { LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();