wangxianzhang 3 years ago
parent
commit
d62e315c8b
  1. 34
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java
  2. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java
  3. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatCompareRecordExcelData.java
  4. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java
  5. 17
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java
  6. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_nat_compare_record_template.xlsx
  7. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml

34
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java

@ -2,11 +2,11 @@ package com.epmet.commons.tools.utils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.dto.result.YtHsjcResDTO; import com.epmet.commons.tools.dto.result.YtHsjcResDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/** /**
* @Description * @Description
@ -15,8 +15,12 @@ import java.util.ArrayList;
*/ */
@Slf4j @Slf4j
public class YtHsResUtils { public class YtHsResUtils {
static String url = "https://10.2.2.60:8191/sjzt/server/hsjcxx?appkey=DR4jF5Be7sCsqDmCamq2tmYCl"; private static String URL = "http://10.2.2.60:8191/sjzt/server/hsjcxx";
private static final String APP_KEY_VALUE = "DR4jF5Be7sCsqDmCamq2tmYCl";
private static final String APP_KEY = "appkey";
private static final String CARD_NO = "card_no";
private static final String ROW_NUM = "ROWNUM";
private static final String PAGE_SIZE = "PAGESIZE";
/** /**
* desc:图片同步扫描 * desc:图片同步扫描
* *
@ -24,20 +28,26 @@ public class YtHsResUtils {
*/ */
public static YtHsjcResDTO hsjc(String cardNo, Integer rowNum, Integer pageSize) { public static YtHsjcResDTO hsjc(String cardNo, Integer rowNum, Integer pageSize) {
try { try {
String param = String.format("&card_no=%s&ROWNUM=%s&PAGESIZE=%s", cardNo, rowNum, pageSize); //String param = String.format("&card_no=%s&ROWNUM=%s&PAGESIZE=%s", cardNo, rowNum, pageSize);
String apiUrl = url.concat(param); //String apiUrl = url.concat(param);
Result<String> result = HttpClientManager.getInstance().sendPostByJSON(apiUrl, null); Map<String,Object> param = new HashMap<>();
param.put(APP_KEY,APP_KEY_VALUE);
param.put(CARD_NO,cardNo);
param.put(ROW_NUM,rowNum);
param.put(PAGE_SIZE,pageSize);
log.info("hsjc api param:{}",param);
Result<String> result = HttpClientManager.getInstance().sendGet(URL, param);
log.info("hsjc api result:{}",JSON.toJSONString(result));
if (result.success()) { if (result.success()) {
return JSON.parseObject(result.getData(), YtHsjcResDTO.class); return JSON.parseObject(result.getData(), YtHsjcResDTO.class);
} }
} catch (Exception e) {
e.printStackTrace();
log.warn(String.format("烟台核酸检测结果查询异常cardNo:%s,异常信息:%s", cardNo, e.getMessage()));
}
YtHsjcResDTO resultResult = new YtHsjcResDTO(); YtHsjcResDTO resultResult = new YtHsjcResDTO();
resultResult.setData(new ArrayList<>()); resultResult.setData(new ArrayList<>());
log.info("hsjc api param:{}, result:{}",cardNo+rowNum+pageSize,JSON.toJSONString(resultResult));
return resultResult; return resultResult;
} catch (Exception e) {
log.error(String.format("烟台核算检测结果查询异常cardNo:%s,异常信息:%s", cardNo, e.getMessage()));
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "获取核算检测结果api异常"+e.getMessage());
}
} }
} }

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java

@ -60,7 +60,7 @@ public class IcNatCompareRecordDTO implements Serializable {
* 真实手机号 * 真实手机号
*/ */
@ColumnWidth(20) @ColumnWidth(20)
@ExcelProperty("手机号") @ExcelProperty("联系方式")
private String realMobile; private String realMobile;
/** /**

6
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatCompareRecordExcelData.java

@ -21,8 +21,8 @@ public class IcNatCompareRecordExcelData {
@ExcelProperty("身份证号") @ExcelProperty("身份证号")
private String idCard; private String idCard;
@NotBlank(message = "手机号为必填项") @NotBlank(message = "联系方式为必填项")
@ExcelProperty("手机号") @ExcelProperty("联系方式")
private String mobile; private String mobile;
@Data @Data
@ -36,7 +36,7 @@ public class IcNatCompareRecordExcelData {
@ExcelProperty("身份证号") @ExcelProperty("身份证号")
private String idCard; private String idCard;
@ExcelProperty("手机号") @ExcelProperty("联系方式")
@ColumnWidth(20) @ColumnWidth(20)
private String mobile; private String mobile;

9
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java

@ -89,12 +89,17 @@ public class IcNatCompareRecordExcelImportListener implements ReadListener<IcNat
if (null != hsjcResDTO && CollectionUtils.isNotEmpty(hsjcResDTO.getData()) && null != hsjcResDTO.getData().get(0)) { if (null != hsjcResDTO && CollectionUtils.isNotEmpty(hsjcResDTO.getData()) && null != hsjcResDTO.getData().get(0)) {
YtHsjcResDetailDTO ytHsjcResDetailDTO = hsjcResDTO.getData().get(0); YtHsjcResDetailDTO ytHsjcResDetailDTO = hsjcResDTO.getData().get(0);
String testTime = ytHsjcResDetailDTO.getTest_time(); String testTime = ytHsjcResDetailDTO.getTest_time();
compareRecordEntity.setLatestNatTime(DateUtils.parse(testTime, DateUtils.DATE_PATTERN)); if (StringUtils.isNotBlank(testTime)) {
compareRecordEntity.setNatAddress(StringUtils.isNotBlank(ytHsjcResDetailDTO.getSampling_org_pcr()) ? ytHsjcResDetailDTO.getSample_result_pcr() : StrConstant.EPMETY_STR); // 赋值最近一次核酸时间
compareRecordEntity.setLatestNatTime(DateUtils.parse(testTime, DateUtils.DATE_TIME_PATTERN));
}
// 赋值检测地点
compareRecordEntity.setNatAddress(StringUtils.isNotBlank(ytHsjcResDetailDTO.getSampling_org_pcr()) ? ytHsjcResDetailDTO.getSampling_org_pcr() : StrConstant.EPMETY_STR);
// "sample_result_pcr":"2",// 核酸检测结果 1:阳性,2:阴性 // "sample_result_pcr":"2",// 核酸检测结果 1:阳性,2:阴性
String sample_result_pcr = ytHsjcResDetailDTO.getSample_result_pcr(); String sample_result_pcr = ytHsjcResDetailDTO.getSample_result_pcr();
if (NumConstant.ONE_STR.equals(sample_result_pcr)) { if (NumConstant.ONE_STR.equals(sample_result_pcr)) {
// 检测结果(0:阴性 1:阳性):接口填入
compareRecordEntity.setNatResult(NumConstant.ONE_STR); compareRecordEntity.setNatResult(NumConstant.ONE_STR);
} else if (NumConstant.TWO_STR.equals(sample_result_pcr)) { } else if (NumConstant.TWO_STR.equals(sample_result_pcr)) {
compareRecordEntity.setNatResult(NumConstant.ZERO_STR); compareRecordEntity.setNatResult(NumConstant.ZERO_STR);

17
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java

@ -32,6 +32,7 @@ import com.epmet.service.IcNatService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
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;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -223,14 +224,16 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR); e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR);
e.setUserId(idCard.getUserId()); e.setUserId(idCard.getUserId());
e.setUserType("sync"); e.setUserType("sync");
e.setName(natInfo.getName()); e.setName(StringUtils.isNotBlank(natInfo.getName()) ? natInfo.getName() : "");
e.setMobile(natInfo.getTelephone()); e.setMobile(StringUtils.isNotBlank(natInfo.getTelephone()) ? natInfo.getTelephone() : "");
e.setIdCard(natInfo.getCard_no()); e.setIdCard(StringUtils.isNotBlank(natInfo.getCard_no()) ? natInfo.getCard_no() : "");
e.setNatTime(DateUtils.parseDate(natInfo.getTest_time(),DateUtils.DATE_TIME_PATTERN)); e.setNatTime(DateUtils.parseDate(natInfo.getTest_time(),DateUtils.DATE_TIME_PATTERN));
e.setNatResult(natInfo.getSample_result_pcr()); e.setNatResult(natInfo.getSample_result_pcr());
e.setNatAddress(natInfo.getSampling_org_pcr()); e.setNatAddress(natInfo.getSampling_org_pcr());
e.setAgencyId(idCard.getAgencyId()); e.setAgencyId(idCard.getAgencyId());
e.setPids(idCard.getPids()); e.setPids(idCard.getPids());
e.setAttachmentType("");
e.setAttachmentUrl("");
entities.add(e); entities.add(e);
}); });
} }
@ -240,7 +243,9 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
entities.forEach(e -> existNatInfos.stream().filter(i -> i.getUserId().equals(e.getUserId()) && i.getIdCard().equals(e.getIdCard())).forEach(i -> e.setExistStatus(true))); entities.forEach(e -> existNatInfos.stream().filter(i -> i.getUserId().equals(e.getUserId()) && i.getIdCard().equals(e.getIdCard())).forEach(i -> e.setExistStatus(true)));
Map<Boolean, List<IcNatEntity>> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus)); Map<Boolean, List<IcNatEntity>> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus));
if (CollectionUtils.isNotEmpty(groupByStatus.get(false))){ if (CollectionUtils.isNotEmpty(groupByStatus.get(false))){
icNatService.insertBatch(groupByStatus.get(false)); for (List<IcNatEntity> icNatEntities : ListUtils.partition(groupByStatus.get(false), 500)) {
icNatService.insertBatch(icNatEntities);
}
} }
//组织关系表 //组织关系表
List<IcNatRelationEntity> relationEntities = new ArrayList<>(); List<IcNatRelationEntity> relationEntities = new ArrayList<>();
@ -257,7 +262,9 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
} }
}); });
if (CollectionUtils.isNotEmpty(relationEntities)){ if (CollectionUtils.isNotEmpty(relationEntities)){
icNatRelationService.insertBatch(relationEntities); for (List<IcNatRelationEntity> icNatRelationEntities : ListUtils.partition(relationEntities, 500)) {
icNatRelationService.insertBatch(icNatRelationEntities);
}
} }
} }
} }

BIN
epmet-user/epmet-user-server/src/main/resources/excel/ic_nat_compare_record_template.xlsx

Binary file not shown.

3
epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml

@ -37,7 +37,8 @@
DATA_NAME AS dataName, DATA_NAME AS dataName,
switch_status AS switchStatus, switch_status AS switchStatus,
sort AS sort, sort AS sort,
data_code AS dataCode data_code AS dataCode,
customer_id as customerId
FROM data_sync_config FROM data_sync_config
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
<if test='null != customerId and customerId != "" '> <if test='null != customerId and customerId != "" '>

Loading…
Cancel
Save