|
|
|
@ -43,8 +43,6 @@ public class TBasicServiceImpl implements ITBasicService {
|
|
|
|
|
@Value("${TBasic.url}")
|
|
|
|
|
private String url;
|
|
|
|
|
|
|
|
|
|
private String headers="{\"Content-Type\":\"application/json\",\"domain\":\"b91b0ac7-665f-4874-a282-2f5511a44263\",\"key\":\"WZHBA\"}\n";
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setTBasic() throws Exception {
|
|
|
|
|
//读取配置文件
|
|
|
|
@ -74,7 +72,6 @@ public class TBasicServiceImpl implements ITBasicService {
|
|
|
|
|
//开始时间
|
|
|
|
|
Date beginTime=DateUtil.plusDays(startTime,i);
|
|
|
|
|
String beginTimeStr = DateUtil.format(beginTime, DateUtil.PATTERN_DATETIME);
|
|
|
|
|
log.info("TBasicServiceImpl:beginTimeStr:"+beginTimeStr);
|
|
|
|
|
|
|
|
|
|
//结束时间
|
|
|
|
|
Date endTime = DateUtil.plusDays(beginTime, 1);
|
|
|
|
@ -92,7 +89,10 @@ public class TBasicServiceImpl implements ITBasicService {
|
|
|
|
|
//分页查询
|
|
|
|
|
for(pageNum=1;true;i++){
|
|
|
|
|
//设置请求头信息
|
|
|
|
|
Map<String,String> headerMap = Func.readJson(headers, Map.class);
|
|
|
|
|
Map<String,String> headerMap =new HashMap<>();
|
|
|
|
|
headerMap.put("Content-Type","application/json");
|
|
|
|
|
headerMap.put("domain","b91b0ac7-665f-4874-a282-2f5511a44263");
|
|
|
|
|
headerMap.put("key","WZHBA");
|
|
|
|
|
|
|
|
|
|
//设置请求参数
|
|
|
|
|
Map<String,Object> paramMap = new HashMap<String,Object>(5);
|
|
|
|
@ -113,9 +113,7 @@ public class TBasicServiceImpl implements ITBasicService {
|
|
|
|
|
for(TBasicDto tBasicDto:tBasicDtoList){
|
|
|
|
|
//判断jzh是否重复
|
|
|
|
|
Integer num = tBasicMapper.selectOne(tBasicDto.getJzh());
|
|
|
|
|
if (num>0) {
|
|
|
|
|
throw new Exception("记帐号已存在");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Long patientId = idService.getDateSeq();
|
|
|
|
|
|
|
|
|
|
//数据类型转化,格式处理
|
|
|
|
@ -185,14 +183,19 @@ public class TBasicServiceImpl implements ITBasicService {
|
|
|
|
|
tBasic.setDisDeptName(tBasicDto.getDisDeptName());
|
|
|
|
|
tBasic.setCreateTime(DateUtil.now());
|
|
|
|
|
|
|
|
|
|
//持久化
|
|
|
|
|
tBasicList.add(tBasic);
|
|
|
|
|
if (num>0) {
|
|
|
|
|
tBasicMapper.update(tBasic);
|
|
|
|
|
}else{
|
|
|
|
|
tBasicList.add(tBasic);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.info("TBasicServiceImpl:tBasicList:"+tBasicList);
|
|
|
|
|
//批量插入
|
|
|
|
|
Integer insertBatch = tBasicMapper.insertBatch(tBasicList);
|
|
|
|
|
log.info("TBasicServiceImpl:insertBatch:"+insertBatch);
|
|
|
|
|
if(Func.isNotEmpty(tBasicList)){
|
|
|
|
|
log.info("新增"+tBasicList.size()+"条基础数据开始");
|
|
|
|
|
tBasicMapper.insertBatch(tBasicList);
|
|
|
|
|
log.info("新增"+tBasicList.size()+"条基础数据结束");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//记录页码startTime
|
|
|
|
|
modifyJsonFile(timeConfigFile,"pageNum",pageNum.toString());
|
|
|
|
@ -205,28 +208,6 @@ public class TBasicServiceImpl implements ITBasicService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// public static void main(String[] args) throws IOException {
|
|
|
|
|
// File dir = new File(".");
|
|
|
|
|
// String path ="";
|
|
|
|
|
// path = dir.getCanonicalPath()+"\\timeConfig\\time.json";
|
|
|
|
|
// File timeConfigFile= new File(path);
|
|
|
|
|
// InputStream inputstream =null;
|
|
|
|
|
// if(timeConfigFile.isFile()){
|
|
|
|
|
// inputstream=new FileInputStream(timeConfigFile);
|
|
|
|
|
// }
|
|
|
|
|
// byte[] bytes = IOUtils.toByteArray(inputstream);
|
|
|
|
|
// String timeJson = new String(bytes);
|
|
|
|
|
//
|
|
|
|
|
// String str1=timeJson.substring(0,timeJson.indexOf("startTime"));
|
|
|
|
|
// String str2=timeJson.substring(timeJson.indexOf("startTime"));
|
|
|
|
|
// String str3=str2.substring(0,str2.indexOf(":")+2);
|
|
|
|
|
// String str4=str2.substring(str2.indexOf(":")+2);
|
|
|
|
|
// String str5=str4.substring(str4.indexOf("\""));
|
|
|
|
|
// System.out.println(str1+str3+str5);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void modifyJsonFile(File file, String key, String value) {
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
//记录替换所在的行
|
|
|
|
|