diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java index ad43e9a..f7fa269 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java @@ -301,4 +301,4 @@ public class PublicController extends BaseController { List list = yqService.queryList(form); return success(list); } -} +} \ No newline at end of file diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspDto.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspDto.java index f6fbd76..85611f9 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspDto.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspDto.java @@ -2,6 +2,10 @@ package com.hxhq.business.dto.gsp; import com.hxhq.business.domain.Gsp; +/** + * 供试品详情 + * @author HanLong + */ public class GspDto extends Gsp { /** 发放目的名称 */ diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspFfjlListDto.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspFfjlListDto.java index 386ecb0..7ea52ec 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspFfjlListDto.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspFfjlListDto.java @@ -2,6 +2,10 @@ package com.hxhq.business.dto.gsp; import com.hxhq.business.domain.GspFfjl; +/** + * 供试品发放记录详情 + * @author HanLong + */ public class GspFfjlListDto extends GspFfjl { /** 发放目的名称 */ diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspListDto.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspListDto.java index 4698c41..3898b13 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspListDto.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspListDto.java @@ -9,6 +9,7 @@ import java.util.Date; /** * 供试品列表 + * @author HanLong */ public class GspListDto { diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/sj/SjListDto.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/sj/SjListDto.java index bd573b0..e3b43c8 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/sj/SjListDto.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/sj/SjListDto.java @@ -2,6 +2,10 @@ package com.hxhq.business.dto.sj; import com.hxhq.business.domain.Sj; +/** + * 试剂列表 + * @author HanLong + */ public class SjListDto extends Sj { /** 所属部门名称 */ diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspBjForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspBjForm.java index 3b82855..433de35 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspBjForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspBjForm.java @@ -9,6 +9,7 @@ import java.util.Date; /** * 供试品编辑 + * @author HanLong */ public class GspBjForm { diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspForm.java index 52b1529..198b0bb 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspForm.java @@ -9,6 +9,7 @@ import java.util.Date; /** * 供试品编辑 + * @author HanLong */ public class GspForm { diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspRkjlForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspRkjlForm.java index 31eac06..1dad249 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspRkjlForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspRkjlForm.java @@ -7,6 +7,7 @@ import java.util.Date; /** * 供试品入库记录 + * @author HanLong */ public class GspRkjlForm { diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspSearchListForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspSearchListForm.java index 8c87daf..de82d29 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspSearchListForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspSearchListForm.java @@ -9,6 +9,7 @@ import java.util.Date; /** * 供试品列表 + * @author HanLong */ public class GspSearchListForm { diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjBjForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjBjForm.java index d9168f3..ca10181 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjBjForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjBjForm.java @@ -6,6 +6,7 @@ import java.util.Date; /** * 试剂编辑 + * @author HanLong */ public class SjBjForm { diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSearchListForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSearchListForm.java index 703ca15..526e49f 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSearchListForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSearchListForm.java @@ -2,6 +2,7 @@ package com.hxhq.business.form.sj; /** * 试剂列表搜索参数 + * @author HanLong */ public class SjSearchListForm { diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSubpackageForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSubpackageForm.java index 9a2be83..8444899 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSubpackageForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSubpackageForm.java @@ -2,6 +2,10 @@ package com.hxhq.business.form.sj; import java.util.List; +/** + * 试剂分装参数 + * @author HanLong + */ public class SjSubpackageForm { /** 试验id */ diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyCellSearchForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyCellSearchForm.java index 5cce4af..1bce88b 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyCellSearchForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyCellSearchForm.java @@ -2,6 +2,7 @@ package com.hxhq.business.form.study; /** * 试验物资搜索列表 + * @author HanLong */ public class StudyCellSearchForm { diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodForm.java index c8edf6f..cd56544 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodForm.java @@ -5,6 +5,7 @@ import javax.validation.constraints.NotNull; /** * 试验-试验方法对象 + * @author HanLong */ public class StudyMethodForm { diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodReadForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodReadForm.java index 69d61e0..905a673 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodReadForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodReadForm.java @@ -5,6 +5,7 @@ import javax.validation.constraints.NotNull; /** * 试验-试验方法阅读对象 + * @author HanLong */ public class StudyMethodReadForm { diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java index b7bd6d5..c119dc2 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java @@ -1,5 +1,9 @@ package com.hxhq.business.form.study; +/** + * 试验方法搜索参数 + * @author HanLong + */ public class StudyMethodSearchForm { private Long studyId; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomForm.java index d866ae5..3645409 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomForm.java @@ -4,6 +4,7 @@ import javax.validation.constraints.NotEmpty; /** * 饲养间 + * @author HanLong */ public class StudyRoomForm { diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomHistorySearchForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomHistorySearchForm.java index 38a84bd..802261e 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomHistorySearchForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomHistorySearchForm.java @@ -2,6 +2,7 @@ package com.hxhq.business.form.study; /** * 饲养间更换笼具记录列表搜索参数 + * @author HanLong */ public class StudyRoomHistorySearchForm { diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomSearchForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomSearchForm.java index 071806c..3a04b17 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomSearchForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomSearchForm.java @@ -2,6 +2,7 @@ package com.hxhq.business.form.study; /** * 饲养间列表搜索参数 + * @author HanLong */ public class StudyRoomSearchForm { diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/GspFfjlMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/GspFfjlMapper.java index 96c8612..8404725 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/GspFfjlMapper.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/GspFfjlMapper.java @@ -26,5 +26,10 @@ public interface GspFfjlMapper extends BaseMapper */ List queryList(@Param("ew") Wrapper queryWrapper); + /** + * 供试品发放记录详情 + * @param id 供试品发放记录id + * @return + */ GspFfjlListDto queryInfo(Long id); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/GspMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/GspMapper.java index 747e748..6d00ebd 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/GspMapper.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/GspMapper.java @@ -20,7 +20,17 @@ import java.util.List; public interface GspMapper extends BaseMapper { + /** + * 试验物资列表 + * @param queryWrapper + * @return + */ List queryStudyList(@Param("ew") Wrapper queryWrapper); + /** + * 供试品详情 + * @param id + * @return + */ GspDto queryInfo(Long id); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IBacteriaService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IBacteriaService.java index a6d5f65..0cd9414 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IBacteriaService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IBacteriaService.java @@ -22,6 +22,9 @@ public interface IBacteriaService extends IService */ List queryStudyList(StudyCellSearchForm form); - /** 处置 */ + /** + * 处置 + * @param form 处置表单 + */ void cz(CzForm form); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ICellService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ICellService.java index 6bc7af1..993110e 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ICellService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ICellService.java @@ -22,5 +22,9 @@ public interface ICellService extends IService */ public List queryStudyList(StudyCellSearchForm form); + /** + * 处置 + * @param form 处置表单 + */ public void cz(CzForm form); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IGspFfjlJcgjService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IGspFfjlJcgjService.java index 18513bf..3d00f95 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IGspFfjlJcgjService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IGspFfjlJcgjService.java @@ -26,8 +26,10 @@ public interface IGspFfjlJcgjService extends IService * @param ffjlId 发放记录id * @param jcgjlx 稽查轨迹类型:1:流程;3:编辑 * @param jcmc 稽查名称 + * @param jcmcEn 稽查名称-英文 * @param jcmcys 稽查名称颜色:1:蓝色;3:红色;5:绿色;7:橙色 * @param jcnr 稽查内容 + * @param jcnrEn 稽查内容 - 英文 * @param qmr 稽查人 */ public void saveJcgj(Long ffjlId, Integer jcgjlx, String jcmc, String jcmcEn, Integer jcmcys, String jcnr, String jcnrEn, SysUser qmr); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GspServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GspServiceImpl.java index 2334b24..6811efc 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GspServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GspServiceImpl.java @@ -427,9 +427,7 @@ public class GspServiceImpl extends ServiceImpl implements IGspS ffr2 = sysUserService.selectUserById(form.getFfr2Id()); sysUserService.checkPassword(ffr2, form.getFfr2mm(), true); } - List gspIdList = form.getList().stream().map(GspPlffItem::getId).collect(Collectors.toList()); - QueryWrapper queryWrapper = Wrappers.query(); queryWrapper.in("id", gspIdList); queryWrapper.eq("zjzt", ZjztEnum.rk.getValue()); @@ -447,27 +445,7 @@ public class GspServiceImpl extends ServiceImpl implements IGspS if (plffItemFilter.size() > 0) { gspFfjlService.ff(gsp.getKc(),gsp.getKcdw(),plffItemFilter.get(0).getZytj(),plffItemFilter.get(0).getRemark(),plffItemFilter.get(0).getMdIds(),gsp,lqr1,lqr2,ffr1,ffr2,now); //region 稽查轨迹 - GspJcgj gspJcgj = new GspJcgj(); - gspJcgj.setGspId(gsp.getId()); - gspJcgj.setJcgjlx(JcgjlxEnum.lc.getValue()); - gspJcgj.setJcmc("领取发放"); - gspJcgj.setJcmcEn("Distribution"); - gspJcgj.setJcmcys(JcmcysEnum.green.getValue()); - Map formData = new LinkedHashMap<>(); - formData.put("出库量", gsp.getKc()+ gsp.getKcdw()); - formData.put("转移条件", plffItemFilter.get(0).getZytj()); - formData.put("目的", plffItemFilter.get(0).getMdMcs()); - formData.put("备注", plffItemFilter.get(0).getRemark()); - gspJcgj.setJcnr(JctUtil.formatStr(formData)); - Map formDataEn = new LinkedHashMap<>(); - formDataEn.put("Out Amount", gsp.getKc()+ gsp.getKcdw()); - formDataEn.put("Transfer Condition", plffItemFilter.get(0).getZytj()); - formDataEn.put("Purpose", plffItemFilter.get(0).getMdMcs()); - formDataEn.put("Comment", plffItemFilter.get(0).getRemark()); - gspJcgj.setJcnrEn(JctUtil.formatStr(formDataEn)); - gspJcgj.setQmrId(SecurityUtils.getUserId()); - gspJcgj.setQmrMc(SecurityUtils.getNickName()); - gspJcgj.setQmrMcEn(SecurityUtils.getUsername()); + GspJcgj gspJcgj = plffJcgj(plffItemFilter, gsp); gspJcgjList.add(gspJcgj); //endregion //region 台账 @@ -512,6 +490,38 @@ public class GspServiceImpl extends ServiceImpl implements IGspS this.saveOrUpdateBatch(gspList); } + /** + * 批量发放的稽查轨迹 + * @param plffItemFilter + * @param gsp + * @return + */ + private GspJcgj plffJcgj(List plffItemFilter, Gsp gsp) { + GspJcgj gspJcgj = new GspJcgj(); + gspJcgj.setGspId(gsp.getId()); + gspJcgj.setJcgjlx(JcgjlxEnum.lc.getValue()); + gspJcgj.setJcmc("领取发放"); + gspJcgj.setJcmcEn("Distribution"); + gspJcgj.setJcmcys(JcmcysEnum.green.getValue()); + Map formData = new LinkedHashMap<>(); + formData.put("出库量", gsp.getKc()+ gsp.getKcdw()); + formData.put("转移条件", plffItemFilter.get(0).getZytj()); + formData.put("目的", plffItemFilter.get(0).getMdMcs()); + formData.put("备注", plffItemFilter.get(0).getRemark()); + gspJcgj.setJcnr(JctUtil.formatStr(formData)); + Map formDataEn = new LinkedHashMap<>(); + formDataEn.put("Out Amount", gsp.getKc()+ gsp.getKcdw()); + formDataEn.put("Transfer Condition", plffItemFilter.get(0).getZytj()); + formDataEn.put("Purpose", plffItemFilter.get(0).getMdMcs()); + formDataEn.put("Comment", plffItemFilter.get(0).getRemark()); + gspJcgj.setJcnrEn(JctUtil.formatStr(formDataEn)); + gspJcgj.setQmrId(SecurityUtils.getUserId()); + gspJcgj.setQmrMc(SecurityUtils.getNickName()); + gspJcgj.setQmrMcEn(SecurityUtils.getUsername()); + return gspJcgj; + } + + @Override @Transactional(rollbackFor = Exception.class) public void xgkc(GspXgkcForm form) { @@ -792,7 +802,7 @@ public class GspServiceImpl extends ServiceImpl implements IGspS SysUser qmr = sysUserService.selectUserById(form.getQmrId()); sysUserService.checkPassword(qmr, form.getQmrmm(), false); List gspList = new ArrayList<>(); - Map map = new HashMap<>(); + Map map = new HashMap<>(form.getList().size()); for (GspPlczItemForm itemForm : form.getList()) { if (itemForm.getId() == null || itemForm.getId() < 0) { throw new SecurityException("参数id不正确"); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java index 91bc908..22e4e27 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java @@ -252,7 +252,7 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi sysUserService.checkPassword(qmr, form.getQmrmm(), false); List sjList = new ArrayList<>(); - Map map = new HashMap<>(); + Map map = new HashMap<>(form.getList().size()); for (PlczSjItemForm itemForm : form.getList()) { if (itemForm.getId() == null || itemForm.getId() < 0) { throw new SecurityException("参数id不正确"); @@ -641,18 +641,17 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi public void genResource(StudyFormFill studyFormFill, Template template) { Boolean mark = template.getProduct().equals(StudyFormFillResourceTypeEnum.sj.getValue()) ? true : false; SysUser qmr = sysUserService.selectUserById(SecurityUtils.getUserId()); - Long studyId = studyFormFill.getStudyId(); Long studyFormId = studyFormFill.getId(); Long deptId = template.getDeptId(); - // 生成/使用 String resource = studyFormFill.getResource(); Map sjMap = new HashMap<>(); List sjList = new ArrayList<>(); LinkedList jcgjList = new LinkedList<>(); LinkedList tzList = new LinkedList<>(); - if (StringUtils.isNotEmpty(resource) && !StringUtils.equals("[]", resource)) { + String empty = "[]"; + if (StringUtils.isNotEmpty(resource) && !StringUtils.equals(empty, resource)) { List studyFormFillResourceList = JSONUtil.toList(resource, StudyFormFillResource.class); List tmp= studyFormFillResourceList.stream().filter(p -> (p.getType() == null && mark) || (p.getType()!=null&&StudyFormFillResourceTypeEnum.sj.getValue()==p.getType())).collect(Collectors.toList()); // 根据编号获取需要处置的列表 @@ -720,28 +719,7 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi } } // 使用 - String syl = studyFormFillResource.getSyl(); - if (StringUtils.isNotEmpty(syl) && NumberUtils.isParsable(syl)) { - BigDecimal kc = new BigDecimal(sj.getKc()); - kc = kc.subtract(new BigDecimal(syl)); - baseMapper.updateKc(sj.getId(), kc.toString()); - - // 使用稽查轨迹 - Map jcnrMap = new LinkedHashMap<>(); - jcnrMap.put("使用量", syl + studyFormFillResource.getSyldw()); - - Map jcnrEnMap = new LinkedHashMap<>(); - jcnrEnMap.put("Usage Amount", syl + studyFormFillResource.getSyldw()); - - SjJcgj sjJcgj = sjJcgjService.genJcgj(sj.getId(), JcgjlxEnum.lc.getValue(), "使用", "Usage", - JcmcysEnum.green.getValue(), JctUtil.formatStr(jcnrMap), JctUtil.formatStr(jcnrEnMap), qmr); - jcgjList.add(sjJcgj); - - - // 台账 - SjTz sjTz = sjTzService.genTz(sj.getId(), "使用", "Usage", syl, studyFormFillResource.getKcdw(), null, qmr); - tzList.add(sjTz); - } + syl(studyFormFillResource, sj, jcgjList, tzList, qmr); sjMap.put(sj.getBh(), sj); } @@ -752,82 +730,119 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi if (sjMap.size() > 0) { // 存储 - String cclist = studyFormFill.getCclist(); - if (StringUtils.isNotEmpty(cclist) && !StringUtils.equals("[]", cclist)) { - List studyFormFillCcList = JSONUtil.toList(cclist, StudyFormFillCc.class); - for (StudyFormFillCc studyFormFillCc : studyFormFillCcList) { - List list = new ArrayList<>(); - for (String bh : studyFormFillCc.getList()) { - Sj sj = sjMap.get(bh); - if (sj != null) { - list.add(bh); - // 稽查轨迹 - LinkedHashMap jcnrMap = new LinkedHashMap<>(); - jcnrMap.put("存储位置", studyFormFillCc.getCcwz()); - jcnrMap.put("存储条件", studyFormFillCc.getCctj()); + cc(studyFormFill, sjMap, jcgjList, tzList, qmr); + // 处置,库存全变为0 + cz(studyFormFill, sjMap, jcgjList, tzList, qmr); + } + if(jcgjList.size()>0){ + sjJcgjService.saveBatch(jcgjList); + } + if(jcgjList.size()>0){ + sjTzService.saveBatch(tzList); + } + if(jcgjList.size()>0){ + studySjService.saveBatch(studyId, sjList); + } + } - LinkedHashMap jcnrEnMap = new LinkedHashMap<>(); - jcnrEnMap.put("Storage Location", studyFormFillCc.getCcwz()); - jcnrEnMap.put("Storage Condition", studyFormFillCc.getCctj()); + private void syl(StudyFormFillResource studyFormFillResource, Sj sj, List jcgjList, List tzList, SysUser qmr) { + // 使用 + String syl = studyFormFillResource.getSyl(); + if (StringUtils.isNotEmpty(syl) && NumberUtils.isParsable(syl)) { + BigDecimal kc = new BigDecimal(sj.getKc()); + kc = kc.subtract(new BigDecimal(syl)); + baseMapper.updateKc(sj.getId(), kc.toString()); - SjJcgj sjJcgj = sjJcgjService.genJcgj(sj.getId(), JcgjlxEnum.lc.getValue(), "存储", "Storage", - JcmcysEnum.green.getValue(), JctUtil.formatStr(jcnrMap), JctUtil.formatStr(jcnrEnMap), qmr); - jcgjList.add(sjJcgj); + // 使用稽查轨迹 + Map jcnrMap = new LinkedHashMap<>(); + jcnrMap.put("使用量", syl + studyFormFillResource.getSyldw()); - // 台账 - SjTz sjTz = sjTzService.genTz(sj.getId(), "存储", "Storage", sj.getKc(), sj.getKcdw(), null, qmr); - tzList.add(sjTz); - } - } - if(list.size()>0){ - baseMapper.updateCc(list, studyFormFillCc.getCctj(), studyFormFillCc.getCcwz()); - } - } - } + Map jcnrEnMap = new LinkedHashMap<>(); + jcnrEnMap.put("Usage Amount", syl + studyFormFillResource.getSyldw()); - // 处置,库存全变为0 - String czlist = studyFormFill.getCzlist(); - if (StringUtils.isNotEmpty(czlist) && !StringUtils.equals("[]", czlist)) { - List studyFormFillCzList = JSONUtil.toList(czlist, StudyFormFillCz.class); - for (StudyFormFillCz studyFormFillCz : studyFormFillCzList) { - List list = new ArrayList<>(); - for (String bh : studyFormFillCz.getList()) { - Sj sj = sjMap.get(bh); - if (sj != null) { - list.add(bh); - // 稽查轨迹 - LinkedHashMap jcnrMap = new LinkedHashMap<>(); - jcnrMap.put("处置方式", studyFormFillCz.getCzfs()); - jcnrMap.put("处置量", sj.getKc() + sj.getKcdw()); + SjJcgj sjJcgj = sjJcgjService.genJcgj(sj.getId(), JcgjlxEnum.lc.getValue(), "使用", "Usage", + JcmcysEnum.green.getValue(), JctUtil.formatStr(jcnrMap), JctUtil.formatStr(jcnrEnMap), qmr); + jcgjList.add(sjJcgj); - LinkedHashMap jcnrEnMap = new LinkedHashMap<>(); - jcnrEnMap.put("Dispose Method", studyFormFillCz.getCzfs()); - jcnrEnMap.put("Amount", sj.getKc() + sj.getKcdw()); - SjJcgj sjJcgj = sjJcgjService.genJcgj(sj.getId(), JcgjlxEnum.lc.getValue(), "处置", "Dispose", - JcmcysEnum.green.getValue(), JctUtil.formatStr(jcnrMap), JctUtil.formatStr(jcnrEnMap), qmr); - jcgjList.add(sjJcgj); + // 台账 + SjTz sjTz = sjTzService.genTz(sj.getId(), "使用", "Usage", syl, studyFormFillResource.getKcdw(), null, qmr); + tzList.add(sjTz); + } + } + private void cc(StudyFormFill studyFormFill, Map sjMap, List jcgjList, List tzList, SysUser qmr) { + String empty = "[]"; + String cclist = studyFormFill.getCclist(); + if (StringUtils.isNotEmpty(cclist) && !StringUtils.equals(empty, cclist)) { + List studyFormFillCcList = JSONUtil.toList(cclist, StudyFormFillCc.class); + for (StudyFormFillCc studyFormFillCc : studyFormFillCcList) { + List list = new ArrayList<>(); + for (String bh : studyFormFillCc.getList()) { + Sj sj = sjMap.get(bh); + if (sj != null) { + list.add(bh); + // 稽查轨迹 + LinkedHashMap jcnrMap = new LinkedHashMap<>(); + jcnrMap.put("存储位置", studyFormFillCc.getCcwz()); + jcnrMap.put("存储条件", studyFormFillCc.getCctj()); + + LinkedHashMap jcnrEnMap = new LinkedHashMap<>(); + jcnrEnMap.put("Storage Location", studyFormFillCc.getCcwz()); + jcnrEnMap.put("Storage Condition", studyFormFillCc.getCctj()); + + SjJcgj sjJcgj = sjJcgjService.genJcgj(sj.getId(), JcgjlxEnum.lc.getValue(), "存储", "Storage", + JcmcysEnum.green.getValue(), JctUtil.formatStr(jcnrMap), JctUtil.formatStr(jcnrEnMap), qmr); + jcgjList.add(sjJcgj); - // 台账 - SjTz sjTz = sjTzService.genTz(sj.getId(), "处置", "Dispose", sj.getKc(), sj.getKcdw(), null, qmr); - tzList.add(sjTz); - } - } - if(list.size()>0){ - baseMapper.updateKcBatch(list, "0"); + // 台账 + SjTz sjTz = sjTzService.genTz(sj.getId(), "存储", "Storage", sj.getKc(), sj.getKcdw(), null, qmr); + tzList.add(sjTz); } } + if(list.size()>0){ + baseMapper.updateCc(list, studyFormFillCc.getCctj(), studyFormFillCc.getCcwz()); + } } } - if(jcgjList.size()>0){ - sjJcgjService.saveBatch(jcgjList); - } - if(jcgjList.size()>0){ - sjTzService.saveBatch(tzList); - } - if(jcgjList.size()>0){ - studySjService.saveBatch(studyId, sjList); + } + + // 处置 + private void cz(StudyFormFill studyFormFill, Map sjMap, List jcgjList, List tzList, SysUser qmr) { + String empty = "[]"; + // 处置,库存全变为0 + String czlist = studyFormFill.getCzlist(); + if (StringUtils.isNotEmpty(czlist) && !StringUtils.equals(empty, czlist)) { + List studyFormFillCzList = JSONUtil.toList(czlist, StudyFormFillCz.class); + for (StudyFormFillCz studyFormFillCz : studyFormFillCzList) { + List list = new ArrayList<>(); + for (String bh : studyFormFillCz.getList()) { + Sj sj = sjMap.get(bh); + if (sj != null) { + list.add(bh); + // 稽查轨迹 + LinkedHashMap jcnrMap = new LinkedHashMap<>(); + jcnrMap.put("处置方式", studyFormFillCz.getCzfs()); + jcnrMap.put("处置量", sj.getKc() + sj.getKcdw()); + + LinkedHashMap jcnrEnMap = new LinkedHashMap<>(); + jcnrEnMap.put("Dispose Method", studyFormFillCz.getCzfs()); + jcnrEnMap.put("Amount", sj.getKc() + sj.getKcdw()); + + SjJcgj sjJcgj = sjJcgjService.genJcgj(sj.getId(), JcgjlxEnum.lc.getValue(), "处置", "Dispose", + JcmcysEnum.green.getValue(), JctUtil.formatStr(jcnrMap), JctUtil.formatStr(jcnrEnMap), qmr); + jcgjList.add(sjJcgj); + + + // 台账 + SjTz sjTz = sjTzService.genTz(sj.getId(), "处置", "Dispose", sj.getKc(), sj.getKcdw(), null, qmr); + tzList.add(sjTz); + } + } + if(list.size()>0){ + baseMapper.updateKcBatch(list, "0"); + } + } } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/StudyMethodFileUtil.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/StudyMethodFileUtil.java index ea7198e..f71b303 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/StudyMethodFileUtil.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/StudyMethodFileUtil.java @@ -19,7 +19,8 @@ import java.util.*; import java.util.List; /** - * OpenPDF工具类 - 支持保存到本地文件 + * 试验方法pdf导出 + * @author HanLong */ @Component public class StudyMethodFileUtil { @@ -86,56 +87,43 @@ public class StudyMethodFileUtil { try { // 1. 生成文件名 fileName = generateFileName(); - // 2. 确保目录存在 File dir = new File(fileDir); if (!dir.exists()) { dir.mkdirs(); } - // 3. 完整文件路径 filePath = Paths.get(fileDir, fileName).toString(); - // 创建PDF文档 设置文档边距,避免内容遮挡页眉页脚 - // 1. 读取原有PDF,获取页面尺寸(保证新文档与原文档格式一致) PdfReader srcReader = new PdfReader(srcPdf); // 取第一页尺寸作为新文档尺寸 Rectangle pageSize = srcReader.getPageSize(1); - // 2. 初始化Document(iText 5的核心高层类) document = new Document(pageSize); fos = new FileOutputStream(filePath); // 3. 关联PdfWriter,绑定Document和输出流(5.5.11必须先创建Writer再open Document) PdfWriter writer = PdfWriter.getInstance(document, fos); - // 设置页面事件,每页添加文字页眉 writer.setPageEvent(new TextHeaderEvent(headerText)); - // 4. 设置PDF属性 document.addTitle("华西海圻"); document.addAuthor("华西海圻"); document.addCreator("华西海圻"); document.addCreationDate(); - document.open(); - // 5. 复制原有PDF的所有页面到新Document中 copyOriginalPagesToDocument(document, writer, srcReader); - // 6. 设置中文字体 BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); Font headerFont = new Font(bfChinese, 12, Font.BOLD); Font contentFont = new Font(bfChinese, 10, Font.NORMAL); - // 7. 表格设置到新的一页 document.newPage(); - // 8. 创建表格 PdfPTable table = new PdfPTable(4); table.setWidthPercentage(100); table.setSpacingBefore(10); - // 9. 表头 String[] headers = {"签名人", "签名意义", "签名时间", "备注"}; for (String header : headers) { @@ -146,7 +134,6 @@ public class StudyMethodFileUtil { cell.setBorderWidth(1); table.addCell(cell); } - // 10. 表格数据 int rowNum = 0; for (StudyMethodRead studyMethodRead : list) { @@ -163,21 +150,12 @@ public class StudyMethodFileUtil { rowNum++; } document.add(table); - - log.info("生成成功:{}", filePath); } catch (Exception e) { - log.error("生成失败", e); throw new RuntimeException("生成失败: " + e.getMessage()); } finally { - if (document != null) { - document.close(); - } + if (document != null) { document.close(); } if (fos != null) { - try { - fos.close(); - } catch (IOException e) { - log.error("关闭文件流失败", e); - } + try { fos.close(); } catch (IOException e) { log.error("关闭文件流失败", e); } } } return fileName; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/GspPdf.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/GspPdf.java index b660774..212b1b4 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/GspPdf.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/GspPdf.java @@ -62,14 +62,6 @@ public class GspPdf { formData1.put(getName("有效期"), PdfExportUtil.parseDateToStr(gsp.getYxq())); formData1.put(getName("状态"), "en".equals(language) ? (GyzjJcnrUtil.getEn(ZjztEnum.getEnumByValue(gsp.getZjzt()).getText())) : ZjztEnum.getEnumByValue(gsp.getZjzt()).getText()); PdfBaseUtil.addFormTableColumns(document, formData1, 2); - // 表单信息 - /*PdfBaseUtil.addUnderlinedTitle(document, getName("表单信息"), 10, true); - Map formData3 = new LinkedHashMap<>(); - formData3.put(getName("表单所属试验"), gsp.getStudyMc()); - formData3.put(getName("所属表单"), gsp.getBdMc()); - formData3.put(getName("表单所属人"), gsp.getBdgsrMc()); - PdfBaseUtil.addFormTableColumns(document, formData3, 2); - PdfBaseUtil.addUnderlinedTitle(document, getName("给药制剂台账") , 10, true);*/ // 台账 addTz(document, tzList, lang); PdfBaseUtil.addUnderlinedTitle(document, getName("稽查轨迹") , 10, true);