Commit ecc8c696 by lijingjing

添加部分提示消息;

parent 1ce7dc74
...@@ -106,4 +106,5 @@ public interface IEntrustSampleItemService extends IBaseService<EntrustSampleIte ...@@ -106,4 +106,5 @@ public interface IEntrustSampleItemService extends IBaseService<EntrustSampleIte
boolean revokeDeletedItems(Long[] sampleIds); boolean revokeDeletedItems(Long[] sampleIds);
List<EntrustSampleItem> getListByEntrustId(Long entrustId);
} }
...@@ -1318,6 +1318,14 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI ...@@ -1318,6 +1318,14 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
return baseMapper.updateForRevokeDeletedItems(sampleIds); return baseMapper.updateForRevokeDeletedItems(sampleIds);
} }
@Override
public List<EntrustSampleItem> getListByEntrustId(Long entrustId) {
if (null == entrustId) {
return null;
}
return list(Condition.create().exists("select 1 from entrust_sample s where s.deleted = 0 and s.id = entrust_sample_item.entrust_sample_id and s.entrust_id = " + entrustId));
}
/** /**
* 处理 原铝等标准为 * 处理 原铝等标准为
*/ */
......
...@@ -16,6 +16,7 @@ import com.patzn.cloud.feign.base.client.SysUserClient; ...@@ -16,6 +16,7 @@ import com.patzn.cloud.feign.base.client.SysUserClient;
import com.patzn.cloud.feign.lims.hmhj.client.LmsChemicalCategoryClient; import com.patzn.cloud.feign.lims.hmhj.client.LmsChemicalCategoryClient;
import com.patzn.cloud.oss.starter.OssClient; import com.patzn.cloud.oss.starter.OssClient;
import com.patzn.cloud.oss.starter.OssFileResult; import com.patzn.cloud.oss.starter.OssFileResult;
import com.patzn.cloud.service.BaseEntity;
import com.patzn.cloud.service.base.entity.SysOrg; import com.patzn.cloud.service.base.entity.SysOrg;
import com.patzn.cloud.service.base.entity.SysUser; import com.patzn.cloud.service.base.entity.SysUser;
import com.patzn.cloud.service.hmhj.dto.EntrustDTO; import com.patzn.cloud.service.hmhj.dto.EntrustDTO;
...@@ -26,10 +27,10 @@ import com.patzn.cloud.service.hmhj.vo.EntrustSampleItemVO; ...@@ -26,10 +27,10 @@ import com.patzn.cloud.service.hmhj.vo.EntrustSampleItemVO;
import com.patzn.cloud.service.hmhj.vo.EntrustSampleVO; import com.patzn.cloud.service.hmhj.vo.EntrustSampleVO;
import com.patzn.cloud.service.hmhj.vo.EntrustVO; import com.patzn.cloud.service.hmhj.vo.EntrustVO;
import com.patzn.cloud.service.lims.chemical.entity.LmsChemicalCategory; import com.patzn.cloud.service.lims.chemical.entity.LmsChemicalCategory;
import com.patzn.cloud.service.lims.hmhj.common.consts.HmConst;
import com.patzn.cloud.service.lims.common.consts.Symbol; import com.patzn.cloud.service.lims.common.consts.Symbol;
import com.patzn.cloud.service.lims.common.service.ILmsMsgService; import com.patzn.cloud.service.lims.common.service.ILmsMsgService;
import com.patzn.cloud.service.lims.hmhj.common.EntrustFlowUtils; import com.patzn.cloud.service.lims.hmhj.common.EntrustFlowUtils;
import com.patzn.cloud.service.lims.hmhj.common.consts.HmConst;
import com.patzn.cloud.service.lims.hmhj.mapper.EntrustMapper; import com.patzn.cloud.service.lims.hmhj.mapper.EntrustMapper;
import com.patzn.cloud.service.lims.hmhj.service.*; import com.patzn.cloud.service.lims.hmhj.service.*;
import com.patzn.poibox.xwpf.XWPFTemplate; import com.patzn.poibox.xwpf.XWPFTemplate;
...@@ -141,7 +142,6 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -141,7 +142,6 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
public boolean isExistSampleCode(EntrustSample sample) { public boolean isExistSampleCode(EntrustSample sample) {
String category = sample.getCategory(); String category = sample.getCategory();
String sampleName = sample.getName();
RestAssert.fail(StringUtils.isBlank(category), "样品类型为空"); RestAssert.fail(StringUtils.isBlank(category), "样品类型为空");
LmsChemicalCategory chemicalCategory = lmsChemicalCategoryClient.getTopCategory(category).getData(); LmsChemicalCategory chemicalCategory = lmsChemicalCategoryClient.getTopCategory(category).getData();
RestAssert.fail(null == chemicalCategory, "样品(物资)类型为空"); RestAssert.fail(null == chemicalCategory, "样品(物资)类型为空");
...@@ -169,7 +169,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -169,7 +169,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
int codeTypeNo = 0; int codeTypeNo = 0;
List<SysOrg> orgList = sysOrgClient.getListByUserId(account.getUserId()).getData(); List<SysOrg> orgList = sysOrgClient.getListByUserId(account.getUserId()).getData();
// 具体是哪一期 // 具体是哪一期
String phase = orgList.stream().filter(t -> t.getName().contains("二期")).count() > 0 ? "Z" : "F"; String phase = orgList.stream().anyMatch(t -> t.getName().contains("二期")) ? "Z" : "F";
// 默认样品初始编号 // 默认样品初始编号
CodeTypeEnum codeType = null; CodeTypeEnum codeType = null;
switch (parentCategory) { switch (parentCategory) {
...@@ -199,7 +199,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -199,7 +199,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
break; break;
} }
String sampleCode = null; String sampleCode;
String replaceStr = "XX", inspectNo = "", secondCode = "", thirdCode = ""; String replaceStr = "XX", inspectNo = "", secondCode = "", thirdCode = "";
// == // ==
if (HmConst.EXIST_CODE_MATERIALS.equals(parentCategory)) { if (HmConst.EXIST_CODE_MATERIALS.equals(parentCategory)) {
...@@ -239,7 +239,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -239,7 +239,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
LocalTime zero = LocalTime.parse("00:00:00"); LocalTime zero = LocalTime.parse("00:00:00");
LocalTime eight = LocalTime.parse("08:00:00"); LocalTime eight = LocalTime.parse("08:00:00");
LocalTime sixth = LocalTime.parse("16:00:00"); LocalTime sixth = LocalTime.parse("16:00:00");
String clazz = ""; String clazz;
if (now.isAfter(zero) && now.isBefore(eight)) { if (now.isAfter(zero) && now.isBefore(eight)) {
clazz = "E"; clazz = "E";
} else if (now.isAfter(eight) && now.isBefore(sixth)) { } else if (now.isAfter(eight) && now.isBefore(sixth)) {
...@@ -290,9 +290,8 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -290,9 +290,8 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
/** /**
* 样品编号处理 * 样品编号处理
* @param sample
*/ */
private void handleSampleCode(EntrustSample sample){ private void handleSampleCode(EntrustSample sample) {
String sampleCode = sample.getCode(); String sampleCode = sample.getCode();
if (isExistSampleCode(sample) && StringUtils.isBlank(sampleCode)) { if (isExistSampleCode(sample) && StringUtils.isBlank(sampleCode)) {
throw new PatznException("样品编号为空"); throw new PatznException("样品编号为空");
...@@ -311,7 +310,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -311,7 +310,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
RestAssert.fail(StringUtils.isBlank(dto.getClient()), "委托单位不能为空!"); RestAssert.fail(StringUtils.isBlank(dto.getClient()), "委托单位不能为空!");
Entrust entrust = dto.convert(Entrust.class); Entrust entrust = dto.convert(Entrust.class);
List<EntrustSampleDTO> sampleDTOList = dto.getSampleDTOList(); List<EntrustSampleDTO> sampleDTOList = dto.getSampleDTOList();
RestAssert.fail(CollectionUtils.isEmpty(sampleDTOList), "委托样品为空");
if (null == entrust.getEntrustTime()) { if (null == entrust.getEntrustTime()) {
entrust.setEntrustTime(new Date()); entrust.setEntrustTime(new Date());
} }
...@@ -358,6 +357,8 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -358,6 +357,8 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
} }
//计算费用 //计算费用
entrust.setTotalFee(totalFee); entrust.setTotalFee(totalFee);
//保存样品名称
entrust.setSampleName(sampleDTOList.get(0).getName());
if (saveEntrust(entrust)) { if (saveEntrust(entrust)) {
if (CollectionUtils.isNotEmpty(saveSampleList)) { if (CollectionUtils.isNotEmpty(saveSampleList)) {
entrustSampleService.saveBatch(saveSampleList); entrustSampleService.saveBatch(saveSampleList);
...@@ -373,9 +374,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -373,9 +374,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
@Override @Override
public Boolean saveOutEntrust(EntrustDTO dto, Account account) { public Boolean saveOutEntrust(EntrustDTO dto, Account account) {
RestAssert.fail(CollectionUtils.isEmpty(dto.getSampleDTOList()), "外委样品不能为空"); RestAssert.fail(CollectionUtils.isEmpty(dto.getSampleDTOList()), "外委样品不能为空");
dto.getSampleDTOList().stream().forEach(t -> { dto.getSampleDTOList().forEach(t -> t.setCategory(HmConst.EXTERNAL_INSPECTION_MATERIALS));
t.setCategory(HmConst.EXTERNAL_INSPECTION_MATERIALS);
});
return saveEntrustDTO(dto, account); return saveEntrustDTO(dto, account);
} }
...@@ -392,7 +391,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -392,7 +391,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
entrust.setFlowStatus(EntrustFlowEnum.CHECK.getName()); entrust.setFlowStatus(EntrustFlowEnum.CHECK.getName());
if (update(entrust, Condition.create().in("id", ids))) { if (update(entrust, Condition.create().in("id", ids))) {
entrustRecordService.record(ids, EntrustStatusEnum.DRAFT.getDisplay(), EntrustStatusEnum.CHECK.getDisplay(), 0, account, "提交至委托审核"); entrustRecordService.record(ids, EntrustStatusEnum.DRAFT.getDisplay(), EntrustStatusEnum.CHECK.getDisplay(), 0, account, "提交至委托审核");
lmsMsgService.sendMsg("/hmhj/entrust_manage/entrust_review", "有委托从委托登记提交过来,请及时审核", "新的委托审核任务!", account, null); lmsMsgService.sendMsg("/hmhj/entrust_manage/entrust_review", "有委托从委托登记提交过来,请及时审核", "新的委托审核任务!", account, userInfoService.getUserIds(MessageUserEnum.GROUP_USER, null));
} }
return true; return true;
} }
...@@ -409,7 +408,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -409,7 +408,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
entrust.setProgress(EntrustStatusEnum.OUT_INPUT); entrust.setProgress(EntrustStatusEnum.OUT_INPUT);
if (update(entrust, Condition.create().in("id", ids))) { if (update(entrust, Condition.create().in("id", ids))) {
entrustRecordService.record(ids, EntrustStatusEnum.OUT_DRAFT.getDisplay(), EntrustStatusEnum.OUT_INPUT.getDisplay(), 0, account, "提交至外委数据录入"); entrustRecordService.record(ids, EntrustStatusEnum.OUT_DRAFT.getDisplay(), EntrustStatusEnum.OUT_INPUT.getDisplay(), 0, account, "提交至外委数据录入");
lmsMsgService.sendMsg("/hmhj/accept_manage/sub_input", "有外委登记提交过来,请及时填写外委数据", "新的委托外委数据录入任务!", account, null); lmsMsgService.sendMsg("/hmhj/accept_manage/sub_input", "有外委登记提交过来,请及时填写外委数据", "新的委托外委数据录入任务!", account, userInfoService.getUserIds(MessageUserEnum.GROUP_USER, null));
} }
return true; return true;
} }
...@@ -436,7 +435,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -436,7 +435,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
} }
} }
if (!hasSendMessage) { if (!hasSendMessage) {
lmsMsgService.sendMsg("/hmhj/entrust_manage/entrust_register", "有委托从委托审核驳回,请及时查看退回原因并处理", "新的委托审核退回任务!", account, null); lmsMsgService.sendMsg("/hmhj/entrust_manage/entrust_register", "有委托从委托审核驳回,请及时查看退回原因并处理", "新的委托审核退回任务!", account, userInfoService.getUserIds(MessageUserEnum.GROUP_USER, null));
} }
return true; return true;
...@@ -464,7 +463,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -464,7 +463,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
} }
} }
if (!hasSendMessage) { if (!hasSendMessage) {
lmsMsgService.sendMsg("/hmhj/sample_manage/sample_prepare", "有委托审核通过,请及时进行样品的制备", "新的样品制备任务!", account, null); lmsMsgService.sendMsg("/hmhj/sample_manage/sample_prepare", "有委托审核通过,请及时进行样品的制备", "新的样品制备任务!", account, userInfoService.getUserIds(MessageUserEnum.GROUP_USER, null));
} }
return true; return true;
} }
...@@ -493,7 +492,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -493,7 +492,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
} }
if (!hasSendMessage) { if (!hasSendMessage) {
lmsMsgService.sendMsg("/hmhj/sample_manage/sample_prepare", "有委托登记提交至样品待制备,请及时进行样品的制备", "新的样品制备任务!", account, null); lmsMsgService.sendMsg("/hmhj/sample_manage/sample_prepare", "有委托登记提交至样品待制备,请及时进行样品的制备", "新的样品制备任务!", account, userInfoService.getUserIds(MessageUserEnum.GROUP_USER, null));
} }
return true; return true;
...@@ -507,17 +506,14 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -507,17 +506,14 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
return false; return false;
} }
List<EntrustSampleDTO> sampleList = entrustDTO.getSampleDTOList(); List<EntrustSampleDTO> sampleList = entrustDTO.getSampleDTOList();
RestAssert.fail(CollectionUtils.isEmpty(sampleList), "委托样品为空");
RestAssert.fail(sampleList.stream().map(EntrustSampleDTO::getName).distinct().count() > 1, "一个委托只能下同一种样品!"); RestAssert.fail(sampleList.stream().map(EntrustSampleDTO::getName).distinct().count() > 1, "一个委托只能下同一种样品!");
if (CollectionUtils.isEmpty(sampleList)) {
// PtAssert.fail("样品不能为空");
}
for (EntrustSampleDTO sampleDTO : sampleList) { for (EntrustSampleDTO sampleDTO : sampleList) {
RestAssert.fail(StringUtils.isBlank(sampleDTO.getName()), "样品名称不能为空"); RestAssert.fail(StringUtils.isBlank(sampleDTO.getName()), "样品名称不能为空");
} }
Entrust entrust = entrustDTO.convert(Entrust.class); Entrust entrust = entrustDTO.convert(Entrust.class);
entrust.setSampleName(sampleList.get(0).getName());
if (updateById(entrust)) { if (updateById(entrust)) {
List<Long> sampleIdsList = new ArrayList<>();
List<EntrustSample> updateSampleList = new ArrayList<>(); List<EntrustSample> updateSampleList = new ArrayList<>();
List<EntrustSample> saveSampleList = new ArrayList<>(); List<EntrustSample> saveSampleList = new ArrayList<>();
...@@ -529,7 +525,6 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -529,7 +525,6 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
incNum += 10; incNum += 10;
if (null != sample.getId()) { if (null != sample.getId()) {
updateSampleList.add(sample); updateSampleList.add(sample);
sampleIdsList.add(sample.getId());
} else { } else {
sample.setEntrustId(entrust.getId()); sample.setEntrustId(entrust.getId());
handleSampleCode(sample); handleSampleCode(sample);
...@@ -584,9 +579,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -584,9 +579,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
if (CollectionUtils.isEmpty(entrustSamples)) { if (CollectionUtils.isEmpty(entrustSamples)) {
return; return;
} }
List<Long> sampleIdList = entrustSamples.stream().map(e -> { List<Long> sampleIdList = entrustSamples.stream().map(BaseEntity::getId).collect(Collectors.toList());
return e.getId();
}).collect(Collectors.toList());
List<EntrustSampleItem> itemList = entrustSampleItemService.list(Condition.create().in("entrust_sample_id", sampleIdList).isNotNull("price")); List<EntrustSampleItem> itemList = entrustSampleItemService.list(Condition.create().in("entrust_sample_id", sampleIdList).isNotNull("price"));
BigDecimal totalFee = BigDecimal.ZERO; BigDecimal totalFee = BigDecimal.ZERO;
...@@ -899,13 +892,13 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -899,13 +892,13 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
} }
EntrustFlowEnum nextFlowStatus = EntrustFlowUtils.getNextFlowStatus(flowStatus, statusPath); EntrustFlowEnum nextFlowStatus = EntrustFlowUtils.getNextFlowStatus(flowStatus, statusPath);
RestAssert.fail(null == nextFlowStatus, String.format("编号为【%s】的委托,未配置下一流程状态信息!", entrust.getCode())); RestAssert.fail(null == nextFlowStatus, String.format("编号为【%s】的委托,未配置下一流程状态信息!", entrust.getCode()));
int nextFlowValue = nextFlowStatus.getValue().intValue(); int nextFlowValue = nextFlowStatus.getValue();
EntrustStatusEnum nextStatus = EntrustFlowUtils.getStatus(nextFlowStatus); EntrustStatusEnum nextStatus = EntrustFlowUtils.getStatus(nextFlowStatus);
RestAssert.fail(null == nextStatus, String.format("编号为【%s】的委托,未配置下一流程状态信息!", entrust.getCode())); RestAssert.fail(null == nextStatus, String.format("编号为【%s】的委托,未配置下一流程状态信息!", entrust.getCode()));
// 当前委托状态 // 当前委托状态
EntrustStatusEnum status = entrust.getStatus(); EntrustStatusEnum status = entrust.getStatus();
// 是否特殊需求 // 是否特殊需求
boolean isSpecAsk = null == entrust.getSpecialAsk() ? false : ("是".equals(entrust.getSpecialAsk())); boolean isSpecAsk = null != entrust.getSpecialAsk() && ("是".equals(entrust.getSpecialAsk()));
// 是否需要修改样品和检测项目(由于报告处只会修改部分样品) // 是否需要修改样品和检测项目(由于报告处只会修改部分样品)
boolean isUpdateSampleInfo = nextFlowValue < 9 || nextFlowValue > 12; boolean isUpdateSampleInfo = nextFlowValue < 9 || nextFlowValue > 12;
// 若为特殊需求,必须要走评审 // 若为特殊需求,必须要走评审
...@@ -914,6 +907,8 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -914,6 +907,8 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
uri = "/hmhj/entrust_manage/entrust_review"; uri = "/hmhj/entrust_manage/entrust_review";
} else if (nextStatus == EntrustStatusEnum.MAKE) { } else if (nextStatus == EntrustStatusEnum.MAKE) {
uri = "/hmhj/sample_manage/sample_prepare"; uri = "/hmhj/sample_manage/sample_prepare";
} else if (nextStatus == EntrustStatusEnum.TEST) {
uri = "/hmhj/accept_manage/input";
} else if (nextStatus == EntrustStatusEnum.OUT_INPUT) { } else if (nextStatus == EntrustStatusEnum.OUT_INPUT) {
uri = "/hmhj/accept_manage/sub_input"; uri = "/hmhj/accept_manage/sub_input";
} else if (nextStatus == EntrustStatusEnum.QUALITY_CHECK) { } else if (nextStatus == EntrustStatusEnum.QUALITY_CHECK) {
...@@ -935,7 +930,17 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -935,7 +930,17 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
content = String.format("有%s提交过来,请及时%s", EntrustFlowEnum.convert(flowStatus).getDisplay(), nextFlowStatus.getDisplay()); content = String.format("有%s提交过来,请及时%s", EntrustFlowEnum.convert(flowStatus).getDisplay(), nextFlowStatus.getDisplay());
entrustRecordService.record(new Long[]{entrust.getId()}, status.getDisplay(), nextStatus.getDisplay(), 0, account, remark); entrustRecordService.record(new Long[]{entrust.getId()}, status.getDisplay(), nextStatus.getDisplay(), 0, account, remark);
if (StringUtils.isNotBlank(uri)) { if (StringUtils.isNotBlank(uri)) {
lmsMsgService.sendMsg(uri, content, title, account, null); List<Long> userIds = userInfoService.getUserIds(MessageUserEnum.GROUP_USER, null);
// 若为数据录入,消息具体到检测人
if (nextFlowStatus == EntrustFlowEnum.TEST) {
List<EntrustSampleItem> sampleItems = entrustSampleItemService.getListByEntrustId(entrust.getId());
if (CollectionUtils.isEmpty(sampleItems)) {
// 为空不发消息,直接返回
return true;
}
userIds = sampleItems.stream().map(EntrustSampleItem::getTesterId).collect(Collectors.toList());
}
lmsMsgService.sendMsg(uri, content, title, account, userIds);
} }
return true; return true;
} }
...@@ -969,7 +974,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -969,7 +974,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
} else if (prevStatus == EntrustStatusEnum.CHECK) { } else if (prevStatus == EntrustStatusEnum.CHECK) {
} else if (prevStatus == EntrustStatusEnum.MAKE) { } else if (prevStatus == EntrustStatusEnum.MAKE) {
uri = "/hmhj/sample_manage/sample_prepare";
} else if (prevStatus == EntrustStatusEnum.OUT_INPUT) { } else if (prevStatus == EntrustStatusEnum.OUT_INPUT) {
} else if (prevStatus == EntrustStatusEnum.QUALITY_CHECK) { } else if (prevStatus == EntrustStatusEnum.QUALITY_CHECK) {
...@@ -988,7 +993,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -988,7 +993,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
content = String.format("有%s驳回过来,请及时%s", EntrustFlowEnum.convert(flowStatus).getDisplay(), prevFlowStatus.getDisplay()); content = String.format("有%s驳回过来,请及时%s", EntrustFlowEnum.convert(flowStatus).getDisplay(), prevFlowStatus.getDisplay());
entrustRecordService.record(new Long[]{entrust.getId()}, status.getDisplay(), prevStatus.getDisplay(), 1, account, reason); entrustRecordService.record(new Long[]{entrust.getId()}, status.getDisplay(), prevStatus.getDisplay(), 1, account, reason);
if (StringUtils.isNotBlank(uri)) { if (StringUtils.isNotBlank(uri)) {
lmsMsgService.sendMsg(uri, content, title, account, null); lmsMsgService.sendMsg(uri, content, title, account, userInfoService.getUserIds(MessageUserEnum.GROUP_USER, null));
} }
return true; return true;
} }
...@@ -1012,7 +1017,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -1012,7 +1017,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
entrust.setId(null); entrust.setId(null);
entrust.setCode(null).setStatus(EntrustStatusEnum.DRAFT).setProgress(EntrustStatusEnum.DRAFT) entrust.setCode(null).setStatus(EntrustStatusEnum.DRAFT).setProgress(EntrustStatusEnum.DRAFT)
.setFlowStatus(EntrustFlowEnum.DRAFT.getName()).setEntrustTime(new Date()).setExpectSendTime(new Date()) .setFlowStatus(EntrustFlowEnum.DRAFT.getName()).setEntrustTime(new Date()).setExpectSendTime(new Date())
.setUid(account.getUserId()).setCtime(new Date()).setLid(null).setLtime(null).setOrgId(null); .setUid(account.getUserId()).setCtime(new Date()).setLid(null).setLtime(null).setOrgId(null).setSampleName(sampleList.get(0).getName());
// 保存委托信息 // 保存委托信息
saveEntrust(entrust); saveEntrust(entrust);
entrustIdList.add(entrust.getId()); entrustIdList.add(entrust.getId());
...@@ -1079,7 +1084,6 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -1079,7 +1084,6 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
int count = super.count(Condition.create().in("id", ids).eq("status", EntrustStatusEnum.MAKE)); int count = super.count(Condition.create().in("id", ids).eq("status", EntrustStatusEnum.MAKE));
RestAssert.fail(ids.length != count, "请选择要退回至登记的委托"); RestAssert.fail(ids.length != count, "请选择要退回至登记的委托");
List<Entrust> entrustList = getBatchIds(Arrays.asList(ids)); List<Entrust> entrustList = getBatchIds(Arrays.asList(ids));
boolean hasSendMessage = false;
for (Entrust e : entrustList) { for (Entrust e : entrustList) {
e.setStatus(EntrustStatusEnum.DRAFT); e.setStatus(EntrustStatusEnum.DRAFT);
e.setProgress(EntrustStatusEnum.BACK_MAKE); e.setProgress(EntrustStatusEnum.BACK_MAKE);
...@@ -1100,7 +1104,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -1100,7 +1104,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
entrustSampleItemService.update(entrustSampleItem, Condition.create().in("entrust_sample_id", sampleIds)); entrustSampleItemService.update(entrustSampleItem, Condition.create().in("entrust_sample_id", sampleIds));
} }
} }
lmsMsgService.sendMsg("/hmhj/entrust_manage/entrust_register", "有委托从样品制备退回,请及时查看退回原因并处理", "新的样品制备退回任务!", account, null); lmsMsgService.sendMsg("/hmhj/entrust_manage/entrust_register", "有委托从样品制备退回,请及时查看退回原因并处理", "新的样品制备退回任务!", account, userInfoService.getUserIds(MessageUserEnum.GROUP_USER, null));
return true; return true;
} }
...@@ -1134,7 +1138,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -1134,7 +1138,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
// 删除委托下样品备样 // 删除委托下样品备样
entrustSampleBackupService.remove(Condition.create().eq("entrust_id", e.getId())); entrustSampleBackupService.remove(Condition.create().eq("entrust_id", e.getId()));
} }
lmsMsgService.sendMsg("/hmhj/entrust_manage/entrust_register", "有委托从样品接收退回,请及时查看退回原因并处理", "新的样品接收退回任务!", account, null); lmsMsgService.sendMsg("/hmhj/entrust_manage/entrust_register", "有委托从样品接收退回,请及时查看退回原因并处理", "新的样品接收退回任务!", account, userInfoService.getUserIds(MessageUserEnum.GROUP_USER, null));
return true; return true;
} }
...@@ -1418,6 +1422,12 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -1418,6 +1422,12 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
entrustSampleItemService.update(item, Condition.create().in("entrust_sample_id", sampleIds)); entrustSampleItemService.update(item, Condition.create().in("entrust_sample_id", sampleIds));
// 3.日志 // 3.日志
entrustRecordService.record(ids, EntrustFlowEnum.REPORT_MAKE.getDisplay(), prevFlow.getDisplay(), 1, account, reason); entrustRecordService.record(ids, EntrustFlowEnum.REPORT_MAKE.getDisplay(), prevFlow.getDisplay(), 1, account, reason);
// 4.消息
List<EntrustSampleItem> items = entrustSampleItemService.getListByEntrustId(entrust.getId());
if (CollectionUtils.isNotEmpty(items)) {
lmsMsgService.sendMsg("/hmhj/test_manage/test_input", "有委托从报告编制退回过来,请及时处理",
"新的(报告编制退回)数据录入任务!", account, items.stream().map(EntrustSampleItem::getTesterId).collect(Collectors.toList()));
}
} }
// 4.删除报告 // 4.删除报告
EntrustReport report = new EntrustReport(); EntrustReport report = new EntrustReport();
...@@ -1475,7 +1485,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -1475,7 +1485,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
updateModel.setFlowStatus(EntrustFlowEnum.CHECK.getName()); updateModel.setFlowStatus(EntrustFlowEnum.CHECK.getName());
update(updateModel, Condition.create().in("id", specialIds)); update(updateModel, Condition.create().in("id", specialIds));
entrustRecordService.record(specialIds, EntrustStatusEnum.DRAFT.getDisplay(), EntrustStatusEnum.CHECK.getDisplay(), 0, account, "提交至委托审核"); entrustRecordService.record(specialIds, EntrustStatusEnum.DRAFT.getDisplay(), EntrustStatusEnum.CHECK.getDisplay(), 0, account, "提交至委托审核");
lmsMsgService.sendMsg("/hmhj/entrust_manage/entrust_review", "有委托从委托登记提交过来,请及时审核", "新的委托审核任务!", account, null); lmsMsgService.sendMsg("/hmhj/entrust_manage/entrust_review", "有委托从委托登记提交过来,请及时审核", "新的委托审核任务!", account, userInfoService.getUserIds(MessageUserEnum.GROUP_USER, null));
} }
if (CollectionUtils.isNotEmpty(normalIds)) { if (CollectionUtils.isNotEmpty(normalIds)) {
...@@ -1488,7 +1498,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -1488,7 +1498,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
entrustSampleService.updateSampleCodeByEntrustId(entrustId, HmConst.TWO); entrustSampleService.updateSampleCodeByEntrustId(entrustId, HmConst.TWO);
}); });
entrustRecordService.record(normalIds, EntrustStatusEnum.CHECK.getDisplay(), EntrustStatusEnum.MAKE.getDisplay(), 0, account, "提交至样品待制备"); entrustRecordService.record(normalIds, EntrustStatusEnum.CHECK.getDisplay(), EntrustStatusEnum.MAKE.getDisplay(), 0, account, "提交至样品待制备");
lmsMsgService.sendMsg("/hmhj/sample_manage/sample_prepare", "有委托审核通过,请及时进行样品的制备", "新的样品制备任务!", account, null); lmsMsgService.sendMsg("/hmhj/sample_manage/sample_prepare", "有委托审核通过,请及时进行样品的制备", "新的样品制备任务!", account, userInfoService.getUserIds(MessageUserEnum.GROUP_USER, null));
} }
return true; return true;
} }
......
...@@ -11,7 +11,10 @@ import com.patzn.cloud.feign.lims.base.client.LmsUserGroupClient; ...@@ -11,7 +11,10 @@ import com.patzn.cloud.feign.lims.base.client.LmsUserGroupClient;
import com.patzn.cloud.service.base.entity.SysOrg; import com.patzn.cloud.service.base.entity.SysOrg;
import com.patzn.cloud.service.base.entity.SysUser; import com.patzn.cloud.service.base.entity.SysUser;
import com.patzn.cloud.service.hmhj.entity.Entrust; import com.patzn.cloud.service.hmhj.entity.Entrust;
import com.patzn.cloud.service.hmhj.enums.MessageUserEnum;
import com.patzn.cloud.service.lims.base.entity.LmsUserGroup; import com.patzn.cloud.service.lims.base.entity.LmsUserGroup;
import com.patzn.cloud.service.lims.base.vo.GroupUserVO;
import com.patzn.cloud.service.lims.common.consts.Symbol;
import com.patzn.cloud.service.lims.hmhj.service.IEntrustService; import com.patzn.cloud.service.lims.hmhj.service.IEntrustService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -20,6 +23,7 @@ import org.springframework.stereotype.Service; ...@@ -20,6 +23,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service @Service
public class UserInfoServiceImpl { public class UserInfoServiceImpl {
...@@ -75,6 +79,24 @@ public class UserInfoServiceImpl { ...@@ -75,6 +79,24 @@ public class UserInfoServiceImpl {
return StringUtils.join(curGroupNameList, "-"); return StringUtils.join(curGroupNameList, "-");
} }
public List<Long> getGroupUserIds(Long userId) {
// 为空默认获取当前用户所有组
Account account = LoginHelper.getAccount();
if (null == userId) {
userId = account.getUserId();
}
List<LmsUserGroup> userGroups = getGroupList(userId);
if (CollectionUtils.isEmpty(userGroups)) {
return null;
}
List<String> groupNames = userGroups.stream().map(LmsUserGroup::getName).collect(Collectors.toList());
List<GroupUserVO> groupUserList = lmsUserGroupClient.getGroupUserIdsList(account.getCompanyId()).serviceData();
String userIdStr = groupUserList.stream().filter(t ->
groupNames.contains(t.getGroupName()) && StringUtils.isNotBlank(t.getUserIds())
).map(GroupUserVO::getUserIds).collect(Collectors.joining(Symbol.COMMA));
return Stream.of(userIdStr.split(Symbol.COMMA)).map(Long::valueOf).distinct().collect(Collectors.toList());
}
public boolean isGroupLeader(Long entrustId, Account account) { public boolean isGroupLeader(Long entrustId, Account account) {
if (null == entrustId) { if (null == entrustId) {
return false; return false;
...@@ -117,4 +139,16 @@ public class UserInfoServiceImpl { ...@@ -117,4 +139,16 @@ public class UserInfoServiceImpl {
return getUserById(LoginHelper.getAccount().getUserId()); return getUserById(LoginHelper.getAccount().getUserId());
} }
public List<Long> getUserIds(MessageUserEnum messageUserEnum, Long someoneId) {
List<Long> userIdList = new ArrayList<>();
if (MessageUserEnum.CURRENT == messageUserEnum) {
userIdList.add(LoginHelper.getAccount().getUserId());
} else if (MessageUserEnum.SOMEONE == messageUserEnum) {
userIdList.add(someoneId);
} else {
userIdList.addAll(getGroupUserIds(null));
}
return userIdList;
}
} }
/** created by meazty on 2021/8/10 11:11 **/
/** created by meazty on 2021/8/10 11:11 **/
ALTER TABLE "public"."business_data"
ADD COLUMN "data_name" varchar(128) COLLATE "pg_catalog"."default";
COMMENT ON COLUMN "public"."business_data"."data_name" IS '数据名称';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment