Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -6,7 +6,9 @@ import digital.laboratory.platform.common.swagger.annotation.EnableDLPSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
// todo @EnableScheduling // 开启定时任务
|
||||
@EnableDLPSwagger2
|
||||
@EnableDLPFeignClients
|
||||
@EnableDiscoveryClient
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
package digital.laboratory.platform.entrustment.config;
|
||||
|
||||
import digital.laboratory.platform.entrustment.enums.EntrustEvent;
|
||||
import digital.laboratory.platform.entrustment.enums.EntrustStatusConstants;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.statemachine.config.EnumStateMachineConfigurerAdapter;
|
||||
import org.springframework.statemachine.config.builders.StateMachineStateConfigurer;
|
||||
|
||||
/**
|
||||
* @author ChenJiangBao
|
||||
* @version 1.0
|
||||
* @description: 委托状态机配置类
|
||||
* @date 2025/3/14 11:47
|
||||
*/
|
||||
@Configuration
|
||||
public class EntrustStateMachineConfig extends EnumStateMachineConfigurerAdapter<EntrustStatusConstants, EntrustEvent> {
|
||||
|
||||
@Value("${dlp.entrustment.isApprovalRequired}")
|
||||
private boolean isApprovalRequired; // 动态标志判断是否需要审批
|
||||
|
||||
@Override
|
||||
public void configure(StateMachineStateConfigurer<EntrustStatusConstants, EntrustEvent> states) throws Exception {
|
||||
states.withStates()
|
||||
.initial(EntrustStatusConstants.ENTRUST_STATUS_CREATED)
|
||||
.state(EntrustStatusConstants.ENTRUST_STATUS_WAITING_CHECK_CLAIM)
|
||||
.state(EntrustStatusConstants.ENTRUST_STATUS_WAITING_CHECK)
|
||||
.state(EntrustStatusConstants.ENTRUST_STATUS_WAITING_CONFIRM)
|
||||
.state(EntrustStatusConstants.ENTRUST_STATUS_WAITING_DELIVER)
|
||||
.state(EntrustStatusConstants.ENTRUST_STATUS_WAITING_ACCEPT)
|
||||
.state(EntrustStatusConstants.ENTRUST_STATUS_ACCEPTED)
|
||||
.state(EntrustStatusConstants.ENTRUST_STATUS_TEST_FINISH)
|
||||
.state(EntrustStatusConstants.ENTRUST_STATUS_COMPLETED)
|
||||
.state(EntrustStatusConstants.ENTRUST_STATUS_TERMINATED)
|
||||
.state(EntrustStatusConstants.ENTRUST_STATUS_ABORTED)
|
||||
.end(EntrustStatusConstants.ENTRUST_STATUS_COMPLETED);
|
||||
}
|
||||
}
|
||||
//package digital.laboratory.platform.entrustment.config;
|
||||
//
|
||||
//import digital.laboratory.platform.entrustment.enums.EntrustEvent;
|
||||
//import digital.laboratory.platform.entrustment.enums.EntrustStatusConstants;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.statemachine.config.EnumStateMachineConfigurerAdapter;
|
||||
//import org.springframework.statemachine.config.builders.StateMachineStateConfigurer;
|
||||
//
|
||||
///**
|
||||
// * @author ChenJiangBao
|
||||
// * @version 1.0
|
||||
// * @description: 委托状态机配置类
|
||||
// * @date 2025/3/14 11:47
|
||||
// */
|
||||
//@Configuration
|
||||
//public class EntrustStateMachineConfig extends EnumStateMachineConfigurerAdapter<EntrustStatusConstants, EntrustEvent> {
|
||||
//
|
||||
// @Value("${dlp.entrustment.isApprovalRequired}")
|
||||
// private boolean isApprovalRequired; // 动态标志判断是否需要审批
|
||||
//
|
||||
// @Override
|
||||
// public void configure(StateMachineStateConfigurer<EntrustStatusConstants, EntrustEvent> states) throws Exception {
|
||||
// states.withStates()
|
||||
// .initial(EntrustStatusConstants.ENTRUST_STATUS_CREATED)
|
||||
// .state(EntrustStatusConstants.ENTRUST_STATUS_WAITING_CHECK_CLAIM)
|
||||
// .state(EntrustStatusConstants.ENTRUST_STATUS_WAITING_CHECK)
|
||||
// .state(EntrustStatusConstants.ENTRUST_STATUS_WAITING_CONFIRM)
|
||||
// .state(EntrustStatusConstants.ENTRUST_STATUS_WAITING_DELIVER)
|
||||
// .state(EntrustStatusConstants.ENTRUST_STATUS_WAITING_ACCEPT)
|
||||
// .state(EntrustStatusConstants.ENTRUST_STATUS_ACCEPTED)
|
||||
// .state(EntrustStatusConstants.ENTRUST_STATUS_TEST_FINISH)
|
||||
// .state(EntrustStatusConstants.ENTRUST_STATUS_COMPLETED)
|
||||
// .state(EntrustStatusConstants.ENTRUST_STATUS_TERMINATED)
|
||||
// .state(EntrustStatusConstants.ENTRUST_STATUS_ABORTED)
|
||||
// .end(EntrustStatusConstants.ENTRUST_STATUS_COMPLETED);
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -747,7 +747,12 @@ public class Entrustment extends BaseEntity {
|
||||
@ApiModelProperty(value="是否退回(0:未退回,-1:已退回)")
|
||||
private Integer returnOrNot;
|
||||
|
||||
|
||||
@ApiModelProperty("标记该委托是否已经上传了检材照片, 默认false")
|
||||
private Boolean materialImageFlag = false;
|
||||
|
||||
@ApiModelProperty("是否推送数据到LabsCare的标识,[EntrustLetter:true 代表推送委托书成功 | ItemConfirmLetter:true 代表推送鉴定事项确认书成功]" +
|
||||
"如果这个字段为空则表示失败,如果两个推送都成功,以英文逗号分隔")
|
||||
private String pushFlag;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,31 +1,16 @@
|
||||
package digital.laboratory.platform.entrustment.listener;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import digital.laboratory.platform.entrustment.config.GlobalThreadPool;
|
||||
import digital.laboratory.platform.entrustment.config.properties.ApiPathProperties;
|
||||
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
|
||||
import digital.laboratory.platform.entrustment.event.PushDataToLabsCareEvent;
|
||||
import digital.laboratory.platform.entrustment.service.CommonFeignService;
|
||||
import digital.laboratory.platform.entrustment.service.EntrustmentIdentificationMaterialService;
|
||||
import digital.laboratory.platform.entrustment.service.EntrustmentService;
|
||||
import digital.laboratory.platform.entrustment.service.PushDataToLabsCareService;
|
||||
import digital.laboratory.platform.entrustment.vo.EntrustmentVO;
|
||||
import digital.laboratory.platform.entrustment.vo.MaterialListForBookVo;
|
||||
import digital.laboratory.platform.othersys.utils.HttpsUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestClientException;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 监听有关推送数据到LabsCare 平台的事件, 采用异步
|
||||
@@ -34,22 +19,11 @@ import java.util.stream.Collectors;
|
||||
@Component
|
||||
public class PushDataToLabsCareEventListener implements ApplicationListener<PushDataToLabsCareEvent> {
|
||||
|
||||
@Resource
|
||||
private ApiPathProperties apiPathProperties;
|
||||
|
||||
@Resource
|
||||
private EntrustmentService entrustmentService;
|
||||
|
||||
@Resource
|
||||
private CommonFeignService commonFeignService;
|
||||
|
||||
@Resource
|
||||
private EntrustmentIdentificationMaterialService entrustmentIdentificationMaterialService;
|
||||
|
||||
private final static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
|
||||
|
||||
// "#NULL#" 作为空数据的占位符, 对于系统中没有的信息以占位符代替
|
||||
private final static String NULL_PLACEHOLDER = "#NULL#";
|
||||
private PushDataToLabsCareService pushDataToLabsCareService;
|
||||
|
||||
/**
|
||||
* 处理委托数据推送事件
|
||||
@@ -73,15 +47,14 @@ public class PushDataToLabsCareEventListener implements ApplicationListener<Push
|
||||
switch (event.getPushType()) {
|
||||
case 1: // 推送委托书数据
|
||||
try {
|
||||
Map<String, Object> dataMap = entrustmentService.buildEntrustLetterDataMap(entrustVO);
|
||||
pushEntrustLetterData(entrustVO, dataMap);
|
||||
} catch (IllegalAccessException e) {
|
||||
pushDataToLabsCareService.pushEntrustLetterData(entrustVO);
|
||||
} catch (Exception e) {
|
||||
log.error("委托编号 {} 的鉴定委托书数据推送失败!", entrustVO.getEntrustmentNo(), e);
|
||||
}
|
||||
break;
|
||||
case 2: // 推送鉴定事项确认书数据
|
||||
try {
|
||||
pushItemConfirmLetterData(entrustVO);
|
||||
pushDataToLabsCareService.pushItemConfirmLetterData(entrustVO);
|
||||
} catch (Exception e) {
|
||||
log.error("受理编号 {} 的鉴定事项确认书数据推送失败!", entrustVO.getAcceptNo(), e);
|
||||
}
|
||||
@@ -96,167 +69,4 @@ public class PushDataToLabsCareEventListener implements ApplicationListener<Push
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送鉴定事项确认书数据
|
||||
*
|
||||
* @param entrustVO 委托vo
|
||||
*/
|
||||
private void pushItemConfirmLetterData(EntrustmentVO entrustVO) {
|
||||
JSONObject jsonObject = buildItemConfirmLetterJsonPayload(entrustVO);
|
||||
|
||||
try {
|
||||
ResponseEntity<String> response = exchangeRemoteApi(jsonObject, apiPathProperties.getConfirmLetter());
|
||||
|
||||
if (response.getStatusCode().is2xxSuccessful() && response.getBody().contains("\"status\":200")) {
|
||||
log.info("推送鉴定事项确认书数据成功, 受理编号: {}, 响应: {}", entrustVO.getAcceptNo(), response.getBody());
|
||||
} else {
|
||||
log.warn("推送鉴定事项确认书数据失败, 受理编号: {}, 状态码: {}, 响应: {}",
|
||||
entrustVO.getAcceptNo(), response.getStatusCode(), response.getBody());
|
||||
}
|
||||
} catch (RestClientException e) {
|
||||
log.error("推送鉴定事项确认书数据到 LabsCare 失败, 受理编号: {}", entrustVO.getAcceptNo(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建鉴定事项确认书的JSON负载
|
||||
*
|
||||
* @param entrustVO 委托单VO对象,包含构建JSON负载所需的数据
|
||||
* @return 包含鉴定事项确认书数据的JSONObject对象
|
||||
*/
|
||||
private JSONObject buildItemConfirmLetterJsonPayload(EntrustmentVO entrustVO) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.set("ajmc", entrustVO.getCaseName()); // 案件名称
|
||||
jsonObject.set("dwfzr", StrUtil.join("、", entrustVO.getDeliverer1Name(), entrustVO.getDeliverer2Name())); // 送检人签名
|
||||
// 检材处理要求,这里的值是直接复制了确认书里的值
|
||||
jsonObject.set("jcclyq", "以上检材均按照《办理毒品犯罪案件毒品提取、扣押、称量、取样和送检程序若干问题的规定》、《贵阳市公安局关于进一步规范毒品取样、保管及送检程序的通知》要求的提取部位和提取方法进行取样。");
|
||||
jsonObject.set("jdjbrqm", ""); /// 鉴定机构经办人签字 ,我们系统是单位自己打印出来,线下自己手签
|
||||
jsonObject.set("jdyq", entrustVO.getEntrustRequirement()); // 鉴定要求
|
||||
jsonObject.set("jyaq", entrustVO.getCaseBrief()); // 简要案情
|
||||
jsonObject.set("lqrqm", NULL_PLACEHOLDER); // 领取人签名
|
||||
jsonObject.set("sjr1", entrustVO.getDeliverer1Name()); // 送检人1姓名
|
||||
jsonObject.set("sjr2", entrustVO.getDeliverer2Name()); // 送检人2姓名
|
||||
jsonObject.set("sjr1dh", entrustVO.getDeliverer1Phone()); // 送检人电话
|
||||
jsonObject.set("sjr2dh", entrustVO.getDeliverer2Phone());
|
||||
jsonObject.set("sjr1zjh", StrUtil.join(":", entrustVO.getDeliverer1Cert(), entrustVO.getDeliverer1Id())); // 送检人证件和号码
|
||||
jsonObject.set("sjr2zjh", StrUtil.join(":", entrustVO.getDeliverer2Cert(), entrustVO.getDeliverer2Id()));
|
||||
jsonObject.set("sjr1zw", entrustVO.getDeliverer1Position()); // 送检人职务
|
||||
jsonObject.set("sjr2zw", entrustVO.getDeliverer2Position());
|
||||
jsonObject.set("slbh", entrustVO.getAcceptNo());
|
||||
jsonObject.set("slrq", entrustVO.getAcceptTime().format(formatter));
|
||||
jsonObject.set("slr", commonFeignService.remoteGetUserById(entrustVO.getAcceptUser()).getName());
|
||||
jsonObject.set("slrqm", NULL_PLACEHOLDER); // 鉴定机构受理人签字
|
||||
jsonObject.set("type", NULL_PLACEHOLDER);
|
||||
jsonObject.set("wtbh", entrustVO.getAcceptNo()); // 委托书编号
|
||||
jsonObject.set("wtdw", entrustVO.getClientOrgName());
|
||||
jsonObject.set("wtsj", entrustVO.getEntrustmentTime().format(formatter));
|
||||
List<EntrustmentIdentificationMaterial> materialList = entrustmentIdentificationMaterialService.list(Wrappers.<EntrustmentIdentificationMaterial>lambdaQuery()
|
||||
.eq(EntrustmentIdentificationMaterial::getEntrustmentId, entrustVO.getId()));
|
||||
List<MaterialListForBookVo> materialBookVoList = entrustmentService.getMaterialBookVoList(materialList);
|
||||
List<JSONObject> table = materialBookVoList.stream().map(materialBookVo -> {
|
||||
JSONObject materialBookVoJson = new JSONObject();
|
||||
materialBookVoJson.set("baozhuang", materialBookVo.isPackComplete() ? "是" : "否");
|
||||
materialBookVoJson.set("bh", materialBookVo.getOrderNo());
|
||||
materialBookVoJson.set("yswzl", materialBookVo.getMaterialName());
|
||||
materialBookVoJson.set("bz", materialBookVo.getRemark());
|
||||
materialBookVoJson.set("lcygs", materialBookVo.getRtSampleQuantity());
|
||||
materialBookVoJson.set("sl", materialBookVo.getTotalSampleDes());
|
||||
materialBookVoJson.set("xzms", materialBookVo.getFormName());
|
||||
return materialBookVoJson;
|
||||
}).collect(Collectors.toList());
|
||||
jsonObject.put("table", table);
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送委托函数据
|
||||
*
|
||||
* @param entrustVO
|
||||
* @param dataMap 待推送的数据映射
|
||||
*/
|
||||
private void pushEntrustLetterData(EntrustmentVO entrustVO, Map<String, Object> dataMap) {
|
||||
JSONObject jsonObject = buildEntrustLetterJsonPayload(entrustVO, dataMap);
|
||||
|
||||
try {
|
||||
ResponseEntity<String> response = exchangeRemoteApi(jsonObject, apiPathProperties.getEntrustLetter());
|
||||
|
||||
if (response.getStatusCode().is2xxSuccessful() && response.getBody().contains("\"status\":200")) {
|
||||
log.info("推送鉴定委托书数据成功, 委托编号: {}, 响应: {}", entrustVO.getEntrustmentNo(), response.getBody());
|
||||
} else {
|
||||
log.warn("推送鉴定委托书数据失败, 委托编号: {}, 状态码: {}, 响应: {}",
|
||||
entrustVO.getEntrustmentNo(), response.getStatusCode(), response.getBody());
|
||||
}
|
||||
} catch (RestClientException e) {
|
||||
log.error("推送鉴定委托书数据到 LabsCare 失败, 委托编号: {}", entrustVO.getEntrustmentNo(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建委托函的JSON负载
|
||||
*
|
||||
* @param entrustVO 委托VO对象
|
||||
* @param dataMap 数据映射
|
||||
* @return 构建好的JSON对象
|
||||
*/
|
||||
private JSONObject buildEntrustLetterJsonPayload(EntrustmentVO entrustVO, Map<String, Object> dataMap) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.set("afsj", entrustVO.getHappenTime()); // 案发时间
|
||||
jsonObject.set("ajmc", entrustVO.getCaseName()); // 案事件名称
|
||||
jsonObject.set("dwgz", NULL_PLACEHOLDER); // 单位盖章
|
||||
jsonObject.set("jyaq", entrustVO.getCaseBrief()); // 简要案情
|
||||
jsonObject.set("sjdwfzr", NULL_PLACEHOLDER); // 单位负责人签名
|
||||
jsonObject.set("sjr1", entrustVO.getDeliverer1Name()); // 送检人
|
||||
jsonObject.set("sjr2", entrustVO.getDeliverer2Name());
|
||||
jsonObject.set("sjr1dh", entrustVO.getDeliverer1Phone());
|
||||
jsonObject.set("sjr2dh", entrustVO.getDeliverer2Phone());
|
||||
jsonObject.set("slrq", entrustVO.getAcceptTime().format(formatter));
|
||||
jsonObject.set("type", NULL_PLACEHOLDER);
|
||||
jsonObject.set("wtdw", entrustVO.getClientOrgName());
|
||||
jsonObject.set("wtsj", entrustVO.getEntrustmentTime().format(formatter));
|
||||
jsonObject.set("yjdqk", entrustVO.getOldIdentificationResult());
|
||||
|
||||
// 组装材料信息
|
||||
List<EntrustmentIdentificationMaterial> materialList = (List<EntrustmentIdentificationMaterial>) dataMap.get("materialList");
|
||||
AtomicInteger index = new AtomicInteger(1);
|
||||
List<JSONObject> table = materialList.stream().map(material -> {
|
||||
JSONObject materialJson = new JSONObject();
|
||||
materialJson.set("bzsfwz", material.getPackComplete() ? "是" : "否");
|
||||
materialJson.set("jyjdyq", material.getDrugsValue() + material.getAnalysisOptionValue());
|
||||
materialJson.set("lcygs", material.getRtSampleQuantity());
|
||||
materialJson.set("projectName", index.getAndIncrement());
|
||||
materialJson.set("tqdd", material.getDrawPlace());
|
||||
materialJson.set("tqsj", material.getDrawTime().format(formatter));
|
||||
materialJson.set("xzms", material.getFormName());
|
||||
materialJson.set("yswzl", material.getName());
|
||||
materialJson.set("zltj", material.getQuantity() + material.getUnit());
|
||||
return materialJson;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
jsonObject.set("table", table);
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过POST请求与远程API进行交互
|
||||
*
|
||||
* @param jsonObject 包含请求数据的JSONObject对象
|
||||
* @param url 远程API的URL
|
||||
* @return ResponseEntity<String> 包含远程API响应数据的ResponseEntity对象
|
||||
*/
|
||||
private ResponseEntity<String> exchangeRemoteApi(JSONObject jsonObject, String url) {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON); // 设置为 application/json
|
||||
HttpEntity<JSONObject> requestEntity = new HttpEntity<>(jsonObject, headers);
|
||||
ResponseEntity<String> response = HttpsUtils
|
||||
.genRestTemplate()
|
||||
.exchange(
|
||||
url,
|
||||
HttpMethod.POST,
|
||||
requestEntity,
|
||||
String.class
|
||||
);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package digital.laboratory.platform.entrustment.service;
|
||||
|
||||
import digital.laboratory.platform.entrustment.vo.EntrustmentVO;
|
||||
|
||||
|
||||
/**
|
||||
* @author ChenJiangBao
|
||||
* @version 1.0
|
||||
* @description: 推送数据到labscare平台接口
|
||||
* @date 2025/3/27 16:32
|
||||
*/
|
||||
public interface PushDataToLabsCareService {
|
||||
|
||||
/**
|
||||
* 推送鉴定事项确认书数据
|
||||
*
|
||||
* @param entrustVO 委托vo
|
||||
*/
|
||||
void pushItemConfirmLetterData(EntrustmentVO entrustVO);
|
||||
|
||||
/**
|
||||
* 推送委托函数据
|
||||
*
|
||||
* @param entrustVO
|
||||
*/
|
||||
void pushEntrustLetterData(EntrustmentVO entrustVO) throws IllegalAccessException;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class CommonFeignServiceImpl implements CommonFeignService {
|
||||
@Override
|
||||
public SysOrg remoteGetSysOrg(String orgId) {
|
||||
SysOrg sysOrg = null;
|
||||
R<SysOrg> r = remoteOrgService.getById(orgId);
|
||||
R<SysOrg> r = remoteOrgService.getByIdWithoutToken(orgId);
|
||||
if (r != null && r.getCode() == CommonConstants.SUCCESS) {
|
||||
sysOrg = r.getData();
|
||||
} else {
|
||||
|
||||
@@ -40,6 +40,7 @@ import digital.laboratory.platform.entrustment.entity.*;
|
||||
import digital.laboratory.platform.entrustment.enums.AnalysisOptionEnums;
|
||||
import digital.laboratory.platform.entrustment.enums.EntrustAlterApplyStatus;
|
||||
import digital.laboratory.platform.entrustment.enums.EntrustStatusConstants;
|
||||
import digital.laboratory.platform.entrustment.event.PushDataToLabsCareEvent;
|
||||
import digital.laboratory.platform.entrustment.handler.AppStartupRunner;
|
||||
import digital.laboratory.platform.entrustment.mapper.EntrustmentMapper;
|
||||
import digital.laboratory.platform.entrustment.misc.ProcessFlowMapper;
|
||||
@@ -68,6 +69,8 @@ import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.activation.MimetypesFileTypeMap;
|
||||
import javax.annotation.Resource;
|
||||
@@ -132,8 +135,6 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
|
||||
@Resource
|
||||
private RemoteDeliverService remoteDeliverService;
|
||||
@Resource
|
||||
private RemoteOrgService remoteOrgService;
|
||||
|
||||
@Resource
|
||||
private RemoteWord2PDFService remoteWord2PDFService;
|
||||
@@ -2172,7 +2173,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
//编码转换---
|
||||
dm.put("identificationMaterials", ems);
|
||||
|
||||
SysOrg org = remoteOrgService.getById(ev.getClientOrgId()).getData();
|
||||
SysOrg org = commonFeignService.remoteGetSysOrg(ev.getClientOrgId());
|
||||
dm.put("clientOrg", ClassUtils.objectToMap(org));
|
||||
|
||||
List<EntrustmentIdentificationMaterial> materialList = entrustmentIdentificationMaterialService.list(
|
||||
@@ -2445,22 +2446,8 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
if (!this.updateById(entrustment)) {
|
||||
throw new RuntimeException("保存委托信息失败");
|
||||
}
|
||||
// 更新委托书和确认书
|
||||
CompletableFuture.runAsync(() -> {
|
||||
this.generateIdentifyItemsBook(entrustment.getId());
|
||||
try {
|
||||
GenerateEntrustmentLetterPDF(this.getEntrustmentVOById(entrustment.getId()));
|
||||
} catch (Exception e) {
|
||||
log.error("委托书重新生成失败, 失败原因: {}", e.getMessage());
|
||||
}
|
||||
// 推送数据到LabsCare 平台
|
||||
// // 保存当前请求上下文到 RequestContextHolder
|
||||
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
// // 让异步线程继承主线程的上下文
|
||||
// RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
|
||||
// applicationContext.publishEvent(new PushDataToLabsCareEvent(this, entrust.getId(), 1));
|
||||
// applicationContext.publishEvent(new PushDataToLabsCareEvent(this, entrust.getId(), 2));
|
||||
});
|
||||
// 异步处理
|
||||
processPushDataAndUpdateDoc(entrustment.getId());
|
||||
|
||||
//同步第三方禁毒系统的受理功能 开始--------------------------------------------------------------
|
||||
boolean isSuccess = true;
|
||||
@@ -2523,6 +2510,38 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
return entrustment;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理推送数据并更新委托书和确认书
|
||||
*
|
||||
* @param entrustId 委托id
|
||||
*/
|
||||
private void processPushDataAndUpdateDoc(String entrustId) {
|
||||
// 保存当前请求上下文到 RequestContextHolder
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
// 更新委托书和确认书
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
this.generateIdentifyItemsBook(entrustId);
|
||||
try {
|
||||
GenerateEntrustmentLetterPDF(this.getEntrustmentVOById(entrustId));
|
||||
} catch (Exception e) {
|
||||
log.error("委托书重新生成失败, 失败原因: {}", e.getMessage());
|
||||
}
|
||||
// 推送数据到LabsCare 平台
|
||||
// 让异步线程继承主线程的上下文
|
||||
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
|
||||
applicationContext.publishEvent(new PushDataToLabsCareEvent(this, entrustId, 1));
|
||||
applicationContext.publishEvent(new PushDataToLabsCareEvent(this, entrustId, 2));
|
||||
} finally {
|
||||
// 清理 RequestContextHolder,避免线程池污染
|
||||
RequestContextHolder.resetRequestAttributes();
|
||||
}
|
||||
}).exceptionally(e -> {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建需要流转到流转系统的检材列表
|
||||
*
|
||||
@@ -2640,7 +2659,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
.eq("entrustment_id", ev.getId()).orderByAsc("im_no"));
|
||||
dm.put("identificationMaterials", ems);
|
||||
|
||||
SysOrg org = remoteOrgService.getById(ev.getClientOrgId()).getData();
|
||||
SysOrg org = commonFeignService.remoteGetSysOrg(ev.getClientOrgId());
|
||||
dm.put("clientOrg", ClassUtils.objectToMap(org));
|
||||
|
||||
// QR Code
|
||||
@@ -3012,16 +3031,9 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
|
||||
// 如果没有提供案件编码, 生成一个
|
||||
|
||||
if ((caseEvent.getHappenTime() != null) && (StrUtil.isNotBlank(caseEvent.getCaseOwnOrgId()))) {
|
||||
SysOrg caseOwnOrg;
|
||||
R r = remoteOrgService.getById(caseEvent.getCaseOwnOrgId());
|
||||
if (r.getCode() == CommonConstants.SUCCESS) {
|
||||
caseOwnOrg = (SysOrg) r.getData();
|
||||
// Date happenTime = Date.from(caseEvent.getHappenTime().atZone(ZoneId.systemDefault()).toInstant());
|
||||
|
||||
SysOrg caseOwnOrg = commonFeignService.remoteGetSysOrg(caseEvent.getCaseOwnOrgId());
|
||||
caseEvent.setCaseNo(caseEventService.getNewCaseCode(caseOwnOrg.getOrgCode(), caseEvent.getHappenTime()));
|
||||
} else {
|
||||
throw new RuntimeException(String.format("没有找到 orgId 为 %s 的机构, 请确认案件所属机构(CaseOwnOrg)的正确性!", caseEvent.getCaseOwnOrgId()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
caseEvent.setId(IdWorker.get32UUID().toUpperCase());
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
package digital.laboratory.platform.entrustment.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import digital.laboratory.platform.entrustment.config.properties.ApiPathProperties;
|
||||
import digital.laboratory.platform.entrustment.entity.Entrustment;
|
||||
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
|
||||
import digital.laboratory.platform.entrustment.enums.EntrustStatusConstants;
|
||||
import digital.laboratory.platform.entrustment.mapper.EntrustmentMapper;
|
||||
import digital.laboratory.platform.entrustment.service.CommonFeignService;
|
||||
import digital.laboratory.platform.entrustment.service.EntrustmentIdentificationMaterialService;
|
||||
import digital.laboratory.platform.entrustment.service.EntrustmentService;
|
||||
import digital.laboratory.platform.entrustment.service.PushDataToLabsCareService;
|
||||
import digital.laboratory.platform.entrustment.vo.EntrustmentVO;
|
||||
import digital.laboratory.platform.entrustment.vo.MaterialListForBookVo;
|
||||
import digital.laboratory.platform.othersys.utils.HttpsUtils;
|
||||
import digital.laboratory.platform.sys.entity.SysUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestClientException;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author ChenJiangBao
|
||||
* @version 1.0
|
||||
* @description: 推送数据到labscare平台接口
|
||||
* @date 2025/3/27 16:32
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PushDataToLabsCareServiceImpl implements PushDataToLabsCareService {
|
||||
|
||||
@Resource
|
||||
private EntrustmentService entrustmentService;
|
||||
|
||||
@Resource
|
||||
private EntrustmentMapper entrustmentMapper;
|
||||
|
||||
@Resource
|
||||
private ApiPathProperties apiPathProperties;
|
||||
|
||||
@Resource
|
||||
private CommonFeignService commonFeignService;
|
||||
|
||||
@Resource
|
||||
private EntrustmentIdentificationMaterialService entrustmentIdentificationMaterialService;
|
||||
|
||||
private final static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
|
||||
|
||||
// "#NULL#" 作为空数据的占位符, 对于系统中没有的信息以占位符代替
|
||||
public final static String NULL_PLACEHOLDER = "#NULL#";
|
||||
|
||||
// 委托书的推送标识
|
||||
public final static String ENTRUST_LETTER = "EntrustLetter";
|
||||
|
||||
// 事项确认书的推送标识
|
||||
public final static String ITEM_CONFIRM_LETTER = "ItemConfirmLetter";
|
||||
|
||||
/**
|
||||
* 做一个定时推送,对于推送失败的委托进行重新推送, 每天凌晨1点推送
|
||||
*/
|
||||
// @Scheduled(cron = "30 * * * * ?") // 测试
|
||||
@Scheduled(cron = "0 0 1 * * ?") // 每天凌晨 1 点执行
|
||||
public void timingPushDataToLabsCare() throws IllegalAccessException {
|
||||
// 查询受理后推送失败的委托
|
||||
List<EntrustmentVO> entrustmentList = entrustmentMapper.getEntrustmentVOList(
|
||||
Wrappers.<Entrustment>query()
|
||||
.in("e.status",
|
||||
EntrustStatusConstants.ENTRUST_STATUS_ACCEPTED.getStatus(),
|
||||
EntrustStatusConstants.ENTRUST_STATUS_TEST_FINISH.getStatus(),
|
||||
EntrustStatusConstants.ENTRUST_STATUS_COMPLETED.getStatus())
|
||||
.and(wrapper -> wrapper
|
||||
.eq("e.push_flag", "")
|
||||
.or()
|
||||
.isNull("e.push_flag")
|
||||
.or()
|
||||
.like("e.push_flag", "false")
|
||||
)
|
||||
);
|
||||
|
||||
for (EntrustmentVO entrustmentVO : entrustmentList) {
|
||||
String pushFlag = entrustmentVO.getPushFlag();
|
||||
if (StrUtil.isBlank(pushFlag)) {
|
||||
pushEntrustLetterData(entrustmentVO);
|
||||
pushItemConfirmLetterData(entrustmentVO);
|
||||
} else {
|
||||
List<String> flagList = StrUtil.split(pushFlag, StrUtil.COMMA).stream().filter(str -> str.contains("false")).collect(Collectors.toList());
|
||||
for (String flag : flagList) {
|
||||
if (flag.contains(ENTRUST_LETTER)) {
|
||||
pushEntrustLetterData(entrustmentVO);
|
||||
} else {
|
||||
pushItemConfirmLetterData(entrustmentVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送鉴定事项确认书数据
|
||||
*
|
||||
* @param entrustVO 委托vo
|
||||
*/
|
||||
@Override
|
||||
public void pushItemConfirmLetterData(EntrustmentVO entrustVO) {
|
||||
JSONObject jsonObject = buildItemConfirmLetterJsonPayload(entrustVO);
|
||||
String successFlag = ITEM_CONFIRM_LETTER + ":true";
|
||||
String failureFlag = ITEM_CONFIRM_LETTER + ":false";
|
||||
try {
|
||||
ResponseEntity<String> response = exchangeRemoteApi(jsonObject, apiPathProperties.getConfirmLetter());
|
||||
|
||||
if (response.getStatusCode().is2xxSuccessful() && response.getBody().contains("\"status\":200")) {
|
||||
updatePushFlag(entrustVO, ITEM_CONFIRM_LETTER, successFlag);
|
||||
log.info("推送鉴定事项确认书数据成功, 受理编号: {}, 响应: {}", entrustVO.getAcceptNo(), response.getBody());
|
||||
} else {
|
||||
updatePushFlag(entrustVO, ITEM_CONFIRM_LETTER, failureFlag);
|
||||
log.warn("推送鉴定事项确认书数据失败, 受理编号: {}, 状态码: {}, 响应: {}",
|
||||
entrustVO.getAcceptNo(), response.getStatusCode(), response.getBody());
|
||||
}
|
||||
} catch (RestClientException e) {
|
||||
log.error("推送鉴定事项确认书数据到 LabsCare 失败, 受理编号: {}", entrustVO.getAcceptNo(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送委托函数据
|
||||
*
|
||||
* @param entrustVO
|
||||
*/
|
||||
@Override
|
||||
public void pushEntrustLetterData(EntrustmentVO entrustVO) throws IllegalAccessException {
|
||||
Map<String, Object> dataMap = entrustmentService.buildEntrustLetterDataMap(entrustVO);
|
||||
JSONObject jsonObject = buildEntrustLetterJsonPayload(entrustVO, dataMap);
|
||||
|
||||
String successFlag = ENTRUST_LETTER + ":true";
|
||||
String failureFlag = ENTRUST_LETTER + ":false";
|
||||
try {
|
||||
ResponseEntity<String> response = exchangeRemoteApi(jsonObject, apiPathProperties.getEntrustLetter());
|
||||
|
||||
if (response.getStatusCode().is2xxSuccessful() && response.getBody().contains("\"status\":200")) {
|
||||
updatePushFlag(entrustVO, ENTRUST_LETTER, successFlag);
|
||||
log.info("推送鉴定委托书数据成功, 委托编号: {}, 响应: {}", entrustVO.getEntrustmentNo(), response.getBody());
|
||||
} else {
|
||||
updatePushFlag(entrustVO, ENTRUST_LETTER, failureFlag);
|
||||
log.warn("推送鉴定委托书数据失败, 委托编号: {}, 状态码: {}, 响应: {}",
|
||||
entrustVO.getEntrustmentNo(), response.getStatusCode(), response.getBody());
|
||||
}
|
||||
} catch (RestClientException e) {
|
||||
log.error("推送鉴定委托书数据到 LabsCare 失败, 委托编号: {}", entrustVO.getEntrustmentNo(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建委托函的JSON负载
|
||||
*
|
||||
* @param entrustVO 委托VO对象
|
||||
* @param dataMap 数据映射
|
||||
* @return 构建好的JSON对象
|
||||
*/
|
||||
private JSONObject buildEntrustLetterJsonPayload(EntrustmentVO entrustVO, Map<String, Object> dataMap) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.set("afsj", entrustVO.getHappenTime()); // 案发时间
|
||||
jsonObject.set("ajmc", entrustVO.getCaseName()); // 案事件名称
|
||||
jsonObject.set("dwgz", entrustVO.getClientOrgName()); // 单位盖章
|
||||
jsonObject.set("jyaq", entrustVO.getCaseBrief()); // 简要案情
|
||||
jsonObject.set("sjdwfzr", entrustVO.getDeliverer1Name() + "、" + entrustVO.getDeliverer2Name()); // 单位负责人签名
|
||||
jsonObject.set("sjr1", entrustVO.getDeliverer1Name()); // 送检人
|
||||
jsonObject.set("sjr2", entrustVO.getDeliverer2Name());
|
||||
jsonObject.set("sjr1dh", entrustVO.getDeliverer1Phone());
|
||||
jsonObject.set("sjr2dh", entrustVO.getDeliverer2Phone());
|
||||
jsonObject.set("slrq", entrustVO.getAcceptTime().format(formatter));
|
||||
jsonObject.set("wtdw", entrustVO.getClientOrgName());
|
||||
jsonObject.set("wtsj", entrustVO.getEntrustmentTime().format(formatter));
|
||||
jsonObject.set("yjdqk", entrustVO.getOldIdentificationResult());
|
||||
|
||||
// 组装材料信息
|
||||
List<EntrustmentIdentificationMaterial> materialList = (List<EntrustmentIdentificationMaterial>) dataMap.get("materialList");
|
||||
AtomicInteger index = new AtomicInteger(1);
|
||||
List<JSONObject> table = materialList.stream().map(material -> {
|
||||
JSONObject materialJson = new JSONObject();
|
||||
materialJson.set("bzsfwz", material.getPackComplete() ? "是" : "否");
|
||||
materialJson.set("jyjdyq", material.getDrugsValue() + material.getAnalysisOptionValue());
|
||||
materialJson.set("lcygs", material.getRtSampleQuantity());
|
||||
materialJson.set("projectName", index.getAndIncrement());
|
||||
materialJson.set("tqdd", material.getDrawPlace());
|
||||
materialJson.set("tqsj", material.getDrawTime().format(formatter));
|
||||
materialJson.set("xzms", material.getFormName());
|
||||
materialJson.set("yswzl", material.getName());
|
||||
materialJson.set("zltj", material.getQuantity() + material.getUnit());
|
||||
return materialJson;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
jsonObject.set("table", table);
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建鉴定事项确认书的JSON负载
|
||||
*
|
||||
* @param entrustVO 委托单VO对象,包含构建JSON负载所需的数据
|
||||
* @return 包含鉴定事项确认书数据的JSONObject对象
|
||||
*/
|
||||
private JSONObject buildItemConfirmLetterJsonPayload(EntrustmentVO entrustVO) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
SysUser sysUser = commonFeignService.remoteGetUserById(entrustVO.getAcceptUser());
|
||||
jsonObject.set("ajmc", entrustVO.getCaseName()); // 案件名称
|
||||
jsonObject.set("dwfzr", StrUtil.join("、", entrustVO.getDeliverer1Name(), entrustVO.getDeliverer2Name())); // 送检人签名
|
||||
// 检材处理要求,这里的值是直接复制了确认书里的值
|
||||
jsonObject.set("jcclyq", "以上检材均按照《办理毒品犯罪案件毒品提取、扣押、称量、取样和送检程序若干问题的规定》、《贵阳市公安局关于进一步规范毒品取样、保管及送检程序的通知》要求的提取部位和提取方法进行取样。");
|
||||
jsonObject.set("jdjbrqm", sysUser.getName()); /// 鉴定机构经办人签字 ,我们系统是单位自己打印出来,线下自己手签
|
||||
jsonObject.set("jdyq", entrustVO.getEntrustRequirement()); // 鉴定要求
|
||||
jsonObject.set("jyaq", entrustVO.getCaseBrief()); // 简要案情
|
||||
jsonObject.set("lqrqm", StrUtil.join("、", entrustVO.getDeliverer1Name(), entrustVO.getDeliverer2Name())); // 领取人签名
|
||||
jsonObject.set("sjr1", entrustVO.getDeliverer1Name()); // 送检人1姓名
|
||||
jsonObject.set("sjr2", entrustVO.getDeliverer2Name()); // 送检人2姓名
|
||||
jsonObject.set("sjr1dh", entrustVO.getDeliverer1Phone()); // 送检人电话
|
||||
jsonObject.set("sjr2dh", entrustVO.getDeliverer2Phone());
|
||||
jsonObject.set("sjr1zjh", StrUtil.join(":", entrustVO.getDeliverer1Cert(), entrustVO.getDeliverer1Id())); // 送检人证件和号码
|
||||
jsonObject.set("sjr2zjh", StrUtil.join(":", entrustVO.getDeliverer2Cert(), entrustVO.getDeliverer2Id()));
|
||||
jsonObject.set("sjr1zw", entrustVO.getDeliverer1Position()); // 送检人职务
|
||||
jsonObject.set("sjr2zw", entrustVO.getDeliverer2Position());
|
||||
jsonObject.set("slbh", entrustVO.getAcceptNo());
|
||||
jsonObject.set("slrq", entrustVO.getAcceptTime().format(formatter));
|
||||
jsonObject.set("slr", sysUser.getName());
|
||||
jsonObject.set("slrqm", sysUser.getName()); // 鉴定机构受理人签字
|
||||
jsonObject.set("wtbh", entrustVO.getAcceptNo()); // 委托书编号
|
||||
jsonObject.set("wtdw", entrustVO.getClientOrgName());
|
||||
jsonObject.set("wtsj", entrustVO.getEntrustmentTime().format(formatter));
|
||||
List<EntrustmentIdentificationMaterial> materialList = entrustmentIdentificationMaterialService.list(Wrappers.<EntrustmentIdentificationMaterial>lambdaQuery()
|
||||
.eq(EntrustmentIdentificationMaterial::getEntrustmentId, entrustVO.getId()));
|
||||
List<MaterialListForBookVo> materialBookVoList = entrustmentService.getMaterialBookVoList(materialList);
|
||||
List<JSONObject> table = materialBookVoList.stream().map(materialBookVo -> {
|
||||
JSONObject materialBookVoJson = new JSONObject();
|
||||
materialBookVoJson.set("baozhuang", materialBookVo.isPackComplete() ? "是" : "否");
|
||||
materialBookVoJson.set("bh", materialBookVo.getOrderNo());
|
||||
materialBookVoJson.set("yswzl", materialBookVo.getMaterialName());
|
||||
materialBookVoJson.set("bz", StrUtil.isBlank(materialBookVo.getRemark()) ? NULL_PLACEHOLDER : materialBookVo.getRemark());
|
||||
materialBookVoJson.set("lcygs", materialBookVo.getRtSampleQuantity());
|
||||
materialBookVoJson.set("sl", materialBookVo.getTotalSampleDes());
|
||||
materialBookVoJson.set("xzms", materialBookVo.getFormName());
|
||||
return materialBookVoJson;
|
||||
}).collect(Collectors.toList());
|
||||
jsonObject.put("table", table);
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过POST请求与远程API进行交互
|
||||
*
|
||||
* @param jsonObject 包含请求数据的JSONObject对象
|
||||
* @param url 远程API的URL
|
||||
* @return ResponseEntity<String> 包含远程API响应数据的ResponseEntity对象
|
||||
*/
|
||||
private ResponseEntity<String> exchangeRemoteApi(JSONObject jsonObject, String url) {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON); // 设置为 application/json
|
||||
HttpEntity<JSONObject> requestEntity = new HttpEntity<>(jsonObject, headers);
|
||||
ResponseEntity<String> response = HttpsUtils
|
||||
.genRestTemplate()
|
||||
.exchange(
|
||||
url,
|
||||
HttpMethod.POST,
|
||||
requestEntity,
|
||||
String.class
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新推送标志
|
||||
*
|
||||
* @param entrustVO 委托VO对象
|
||||
* @param pushType 推送类型 EntrustLetter 委托书 | ItemConfirmLetter 事项确认书
|
||||
* @param newFlag 新的推送标志
|
||||
*/
|
||||
private void updatePushFlag(EntrustmentVO entrustVO, String pushType, String newFlag) {
|
||||
List<String> flagList = Optional.ofNullable(StrUtil.split(entrustVO.getPushFlag(), StrUtil.COMMA))
|
||||
.orElse(new ArrayList<>());
|
||||
|
||||
// 判断是否已有 指定的推送类型,如果有就替换,否则添加
|
||||
boolean exists = flagList.stream().anyMatch(flag -> flag.contains(pushType));
|
||||
if (exists) {
|
||||
flagList.replaceAll(flag -> flag.contains(pushType) ? newFlag : flag);
|
||||
} else {
|
||||
flagList.add(newFlag);
|
||||
}
|
||||
// 更新标识, 防止定时任务那里连续推送数据时推送标识更新出错
|
||||
entrustVO.setPushFlag(String.join(",", flagList));
|
||||
// 更新数据库
|
||||
entrustmentService.update(Wrappers.<Entrustment>lambdaUpdate()
|
||||
.eq(Entrustment::getId, entrustVO.getId())
|
||||
.set(Entrustment::getPushFlag, String.join(",", flagList)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,50 +1,93 @@
|
||||
package digital.laboratory.platform.entrustment.vo;
|
||||
|
||||
import digital.laboratory.platform.common.aop.annotation.DlpFeign;
|
||||
import digital.laboratory.platform.entrustment.entity.Entrustment;
|
||||
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(description = "委托信息视图对象")
|
||||
public class EntrustmentVO extends Entrustment {
|
||||
String caseName; // 案件名称
|
||||
String caseNo; // 案件编号
|
||||
String caseBrief; // 案情简要
|
||||
List<String> clientOrgAncestors; // 委托单位的祖先 id, json 字符串数组
|
||||
|
||||
String submitterName; // 委托提交人姓名
|
||||
String checkClaimUserName; // 审核任务认领人姓名
|
||||
String checkUserName; // 审核人姓名
|
||||
String approveClaimUserName; // 审批任务认领人姓名
|
||||
String approveUserName; // 审批人姓名
|
||||
String deliverConfirmUserName; // 送检确认人姓名
|
||||
String deliverSubmitterName; // 送检操作提交人姓名
|
||||
String acceptClaimUserName; // 受理任务认领人姓名
|
||||
String acceptUserName; // 受理人姓名
|
||||
String reportSenderUserName; // 报告发放人姓名
|
||||
String sampleSenderUserName; // 检材发放人姓名
|
||||
@ApiModelProperty("案件名称")
|
||||
private String caseName;
|
||||
|
||||
String createUserName; // 创建人姓名
|
||||
String updateUserName; // 更新人姓名
|
||||
@ApiModelProperty("案件编号")
|
||||
private String caseNo;
|
||||
|
||||
String statusDescription; // 状态描述
|
||||
String previousStatusDescription; // 上一个状态的描述
|
||||
@ApiModelProperty("案情简要")
|
||||
private String caseBrief;
|
||||
|
||||
int identificationMaterialCount; // 检材数量
|
||||
@ApiModelProperty("委托单位的祖先 ID(JSON 数组)")
|
||||
private List<String> clientOrgAncestors;
|
||||
|
||||
String oldIdentificationBrief; // 原鉴定情况(组合5个字段形成综述)
|
||||
@ApiModelProperty("委托提交人姓名")
|
||||
private String submitterName;
|
||||
|
||||
String identificationNo;
|
||||
@ApiModelProperty("审核任务认领人姓名")
|
||||
private String checkClaimUserName;
|
||||
|
||||
String happenTime;//案发时间
|
||||
@ApiModelProperty("审核人姓名")
|
||||
private String checkUserName;
|
||||
|
||||
@ApiModelProperty("审批任务认领人姓名")
|
||||
private String approveClaimUserName;
|
||||
|
||||
@ApiModelProperty("审批人姓名")
|
||||
private String approveUserName;
|
||||
|
||||
@ApiModelProperty("送检确认人姓名")
|
||||
private String deliverConfirmUserName;
|
||||
|
||||
@ApiModelProperty("送检操作提交人姓名")
|
||||
private String deliverSubmitterName;
|
||||
|
||||
@ApiModelProperty("受理任务认领人姓名")
|
||||
private String acceptClaimUserName;
|
||||
|
||||
@ApiModelProperty("受理人姓名")
|
||||
private String acceptUserName;
|
||||
|
||||
@ApiModelProperty("报告发放人姓名")
|
||||
private String reportSenderUserName;
|
||||
|
||||
@ApiModelProperty("检材发放人姓名")
|
||||
private String sampleSenderUserName;
|
||||
|
||||
@ApiModelProperty("创建人姓名")
|
||||
private String createUserName;
|
||||
|
||||
@ApiModelProperty("更新人姓名")
|
||||
private String updateUserName;
|
||||
|
||||
@ApiModelProperty("状态描述")
|
||||
private String statusDescription;
|
||||
|
||||
@ApiModelProperty("上一个状态的描述")
|
||||
private String previousStatusDescription;
|
||||
|
||||
@ApiModelProperty("检材数量")
|
||||
private int identificationMaterialCount;
|
||||
|
||||
@ApiModelProperty("原鉴定情况(组合 5 个字段形成综述)")
|
||||
private String oldIdentificationBrief;
|
||||
|
||||
@ApiModelProperty("鉴定编号")
|
||||
private String identificationNo;
|
||||
|
||||
@ApiModelProperty("案发时间")
|
||||
private String happenTime;
|
||||
|
||||
@ApiModelProperty("委托关联的检出有多少检出的数量")
|
||||
private Integer checkoutResultCount;
|
||||
|
||||
@ApiModelProperty("委托关联的检出有多少检出信息字符串")
|
||||
@ApiModelProperty("委托关联的检出信息字符串")
|
||||
private String checkoutResultStr;
|
||||
|
||||
private List<EntrustmentIdentificationMaterial> materialList;//检材列表
|
||||
@ApiModelProperty("检材列表")
|
||||
private List<EntrustmentIdentificationMaterial> materialList;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
<result property="qualitativeAnalysis" column="qualitative_analysis"/>
|
||||
<result property="quantitativeAnalysis" column="quantitative_analysis"/>
|
||||
<result property="otherIdentificationRequests" column="other_identification_requests"/>
|
||||
<result property="candidateDrugs" column="candidate_drugs" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
|
||||
<result property="candidateDrugs" column="candidate_drugs"
|
||||
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
|
||||
<result property="isClientSpecifiedMethod" column="is_client_specified_method"/>
|
||||
<result property="clientSpecifiedMethod" column="client_specified_method"/>
|
||||
<result property="destructiveAnalysis" column="destructive_analysis"/>
|
||||
@@ -36,7 +37,8 @@
|
||||
<result property="oldIdentificationDocument" column="old_identification_document"/>
|
||||
<result property="oldIdentificationResult" column="old_identification_result"/>
|
||||
<result property="reidentificationReason" column="reidentification_reason"/>
|
||||
<result property="avoidIdentifier" column="avoid_identifier" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
|
||||
<result property="avoidIdentifier" column="avoid_identifier"
|
||||
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
|
||||
<result property="specifiedIdentifier" column="specified_identifier"/>
|
||||
<result property="otherAgreement" column="other_agreement"/>
|
||||
<result property="comments" column="comments"/>
|
||||
@@ -47,7 +49,8 @@
|
||||
<result property="checkTime" column="check_time"/>
|
||||
<result property="checkComments" column="check_comments"/>
|
||||
<result property="checkTimes" column="check_times"/>
|
||||
<result property="checkAllIdentificationMaterialConfirmed" column="check_all_identification_material_confirmed"/>
|
||||
<result property="checkAllIdentificationMaterialConfirmed"
|
||||
column="check_all_identification_material_confirmed"/>
|
||||
<result property="approveCandidateUser" column="approve_candidate_user"/>
|
||||
<result property="approveClaimUser" column="approve_claim_user"/>
|
||||
<result property="approveClaimTime" column="approve_claim_time"/>
|
||||
@@ -60,26 +63,23 @@
|
||||
<result property="deliverConfirmComments" column="deliver_confirm_comments"/>
|
||||
<result property="deliverTime" column="deliver_time"/>
|
||||
<result property="deliverSubmitter" column="deliver_submitter"/>
|
||||
<!-- <result property="deliverer1UserId" column="deliverer1_user_id"/>-->
|
||||
<result property="deliverer1Name" column="deliverer1_name"/>
|
||||
<result property="deliverer1Position" column="deliverer1_position"/>
|
||||
<result property="deliverer1Cert" column="deliverer1_cert"/>
|
||||
<result property="deliverer1Id" column="deliverer1_id"/>
|
||||
<result property="deliverer1Phone" column="deliverer1_phone"/>
|
||||
<!-- <result property="deliverer2UserId" column="deliverer2_user_id"/>-->
|
||||
<result property="deliverer2Name" column="deliverer2_name"/>
|
||||
<result property="deliverer2Position" column="deliverer2_position"/>
|
||||
<result property="deliverer2Cert" column="deliverer2_cert"/>
|
||||
<result property="deliverer2Id" column="deliverer2_id"/>
|
||||
<result property="deliverer2Phone" column="deliverer2_phone"/>
|
||||
<!-- <result property="acceptClaimUser" column="accept_claim_user"/>-->
|
||||
<!-- <result property="acceptClaimTime" column="accept_claim_time"/>-->
|
||||
<result property="acceptNo" column="accept_no"/>
|
||||
<result property="acceptUser" column="accept_user"/>
|
||||
<result property="acceptTime" column="accept_time"/>
|
||||
<result property="acceptComments" column="accept_comments"/>
|
||||
<result property="identificationItemsConfirmPrinted" column="identification_items_confirm_printed"/>
|
||||
<result property="processInfo" column="process_info" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
|
||||
<result property="processInfo" column="process_info"
|
||||
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
|
||||
<result property="reportReceiveMode" column="report_receive_mode"/>
|
||||
<result property="reportReceiver1UserId" column="report_receiver1_user_id"/>
|
||||
<result property="reportReceiver1Name" column="report_receiver1_name"/>
|
||||
@@ -122,13 +122,15 @@
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="returnOrNot" column="return_or_not"/>
|
||||
<result property="materialImageFlag" column="material_image_flag"/>
|
||||
<result property="pushFlag" column="push_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="entrustmentVO" type="digital.laboratory.platform.entrustment.vo.EntrustmentVO" extends="entrustmentMap">
|
||||
<resultMap id="entrustmentVO" type="digital.laboratory.platform.entrustment.vo.EntrustmentVO"
|
||||
extends="entrustmentMap">
|
||||
<result property="caseName" column="case_name"/>
|
||||
<result property="caseNo" column="case_no"/>
|
||||
<result property="caseBrief" column="case_brief"/>
|
||||
|
||||
<result property="happenTime" column="happen_time"/>
|
||||
<result property="submitterName" column="submitter_name"/>
|
||||
<result property="checkClaimUserName" column="check_claim_user_name"/>
|
||||
<result property="checkUserName" column="check_user_name"/>
|
||||
@@ -264,11 +266,6 @@
|
||||
e.update_by,
|
||||
e.entrustment_letter_path,
|
||||
e.identification_items_confirm_path,
|
||||
e.transfer_status,
|
||||
e.transfer_oper_signnature,
|
||||
e.transfer_get_signnature,
|
||||
e.transfer_name,
|
||||
e.transfer_no,
|
||||
e.accept_need_professional,
|
||||
e.data_sources,
|
||||
e.accept_no_third_sys,
|
||||
@@ -276,7 +273,8 @@
|
||||
e.post_address,
|
||||
e.return_or_not,
|
||||
e.is_trans,
|
||||
e.material_image_flag
|
||||
e.material_image_flag,
|
||||
e.push_flag
|
||||
</sql>
|
||||
|
||||
<sql id="getEntrustmentVOSQL">
|
||||
@@ -286,6 +284,7 @@
|
||||
c.case_name,
|
||||
c.case_no,
|
||||
c.case_brief,
|
||||
c.happen_time,
|
||||
(
|
||||
SELECT user.name
|
||||
FROM dlp_base.sys_user user
|
||||
@@ -374,19 +373,22 @@
|
||||
</sql>
|
||||
|
||||
<!-- 取委托列表分页 -->
|
||||
<select id="getEntrustmentVOPage" resultMap="entrustmentVO" resultType="digital.laboratory.platform.entrustment.vo.EntrustmentVO">
|
||||
<select id="getEntrustmentVOPage" resultMap="entrustmentVO"
|
||||
resultType="digital.laboratory.platform.entrustment.vo.EntrustmentVO">
|
||||
<include refid="getEntrustmentVOSQL"/>
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- 取委托列表 -->
|
||||
<select id="getEntrustmentVOList" resultMap="entrustmentVO" resultType="digital.laboratory.platform.entrustment.vo.EntrustmentVO">
|
||||
<select id="getEntrustmentVOList" resultMap="entrustmentVO"
|
||||
resultType="digital.laboratory.platform.entrustment.vo.EntrustmentVO">
|
||||
<include refid="getEntrustmentVOSQL"/>
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- 取指定 Id 的委托 -->
|
||||
<select id="getEntrustmentVOById" resultMap="entrustmentVO" resultType="digital.laboratory.platform.entrustment.vo.EntrustmentVO">
|
||||
<select id="getEntrustmentVOById" resultMap="entrustmentVO"
|
||||
resultType="digital.laboratory.platform.entrustment.vo.EntrustmentVO">
|
||||
<include refid="getEntrustmentVOSQL"/>
|
||||
where e.id=#{id}
|
||||
</select>
|
||||
@@ -396,15 +398,13 @@
|
||||
SELECT entrustment_no
|
||||
FROM b_entrustment
|
||||
WHERE entrustment_no LIKE CONCAT(#{prefix}, '%')
|
||||
ORDER BY CAST(SUBSTRING_INDEX(entrustment_no, '-', -1) AS UNSIGNED) DESC
|
||||
LIMIT 1
|
||||
ORDER BY CAST(SUBSTRING_INDEX(entrustment_no, '-', -1) AS UNSIGNED) DESC LIMIT 1
|
||||
</select>
|
||||
<select id="getMaxEntrustmentNoNew" parameterType="String" resultType="java.lang.String">
|
||||
SELECT entrustment_no
|
||||
FROM b_entrustment
|
||||
WHERE entrustment_no LIKE CONCAT(#{prefix}, '%')
|
||||
ORDER BY CAST(SUBSTRING_INDEX(entrustment_no, '-', -1) AS UNSIGNED) DESC
|
||||
LIMIT 1
|
||||
ORDER BY CAST(SUBSTRING_INDEX(entrustment_no, '-', -1) AS UNSIGNED) DESC LIMIT 1
|
||||
</select>
|
||||
<select id="getMaxEntrustAcceptNo" parameterType="String" resultType="java.lang.String">
|
||||
SELECT MAX(CAST(SUBSTRING(accept_no, 6) AS UNSIGNED)) AS maxno
|
||||
|
||||
Reference in New Issue
Block a user