Browse Source

style:[资源库管理]

master
HanLong 2 months ago
parent
commit
17af9debe9
28 changed files with 202 additions and 150 deletions
  1. +1
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java
  2. +4
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspDto.java
  3. +4
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspFfjlListDto.java
  4. +1
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspListDto.java
  5. +4
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/sj/SjListDto.java
  6. +1
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspBjForm.java
  7. +1
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspForm.java
  8. +1
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspRkjlForm.java
  9. +1
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspSearchListForm.java
  10. +1
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjBjForm.java
  11. +1
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSearchListForm.java
  12. +4
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSubpackageForm.java
  13. +1
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyCellSearchForm.java
  14. +1
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodForm.java
  15. +1
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodReadForm.java
  16. +4
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java
  17. +1
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomForm.java
  18. +1
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomHistorySearchForm.java
  19. +1
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomSearchForm.java
  20. +5
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/GspFfjlMapper.java
  21. +10
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/GspMapper.java
  22. +4
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IBacteriaService.java
  23. +4
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ICellService.java
  24. +2
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IGspFfjlJcgjService.java
  25. +34
    -24
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GspServiceImpl.java
  26. +105
    -90
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java
  27. +4
    -26
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/StudyMethodFileUtil.java
  28. +0
    -8
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/GspPdf.java

+ 1
- 1
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java View File

@ -301,4 +301,4 @@ public class PublicController extends BaseController {
List<Yq> list = yqService.queryList(form);
return success(list);
}
}
}

+ 4
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspDto.java View File

@ -2,6 +2,10 @@ package com.hxhq.business.dto.gsp;
import com.hxhq.business.domain.Gsp;
/**
* 供试品详情
* @author HanLong
*/
public class GspDto extends Gsp {
/** 发放目的名称 */

+ 4
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspFfjlListDto.java View File

@ -2,6 +2,10 @@ package com.hxhq.business.dto.gsp;
import com.hxhq.business.domain.GspFfjl;
/**
* 供试品发放记录详情
* @author HanLong
*/
public class GspFfjlListDto extends GspFfjl {
/** 发放目的名称 */

+ 1
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/GspListDto.java View File

@ -9,6 +9,7 @@ import java.util.Date;
/**
* 供试品列表
* @author HanLong
*/
public class GspListDto {

+ 4
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/sj/SjListDto.java View File

@ -2,6 +2,10 @@ package com.hxhq.business.dto.sj;
import com.hxhq.business.domain.Sj;
/**
* 试剂列表
* @author HanLong
*/
public class SjListDto extends Sj {
/** 所属部门名称 */

+ 1
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspBjForm.java View File

@ -9,6 +9,7 @@ import java.util.Date;
/**
* 供试品编辑
* @author HanLong
*/
public class GspBjForm {

+ 1
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspForm.java View File

@ -9,6 +9,7 @@ import java.util.Date;
/**
* 供试品编辑
* @author HanLong
*/
public class GspForm {

+ 1
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspRkjlForm.java View File

@ -7,6 +7,7 @@ import java.util.Date;
/**
* 供试品入库记录
* @author HanLong
*/
public class GspRkjlForm {

+ 1
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspSearchListForm.java View File

@ -9,6 +9,7 @@ import java.util.Date;
/**
* 供试品列表
* @author HanLong
*/
public class GspSearchListForm {

+ 1
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjBjForm.java View File

@ -6,6 +6,7 @@ import java.util.Date;
/**
* 试剂编辑
* @author HanLong
*/
public class SjBjForm {

+ 1
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSearchListForm.java View File

@ -2,6 +2,7 @@ package com.hxhq.business.form.sj;
/**
* 试剂列表搜索参数
* @author HanLong
*/
public class SjSearchListForm {

+ 4
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSubpackageForm.java View File

@ -2,6 +2,10 @@ package com.hxhq.business.form.sj;
import java.util.List;
/**
* 试剂分装参数
* @author HanLong
*/
public class SjSubpackageForm {
/** 试验id */

+ 1
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyCellSearchForm.java View File

@ -2,6 +2,7 @@ package com.hxhq.business.form.study;
/**
* 试验物资搜索列表
* @author HanLong
*/
public class StudyCellSearchForm {

+ 1
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodForm.java View File

@ -5,6 +5,7 @@ import javax.validation.constraints.NotNull;
/**
* 试验-试验方法对象
* @author HanLong
*/
public class StudyMethodForm {

+ 1
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodReadForm.java View File

@ -5,6 +5,7 @@ import javax.validation.constraints.NotNull;
/**
* 试验-试验方法阅读对象
* @author HanLong
*/
public class StudyMethodReadForm {

+ 4
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java View File

@ -1,5 +1,9 @@
package com.hxhq.business.form.study;
/**
* 试验方法搜索参数
* @author HanLong
*/
public class StudyMethodSearchForm {
private Long studyId;

+ 1
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomForm.java View File

@ -4,6 +4,7 @@ import javax.validation.constraints.NotEmpty;
/**
* 饲养间
* @author HanLong
*/
public class StudyRoomForm {

+ 1
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomHistorySearchForm.java View File

@ -2,6 +2,7 @@ package com.hxhq.business.form.study;
/**
* 饲养间更换笼具记录列表搜索参数
* @author HanLong
*/
public class StudyRoomHistorySearchForm {

+ 1
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyRoomSearchForm.java View File

@ -2,6 +2,7 @@ package com.hxhq.business.form.study;
/**
* 饲养间列表搜索参数
* @author HanLong
*/
public class StudyRoomSearchForm {

+ 5
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/GspFfjlMapper.java View File

@ -26,5 +26,10 @@ public interface GspFfjlMapper extends BaseMapper
*/
List<GspFfjlListDto> queryList(@Param("ew") Wrapper<GspFfjl> queryWrapper);
/**
* 供试品发放记录详情
* @param id 供试品发放记录id
* @return
*/
GspFfjlListDto queryInfo(Long id);
}

+ 10
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/GspMapper.java View File

@ -20,7 +20,17 @@ import java.util.List;
public interface GspMapper extends BaseMapper<Gsp>
{
/**
* 试验物资列表
* @param queryWrapper
* @return
*/
List<GspListDto> queryStudyList(@Param("ew") Wrapper<Gsp> queryWrapper);
/**
* 供试品详情
* @param id
* @return
*/
GspDto queryInfo(Long id);
}

+ 4
- 1
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IBacteriaService.java View File

@ -22,6 +22,9 @@ public interface IBacteriaService extends IService
*/
List<Bacteria> queryStudyList(StudyCellSearchForm form);
/** 处置 */
/**
* 处置
* @param form 处置表单
*/
void cz(CzForm form);
}

+ 4
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ICellService.java View File

@ -22,5 +22,9 @@ public interface ICellService extends IService
*/
public List<Cell> queryStudyList(StudyCellSearchForm form);
/**
* 处置
* @param form 处置表单
*/
public void cz(CzForm form);
}

+ 2
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IGspFfjlJcgjService.java View File

@ -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);

+ 34
- 24
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GspServiceImpl.java View File

@ -427,9 +427,7 @@ public class GspServiceImpl extends ServiceImpl implements IGspS
ffr2 = sysUserService.selectUserById(form.getFfr2Id());
sysUserService.checkPassword(ffr2, form.getFfr2mm(), true);
}
List<Long> gspIdList = form.getList().stream().map(GspPlffItem::getId).collect(Collectors.toList());
QueryWrapper<Gsp> 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<String, String> 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<String, String> 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<GspPlffItem> 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<String, String> 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<String, String> 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<Gsp> gspList = new ArrayList<>();
Map<Long, Gsp> map = new HashMap<>();
Map<Long, Gsp> map = new HashMap<>(form.getList().size());
for (GspPlczItemForm itemForm : form.getList()) {
if (itemForm.getId() == null || itemForm.getId() < 0) {
throw new SecurityException("参数id不正确");

+ 105
- 90
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java View File

@ -252,7 +252,7 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi
sysUserService.checkPassword(qmr, form.getQmrmm(), false);
List<Sj> sjList = new ArrayList<>();
Map<Long, Sj> map = new HashMap<>();
Map<Long, Sj> 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<String, Sj> sjMap = new HashMap<>();
List<Sj> sjList = new ArrayList<>();
LinkedList<SjJcgj> jcgjList = new LinkedList<>();
LinkedList<SjTz> tzList = new LinkedList<>();
if (StringUtils.isNotEmpty(resource) && !StringUtils.equals("[]", resource)) {
String empty = "[]";
if (StringUtils.isNotEmpty(resource) && !StringUtils.equals(empty, resource)) {
List<StudyFormFillResource> studyFormFillResourceList = JSONUtil.toList(resource, StudyFormFillResource.class);
List<StudyFormFillResource> 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<String, String> jcnrMap = new LinkedHashMap<>();
jcnrMap.put("使用量", syl + studyFormFillResource.getSyldw());
Map<String, String> 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<StudyFormFillCc> studyFormFillCcList = JSONUtil.toList(cclist, StudyFormFillCc.class);
for (StudyFormFillCc studyFormFillCc : studyFormFillCcList) {
List<String> list = new ArrayList<>();
for (String bh : studyFormFillCc.getList()) {
Sj sj = sjMap.get(bh);
if (sj != null) {
list.add(bh);
// 稽查轨迹
LinkedHashMap<String, String> 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<String, String> jcnrEnMap = new LinkedHashMap<>();
jcnrEnMap.put("Storage Location", studyFormFillCc.getCcwz());
jcnrEnMap.put("Storage Condition", studyFormFillCc.getCctj());
private void syl(StudyFormFillResource studyFormFillResource, Sj sj, List<SjJcgj> jcgjList, List<SjTz> 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<String, String> 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<String, String> jcnrEnMap = new LinkedHashMap<>();
jcnrEnMap.put("Usage Amount", syl + studyFormFillResource.getSyldw());
// 处置库存全变为0
String czlist = studyFormFill.getCzlist();
if (StringUtils.isNotEmpty(czlist) && !StringUtils.equals("[]", czlist)) {
List<StudyFormFillCz> studyFormFillCzList = JSONUtil.toList(czlist, StudyFormFillCz.class);
for (StudyFormFillCz studyFormFillCz : studyFormFillCzList) {
List<String> list = new ArrayList<>();
for (String bh : studyFormFillCz.getList()) {
Sj sj = sjMap.get(bh);
if (sj != null) {
list.add(bh);
// 稽查轨迹
LinkedHashMap<String, String> 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<String, String> 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<String, Sj> sjMap, List<SjJcgj> jcgjList, List<SjTz> tzList, SysUser qmr) {
String empty = "[]";
String cclist = studyFormFill.getCclist();
if (StringUtils.isNotEmpty(cclist) && !StringUtils.equals(empty, cclist)) {
List<StudyFormFillCc> studyFormFillCcList = JSONUtil.toList(cclist, StudyFormFillCc.class);
for (StudyFormFillCc studyFormFillCc : studyFormFillCcList) {
List<String> list = new ArrayList<>();
for (String bh : studyFormFillCc.getList()) {
Sj sj = sjMap.get(bh);
if (sj != null) {
list.add(bh);
// 稽查轨迹
LinkedHashMap<String, String> jcnrMap = new LinkedHashMap<>();
jcnrMap.put("存储位置", studyFormFillCc.getCcwz());
jcnrMap.put("存储条件", studyFormFillCc.getCctj());
LinkedHashMap<String, String> 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<String, Sj> sjMap, List<SjJcgj> jcgjList, List<SjTz> tzList, SysUser qmr) {
String empty = "[]";
// 处置库存全变为0
String czlist = studyFormFill.getCzlist();
if (StringUtils.isNotEmpty(czlist) && !StringUtils.equals(empty, czlist)) {
List<StudyFormFillCz> studyFormFillCzList = JSONUtil.toList(czlist, StudyFormFillCz.class);
for (StudyFormFillCz studyFormFillCz : studyFormFillCzList) {
List<String> list = new ArrayList<>();
for (String bh : studyFormFillCz.getList()) {
Sj sj = sjMap.get(bh);
if (sj != null) {
list.add(bh);
// 稽查轨迹
LinkedHashMap<String, String> jcnrMap = new LinkedHashMap<>();
jcnrMap.put("处置方式", studyFormFillCz.getCzfs());
jcnrMap.put("处置量", sj.getKc() + sj.getKcdw());
LinkedHashMap<String, String> 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");
}
}
}
}

+ 4
- 26
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/StudyMethodFileUtil.java View File

@ -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. 初始化DocumentiText 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;

+ 0
- 8
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/GspPdf.java View File

@ -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<String, String> 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);

Loading…
Cancel
Save