导入导出bug修复

master
anthonywj 4 years ago
parent 7b88dd2cb6
commit 9296e18d02

@ -248,7 +248,7 @@ public class UdiInfoImportLogController {
if(udiInfoImportLogEntity==null){
udiInfoImportLogEntity = new UdiInfoImportLogEntity();
udiInfoImportLogEntity.setGenKey(genKey);
udiInfoImportLogEntity.setFromType("接口导入");
udiInfoImportLogEntity.setFromType("接口上传");
udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_UNPROCESS);
udiInfoImportLogEntity.setUpdateTime(new Date(System.currentTimeMillis()));
udiInfoImportLogService.insertImportLog(udiInfoImportLogEntity);

@ -89,8 +89,8 @@ public class InvErpOnhandController {
erpInvProductResponse.setName(item.getInventoryName());
return erpInvProductResponse;
}).collect(Collectors.toList());
PageInfo<ErpInvProductResponse> pageInfo;
pageInfo = new PageInfo<>(erpInvProductResponseList);
PageInfo<ThrInvProductsEntity> pageInfo;
pageInfo = new PageInfo<>(thrInvProductsEntities);
PageSimpleResponse<ErpInvProductResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(erpInvProductResponseList);

@ -77,9 +77,13 @@ public class ThrInvProductsImportLogController {
if (thrInvProductsImportLogEntities != null && thrInvProductsImportLogEntities.size() > 0) {
ThrInvProductsImportLogEntity thrInvProductsImportLogEntity = thrInvProductsImportLogEntities.get(0);
thrInvProductsImportLogService.deleteById(thrInvProductsImportLogEntity.getId() + "");
thrInvProductsDetailService.deleteByGenkey(thrInvProductsImportLogEntity.getGenKey());
return ResultVOUtils.success("删除成功");
}else {
return ResultVOUtils.error(500, "删除失败,未找到该记录");
}
return ResultVOUtils.success("删除成功");
}
}

@ -179,7 +179,7 @@ public class ThrOrderController {
String genKey = CustomUtil.getId();
thrOrderImportLogEntity.setGenKey(genKey);
thrOrderImportLogEntity.setFromType("第三方系统获取");
thrOrderImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_PROCESS);
thrOrderImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_UNPROCESS);
thrOrderImportLogEntity.setUpdateTime(new Date());
thrOrderImportLogEntity.setThirdSysFk(filterThrProductsRequest.getThirdSysFk());
thrOrderImportLogService.insertImportLog(thrOrderImportLogEntity);

@ -60,7 +60,7 @@ public class ThrDataService {
} else {
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
filterThrProductsRequest.setCode(code);
filterThrProductsRequest.setThirdSys(thirdSys);
filterThrProductsRequest.setThirdSysFk(thirdSys);
List<ThrProductsEntity> thrProductsEntitys = thrProductsService.filterThrProductsRequest(filterThrProductsRequest);
if (thrProductsEntitys != null && thrProductsEntitys.size() > 0) {
return thrProductsEntitys.get(0);

@ -72,6 +72,7 @@ public class BasicGenExcelService {
} else {//一键导出
BasicUnitMaintainFilterRequest filterRequest = new BasicUnitMaintainFilterRequest();
BeanUtils.copyProperties(corpsExportRequest, filterRequest);
filterRequest.setPage(null);
List<List<String>> genDatas = genExcelData(filterRequest);
if (genDatas != null && genDatas.size() > 0) {
excelData.addAll(genDatas);
@ -166,6 +167,7 @@ public class BasicGenExcelService {
} else {//一键导出
FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest();
BeanUtils.copyProperties(udiInfoExportRequest, filterUdiInfoRequest);
filterUdiInfoRequest.setPage(null);
List<List<String>> genDatas = genExcelData(filterUdiInfoRequest);
if (genDatas != null && genDatas.size() > 0) {
excelData.addAll(genDatas);

@ -51,6 +51,7 @@ public class BasicUdiInfoImportService {
for (UdiInfoImportDetailEntity udiInfoImportDetailEntity : udiInfoImportEntities) {
UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(udiInfoImportDetailEntity.getUdiCode());
if (udiInfoEntity == null) {
//国家库取UDI信息
List<UdiInfoEntity> froms = new UdiDlHttpClient(udiUrl).getUdiByDi(udiInfoImportDetailEntity.getUdiCode());
if (froms != null && !froms.isEmpty()) {
udiInfoEntity = froms.get(0);
@ -99,7 +100,4 @@ public class BasicUdiInfoImportService {
}
//导出生成EXCEL文件
}

@ -128,6 +128,7 @@ public class ThrCorpsDlService {
//根据查询条件一键导出数据库往来单位
FilterThrCorpRequest filterThrCorpRequest = new FilterThrCorpRequest();
BeanUtils.copyProperties(thrCorpExportRequest, filterThrCorpRequest);
filterThrCorpRequest.setPage(null);
List<List<String>> genDatas = genExcelData(filterThrCorpRequest);
if (genDatas != null && genDatas.size() > 0) {
excelData.addAll(genDatas);

@ -85,13 +85,17 @@ public class ThrInvProductsDlService {
ThrInvProductsExportLogEntity thrInvProductsExportLogEntity = thrInvProductsExportLogService.selectByGenKey(genKey);
List<List<String>> excelData = new ArrayList<>();
List<String> head = new ArrayList<>();
head.add("往来单位ID");
head.add("往来单位名称");
head.add("拼音简写");
head.add("地址");
head.add("社会信用号");
head.add("联系人");
head.add("联系电话");
head.add("存货编码");
head.add("存货名称");
head.add("规格型号");
head.add("数量");
head.add("批次号");
head.add("生产日期");
head.add("失效日期");
head.add("仓位号");
head.add("仓位名称");
head.add("货位号");
head.add("货位名称");
excelData.add(head);
//选中导出
if (thrInvProductsExportRequest.getThrInvProductsEntities() != null && thrInvProductsExportRequest.getThrInvProductsEntities().size() > 0) {
@ -99,7 +103,7 @@ public class ThrInvProductsDlService {
excelData.addAll(getRows(thrInvProductsEntities));
} else {//一键导出
//判断是否启用实时获取
BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("invPiUrl", thrInvProductsExportRequest.getThirdSysFk());
BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("invPiUrl", thrInvProductsExportRequest.getThirdSys());
if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null) {
thrInvProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
thrInvProductsExportLogEntity.setRemark("库存产品信息接口地址未定义");
@ -112,7 +116,7 @@ public class ThrInvProductsDlService {
thrInvProductsExportLogService.updateThrInvProductsExportLog(thrInvProductsExportLogEntity);
return;
}
if ( basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
if (basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
//从第三方服务实时一键导出
FilterThrInvProductsRequest filterThrInvProductsRequest = new FilterThrInvProductsRequest();
BeanUtils.copyProperties(thrInvProductsExportRequest, filterThrInvProductsRequest);
@ -257,7 +261,7 @@ public class ThrInvProductsDlService {
}
public List<List<String>> genExcelData(String id, FilterThrInvProductsRequest filterThrInvProductsRequest) {
filterThrInvProductsRequest.setThirdSysFk(filterThrInvProductsRequest.getThirdSys());
List<List<String>> excelData = new ArrayList<>();
List<ThrInvProductsEntity> thrInvProductsEntities = new ArrayList<>();
if (id != null) {

@ -5,6 +5,7 @@ import com.glxp.api.admin.constant.BasicProcessStatus;
import com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity;
import com.glxp.api.admin.entity.thrsys.*;
import com.glxp.api.admin.httpclient.ErpOrderClient;
import com.glxp.api.admin.req.basic.FilterUdiIpLogRequest;
import com.glxp.api.admin.req.inout.FilterOrderRequest;
import com.glxp.api.admin.req.thrsys.FilterThrOrderDetailRequest;
import com.glxp.api.admin.req.thrsys.FilterThrOrderRequest;
@ -25,6 +26,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
@ -43,7 +45,10 @@ public class ThrOrdersDlService {
private ThrOrderImportLogService thrOrderImportLogService;
@Resource
ThrOrderExportLogService thrOrderExportLogService;
@Resource
ThrOrderImportDetailService thrOrderImportDetailService;
@Resource
ThrOrderImportService thrOrderImportService;
@Async
public void importOrders(String genKey, String action) {
@ -55,16 +60,18 @@ public class ThrOrdersDlService {
return;
}
int page = 1;
int limit = 100;
while (page != -1) {
page = getOrders(page, limit, basicThirdSysDetailEntity.getValue(), basicThirdSysDetailEntity.getThirdSysFk(), thrOrderImportLogEntity, action);
}
thrOrderImportService.importThrOrder(genKey);
redisUtil.set(Constant.dlThrProducts, "false");
WebSocketServer.sendInfo("业务单据信息下载已完成,请刷新查看!", "sid");
// thrOrderImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
// thrOrderImportLogService.updateImportLog(thrOrderImportLogEntity);
thrOrderImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
thrOrderImportLogService.updateImportLog(thrOrderImportLogEntity);
}
@Async
@ -159,7 +166,7 @@ public class ThrOrdersDlService {
List<ErpOrderResponse> erpOrderResponses = thrOrderExportRequest.getErpOrderResponses();
postThrOrderRequest.setDatas(erpOrderResponses);
} else {//一键导出
List<ErpOrderResponse> erpOrderResponses =new ArrayList<>();
List<ErpOrderResponse> erpOrderResponses = new ArrayList<>();
BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("orderQueryUrl", thrOrderExportRequest.getThirdSysFk());
if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null) {
thrOrderExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
@ -186,15 +193,15 @@ public class ThrOrdersDlService {
List<ThrOrderEntity> thrOrderEntities = thrOrderService.filterThrOrder(filterThrOrderRequest);
for (ThrOrderEntity thrOrderEntity : thrOrderEntities) {
ErpOrderResponse erpOrderResponse = new ErpOrderResponse();
BeanUtils.copyProperties(thrOrderEntity,erpOrderResponse);
BeanUtils.copyProperties(thrOrderEntity, erpOrderResponse);
FilterThrOrderDetailRequest filterThrOrderDetailRequest = new FilterThrOrderDetailRequest();
filterThrOrderDetailRequest.setOrderIdFk(thrOrderEntity.getId() + "");
List<ThrOrderDetailEntity> thrOrderDetailEntities = thrOrderDetailService.filterThrOrderDetailDetail(filterThrOrderDetailRequest);
if (thrOrderDetailEntities != null) {
List<ErpOrderResponse.SubErpOrder > subErpOrders = new ArrayList<>();
List<ErpOrderResponse.SubErpOrder> subErpOrders = new ArrayList<>();
for (ThrOrderDetailEntity thrOrderDetailEntity : thrOrderDetailEntities) {
ErpOrderResponse.SubErpOrder subErpOrder = new ErpOrderResponse.SubErpOrder();
BeanUtils.copyProperties(thrOrderDetailEntity,subErpOrder);
BeanUtils.copyProperties(thrOrderDetailEntity, subErpOrder);
subErpOrders.add(subErpOrder);
}
erpOrderResponse.setSubErpOrders(subErpOrders);
@ -226,15 +233,18 @@ public class ThrOrdersDlService {
BeanUtils.copyProperties(erpOrderResponse, thrOrderEntity);
thrOrderEntity.setThirdSysFk(thirdSys);
thrOrderService.insertThrOrder(thrOrderEntity);
thrOrderEntity = thrOrderService.findByUnique(thrOrderEntity.getBillNo(), thrOrderEntity.getThirdSysFk());
List<ThrOrderDetailEntity> thrOrderDetailEntities = new ArrayList<>();
// thrOrderEntity = thrOrderService.findByUnique(thrOrderEntity.getBillNo(), thrOrderEntity.getThirdSysFk());
List<ThrOrderImportDetailEntity> thrOrderDetailEntities = new ArrayList<>();
for (ErpOrderResponse.SubErpOrder subPurchase : erpOrderResponse.getSubErpOrders()) {
ThrOrderDetailEntity thrOrderDetailEntity = new ThrOrderDetailEntity();
ThrOrderImportDetailEntity thrOrderDetailEntity = new ThrOrderImportDetailEntity();
BeanUtils.copyProperties(subPurchase, thrOrderDetailEntity);
thrOrderDetailEntity.setOrderIdFk(thrOrderEntity.getId() + "");
BeanUtils.copyProperties(erpOrderResponse, thrOrderDetailEntity);
thrOrderDetailEntity.setGenKeyFk(thrOrderImportLogEntity.getGenKey());
thrOrderDetailEntity.setThirdSysFk(thirdSys);
thrOrderDetailEntity.setUpdateTime(new Date());
thrOrderDetailEntities.add(thrOrderDetailEntity);
}
thrOrderDetailService.insertThrOrderDetails(thrOrderDetailEntities);
thrOrderImportDetailService.insertOrderImportDetails(thrOrderDetailEntities);
}
page++;
if (page * limit < responseBaseResponse.getData().getTotal()) {
@ -251,8 +261,6 @@ public class ThrOrdersDlService {
thrOrderImportLogService.updateImportLog(thrOrderImportLogEntity);
return -1;
}
thrOrderImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
thrOrderImportLogService.updateImportLog(thrOrderImportLogEntity);
return -1;
}
@ -316,6 +324,7 @@ public class ThrOrdersDlService {
}
return erpOrderResponseList;
}
public List<ErpOrderResponse> getThrOrders(int page, int limit, String orderQueryUrl, FilterThrOrderRequest filterThrOrderRequest) {
FilterOrderRequest filterOrderRequest = new FilterOrderRequest();
BeanUtils.copyProperties(filterThrOrderRequest, filterOrderRequest);

Loading…
Cancel
Save