|
|
|
@ -2,6 +2,7 @@ package digital.laboratory.platform.entrustment.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import cn.hutool.json.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import digital.laboratory.platform.common.core.exception.CheckedException; |
|
|
|
|
import digital.laboratory.platform.entrustment.config.properties.ApiPathProperties; |
|
|
|
@ -39,7 +40,7 @@ import java.util.stream.Collectors; |
|
|
|
|
* @date 2025/3/27 16:32 |
|
|
|
|
*/ |
|
|
|
|
@Slf4j |
|
|
|
|
//@Service
|
|
|
|
|
@Service |
|
|
|
|
public class PushDataToLabsCareServiceImpl implements PushDataToLabsCareService { |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@ -72,9 +73,10 @@ public class PushDataToLabsCareServiceImpl implements PushDataToLabsCareService |
|
|
|
|
/** |
|
|
|
|
* 做一个定时推送,对于推送失败的委托进行重新推送, 每天凌晨1点推送 |
|
|
|
|
*/ |
|
|
|
|
// @Scheduled(cron = "30 * * * * ?") // 测试
|
|
|
|
|
@Scheduled(cron = "0 0 1 * * ?") // 每天凌晨 1 点执行
|
|
|
|
|
@Scheduled(cron = "* */5 * * * ?") // 测试
|
|
|
|
|
// @Scheduled(cron = "0 0 1 * * ?") // 每天凌晨 1 点执行
|
|
|
|
|
public void timingPushDataToLabsCare() throws IllegalAccessException { |
|
|
|
|
log.info("开始推送数据到 LabsCare"); |
|
|
|
|
// 查询受理后推送失败的委托
|
|
|
|
|
List<EntrustmentVO> entrustmentList = entrustmentMapper.getEntrustmentVOList( |
|
|
|
|
Wrappers.<Entrustment>query() |
|
|
|
@ -91,22 +93,28 @@ public class PushDataToLabsCareServiceImpl implements PushDataToLabsCareService |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
Integer count = 0; |
|
|
|
|
for (EntrustmentVO entrustmentVO : entrustmentList) { |
|
|
|
|
String pushFlag = entrustmentVO.getPushFlag(); |
|
|
|
|
if (StrUtil.isBlank(pushFlag)) { |
|
|
|
|
pushEntrustLetterData(entrustmentVO); |
|
|
|
|
pushItemConfirmLetterData(entrustmentVO); |
|
|
|
|
count++; |
|
|
|
|
count++; |
|
|
|
|
} 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); |
|
|
|
|
count++; |
|
|
|
|
} else { |
|
|
|
|
pushItemConfirmLetterData(entrustmentVO); |
|
|
|
|
count++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
log.info("成功推送 {} 条数据到 LabsCare", count); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -199,7 +207,6 @@ public class PushDataToLabsCareServiceImpl implements PushDataToLabsCareService |
|
|
|
|
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()); // 送检人
|
|
|
|
@ -208,7 +215,16 @@ public class PushDataToLabsCareServiceImpl implements PushDataToLabsCareService |
|
|
|
|
jsonObject.set("sjr2dh", entrustVO.getDeliverer2Phone()); |
|
|
|
|
jsonObject.set("slrq", entrustVO.getAcceptTime().format(formatter)); |
|
|
|
|
jsonObject.set("wtdw", entrustVO.getClientOrgName()); |
|
|
|
|
jsonObject.set("wtsj", entrustVO.getEntrustmentTime().format(formatter)); |
|
|
|
|
if (entrustVO.getEntrustmentTime() != null) { |
|
|
|
|
jsonObject.set("wtsj", entrustVO.getEntrustmentTime().format(formatter)); |
|
|
|
|
} else { |
|
|
|
|
jsonObject.set("wtsj", entrustVO.getAcceptTime().format(formatter)); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isNotBlank(entrustVO.getAcceptNo())) { |
|
|
|
|
jsonObject.set("dwgz", entrustVO.getAcceptNo()); // 单位盖章
|
|
|
|
|
} else { |
|
|
|
|
jsonObject.set("dwgz", entrustVO.getClientOrgName()); |
|
|
|
|
} |
|
|
|
|
jsonObject.set("yjdqk", entrustVO.getOldIdentificationResult()); |
|
|
|
|
|
|
|
|
|
// 组装材料信息
|
|
|
|
|