自动下载,或手动下载第三方产品信息,自动导入到耗材字典

fengcang
anthonyywj2 3 years ago
parent fef9a9707c
commit c088c32e37

@ -119,6 +119,9 @@ public class UdiContrastService {
}
@Resource
GennerOrderUtils gennerOrderUtils;
@Resource

@ -43,6 +43,8 @@ public interface UdiRelevanceService {
UdiRelevanceEntity selectUpdateByThirdId(String thirdId);
UdiRelevanceEntity selectByMainIdLimitOne(String mainId);
List<UdiRelevanceResponse> selectByMainId(String mainId);
UdiRelevanceEntity selectUpteaByAll(String uuid, String thirdId);

@ -199,6 +199,16 @@ public class UdiRelevanceServiceImpl implements UdiRelevanceService {
return null;
}
@Override
public UdiRelevanceEntity selectByMainIdLimitOne(String mainId) {
if (mainId == null)
return null;
FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest();
filterUdiInfoRequest.setMainId(mainId);
return udiRelevanceDao.selectByThirdId(filterUdiInfoRequest);
}
@Override
public List<UdiRelevanceResponse> selectByMainId(String mainId) {
FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest();

@ -69,8 +69,6 @@ public class DownloadThirdSysDataTask implements SchedulingConfigurer {
private BussinessOriginTypeService bussinessOriginTypeService;
@Resource
private BasicThirdSysDetailDao basicThirdSysDetailDao;
@Resource
private BasicThirdSysService basicThirdSysService;
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
@ -80,9 +78,6 @@ public class DownloadThirdSysDataTask implements SchedulingConfigurer {
scheduledRequest.setCronName("downThirdSysDataTask");
ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest);
String cron = scheduledEntity.getCron();
if (cron.isEmpty()) {
log.error("cron is null");
}
return new CronTrigger(cron).nextExecutionTime(triggerContext);
});
}

@ -7,7 +7,10 @@ import com.alibaba.fastjson.TypeReference;
import com.glxp.api.admin.config.WebSocketServer;
import com.glxp.api.admin.constant.BasicProcessStatus;
import com.glxp.api.admin.constant.Constant;
import com.glxp.api.admin.dao.basic.UdiRelevanceDao;
import com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity;
import com.glxp.api.admin.entity.basic.BasicThirdSysEntity;
import com.glxp.api.admin.entity.basic.UdiRelevanceEntity;
import com.glxp.api.admin.entity.info.SyncDataSetEntity;
import com.glxp.api.admin.entity.thrsys.ThrProductsEntity;
import com.glxp.api.admin.entity.thrsys.ThrProductsExportLogEntity;
@ -22,6 +25,9 @@ import com.glxp.api.admin.req.thrsys.ThrProductsExportRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.res.basic.ErpProductsResponse;
import com.glxp.api.admin.service.basic.BasicThirdSysDetailService;
import com.glxp.api.admin.service.basic.BasicThirdSysService;
import com.glxp.api.admin.service.basic.UdiContrastService;
import com.glxp.api.admin.service.basic.UdiRelevanceService;
import com.glxp.api.admin.service.info.SyncDataSetService;
import com.glxp.api.admin.service.thrsys.ThrProductsExportLogService;
import com.glxp.api.admin.service.thrsys.ThrProductsImportDetailService;
@ -67,6 +73,12 @@ public class ThrProductsDlService {
ThrProductsExportLogService thrProductsExportLogService;
@Resource
private ErpBasicClient erpBasicClient;
@Resource
private BasicThirdSysService basicThirdSysService;
@Resource
private UdiRelevanceService udiRelevanceService;
@Resource
private UdiContrastService udiContrastService;
@Async
public void importSelectProducrs(String genKey, List<ThrProductsEntity> thrProductsEntities, String thirdSys) {
@ -142,6 +154,15 @@ public class ThrProductsDlService {
for (List<ThrProductsEntity> data : splitList) {
thrProductsService.insertThrProductss(data);
}
BasicThirdSysEntity basicThirdSysEntity = basicThirdSysService.selectMainThrSys();
if (filterThrProductsRequest.getThirdSysFk().equals(basicThirdSysEntity.getThirdId())) {
for (ThrProductsEntity thrProductsEntity : thrProductsEntities) {
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByMainIdLimitOne(thrProductsEntity.getCode());
if (udiRelevanceEntity == null) {
udiContrastService.createOnlyMainId(thrProductsEntity.getCode());
}
}
}
redisUtil.set(Constant.dlThrProducts, "false");
thrProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
thrProductsImportLogService.updateImportLog(thrProductsImportLogEntity);

Loading…
Cancel
Save