diff --git a/src/main/java/digital/laboratory/platform/entrustment/controller/EntrustmentController.java b/src/main/java/digital/laboratory/platform/entrustment/controller/EntrustmentController.java index c58834f..f3b230a 100644 --- a/src/main/java/digital/laboratory/platform/entrustment/controller/EntrustmentController.java +++ b/src/main/java/digital/laboratory/platform/entrustment/controller/EntrustmentController.java @@ -2364,4 +2364,12 @@ public class EntrustmentController { entst.setEntrustRequirement(entrustment.getEntrustRequirement()); return entrustmentService.updateById(entst) ? R.ok("修改成功") : R.failed("修改失败"); } + + @ApiOperation("根据委托时间去修改一些时间类型的字段信息,例如 submit_time、check_claim_time、check_time、approve_claim_time、approve_time、" + + "deliver_confirm_time、accept_claim_time、accept_time、create_time以及process_info字段中的time类型的数据") + @PutMapping("/alertTimeFiledInfoByEntrustDate") + public R alertTimeFiledInfoByEntrustDate(@RequestBody Entrustment entrustment){ + boolean success = entrustmentService.alertTimeFiledInfoByEntrustDate(entrustment); + return success ? R.ok("修改成功") : R.failed("修改失败"); + } } diff --git a/src/main/java/digital/laboratory/platform/entrustment/service/EntrustmentService.java b/src/main/java/digital/laboratory/platform/entrustment/service/EntrustmentService.java index cb8c5b1..48d34e8 100644 --- a/src/main/java/digital/laboratory/platform/entrustment/service/EntrustmentService.java +++ b/src/main/java/digital/laboratory/platform/entrustment/service/EntrustmentService.java @@ -50,55 +50,6 @@ public interface EntrustmentService extends IService { IPage getEntrustmentVOPage(IPage page, QueryWrapper qw); EntrustmentVO getEntrustmentVOById(String id); - /** - * 查询任务 - * @param userId - * @param group - * @param processInstanceId - * @param businessKey - * @return - */ - //List taskQuery(String userId, String group, String processInstanceId, String businessKey); - - /** - * 获取任务列表 - * 查询条件可以是 userId, groupId, processInstanceId, busincessKey - */ - //List taskList(String entrustmentId, String userId); - - /** - * 认领任务 - * 只有 Assignee 为空才能认领, unclaim 反认领可以置 Assignee 为空 - * @param entrustmentId - * @return - */ - //HashMap taskClaim(String entrustmentId); - - /** - * 反认领任务 - * @param entrustmentId - * @return - */ - //HashMap taskUnclaim(String entrustmentId); - - /** - * 委派任务 - * 把任务指定给某个用户, 与 claim 不同之处于无论之前 assignee 是否为空都可以委派。 - * 可以在某个用户长期不作为的情况下重新委派给其他人 - * @param entrustmentId - * @param userId - * @return - */ - //HashMap taskAssigneeSet(String entrustmentId, String userId); - - /** - * 提交任务 - * @param entrustmentId 委托ID - * @param opCode 操作码: 1=通过, -1=拒绝(驳回), 2...=其他路径 - */ - //HashMap taskApply(String entrustmentId, Integer opCode); - - /** * 取指定环节可用的用户列表 * 当流程进行到某个环节的时候, 需要某个用户对这个环节进行处理(通过或不通过)。 @@ -123,10 +74,8 @@ public interface EntrustmentService extends IService { List taskAvailableUserList_Approve(); List taskAvailableUserList_Confirm(String clientOrgId); List taskAvailableUserList_Accept(); -// List taskAvailableUserList(String entrustmentId); public long countByCaseId(String caseId); void Entrustment2Word(EntrustmentVO ev) throws IOException; -// void Entrustment2Word(EntrustmentVO ev, InputStream tempStream, OutputStream) throws IOException; //初始化送检受理系统数据 void initCaseSendAccept(); @@ -241,4 +190,12 @@ public interface EntrustmentService extends IService { IPage getEntrustmentAndMaterial(Page page, Integer status,String keywords); boolean isMaterialPhoto(String entrustmentId); + + /** + * 根据委托时间去修改一些时间类型的字段信息,例如 submit_time、check_claim_time、check_time、approve_claim_time、approve_time、" + * deliver_confirm_time、accept_claim_time、accept_time、create_time以及process_info字段中的time类型的数据 + * @param entrustment + * @return + */ + boolean alertTimeFiledInfoByEntrustDate(Entrustment entrustment); } diff --git a/src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustmentServiceImpl.java b/src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustmentServiceImpl.java index a1d49d7..d54f3a4 100644 --- a/src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustmentServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustmentServiceImpl.java @@ -23,6 +23,7 @@ import com.deepoove.poi.data.Pictures; import com.deepoove.poi.plugin.table.MultipleRowTableRenderPolicy; import digital.laboratory.platform.common.core.constant.CommonConstants; import digital.laboratory.platform.common.core.constant.OSSDirectoryConstants; +import digital.laboratory.platform.common.core.exception.ValidateCodeException; import digital.laboratory.platform.common.core.util.ClassUtils; import digital.laboratory.platform.common.core.util.R; import digital.laboratory.platform.common.feign.RemoteGenerateWordService; @@ -75,6 +76,7 @@ import java.math.BigDecimal; import java.security.Principal; import java.time.LocalDate; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; @@ -211,7 +213,7 @@ public class EntrustmentServiceImpl extends ServiceImpl materialList) { int anCount = getCountForAnyRet(materialList, "A").size(); int reCount = getCountForAnyRet(materialList, "R").size(); - String ret = ""; + String ret; if (anCount > 0 & reCount > 0) { ret = "将检材分装为分析样、留存样"; } else if (anCount > 0) { @@ -652,7 +654,6 @@ public class EntrustmentServiceImpl extends ServiceImpl { EntrustmentIdentificationMaterial materialObj = v.get(0); - String typeName = ""; + String typeName; if (materialObj.getTypeName().equals("inVitro")) { typeName = "常规毒品"; } else if (materialObj.getTypeName().equals("inVivo")) { @@ -808,9 +809,9 @@ public class EntrustmentServiceImpl extends ServiceImpl drugLites) { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < drugLites.size(); i++) { - DrugLite drugLite = (DrugLite) JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(drugLites.get(i))), DrugLite.class); + StringBuilder sb = new StringBuilder(); + for (DrugLite lite : drugLites) { + DrugLite drugLite = (DrugLite) JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(lite)), DrugLite.class); sb.append(drugLite.getName()); } return sb.toString(); @@ -838,7 +839,6 @@ public class EntrustmentServiceImpl extends ServiceImpl pis = entrustment.getProcessInfo(); -// if (pis == null) { -// pis = new ArrayList(); -// } -// if (opCode == 1) { -// UpdateInfo pi = new UpdateInfo(dlpUser.getId(), -// dlpUser.getName(), -// dlpUser.getOrgId(), -// dlpUser.getOrgName(), -// "已审批", -// opCode, entrustment.getStatus(), true); -// pis.add(pi); -// } else { -// UpdateInfo pi = new UpdateInfo(dlpUser.getId(), -// dlpUser.getName(), -// dlpUser.getOrgId(), -// dlpUser.getOrgName(), -// "审批不通过", -// opCode, entrustment.getStatus(), false, entrust.getApproveComments()); -// pis.add(pi); -// } -// entrustment.setProcessInfo(pis); - this.updateById(entrustment); // 从数据库表中取出保存的委托对象, 后续的操作我们以此为准 @@ -1945,23 +1898,9 @@ public class EntrustmentServiceImpl extends ServiceImpl updateWrapper = getEntrustDeliverUpdateWrapper(entrustment); + + if (!this.update(null, updateWrapper)) { + throw new RuntimeException("保存委托信息失败"); + } + + // 从数据库表中取出保存的委托对象, 后续的操作我们以此为准 + entrustment = this.getById(entrust.getId()); + if (entrustment == null) { + throw new RuntimeException(String.format("没有找到 id 为 %s 的委托", entrust.getId())); + } + return entrustment; + } + + /** + * 设置送检信息 + * @param entrustment + * @return + */ + private static UpdateWrapper getEntrustDeliverUpdateWrapper(Entrustment entrustment) { UpdateWrapper updateWrapper = new UpdateWrapper(); updateWrapper.eq("id", entrustment.getId()); // 查询条件是 id 相等 @@ -1997,18 +1956,7 @@ public class EntrustmentServiceImpl extends ServiceImpl updateWrapper = new UpdateWrapper(); updateWrapper.eq("id", entrustment.getId()); // 查询条件是 id 相等 - // updateWrapper.set("deliverer1_user_id", entrustment.getDeliverer1UserId()); -// updateWrapper.set("deliverer1_name", entrustment.getDeliverer1Name()); -// updateWrapper.set("deliverer1_position", entrustment.getDeliverer1Position()); -// updateWrapper.set("deliverer1_cert", entrustment.getDeliverer1Cert()); -// updateWrapper.set("deliverer1_id", entrustment.getDeliverer1Id()); -// updateWrapper.set("deliverer1_phone", entrustment.getDeliverer1Phone()); -// -// // updateWrapper.set("deliverer2_user_id", entrustment.getDeliverer2UserId()); -// updateWrapper.set("deliverer2_name", entrustment.getDeliverer2Name()); -// updateWrapper.set("deliverer2_position", entrustment.getDeliverer2Position()); -// updateWrapper.set("deliverer2_cert", entrustment.getDeliverer2Cert()); -// updateWrapper.set("deliverer2_id", entrustment.getDeliverer2Id()); -// updateWrapper.set("deliverer2_phone", entrustment.getDeliverer2Phone()); updateWrapper.set("deliver_time", entrustment.getDeliverTime()); updateWrapper.set("deliver_submitter", entrustment.getDeliverSubmitter()); @@ -2303,15 +2189,6 @@ public class EntrustmentServiceImpl extends ServiceImpl integers = new ArrayList<>(); @@ -3446,26 +3323,14 @@ public class EntrustmentServiceImpl extends ServiceImpl processInfoList = entrust.getProcessInfo(); + processInfoList.forEach(process -> + process.setProcessTime( + LocalDateTime.parse(process.getProcessTime(), formatter) + .withYear(year).withMonth(monthValue).withDayOfMonth(dayValue) + .format(formatter) + )); + return this.update(Wrappers.lambdaUpdate() + .eq(Entrustment::getId, entrust.getId()) + .set(Entrustment::getSubmitTime, entrust.getSubmitTime().withYear(year).withMonth(monthValue).withDayOfMonth(dayValue)) + .set(Entrustment::getCheckClaimTime, entrust.getCheckClaimTime().withYear(year).withMonth(monthValue).withDayOfMonth(dayValue)) + .set(Entrustment::getCheckTime, entrust.getCheckTime().withYear(year).withMonth(monthValue).withDayOfMonth(dayValue)) + .set(Entrustment::getApproveClaimTime, entrust.getApproveClaimTime().withYear(year).withMonth(monthValue).withDayOfMonth(dayValue)) + .set(Entrustment::getApproveTime, entrust.getApproveTime().withYear(year).withMonth(monthValue).withDayOfMonth(dayValue)) + .set(Entrustment::getDeliverConfirmTime, entrust.getDeliverConfirmTime().withYear(year).withMonth(monthValue).withDayOfMonth(dayValue)) + .set(Entrustment::getAcceptTime, entrust.getAcceptTime().withYear(year).withMonth(monthValue).withDayOfMonth(dayValue)) + .set(Entrustment::getCreateTime, entrust.getCreateTime().withYear(year).withMonth(monthValue).withDayOfMonth(dayValue)) + .set(Entrustment::getProcessInfo, processInfoList)); + } + + + private Deliverer getDeliverer2(Entrustment entrust, DLPUser dlpUser) { + Deliverer deliverer2 = new Deliverer(); + deliverer2.setOwnerUserId(dlpUser.getId()); + deliverer2.setName(entrust.getDeliverer2Name()); + deliverer2.setPosition(entrust.getDeliverer2Position()); + deliverer2.setCert(entrust.getDeliverer2Cert()); + deliverer2.setIdnum(entrust.getDeliverer2Id()); + deliverer2.setPhone(entrust.getDeliverer2Phone()); + return deliverer2; + } + + private Deliverer getDeliverer1(Entrustment entrust, DLPUser dlpUser) { + Deliverer deliverer1 = new Deliverer(); + deliverer1.setOwnerUserId(dlpUser.getId()); + deliverer1.setName(entrust.getDeliverer1Name()); + deliverer1.setPosition(entrust.getDeliverer1Position()); + deliverer1.setCert(entrust.getDeliverer1Cert()); + deliverer1.setIdnum(entrust.getDeliverer1Id()); + deliverer1.setPhone(entrust.getDeliverer1Phone()); + return deliverer1; + } + + private EntrustmentIdentificationMaterial getEntrustmentIdentificationMaterial() { + EntrustmentIdentificationMaterial entrustmentIdentificationMaterial = new EntrustmentIdentificationMaterial(); + entrustmentIdentificationMaterial.setAcceptNo(""); + entrustmentIdentificationMaterial.setOrderNo(null); + entrustmentIdentificationMaterial.setTypeName(""); + entrustmentIdentificationMaterial.setFormName(""); + entrustmentIdentificationMaterial.setFundName(""); + entrustmentIdentificationMaterial.setAcceptTime(null); + return entrustmentIdentificationMaterial; + } }