feat:医共体

dev_unify
chenhc 3 months ago
parent 691ffb728c
commit 59578f8f8b

@ -140,6 +140,7 @@ public enum BasicExportStatusTimeEnum {
PRODUCE_BUSINESS_DATA("thr_manufacturer", "生产企业数据"),
DRUG_DATA_TASK("drug_data_task", "药品关联信息"),
UNIFY_DATA_TASK("unify_data_task", "医共体信息"),
;
@EnumValue
private String key;

@ -78,6 +78,11 @@ public enum BasicExportTypeEnum {
*
*/
DRUG_DATA_TASK("drug_data_task", "药品关联关系"),
/**
*
*/
UNIFY_DATA("unify_data", "医共体数据"),
;
@EnumValue
private String key;

@ -1,7 +1,13 @@
package com.glxp.api.service.auth;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.dao.auth.AuthAliUserDao;
import com.glxp.api.dao.auth.AuthWarehouseUnifyMapper;
import com.glxp.api.entity.auth.AuthAliUser;
import com.glxp.api.entity.auth.AuthWarehouseUnify;
import com.glxp.api.entity.auth.InvBusUserEntity;
public interface AuthWarehouseUnifyService {
public interface AuthWarehouseUnifyService extends IService<AuthWarehouseUnify> {
void deleteWarehouseCustomer(AuthWarehouseUnify authWarehouseUnify);
}

@ -1,8 +1,12 @@
package com.glxp.api.service.auth.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.dao.auth.AuthWarehouseUnifyMapper;
import com.glxp.api.dao.auth.InvBusUserDao;
import com.glxp.api.entity.auth.AuthWarehouseUnify;
import com.glxp.api.entity.auth.InvBusUserEntity;
import com.glxp.api.service.auth.AuthWarehouseUnifyService;
import com.glxp.api.service.auth.InvBusUserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -10,7 +14,7 @@ import javax.annotation.Resource;
@Service
@Transactional(rollbackFor = Exception.class)
public class AuthWarehouseUnifyServiceImpl implements AuthWarehouseUnifyService {
public class AuthWarehouseUnifyServiceImpl extends ServiceImpl<AuthWarehouseUnifyMapper, AuthWarehouseUnify> implements AuthWarehouseUnifyService {
@Resource
AuthWarehouseUnifyMapper authWarehouseUnifyMapper;

@ -13,7 +13,9 @@ import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.*;
import com.glxp.api.controller.sync.SpsSyncWebSocket;
import com.glxp.api.constant.Constant;
import com.glxp.api.dao.auth.AuthWarehouseUnifyMapper;
import com.glxp.api.dao.basic.BasicProductsDao;
import com.glxp.api.entity.auth.AuthWarehouseUnify;
import com.glxp.api.entity.basic.*;
import com.glxp.api.entity.collect.RelCodeBatch;
import com.glxp.api.entity.collect.RelCodeDetail;
@ -37,6 +39,7 @@ import com.glxp.api.res.sync.SpsSyncDeviceTaskResponse;
import com.glxp.api.res.sync.SpsSyncDrugDataTaskResponse;
import com.glxp.api.res.sync.SpsSyncOrderResponse;
import com.glxp.api.res.system.SyncDataSetResponse;
import com.glxp.api.service.auth.AuthWarehouseUnifyService;
import com.glxp.api.service.basic.*;
import com.glxp.api.service.collect.RelCodeBatchService;
import com.glxp.api.service.collect.RelCodeDetailService;
@ -104,6 +107,8 @@ public class SpsSyncDownloadService {
@Resource
IoOrderInvoiceService orderInvoiceService;
@Resource
AuthWarehouseUnifyService authWarehouseUnifyService;
// 创建单据同步任务
@ -286,6 +291,77 @@ public class SpsSyncDownloadService {
, x -> x.generateDrugDataFile(info, now, false, syncTime)
, x -> x.generateDrugDataFile(info, now, true, syncTime));
break;
case UNIFY_DATA:
basicExportInfoCreate(exportType, syncTime, now
, x -> x.generateUnifyDataFile(info, now, false, syncTime)
, x -> x.generateUnifyDataFile(info, now, true, syncTime));
break;
}
}
private Boolean generateUnifyDataFile(SyncDataSetResponse info, Date now, boolean createFile, Date syncTime) {
BasicExportTypeEnum exportType = BasicExportTypeEnum.UNIFY_DATA;
//文件数据
Map<String, Object> jsonMap = new WeakHashMap<>(4);
List<String> syncFiles = new ArrayList<>();
Map<BasicExportStatusTimeEnum, Map<String, Object>> totalTimeMap = new WeakHashMap<>(10);
StringBuffer remark = new StringBuffer();
Map<String, Object> syncTimeMap = new WeakHashMap<>(3);
syncTimeMap.put("isNew", true);
boolean ge = false;
if (syncTime != null) {
ge = true;
}
try {
//确认有开启设备信息由外向内同步
// if (needExec(info.getDeviceInfo()))
{
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.UNIFY_DATA_TASK, createFile);
totalTimeMap.put(BasicExportStatusTimeEnum.UNIFY_DATA_TASK, map);
List<AuthWarehouseUnify> list = authWarehouseUnifyService.list(Wrappers.lambdaQuery(AuthWarehouseUnify.class)
.le(!ge && (boolean) map.get("isNew"), AuthWarehouseUnify::getUpdateTime, now)
.between(ge, AuthWarehouseUnify::getUpdateTime, syncTime, now)
.between(!ge && !(boolean) map.get("isNew"), AuthWarehouseUnify::getUpdateTime
, map.get("oldDate"), now)
);
if (CollectionUtil.isNotEmpty(list)) {
jsonMap.put(AuthWarehouseUnify.class.getSimpleName(), list);
remark.append("医共体信息:").append(list.size()).append("条\n");
}
}
if (jsonMap.size() > 0) {
jsonMap.put(SYNC_REMARK, remark.toString());
if (!createFile) {
return true;
}
try {
String fileFullPath = writeFile(filePath, exportType.getRemark(), JsonUtils.toJsonString(jsonMap));
try {
//修改任务数据
boolean update = updateExportStatus(exportType, fileFullPath, remark.toString());
} catch (Exception e) {
// 异常回滚
this.exportTimeRollback(totalTimeMap, exportType, fileFullPath);
}
SocketMsgEntity socketMsgEntity = SocketMsgEntity.builder().type(SocketMsgType.DL_ALL_DATA).remark("下载医共体信息").build();
spsSyncWebSocket.sendMessage(socketMsgEntity, "1:" + socketToken);
return true;
} catch (IOException e) {
logger.error(String.format("syncIdcSps----process------------生成[%s]文件及更改库操作异常,异常信息<%s>"
, exportType.getRemark(), e.getMessage()));
// 异常回滚
this.exportTimeRollback(totalTimeMap, exportType, null);
}
}
return false;
} catch (Exception e) {
logger.error(e.getMessage());
return false;
}
}

Loading…
Cancel
Save