From b4a762ab61f09525953849b8eb29a7081e5b8551 Mon Sep 17 00:00:00 2001 From: memorylkf <312904636@qq.com> Date: Sat, 3 Jan 2026 10:00:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20[=E8=AF=95=E9=AA=8C=E7=AE=A1=E7=90=86]?= =?UTF-8?q?=20=E8=B5=8B=E5=80=BC=E8=AF=95=E9=AA=8C=E7=9A=84=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E6=95=B0=E9=87=8F=20fix:=20[=E7=A8=BD=E6=9F=A5?= =?UTF-8?q?=E8=BD=A8=E8=BF=B9]=20=E5=AF=B9=E8=B1=A1=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=8F=98=E5=8C=96=E6=94=AF=E6=8C=81null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hxhq/business/controller/StudyController.java | 50 ++++++++++++++++++---- .../java/com/hxhq/business/mapper/StudyMapper.java | 7 +++ .../com/hxhq/business/service/IStudyService.java | 7 +++ .../business/service/impl/StudyServiceImpl.java | 20 +++++++++ .../com/hxhq/business/utils/ObjectCompareUtil.java | 10 ++--- .../main/resources/mapper/business/StudyMapper.xml | 11 +++++ 6 files changed, 92 insertions(+), 13 deletions(-) diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java index 4b7c4e9..9239580 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java @@ -1,7 +1,9 @@ package com.hxhq.business.controller; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; import com.alibaba.fastjson2.JSONObject; import com.hxhq.business.domain.MjyJcgj; @@ -58,9 +60,19 @@ public class StudyController extends BaseController * @return */ private List initFormCount(List list){ - for(StudyListDto l : list){ - l.setFormCount(0); - l.setFormFinishCount(0); + if(list.size()>0){ + List countList = studyService.queryFormCountList(list.stream().map(o->o.getId()).collect(Collectors.toList())); + for(StudyListDto l : list){ + List matchList = countList.stream().filter(o->o.getId().equals(l.getId())).collect(Collectors.toList()); + if(matchList.size()>0){ + l.setFormCount(matchList.get(0).getFormCount()); + l.setFormFinishCount(matchList.get(0).getFormFinishCount()); + }else{ + l.setFormCount(0); + l.setFormFinishCount(0); + } + + } } return list; } @@ -68,6 +80,7 @@ public class StudyController extends BaseController /** * 获取试验详细信息 */ + @RequiresPermissions({"business:study:add", "business:study:edit", "business:study:detail"}) @GetMapping(value = "/info") public AjaxResult getInfo(Long id) { @@ -76,12 +89,19 @@ public class StudyController extends BaseController return AjaxResult.error("信息不存在"); } StudyListDto info = JSONObject.parseObject(JSONObject.toJSONString(study),StudyListDto.class); - info.setFormCount(0); + List idList = new ArrayList<>(); + idList.add(info.getId()); + List countList = studyService.queryFormCountList(idList); + if(countList.size()>0){ + info.setFormCount(countList.get(0).getFormCount()); + }else{ + info.setFormCount(0); + } return AjaxResult.success(info); } /** - * 新增试验信息 + * 新增/编辑试验信息 */ @RequiresPermissions({"business:study:add", "business:study:edit"}) @PostMapping("/save") @@ -110,6 +130,12 @@ public class StudyController extends BaseController return AjaxResult.success(); } + /** + * 稽查轨迹列表 + * @param form + * @return + */ + @RequiresPermissions({"business:study:detail"}) @GetMapping("/jcgjList") public TableDataInfo jcgjList(StudyJcgj form) { @@ -138,7 +164,9 @@ public class StudyController extends BaseController } /** - * 删除试验信息 + * 归档 + * @param form + * @return */ @RequiresPermissions({"business:study:gd"}) @PostMapping("/gd") @@ -157,7 +185,9 @@ public class StudyController extends BaseController } /** - * 删除试验信息 + * 解锁 + * @param form + * @return */ @RequiresPermissions({"business:study:js"}) @PostMapping("/js") @@ -176,7 +206,9 @@ public class StudyController extends BaseController } /** - * 删除试验信息 + * 解档 + * @param form + * @return */ @RequiresPermissions({"business:study:jd"}) @PostMapping("/jd") @@ -196,6 +228,8 @@ public class StudyController extends BaseController /** * 借阅 + * @param form + * @return */ @RequiresPermissions({"business:study:jy"}) @PostMapping("/jy") diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMapper.java index 84b8dae..b3dda58 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMapper.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMapper.java @@ -22,4 +22,11 @@ public interface StudyMapper extends BaseMapper * @return */ List queryList(@Param("ew") Wrapper queryWrapper); + + /** + * 获取表单数量 + * @param idList + * @return + */ + List queryFormCountList(@Param("idList") List idList); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java index dc9f9a7..de75072 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java @@ -25,6 +25,13 @@ public interface IStudyService extends IService public List queryList(StudySearchForm form); /** + * 获取表单数量 + * @param idList + * @return + */ + List queryFormCountList(List idList); + + /** * 保存 * @param form */ diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java index 0b3e399..0829834 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java @@ -80,6 +80,14 @@ public class StudyServiceImpl extends ServiceImpl implements } @Override + public List queryFormCountList(List idList) { + if(idList==null || idList.size()<1){ + return new ArrayList<>(); + } + return baseMapper.queryFormCountList(idList); + } + + @Override @Transactional(rollbackFor = Exception.class) public void saveInfo(StudySaveForm form) { Study study = form.getStudy(); @@ -107,6 +115,7 @@ public class StudyServiceImpl extends ServiceImpl implements throw new ServiceException("当前状态不允许修改"); } + //修改字段的稽查轨迹 List jcgjList = new ArrayList<>(); List fieldChanges = ObjectCompareUtil.compareObjects(old, study); if (fieldChanges.size() > 0) { @@ -127,6 +136,17 @@ public class StudyServiceImpl extends ServiceImpl implements } studyJcgjService.saveBatch(jcgjList); + //修改试验负责人的稽查轨迹 + if(!old.getLeaderName().equals(study.getLeaderName())){ + Map formData = new LinkedHashMap<>(); + formData.put("新增人员", study.getLeaderName()); + formData.put("删除人员", old.getLeaderName()); + if(study.getStatus().equals(StudyStatusEnum.cg.getValue())){ + studyJcgjService.saveInfo(study.getId(), JcgjlxEnum.ry, JcmcysEnum.blue,"人员变更", JctUtil.formatStr(formData), null,null,null); + }else{ + studyJcgjService.saveInfo(study.getId(), JcgjlxEnum.ry, JcmcysEnum.blue,"人员变更", JctUtil.formatStr(formData), SecurityUtils.getUserId(),SecurityUtils.getNickName(),sign.getRemark()); + } + } if(study.getStatus().equals(StudyStatusEnum.cg.getValue())){ Map formData = new LinkedHashMap<>(); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/ObjectCompareUtil.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/ObjectCompareUtil.java index e23c380..ffc55f8 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/ObjectCompareUtil.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/ObjectCompareUtil.java @@ -30,9 +30,9 @@ public class ObjectCompareUtil { public static List compareObjects(Object oldObj, Object newObj) { List changes = new ArrayList<>(); - if (oldObj == null || newObj == null) { - return changes; - } +// if (oldObj == null || newObj == null) { +// return changes; +// } // 获取所有字段 Field[] fields = oldObj.getClass().getDeclaredFields(); @@ -82,7 +82,7 @@ public class ObjectCompareUtil { } } - if (StringUtils.isNoneBlank(oldValueStr) && StringUtils.isNoneBlank(newValueStr)) { +// if (StringUtils.isNoneBlank(oldValueStr) && StringUtils.isNoneBlank(newValueStr)) { // 对比字段值 if (!Objects.equals(oldValue, newValue)) { FieldChange change = new FieldChange(); @@ -93,7 +93,7 @@ public class ObjectCompareUtil { change.setFieldType(field.getType().getSimpleName()); changes.add(change); } - } +// } } catch (Exception ex) { // 忽略没有的字段 diff --git a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMapper.xml b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMapper.xml index d78674e..2f19002 100644 --- a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMapper.xml +++ b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMapper.xml @@ -11,4 +11,15 @@ + + \ No newline at end of file