全部bug修复

master
anthonywj 4 years ago
parent 17b0308116
commit 1005c7d362

@ -0,0 +1,9 @@
package com.glxp.api.admin.constant;
public class SetupType {
public static final int THRSYS_DATA_API_REALTIME = 0;
public static final int THRSYS_DATA_API_CACHE = 3;
public static final int THRSYS_DATA_FILE_CACHE = 2;
public static final int THRSYS_DATA_UPLOAD_CACHE = 1;
}

@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo;
import com.glxp.api.admin.annotation.AuthRuleAnnotation;
import com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity;
import com.glxp.api.admin.entity.basic.BasicThirdSysEntity;
import com.glxp.api.admin.entity.info.SystemParamConfigEntity;
import com.glxp.api.admin.req.basic.FilterBasicThirdSysDetailRequest;
import com.glxp.api.admin.req.basic.FilterBasicThirdSysRequest;
import com.glxp.api.admin.req.thrsys.FilterThrOrderDetailRequest;
@ -14,6 +15,7 @@ import com.glxp.api.admin.service.basic.BasicThirdSysDetailService;
import com.glxp.api.admin.service.basic.BasicThirdSysService;
import com.glxp.api.admin.service.basic.UdiRelevanceService;
import com.glxp.api.admin.service.basic.UnitMaintainService;
import com.glxp.api.admin.service.info.SystemParamConfigService;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
@ -42,6 +44,8 @@ public class BasicThirdSysController {
UdiRelevanceService udiRelevanceService;
@Resource
UnitMaintainService unitMaintainService;
@Resource
SystemParamConfigService systemParamConfigService;
@GetMapping("/udiwms/basic/thirdsys/filter")
public BaseResponse filter(FilterBasicThirdSysRequest filterBasicThirdSysRequest,
@ -51,6 +55,14 @@ public class BasicThirdSysController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<BasicThirdSysEntity> basicThirdSysEntities;
// if (filterBasicThirdSysRequest.getFilter() != null && filterBasicThirdSysRequest.getFilter()) {
//
// SystemParamConfigEntity thirdSys = systemParamConfigService.selectByParamKey("erp_updateErpData_thirdSys");
// if (thirdSys != null) {
// filterBasicThirdSysRequest.setThirdId(thirdSys.getParamValue());
// filterBasicThirdSysRequest.setMainSys(null);
// }
// }
basicThirdSysEntities = basicThirdSysService.filterBasicThiSys(filterBasicThirdSysRequest);
PageInfo<BasicThirdSysEntity> pageInfo;
pageInfo = new PageInfo<>(basicThirdSysEntities);
@ -78,9 +90,9 @@ public class BasicThirdSysController {
BeanUtils.copyProperties(item, basicThirdSysResponse);
return basicThirdSysResponse;
}).collect(Collectors.toList());
basicThirdSysResponses.add(new BasicThirdSysResponse("ybbm","医保编码"));
basicThirdSysResponses.add(new BasicThirdSysResponse("sptm","商品条码"));
basicThirdSysResponses.add(new BasicThirdSysResponse("udiCode","UDI最小销售标识"));
basicThirdSysResponses.add(new BasicThirdSysResponse("ybbm", "医保编码"));
basicThirdSysResponses.add(new BasicThirdSysResponse("sptm", "商品条码"));
basicThirdSysResponses.add(new BasicThirdSysResponse("udiCode", "UDI最小销售标识"));
return ResultVOUtils.success(basicThirdSysResponses);
}

@ -9,24 +9,20 @@ import com.glxp.api.admin.entity.basic.UdiRelevanceEntity;
import com.glxp.api.admin.entity.info.SystemParamConfigEntity;
import com.glxp.api.admin.entity.thrsys.ThrCorpEntity;
import com.glxp.api.admin.httpclient.ErpBasicClient;
import com.glxp.api.admin.req.basic.BasicUnitMaintainFilterRequest;
import com.glxp.api.admin.req.basic.CombineSingleUnitRequest;
import com.glxp.api.admin.req.basic.FilterBasicThirdSysRequest;
import com.glxp.api.admin.req.basic.FilterUdiInfoRequest;
import com.glxp.api.admin.req.basic.*;
import com.glxp.api.admin.req.inout.DeleteRequest;
import com.glxp.api.admin.req.receipt.CombineUnitRequest;
import com.glxp.api.admin.req.thrsys.FilterThrCorpRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.res.basic.BasicProductThirdSysResponse;
import com.glxp.api.admin.res.basic.BasicUnitMaintainResponse;
import com.glxp.api.admin.res.basic.ErpUnitsResponse;
import com.glxp.api.admin.res.basic.SrtBasicUnitResponse;
import com.glxp.api.admin.res.basic.*;
import com.glxp.api.admin.res.inout.WarehouseResponse;
import com.glxp.api.admin.service.basic.BasicThirdSysDetailService;
import com.glxp.api.admin.service.basic.BasicThirdSysService;
import com.glxp.api.admin.service.basic.BasicUnitMaintainService;
import com.glxp.api.admin.service.info.SystemParamConfigService;
import com.glxp.api.admin.service.thrsys.ThrCorpService;
import com.glxp.api.admin.thread.BasicUnitImportService;
import com.glxp.api.admin.util.CustomUtil;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
@ -41,10 +37,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -63,6 +56,8 @@ public class BasicUnitMaintainController {
private BasicThirdSysService basicThirdSysService;
@Resource
private ThrCorpService thrCorpService;
@Resource
BasicUnitImportService basicUnitImportService;
@GetMapping("/udiwms/basic/unit/maintain/filter")
public BaseResponse filterBasicUnitMaintain(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest,
@ -101,7 +96,7 @@ public class BasicUnitMaintainController {
BasicUnitMaintainEntity basicUnitMaintainEntity = new BasicUnitMaintainEntity();
BeanUtils.copyProperties(basicUnitMaintainSaveRequest, basicUnitMaintainEntity);
basicUnitMaintainEntity.setErpId(CustomUtil.getId());
boolean b = basicUnitMaintainService.insertBasicUnitMaintain(basicUnitMaintainEntity);
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
@ -198,19 +193,41 @@ public class BasicUnitMaintainController {
basicUnitMaintainEntity.setThirdName4(erpUnitsResponse.getName());
}
}
basicUnitMaintainEntity.setErpId(erpUnitsResponse.getId());
basicUnitMaintainEntity.setErpId(CustomUtil.getId());
basicUnitMaintainEntity.setName(erpUnitsResponse.getName());
basicUnitMaintainEntity.setSpell(erpUnitsResponse.getSpell());
basicUnitMaintainEntity.setAddr(erpUnitsResponse.getAddr());
basicUnitMaintainEntity.setCreditNo(erpUnitsResponse.getCreditNo());
basicUnitMaintainEntity.setContact(erpUnitsResponse.getContact());
basicUnitMaintainEntity.setMobile(erpUnitsResponse.getMobile());
basicUnitMaintainEntity.setUpdateTime(new Date());
basicUnitMaintainService.insertBasicUnitMaintain(basicUnitMaintainEntity);
}
}
return ResultVOUtils.success("选入成功");
}
@GetMapping("/udiwms/basic/unit/maintain/combineAll")
public BaseResponse combineAll(BasicUnitMaintainFilterRequest unitMaintainFilterRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("corpUrl", unitMaintainFilterRequest.getThirdSys());
if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null)
return ResultVOUtils.error(500, "往来单位接口地址未定义");
if (basicThirdSysDetailEntity.getEnabled()) {
basicUnitImportService.selectAllUnit(basicThirdSysDetailEntity, unitMaintainFilterRequest);
} else {
return ResultVOUtils.error(500, "第三方往来单位服务未启用");
}
return ResultVOUtils.success("后台正在添加,请稍后刷新查看!");
}
@PostMapping("/udiwms/basic/unit/maintain/combineSingle")
public BaseResponse combineSingle(@RequestBody CombineSingleUnitRequest combineRequest, BindingResult bindingResult) {
@ -219,29 +236,61 @@ public class BasicUnitMaintainController {
}
ErpUnitsResponse erpUnitsResponse = combineRequest.getErpUnitsResponse();
BasicUnitMaintainEntity basicUnitMaintainEntity = new BasicUnitMaintainEntity();
basicUnitMaintainEntity.setId(Integer.parseInt(combineRequest.getKey()));
if (combineRequest.getThirdSys() != null) {
if ("thirdId".equals(combineRequest.getThirdSys())) {
basicUnitMaintainEntity.setThirdId(combineRequest.getKey());
basicUnitMaintainEntity.setThirdId(erpUnitsResponse.getId());
basicUnitMaintainEntity.setThirdName(erpUnitsResponse.getName());
} else if ("thirdId1".equals(combineRequest.getThirdSys())) {
basicUnitMaintainEntity.setThirdId1(combineRequest.getKey());
basicUnitMaintainEntity.setThirdId1(erpUnitsResponse.getId());
basicUnitMaintainEntity.setThirdName1(erpUnitsResponse.getName());
} else if ("thirdId2".equals(combineRequest.getThirdSys())) {
basicUnitMaintainEntity.setThirdId2(combineRequest.getKey());
basicUnitMaintainEntity.setThirdId2(erpUnitsResponse.getId());
basicUnitMaintainEntity.setThirdName2(erpUnitsResponse.getName());
} else if ("thirdId3".equals(combineRequest.getThirdSys())) {
basicUnitMaintainEntity.setThirdId3(combineRequest.getKey());
basicUnitMaintainEntity.setThirdId3(erpUnitsResponse.getId());
basicUnitMaintainEntity.setThirdName3(erpUnitsResponse.getName());
} else if ("thirdId4".equals(combineRequest.getThirdSys())) {
basicUnitMaintainEntity.setThirdId4(combineRequest.getKey());
basicUnitMaintainEntity.setThirdId4(erpUnitsResponse.getId());
basicUnitMaintainEntity.setThirdName4(erpUnitsResponse.getName());
}
}
basicUnitMaintainEntity.setName(erpUnitsResponse.getName());
basicUnitMaintainEntity.setSpell(erpUnitsResponse.getSpell());
basicUnitMaintainEntity.setAddr(erpUnitsResponse.getAddr());
basicUnitMaintainEntity.setCreditNo(erpUnitsResponse.getCreditNo());
basicUnitMaintainEntity.setContact(erpUnitsResponse.getContact());
basicUnitMaintainEntity.setMobile(erpUnitsResponse.getMobile());
basicUnitMaintainEntity.setThirdName(erpUnitsResponse.getName());
// basicUnitMaintainEntity.setSpell(erpUnitsResponse.getSpell());
// basicUnitMaintainEntity.setAddr(erpUnitsResponse.getAddr());
// basicUnitMaintainEntity.setCreditNo(erpUnitsResponse.getCreditNo());
// basicUnitMaintainEntity.setContact(erpUnitsResponse.getContact());
// basicUnitMaintainEntity.setMobile(erpUnitsResponse.getMobile());
basicUnitMaintainService.updateById(basicUnitMaintainEntity);
return ResultVOUtils.success("关联成功");
}
//解除绑定
@GetMapping("/udiwms/unit/thirdSys/removeRl")
public BaseResponse uploadThirdServcie(RemoveRelRequest removeRelRequest) {
BasicUnitMaintainEntity udiRelevanceEntity = basicUnitMaintainService.selectById(removeRelRequest.getRelId());
if (removeRelRequest.getThirdSys().equals("thirdId")) {
udiRelevanceEntity.setThirdId("");
udiRelevanceEntity.setThirdName("");
} else if (removeRelRequest.getThirdSys().equals("thirdId1")) {
udiRelevanceEntity.setThirdId1("");
udiRelevanceEntity.setThirdName1("");
} else if (removeRelRequest.getThirdSys().equals("thirdId2")) {
udiRelevanceEntity.setThirdId2("");
udiRelevanceEntity.setThirdName2("");
} else if (removeRelRequest.getThirdSys().equals("thirdId3")) {
udiRelevanceEntity.setThirdId3("");
udiRelevanceEntity.setThirdName3("");
} else if (removeRelRequest.getThirdSys().equals("thirdId4")) {
udiRelevanceEntity.setThirdId4("");
udiRelevanceEntity.setThirdName4("");
}
basicUnitMaintainService.updateById(udiRelevanceEntity);
return ResultVOUtils.success("解除绑定成功!");
}
@PostMapping("/udiwms/basic/unit/maintain/delete")
public BaseResponse deleteBasicUnitMaintain(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
@ -268,10 +317,25 @@ public class BasicUnitMaintainController {
if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null)
return ResultVOUtils.error(500, "往来单位接口地址未定义");
if (basicThirdSysDetailEntity.getEnabled()) {
if (basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if (basicThirdSysDetailEntity.getFromType() == 0 || (unitMaintainFilterRequest.getIsDownThrSys() != null && unitMaintainFilterRequest.getIsDownThrSys())) {
BaseResponse<PageSimpleResponse<ErpUnitsResponse>> udiDlDeviceResponse =
new ErpBasicClient().getErpCrop(unitMaintainFilterRequest, basicThirdSysDetailEntity.getValue());
return udiDlDeviceResponse;
if (udiDlDeviceResponse.getCode() == 20000) {
for (ErpUnitsResponse erpUnitsResponse : udiDlDeviceResponse.getData().getList()) {
BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByThirdId(erpUnitsResponse.getId(), unitMaintainFilterRequest.getThirdSys());
if (basicUnitMaintainEntity != null) {
erpUnitsResponse.setChecked(true);
} else {
erpUnitsResponse.setChecked(false);
}
}
return udiDlDeviceResponse;
} else {
return udiDlDeviceResponse;
}
} else {
FilterThrCorpRequest filterThrCorpRequest = new FilterThrCorpRequest();
BeanUtils.copyProperties(unitMaintainFilterRequest, filterThrCorpRequest);
@ -282,6 +346,12 @@ public class BasicUnitMaintainController {
{
ThrCorpEntity thrCorpEntity = new ThrCorpEntity();
BeanUtils.copyProperties(item, thrCorpEntity);
BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByThirdId(item.getUnitId(), unitMaintainFilterRequest.getThirdSys());
if (basicUnitMaintainEntity != null) {
thrCorpEntity.setChecked(true);
} else {
thrCorpEntity.setChecked(false);
}
thrCorpEntity.setId(item.getUnitId());
return thrCorpEntity;
}).collect(Collectors.toList());
@ -313,52 +383,56 @@ public class BasicUnitMaintainController {
filterBasicThirdSysRequest.setEnabled(true);
List<BasicThirdSysEntity> basicThirdSysEntities = basicThirdSysService.filterBasicThiSys(filterBasicThirdSysRequest);
List<BasicProductThirdSysResponse> basicProductThirdSysResponses = new ArrayList<>();
if (basicUnitMaintainEntity.getThirdId() != null) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
BasicThirdSysEntity basicThirdSysEntity = filterThirdSys("thirdId", basicThirdSysEntities);
if (basicThirdSysEntity != null)
for (BasicThirdSysEntity basicThirdSysEntity : basicThirdSysEntities) {
if (basicThirdSysEntity.getThirdId().equals("thirdId")) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
basicProductThirdSysResponse.setSysId(basicThirdSysEntity.getThirdId());
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
basicProductThirdSysResponse.setThirdId(basicUnitMaintainEntity.getThirdId());
basicProductThirdSysResponse.setThirdName(basicUnitMaintainEntity.getThirdName());
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
if (basicUnitMaintainEntity.getThirdId1() != null) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
BasicThirdSysEntity basicThirdSysEntity = filterThirdSys("thirdId1", basicThirdSysEntities);
if (basicThirdSysEntity != null)
if (basicUnitMaintainEntity != null) {
basicProductThirdSysResponse.setThirdId(basicUnitMaintainEntity.getThirdId());
basicProductThirdSysResponse.setThirdName(basicUnitMaintainEntity.getThirdName());
}
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
} else if (basicThirdSysEntity.getThirdId().equals("thirdId1")) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
basicProductThirdSysResponse.setSysId(basicThirdSysEntity.getThirdId());
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
basicProductThirdSysResponse.setThirdId(basicUnitMaintainEntity.getThirdId());
basicProductThirdSysResponse.setThirdName(basicUnitMaintainEntity.getThirdName());
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
if (basicUnitMaintainEntity.getThirdId2() != null) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
BasicThirdSysEntity basicThirdSysEntity = filterThirdSys("thirdId2", basicThirdSysEntities);
if (basicThirdSysEntity != null)
if (basicUnitMaintainEntity != null) {
basicProductThirdSysResponse.setThirdId(basicUnitMaintainEntity.getThirdId1());
basicProductThirdSysResponse.setThirdName(basicUnitMaintainEntity.getThirdName1());
}
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
} else if (basicThirdSysEntity.getThirdId().equals("thirdId2")) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
basicProductThirdSysResponse.setSysId(basicThirdSysEntity.getThirdId());
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
basicProductThirdSysResponse.setThirdId(basicUnitMaintainEntity.getThirdId());
basicProductThirdSysResponse.setThirdName(basicUnitMaintainEntity.getThirdName());
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
if (basicUnitMaintainEntity.getThirdId3() != null) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
BasicThirdSysEntity basicThirdSysEntity = filterThirdSys("thirdId3", basicThirdSysEntities);
if (basicThirdSysEntity != null)
if (basicUnitMaintainEntity != null) {
basicProductThirdSysResponse.setThirdId(basicUnitMaintainEntity.getThirdId2());
basicProductThirdSysResponse.setThirdName(basicUnitMaintainEntity.getThirdName2());
}
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
} else if (basicThirdSysEntity.getThirdId().equals("thirdId3")) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
basicProductThirdSysResponse.setSysId(basicThirdSysEntity.getThirdId());
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
basicProductThirdSysResponse.setThirdId(basicUnitMaintainEntity.getThirdId());
basicProductThirdSysResponse.setThirdName(basicUnitMaintainEntity.getThirdName());
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
if (basicUnitMaintainEntity.getThirdId4() != null) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
BasicThirdSysEntity basicThirdSysEntity = filterThirdSys("thirdId4", basicThirdSysEntities);
if (basicThirdSysEntity != null)
if (basicUnitMaintainEntity != null) {
basicProductThirdSysResponse.setThirdId(basicUnitMaintainEntity.getThirdId3());
basicProductThirdSysResponse.setThirdName(basicUnitMaintainEntity.getThirdName3());
}
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
} else if (basicThirdSysEntity.getThirdId().equals("thirdId4")) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
basicProductThirdSysResponse.setSysId(basicThirdSysEntity.getThirdId());
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
basicProductThirdSysResponse.setThirdId(basicUnitMaintainEntity.getThirdId());
basicProductThirdSysResponse.setThirdName(basicUnitMaintainEntity.getThirdName());
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
if (basicUnitMaintainEntity != null) {
basicProductThirdSysResponse.setThirdId(basicUnitMaintainEntity.getThirdId4());
basicProductThirdSysResponse.setThirdName(basicUnitMaintainEntity.getThirdName4());
}
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
}
PageInfo<BasicProductThirdSysResponse> pageInfo;
pageInfo = new PageInfo<>(basicProductThirdSysResponses);
PageSimpleResponse<BasicProductThirdSysResponse> pageSimpleResponse = new PageSimpleResponse<>();

@ -1,11 +1,13 @@
package com.glxp.api.admin.controller.basic;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.github.pagehelper.PageInfo;
import com.glxp.api.admin.entity.basic.*;
import com.glxp.api.admin.entity.info.SystemParamConfigEntity;
import com.glxp.api.admin.entity.thrsys.ThrProductsEntity;
import com.glxp.api.admin.httpclient.ErpBasicClient;
import com.glxp.api.admin.httpclient.ErpOrderClient;
import com.glxp.api.admin.req.basic.FilterErpGoodsRequest;
import com.glxp.api.admin.req.basic.FilterUdiInfoRequest;
import com.glxp.api.admin.req.info.SystemParamConfigRequest;
@ -56,14 +58,17 @@ public class UdiInfoController {
String nameCode = null;
if (productInfoFilterRequest.getNameCode() != null) {
UdiEntity udiEntity = FilterUdiUtils.getUdi(productInfoFilterRequest.getNameCode());
if (productInfoFilterRequest.getUdiCode() != null && !productInfoFilterRequest.getUdiCode().equals("")) {
UdiEntity udiEntity = FilterUdiUtils.getUdi(productInfoFilterRequest.getUdiCode());
if (udiEntity != null) {
nameCode = udiEntity.getUdi();
} else {
nameCode = productInfoFilterRequest.getNameCode();
return ResultVOUtils.error(500, "无效UDI码");
// nameCode = productInfoFilterRequest.getNameCode();
}
}
} else
nameCode = productInfoFilterRequest.getNameCode();
Map<String, Object> paramMap = new HashMap<>(16);
paramMap.put("page", productInfoFilterRequest.getPage());
paramMap.put("limit", productInfoFilterRequest.getLimit());
@ -71,11 +76,63 @@ public class UdiInfoController {
paramMap.put("cpmctymc", productInfoFilterRequest.getCpmctymc());
paramMap.put("nameCode", nameCode);
paramMap.put("ggxh", productInfoFilterRequest.getGgxh());
paramMap.put("zczbhhzbapzbh", productInfoFilterRequest.getZczbhhzbapzbh());
paramMap.put("uuid", productInfoFilterRequest.getUuid());
String response = HttpClient.mipsGet(udiUrl + "/udidl/device/filterUdi", paramMap);
try {
BaseResponse<PageSimpleResponse<UdiInfoEntity>> udiDlDeviceResponse = (BaseResponse<PageSimpleResponse<UdiInfoEntity>>) JSONObject.parseObject(response, BaseResponse.class);
BaseResponse<PageSimpleResponse<UdiInfoEntity>> udiDlDeviceResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<UdiInfoEntity>>>() {
});
if (productInfoFilterRequest.getIsCheck() != null && productInfoFilterRequest.getIsCheck()) {
List<UdiInfoEntity> udiInfoEntities = udiDlDeviceResponse.getData().getList();
if (udiInfoEntities != null && udiInfoEntities.size() > 0) {
for (UdiInfoEntity udiInfoEntity : udiInfoEntities) {
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(udiInfoEntity.getUuid());
if (udiRelevanceEntities != null && udiRelevanceEntities.size() > 0) {
for(UdiRelevanceEntity udiRelevanceEntity:udiRelevanceEntities){
if (udiRelevanceEntity.getThirdId() == null &&
udiRelevanceEntity.getThirdId2() == null && udiRelevanceEntity.getThirdId1() == null &&
udiRelevanceEntity.getThirdId3() == null && udiRelevanceEntity.getThirdId4() == null) {
//不能添加
udiInfoEntity.setCheck(true);
break;
} else
udiInfoEntity.setCheck(false);
}
} else {
udiInfoEntity.setCheck(false);
}
}
}
}
return udiDlDeviceResponse;
} catch (Exception e) {
e.printStackTrace();
return ResultVOUtils.error(500, "连接UDI数据下载服务出错");
}
}
//获取同步库医疗器械注册人信息
@GetMapping("udiwms/udiinfo/filterCompany")
public BaseResponse filterCompany(FilterUdiInfoRequest productInfoFilterRequest) {
Map<String, Object> paramMap = new HashMap<>(16);
paramMap.put("page", productInfoFilterRequest.getPage());
paramMap.put("limit", productInfoFilterRequest.getLimit());
paramMap.put("ylqxzcrbarmc", productInfoFilterRequest.getYlqxzcrbarmc());
String response = HttpClient.mipsGet(udiUrl + "/udi/company/filter", paramMap);
try {
BaseResponse<PageSimpleResponse<UdiCompanyEntity>> udiDlDeviceResponse = (BaseResponse<PageSimpleResponse<UdiCompanyEntity>>) JSONObject.parseObject(response, BaseResponse.class);
return udiDlDeviceResponse;
} catch (Exception e) {
e.printStackTrace();
@ -102,15 +159,19 @@ public class UdiInfoController {
BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("piQueryUrl", filterErpGoodsRequest.getThirdSys());
if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null)
return ResultVOUtils.error(500, "ERP产品信息接口地址未定义");
if(basicThirdSysDetailEntity.getEnabled() ){
if ( basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if (basicThirdSysDetailEntity.getEnabled()) {
if (basicThirdSysDetailEntity.getFromType() == 0 || (filterErpGoodsRequest.getIsDownThrSys() != null && filterErpGoodsRequest.getIsDownThrSys())) {
ErpBasicClient erpBasicHttpClient = new ErpBasicClient();
BaseResponse<PageSimpleResponse<ErpProductsResponse>> udiDlDeviceResponse = erpBasicHttpClient.getErpProducts(filterErpGoodsRequest, basicThirdSysDetailEntity.getValue());
if (udiDlDeviceResponse.getCode() == 20000) {
List<ErpProductsResponse> invmandocResponses = udiDlDeviceResponse.getData().getList();
if(invmandocResponses != null){
if (invmandocResponses != null) {
for (ErpProductsResponse invmandocResponse : invmandocResponses) {
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByThirdId(invmandocResponse.getCode(),filterErpGoodsRequest.getThirdSys());
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByThirdId(invmandocResponse.getCode(), filterErpGoodsRequest.getThirdSys());
invmandocResponse.setThirdSys(filterErpGoodsRequest.getThirdSys());
if (udiRelevanceEntity != null) {
invmandocResponse.setChecked(true);
@ -125,8 +186,22 @@ public class UdiInfoController {
} else {
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
BeanUtils.copyProperties(filterErpGoodsRequest, filterThrProductsRequest);
filterThrProductsRequest.setUnionCode(filterErpGoodsRequest.getCode());
filterThrProductsRequest.setCode(null);
List<ThrProductsEntity> thrCorpEntities
= thrProductsService.filterThrProductsRequest(filterThrProductsRequest);
for (ThrProductsEntity thrProductsEntity : thrCorpEntities) {
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByThirdId(thrProductsEntity.getCode(), thrProductsEntity.getThirdSysFk());
if (udiRelevanceEntity != null) {
thrProductsEntity.setChecked(true);
} else {
thrProductsEntity.setChecked(false);
}
}
PageInfo<ThrProductsEntity> pageInfo;
pageInfo = new PageInfo<>(thrCorpEntities);
PageSimpleResponse<ThrProductsEntity> pageSimpleResponse = new PageSimpleResponse<>();
@ -134,12 +209,10 @@ public class UdiInfoController {
pageSimpleResponse.setList(thrCorpEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
}else {
} else {
return ResultVOUtils.error(500, "第三方产品信息服务未启用");
}
}
}

@ -306,5 +306,24 @@ public class UdiInfoImportLogController {
return ResultVOUtils.success("上传成功");
}
//供应商平台产品信息下载
@GetMapping("/udiwms/products/smp/download")
public BaseResponse downloadSmpUdi(FilterUdiIpLogRequest filterUdiIpLogRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
String genKey = CustomUtil.getId();
UdiInfoImportLogEntity udiInfoImportLogEntity = new UdiInfoImportLogEntity();
udiInfoImportLogEntity.setGenKey(genKey);
udiInfoImportLogEntity.setFromType("供应商平台下载");
udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_UNPROCESS);
udiInfoImportLogEntity.setUpdateTime(new java.util.Date());
udiInfoImportLogService.insertImportLog(udiInfoImportLogEntity);
basicUdiInfoImportService.downloadSmpUdiInfo(genKey);
return ResultVOUtils.success("后台已开始下载并更新,请稍后刷新查看!");
}
}

@ -4,28 +4,28 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.github.pagehelper.PageInfo;
import com.glxp.api.admin.config.WebSocketServer;
import com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity;
import com.glxp.api.admin.entity.basic.BasicThirdSysEntity;
import com.glxp.api.admin.entity.basic.UdiInfoEntity;
import com.glxp.api.admin.entity.basic.UdiRelevanceEntity;
import com.glxp.api.admin.entity.basic.*;
import com.glxp.api.admin.entity.info.SystemParamConfigEntity;
import com.glxp.api.admin.entity.inout.WarehouseEntity;
import com.glxp.api.admin.entity.thrsys.ThrProductsEntity;
import com.glxp.api.admin.httpclient.UdiDlHttpClient;
import com.glxp.api.admin.req.basic.*;
import com.glxp.api.admin.req.inout.DeleteRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.res.basic.BasicProductThirdSysResponse;
import com.glxp.api.admin.res.basic.UdiRelevanceResponse;
import com.glxp.api.admin.res.inout.WarehouseResponse;
import com.glxp.api.admin.service.basic.BasicThirdSysDetailService;
import com.glxp.api.admin.service.basic.BasicThirdSysService;
import com.glxp.api.admin.service.basic.UdiInfoService;
import com.glxp.api.admin.service.basic.UdiRelevanceService;
import com.glxp.api.admin.service.info.SystemParamConfigService;
import com.glxp.api.admin.service.inout.CodesService;
import com.glxp.api.admin.thread.BasicUpdateproductService;
import com.glxp.api.admin.service.thrsys.ThrDataService;
import com.glxp.api.admin.thread.BasicBackUpdateProductService;
import com.glxp.api.admin.thread.BasicUpdateProductService;
import com.glxp.api.admin.util.CustomUtil;
import com.glxp.api.admin.util.DateUtil;
import com.glxp.api.admin.util.FilterUdiUtils;
import com.glxp.api.admin.util.HttpClient;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
@ -40,7 +40,9 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@RestController
@ -53,7 +55,9 @@ public class UdiRelevanceController {
@Resource
UdiInfoService udiInfoService;
@Resource
BasicUpdateproductService updateproductService;
BasicBackUpdateProductService updateproductService;
@Resource
BasicUpdateProductService basicUpdateProductService;
@Resource
CodesService warehouseService;
@Resource
@ -62,6 +66,8 @@ public class UdiRelevanceController {
private BasicThirdSysService basicThirdSysService;
@Resource
BasicThirdSysDetailService basicThirdSysDetailService;
@Resource
ThrDataService thrDataService;
//客户端器械信息下载
@GetMapping("/udi/udirel/download")
@ -92,14 +98,23 @@ public class UdiRelevanceController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<UdiRelevanceResponse> udiRelevanceResponses = null;
udiRelevanceResponses = udiRelevanceService.filterUdiGp(filterUdiInfoRequest);
if (udiRelevanceResponses != null && udiRelevanceResponses.size() > 0) {
for (UdiRelevanceResponse udiRelevanceResponse : udiRelevanceResponses) {
if (udiRelevanceResponse.getDiType() == 2 && udiRelevanceResponse.getIsUseDy() != 1) {
udiRelevanceResponse.setNameCode(udiRelevanceResponse.getSjcpbm());
}
}
filterUdiInfoRequest.setDiType(1);
if (filterUdiInfoRequest.getUdiCode() != null && !filterUdiInfoRequest.getUdiCode().isEmpty()) {
UdiEntity udiEntity = FilterUdiUtils.getUdi(filterUdiInfoRequest.getUdiCode());
filterUdiInfoRequest.setNameCode(udiEntity.getUdi());
}
udiRelevanceResponses = udiRelevanceService.filterUdiGp(filterUdiInfoRequest);
// if (udiRelevanceResponses != null && udiRelevanceResponses.size() > 0) {
// for (UdiRelevanceResponse udiRelevanceResponse : udiRelevanceResponses) {
// if (udiRelevanceResponse.getDiType() == 2 && udiRelevanceResponse.getIsUseDy() != 1) {
// udiRelevanceResponse.setNameCode(udiRelevanceResponse.getSjcpbm());
// }
// }
// }
PageInfo<UdiRelevanceResponse> pageInfo;
pageInfo = new PageInfo<>(udiRelevanceResponses);
PageSimpleResponse<UdiRelevanceResponse> pageSimpleResponse = new PageSimpleResponse<>();
@ -124,7 +139,7 @@ public class UdiRelevanceController {
return ResultVOUtils.error(500, "ERP产品信息接口地址未定义");
if (invPiDetailEntity == null || invPiDetailEntity.getValue() == null)
return ResultVOUtils.error(500, "ERP库存产品信息接口地址未定义");
updateproductService.updateProduct(piDetailEntity.getValue(), invPiDetailEntity.getValue(),thirdSysId);
// updateproductService.(piDetailEntity.getValue(), invPiDetailEntity.getValue(), thirdSysId,true);
return ResultVOUtils.success("后台已开启下载更新,请稍后刷新查看!");
}
@ -163,10 +178,13 @@ public class UdiRelevanceController {
}
}
}
udiInfoService.deleteByUuid(udiRelevanceEntity.getUuid());
}
}
udiRelevanceService.deleteById(ids);
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(udiRelevanceEntity.getUuid());
if (udiRelevanceEntities == null || udiRelevanceEntities.isEmpty()) {
udiInfoService.deleteByUuid(udiRelevanceEntity.getUuid());
}
return ResultVOUtils.success("删除成功");
}
@ -200,7 +218,34 @@ public class UdiRelevanceController {
return ResultVOUtils.error(500, "连接UDI数据下载服务出错");
}
}
if (combineRequest.getRelId() != null) {
if (combineRequest.getRelId() != null && !combineRequest.getRelId().equals("")) {
//判断DI是否被使用若使用则新增一条
UdiRelevanceEntity temp = udiRelevanceService.selectById(combineRequest.getRelId());
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(temp.getUuid());
if (udiRelevanceEntities != null && !udiRelevanceEntities.isEmpty()) {
for (UdiRelevanceEntity udiRelevanceEntity1 : udiRelevanceEntities) {
List<UdiInfoEntity> temps = udiInfoService.findByUuids(udiRelevanceEntity1.getUuid());
if (temps != null && temps.size() > 0) {
for (int i = 0; i < temps.size(); i++) {
List<WarehouseEntity> warehouseEntityList = warehouseService.searchCode(temps.get(i).getNameCode());
if (warehouseEntityList != null && warehouseEntityList.size() > 0) {
//新增一条记录
UdiRelevanceEntity newRlEntity = new UdiRelevanceEntity();
newRlEntity = setThird(combineRequest, newRlEntity);
newRlEntity.setUpdateTime(DateUtil.getDateTime());
newRlEntity.setUuid(key);
udiRelevanceService.insertUdiRelevance(newRlEntity);
return ResultVOUtils.success("合并成功");
}
}
}
}
}
udiRelevanceEntity.setId(combineRequest.getRelId());
udiRelevanceEntity.setUuid(key);
udiRelevanceEntity.setUpdateTime(DateUtil.getDateTime());
@ -218,6 +263,14 @@ public class UdiRelevanceController {
return ResultVOUtils.success("合并成功");
}
//选入查询结果的所有DI
@GetMapping("/udi/udirel/combineAll")
public BaseResponse combineAll(FilterUdiInfoRequest productInfoFilterRequest) {
basicUpdateProductService.relAllUdi(productInfoFilterRequest);
return ResultVOUtils.success("后台已开始导入,请稍后刷新查看");
}
//更换关联ERP产品
@PostMapping("/udi/udirel/modifyRel")
public BaseResponse modifyRel(@RequestBody CombineRequest combineRequest) {
@ -237,8 +290,42 @@ public class UdiRelevanceController {
if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null)
return ResultVOUtils.error(500, "ERP产品信息接口地址未定义");
String url = basicThirdSysDetailEntity.getValue();
updateproductService.addProduct(combineRequest, url);
return ResultVOUtils.success("添加成功");
String errMsg = basicUpdateProductService.addProduct(combineRequest, url);
if (errMsg == null)
return ResultVOUtils.success("添加成功!");
else {
return ResultVOUtils.error(500, errMsg);
}
}
//一键选入ERP产品
@PostMapping("/udi/udirel/addAllErp")
public BaseResponse addAllErp(@RequestBody CombineRequest combineRequest) {
BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("piQueryUrl", combineRequest.getThirdSys());
if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null)
return ResultVOUtils.error(500, "ERP产品信息接口地址未定义");
String url = basicThirdSysDetailEntity.getValue();
BasicThirdSysDetailEntity inQuery = basicThirdSysDetailService.selectByKey("invPiUrl", combineRequest.getThirdSys());
if (basicThirdSysDetailEntity.getFromType() == 0) {
if (combineRequest.getIsRlInv() != null && combineRequest.getIsRlInv()) {//是否关联库存
updateproductService.addAllProducts(combineRequest.getQuery(), basicThirdSysDetailEntity.getValue(), inQuery.getValue(), combineRequest.getThirdSys(), true);
} else {
updateproductService.addAllProducts(combineRequest.getQuery(), basicThirdSysDetailEntity.getValue(), inQuery.getValue(), combineRequest.getThirdSys(), null);
}
} else {
if (combineRequest.getIsRlInv() != null && combineRequest.getIsRlInv()) {
updateproductService.loadLocal(combineRequest.getQuery(), combineRequest.getThirdSys(), inQuery.getValue(), true);
} else {
updateproductService.loadLocal(combineRequest.getQuery(), combineRequest.getThirdSys(), inQuery.getValue(), null);
}
}
return ResultVOUtils.success("后台正在添加,请稍后刷新查看!");
}
//上传产品信息至供应商管理平台
@ -330,6 +417,36 @@ public class UdiRelevanceController {
}
//获取产品信息详情(多平台)
@GetMapping("/udiwms/udirel/thirdSys/filter")
public BaseResponse getThirdSysfilter(FilterUdiInfoRequest filterUdiInfoRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
FilterBasicThirdSysRequest filterBasicThirdSysRequest = new FilterBasicThirdSysRequest();
filterBasicThirdSysRequest.setEnabled(true);
List<BasicThirdSysEntity> basicThirdSysEntities = basicThirdSysService.filterBasicThiSys(filterBasicThirdSysRequest);
List<FilterSysEntity> filterSysEntityList = new ArrayList<>();
filterSysEntityList.add(new FilterSysEntity(0, "全部"));
filterSysEntityList.add(new FilterSysEntity(1, "对照完成"));
filterSysEntityList.add(new FilterSysEntity(2, "未对照DI"));
if (basicThirdSysEntities != null && basicThirdSysEntities.size() > 0) {
for (int i = 0; i < basicThirdSysEntities.size(); i++) {
filterSysEntityList.add(new FilterSysEntity(i + 3, "未对照"+basicThirdSysEntities.get(i).getThirdName()));
}
}
PageInfo<FilterSysEntity> pageInfo;
pageInfo = new PageInfo<>(filterSysEntityList);
PageSimpleResponse<FilterSysEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(filterSysEntityList);
return ResultVOUtils.success(pageSimpleResponse);
}
//获取对照过滤列表
@GetMapping("/udiwms/udirel/thirdSys/detail")
public BaseResponse getThirdSysDetail(FilterUdiInfoRequest filterUdiInfoRequest,
BindingResult bindingResult) {
@ -342,52 +459,96 @@ public class UdiRelevanceController {
filterBasicThirdSysRequest.setEnabled(true);
List<BasicThirdSysEntity> basicThirdSysEntities = basicThirdSysService.filterBasicThiSys(filterBasicThirdSysRequest);
List<BasicProductThirdSysResponse> basicProductThirdSysResponses = new ArrayList<>();
if (udiRelevanceEntity.getThirdId() != null) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
BasicThirdSysEntity basicThirdSysEntity = filterThirdSys("thirdId", basicThirdSysEntities);
if (basicThirdSysEntity != null)
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId());
basicProductThirdSysResponse.setThirdName(udiRelevanceEntity.getThirdName());
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
if (udiRelevanceEntity.getThirdId1() != null) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
BasicThirdSysEntity basicThirdSysEntity = filterThirdSys("thirdId1", basicThirdSysEntities);
if (basicThirdSysEntity != null)
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId());
basicProductThirdSysResponse.setThirdName(udiRelevanceEntity.getThirdName());
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
if (udiRelevanceEntity.getThirdId2() != null) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
BasicThirdSysEntity basicThirdSysEntity = filterThirdSys("thirdId2", basicThirdSysEntities);
if (basicThirdSysEntity != null)
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId());
basicProductThirdSysResponse.setThirdName(udiRelevanceEntity.getThirdName());
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
if (udiRelevanceEntity.getThirdId3() != null) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
BasicThirdSysEntity basicThirdSysEntity = filterThirdSys("thirdId3", basicThirdSysEntities);
if (basicThirdSysEntity != null)
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId());
basicProductThirdSysResponse.setThirdName(udiRelevanceEntity.getThirdName());
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
if (udiRelevanceEntity.getThirdId4() != null) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
BasicThirdSysEntity basicThirdSysEntity = filterThirdSys("thirdId4", basicThirdSysEntities);
if (basicThirdSysEntity != null)
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId());
basicProductThirdSysResponse.setThirdName(udiRelevanceEntity.getThirdName());
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
if (basicThirdSysEntities != null && basicThirdSysEntities.size() > 0) {
for (BasicThirdSysEntity basicThirdSysEntity : basicThirdSysEntities) {
if (basicThirdSysEntity.getThirdId().equals("thirdId")) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId());
basicProductThirdSysResponse.setThirdName(udiRelevanceEntity.getThirdName());
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
basicProductThirdSysResponse.setSysId(basicThirdSysEntity.getThirdId());
if (udiRelevanceEntity.getThirdId() != null && !udiRelevanceEntity.getThirdId().isEmpty()) {
if (udiRelevanceEntity.getThirdId() != null) {
ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiRelevanceEntity.getThirdId(), "thirdId");
if (thrProductsEntity != null) {
basicProductThirdSysResponse.setManufactory(thrProductsEntity.getManufactory());
basicProductThirdSysResponse.setRegisterNo(thrProductsEntity.getRegisterNo());
basicProductThirdSysResponse.setSpec(thrProductsEntity.getSpec());
}
}
}
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
if (basicThirdSysEntity.getThirdId().equals("thirdId1")) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId1());
basicProductThirdSysResponse.setThirdName(udiRelevanceEntity.getThirdName1());
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
basicProductThirdSysResponse.setSysId(basicThirdSysEntity.getThirdId());
if (udiRelevanceEntity.getThirdId1() != null && !udiRelevanceEntity.getThirdId1().isEmpty()) {
ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiRelevanceEntity.getThirdId1(), "thirdId1");
if (thrProductsEntity != null) {
basicProductThirdSysResponse.setManufactory(thrProductsEntity.getManufactory());
basicProductThirdSysResponse.setRegisterNo(thrProductsEntity.getRegisterNo());
basicProductThirdSysResponse.setSpec(thrProductsEntity.getSpec());
}
}
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
if (basicThirdSysEntity.getThirdId().equals("thirdId2")) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId2());
basicProductThirdSysResponse.setThirdName(udiRelevanceEntity.getThirdName2());
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
basicProductThirdSysResponse.setSysId(basicThirdSysEntity.getThirdId());
if (udiRelevanceEntity.getThirdId2() != null && !udiRelevanceEntity.getThirdId2().isEmpty()) {
ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiRelevanceEntity.getThirdId2(), "thirdId2");
if (thrProductsEntity != null) {
basicProductThirdSysResponse.setManufactory(thrProductsEntity.getManufactory());
basicProductThirdSysResponse.setRegisterNo(thrProductsEntity.getRegisterNo());
basicProductThirdSysResponse.setSpec(thrProductsEntity.getSpec());
}
}
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
if (basicThirdSysEntity.getThirdId().equals("thirdId3")) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId3());
basicProductThirdSysResponse.setThirdName(udiRelevanceEntity.getThirdName3());
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
basicProductThirdSysResponse.setSysId(basicThirdSysEntity.getThirdId());
if (udiRelevanceEntity.getThirdId3() != null && !udiRelevanceEntity.getThirdId3().isEmpty()) {
ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiRelevanceEntity.getThirdId3(), "thirdId3");
if (thrProductsEntity != null) {
basicProductThirdSysResponse.setManufactory(thrProductsEntity.getManufactory());
basicProductThirdSysResponse.setRegisterNo(thrProductsEntity.getRegisterNo());
basicProductThirdSysResponse.setSpec(thrProductsEntity.getSpec());
}
}
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
if (basicThirdSysEntity.getThirdId().equals("thirdId4")) {
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId4());
basicProductThirdSysResponse.setThirdName(udiRelevanceEntity.getThirdName4());
basicProductThirdSysResponse.setSysName(basicThirdSysEntity.getThirdName());
basicProductThirdSysResponse.setSysId(basicThirdSysEntity.getThirdId());
if (udiRelevanceEntity.getThirdId4() != null && !udiRelevanceEntity.getThirdId4().isEmpty()) {
ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiRelevanceEntity.getThirdId4(), "thirdId4");
if (thrProductsEntity != null) {
basicProductThirdSysResponse.setManufactory(thrProductsEntity.getManufactory());
basicProductThirdSysResponse.setRegisterNo(thrProductsEntity.getRegisterNo());
basicProductThirdSysResponse.setSpec(thrProductsEntity.getSpec());
}
}
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
}
}
}
PageInfo<BasicProductThirdSysResponse> pageInfo;
pageInfo = new PageInfo<>(basicProductThirdSysResponses);
PageSimpleResponse<BasicProductThirdSysResponse> pageSimpleResponse = new PageSimpleResponse<>();
@ -396,6 +557,44 @@ public class UdiRelevanceController {
return ResultVOUtils.success(pageSimpleResponse);
}
//解除绑定
@GetMapping("/udiwms/udirl/thirdSys/remove")
public BaseResponse uploadThirdServcie(RemoveRelRequest removeRelRequest) {
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(removeRelRequest.getRelId());
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(udiRelevanceEntity.getUuid());
if (udiRelevanceEntities != null && udiRelevanceEntities.size() > 0) {
for (UdiRelevanceEntity udiRelevanceEntity1 : udiRelevanceEntities) {
if (udiRelevanceEntity1.getThirdId() == null && udiRelevanceEntity1.getThirdId1() == null &&
udiRelevanceEntity1.getThirdId2() == null && udiRelevanceEntity1.getThirdId3() == null && udiRelevanceEntity1.getThirdId4() == null) {
return ResultVOUtils.error(500, "解除绑定失败!");
}
}
}
if (removeRelRequest.getThirdSys().equals("thirdId")) {
udiRelevanceEntity.setThirdId("");
udiRelevanceEntity.setThirdName("");
} else if (removeRelRequest.getThirdSys().equals("thirdId1")) {
udiRelevanceEntity.setThirdId1("");
udiRelevanceEntity.setThirdName1("");
} else if (removeRelRequest.getThirdSys().equals("thirdId2")) {
udiRelevanceEntity.setThirdId2("");
udiRelevanceEntity.setThirdName2("");
} else if (removeRelRequest.getThirdSys().equals("thirdId3")) {
udiRelevanceEntity.setThirdId3("");
udiRelevanceEntity.setThirdName3("");
} else if (removeRelRequest.getThirdSys().equals("thirdId4")) {
udiRelevanceEntity.setThirdId4("");
udiRelevanceEntity.setThirdName4("");
}
try {
udiRelevanceService.updateUdiRelevance(udiRelevanceEntity);
} catch (Exception e) {
e.printStackTrace();
return ResultVOUtils.error(500, "解除绑定失败!");
}
return ResultVOUtils.success("解除绑定成功!");
}
public UdiRelevanceEntity setThird(CombineRequest combineRequest, UdiRelevanceEntity udiRelevanceEntity) {
if ("thirdId".equals(combineRequest.getThirdSys())) {
udiRelevanceEntity.setThirdId(combineRequest.getThirdId());

@ -80,25 +80,23 @@ public class OrderDetailController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
BasicThirdSysDetailEntity basicThirdSysDetailEntity = bussinessTypeService.findByActionKey(filterErpOrderRequest.getBillAction(), "orderQueryUrl");
if (basicThirdSysDetailEntity.getValue() == null) {
return ResultVOUtils.error(500, "业务单据查询接口未定义");
}
if(!basicThirdSysDetailEntity.getEnabled()){
if (!basicThirdSysDetailEntity.getEnabled()) {
return ResultVOUtils.error(500, "第三方业务单据服务未启用");
}
if (basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if (filterErpOrderRequest.getIsDownThrSys() != null && filterErpOrderRequest.getIsDownThrSys()) {
return new ErpOrderClient(basicThirdSysDetailEntity.getValue()).getErpOrderResponse(filterErpOrderRequest);
}
if (basicThirdSysDetailEntity.getFromType() == 0) {
return new ErpOrderClient(basicThirdSysDetailEntity.getValue()).getErpOrderResponse(filterErpOrderRequest);
} else {
//todo 订单查询,需加日期
FilterThrOrderRequest filterThrOrderRequest = new FilterThrOrderRequest();
BeanUtils.copyProperties(filterErpOrderRequest, filterThrOrderRequest);
// if (filterThrOrderRequest.getBillAction() != null) {
// BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(filterErpOrderRequest.getBillAction());
// filterThrOrderRequest.setBillAction(bussinessTypeEntity.getName());
// }
filterThrOrderRequest.setPage(filterErpOrderRequest.getPage());
filterThrOrderRequest.setLimit(filterErpOrderRequest.getLimit());
List<ErpOrderResponse> erpOrderResponses = new ArrayList<>();
@ -107,7 +105,7 @@ public class OrderDetailController {
for (ThrOrderEntity thrOrderEntity : data) {
FilterThrOrderDetailRequest filterThrOrderDetailRequest = new FilterThrOrderDetailRequest();
filterThrOrderDetailRequest.setOrderIdFk(thrOrderEntity.getId() + "");
List<ThrOrderDetailEntity> thrOrderDetailEntities =thrOrderDetailService.filterThrOrderDetailDetail(filterThrOrderDetailRequest);
List<ThrOrderDetailEntity> thrOrderDetailEntities = thrOrderDetailService.filterThrOrderDetailDetail(filterThrOrderDetailRequest);
ErpOrderResponse erpOrderResponse = new ErpOrderResponse();
BeanUtils.copyProperties(thrOrderEntity, erpOrderResponse);
List<ErpOrderResponse.SubErpOrder> subErpOrders = new ArrayList<>();

@ -71,7 +71,7 @@ public class InvErpOnhandController {
if (!basicThirdSysDetailEntity.getEnabled()) {
return ResultVOUtils.error(500, "第三方库存信息服务未启用!");
}
if (basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if (basicThirdSysDetailEntity.getFromType() == 0 || (onhandQueryRequest.getIsDownThrSys() != null && onhandQueryRequest.getIsDownThrSys())) {
BaseResponse<PageSimpleResponse<ErpInvProductResponse>> responseBaseResponse = new ErpInvClient().getInvPrdoductResponse(onhandQueryRequest, onHandUrl);
return responseBaseResponse;

@ -136,8 +136,9 @@ public class ThrCorpExportLogController {
thrCorpExportLogEntity.setFilePath(fileName);
thrCorpExportLogEntity.setUpdateTime(new Date());
thrCorpExportLogEntity.setDlCount(0);
thrCorpExportLogEntity.setType(1);
thrCorpExportLogService.insertThrCorpExportLog(thrCorpExportLogEntity);
thrCorpsDlService.genExcel(genKey,thrCorpExportRequest);
thrCorpsDlService.genExcel(genKey, thrCorpExportRequest);
return ResultVOUtils.success("后台正在导出生成excel文件请稍后刷新查看!");
}
@ -146,7 +147,7 @@ public class ThrCorpExportLogController {
//第三方往来单位接口下载(第三方使用)
@GetMapping("/udiwms/thrsys/thrCorp/download")
public BaseResponse downloadThrCorps(BasicUnitMaintainFilterRequest unitMaintainFilterRequest,
BindingResult bindingResult) {
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
@ -155,7 +156,7 @@ public class ThrCorpExportLogController {
if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null)
return ResultVOUtils.error(500, "往来单位接口地址未定义");
if (basicThirdSysDetailEntity.getEnabled()) {
if (basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if (basicThirdSysDetailEntity.getFromType() == 0) {
BaseResponse<PageSimpleResponse<ErpUnitsResponse>> udiDlDeviceResponse =
new ErpBasicClient().getErpCrop(unitMaintainFilterRequest, basicThirdSysDetailEntity.getValue());
return udiDlDeviceResponse;

@ -3,6 +3,7 @@ package com.glxp.api.admin.controller.thrsys;
import com.github.pagehelper.PageInfo;
import com.glxp.api.admin.constant.BasicProcessStatus;
import com.glxp.api.admin.entity.thrsys.*;
import com.glxp.api.admin.req.basic.BasicUnitMaintainFilterRequest;
import com.glxp.api.admin.req.inout.DeleteRequest;
import com.glxp.api.admin.req.thrsys.FilterThrCorpRequest;
import com.glxp.api.admin.req.thrsys.FilterThrProductsRequest;
@ -99,7 +100,7 @@ public class ThrCorpsController {
thrCorpImportLogEntity.setThirdSysFk(postThrCorpRequest.getThirdSys());
thrCorpImportLogService.insertImportLog(thrCorpImportLogEntity);
}
thrCorpsDlService.insertData(genKey,postThrCorpRequest.getThirdSys(),erpUnitsResponses);
thrCorpsDlService.insertData(genKey, postThrCorpRequest.getThirdSys(), erpUnitsResponses);
return ResultVOUtils.success("往来单位上传成功!后台正在处理,请稍后刷新查看!");
}
return ResultVOUtils.error(500, "上传数据为空");
@ -107,7 +108,7 @@ public class ThrCorpsController {
//接口一键全部
@RequestMapping("/udiwms/thrsys/corp/downloadAll")
public BaseResponse downloadAll(FilterThrProductsRequest filterThrProductsRequest) {
public BaseResponse downloadAll(FilterThrCorpRequest filterThrProductsRequest) {
String data = (String) redisUtil.get(Constant.dlThrProducts);
if (data != null && data.equals("true")) {
return ResultVOUtils.error(500, "当前任务正在下载更新产品信息,请稍后重试!");
@ -124,7 +125,39 @@ public class ThrCorpsController {
thrCorpImportLogEntity.setUpdateTime(new Date());
thrCorpImportLogEntity.setThirdSysFk(filterThrProductsRequest.getThirdSysFk());
thrCorpImportLogService.insertImportLog(thrCorpImportLogEntity);
thrCorpsDlService.importCorps(genKey, filterThrProductsRequest.getThirdSysFk());
thrCorpsDlService.importCorps(genKey,null, filterThrProductsRequest.getThirdSysFk());
return ResultVOUtils.success("后台开始下载更新,请稍后刷新查看");
}
}
//选中或者下载全部
@PostMapping("/udiwms/thrsys/corp/corpsDlAll")
public BaseResponse corpsDlAll(@RequestBody BasicUnitMaintainFilterRequest filterThrCorpRequest) {
filterThrCorpRequest.setThirdSysFk(filterThrCorpRequest.getThirdSys());
String data = (String) redisUtil.get(Constant.dlThrProducts);
if (data != null && data.equals("true")) {
return ResultVOUtils.error(500, "当前任务正在下载更新产品信息,请稍后重试!");
} else {
redisUtil.set(Constant.dlThrCorps, "true", 30);
if (filterThrCorpRequest.getThirdSysFk() == null) {
return ResultVOUtils.error(500, "未选择第三方系统!");
}
ThrCorpImportLogEntity thrCorpImportLogEntity = new ThrCorpImportLogEntity();
String genKey = CustomUtil.getId();
thrCorpImportLogEntity.setGenKey(genKey);
thrCorpImportLogEntity.setFromType("第三方系统获取");
thrCorpImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_PROCESS);
thrCorpImportLogEntity.setUpdateTime(new Date());
thrCorpImportLogEntity.setThirdSysFk(filterThrCorpRequest.getThirdSysFk());
thrCorpImportLogService.insertImportLog(thrCorpImportLogEntity);
if (filterThrCorpRequest.getThrCorpEntities() != null && filterThrCorpRequest.getThrCorpEntities().size() > 0) {//选中导出
thrCorpsDlService.importSelectCorps(genKey, filterThrCorpRequest.getThrCorpEntities(), filterThrCorpRequest.getThirdSysFk());
} else { //结果导出
thrCorpsDlService.importCorps(genKey,filterThrCorpRequest, filterThrCorpRequest.getThirdSysFk());
}
// thrCorpsDlService.importCorps(genKey, filterThrCorpRequest.getThirdSysFk());
return ResultVOUtils.success("后台开始下载更新,请稍后刷新查看");
}
}

@ -4,7 +4,9 @@ import com.github.pagehelper.PageInfo;
import com.glxp.api.admin.constant.BasicProcessStatus;
import com.glxp.api.admin.entity.thrsys.ThrInvProductsEntity;
import com.glxp.api.admin.entity.thrsys.ThrInvProductsImportLogEntity;
import com.glxp.api.admin.req.basic.BasicUnitMaintainFilterRequest;
import com.glxp.api.admin.req.inout.DeleteRequest;
import com.glxp.api.admin.req.inventory.ErpOnhandRequest;
import com.glxp.api.admin.req.thrsys.FilterThrInvProductsRequest;
import com.glxp.api.admin.req.thrsys.PostThrInvProductsRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
@ -116,16 +118,55 @@ public class ThrInvProductsController {
@RequestMapping("/udiwms/thrsys/invProducts/downloadAll")
public BaseResponse downloadAll(FilterThrInvProductsRequest filterThrInvProductsRequest) {
String data = (String) redisUtil.get(Constant.dlThrProducts);
String data = (String) redisUtil.get(Constant.dlThrInvProducts);
if (data != null && data.equals("true")) {
return ResultVOUtils.error(500, "当前任务正在下载更新库存产品信息,请稍后重试!");
} else {
redisUtil.set(Constant.dlThrProducts, "true", 30);
redisUtil.set(Constant.dlThrProducts, "true", 10 * 60);
if (filterThrInvProductsRequest.getThirdSysFk() == null) {
return ResultVOUtils.error(500, "未选择第三方系统!");
}
thrInvProductsDlService.importProducrs(filterThrInvProductsRequest.getThirdSysFk());
ThrInvProductsImportLogEntity thrInvProductsImportLogEntity = new ThrInvProductsImportLogEntity();
String genKey = CustomUtil.getId();
thrInvProductsImportLogEntity.setGenKey(genKey);
thrInvProductsImportLogEntity.setFromType("第三方系统获取");
thrInvProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_PROCESS);
thrInvProductsImportLogEntity.setUpdateTime(new Date());
thrInvProductsImportLogEntity.setThirdSysFk(filterThrInvProductsRequest.getThirdSys());
thrInvProductsImportLogService.insertImportLog(thrInvProductsImportLogEntity);
thrInvProductsDlService.importProducrs(genKey,filterThrInvProductsRequest.getThirdSysFk(), null);
return ResultVOUtils.success("后台开始下载更新,请稍后刷新查看");
}
}
@PostMapping("/udiwms/thrsys/invProducts/inpisDlAll")
public BaseResponse inpisDlAll(@RequestBody ErpOnhandRequest erpOnhandRequest) {
String data = (String) redisUtil.get(Constant.dlThrInvProducts);
if (data != null && data.equals("true")) {
return ResultVOUtils.error(500, "当前任务正在下载更新库存产品信息,请稍后重试!");
} else {
redisUtil.set(Constant.dlThrProducts, "true", 10 * 60);
if (erpOnhandRequest.getThirdSys() == null) {
return ResultVOUtils.error(500, "未选择第三方系统!");
}
ThrInvProductsImportLogEntity thrInvProductsImportLogEntity = new ThrInvProductsImportLogEntity();
String genKey = CustomUtil.getId();
thrInvProductsImportLogEntity.setGenKey(genKey);
thrInvProductsImportLogEntity.setFromType("第三方系统获取");
thrInvProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_PROCESS);
thrInvProductsImportLogEntity.setUpdateTime(new Date());
thrInvProductsImportLogEntity.setThirdSysFk(erpOnhandRequest.getThirdSys());
thrInvProductsImportLogService.insertImportLog(thrInvProductsImportLogEntity);
if (erpOnhandRequest.getThrInvProductsEntities() != null && erpOnhandRequest.getThrInvProductsEntities().size() > 0) {//选中导出
thrInvProductsDlService.importSelcyInvProducrs(genKey,erpOnhandRequest.getThirdSys(), erpOnhandRequest.getThrInvProductsEntities());
} else { //结果导出
thrInvProductsDlService.importProducrs(genKey,erpOnhandRequest.getThirdSys(),erpOnhandRequest);
}
return ResultVOUtils.success("后台开始下载更新,请稍后刷新查看");
}
}
}

@ -157,7 +157,7 @@ public class ThrInvProductsExportLogController {
if (!basicThirdSysDetailEntity.getEnabled()) {
return ResultVOUtils.error(500, "第三方库存信息服务未启用!");
}
if (basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if (basicThirdSysDetailEntity.getFromType() == 0 ) {
BaseResponse<PageSimpleResponse<ErpInvProductResponse>> responseBaseResponse = new ErpInvClient().getInvPrdoductResponse(onhandQueryRequest, onHandUrl);
return responseBaseResponse;

@ -7,10 +7,7 @@ import com.glxp.api.admin.constant.BasicProcessStatus;
import com.glxp.api.admin.entity.info.SystemParamConfigEntity;
import com.glxp.api.admin.entity.inout.ErpOrderEntity;
import com.glxp.api.admin.entity.inout.FilterErpOrderRequest;
import com.glxp.api.admin.entity.thrsys.ThrOrderDetailEntity;
import com.glxp.api.admin.entity.thrsys.ThrOrderEntity;
import com.glxp.api.admin.entity.thrsys.ThrOrderImportDetailEntity;
import com.glxp.api.admin.entity.thrsys.ThrOrderImportLogEntity;
import com.glxp.api.admin.entity.thrsys.*;
import com.glxp.api.admin.req.inout.DeleteRequest;
import com.glxp.api.admin.req.thrsys.*;
import com.glxp.api.admin.res.PageSimpleResponse;
@ -189,13 +186,14 @@ public class ThrOrderController {
return ResultVOUtils.success("删除成功");
}
@RequestMapping("/udiwms/thrsys/orders/downloadAll")
public BaseResponse downloadAll(FilterThrOrderRequest filterThrProductsRequest) {
String data = (String) redisUtil.get(Constant.dlThrOrders);
if (data != null && data.equals("true")) {
if (false) {//(data != null && data.equals("true")) {
return ResultVOUtils.error(500, "当前任务正在下载更新业务单据信息,请稍后重试!");
} else {
redisUtil.set(Constant.dlThrOrders, "true", 30);
redisUtil.set(Constant.dlThrOrders, "true", 10 * 30);
if (filterThrProductsRequest.getBillAction() == null) {
return ResultVOUtils.error(500, "未选择业务类型!");
}
@ -208,13 +206,42 @@ public class ThrOrderController {
thrOrderImportLogEntity.setUpdateTime(new Date());
thrOrderImportLogEntity.setThirdSysFk(filterThrProductsRequest.getThirdSysFk());
thrOrderImportLogService.insertImportLog(thrOrderImportLogEntity);
thrOrdersDlService.importOrders(genKey, filterThrProductsRequest.getBillAction());
if (filterThrProductsRequest.getErpOrderResponses() != null) {//选中导出
thrOrdersDlService.importSelectOrders(genKey, filterThrProductsRequest.getErpOrderResponses(), filterThrProductsRequest.getThirdSysFk());
} else { //结果导出
thrOrdersDlService.importOrders(genKey, filterThrProductsRequest.getBillAction(),null);
}
return ResultVOUtils.success("后台开始下载更新,请稍后刷新查看");
}
}
@PostMapping("/udiwms/thrsys/orders/orderDownload")
public BaseResponse orderDownload(@RequestBody FilterThrOrderRequest filterThrProductsRequest) {
String data = (String) redisUtil.get(Constant.dlThrOrders);
if (false) {//(data != null && data.equals("true")) {
return ResultVOUtils.error(500, "当前任务正在下载更新业务单据信息,请稍后重试!");
} else {
redisUtil.set(Constant.dlThrOrders, "true", 10 * 30);
if (filterThrProductsRequest.getBillAction() == null) {
return ResultVOUtils.error(500, "未选择业务类型!");
}
ThrOrderImportLogEntity thrOrderImportLogEntity = new ThrOrderImportLogEntity();
String genKey = CustomUtil.getId();
thrOrderImportLogEntity.setGenKey(genKey);
thrOrderImportLogEntity.setFromType("第三方系统获取");
thrOrderImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_UNPROCESS);
thrOrderImportLogEntity.setUpdateTime(new Date());
thrOrderImportLogEntity.setThirdSysFk(filterThrProductsRequest.getThirdSysFk());
thrOrderImportLogService.insertImportLog(thrOrderImportLogEntity);
if (filterThrProductsRequest.getErpOrderResponses() != null && filterThrProductsRequest.getErpOrderResponses().size()>0) {//选中导出
thrOrdersDlService.importSelectOrders(genKey, filterThrProductsRequest.getErpOrderResponses(), filterThrProductsRequest.getThirdSysFk());
} else { //结果导出
thrOrdersDlService.importOrders(genKey, filterThrProductsRequest.getBillAction(),filterThrProductsRequest);
}
return ResultVOUtils.success("后台开始下载更新,请稍后刷新查看");
}
}
@PostMapping("/udiwms/smp/postOrder")
public BaseResponse postSmpOrder(@RequestBody PostSmpOrderRequest postSmpOrderRequest,
BindingResult bindingResult) {

@ -181,7 +181,7 @@ public class ThrOrderExportLogController {
return ResultVOUtils.error(500, "第三方业务单据服务未启用");
}
if (basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if (basicThirdSysDetailEntity.getFromType() == 0 ) {
return new ErpOrderClient(basicThirdSysDetailEntity.getValue()).getErpOrderResponse(filterErpOrderRequest);
} else {
//todo 订单查询,需加日期

@ -161,7 +161,7 @@ public class ThrProductsController {
if (data != null && data.equals("true")) {
return ResultVOUtils.error(500, "当前任务正在下载更新产品信息,请稍后重试!");
} else {
redisUtil.set(Constant.dlThrProducts, "true", 60 * 15);
redisUtil.set(Constant.dlThrProducts, "true", 60 * 10);
if (filterThrProductsRequest.getThirdSysFk() == null) {
return ResultVOUtils.error(500, "未选择第三方系统!");
}
@ -173,7 +173,40 @@ public class ThrProductsController {
thrProductsImportLogEntity.setUpdateTime(new Date());
thrProductsImportLogEntity.setThirdSysFk(filterThrProductsRequest.getThirdSysFk());
thrProductsImportLogService.insertImportLog(thrProductsImportLogEntity);
thrProductsDlService.importProducrs(genKey, filterThrProductsRequest.getThirdSysFk());
thrProductsDlService.importProducrs(genKey, filterThrProductsRequest);
return ResultVOUtils.success("后台开始下载更新,请稍后刷新查看");
}
}
//接口一键下载全部
@PostMapping("/udiwms/thrsys/products/productsDlAll")
public BaseResponse productsDlAll(@RequestBody FilterThrProductsRequest filterThrProductsRequest) {
filterThrProductsRequest.setThirdSysFk(filterThrProductsRequest.getThirdSys());
String data = (String) redisUtil.get(Constant.dlThrProducts);
if (false) { //data != null && data.equals("true")
return ResultVOUtils.error(500, "当前任务正在下载更新产品信息,请稍后重试!");
} else {
redisUtil.set(Constant.dlThrProducts, "true", 60 * 10);
if (filterThrProductsRequest.getThirdSysFk() == null) {
return ResultVOUtils.error(500, "未选择第三方系统!");
}
ThrProductsImportLogEntity thrProductsImportLogEntity = new ThrProductsImportLogEntity();
String genKey = CustomUtil.getId();
thrProductsImportLogEntity.setGenKey(genKey);
thrProductsImportLogEntity.setFromType("第三方系统下载");
thrProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_PROCESS);
thrProductsImportLogEntity.setUpdateTime(new Date());
thrProductsImportLogEntity.setThirdSysFk(filterThrProductsRequest.getThirdSysFk());
thrProductsImportLogService.insertImportLog(thrProductsImportLogEntity);
if (filterThrProductsRequest.getThrProductsEntities() != null && filterThrProductsRequest.getThrProductsEntities().size() > 0) {//选中导出
thrProductsDlService.importSelectProducrs(genKey, filterThrProductsRequest.getThrProductsEntities(), filterThrProductsRequest.getThirdSysFk());
} else { //结果导出
thrProductsDlService.importProducrs(genKey,filterThrProductsRequest );
}
// thrProductsDlService.importProducrs(genKey, filterThrProductsRequest.getThirdSysFk());
return ResultVOUtils.success("后台开始下载更新,请稍后刷新查看");
}
}

@ -170,7 +170,7 @@ public class ThrProductsExportLogController {
if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null)
return ResultVOUtils.error(500, "ERP产品信息接口地址未定义");
if (basicThirdSysDetailEntity.getEnabled()) {
if (basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if (basicThirdSysDetailEntity.getFromType() == 0 ) {
ErpBasicClient erpBasicHttpClient = new ErpBasicClient();
BaseResponse<PageSimpleResponse<ErpProductsResponse>> udiDlDeviceResponse = erpBasicHttpClient.getErpProducts(filterErpGoodsRequest, basicThirdSysDetailEntity.getValue());
if (udiDlDeviceResponse.getCode() == 20000) {

@ -16,6 +16,8 @@ public interface BasicUnitMaintainDao {
boolean updateById(BasicUnitMaintainEntity basicUnitMaintainSaveRequest);
BasicUnitMaintainEntity selectByThirdId(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest);
boolean deleteById(@Param("id") String id);
BasicUnitMaintainEntity selectById(@Param("id") String id);

@ -22,6 +22,8 @@ public interface UdiRelevanceDao {
UdiRelevanceEntity selectById(@Param("id") String id);
UdiRelevanceEntity selectByThirdId(FilterUdiInfoRequest filterUdiInfoRequest);
List<UdiRelevanceEntity> filterEntity(FilterUdiInfoRequest filterUdiInfoRequest);
boolean insertUdiRelevance(UdiRelevanceEntity udiRelevanceEntity);

@ -2,6 +2,8 @@ package com.glxp.api.admin.entity.basic;
import lombok.Data;
import java.util.Date;
@Data
public class BasicUnitMaintainEntity {
@ -28,4 +30,6 @@ public class BasicUnitMaintainEntity {
private String thirdName3;
private String thirdName4;
private Date updateTime;
}

@ -0,0 +1,15 @@
package com.glxp.api.admin.entity.basic;
import lombok.Data;
@Data
public class FilterSysEntity {
private Integer filterType;
private String sysName;
public FilterSysEntity(Integer filterType, String sysName) {
this.filterType = filterType;
this.sysName = sysName;
}
}

@ -0,0 +1,20 @@
package com.glxp.api.admin.entity.basic;
import lombok.Data;
import java.util.Date;
@Data
public class UdiCompanyEntity {
private int id;
private String tyshxydm;
private String ylqxzcrbarmc;
private String ylqxzcrbarywmc;
private String qylxrdh;
private String qylxrcz;
private String qylxryx;
private String deviceRecordKey;
private Date updateTime;
}

@ -35,6 +35,7 @@ public class UdiInfoEntity {
private String manufactory;
private String measname;
//本地生成信息
private String batchNo;
private String produceDate;
@ -45,6 +46,9 @@ public class UdiInfoEntity {
private Integer count;
private String warehouseCode;
private Boolean isCheck;
public Integer getId() {
return id;
}
@ -367,4 +371,12 @@ public class UdiInfoEntity {
public void setYbbm(String ybbm) {
this.ybbm = ybbm;
}
public Boolean getCheck() {
return isCheck;
}
public void setCheck(Boolean check) {
isCheck = check;
}
}

@ -23,6 +23,6 @@ public class UdiRelevanceEntity {
private String measname;
private String ybbm;
private String sptm;
private Boolean isDisable;
}

@ -2,11 +2,14 @@ package com.glxp.api.admin.entity.basic;
import lombok.Data;
import java.util.Date;
@Data
public class UnitMaintainEntity {
private Integer id;
private String thirdId;
private String thirdName;
private String erpId;
private String name;
private String spell;
@ -16,4 +19,18 @@ public class UnitMaintainEntity {
private String contact;
private String mobile;
private String creditNo;
private String thirdId1;
private String thirdId2;
private String thirdId3;
private String thirdId4;
private String thirdName1;
private String thirdName2;
private String thirdName3;
private String thirdName4;
private Date updateTime;
}

@ -37,6 +37,7 @@ public class ErpOrderEntity {
private String productDate;
private String expireDate;
private int erpCount;
private String originType;
private int reCount;

@ -21,4 +21,5 @@ public class WarehouseEntity {
private Integer count;
private String packageLevel;
private String warehouseCode;
private String nameCode;
}

@ -37,6 +37,7 @@ public class Warehousetemp {
private Integer count;
private Integer type;
private String nameCode;
public Long getId() {
return id;
@ -189,4 +190,12 @@ public class Warehousetemp {
public void setType(Integer type) {
this.type = type;
}
public String getNameCode() {
return nameCode;
}
public void setNameCode(String nameCode) {
this.nameCode = nameCode;
}
}

@ -2,6 +2,8 @@ package com.glxp.api.admin.entity.thrsys;
import lombok.Data;
import java.util.Date;
@Data
public class ThrCorpEntity {
@ -14,6 +16,8 @@ public class ThrCorpEntity {
private String contact;
private String mobile;
private String thirdSysFk;
private Boolean checked;
private Date updateTime;
}

@ -2,6 +2,8 @@ package com.glxp.api.admin.entity.thrsys;
import lombok.Data;
import java.util.Date;
@Data
public class ThrInvProductsEntity {
@ -19,6 +21,7 @@ public class ThrInvProductsEntity {
private String spaceCode;
private String spaceName;
private String thirdSysFk;
private Date updateTime;
}

@ -2,6 +2,8 @@ package com.glxp.api.admin.entity.thrsys;
import lombok.Data;
import java.util.Date;
@Data
public class ThrOrderDetailEntity {
private Integer id;
@ -15,5 +17,6 @@ public class ThrOrderDetailEntity {
private Integer reCount;
private String orderIdFk;
private String thirdSysFk;
private Date updateTime;
}

@ -2,6 +2,8 @@ package com.glxp.api.admin.entity.thrsys;
import lombok.Data;
import java.util.Date;
@Data
public class ThrOrderEntity {
@ -13,5 +15,7 @@ public class ThrOrderEntity {
private String billType;
private String billFlag;
private String thirdSysFk;
private Date updateTime;
private String originType;
}

@ -2,6 +2,8 @@ package com.glxp.api.admin.entity.thrsys;
import lombok.Data;
import java.util.Date;
@Data
public class ThrProductsEntity {
private Integer id;
@ -22,5 +24,8 @@ public class ThrProductsEntity {
private String ylqxzcrbarmc;
private String ylqxzcrbarywmc;
private String cpms;
private Date updateTime;
private boolean isChecked;
}

@ -45,6 +45,9 @@ public class ErpBasicClient {
Map<String, Object> paramMap = new HashMap<>(16);
paramMap.put("code", filterErpGoodsRequest.getCode());
paramMap.put("name", filterErpGoodsRequest.getName());
paramMap.put("spec", filterErpGoodsRequest.getSpec());
paramMap.put("registerNo", filterErpGoodsRequest.getRegisterNo());
paramMap.put("manufactory", filterErpGoodsRequest.getManufactory());
paramMap.put("limit", filterErpGoodsRequest.getLimit());
paramMap.put("page", filterErpGoodsRequest.getPage());

@ -50,6 +50,7 @@ public class ErpOrderClient {
paramMap.put("limit", filterOrderRequest.getLimit());
paramMap.put("billAction", filterOrderRequest.getBillAction());
paramMap.put("billFlag", filterOrderRequest.getBillFlag());
paramMap.put("corpName", filterOrderRequest.getCorpName());
if (filterOrderRequest.getStartDate() == null || filterOrderRequest.getEndDate() == null) {
Map date = DateUtil.getDayTRange();
if (filterOrderRequest.getBillNo() != null) {
@ -97,6 +98,7 @@ public class ErpOrderClient {
erpOrderEntity.setExpireDate(subPurchase.getExpireDate());
erpOrderEntity.setErpCount(Math.abs(subPurchase.getCount()));
erpOrderEntity.setReCount(Math.abs(subPurchase.getReCount()));
erpOrderEntity.setOriginType(erpOrderResponse.getOriginType());
erpOrderEntity.setGoodsunit(subPurchase.getSpec());
erpOrderEntities.add(erpOrderEntity);
}

@ -1,8 +1,11 @@
package com.glxp.api.admin.req.basic;
import com.glxp.api.admin.req.ListPageRequest;
import com.glxp.api.admin.res.basic.ErpUnitsResponse;
import lombok.Data;
import java.util.List;
@Data
public class BasicUnitMaintainFilterRequest extends ListPageRequest {
@ -11,4 +14,17 @@ public class BasicUnitMaintainFilterRequest extends ListPageRequest {
private String unitId;
private String name;
private String thirdSys;
private String thirdSysFk;
private String thirdId;
private String thirdId1;
private String thirdId2;
private String thirdId3;
private String thirdId4;
private Boolean isDownThrSys;
List<ErpUnitsResponse> thrCorpEntities;
}

@ -11,9 +11,12 @@ public class CombineRequest {
List<String> keys;
private String thirdId;
private List<String> thirdIds;
private String erpName;
private ErpProductsResponse erpProductsResponse;
private String relId;
private String thirdSys;
private Boolean isRlInv;
private FilterErpGoodsRequest query;
}

@ -11,5 +11,6 @@ public class FilterBasicThirdSysRequest extends ListPageRequest {
private Boolean enabled;
private Integer fromType;
private Boolean mainSys;
private Boolean filter;
}

@ -8,6 +8,10 @@ public class FilterErpGoodsRequest extends ListPageRequest {
private String name;
private String code;
private String spec; //规格型号
private String registerNo; //注册证号
private String manufactory; //生产厂家
private String thirdSys;
private Boolean isDownThrSys;
}

@ -23,4 +23,19 @@ public class FilterUdiInfoRequest extends ListPageRequest {
private String thirdCode;
private String thirdSys;
private String lastUpdateTime;
private String zczbhhzbapzbh;
private Integer diType;
private String unionCode;
private String udiCode;
private String thrPiId;
private Boolean isCheck;
private Integer filterType; //0:全部1.对照完成2.未对照DI3.未对照产品编码4.未对照其他产品编码
}

@ -11,4 +11,5 @@ public class FilterUdiIpLogRequest extends ListPageRequest {
private String genKey;
private Integer status;
private String thirdSysFk;
private String fromType;
}

@ -0,0 +1,10 @@
package com.glxp.api.admin.req.basic;
import lombok.Data;
@Data
public class RemoveRelRequest {
private String relId;
private String thirdSys;
}

@ -12,5 +12,7 @@ public class FilterOrderRequest {
private String billAction;
private Integer limit;
private Integer page;
private Boolean isDownThrSys;
private String corpName;
}

@ -11,4 +11,5 @@ public class WarehouseQueryRequest extends ListPageRequest {
private String udi;
private String batchNo;
private String orderId;
private String nameCode;
}

@ -1,12 +1,13 @@
package com.glxp.api.admin.req.inventory;
import com.glxp.api.admin.req.ListPageRequest;
import com.glxp.api.admin.res.inventory.ErpInvProductResponse;
import lombok.Data;
import java.util.List;
@Data
public class ErpOnhandRequest extends ListPageRequest {
public class ErpOnhandRequest extends ListPageRequest {
private String batchNo;
private String warehouseCode;
@ -16,4 +17,9 @@ public class ErpOnhandRequest extends ListPageRequest {
private String udiCode;
private String nameCode;
private String thirdSys;
private Boolean isDownThrSys;
List<ErpInvProductResponse> thrInvProductsEntities;
}

@ -1,11 +1,16 @@
package com.glxp.api.admin.req.thrsys;
import com.glxp.api.admin.req.ListPageRequest;
import com.glxp.api.admin.res.basic.ErpUnitsResponse;
import lombok.Data;
import java.util.List;
@Data
public class FilterThrCorpRequest extends ListPageRequest {
private String thirdSysFk;
private String thirdSys;
private String unitId;
private String name;
List<ErpUnitsResponse> thrCorpEntities;
}

@ -1,6 +1,8 @@
package com.glxp.api.admin.req.thrsys;
import com.glxp.api.admin.entity.thrsys.ThrInvProductsEntity;
import com.glxp.api.admin.req.ListPageRequest;
import com.glxp.api.admin.res.inventory.ErpInvProductResponse;
import lombok.Data;
import java.util.List;
@ -17,4 +19,5 @@ public class FilterThrInvProductsRequest extends ListPageRequest {
private String udiCode;
private String nameCode;
private String thirdSys;
List<ErpInvProductResponse> erpInvProductResponses;
}

@ -1,8 +1,11 @@
package com.glxp.api.admin.req.thrsys;
import com.glxp.api.admin.req.ListPageRequest;
import com.glxp.api.admin.res.inout.ErpOrderResponse;
import lombok.Data;
import java.util.List;
@Data
public class FilterThrOrderRequest extends ListPageRequest {
@ -13,4 +16,8 @@ public class FilterThrOrderRequest extends ListPageRequest {
private String endDate; //结束日期
private String billFlag; //单据状态,0.未签字1.已签字
private String billAction;
private String corpName;
private List<ErpOrderResponse> erpOrderResponses;
}

@ -1,12 +1,20 @@
package com.glxp.api.admin.req.thrsys;
import com.glxp.api.admin.entity.thrsys.ThrProductsEntity;
import com.glxp.api.admin.req.ListPageRequest;
import lombok.Data;
import java.util.List;
@Data
public class FilterThrProductsRequest extends ListPageRequest {
private List<ThrProductsEntity> thrProductsEntities;
private String code;
private String name;
private String spec; //规格型号
private String registerNo; //注册证号
private String manufactory; //生产厂家
private String thirdSys;
private String thirdSysFk;
private String unionCode;
}

@ -4,7 +4,13 @@ import lombok.Data;
@Data
public class BasicProductThirdSysResponse {
private String sysId;
private String sysName;
private String thirdName;
private String thirdId;
private String spec;
private String registerNo;
private String manufactory;
}

@ -12,4 +12,5 @@ public class ErpUnitsResponse {
private String creditNo;
private String contact;
private String mobile;
private Boolean checked;
}

@ -45,5 +45,8 @@ public class UdiRelevanceResponse {
private String thirdName4;
private String ybbm;
private String sptm;
private Boolean isDisable;
private String erpId;
private String erpName;
}

@ -10,6 +10,7 @@ public class ErpOrderResponse {
private String corpName;
private String billType;
private String billFlag;
private String originType;
private List<ErpOrderResponse.SubErpOrder> subErpOrders;
public String getBillNo() {
@ -69,6 +70,14 @@ public class ErpOrderResponse {
this.billFlag = billFlag;
}
public String getOriginType() {
return originType;
}
public void setOriginType(String originType) {
this.originType = originType;
}
public static class SubErpOrder {
private String productId;
private String productName;

@ -17,5 +17,8 @@ public interface BasicUnitMaintainService {
boolean deleteById(String id);
BasicUnitMaintainEntity selectByThirdId(String thirdId, String thirdSys);
BasicUnitMaintainEntity selectById(String id);
}

@ -16,10 +16,20 @@ public interface UdiRelevanceService {
List<UdiRelevanceResponse> filterUdiGp(FilterUdiInfoRequest filterUdiInfoRequest);
boolean isExitByUuid(String uuid);
List<UdiRelevanceEntity> selectByUuid(String uuid);
UdiRelevanceEntity selectById( String id);
UdiRelevanceResponse selectGroupById( String id);
UdiRelevanceEntity selectById(String id);
UdiRelevanceResponse selectGroupById(String id);
UdiRelevanceEntity selectUpdateByUuid(String uuid);
UdiRelevanceEntity selectUpdateByThirdId(String thirdId);
UdiRelevanceEntity selectUpteaByAll(String uuid, String thirdId);
UdiRelevanceEntity selectByThirdId(String thirdId, String thirdSys);
boolean insertUdiRelevance(UdiRelevanceEntity udiRelevanceEntity);

@ -5,6 +5,7 @@ import com.glxp.api.admin.dao.basic.BasicUnitMaintainDao;
import com.glxp.api.admin.entity.basic.BasicUnitMaintainEntity;
import com.glxp.api.admin.req.basic.BasicUnitMaintainFilterRequest;
import com.glxp.api.admin.req.basic.BasicUnitMaintainSaveRequest;
import com.glxp.api.admin.req.basic.FilterUdiInfoRequest;
import com.glxp.api.admin.service.basic.BasicUnitMaintainService;
import org.springframework.stereotype.Service;
@ -48,6 +49,26 @@ public class BasicUnitMaintainServiceImpl implements BasicUnitMaintainService {
return basicUnitMaintainDao.deleteById(id);
}
@Override
public BasicUnitMaintainEntity selectByThirdId(String thirdId, String thirdSys) {
BasicUnitMaintainFilterRequest filterUdiInfoRequest = new BasicUnitMaintainFilterRequest();
if ("thirdId".equals(thirdSys)) {
filterUdiInfoRequest.setThirdId(thirdId);
} else if ("thirdId1".equals(thirdSys)) {
filterUdiInfoRequest.setThirdId1(thirdId);
} else if ("thirdId2".equals(thirdSys)) {
filterUdiInfoRequest.setThirdId2(thirdId);
} else if ("thirdId3".equals(thirdSys)) {
filterUdiInfoRequest.setThirdId3(thirdId);
} else if ("thirdId4".equals(thirdSys)) {
filterUdiInfoRequest.setThirdId4(thirdId);
}
return basicUnitMaintainDao.selectByThirdId(filterUdiInfoRequest);
}
@Override
public BasicUnitMaintainEntity selectById(String id) {
return basicUnitMaintainDao.selectById(id);

@ -2,10 +2,12 @@ package com.glxp.api.admin.service.basic.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.dao.basic.UdiRelevanceDao;
import com.glxp.api.admin.entity.basic.BasicThirdSysEntity;
import com.glxp.api.admin.entity.basic.UdiInfoEntity;
import com.glxp.api.admin.entity.basic.UdiRelevanceEntity;
import com.glxp.api.admin.req.basic.FilterUdiInfoRequest;
import com.glxp.api.admin.res.basic.UdiRelevanceResponse;
import com.glxp.api.admin.service.basic.BasicThirdSysService;
import com.glxp.api.admin.service.basic.UdiRelevanceService;
import org.springframework.stereotype.Service;
@ -17,6 +19,8 @@ import java.util.List;
public class UdiRelevanceServiceImpl implements UdiRelevanceService {
@Resource
UdiRelevanceDao udiRelevanceDao;
@Resource
BasicThirdSysService basicThirdSysService;
@Override
public List<UdiRelevanceResponse> filterUdiRelevance(FilterUdiInfoRequest filterUdiInfoRequest) {
@ -58,6 +62,15 @@ public class UdiRelevanceServiceImpl implements UdiRelevanceService {
return data;
}
@Override
public boolean isExitByUuid(String uuid) {
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceDao.selectByUuid(uuid);
if (udiRelevanceEntities != null && !udiRelevanceEntities.isEmpty()) {
return true;
}
return false;
}
@Override
public List<UdiRelevanceEntity> selectByUuid(String uuid) {
return udiRelevanceDao.selectByUuid(uuid);
@ -78,6 +91,77 @@ public class UdiRelevanceServiceImpl implements UdiRelevanceService {
return null;
}
@Override
public UdiRelevanceEntity selectUpdateByUuid(String uuid) {
FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest();
filterUdiInfoRequest.setUuid(uuid);
List<UdiRelevanceEntity> data = udiRelevanceDao.filterEntity(filterUdiInfoRequest);
if (data != null && data.size() > 0)
return data.get(0);
return null;
}
@Override
public UdiRelevanceEntity selectUpdateByThirdId(String thirdId) {
FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest();
if (thirdId != null) {
BasicThirdSysEntity basicThirdSysEntity = basicThirdSysService.selectMainThrSys();
String mainSys = basicThirdSysEntity.getThirdId();
if (mainSys.equals("thirdId")) {
filterUdiInfoRequest.setThirdId(thirdId);
} else if (mainSys.equals("thirdId1")) {
filterUdiInfoRequest.setThirdId1(thirdId);
} else if (mainSys.equals("thirdId2")) {
filterUdiInfoRequest.setThirdId2(thirdId);
} else if (mainSys.equals("thirdId3")) {
filterUdiInfoRequest.setThirdId3(thirdId);
} else if (mainSys.equals("thirdId4")) {
filterUdiInfoRequest.setThirdId4(thirdId);
}
}
List<UdiRelevanceEntity> data = udiRelevanceDao.filterEntity(filterUdiInfoRequest);
if (data != null && data.size() > 0)
return data.get(0);
return null;
}
@Override
public UdiRelevanceEntity selectUpteaByAll(String uuid, String thirdId) {
FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest();
if (thirdId != null) {
BasicThirdSysEntity basicThirdSysEntity = basicThirdSysService.selectMainThrSys();
String mainSys = basicThirdSysEntity.getThirdId();
filterUdiInfoRequest.setUuid(uuid);
if (mainSys.equals("thirdId")) {
filterUdiInfoRequest.setThirdId(thirdId);
} else if (mainSys.equals("thirdId1")) {
filterUdiInfoRequest.setThirdId1(thirdId);
} else if (mainSys.equals("thirdId2")) {
filterUdiInfoRequest.setThirdId2(thirdId);
} else if (mainSys.equals("thirdId3")) {
filterUdiInfoRequest.setThirdId3(thirdId);
} else if (mainSys.equals("thirdId4")) {
filterUdiInfoRequest.setThirdId4(thirdId);
}
}
List<UdiRelevanceEntity> data = udiRelevanceDao.filterEntity(filterUdiInfoRequest);
// if ((data == null || data.isEmpty()) && thirdId != null) {
// filterUdiInfoRequest.setUuid(null);
// data = udiRelevanceDao.filterEntity(filterUdiInfoRequest);
// if ((data == null || data.isEmpty()) && uuid != null) {
// filterUdiInfoRequest.setUuid(uuid);
// filterUdiInfoRequest.setThirdId(null);
// data = udiRelevanceDao.filterEntity(filterUdiInfoRequest);
// }
// }
if (data != null && data.size() > 0)
return data.get(0);
return null;
}
@Override
public UdiRelevanceEntity selectByThirdId(String thirdId, String thirdSys) {
FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest();

@ -43,7 +43,7 @@ public class ThrDataService {
return null;
}
if ( basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if ( basicThirdSysDetailEntity.getFromType() == 0 ) {
FilterErpGoodsRequest filterErpGoodsRequest = new FilterErpGoodsRequest();
filterErpGoodsRequest.setCode(code);
filterErpGoodsRequest.setPage(1);

@ -0,0 +1,324 @@
package com.glxp.api.admin.thread;
import com.glxp.api.admin.entity.basic.UdiInfoEntity;
import com.glxp.api.admin.entity.basic.UdiRelevanceEntity;
import com.glxp.api.admin.entity.info.SystemParamConfigEntity;
import com.glxp.api.admin.entity.thrsys.ThrProductsEntity;
import com.glxp.api.admin.httpclient.ErpBasicClient;
import com.glxp.api.admin.httpclient.ErpInvClient;
import com.glxp.api.admin.req.basic.FilterErpGoodsRequest;
import com.glxp.api.admin.req.inventory.ErpOnhandRequest;
import com.glxp.api.admin.req.thrsys.FilterThrProductsRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.res.basic.ErpProductsResponse;
import com.glxp.api.admin.res.inventory.ErpInvProductResponse;
import com.glxp.api.admin.service.basic.UdiInfoService;
import com.glxp.api.admin.service.basic.UdiRelevanceService;
import com.glxp.api.admin.service.info.SystemParamConfigService;
import com.glxp.api.admin.service.thrsys.ThrProductsService;
import com.glxp.api.admin.util.CustomUtil;
import com.glxp.api.admin.util.DateUtil;
import com.glxp.api.common.res.BaseResponse;
import org.springframework.beans.BeanUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class BasicBackUpdateProductService {
@Resource
UdiRelevanceService udiRelevanceService;
@Resource
UdiInfoService udiInfoService;
@Resource
ThrProductsService thrProductsService;
@Resource
SystemParamConfigService systemParamConfigService;
//定时或一键下载更新全部线上产品信息
@Async
public void addAllProducts(FilterErpGoodsRequest filterErpGoodsRequest, String productUrl, String onHandUrl, String thirdSysId, Boolean isEnable) {
int page = 1;
if (filterErpGoodsRequest == null) {
filterErpGoodsRequest = new FilterErpGoodsRequest();
}
filterErpGoodsRequest.setPage(1);
filterErpGoodsRequest.setLimit(100);
while (page != -1) {
page = getAllProducts(filterErpGoodsRequest, productUrl, onHandUrl, thirdSysId, isEnable);
}
}
//定时或一键下载更新全部线上产品信息
public int getAllProducts(FilterErpGoodsRequest filterErpGoodsRequest, String productUrl, String
onHandUrl, String thirdSysId, Boolean isEnable) {
BaseResponse<PageSimpleResponse<ErpProductsResponse>> erpProducts = new ErpBasicClient().getErpProducts(filterErpGoodsRequest, productUrl);
List<ErpProductsResponse> invmandocResponses = erpProducts.getData().getList();
SystemParamConfigEntity isUpdate = systemParamConfigService.selectByParamKey("erp_updateErpData_type");
if (isEnable == null || isEnable == false) {
isUpdate.setParamValue("1");
}
Map<String, ErpProductsResponse> erpProductsMap = new HashMap<>();
if (invmandocResponses != null && invmandocResponses.size() > 0) {
List<String> inventoryCodes = new ArrayList<>();
// if (filterErpGoodsRequest.getCode() != null) {
// inventoryCodes.add(filterErpGoodsRequest.getCode());
// erpProductsMap.put(filterErpGoodsRequest.getCode(), invmandocResponses.get(0));
// } else {
for (ErpProductsResponse invmandocResponse : invmandocResponses) {
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByThirdId(invmandocResponse.getCode(), thirdSysId);
if (udiRelevanceEntity == null) {
inventoryCodes.add(invmandocResponse.getCode());
erpProductsMap.put(invmandocResponse.getCode(), invmandocResponse);
if (isUpdate.getParamValue().equals("1")) {//不根据库存信息过滤
UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
udiInfoEntity.setNameCode(invmandocResponse.getCode());
udiInfoEntity.setCpmctymc(invmandocResponse.getName());
udiInfoEntity.setGgxh(invmandocResponse.getSpec());
udiInfoEntity.setUuid(CustomUtil.getUUId());
udiInfoEntity.setDiType(1);
udiInfoEntity.setManufactory(invmandocResponses.get(0).getManufactory());
udiInfoEntity.setYlqxzcrbarmc(invmandocResponses.get(0).getManufactory());
udiInfoEntity.setZczbhhzbapzbh(invmandocResponses.get(0).getRegisterNo());
udiInfoService.insertUdiInfo(udiInfoEntity);
UdiRelevanceEntity udiRelevanceEntity1 = new UdiRelevanceEntity();
udiRelevanceEntity1.setUuid(udiInfoEntity.getUuid());
if ("thirdId".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId(invmandocResponse.getCode());
udiRelevanceEntity1.setThirdName(invmandocResponse.getName());
} else if ("thirdId1".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId1(invmandocResponse.getCode());
udiRelevanceEntity1.setThirdName1(invmandocResponse.getName());
} else if ("thirdId2".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId4(invmandocResponse.getCode());
udiRelevanceEntity1.setThirdName4(invmandocResponse.getName());
} else if ("thirdId3".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId3(invmandocResponse.getCode());
udiRelevanceEntity1.setThirdName3(invmandocResponse.getName());
} else if ("thirdId4".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId4(invmandocResponse.getCode());
udiRelevanceEntity1.setThirdName4(invmandocResponse.getName());
}
udiRelevanceEntity1.setThirdId(invmandocResponse.getCode());
udiRelevanceEntity1.setThirdName(invmandocResponse.getName());
udiRelevanceEntity1.setUpdateTime(DateUtil.getDateTime());
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity1);
}
}
// }
}
//若需要对照库存信息
if (!isUpdate.getParamValue().equals("1")) {
if (inventoryCodes.size() > 0) {
ErpOnhandRequest erpOnhandRequest = new ErpOnhandRequest();
erpOnhandRequest.setInventoryCodes(inventoryCodes);
List<ErpInvProductResponse> erpOnHandResponses = new ErpInvClient().getInvPrdoduct(erpOnhandRequest, onHandUrl);
if (erpOnHandResponses != null) {
Map<String, List<ErpInvProductResponse>> map = erpOnHandResponses.stream().collect(Collectors.groupingBy(ErpInvProductResponse::getCode));
for (List<ErpInvProductResponse> onHandResponses : map.values()) {
if (onHandResponses != null && onHandResponses.size() > 0) {
ErpInvProductResponse onhandQueryResponse = onHandResponses.get(0);
if (isUpdate.getParamValue().equals("2")) {
addRl(onhandQueryResponse, thirdSysId, erpProductsMap);
} else if (isUpdate.getParamValue().equals("3")) {
if (onhandQueryResponse.getCount() != null && onhandQueryResponse.getCount() > 0) {
addRl(onhandQueryResponse, thirdSysId, erpProductsMap);
}
} else if (isUpdate.getParamValue().equals("4")) {
if (onhandQueryResponse.getCount() == null || onhandQueryResponse.getCount() <= 0) {
addRl(onhandQueryResponse, thirdSysId, erpProductsMap);
}
}
}
}
}
}
}
filterErpGoodsRequest.setPage(filterErpGoodsRequest.getPage() + 1);
if (filterErpGoodsRequest.getPage() * filterErpGoodsRequest.getLimit() < erpProducts.getData().getTotal()) {
return filterErpGoodsRequest.getPage();
}
} else {
return -1;
}
return -1;
}
//定时或一键下载更新本地所有产品信息
@Async
public void loadLocal(FilterErpGoodsRequest filterErpGoodsRequest, String thirdSysId, String onHandUrl, Boolean isEnable) {
if (filterErpGoodsRequest == null) {
filterErpGoodsRequest = new FilterErpGoodsRequest();
}
FilterThrProductsRequest filterThrInvProductsRequest = new FilterThrProductsRequest();
BeanUtils.copyProperties(filterErpGoodsRequest, filterThrInvProductsRequest);
filterThrInvProductsRequest.setPage(null);
List<ThrProductsEntity> thrProductsEntities = thrProductsService.filterThrProductsRequest(filterThrInvProductsRequest);
SystemParamConfigEntity isUpdate = systemParamConfigService.selectByParamKey("erp_updateErpData_type");
if (isEnable == null || isEnable == false) {
isUpdate.setParamValue("1");
}
if (thrProductsEntities != null && thrProductsEntities.size() > 0) {
for (ThrProductsEntity thrProductsEntity : thrProductsEntities) {
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByThirdId(thrProductsEntity.getCode(), thirdSysId);
if (udiRelevanceEntity == null){
if (isUpdate.getParamValue().equals("1")) {
UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
udiInfoEntity.setNameCode(thrProductsEntity.getCode());
udiInfoEntity.setCpmctymc(thrProductsEntity.getName());
udiInfoEntity.setGgxh(thrProductsEntity.getSpec());
udiInfoEntity.setUuid(CustomUtil.getUUId());
udiInfoEntity.setDiType(1);
udiInfoEntity.setManufactory(thrProductsEntity.getManufactory());
udiInfoEntity.setYlqxzcrbarmc(thrProductsEntity.getManufactory());
udiInfoEntity.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo());
udiInfoService.insertUdiInfo(udiInfoEntity);
UdiRelevanceEntity udiRelevanceEntity1 = new UdiRelevanceEntity();
udiRelevanceEntity1.setUuid(udiInfoEntity.getUuid());
if ("thirdId".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId(thrProductsEntity.getCode());
udiRelevanceEntity1.setThirdName(thrProductsEntity.getName());
} else if ("thirdId1".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId1(thrProductsEntity.getCode());
udiRelevanceEntity1.setThirdName1(thrProductsEntity.getName());
} else if ("thirdId2".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId4(thrProductsEntity.getCode());
udiRelevanceEntity1.setThirdName4(thrProductsEntity.getName());
} else if ("thirdId3".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId3(thrProductsEntity.getCode());
udiRelevanceEntity1.setThirdName3(thrProductsEntity.getName());
} else if ("thirdId4".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId4(thrProductsEntity.getCode());
udiRelevanceEntity1.setThirdName4(thrProductsEntity.getName());
}
udiRelevanceEntity1.setThirdId(thrProductsEntity.getCode());
udiRelevanceEntity1.setThirdName(thrProductsEntity.getName());
udiRelevanceEntity1.setUpdateTime(DateUtil.getDateTime());
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity1);
} else {
ErpOnhandRequest erpOnhandRequest = new ErpOnhandRequest();
erpOnhandRequest.setInventoryCode(thrProductsEntity.getCode());
List<ErpInvProductResponse> erpOnHandResponses = new ErpInvClient().getInvPrdoduct(erpOnhandRequest, onHandUrl);
if (erpOnHandResponses != null && erpOnHandResponses.size() > 0) {
ErpInvProductResponse onhandQueryResponse = erpOnHandResponses.get(0);
if (isUpdate.getParamValue().equals("2")) {
addRl(onhandQueryResponse, thirdSysId, thrProductsEntity);
} else if (isUpdate.getParamValue().equals("3")) {
if (onhandQueryResponse.getCount() != null && onhandQueryResponse.getCount() > 0) {
addRl(onhandQueryResponse, thirdSysId, thrProductsEntity);
}
} else if (isUpdate.getParamValue().equals("4")) {
if (onhandQueryResponse.getCount() == null || onhandQueryResponse.getCount() <= 0) {
addRl(onhandQueryResponse, thirdSysId, thrProductsEntity);
}
}
}
}
}
}
}
}
public void addRl(ErpInvProductResponse onhandQueryResponse, String
thirdSysId, Map<String, ErpProductsResponse> erpProductsMap) {
UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
udiInfoEntity.setNameCode(onhandQueryResponse.getCode());
udiInfoEntity.setCpmctymc(onhandQueryResponse.getName());
udiInfoEntity.setGgxh(onhandQueryResponse.getSpec());
udiInfoEntity.setUuid(CustomUtil.getUUId());
udiInfoEntity.setDiType(1);
udiInfoEntity.setManufactory(erpProductsMap.get(onhandQueryResponse.getCode()).getManufactory());
udiInfoEntity.setYlqxzcrbarmc(erpProductsMap.get(onhandQueryResponse.getCode()).getManufactory());
udiInfoEntity.setZczbhhzbapzbh(erpProductsMap.get(onhandQueryResponse.getCode()).getRegisterNo());
udiInfoService.insertUdiInfo(udiInfoEntity);
UdiRelevanceEntity udiRelevanceEntity1 = new UdiRelevanceEntity();
udiRelevanceEntity1.setUuid(udiInfoEntity.getUuid());
if ("thirdId".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName(onhandQueryResponse.getName());
} else if ("thirdId1".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId1(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName1(onhandQueryResponse.getName());
} else if ("thirdId2".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId4(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName4(onhandQueryResponse.getName());
} else if ("thirdId3".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId3(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName3(onhandQueryResponse.getName());
} else if ("thirdId4".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId4(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName4(onhandQueryResponse.getName());
}
udiRelevanceEntity1.setThirdId(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName(onhandQueryResponse.getName());
udiRelevanceEntity1.setUpdateTime(DateUtil.getDateTime());
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity1);
}
public void addRl(ErpInvProductResponse onhandQueryResponse, String
thirdSysId, ThrProductsEntity erpProductsResponse) {
UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
udiInfoEntity.setNameCode(onhandQueryResponse.getCode());
udiInfoEntity.setCpmctymc(onhandQueryResponse.getName());
udiInfoEntity.setGgxh(onhandQueryResponse.getSpec());
udiInfoEntity.setUuid(CustomUtil.getUUId());
udiInfoEntity.setDiType(1);
udiInfoEntity.setManufactory(erpProductsResponse.getManufactory());
udiInfoEntity.setYlqxzcrbarmc(erpProductsResponse.getManufactory());
udiInfoEntity.setZczbhhzbapzbh(erpProductsResponse.getRegisterNo());
udiInfoService.insertUdiInfo(udiInfoEntity);
UdiRelevanceEntity udiRelevanceEntity1 = new UdiRelevanceEntity();
udiRelevanceEntity1.setUuid(udiInfoEntity.getUuid());
if ("thirdId".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName(onhandQueryResponse.getName());
} else if ("thirdId1".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId1(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName1(onhandQueryResponse.getName());
} else if ("thirdId2".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId4(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName4(onhandQueryResponse.getName());
} else if ("thirdId3".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId3(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName3(onhandQueryResponse.getName());
} else if ("thirdId4".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId4(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName4(onhandQueryResponse.getName());
}
udiRelevanceEntity1.setThirdId(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName(onhandQueryResponse.getName());
udiRelevanceEntity1.setUpdateTime(DateUtil.getDateTime());
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity1);
}
}

@ -0,0 +1,34 @@
package com.glxp.api.admin.thread;
import com.glxp.api.admin.entity.basic.UdiRelevanceEntity;
import com.glxp.api.admin.service.basic.UdiRelevanceService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class BasicDiUpdateHelper {
@Resource
UdiRelevanceService udiRelevanceService;
//是否可以新增UDI
public void isAddUdi() {
}
//是否可以新增第三方产品ID
public void isAddThridId(String thirdId, String thirdId1, String thirdId2, String thirdId3, String thirdId4) {
}
//是否可以同时关联
public void isAllAdd(String uuid, String thirdId, String thirdId1, String thirdId2, String thirdId3, String thirdId4) {
}
}

@ -1,25 +1,32 @@
package com.glxp.api.admin.thread;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.glxp.api.admin.constant.BasicProcessStatus;
import com.glxp.api.admin.entity.basic.UdiInfoEntity;
import com.glxp.api.admin.entity.basic.UdiInfoImportDetailEntity;
import com.glxp.api.admin.entity.basic.UdiInfoImportLogEntity;
import com.glxp.api.admin.entity.basic.UdiRelevanceEntity;
import com.glxp.api.admin.entity.basic.*;
import com.glxp.api.admin.entity.info.SystemParamConfigEntity;
import com.glxp.api.admin.entity.thrsys.ThrProductsEntity;
import com.glxp.api.admin.httpclient.UdiDlHttpClient;
import com.glxp.api.admin.req.basic.FilterUdiIpLogRequest;
import com.glxp.api.admin.service.basic.UdiInfoImportLogService;
import com.glxp.api.admin.service.basic.UdiInfoImportDetailService;
import com.glxp.api.admin.service.basic.UdiInfoService;
import com.glxp.api.admin.service.basic.UdiRelevanceService;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.res.basic.UdiRelevanceResponse;
import com.glxp.api.admin.service.basic.*;
import com.glxp.api.admin.service.info.SystemParamConfigService;
import com.glxp.api.admin.service.thrsys.ThrDataService;
import com.glxp.api.admin.util.CustomUtil;
import com.glxp.api.admin.util.DateUtil;
import com.glxp.api.admin.util.HttpClient;
import com.glxp.api.common.res.BaseResponse;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class BasicUdiInfoImportService {
@ -36,6 +43,10 @@ public class BasicUdiInfoImportService {
ThrDataService thrDataService;
@Value("${UDI_SERVER_URL}")
private String udiUrl;
@Resource
SystemParamConfigService systemParamConfigService;
@Resource
BasicThirdSysService basicThirdSysService;
//导入产品信息文件,生成产品信息,更新或插入对照表
@Async
@ -49,55 +60,291 @@ public class BasicUdiInfoImportService {
= udiInfoImportService.filterUdiInfoImport(filterUdiIpLogRequest);
if (udiInfoImportEntities != null) {
for (UdiInfoImportDetailEntity udiInfoImportDetailEntity : udiInfoImportEntities) {
UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(udiInfoImportDetailEntity.getUdiCode());
UdiInfoEntity udiInfoEntity = null;
//国家库获取取UDI信息
if (udiInfoImportDetailEntity.getUdiCode() != null && !udiInfoImportDetailEntity.getUdiCode().trim().isEmpty()) {
udiInfoEntity = udiInfoService.findByNameCode(udiInfoImportDetailEntity.getUdiCode());
List<UdiInfoEntity> froms = null;
if (udiInfoEntity == null) {
froms = new UdiDlHttpClient(udiUrl).getUdiByDi(udiInfoImportDetailEntity.getUdiCode());
if (froms != null && !froms.isEmpty()) {
udiInfoEntity = froms.get(0);
} else {
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_FAIL);
udiInfoImportDetailEntity.setRemark("未查询到UDI产品信息");
udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
continue;
}
}
if (froms != null)
udiInfoService.insertUdiInfos(froms);
}
//判断更新
BasicThirdSysEntity basicThirdSysEntity = basicThirdSysService.selectMainThrSys();
String mainSys = basicThirdSysEntity.getThirdId();
String mainId = null;
if (mainSys.equals("thirdId")) {
mainId = udiInfoImportDetailEntity.getThirdId();
} else if (mainSys.equals("thirdId1")) {
mainId = udiInfoImportDetailEntity.getThirdId1();
} else if (mainSys.equals("thirdId2")) {
mainId = udiInfoImportDetailEntity.getThirdId2();
} else if (mainSys.equals("thirdId3")) {
mainId = udiInfoImportDetailEntity.getThirdId3();
} else if (mainSys.equals("thirdId4")) {
mainId = udiInfoImportDetailEntity.getThirdId4();
}
UdiRelevanceEntity udiRelevanceEntity = null;
if (udiInfoEntity == null) {
//国家库取UDI信息
List<UdiInfoEntity> froms = new UdiDlHttpClient(udiUrl).getUdiByDi(udiInfoImportDetailEntity.getUdiCode());
if (froms != null && !froms.isEmpty()) {
udiInfoEntity = froms.get(0);
UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity();
udiRelevanceEntity = udiRelevanceService.selectUpdateByThirdId(mainId); //更新
if (mainId != null) {
ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiInfoImportDetailEntity.getThirdId(), "thirdId");
udiInfoEntity = new UdiInfoEntity();
udiInfoEntity.setNameCode(thrProductsEntity.getCode());
udiInfoEntity.setCpmctymc(thrProductsEntity.getName());
udiInfoEntity.setGgxh(thrProductsEntity.getSpec());
udiInfoEntity.setUuid(CustomUtil.getUUId());
udiInfoEntity.setDiType(1);
udiInfoEntity.setManufactory(thrProductsEntity.getManufactory());
udiInfoEntity.setYlqxzcrbarmc(thrProductsEntity.getManufactory());
udiInfoEntity.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo());
udiInfoService.insertUdiInfo(udiInfoEntity);
} else {
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_FAIL);
udiInfoImportDetailEntity.setRemark("格式错误!");
udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
continue;
}
if (udiRelevanceEntity == null) {
udiRelevanceEntity = new UdiRelevanceEntity();
udiRelevanceEntity.setUuid(udiInfoEntity.getUuid());
udiRelevanceEntity.setUpdateTime(DateUtil.getDateTime());
udiRelevanceEntity.setThirdId(udiInfoImportDetailEntity.getThirdId());
udiRelevanceEntity.setThirdId1(udiInfoImportDetailEntity.getThirdId1());
udiRelevanceEntity.setThirdId2(udiInfoImportDetailEntity.getThirdId2());
udiRelevanceEntity.setThirdId3(udiInfoImportDetailEntity.getThirdId3());
udiRelevanceEntity.setThirdId4(udiInfoImportDetailEntity.getThirdId4());
udiRelevanceEntity.setYbbm(udiInfoImportDetailEntity.getYbbm());
udiRelevanceEntity.setSptm(udiInfoImportDetailEntity.getSptm());
if (udiRelevanceEntity.getThirdId() != null) {
ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiRelevanceEntity.getThirdId(), "thirdId");
if(thrProductsEntity!=null){
udiRelevanceEntity.setManufactory(thrProductsEntity.getManufactory());
udiRelevanceEntity.setMeasname(thrProductsEntity.getMeasname());
udiInfoService.insertUdiInfos(froms);
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_SUCESS);
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
}else {
updateValue(udiRelevanceEntity, udiInfoImportDetailEntity, udiInfoImportLogEntity, mainId);
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
} else {
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_FAIL);
udiInfoImportDetailEntity.setRemark("产品编码已存在,不能重复插入!");
udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
}
} else {
if (mainId == null) {//只存在UDI
UdiRelevanceEntity temp = udiRelevanceService.selectUpdateByUuid(udiInfoEntity.getUuid());
if (temp != null &&
(temp.getThirdId() != null || temp.getThirdId1() != null || temp.getThirdId2() != null ||
temp.getThirdId3() != null || temp.getThirdId4() != null)) {
udiRelevanceEntity.setUuid(udiInfoEntity.getUuid());
updateValue(udiRelevanceEntity, udiInfoImportDetailEntity, udiInfoImportLogEntity, mainId);
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
} else {
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_FAIL);
udiInfoImportDetailEntity.setRemark("UDI已存在并且未关联不能重复插入");
udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
}
} else {
UdiRelevanceEntity temp = udiRelevanceService.selectUpteaByAll(udiInfoEntity.getUuid(), mainId);
if (temp != null) {
updateValue(temp, udiInfoImportDetailEntity, udiInfoImportLogEntity, mainId);
udiRelevanceService.updateUdiRelevance(temp);
} else {
UdiRelevanceEntity mTemp = udiRelevanceService.selectUpdateByThirdId(mainId);
if(mTemp!=null){
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_FAIL);
udiInfoImportDetailEntity.setRemark("未查询到系统产品信息!");
udiInfoImportDetailEntity.setRemark("产品编码已存在关联不能重复插入");
udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
}else {
UdiRelevanceEntity mTemp2 = udiRelevanceService.selectUpdateByUuid(udiInfoEntity.getUuid());
if(mTemp2!=null && (mTemp2.getThirdId() != null || mTemp2.getThirdId1() != null || mTemp2.getThirdId2() != null ||
mTemp2.getThirdId3() != null || mTemp2.getThirdId4() != null)){
udiRelevanceEntity = new UdiRelevanceEntity();
udiRelevanceEntity.setUuid(udiInfoEntity.getUuid());
updateValue(udiRelevanceEntity,udiInfoImportDetailEntity,udiInfoImportLogEntity,mainId);
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
}else {
udiRelevanceEntity = new UdiRelevanceEntity();
udiRelevanceEntity.setUuid(udiInfoEntity.getUuid());
updateValue(udiRelevanceEntity,udiInfoImportDetailEntity,udiInfoImportLogEntity,mainId);
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
}
}
}
} else {
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_FAIL);
udiInfoImportDetailEntity.setRemark("未查询到UDI产品信息");
udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
}
}
}else {
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_SUCESS);
}
//字段更新
udiInfoImportService.updateUdiInfoImport(udiInfoImportDetailEntity);
}
udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
udiInfoImportLogService.updateImportLog(udiInfoImportLogEntity);
}
udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
udiInfoImportLogService.updateImportLog(udiInfoImportLogEntity);
}
}
public void updateValue(UdiRelevanceEntity udiRelevanceEntity, UdiInfoImportDetailEntity udiInfoImportDetailEntity, UdiInfoImportLogEntity udiInfoImportLogEntity, String mainId) {
udiRelevanceEntity.setUpdateTime(DateUtil.getDateTime());
if (udiInfoImportDetailEntity.getYbbm() != null && !udiInfoImportDetailEntity.getYbbm().trim().equals("")) {
udiRelevanceEntity.setYbbm(udiInfoImportDetailEntity.getYbbm());
}
if (udiInfoImportDetailEntity.getSptm() != null && !udiInfoImportDetailEntity.getSptm().trim().equals("")) {
udiRelevanceEntity.setSptm(udiInfoImportDetailEntity.getSptm());
}
if (udiInfoImportDetailEntity.getThirdId() != null && !udiInfoImportDetailEntity.getThirdId().trim().equals("")) {
ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiInfoImportDetailEntity.getThirdId(), "thirdId");
if (thrProductsEntity != null) {
if (mainId != null && udiInfoImportDetailEntity.getThirdId().equals(mainId)) {
udiRelevanceEntity.setManufactory(thrProductsEntity.getManufactory());
udiRelevanceEntity.setMeasname(thrProductsEntity.getMeasname());
}
udiRelevanceEntity.setThirdName(thrProductsEntity.getName());
udiRelevanceEntity.setThirdId(udiInfoImportDetailEntity.getThirdId());
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_SUCESS);
} else {
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_FAIL);
udiInfoImportDetailEntity.setRemark("未查询到系统产品信息!");
udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
}
}
if (udiInfoImportDetailEntity.getThirdId1() != null && !udiInfoImportDetailEntity.getThirdId1().trim().equals("")) {
ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiInfoImportDetailEntity.getThirdId1(), "thirdId1");
if (thrProductsEntity != null) {
if (mainId != null && udiInfoImportDetailEntity.getThirdId1().equals(mainId)) {
udiRelevanceEntity.setManufactory(thrProductsEntity.getManufactory());
udiRelevanceEntity.setMeasname(thrProductsEntity.getMeasname());
}
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_SUCESS);
udiRelevanceEntity.setThirdName1(thrProductsEntity.getName());
udiRelevanceEntity.setThirdId1(udiInfoImportDetailEntity.getThirdId1());
} else {
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_FAIL);
udiInfoImportDetailEntity.setRemark("未查询到系统产品信息!");
udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
}
}
if (udiInfoImportDetailEntity.getThirdId2() != null && !udiInfoImportDetailEntity.getThirdId2().trim().equals("")) {
ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiInfoImportDetailEntity.getThirdId2(), "thirdId2");
if (thrProductsEntity != null) {
if (mainId != null && udiInfoImportDetailEntity.getThirdId2().equals(mainId)) {
udiRelevanceEntity.setManufactory(thrProductsEntity.getManufactory());
udiRelevanceEntity.setMeasname(thrProductsEntity.getMeasname());
}
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_SUCESS);
udiRelevanceEntity.setThirdId2(udiInfoImportDetailEntity.getThirdId2());
udiRelevanceEntity.setThirdName2(thrProductsEntity.getName());
} else {
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_FAIL);
udiRelevanceEntity.setThirdId(udiInfoImportDetailEntity.getThirdId());
udiInfoImportDetailEntity.setRemark("未查询到系统产品信息!");
udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
}
}
if (udiInfoImportDetailEntity.getThirdId3() != null && !udiInfoImportDetailEntity.getThirdId3().trim().equals("")) {
ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiInfoImportDetailEntity.getThirdId3(), "thirdId3");
if (thrProductsEntity != null) {
if (mainId != null && udiInfoImportDetailEntity.getThirdId3().equals(mainId)) {
udiRelevanceEntity.setManufactory(thrProductsEntity.getManufactory());
udiRelevanceEntity.setMeasname(thrProductsEntity.getMeasname());
}
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_SUCESS);
udiRelevanceEntity.setThirdId3(udiInfoImportDetailEntity.getThirdId3());
udiRelevanceEntity.setThirdName3(thrProductsEntity.getName());
} else {
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_FAIL);
udiRelevanceEntity.setThirdId(udiInfoImportDetailEntity.getThirdId());
udiInfoImportDetailEntity.setRemark("未查询到系统产品信息!");
udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
}
}
if (udiInfoImportDetailEntity.getThirdId4() != null && !udiInfoImportDetailEntity.getThirdId4().trim().equals("")) {
ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiInfoImportDetailEntity.getThirdId4(), "thirdId1");
if (thrProductsEntity != null) {
if (mainId != null && udiInfoImportDetailEntity.getThirdId4().equals(mainId)) {
udiRelevanceEntity.setManufactory(thrProductsEntity.getManufactory());
udiRelevanceEntity.setMeasname(thrProductsEntity.getMeasname());
}
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_SUCESS);
udiRelevanceEntity.setThirdName4(thrProductsEntity.getName());
udiRelevanceEntity.setThirdId4(udiInfoImportDetailEntity.getThirdId4());
} else {
udiInfoImportDetailEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_FAIL);
udiInfoImportDetailEntity.setRemark("未查询到系统产品信息!");
udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
}
}
}
//下载供应商产品信息,
@Async
public void downloadSmpUdiInfo(String genKey) {
int page = 1;
int limit = 100;
String lastUpdateTime = DateUtil.formatDateTime(new Date());
while (true) {
List<UdiRelevanceResponse> udiRelevanceResponses = getUdiInfo(page, limit, lastUpdateTime);
if (udiRelevanceResponses != null && udiRelevanceResponses.size() > 0) {
for (UdiRelevanceResponse udiRelevanceResponse : udiRelevanceResponses) {
UdiInfoImportDetailEntity udiInfoImportEntity = new UdiInfoImportDetailEntity();
udiInfoImportEntity.setUdiCode(udiRelevanceResponse.getNameCode());
BeanUtils.copyProperties(udiRelevanceResponse, udiInfoImportEntity);
udiInfoImportEntity.setThirdId(udiRelevanceResponse.getErpId());
udiInfoImportEntity.setUpdateTime(new Date());
udiInfoImportEntity.setGenKeyFk(genKey);
udiInfoImportService.insertUdiInfoImport(udiInfoImportEntity);
}
if (udiRelevanceResponses.size() >= 100) {
page++;
} else {
break;
}
} else {
break;
}
}
importUdiInfo(genKey);
}
public List<UdiRelevanceResponse> getUdiInfo(int page, int limit, String lastUpdateTime) {
String smpUrl = "";
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("smp_service_ip");
if (systemParamConfigEntity != null) {
smpUrl = systemParamConfigEntity.getParamValue();
}
Map<String, Object> paramMap = new HashMap<>(16);
paramMap.put("page", 1);
paramMap.put("limit", 100);
paramMap.put("lastUpdateTime", lastUpdateTime);
String response = HttpClient.mipsGet(smpUrl + "/udiwms/basic/products/download", paramMap);
try {
BaseResponse<PageSimpleResponse<UdiRelevanceResponse>> udiDlDeviceResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<UdiRelevanceResponse>>>() {
});
if (udiDlDeviceResponse != null && udiDlDeviceResponse.getCode() == 20000) {
List<UdiRelevanceResponse> udiRelevanceResponses = udiDlDeviceResponse.getData().getList();
return udiRelevanceResponses;
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return null;
}
}

@ -0,0 +1,103 @@
package com.glxp.api.admin.thread;
import com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity;
import com.glxp.api.admin.entity.basic.BasicUnitMaintainEntity;
import com.glxp.api.admin.entity.thrsys.ThrCorpEntity;
import com.glxp.api.admin.httpclient.ErpBasicClient;
import com.glxp.api.admin.req.basic.BasicUnitMaintainFilterRequest;
import com.glxp.api.admin.req.thrsys.FilterThrCorpRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.res.basic.ErpUnitsResponse;
import com.glxp.api.admin.service.basic.BasicUnitMaintainService;
import com.glxp.api.admin.service.thrsys.ThrCorpService;
import com.glxp.api.admin.util.CustomUtil;
import com.glxp.api.common.res.BaseResponse;
import org.springframework.beans.BeanUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class BasicUnitImportService {
@Resource
private BasicUnitMaintainService basicUnitMaintainService;
@Resource
private ThrCorpService thrCorpService;
@Async
public void selectAllUnit(BasicThirdSysDetailEntity basicThirdSysDetailEntity, BasicUnitMaintainFilterRequest unitMaintainFilterRequest){
List<ErpUnitsResponse> imports = new ArrayList<>();
if (basicThirdSysDetailEntity.getFromType() == 0) {
int page = 1;
List<ErpUnitsResponse> erpUnitsResponses = new ArrayList<>();
while (true) {
unitMaintainFilterRequest.setPage(page);
unitMaintainFilterRequest.setLimit(100);
BaseResponse<PageSimpleResponse<ErpUnitsResponse>> baseResponse =
new ErpBasicClient().getErpCrop(unitMaintainFilterRequest, basicThirdSysDetailEntity.getValue());
List<ErpUnitsResponse> temps = baseResponse.getData().getList();
if (temps.size() < 100) {
erpUnitsResponses.addAll(temps);
break;
} else {
page++;
erpUnitsResponses.addAll(temps);
}
}
imports.addAll(erpUnitsResponses);
} else {
FilterThrCorpRequest filterThrCorpRequest = new FilterThrCorpRequest();
BeanUtils.copyProperties(unitMaintainFilterRequest, filterThrCorpRequest);
filterThrCorpRequest.setThirdSysFk(unitMaintainFilterRequest.getThirdSys());
filterThrCorpRequest.setPage(null);
List<ThrCorpEntity> thrCorpEntities = thrCorpService.filterThrCorps(filterThrCorpRequest);
List<ErpUnitsResponse> lists = thrCorpEntities.stream().map(
item -> {
ErpUnitsResponse thrProductsEntity = new ErpUnitsResponse();
BeanUtils.copyProperties(item, thrProductsEntity);
return thrProductsEntity;
}
).collect(Collectors.toList());
imports.addAll(lists);
}
if (imports != null && imports.size() > 0) {
for (ErpUnitsResponse erpUnitsResponse : imports) {
BasicUnitMaintainEntity basicUnitMaintainEntity = new BasicUnitMaintainEntity();
if (unitMaintainFilterRequest.getThirdSys() != null) {
if ("thirdId".equals(unitMaintainFilterRequest.getThirdSys())) {
basicUnitMaintainEntity.setThirdId(erpUnitsResponse.getId());
basicUnitMaintainEntity.setThirdName(erpUnitsResponse.getName());
} else if ("thirdId1".equals(unitMaintainFilterRequest.getThirdSys())) {
basicUnitMaintainEntity.setThirdId1(erpUnitsResponse.getId());
basicUnitMaintainEntity.setThirdName1(erpUnitsResponse.getName());
} else if ("thirdId2".equals(unitMaintainFilterRequest.getThirdSys())) {
basicUnitMaintainEntity.setThirdId2(erpUnitsResponse.getId());
basicUnitMaintainEntity.setThirdName2(erpUnitsResponse.getName());
} else if ("thirdId3".equals(unitMaintainFilterRequest.getThirdSys())) {
basicUnitMaintainEntity.setThirdId3(erpUnitsResponse.getId());
basicUnitMaintainEntity.setThirdName3(erpUnitsResponse.getName());
} else if ("thirdId4".equals(unitMaintainFilterRequest.getThirdSys())) {
basicUnitMaintainEntity.setThirdId4(erpUnitsResponse.getId());
basicUnitMaintainEntity.setThirdName4(erpUnitsResponse.getName());
}
}
basicUnitMaintainEntity.setErpId(CustomUtil.getId());
basicUnitMaintainEntity.setName(erpUnitsResponse.getName());
basicUnitMaintainEntity.setSpell(erpUnitsResponse.getSpell());
basicUnitMaintainEntity.setAddr(erpUnitsResponse.getAddr());
basicUnitMaintainEntity.setCreditNo(erpUnitsResponse.getCreditNo());
basicUnitMaintainEntity.setContact(erpUnitsResponse.getContact());
basicUnitMaintainEntity.setMobile(erpUnitsResponse.getMobile());
basicUnitMaintainService.insertBasicUnitMaintain(basicUnitMaintainEntity);
}
}
}
}

@ -26,13 +26,15 @@ public class BasicUpdateErpDataTask implements SchedulingConfigurer {
final Logger logger = LoggerFactory.getLogger(IoModifyErpTask.class);
String cron;
@Resource
private BasicUpdateproductService updateproductService;
private BasicBackUpdateProductService updateproductService;
@Resource
protected ScheduledDao scheduledDao;
@Resource
SystemParamConfigService systemParamConfigService;
@Resource
BasicThirdSysDetailService basicThirdSysDetailService;
@Resource
BasicThirdSysService basicThirdSysService;
@Override
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
@ -54,23 +56,25 @@ public class BasicUpdateErpDataTask implements SchedulingConfigurer {
logger.info("定时更新下载第三方产品信息");
SystemParamConfigEntity isUpdate = systemParamConfigService.selectByParamKey("erp_updateErpData");
if (isUpdate != null && "1".equals(isUpdate.getParamValue())) {
SystemParamConfigEntity thirdSys = systemParamConfigService.selectByParamKey("erp_updateErpData_thirdSys");
BasicThirdSysEntity basicThirdSysEntity = basicThirdSysService.selectMainThrSys();
// SystemParamConfigEntity thirdSys = systemParamConfigService.selectByParamKey("erp_updateErpData_thirdSys");
String thirdSysId = null;
if (thirdSys != null && thirdSys.getParamValue() != null) {
thirdSysId = thirdSys.getParamValue();
if (basicThirdSysEntity != null && basicThirdSysEntity.getThirdId() != null) {
thirdSysId = basicThirdSysEntity.getThirdId();
} else
thirdSysId = "thirdId";
BasicThirdSysDetailEntity piDetailEntity = basicThirdSysDetailService.selectByKey("piQueryUrl", thirdSysId);
if (piDetailEntity.getFromType() == 0 && !piDetailEntity.getItrCache()) {
BasicThirdSysDetailEntity invPiDetailEntity = basicThirdSysDetailService.selectByKey("invPiUrl", thirdSysId);
BasicThirdSysDetailEntity invPiDetailEntity = basicThirdSysDetailService.selectByKey("invPiUrl", thirdSysId);
if (piDetailEntity.getFromType() == 0) {
if (piDetailEntity.getValue() != null && invPiDetailEntity.getValue() != null) {
updateproductService.updateProduct(piDetailEntity.getValue(), invPiDetailEntity.getValue(), thirdSysId);
updateproductService.addAllProducts(null,piDetailEntity.getValue(), invPiDetailEntity.getValue(), thirdSysId, true);
} else {
logger.info("接口地址未设置");
}
} else {
updateproductService.loadLocal(thirdSysId);
updateproductService.loadLocal(null,thirdSysId, invPiDetailEntity.getValue(), true);
}

@ -0,0 +1,293 @@
package com.glxp.api.admin.thread;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity;
import com.glxp.api.admin.entity.basic.UdiEntity;
import com.glxp.api.admin.entity.basic.UdiInfoEntity;
import com.glxp.api.admin.entity.basic.UdiRelevanceEntity;
import com.glxp.api.admin.entity.info.SystemParamConfigEntity;
import com.glxp.api.admin.entity.thrsys.ThrProductsEntity;
import com.glxp.api.admin.httpclient.ErpBasicClient;
import com.glxp.api.admin.httpclient.ErpInvClient;
import com.glxp.api.admin.req.basic.CombineRequest;
import com.glxp.api.admin.req.basic.FilterErpGoodsRequest;
import com.glxp.api.admin.req.basic.FilterUdiInfoRequest;
import com.glxp.api.admin.req.inventory.ErpOnhandRequest;
import com.glxp.api.admin.req.thrsys.FilterThrProductsRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.res.basic.ErpProductsResponse;
import com.glxp.api.admin.res.inventory.ErpInvProductResponse;
import com.glxp.api.admin.service.basic.BasicThirdSysDetailService;
import com.glxp.api.admin.service.basic.UdiInfoService;
import com.glxp.api.admin.service.basic.UdiRelevanceService;
import com.glxp.api.admin.service.info.SystemParamConfigService;
import com.glxp.api.admin.service.thrsys.ThrProductsService;
import com.glxp.api.admin.util.CustomUtil;
import com.glxp.api.admin.util.DateUtil;
import com.glxp.api.admin.util.FilterUdiUtils;
import com.glxp.api.admin.util.HttpClient;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class BasicUpdateProductService {
@Value("${UDI_SERVER_URL}")
private String udiUrl;
@Resource
UdiRelevanceService udiRelevanceService;
@Resource
UdiInfoService udiInfoService;
@Resource
ThrProductsService thrProductsService;
@Resource
SystemParamConfigService systemParamConfigService;
@Resource
BasicThirdSysDetailService basicThirdSysDetailService;
public String addProduct(CombineRequest combineRequest, String url) {
String errMsg = null;
List<String> inventoryCodes = new ArrayList<>();
if (combineRequest.getThirdIds() == null)
inventoryCodes.add(combineRequest.getThirdId());
else {
inventoryCodes = combineRequest.getThirdIds();
}
if (inventoryCodes.size() > 0) {
for (String inventoryCode : inventoryCodes) {
UdiRelevanceEntity udiRelevanceEntity1 = new UdiRelevanceEntity();
udiRelevanceEntity1.setThirdId(inventoryCode);
FilterErpGoodsRequest filterErpGoodsRequest = new FilterErpGoodsRequest();
filterErpGoodsRequest.setCode(inventoryCode);
filterErpGoodsRequest.setPage(1);
filterErpGoodsRequest.setLimit(1);
BaseResponse<PageSimpleResponse<ErpProductsResponse>> erpProducts = new ErpBasicClient().getErpProducts(filterErpGoodsRequest, url);
List<ErpProductsResponse> erpProductsResponses = erpProducts.getData().getList();
if (erpProductsResponses != null & erpProductsResponses.size() > 0) {
if (combineRequest.getIsRlInv() != null && combineRequest.getIsRlInv()) {
BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("piQueryUrl", combineRequest.getThirdSys());
if (basicThirdSysDetailEntity.getFromType() == 0) {
BasicThirdSysDetailEntity inQuery = basicThirdSysDetailService.selectByKey("invPiUrl", combineRequest.getThirdSys());
ErpOnhandRequest erpOnhandRequest = new ErpOnhandRequest();
erpOnhandRequest.setInventoryCodes(inventoryCodes);
List<ErpInvProductResponse> erpOnHandResponses = new ErpInvClient().getInvPrdoduct(erpOnhandRequest, inQuery.getValue());
if (erpOnHandResponses != null && erpOnHandResponses.size() > 0) {
ErpInvProductResponse erpInvProductResponse = erpOnHandResponses.get(0);
Map<String, ErpProductsResponse> erpProductsMap = new HashMap<>();
erpProductsMap.put(erpInvProductResponse.getCode(), erpProductsResponses.get(0));
addRl(erpInvProductResponse, combineRequest.getThirdSys(), erpProductsMap);
} else {
errMsg = "部分未找到库存信息无法添加!";
}
} else {
FilterThrProductsRequest filterThrInvProductsRequest = new FilterThrProductsRequest();
filterThrInvProductsRequest.setCode(inventoryCode);
List<ThrProductsEntity> thrProductsEntities = thrProductsService.filterThrProductsRequest(filterThrInvProductsRequest);
if (thrProductsEntities != null && thrProductsEntities.size() > 0) {
for (ThrProductsEntity thrProductsEntity : thrProductsEntities) {
UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
udiInfoEntity.setNameCode(thrProductsEntity.getCode());
udiInfoEntity.setCpmctymc(thrProductsEntity.getName());
udiInfoEntity.setGgxh(thrProductsEntity.getSpec());
udiInfoEntity.setUuid(CustomUtil.getUUId());
udiInfoEntity.setDiType(1);
udiInfoEntity.setManufactory(thrProductsEntity.getManufactory());
udiInfoEntity.setYlqxzcrbarmc(thrProductsEntity.getManufactory());
udiInfoEntity.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo());
udiInfoService.insertUdiInfo(udiInfoEntity);
UdiRelevanceEntity udiRelevanceEntity2 = new UdiRelevanceEntity();
udiRelevanceEntity2.setUuid(udiInfoEntity.getUuid());
if ("thirdId".equals(combineRequest.getThirdSys())) {
udiRelevanceEntity2.setThirdId(thrProductsEntity.getCode());
udiRelevanceEntity2.setThirdName(thrProductsEntity.getName());
} else if ("thirdId1".equals(combineRequest.getThirdSys())) {
udiRelevanceEntity2.setThirdId1(thrProductsEntity.getCode());
udiRelevanceEntity2.setThirdName1(thrProductsEntity.getName());
} else if ("thirdId2".equals(combineRequest.getThirdSys())) {
udiRelevanceEntity2.setThirdId4(thrProductsEntity.getCode());
udiRelevanceEntity2.setThirdName4(thrProductsEntity.getName());
} else if ("thirdId3".equals(combineRequest.getThirdSys())) {
udiRelevanceEntity2.setThirdId3(thrProductsEntity.getCode());
udiRelevanceEntity2.setThirdName3(thrProductsEntity.getName());
} else if ("thirdId4".equals(combineRequest.getThirdSys())) {
udiRelevanceEntity2.setThirdId4(thrProductsEntity.getCode());
udiRelevanceEntity2.setThirdName4(thrProductsEntity.getName());
}
udiRelevanceEntity2.setThirdId(thrProductsEntity.getCode());
udiRelevanceEntity2.setThirdName(thrProductsEntity.getName());
udiRelevanceEntity2.setUpdateTime(DateUtil.getDateTime());
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity2);
}
} else {
errMsg = "部分未找到库存信息无法添加!";
}
}
} else {
ErpProductsResponse erpProductsResponse = erpProductsResponses.get(0);
UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
BeanUtils.copyProperties(erpProductsResponse, udiInfoEntity);
udiInfoEntity.setNameCode(erpProductsResponse.getCode());
udiInfoEntity.setCpmctymc(erpProductsResponse.getName());
udiInfoEntity.setManufactory(erpProductsResponse.getManufactory());
udiInfoEntity.setYlqxzcrbarmc(erpProductsResponse.getManufactory());
udiInfoEntity.setGgxh(erpProductsResponse.getSpec());
udiInfoEntity.setZczbhhzbapzbh(erpProductsResponse.getRegisterNo());
udiInfoEntity.setUuid(CustomUtil.getUUId());
udiInfoEntity.setDiType(1);
udiInfoService.insertUdiInfo(udiInfoEntity);
udiRelevanceEntity1.setUuid(udiInfoEntity.getUuid());
udiRelevanceEntity1.setThirdName(erpProductsResponse.getName());
udiRelevanceEntity1.setUpdateTime(DateUtil.getDateTime());
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity1);
}
}
}
}
return errMsg;
}
public void addRl(ErpInvProductResponse onhandQueryResponse, String
thirdSysId, Map<String, ErpProductsResponse> erpProductsMap) {
UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
udiInfoEntity.setNameCode(onhandQueryResponse.getCode());
udiInfoEntity.setCpmctymc(onhandQueryResponse.getName());
udiInfoEntity.setGgxh(onhandQueryResponse.getSpec());
udiInfoEntity.setUuid(CustomUtil.getUUId());
udiInfoEntity.setDiType(1);
udiInfoEntity.setManufactory(erpProductsMap.get(onhandQueryResponse.getCode()).getManufactory());
udiInfoEntity.setYlqxzcrbarmc(erpProductsMap.get(onhandQueryResponse.getCode()).getManufactory());
udiInfoEntity.setZczbhhzbapzbh(erpProductsMap.get(onhandQueryResponse.getCode()).getRegisterNo());
udiInfoService.insertUdiInfo(udiInfoEntity);
UdiRelevanceEntity udiRelevanceEntity1 = new UdiRelevanceEntity();
udiRelevanceEntity1.setUuid(udiInfoEntity.getUuid());
if ("thirdId".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName(onhandQueryResponse.getName());
} else if ("thirdId1".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId1(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName1(onhandQueryResponse.getName());
} else if ("thirdId2".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId4(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName4(onhandQueryResponse.getName());
} else if ("thirdId3".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId3(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName3(onhandQueryResponse.getName());
} else if ("thirdId4".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId4(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName4(onhandQueryResponse.getName());
}
udiRelevanceEntity1.setThirdId(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName(onhandQueryResponse.getName());
udiRelevanceEntity1.setUpdateTime(DateUtil.getDateTime());
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity1);
}
//选入查询结果的所有DI
@Async
public void relAllUdi(FilterUdiInfoRequest productInfoFilterRequest) {
int page = 1;
int limit = 100;
while (true) {
productInfoFilterRequest.setPage(page);
productInfoFilterRequest.setLimit(limit);
List<UdiInfoEntity> udiInfoEntities = getUdiInfoEntity(productInfoFilterRequest);
if (udiInfoEntities != null && udiInfoEntities.size() > 0) {
udiInfoService.insertUdiInfos(udiInfoEntities);
for (UdiInfoEntity udiInfoEntity : udiInfoEntities) {
UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity();
udiRelevanceEntity.setUpdateTime(DateUtil.getDateTime());
udiRelevanceEntity.setUuid(udiInfoEntity.getUuid());
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(udiInfoEntity.getUuid());
if (udiRelevanceEntities != null && udiRelevanceEntities.size() > 0) {
boolean isAdd = false;
for (UdiRelevanceEntity udiRelevanceEntity1 : udiRelevanceEntities) {
if (udiRelevanceEntity1.getThirdId() == null &&
udiRelevanceEntity1.getThirdId2() == null && udiRelevanceEntity1.getThirdId1() == null &&
udiRelevanceEntity1.getThirdId3() == null && udiRelevanceEntity1.getThirdId4() == null) {
//不能添加
isAdd = false;
break;
} else {
isAdd = true;
}
}
if (isAdd)
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
} else {
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
}
}
if (udiInfoEntities.size() < limit) {
break;
} else {
page++;
}
} else {
break;
}
}
}
public List<UdiInfoEntity> getUdiInfoEntity(FilterUdiInfoRequest productInfoFilterRequest) {
String nameCode = null;
if (productInfoFilterRequest.getNameCode() != null) {
UdiEntity udiEntity = FilterUdiUtils.getUdi(productInfoFilterRequest.getNameCode());
if (udiEntity != null) {
nameCode = udiEntity.getUdi();
} else {
nameCode = productInfoFilterRequest.getNameCode();
}
}
Map<String, Object> paramMap = new HashMap<>(16);
paramMap.put("page", productInfoFilterRequest.getPage());
paramMap.put("limit", productInfoFilterRequest.getLimit());
paramMap.put("ylqxzcrbarmc", productInfoFilterRequest.getYlqxzcrbarmc());
paramMap.put("cpmctymc", productInfoFilterRequest.getCpmctymc());
paramMap.put("nameCode", nameCode);
paramMap.put("ggxh", productInfoFilterRequest.getGgxh());
paramMap.put("zczbhhzbapzbh", productInfoFilterRequest.getZczbhhzbapzbh());
paramMap.put("uuid", productInfoFilterRequest.getUuid());
String response = HttpClient.mipsGet(udiUrl + "/udidl/device/filterUdi", paramMap);
try {
BaseResponse<PageSimpleResponse<UdiInfoEntity>> udiDlDeviceResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<UdiInfoEntity>>>() {
});
if (udiDlDeviceResponse != null) {
List<UdiInfoEntity> udiInfoEntities = udiDlDeviceResponse.getData().getList();
return udiInfoEntities;
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return null;
}
}

@ -1,214 +0,0 @@
package com.glxp.api.admin.thread;
import com.glxp.api.admin.entity.basic.UdiInfoEntity;
import com.glxp.api.admin.entity.basic.UdiRelevanceEntity;
import com.glxp.api.admin.entity.thrsys.ThrProductsEntity;
import com.glxp.api.admin.httpclient.ErpBasicClient;
import com.glxp.api.admin.httpclient.ErpInvClient;
import com.glxp.api.admin.req.basic.CombineRequest;
import com.glxp.api.admin.req.basic.FilterErpGoodsRequest;
import com.glxp.api.admin.req.inventory.ErpOnhandRequest;
import com.glxp.api.admin.req.thrsys.FilterThrProductsRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.res.basic.ErpProductsResponse;
import com.glxp.api.admin.res.inventory.ErpInvProductResponse;
import com.glxp.api.admin.res.inventory.ErpOnHandResponse;
import com.glxp.api.admin.service.basic.UdiInfoService;
import com.glxp.api.admin.service.basic.UdiRelevanceService;
import com.glxp.api.admin.service.thrsys.ThrProductsService;
import com.glxp.api.admin.util.CustomUtil;
import com.glxp.api.admin.util.DateUtil;
import com.glxp.api.common.res.BaseResponse;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class BasicUpdateproductService {
@Resource
UdiRelevanceService udiRelevanceService;
@Resource
UdiInfoService udiInfoService;
@Resource
ThrProductsService thrProductsService;
@Async
public void updateProduct(String productUrl, String onHandUrl, String thirdSysId) {
int page = 1;
int limit = 100;
while (page != -1) {
page = getInvmandoc(null, page, limit, productUrl, onHandUrl, thirdSysId);
}
}
public void addProduct(CombineRequest combineRequest, String url) {
List<String> inventoryCodes = new ArrayList<>();
inventoryCodes.add(combineRequest.getThirdId());
if (inventoryCodes.size() > 0) {
UdiRelevanceEntity udiRelevanceEntity1 = new UdiRelevanceEntity();
udiRelevanceEntity1.setThirdId(combineRequest.getThirdId());
udiRelevanceEntity1.setThirdName(combineRequest.getErpName());
FilterErpGoodsRequest filterErpGoodsRequest = new FilterErpGoodsRequest();
filterErpGoodsRequest.setCode(combineRequest.getThirdId());
filterErpGoodsRequest.setPage(1);
filterErpGoodsRequest.setLimit(1);
BaseResponse<PageSimpleResponse<ErpProductsResponse>> erpProducts = new ErpBasicClient().getErpProducts(filterErpGoodsRequest, url);
List<ErpProductsResponse> erpProductsResponses = erpProducts.getData().getList();
if (erpProductsResponses != null & erpProductsResponses.size() > 0) {
ErpProductsResponse erpProductsResponse = erpProductsResponses.get(0);
UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
BeanUtils.copyProperties(erpProductsResponse, udiInfoEntity);
// udiInfoEntity.setNameCode(erpProductsResponse.getCode());
udiInfoEntity.setCpmctymc(erpProductsResponse.getName());
udiInfoEntity.setGgxh(erpProductsResponse.getSpec());
udiInfoEntity.setZczbhhzbapzbh(erpProductsResponse.getRegisterNo());
udiInfoEntity.setUuid(CustomUtil.getUUId());
udiInfoService.insertUdiInfo(udiInfoEntity);
udiRelevanceEntity1.setUuid(udiInfoEntity.getUuid());
udiRelevanceEntity1.setUpdateTime(DateUtil.getDateTime());
}
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity1);
}
}
@Async
public void loadLocal(String thirdSysId) {
FilterThrProductsRequest filterThrInvProductsRequest = new FilterThrProductsRequest();
List<ThrProductsEntity> thrProductsEntities = thrProductsService.filterThrProductsRequest(filterThrInvProductsRequest);
if (thrProductsEntities != null && thrProductsEntities.size() > 0) {
for (ThrProductsEntity thrProductsEntity : thrProductsEntities) {
UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
udiInfoEntity.setNameCode(thrProductsEntity.getCode());
udiInfoEntity.setCpmctymc(thrProductsEntity.getName());
udiInfoEntity.setGgxh(thrProductsEntity.getSpec());
udiInfoEntity.setUuid(CustomUtil.getUUId());
udiInfoEntity.setYlqxzcrbarmc(thrProductsEntity.getManufactory());
udiInfoEntity.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo());
udiInfoService.insertUdiInfo(udiInfoEntity);
UdiRelevanceEntity udiRelevanceEntity1 = new UdiRelevanceEntity();
udiRelevanceEntity1.setUuid(udiInfoEntity.getUuid());
if ("thirdId".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId(thrProductsEntity.getCode());
udiRelevanceEntity1.setThirdName(thrProductsEntity.getName());
} else if ("thirdId1".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId1(thrProductsEntity.getCode());
udiRelevanceEntity1.setThirdName1(thrProductsEntity.getName());
} else if ("thirdId2".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId4(thrProductsEntity.getCode());
udiRelevanceEntity1.setThirdName4(thrProductsEntity.getName());
} else if ("thirdId3".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId3(thrProductsEntity.getCode());
udiRelevanceEntity1.setThirdName3(thrProductsEntity.getName());
} else if ("thirdId4".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId4(thrProductsEntity.getCode());
udiRelevanceEntity1.setThirdName4(thrProductsEntity.getName());
}
udiRelevanceEntity1.setThirdId(thrProductsEntity.getCode());
udiRelevanceEntity1.setThirdName(thrProductsEntity.getName());
udiRelevanceEntity1.setUpdateTime(DateUtil.getDateTime());
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity1);
}
}
}
public int getInvmandoc(String invcode, int page, int limit, String productUrl, String onHandUrl, String thirdSysId) {
FilterErpGoodsRequest filterErpGoodsRequest = new FilterErpGoodsRequest();
filterErpGoodsRequest.setPage(page);
filterErpGoodsRequest.setLimit(limit);
if (invcode != null) {
filterErpGoodsRequest.setCode(invcode);
}
BaseResponse<PageSimpleResponse<ErpProductsResponse>> erpProducts = new ErpBasicClient().getErpProducts(filterErpGoodsRequest, productUrl);
List<ErpProductsResponse> invmandocResponses = erpProducts.getData().getList();
if (invmandocResponses != null && invmandocResponses.size() > 0) {
List<String> inventoryCodes = new ArrayList<>();
if (invcode != null) {
inventoryCodes.add(invcode);
} else {
for (ErpProductsResponse invmandocResponse : invmandocResponses) {
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByThirdId(invmandocResponse.getCode(), thirdSysId);
if (udiRelevanceEntity == null) {
inventoryCodes.add(invmandocResponse.getCode());
}
}
}
if (inventoryCodes.size() > 0) {
ErpOnhandRequest erpOnhandRequest = new ErpOnhandRequest();
erpOnhandRequest.setInventoryCodes(inventoryCodes);
List<ErpInvProductResponse> erpOnHandResponses = new ErpInvClient().getInvPrdoduct(erpOnhandRequest, onHandUrl);
if (erpOnHandResponses != null) {
Map<String, List<ErpInvProductResponse>> map = erpOnHandResponses.stream().collect(Collectors.groupingBy(ErpInvProductResponse::getCode));
for (List<ErpInvProductResponse> onHandResponses : map.values()) {
if (onHandResponses != null && onHandResponses.size() > 0) {
ErpInvProductResponse onhandQueryResponse = onHandResponses.get(0);
if (onhandQueryResponse.getCount() > 0) {
UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
udiInfoEntity.setNameCode(onhandQueryResponse.getCode());
udiInfoEntity.setCpmctymc(onhandQueryResponse.getName());
udiInfoEntity.setGgxh(onhandQueryResponse.getSpec());
udiInfoEntity.setUuid(CustomUtil.getUUId());
udiInfoEntity.setYlqxzcrbarmc(invmandocResponses.get(0).getManufactory());
udiInfoEntity.setZczbhhzbapzbh(invmandocResponses.get(0).getRegisterNo());
udiInfoService.insertUdiInfo(udiInfoEntity);
UdiRelevanceEntity udiRelevanceEntity1 = new UdiRelevanceEntity();
udiRelevanceEntity1.setUuid(udiInfoEntity.getUuid());
if ("thirdId".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName(onhandQueryResponse.getName());
} else if ("thirdId1".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId1(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName1(onhandQueryResponse.getName());
} else if ("thirdId2".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId4(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName4(onhandQueryResponse.getName());
} else if ("thirdId3".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId3(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName3(onhandQueryResponse.getName());
} else if ("thirdId4".equals(thirdSysId)) {
udiRelevanceEntity1.setThirdId4(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName4(onhandQueryResponse.getName());
}
udiRelevanceEntity1.setThirdId(onhandQueryResponse.getCode());
udiRelevanceEntity1.setThirdName(onhandQueryResponse.getName());
udiRelevanceEntity1.setUpdateTime(DateUtil.getDateTime());
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity1);
}
}
}
} else {
UdiRelevanceEntity udiRelevanceEntity1 = new UdiRelevanceEntity();
udiRelevanceEntity1.setThirdId(invcode);
udiRelevanceEntity1.setThirdName(invmandocResponses.get(0).getName());
udiRelevanceEntity1.setUpdateTime(DateUtil.getDateTime());
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity1);
}
}
page++;
if (page * limit < erpProducts.getData().getTotal()) {
return page;
}
} else {
return -1;
}
return -1;
}
}

@ -4,6 +4,7 @@ import com.glxp.api.admin.config.WebSocketServer;
import com.glxp.api.admin.constant.ConstantStatus;
import com.glxp.api.admin.controller.inout.utils.DataTransUtil;
import com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity;
import com.glxp.api.admin.entity.basic.UdiEntity;
import com.glxp.api.admin.entity.info.SystemParamConfigEntity;
import com.glxp.api.admin.httpclient.ErpOrderClient;
import com.glxp.api.admin.controller.inout.utils.ContrastErpUtil;
@ -25,6 +26,7 @@ import com.glxp.api.admin.service.inout.CodesTempService;
import com.glxp.api.admin.service.inout.OrderDetailService;
import com.glxp.api.admin.service.inout.OrderService;
import com.glxp.api.admin.service.inout.CodesService;
import com.glxp.api.admin.util.FilterUdiUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -70,6 +72,14 @@ public class IoTransInoutService {
PostOrderRequest.PostOrder postOrder = postOrders.get(i);
List<WarehouseEntity> warehouseEntityList = postOrder.getCodes();
if (warehouseEntityList != null && warehouseEntityList.size() > 0) {
//解析条码
for (WarehouseEntity temp : warehouseEntityList) {
UdiEntity udiEntity = FilterUdiUtils.getUdi(temp.getCode());
temp.setNameCode(udiEntity.getUdi());
}
WarehouseEntity warehouseEntity = warehouseEntityList.get(0);
String orderId = System.currentTimeMillis() + i + "";
OrderEntity orderSaveRequest = new OrderEntity();
@ -188,7 +198,7 @@ public class IoTransInoutService {
if (erpIds != null && erpIds.size() > 0) {
BasicThirdSysDetailEntity basicThirdSysDetailEntity = bussinessTypeService.findByActionKey(orderEntity.getAction(), "orderQueryUrl");
if (basicThirdSysDetailEntity.getEnabled() && basicThirdSysDetailEntity.getFromType() == 0 ) {
if (basicThirdSysDetailEntity.getEnabled() && basicThirdSysDetailEntity.getFromType() == 0) {
if (basicThirdSysDetailEntity.getValue() == null) {
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_FAIL);
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
@ -221,7 +231,7 @@ public class IoTransInoutService {
new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, myErpOrderService, transData);
}
}
}else {
} else {
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_FAIL);
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
orderEntity.setRemark("第三方出入库单据未启用");

@ -43,9 +43,55 @@ public class ThrCorpsDlService {
@Resource
private ThrCorpImportDetailService thrCorpImportDetailService;
@Async
public void importSelectCorps(String genKey, List<ErpUnitsResponse> erpUnitsResponses, String thirdSys) {
BasicThirdSysDetailEntity piDetailEntity = basicThirdSysDetailService.selectByKey("corpUrl", thirdSys);
if (piDetailEntity == null || piDetailEntity.getValue() == null) {
WebSocketServer.sendInfo("往来单位接口未设置!", "sid");
return;
}
ThrCorpImportLogEntity thrProductsImportLogEntity = thrCorpImportLogService.selectByGenKey(genKey);
if (erpUnitsResponses != null && erpUnitsResponses.size() > 0) {
List<ThrCorpImportDetailEntity> thrCorpImportDetailEntities;
String finalGenKey = genKey;
thrCorpImportDetailEntities = erpUnitsResponses.stream().map(
item -> {
ThrCorpImportDetailEntity thrCorpEntity = new ThrCorpImportDetailEntity();
BeanUtils.copyProperties(item, thrCorpEntity);
thrCorpEntity.setUnitId(item.getId());
thrCorpEntity.setGenKeyFk(finalGenKey);
thrCorpEntity.setUpdateTime(new Date());
thrCorpEntity.setThirdSysFk(thirdSys);
return thrCorpEntity;
}
).collect(Collectors.toList());
thrCorpImportDetailService.insertCorpDetailImports(thrCorpImportDetailEntities);
FilterUdiIpLogRequest filterUdiIpLogRequest = new FilterUdiIpLogRequest();
filterUdiIpLogRequest.setGenKey(genKey);
List<ThrCorpImportDetailEntity> temps = thrCorpImportDetailService.filterCorpDetailImport(filterUdiIpLogRequest);
List<ThrCorpEntity> thrCorpEntities = temps.stream().map(
item -> {
ThrCorpEntity thrProductsEntity = new ThrCorpEntity();
BeanUtils.copyProperties(item, thrProductsEntity);
thrProductsEntity.setThirdSysFk(thirdSys);
thrProductsEntity.setUpdateTime(new Date());
return thrProductsEntity;
}
).collect(Collectors.toList());
thrCorpService.insertThrCorpss(thrCorpEntities);
redisUtil.set(Constant.dlThrProducts, "false");
WebSocketServer.sendInfo("往来单位信息下载已完成,请刷新查看!", "sid");
thrProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
thrProductsImportLogEntity.setUpdateTime(new Date());
thrCorpImportLogService.updateImportLog(thrProductsImportLogEntity);
}
}
//主动下载第三方系统往来单位信息
@Async
public void importCorps(String genKey, String thirdSys) {
public void importCorps(String genKey, BasicUnitMaintainFilterRequest filterThrProductsRequest, String thirdSys) {
BasicThirdSysDetailEntity piDetailEntity = basicThirdSysDetailService.selectByKey("corpUrl", thirdSys);
if (piDetailEntity == null || piDetailEntity.getValue() == null) {
WebSocketServer.sendInfo("往来单位接口未设置!", "sid");
@ -56,7 +102,7 @@ public class ThrCorpsDlService {
int page = 1;
int limit = 100;
while (page != -1) {
page = getCorps(page, limit, piDetailEntity.getValue(), thrProductsImportLogEntity, thirdSys, genKey);
page = getCorps(page, limit, piDetailEntity.getValue(), thrProductsImportLogEntity, thirdSys, genKey, filterThrProductsRequest);
}
FilterUdiIpLogRequest filterUdiIpLogRequest = new FilterUdiIpLogRequest();
filterUdiIpLogRequest.setGenKey(genKey);
@ -65,6 +111,7 @@ public class ThrCorpsDlService {
item -> {
ThrCorpEntity thrProductsEntity = new ThrCorpEntity();
BeanUtils.copyProperties(item, thrProductsEntity);
thrProductsEntity.setUpdateTime(new Date());
thrProductsEntity.setThirdSysFk(thirdSys);
return thrProductsEntity;
}
@ -72,6 +119,9 @@ public class ThrCorpsDlService {
thrCorpService.insertThrCorpss(thrCorpEntities);
redisUtil.set(Constant.dlThrProducts, "false");
WebSocketServer.sendInfo("往来单位信息下载已完成,请刷新查看!", "sid");
thrProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
thrProductsImportLogEntity.setUpdateTime(new Date());
thrCorpImportLogService.updateImportLog(thrProductsImportLogEntity);
}
//导出生成Excel文件
@ -113,14 +163,14 @@ public class ThrCorpsDlService {
return;
}
if(!basicThirdSysDetailEntity.getEnabled()){
if (!basicThirdSysDetailEntity.getEnabled()) {
thrCorpExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
thrCorpExportLogEntity.setRemark("第三方往来单位服务未启用");
thrCorpExportLogService.updateThrCorpExportLog(thrCorpExportLogEntity);
return;
}
if ( basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if (basicThirdSysDetailEntity.getFromType() == 0) {
//根据查询条件一键导出第三方系统往来单位
List<ThrCorpEntity> thrCorpEntities = exportCorps(thrCorpExportRequest);
excelData.addAll(getRows(thrCorpEntities));
@ -169,6 +219,7 @@ public class ThrCorpsDlService {
ThrCorpEntity thrCorpEntity = new ThrCorpEntity();
BeanUtils.copyProperties(item, thrCorpEntity);
// thrCorpEntity.setUnitId(item.getId());
thrCorpEntity.setUpdateTime(new Date());
thrCorpEntity.setThirdSysFk(thirdSys);
return thrCorpEntity;
}
@ -180,8 +231,9 @@ public class ThrCorpsDlService {
}
public int getCorps(int page, int limit, String corpUrl, ThrCorpImportLogEntity thrCorpImportLogEntity, String thirdSys, String genKey) {
BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest = new BasicUnitMaintainFilterRequest();
public int getCorps(int page, int limit, String corpUrl, ThrCorpImportLogEntity thrCorpImportLogEntity, String thirdSys, String genKey, BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest) {
if (basicUnitMaintainFilterRequest == null)
basicUnitMaintainFilterRequest = new BasicUnitMaintainFilterRequest();
basicUnitMaintainFilterRequest.setPage(page);
basicUnitMaintainFilterRequest.setLimit(limit);
BaseResponse<PageSimpleResponse<ErpUnitsResponse>> erpCrops = new ErpBasicClient().getErpCrop(basicUnitMaintainFilterRequest, corpUrl);

@ -44,25 +44,65 @@ public class ThrInvProductsDlService {
@Resource
ThrInvProductsDetailService thrInvProductsDetailService;
@Async
public void importProducrs(String thirdSys) {
public void importSelcyInvProducrs(String genKey,String thirdSys, List<ErpInvProductResponse> erpInvProductResponses) {
ThrInvProductsImportLogEntity thrInvProductsImportLogEntity = thrInvProductsImportLogService.selectByGenKey(genKey);
BasicThirdSysDetailEntity piDetailEntity = basicThirdSysDetailService.selectByKey("invPiUrl", thirdSys);
if (piDetailEntity == null || piDetailEntity.getValue() == null) {
WebSocketServer.sendInfo("库存产品信息接口未设置!", "sid");
return;
}
ThrInvProductsImportLogEntity thrInvProductsImportLogEntity = new ThrInvProductsImportLogEntity();
String genKey = CustomUtil.getId();
thrInvProductsImportLogEntity.setGenKey(genKey);
thrInvProductsImportLogEntity.setFromType("第三方系统获取");
thrInvProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_PROCESS);
thrInvProductsImportLogEntity.setUpdateTime(new Date());
thrInvProductsImportLogEntity.setThirdSysFk(thirdSys);
thrInvProductsImportLogService.insertImportLog(thrInvProductsImportLogEntity);
if (erpInvProductResponses != null && erpInvProductResponses.size() > 0) {
List<ThrInvProductsImportDetailEntity> thrProductsEntities = erpInvProductResponses.stream().map(
item -> {
ThrInvProductsImportDetailEntity thrProductsEntity = new ThrInvProductsImportDetailEntity();
BeanUtils.copyProperties(item, thrProductsEntity);
thrProductsEntity.setInventoryCode(item.getCode());
thrProductsEntity.setInventoryName(item.getName());
thrProductsEntity.setGenKeyFk(genKey);
thrProductsEntity.setThirdSysFk(thirdSys);
thrProductsEntity.setUpdateTime(new Date());
return thrProductsEntity;
}
).collect(Collectors.toList());
thrInvProductsDetailService.insertInvProductsDetailImports(thrProductsEntities);
}
FilterUdiIpLogRequest filterUdiIpLogRequest = new FilterUdiIpLogRequest();
filterUdiIpLogRequest.setGenKey(genKey);
List<ThrInvProductsImportDetailEntity> thrInvProductsImportDetailEntities = thrInvProductsDetailService.filterInvProductsDetailImport(filterUdiIpLogRequest);
List<ThrInvProductsEntity> thrInvProductsEntities = thrInvProductsImportDetailEntities.stream().map(
item -> {
ThrInvProductsEntity thrInvProductsEntity = new ThrInvProductsEntity();
BeanUtils.copyProperties(item, thrInvProductsEntity);
thrInvProductsEntity.setUpdateTime(new Date());
return thrInvProductsEntity;
}
).collect(Collectors.toList());
thrInvProductsService.insertThrInvProducts(thrInvProductsEntities);
redisUtil.set(Constant.dlThrProducts, "false");
WebSocketServer.sendInfo("库存产品信息下载已完成,请刷新查看!", "sid");
thrInvProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
thrInvProductsImportLogService.updateImportLog(thrInvProductsImportLogEntity);
}
@Async
public void importProducrs(String genKey,String thirdSys, ErpOnhandRequest erpOnhandRequest) {
BasicThirdSysDetailEntity piDetailEntity = basicThirdSysDetailService.selectByKey("invPiUrl", thirdSys);
if (piDetailEntity == null || piDetailEntity.getValue() == null) {
WebSocketServer.sendInfo("库存产品信息接口未设置!", "sid");
return;
}
ThrInvProductsImportLogEntity thrInvProductsImportLogEntity = thrInvProductsImportLogService.selectByGenKey(genKey);
int page = 1;
int limit = 100;
while (page != -1) {
page = getInvmandoc(page, limit, piDetailEntity.getValue(), thrInvProductsImportLogEntity, genKey, thirdSys);
page = getInvmandoc(page, limit, piDetailEntity.getValue(), thrInvProductsImportLogEntity, genKey, thirdSys, erpOnhandRequest);
}
FilterUdiIpLogRequest filterUdiIpLogRequest = new FilterUdiIpLogRequest();
filterUdiIpLogRequest.setGenKey(genKey);
@ -71,6 +111,7 @@ public class ThrInvProductsDlService {
item -> {
ThrInvProductsEntity thrInvProductsEntity = new ThrInvProductsEntity();
BeanUtils.copyProperties(item, thrInvProductsEntity);
thrInvProductsEntity.setUpdateTime(new Date());
return thrInvProductsEntity;
}
).collect(Collectors.toList());
@ -116,7 +157,7 @@ public class ThrInvProductsDlService {
thrInvProductsExportLogService.updateThrInvProductsExportLog(thrInvProductsExportLogEntity);
return;
}
if (basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if (basicThirdSysDetailEntity.getFromType() == 0) {
//从第三方服务实时一键导出
FilterThrInvProductsRequest filterThrInvProductsRequest = new FilterThrInvProductsRequest();
BeanUtils.copyProperties(thrInvProductsExportRequest, filterThrInvProductsRequest);
@ -163,6 +204,7 @@ public class ThrInvProductsDlService {
item -> {
ThrInvProductsEntity thrInvProductsEntity = new ThrInvProductsEntity();
BeanUtils.copyProperties(item, thrInvProductsEntity);
thrInvProductsEntity.setUpdateTime(new Date());
return thrInvProductsEntity;
}
).collect(Collectors.toList());
@ -174,9 +216,10 @@ public class ThrInvProductsDlService {
}
public int getInvmandoc(int page, int limit, String productUrl, ThrInvProductsImportLogEntity thrInvProductsImportLogEntity, String genKey, String thirdSys) {
ErpOnhandRequest erpOnhandRequest = new ErpOnhandRequest();
public int getInvmandoc(int page, int limit, String productUrl, ThrInvProductsImportLogEntity thrInvProductsImportLogEntity,
String genKey, String thirdSys, ErpOnhandRequest erpOnhandRequest) {
if (erpOnhandRequest == null)
erpOnhandRequest = new ErpOnhandRequest();
erpOnhandRequest.setPage(page);
erpOnhandRequest.setLimit(limit);

@ -1,11 +1,13 @@
package com.glxp.api.admin.thread;
import com.glxp.api.admin.constant.BasicProcessStatus;
import com.glxp.api.admin.entity.basic.BussinessTypeEntity;
import com.glxp.api.admin.entity.thrsys.ThrOrderDetailEntity;
import com.glxp.api.admin.entity.thrsys.ThrOrderEntity;
import com.glxp.api.admin.entity.thrsys.ThrOrderImportDetailEntity;
import com.glxp.api.admin.entity.thrsys.ThrOrderImportLogEntity;
import com.glxp.api.admin.req.basic.FilterUdiIpLogRequest;
import com.glxp.api.admin.service.basic.BussinessTypeService;
import com.glxp.api.admin.service.thrsys.ThrOrderDetailService;
import com.glxp.api.admin.service.thrsys.ThrOrderImportDetailService;
import com.glxp.api.admin.service.thrsys.ThrOrderImportLogService;
@ -15,6 +17,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -30,6 +33,8 @@ public class ThrOrderImportService {
ThrOrderService thrOrderService;
@Resource
ThrOrderDetailService thrOrderDetailService;
@Resource
BussinessTypeService bussinessTypeService;
@Async
public void importThrOrder(String genKey) {
@ -44,14 +49,21 @@ public class ThrOrderImportService {
ThrOrderImportDetailEntity thrOrderImportDetailEntity = datas.get(0);
ThrOrderEntity thrOrderEntity = new ThrOrderEntity();
BeanUtils.copyProperties(thrOrderImportDetailEntity, thrOrderEntity);
thrOrderEntity.setUpdateTime(new Date());
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByName(thrOrderEntity.getBillType());
if (bussinessTypeEntity != null) {
thrOrderEntity.setBillType(bussinessTypeEntity.getAction());
}
thrOrderService.insertThrOrder(thrOrderEntity);
thrOrderEntity = thrOrderService.findByUnique(thrOrderEntity.getBillNo(), thrOrderEntity.getThirdSysFk());
ThrOrderEntity finalThrOrderEntity = thrOrderEntity;
List<ThrOrderDetailEntity> postDatas = datas.stream().map(item ->
{
ThrOrderDetailEntity thrOrderDetailEntity = new ThrOrderDetailEntity();
thrOrderDetailEntity.setUpdateTime(new Date());
BeanUtils.copyProperties(item, thrOrderDetailEntity);
thrOrderDetailEntity.setOrderIdFk(finalThrOrderEntity.getId()+"");
thrOrderDetailEntity.setOrderIdFk(finalThrOrderEntity.getId() + "");
return thrOrderDetailEntity;
}).collect(Collectors.toList());
thrOrderDetailService.insertThrOrderDetails(postDatas);

@ -59,7 +59,7 @@ public class ThrOrdersDlService {
@Async
public void importOrders(String genKey, String action) {
public void importOrders(String genKey, String action, FilterThrOrderRequest filterThrProductsRequest) {
ThrOrderImportLogEntity thrOrderImportLogEntity = thrOrderImportLogService.selectByGenKey(genKey);
@ -72,7 +72,7 @@ public class ThrOrdersDlService {
int page = 1;
int limit = 100;
while (page != -1) {
page = getOrders(page, limit, basicThirdSysDetailEntity.getValue(), basicThirdSysDetailEntity.getThirdSysFk(), thrOrderImportLogEntity, action);
page = getOrders(page, limit, basicThirdSysDetailEntity.getValue(), basicThirdSysDetailEntity.getThirdSysFk(), thrOrderImportLogEntity, action, filterThrProductsRequest);
}
thrOrderImportService.importThrOrder(genKey);
@ -83,6 +83,36 @@ public class ThrOrdersDlService {
thrOrderImportLogService.updateImportLog(thrOrderImportLogEntity);
}
@Async
public void importSelectOrders(String genKey, List<ErpOrderResponse> erpOrderResponses, String thirdSys) {
ThrOrderImportLogEntity thrOrderImportLogEntity = thrOrderImportLogService.selectByGenKey(genKey);
if (erpOrderResponses != null && erpOrderResponses.size() > 0) {
for (ErpOrderResponse erpOrderResponse : erpOrderResponses) {
ThrOrderEntity thrOrderEntity = new ThrOrderEntity();
BeanUtils.copyProperties(erpOrderResponse, thrOrderEntity);
thrOrderEntity.setThirdSysFk(thirdSys);
thrOrderEntity.setUpdateTime(new Date());
thrOrderService.insertThrOrder(thrOrderEntity);
List<ThrOrderImportDetailEntity> thrOrderDetailEntities = new ArrayList<>();
for (ErpOrderResponse.SubErpOrder subPurchase : erpOrderResponse.getSubErpOrders()) {
ThrOrderImportDetailEntity thrOrderDetailEntity = new ThrOrderImportDetailEntity();
BeanUtils.copyProperties(subPurchase, thrOrderDetailEntity);
BeanUtils.copyProperties(erpOrderResponse, thrOrderDetailEntity);
thrOrderDetailEntity.setGenKeyFk(thrOrderImportLogEntity.getGenKey());
thrOrderDetailEntity.setThirdSysFk(thirdSys);
thrOrderDetailEntity.setUpdateTime(new Date());
thrOrderDetailEntities.add(thrOrderDetailEntity);
}
thrOrderImportDetailService.insertOrderImportDetails(thrOrderDetailEntities);
}
}
thrOrderImportService.importThrOrder(genKey);
redisUtil.set(Constant.dlThrProducts, "false");
WebSocketServer.sendInfo("业务单据信息下载已完成,请刷新查看!", "sid");
thrOrderImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
thrOrderImportLogService.updateImportLog(thrOrderImportLogEntity);
}
@Async
public void genExcel(String genKey, ThrOrderExportRequest thrOrderExportRequest) {
@ -146,7 +176,7 @@ public class ThrOrdersDlService {
return;
}
if (basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if (basicThirdSysDetailEntity.getFromType() == 0) {
FilterThrOrderRequest filterThrOrderRequest = new FilterThrOrderRequest();
BeanUtils.copyProperties(thrOrderExportRequest, filterThrOrderRequest);
List<List<String>> datas = exportThrOrders(filterThrOrderRequest);
@ -192,7 +222,7 @@ public class ThrOrdersDlService {
return;
}
if (basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if (basicThirdSysDetailEntity.getFromType() == 0) {
FilterThrOrderRequest filterThrOrderRequest = new FilterThrOrderRequest();
BeanUtils.copyProperties(thrOrderExportRequest, filterThrOrderRequest);
List<ErpOrderResponse> datas = getThrOrders(filterThrOrderRequest);
@ -245,11 +275,14 @@ public class ThrOrdersDlService {
}
public int getOrders(int page, int limit, String orderUrl, String thirdSys, ThrOrderImportLogEntity thrOrderImportLogEntity, String action) {
public int getOrders(int page, int limit, String orderUrl, String thirdSys, ThrOrderImportLogEntity thrOrderImportLogEntity, String action, FilterThrOrderRequest filterThrOrderRequest) {
if (filterThrOrderRequest == null)
filterThrOrderRequest = new FilterThrOrderRequest();
filterThrOrderRequest.setPage(page);
filterThrOrderRequest.setLimit(limit);
filterThrOrderRequest.setBillAction(action);
FilterOrderRequest filterOrderRequest = new FilterOrderRequest();
filterOrderRequest.setPage(page);
filterOrderRequest.setLimit(limit);
filterOrderRequest.setBillAction(action);
BeanUtils.copyProperties(filterThrOrderRequest,filterOrderRequest);
BaseResponse<PageSimpleResponse<ErpOrderResponse>> responseBaseResponse = new ErpOrderClient(orderUrl).getErpOrderResponse(filterOrderRequest);
if (responseBaseResponse != null && responseBaseResponse.getCode() == 20000) {
List<ErpOrderResponse> erpOrderResponses = responseBaseResponse.getData().getList();
@ -258,6 +291,7 @@ public class ThrOrdersDlService {
ThrOrderEntity thrOrderEntity = new ThrOrderEntity();
BeanUtils.copyProperties(erpOrderResponse, thrOrderEntity);
thrOrderEntity.setThirdSysFk(thirdSys);
thrOrderEntity.setUpdateTime(new Date());
thrOrderService.insertThrOrder(thrOrderEntity);
// thrOrderEntity = thrOrderService.findByUnique(thrOrderEntity.getBillNo(), thrOrderEntity.getThirdSysFk());
List<ThrOrderImportDetailEntity> thrOrderDetailEntities = new ArrayList<>();

@ -53,11 +53,47 @@ public class ThrProductsDlService {
@Resource
SystemParamConfigService systemParamConfigService;
@Async
public void importSelectProducrs(String genKey, List<ThrProductsEntity> thrProductsEntities, String thirdSys) {
ThrProductsImportLogEntity thrProductsImportLogEntity = thrProductsImportLogService.selectByGenKey(genKey);
if (thrProductsEntities != null && thrProductsEntities.size() > 0) {
List<ThrProductsImportDetailEntity> thrProductsImportDetailEntities;
thrProductsImportDetailEntities = thrProductsEntities.stream().map(
item -> {
ThrProductsImportDetailEntity thrProductsImportDetailEntity = new ThrProductsImportDetailEntity();
BeanUtils.copyProperties(item, thrProductsImportDetailEntity);
thrProductsImportDetailEntity.setThirdSysFk(thirdSys);
thrProductsImportDetailEntity.setGenKeyFk(thrProductsImportLogEntity.getGenKey());
return thrProductsImportDetailEntity;
}
).collect(Collectors.toList());
thrProductsImportDetailService.insertProductsDetailImports(thrProductsImportDetailEntities);
FilterUdiIpLogRequest filterUdiIpLogRequest = new FilterUdiIpLogRequest();
filterUdiIpLogRequest.setGenKey(genKey);
List<ThrProductsImportDetailEntity> thrProductsImportDetailEntities1 =
thrProductsImportDetailService.filterProductsDetailImport(filterUdiIpLogRequest);
List<ThrProductsEntity> thrProductsEntities1 = thrProductsImportDetailEntities1.stream().map(
item -> {
ThrProductsEntity thrProductsEntity = new ThrProductsEntity();
BeanUtils.copyProperties(item, thrProductsEntity);
thrProductsEntity.setUpdateTime(new Date());
return thrProductsEntity;
}
).collect(Collectors.toList());
thrProductsService.insertThrProductss(thrProductsEntities1);
redisUtil.set(Constant.dlThrProducts, "false");
thrProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
thrProductsImportLogService.updateImportLog(thrProductsImportLogEntity);
WebSocketServer.sendInfo("产品信息下载已完成,请刷新查看!", "sid");
}
}
//主动下载产品信息
@Async
public void importProducrs(String genKey, String thirdSys) {
public void importProducrs(String genKey, FilterThrProductsRequest filterThrProductsRequest) {
ThrProductsImportLogEntity thrProductsImportLogEntity = thrProductsImportLogService.selectByGenKey(genKey);
BasicThirdSysDetailEntity piDetailEntity = basicThirdSysDetailService.selectByKey("piQueryUrl", thirdSys);
BasicThirdSysDetailEntity piDetailEntity = basicThirdSysDetailService.selectByKey("piQueryUrl", filterThrProductsRequest.getThirdSysFk());
if (piDetailEntity == null || piDetailEntity.getValue() == null) {
thrProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
thrProductsImportLogEntity.setRemark("产品信息接口未设置");
@ -69,7 +105,9 @@ public class ThrProductsDlService {
int page = 1;
int limit = 100;
while (page != -1) {
page = getInvmandoc(thrProductsImportLogEntity, page, limit, piDetailEntity.getValue(), thirdSys);
FilterErpGoodsRequest filterErpGoodsRequest = new FilterErpGoodsRequest();
BeanUtils.copyProperties(filterThrProductsRequest, filterErpGoodsRequest);
page = getInvmandoc(thrProductsImportLogEntity, page, limit, piDetailEntity.getValue(), filterErpGoodsRequest.getThirdSys(), filterErpGoodsRequest);
}
FilterUdiIpLogRequest filterUdiIpLogRequest = new FilterUdiIpLogRequest();
filterUdiIpLogRequest.setGenKey(genKey);
@ -79,6 +117,7 @@ public class ThrProductsDlService {
item -> {
ThrProductsEntity thrProductsEntity = new ThrProductsEntity();
BeanUtils.copyProperties(item, thrProductsEntity);
thrProductsEntity.setUpdateTime(new Date());
return thrProductsEntity;
}
).collect(Collectors.toList());
@ -127,7 +166,7 @@ public class ThrProductsDlService {
return;
}
if (basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if (basicThirdSysDetailEntity.getFromType() == 0) {
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
BeanUtils.copyProperties(thrProductsExportRequest, filterThrProductsRequest);
List<ThrProductsEntity> thrProductsEntities = exportThrProducts(filterThrProductsRequest);
@ -191,7 +230,7 @@ public class ThrProductsDlService {
return;
}
List<ThrProductsEntity> thrProductsEntities;
if (basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if (basicThirdSysDetailEntity.getFromType() == 0) {
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
BeanUtils.copyProperties(thrProductsExportRequest, filterThrProductsRequest);
thrProductsEntities = exportThrProducts(filterThrProductsRequest);
@ -199,7 +238,7 @@ public class ThrProductsDlService {
FilterThrProductsRequest filterThrInvProductsRequest = new FilterThrProductsRequest();
thrProductsEntities = thrProductsService.filterThrProductsRequest(filterThrInvProductsRequest);
}
if(thrProductsEntities!=null){
if (thrProductsEntities != null) {
List<ErpProductsResponse> lists = thrProductsEntities.stream().map(
item -> {
ErpProductsResponse thrProductsEntity = new ErpProductsResponse();
@ -219,15 +258,16 @@ public class ThrProductsDlService {
//Todo 接口上传SMP
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("smp_service_ip");
if(systemParamConfigEntity!=null){
String response = HttpClient.uCloudPost(systemParamConfigEntity.getParamValue()+"/udiwms/thrsys/postThrProducts", postThrProductsRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, new TypeReference<BaseResponse>() {});
if (systemParamConfigEntity != null) {
String response = HttpClient.uCloudPost(systemParamConfigEntity.getParamValue() + "/udiwms/thrsys/postThrProducts", postThrProductsRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
});
if (baseResponse.getCode() == 20000) {
thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
} else {
thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
}
}else {
} else {
thrProductsExportLogEntity.setRemark("SMP服务IP地址未定义");
thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
}
@ -258,6 +298,7 @@ public class ThrProductsDlService {
item -> {
ThrProductsEntity thrProductsEntity = new ThrProductsEntity();
BeanUtils.copyProperties(item, thrProductsEntity);
thrProductsEntity.setUpdateTime(new Date());
return thrProductsEntity;
}
).collect(Collectors.toList());
@ -265,13 +306,16 @@ public class ThrProductsDlService {
thrProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
thrProductsImportLogEntity.setUpdateTime(new Date());
thrProductsImportLogService.updateImportLog(thrProductsImportLogEntity);
} else {
thrProductsImportLogEntity.setRemark("未选择产品信息");
thrProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
thrProductsImportLogService.updateImportLog(thrProductsImportLogEntity);
}
}
public int getInvmandoc(ThrProductsImportLogEntity thrProductsImportLogEntity, int page, int limit, String
productUrl, String thirdSys) {
productUrl, String thirdSys, FilterErpGoodsRequest filterErpGoodsRequest) {
FilterErpGoodsRequest filterErpGoodsRequest = new FilterErpGoodsRequest();
filterErpGoodsRequest.setPage(page);
filterErpGoodsRequest.setLimit(limit);
BaseResponse<PageSimpleResponse<ErpProductsResponse>> erpProducts = new ErpBasicClient().getErpProducts(filterErpGoodsRequest, productUrl);

@ -9,6 +9,10 @@ import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Iterator;
import java.util.Map;
@ -18,7 +22,7 @@ public class HttpClient {
public static String post(String url, Object object) {
RestTemplate restTemplate = new RestTemplate();
String json = JSONObject.toJSON(object).toString();
logger.info(url+"\n"+json);
logger.info(url + "\n" + json);
MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>();
postParameters.add("params", json);
HttpHeaders headers = new HttpHeaders();
@ -35,7 +39,7 @@ public class HttpClient {
String json = JSONObject.toJSON(object).toString();
// MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>();
// postParameters.add("params", json);
logger.info(url+"\n"+json);
logger.info(url + "\n" + json);
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
headers.add("system", "1");
@ -49,7 +53,7 @@ public class HttpClient {
public static String uCloudPost(String url, Object object) {
RestTemplate restTemplate = new RestTemplate();
String json = JSONObject.toJSON(object).toString();
logger.info(url+"\n"+json);
logger.info(url + "\n" + json);
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
HttpEntity<String> httpEntity = new HttpEntity<>(json, headers);
@ -79,16 +83,32 @@ public class HttpClient {
Map.Entry<String, Object> entry = (Map.Entry) element;
//过滤value为nullvalue为null时进行拼接字符串会变成 "null"字符串
if (entry.getValue() != null) {
String value = String.valueOf(((Map.Entry) element).getValue());
if(value.contains("#")){
try {
String ps = URLEncoder.encode(value, "UTF-8");
((Map.Entry) element).setValue(ps);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
stringBuffer.append(element).append("&");
}
url = stringBuffer.substring(0, stringBuffer.length() - 1);
}
}
} else {
throw new RuntimeException("url请求:" + url + "请求参数有误不是map类型");
}
RestTemplate restTemplate = new RestTemplate();
String accessTokenRequestUrl = url;//"http://127.0.0.1:9997/mips/druginfo/list";
String accessTokenRequestUrl = null;
try {
accessTokenRequestUrl = new URL(url).toString();
} catch (MalformedURLException e) {
e.printStackTrace();
}
logger.info(accessTokenRequestUrl);
String response = restTemplate.getForObject(accessTokenRequestUrl, String.class);
return response;

@ -18,7 +18,7 @@ logging.path=output/logs
logging.file=D:/udi.log
#UDI数据下载
UDI_SERVER_URL=https://www.udims.com/UDI_DL_Server
#UDI_SERVER_URL=http://127.0.0.1:9994
##端口号
# Redis数据库索引默认为0

@ -8,8 +8,16 @@
SELECT * FROM basic_corp
<where>
<if test="key != '' and key!=null">
and name like concat('%',#{key},'%') or spell like concat('%',#{key},'%') or erpId like
concat('%',#{key},'%')
and name like concat('%',#{key},'%')
or spell like concat('%',#{key},'%')
or erpId like concat('%',#{key},'%')
or creditNo like concat('%',#{key},'%')
or thirdId like concat('%',#{key},'%')
or thirdId1 like concat('%',#{key},'%')
or thirdId2 like concat('%',#{key},'%')
or thirdId3 like concat('%',#{key},'%')
or thirdId4 like concat('%',#{key},'%')
or addr like concat('%',#{key},'%')
</if>
<if test="id != '' and id != null">
AND id = #{id}
@ -18,17 +26,40 @@
AND unitId = #{unitId}
</if>
</where>
order by updateTime desc
</select>
<select id="selectByThirdId" parameterType="com.glxp.api.admin.req.basic.BasicUnitMaintainFilterRequest"
resultType="com.glxp.api.admin.entity.basic.BasicUnitMaintainEntity">
select * FROM basic_corp
<where>
<if test="thirdId != '' and thirdId != null">
AND thirdId = #{thirdId}
</if>
<if test="thirdId1 != '' and thirdId1 != null">
AND thirdId1 = #{thirdId1}
</if>
<if test="thirdId2 != '' and thirdId2 != null">
AND thirdId2 = #{thirdId2}
</if>
<if test="thirdId3 != '' and thirdId3 != null">
AND thirdId3 = #{thirdId3}
</if>
<if test="thirdId4 != '' and thirdId4 != null">
AND thirdId4 = #{thirdId4}
</if>
</where>
limit 1
</select>
<insert id="insertBasicUnitMaintain" keyProperty="id"
parameterType="com.glxp.api.admin.entity.basic.BasicUnitMaintainEntity">
REPLACE INTO basic_corp
(thirdId,erpId,name,spell,
addr,status,type,creditNo,contact,mobile,thirdId1,thirdId2,thirdId3,thirdId4,
thirdName,thirdName1,thirdName2,thirdName3,thirdName4)
thirdName,thirdName1,thirdName2,thirdName3,thirdName4,updateTime)
values
(
#{thirdId},
@ -41,7 +72,7 @@
#{creditNo},
#{contact},
#{mobile},#{thirdId1},#{thirdId2},#{thirdId3},#{thirdId4},
#{thirdName},#{thirdName1},#{thirdName2},#{thirdName3},#{thirdName4}
#{thirdName},#{thirdName1},#{thirdName2},#{thirdName3},#{thirdName4},#{updateTime}
)
</insert>
@ -68,6 +99,8 @@
<if test="thirdName2 != null">thirdName2=#{thirdName2},</if>
<if test="thirdName3 != null">thirdName3=#{thirdName3},</if>
<if test="thirdName4 != null">thirdName4=#{thirdName4},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
</trim>
WHERE id=#{id}
</update>

@ -25,7 +25,8 @@
</select>
<select id="filterJoinList" parameterType="com.glxp.api.admin.req.receipt.BussinessTypeFilterRequest"
resultType="com.glxp.api.admin.res.basic.BussinessTypResponse">
select * from basic_bussiness_type LEFT JOIN basic_third_sys on basic_bussiness_type.thirdSysFk = basic_third_sys.thirdId
select * from basic_bussiness_type LEFT JOIN basic_third_sys on basic_bussiness_type.thirdSysFk =
basic_third_sys.thirdId
<where>
<if test="name != ''and name != null">
AND name LIKE concat(#{name},'%')
@ -60,14 +61,16 @@
</insert>
<update id="updateBussinessType" parameterType="com.glxp.api.admin.entity.basic.BussinessTypeEntity">
UPDATE basic_bussiness_type SET
<if test="action != null"> action = #{action},</if>
<if test="name != null">name = #{name},</if>
<if test="enable != null">enable = #{enable},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="mainAction != null">mainAction = #{mainAction},</if>
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk}</if>
WHERE id = #{id}
UPDATE basic_bussiness_type
<trim prefix="set" suffixOverrides=",">
<if test="action != null">action = #{action},</if>
<if test="name != null">name = #{name},</if>
<if test="enable != null">enable = #{enable},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="mainAction != null">mainAction = #{mainAction},</if>
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk}</if>
</trim>
WHERE id = #{id}
</update>
<delete id="deleteById" parameterType="Map">

@ -13,6 +13,9 @@
<if test="id != '' and id != null">
AND id = #{id}
</if>
<if test="fromType != '' and fromType != null">
AND fromType = #{fromType}
</if>
<if test="status != '' and status != null">
AND status = #{status}
</if>

@ -11,6 +11,7 @@
basic_udirel.thirdId1,basic_udirel.thirdId2,basic_udirel.thirdId3,basic_udirel.thirdId4,
basic_udirel.thirdName1,basic_udirel.thirdName2,basic_udirel.thirdName3,basic_udirel.thirdName4,
basic_udirel.manufactory,basic_udirel.measname,basic_udirel.ybbm,basic_udirel.sptm,
basic_udirel.isDisable,
basic_products.nameCode,basic_products.packRatio,basic_products.packLevel,
basic_products.bhxjsl,basic_products.bhzxxsbzsl,basic_products.zxxsbzbhsydysl,
basic_products.bhxjcpbm,basic_products.bzcj,
@ -41,6 +42,12 @@
<if test="id != '' and id != null">
AND basic_udirel.id = #{id}
</if>
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
AND zczbhhzbapzbh LIKE concat(#{zczbhhzbapzbh},'%')
</if>
<if test="lastUpdateTime!=null and lastUpdateTime!=''">
<![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]>
</if>
</where>
ORDER BY updateTime DESC
@ -53,7 +60,7 @@
basic_udirel.id,
basic_udirel.thirdId,basic_udirel.thirdName,basic_udirel.isUseDy,
basic_udirel.thirdId1,basic_udirel.thirdId2,basic_udirel.thirdId3,basic_udirel.thirdId4,
basic_udirel.ybbm,basic_udirel.sptm,
basic_udirel.ybbm,basic_udirel.sptm,basic_udirel.isDisable,
basic_udirel.thirdName1,basic_udirel.thirdName2,basic_udirel.thirdName3,basic_udirel.thirdName4,
basic_udirel.manufactory,basic_udirel.measname,
basic_products.nameCode,basic_products.packRatio,basic_products.packLevel,basic_products.bhxjsl,basic_products.bhzxxsbzsl,basic_products.zxxsbzbhsydysl,basic_products.bhxjcpbm,basic_products.bzcj,basic_products.addType,basic_products.deviceRecordKey,basic_products.cpmctymc,basic_products.cplb,basic_products.flbm,basic_products.ggxh,basic_products.qxlb,basic_products.tyshxydm,basic_products.ylqxzcrbarmc,basic_products.zczbhhzbapzbh,basic_products.ylqxzcrbarywmc,basic_products.sydycpbs,basic_products.uuid,basic_products.sjcpbm,basic_products.versionNumber,basic_products.diType
@ -70,17 +77,66 @@
<if test="nameCode != '' and nameCode != null">
AND nameCode LIKE concat(#{nameCode},'%')
</if>
<if test="unionCode != '' and unionCode != null">
or nameCode LIKE concat('%',#{unionCode},'%')
or basic_udirel.ybbm LIKE concat('%',#{unionCode},'%')
or basic_udirel.sptm LIKE concat('%',#{unionCode},'%')
</if>
<if test="thrPiId != '' and thrPiId != null">
or thirdId LIKE concat('%',#{thrPiId},'%')
or thirdId1 LIKE concat('%',#{thrPiId},'%')
or thirdId2 LIKE concat('%',#{thrPiId},'%')
or thirdId3 LIKE concat('%',#{thrPiId},'%')
or thirdId4 LIKE concat('%',#{thrPiId},'%')
</if>
<if test="uuid != '' and uuid != null">
AND uuid = #{uuid}
</if>
<if test="thirdId != '' and thirdId != null">
AND thirdId = #{thirdId}
</if>
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
AND zczbhhzbapzbh LIKE concat(#{zczbhhzbapzbh},'%')
</if>
<if test="diType != '' and diType != null">
AND diType =#{diType}
</if>
<if test="filterType != null and filterType == 1">
AND (thirdId <![CDATA[<>]]> '' or thirdId1 <![CDATA[<>]]> '' or thirdId2 <![CDATA[<>]]> '' or
thirdId3 <![CDATA[<>]]> '' or thirdId4 <![CDATA[<>]]> '' )
and basic_products.flbm <![CDATA[<>]]> ''
</if>
<if test="filterType != null and filterType == 2">
AND basic_products.flbm is NULL
</if>
<if test="filterType != null and filterType == 3">
AND thirdId is NULL and basic_products.flbm <![CDATA[<>]]> ''
</if>
<if test="filterType != null and filterType == 4">
AND thirdId1 is NULL and basic_products.flbm <![CDATA[<>]]> ''
</if>
<if test="filterType != null and filterType == 5">
AND thirdId2 is NULL and basic_products.flbm <![CDATA[<>]]> ''
</if>
<if test="filterType != null and filterType == 6">
AND thirdId3 is NULL and basic_products.flbm <![CDATA[<>]]> ''
</if>
<if test="filterType != null and filterType == 7">
AND thirdId4 is NULL and basic_products.flbm <![CDATA[<>]]> ''
</if>
</where>
group by uuid
ORDER BY updateTime DESC
</select>
<!-- GROUP BY
uuid,basic_udirel.thirdId,basic_udirel.thirdId1,basic_udirel.thirdId2,basic_udirel.thirdId3,basic_udirel.thirdId4-->
<select id="selectByUuid" parameterType="java.lang.String"
resultType="com.glxp.api.admin.entity.basic.UdiRelevanceEntity">
select * FROM basic_udirel
@ -117,7 +173,32 @@
</if>
</where>
limit 1
limit 1
</select>
<select id="filterEntity" parameterType="com.glxp.api.admin.req.basic.FilterUdiInfoRequest"
resultType="com.glxp.api.admin.entity.basic.UdiRelevanceEntity">
select * FROM basic_udirel
<where>
<if test="thirdId != '' and thirdId != null">
AND thirdId = #{thirdId}
</if>
<if test="thirdId1 != '' and thirdId1 != null">
AND thirdId1 = #{thirdId1}
</if>
<if test="thirdId2 != '' and thirdId2 != null">
AND thirdId2 = #{thirdId2}
</if>
<if test="thirdId3 != '' and thirdId3 != null">
AND thirdId3 = #{thirdId3}
</if>
<if test="thirdId4 != '' and thirdId4 != null">
AND thirdId4 = #{thirdId4}
</if>
<if test="uuid != '' and uuid != null">
AND uuid = #{uuid}
</if>
</where>
</select>
@ -125,7 +206,7 @@
replace INTO basic_udirel
(
thirdId,thirdName,uuid,isUseDy,updateTime,
thirdId1,thirdId2,thirdId3,thirdId4,thirdName1,thirdName2,thirdName3,thirdName4,manufactory,measname,ybbm,sptm
thirdId1,thirdId2,thirdId3,thirdId4,thirdName1,thirdName2,thirdName3,thirdName4,manufactory,measname,ybbm,sptm,isDisable
)
values
(
@ -136,7 +217,7 @@
#{updateTime},
#{thirdId1}, #{thirdId2}, #{thirdId3}, #{thirdId4},
#{thirdName1}, #{thirdName2}, #{thirdName3}, #{thirdName4},
#{manufactory}, #{measname},#{ybbm},#{sptm}
#{manufactory}, #{measname},#{ybbm},#{sptm},#{isDisable}
)
</insert>
@ -173,7 +254,8 @@
<if test="measname != null">measname=#{measname},</if>
<if test="ybbm != null">ybbm=#{ybbm},</if>
<if test="sptm != null">sptm=#{sptm},</if>
<if test="updateTime != null">updateTime=#{updateTime}</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
<if test="isDisable != null">isDisable=#{isDisable},</if>
</set>
WHERE id = #{id}
</update>

@ -12,16 +12,14 @@
concat('%',#{key},'%')
</if>
<if test="id != '' and id != null">
AND id = #{id}
</if>
AND id = #{id}
</if>
<if test="unitId != '' and unitId != null">
AND unitId = #{unitId}
</if>
</where>
</select>
<insert id="insertUnitMaintain" keyProperty="id"
parameterType="com.glxp.api.admin.entity.basic.UnitMaintainEntity">

@ -30,7 +30,7 @@
<insert id="insertWarehouse" keyProperty="id" parameterType="com.glxp.api.admin.req.inout.WarehouseSaveRequest">
INSERT INTO io_codes(action,mainAction,code,corpOrderId,actor,actDate,upperCorpOrderId,fromCorpId,fromCorp)
INSERT INTO io_codes(action,mainAction,code,corpOrderId,actor,actDate,upperCorpOrderId,fromCorpId,fromCorp,nameCode)
values(
#{action},
#{mainAction},
@ -39,7 +39,7 @@
#{actor},
#{actDate},
#{fromCorpId},
#{fromCorp},#{orderId})
#{fromCorp},#{orderId},#{nameCode})
</insert>
<insert id="insertWarehouses" parameterType="java.util.List">
@ -51,7 +51,7 @@
actor,
actDate,
fromCorpId,fromCorp,orderId,batchNo,produceDate,expireDate,
serialNo,count,packageLevel,warehouseCode)
serialNo,count,packageLevel,warehouseCode,nameCode)
VALUES
<foreach collection="io_codesEntities" item="item" index="index"
separator=",">
@ -70,7 +70,7 @@
,#{item.expireDate}
,#{item.serialNo}
,#{item.count}
,#{item.packageLevel} ,#{item.warehouseCode})
,#{item.packageLevel} ,#{item.warehouseCode},#{item.nameCode})
</foreach>
</insert>
@ -86,7 +86,7 @@
</select>
<select id="searchCode" parameterType="Map" resultType="com.glxp.api.admin.entity.inout.WarehouseEntity">
SELECT * FROM io_codes WHERE
SUBSTRING( `code`,1,14) = #{code} or SUBSTRING( `code`,2,14) = #{code} or SUBSTRING( `code`,3,14) = #{code}
nameCode = #{code}
</select>

@ -7,7 +7,7 @@
<insert id="insertCodesTemp" parameterType="java.util.List">
INSERT INTO io_codes_temp
(action, mainAction,code, corpOrderId, actor,actDate,
fromCorpId, fromCorp, orderId,batchNo,produceDate,expireDate,serialNo,count)
fromCorpId, fromCorp, orderId,batchNo,produceDate,expireDate,serialNo,count,nameCode)
VALUES
<foreach collection="codes" item="item" index="index"
separator=",">
@ -25,7 +25,7 @@
,#{item.produceDate}
,#{item.expireDate}
,#{item.serialNo}
,#{item.count}
,#{item.count},#{item.nameCode}
)
</foreach>
</insert>

@ -47,7 +47,7 @@
</insert>
<update id="updateOrder" parameterType="com.glxp.api.admin.entity.inout.OrderEntity">
UPDATE io_order
<set>
<trim prefix="set" suffixOverrides=",">
<if test="action != null">action=#{action},</if>
<if test="corpOrderId != null">corpOrderId=#{corpOrderId},</if>
<if test="actDate != null">actDate=#{actDate},</if>
@ -63,7 +63,7 @@
<if test="erpFk != null">erpFk=#{erpFk},</if>
<if test="signStatus != null">signStatus=#{signStatus}</if>
<if test="stockCheckFk != null">stockCheckFk=#{stockCheckFk}</if>
</set>
</trim>
WHERE id = #{id}
</update>
<select id="listOrderByIds" resultType="com.glxp.api.admin.entity.inout.OrderEntity">

@ -51,7 +51,7 @@
<update id="updateStockCheck" parameterType="com.glxp.api.admin.entity.inventory.StockPrintEntity">
UPDATE inv_stockcheck
<set>
<trim prefix="set" suffixOverrides=",">
<if test="action != null">action=#{action},</if>
<if test="actDate != null">actDate=#{actDate},</if>
<if test="status != null">status=#{status},</if>
@ -59,7 +59,7 @@
<if test="endTime != null">endTime=#{endTime},</if>
<if test="whouse != null">whouse=#{whouse},</if>
<if test="houseCard != null">houseCard=#{houseCard},</if>
</set>
</trim>
WHERE id = #{id}
</update>

@ -11,13 +11,13 @@
AND unitId = #{unitId}
</if>
<if test="name != '' and name != null">
AND name = #{name}
AND ( name = #{name} or spell = #{name})
</if>
<if test="thirdSysFk != '' and thirdSysFk != null">
AND thirdSysFk = #{thirdSysFk}
</if>
</where>
ORDER BY updateTime DESC
</select>
@ -25,7 +25,7 @@
replace INTO thr_corp
(
unitId,name,spell,addr,creditNo,
contact,mobile,thirdSysFk
contact,mobile,thirdSysFk,updateTime
)
values
(
@ -36,7 +36,7 @@
#{creditNo},
#{contact},
#{mobile},
#{thirdSysFk}
#{thirdSysFk},#{updateTime}
)
</insert>
@ -44,7 +44,7 @@
replace INTO thr_corp
(
unitId,name,spell,addr,creditNo,
contact,mobile,thirdSysFk
contact,mobile,thirdSysFk,updateTime
)
values
@ -58,7 +58,7 @@
#{item.creditNo},
#{item.contact},
#{item.mobile},
#{item.thirdSysFk}
#{item.thirdSysFk},#{item.updateTime}
)
</foreach>
</insert>
@ -80,6 +80,8 @@
<if test="contact != null">contact=#{contact},</if>
<if test="mobile != null">mobile=#{mobile},</if>
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
</trim>
WHERE id = #{id}
</update>

@ -23,7 +23,7 @@
<insert id="insertThrCorpExportLog" keyProperty="id"
parameterType="com.glxp.api.admin.entity.thrsys.ThrCorpExportLogEntity">
insert INTO thr_corp_export_log
insert INTO thr_corp_export_log
(genKey,updateTime,dlCount,status,filePath,remark,`type`)
values
(

@ -17,7 +17,7 @@
AND thirdSysFk = #{thirdSysFk}
</if>
</where>
ORDER BY updateTime DESC
</select>
<select id="selectById" parameterType="Map" resultType="com.glxp.api.admin.entity.thrsys.ThrInvProductsEntity">
@ -29,14 +29,14 @@
(
inventoryCode,inventoryName,count,spec,
warehouseName,warehouseCode,registerCertNo,manufacturingDate,
expirationDate,thirdSysFk,batchNo,spaceCode,spaceName
expirationDate,thirdSysFk,batchNo,spaceCode,spaceName,updateTime
)
values
(
#{inventoryCode}, #{inventoryName}, #{count}, #{spec},
#{warehouseName}, #{warehouseCode}, #{registerCertNo}, #{manufacturingDate},
#{expirationDate},
#{thirdSysFk},#{batchNo},#{spaceCode},#{spaceName}
#{thirdSysFk},#{batchNo},#{spaceCode},#{spaceName},#{updateTime}
)
</insert>
@ -45,7 +45,7 @@
(
inventoryCode,inventoryName,count,spec,
warehouseName,warehouseCode,registerCertNo,manufacturingDate,
expirationDate,thirdSysFk,batchNo,spaceCode,spaceName
expirationDate,thirdSysFk,batchNo,spaceCode,spaceName,updateTime
)
values
@ -55,7 +55,7 @@
#{item.inventoryCode}, #{item.inventoryName}, #{item.count}, #{item.spec},
#{item.warehouseName}, #{item.warehouseCode}, #{item.registerCertNo},
#{item.manufacturingDate}, #{item.expirationDate},
#{item.thirdSysFk},#{item.batchNo},#{item.spaceCode},#{item.spaceName}
#{item.thirdSysFk},#{item.batchNo},#{item.spaceCode},#{item.spaceName},#{item.updateTime}
)
</foreach>
</insert>
@ -85,6 +85,8 @@
<if test="spaceCode != null">spaceCode=#{spaceCode},</if>
<if test="spaceName != null">spaceName=#{spaceName},</if>
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
</trim>
WHERE id = #{id}
</update>

@ -22,6 +22,9 @@
<if test="thirdSysFk != '' and thirdSysFk != null">
AND thirdSysFk = #{thirdSysFk}
</if>
<if test="corpName != '' and corpName != null">
AND corpName like concat('%',#{corpName},'%')
</if>
<if test="startDate!=null and startDate!=''">
<![CDATA[ and DATE_FORMAT(billdate, '%Y-%m-%d')>= DATE_FORMAT(#{startDate}, '%Y-%m-%d') ]]>
</if>
@ -29,14 +32,14 @@
<![CDATA[ and DATE_FORMAT(billdate, '%Y-%m-%d') <= DATE_FORMAT(#{endDate}, '%Y-%m-%d') ]]>
</if>
</where>
ORDER BY updateTime DESC
</select>
<insert id="insertThrOrder" keyProperty="id" parameterType="com.glxp.api.admin.entity.thrsys.ThrOrderEntity">
replace INTO thr_order
(
billNo,billdate,corpId,corpName,billType,billFlag,thirdSysFk
billNo,billdate,corpId,corpName,billType,billFlag,thirdSysFk, updateTime,originType
)
values
(
@ -46,14 +49,14 @@
#{corpName},
#{billType},
#{billFlag},
#{thirdSysFk}
#{thirdSysFk},#{updateTime},#{originType}
)
</insert>
<insert id="insertThrOrders" keyProperty="id" parameterType="java.util.List">
replace INTO thr_order
(
billNo,billdate,corpId,corpName,billType,billFlag,thirdSysFk
billNo,billdate,corpId,corpName,billType,billFlag,thirdSysFk,updateTime,originType
)
values
@ -66,7 +69,7 @@
#{item.corpName},
#{item.billType},
#{item.billFlag},
#{item.thirdSysFk}
#{item.thirdSysFk},#{item.updateTime},#{item.originType}
)
</foreach>
</insert>
@ -89,6 +92,8 @@
<if test="billType != null">billType=#{billType},</if>
<if test="billFlag != null">billFlag=#{billFlag},</if>
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
<if test="originType != null">originType=#{originType},</if>
</trim>
WHERE id = #{id}
</update>

@ -14,7 +14,6 @@
AND thirdSysFk = #{thirdSysFk}
</if>
</where>
</select>
@ -23,12 +22,12 @@
replace INTO thr_order_detail
(
productId,productName,spec,batchNo,expireDate,
productDate,count,reCount,orderIdFk,thirdSysFk
productDate,count,reCount,orderIdFk,thirdSysFk,updateTime
)
values
(
#{productId},#{productName},#{spec},#{batchNo},#{expireDate},
#{productDate},#{count},#{reCount},#{orderIdFk},#{thirdSysFk}
#{productDate},#{count},#{reCount},#{orderIdFk},#{thirdSysFk},#{updateTime}
)
</insert>
@ -36,7 +35,7 @@
replace INTO thr_order_detail
(
productId,productName,spec,batchNo,expireDate,
productDate,count,reCount,orderIdFk,thirdSysFk
productDate,count,reCount,orderIdFk,thirdSysFk,updateTime
)
values
@ -44,7 +43,7 @@
separator=",">
(
#{item.productId},#{item.productName},#{item.spec},#{item.batchNo},#{item.expireDate},
#{item.productDate},#{item.count},#{item.reCount},#{item.orderIdFk},#{item.thirdSysFk}
#{item.productDate},#{item.count},#{item.reCount},#{item.orderIdFk},#{item.thirdSysFk},#{item.updateTime}
)
</foreach>
</insert>
@ -69,6 +68,8 @@
<if test="reCount != null">reCount=#{reCount},</if>
<if test="orderIdFk != null">orderIdFk=#{orderIdFk},</if>
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
</trim>
WHERE id = #{id}
</update>

@ -8,16 +8,31 @@
SELECT * FROM thr_products
<where>
<if test="name != '' and name != null">
AND name = #{name}
AND name LIKE concat('%',#{name},'%')
</if>
<if test="code != '' and code != null">
AND code = #{code}
AND code LIKE concat('%',#{code},'%')
</if>
<if test="registerNo != '' and registerNo != null">
AND registerNo LIKE concat('%',#{registerNo},'%')
</if>
<if test="manufactory != '' and manufactory != null">
AND manufactory LIKE concat('%',#{manufactory},'%')
</if>
<if test="spec != '' and spec != null">
AND spec LIKE concat('%',#{spec},'%')
</if>
<if test="unionCode != '' and unionCode != null">
or code LIKE concat('%',#{unionCode},'%') or sptm LIKE concat('%',#{unionCode},'%') or ybbm LIKE concat('%',#{unionCode},'%')
</if>
<if test="thirdSysFk != '' and thirdSysFk != null">
AND thirdSysFk = #{thirdSysFk}
</if>
</where>
ORDER BY updateTime DESC
</select>
<select id="selectById" parameterType="Map" resultType="com.glxp.api.admin.entity.thrsys.ThrProductsEntity">
select * FROM thr_products WHERE id = #{id}
@ -28,7 +43,7 @@
(
code,name,measname,spec,registerNo,manufactory,
cplb,flbm,qxlb,ybbm,sptm,tyshxydm,zczbhhzbapzbh,ylqxzcrbarmc,ylqxzcrbarywmc,cpms,
thirdSysFk
thirdSysFk,updateTime
)
values
(
@ -40,7 +55,7 @@
#{manufactory},
#{cplb}, #{flbm}, #{qxlb}, #{ybbm},#{sptm},
#{tyshxydm}, #{zczbhhzbapzbh}, #{ylqxzcrbarmc}, #{ylqxzcrbarywmc},#{cpms}
#{thirdSysFk}
#{thirdSysFk},#{updateTime}
)
</insert>
@ -49,7 +64,7 @@
(
code,name,measname,spec,registerNo,manufactory,
cplb,flbm,qxlb,ybbm,sptm,tyshxydm,zczbhhzbapzbh,ylqxzcrbarmc,ylqxzcrbarywmc,cpms,
thirdSysFk
thirdSysFk,updateTime
)
values
@ -64,7 +79,7 @@
#{item.manufactory},
#{item.cplb}, #{item.flbm}, #{item.qxlb}, #{item.ybbm},#{item.sptm},
#{item.tyshxydm}, #{item.zczbhhzbapzbh}, #{item.ylqxzcrbarmc}, #{item.ylqxzcrbarywmc},#{item.cpms},
#{item.thirdSysFk}
#{item.thirdSysFk},#{item.updateTime}
)
</foreach>
</insert>
@ -93,6 +108,8 @@
<if test="manufactory != null">manufactory=#{manufactory},</if>
<if test="cpms != null">cpms=#{cpms},</if>
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
</trim>
WHERE id = #{id}
</update>

Loading…
Cancel
Save