|
@@ -2,8 +2,8 @@ package com.shanghaichengdi.ghjgitem.controller;
|
|
|
|
|
|
|
|
|
import cn.hutool.json.JSON;
|
|
|
+import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -67,6 +67,9 @@ public class SIPGDataTransportController extends CommonController {
|
|
|
List<TransportSgDwNzxBoat> transportSgDwNzxBoats= JSONUtil.toList(paramJsonData,TransportSgDwNzxBoat.class);
|
|
|
if (transportSgDwNzxBoats!=null && transportSgDwNzxBoats.size()>0)
|
|
|
{
|
|
|
+ transportSgDwNzxBoats.forEach(i -> {
|
|
|
+ i.setUpdateTime(new Date());
|
|
|
+ });
|
|
|
TransportSgDwNzxBoat sgDwNzxBoat=transportSgDwNzxBoats.get(0);
|
|
|
//获取完工时间
|
|
|
Date date=sgDwNzxBoat.getNzxAendtm();
|
|
@@ -94,13 +97,14 @@ public class SIPGDataTransportController extends CommonController {
|
|
|
Map<List<Object>, List<TransportSgBaseNumber>> lockData = islocks.stream().collect(Collectors.groupingBy(lockDataKey, Collectors.toList()));
|
|
|
|
|
|
if (updata != null && updata.keySet() != null && updata.keySet().size() > 0) {
|
|
|
- StringBuilder stringBuilder = new StringBuilder();
|
|
|
+ List<Long> stringsFilterAll =new ArrayList<>();
|
|
|
List<TransportSgDwNzxBoat> needSaves = new ArrayList<>();
|
|
|
updata.keySet().forEach(i -> {
|
|
|
if (lockData.keySet().contains(i)) //如果过滤数据一致
|
|
|
{
|
|
|
List<Long> stringsFilter = updata.get(i).stream().map(TransportSgDwNzxBoat::getNzxSchPkid).collect(Collectors.toList());
|
|
|
- stringBuilder.append("[" + stringsFilter.toString() + "]");
|
|
|
+ stringsFilterAll.addAll(stringsFilter);
|
|
|
+
|
|
|
} else {
|
|
|
needSaves.addAll(updata.get(i));
|
|
|
}
|
|
@@ -111,13 +115,22 @@ public class SIPGDataTransportController extends CommonController {
|
|
|
});
|
|
|
boolean a = boatService.saveOrUpdateBatch(needSaves);
|
|
|
if (a) {
|
|
|
- String jsonString = JSONArray.toJSONString(stringBuilder.toString());
|
|
|
- String encodedData = resultEncode(jsonString);
|
|
|
- return ReturnMsg.success("存储成功,且部分数据已锁,无法修改,无法修改的pkId列表为data",encodedData);
|
|
|
+ if (stringsFilterAll!=null && stringsFilterAll.size()>0) {
|
|
|
+ JSONArray jsonArray = JSONUtil.parseArray(stringsFilterAll);
|
|
|
+ String encodedData = resultEncode(jsonArray.toString());
|
|
|
+ return ReturnMsg.success("存储成功,且部分数据已锁,无法修改,无法修改的pkId列表为data", encodedData);
|
|
|
+ }else {
|
|
|
+ return ReturnMsg.success("存储成功");
|
|
|
+ }
|
|
|
} else {
|
|
|
- String jsonString = JSONArray.toJSONString(stringBuilder.toString());
|
|
|
- String encodedData = resultEncode(jsonString);
|
|
|
- return ReturnMsg.error("存储失败且部分数据已锁,无法修改,无法修改的pkId列表为data",encodedData);
|
|
|
+ if (stringsFilterAll!=null && stringsFilterAll.size()>0) {
|
|
|
+ JSONArray jsonArray = JSONUtil.parseArray(stringsFilterAll);
|
|
|
+ String encodedData = resultEncode(jsonArray.toString());
|
|
|
+ return ReturnMsg.error("存储失败且部分数据已锁,无法修改,无法修改的pkId列表为data", encodedData);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return ReturnMsg.error("存储失败,请重新尝试");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -159,11 +172,16 @@ public class SIPGDataTransportController extends CommonController {
|
|
|
}
|
|
|
String paramJsonData = getParamJsonData(vo.getData());
|
|
|
List<TransportSgDwNzxContainers> transportSgDwNzxAgents= JSONUtil.toList(paramJsonData,TransportSgDwNzxContainers.class);
|
|
|
- boolean a= containersService.saveOrUpdateBatch(transportSgDwNzxAgents);
|
|
|
- if (a) {
|
|
|
- return ReturnMsg.success("存储成功");
|
|
|
+ if (transportSgDwNzxAgents!=null && transportSgDwNzxAgents.size()>0) {
|
|
|
+ transportSgDwNzxAgents.forEach(i->{i.setUpdateTime(new Date());});
|
|
|
+ boolean a = containersService.saveOrUpdateBatch(transportSgDwNzxAgents);
|
|
|
+ if (a) {
|
|
|
+ return ReturnMsg.success("存储成功");
|
|
|
+ } else {
|
|
|
+ return ReturnMsg.error("存储失败");
|
|
|
+ }
|
|
|
}else {
|
|
|
- return ReturnMsg.error("存储失败");
|
|
|
+ return ReturnMsg.error("无传递数据");
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -183,11 +201,18 @@ public class SIPGDataTransportController extends CommonController {
|
|
|
}
|
|
|
String paramJsonData = getParamJsonData(vo.getData());
|
|
|
List<TransportSgDwNzxAgent> transportSgDwNzxAgents= JSONUtil.toList(paramJsonData,TransportSgDwNzxAgent.class);
|
|
|
- boolean a= agentService.saveOrUpdateBatch(transportSgDwNzxAgents);
|
|
|
- if (a) {
|
|
|
- return ReturnMsg.success("存储成功");
|
|
|
+ if (transportSgDwNzxAgents!=null && transportSgDwNzxAgents.size()>0) {
|
|
|
+ transportSgDwNzxAgents.forEach(i -> {
|
|
|
+ i.setUpdateTime(new Date());
|
|
|
+ });
|
|
|
+ boolean a = agentService.saveOrUpdateBatch(transportSgDwNzxAgents);
|
|
|
+ if (a) {
|
|
|
+ return ReturnMsg.success("存储成功");
|
|
|
+ } else {
|
|
|
+ return ReturnMsg.error("存储失败");
|
|
|
+ }
|
|
|
}else {
|
|
|
- return ReturnMsg.error("存储失败");
|
|
|
+ return ReturnMsg.error("无传递数据");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -218,10 +243,9 @@ public class SIPGDataTransportController extends CommonController {
|
|
|
int count=1;
|
|
|
if (sgSyncStatuses.getSyncStatus()==1 && sgSyncStatuses.getSyncUpdateStatus() == 0) {
|
|
|
LambdaQueryWrapper<TransportSgBaseNumber> sgBaseNumberLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
- sgBaseNumberLambdaQueryWrapper.gt(TransportSgBaseNumber::getBaseYear,sgSyncStatuses.getSyncYear());
|
|
|
- sgBaseNumberLambdaQueryWrapper.gt(TransportSgBaseNumber::getBaseQuarter,sgSyncStatuses.getSyncQuarter());
|
|
|
+ sgBaseNumberLambdaQueryWrapper.eq(TransportSgBaseNumber::getBaseYear,sgSyncStatuses.getSyncYear());
|
|
|
+ sgBaseNumberLambdaQueryWrapper.eq(TransportSgBaseNumber::getBaseQuarter,sgSyncStatuses.getSyncQuarter());
|
|
|
baseNumberService.remove(sgBaseNumberLambdaQueryWrapper);
|
|
|
-
|
|
|
Calendar startDate = DateUtils.getQuarterStart(sgSyncStatuses.getSyncYear(), sgSyncStatuses.getSyncQuarter());
|
|
|
Calendar endDate = DateUtils.getQuarterEnd(sgSyncStatuses.getSyncYear(), sgSyncStatuses.getSyncQuarter());
|
|
|
PageHelper.startPage(count, pageSize);
|
|
@@ -283,41 +307,47 @@ public class SIPGDataTransportController extends CommonController {
|
|
|
}
|
|
|
}
|
|
|
else if (sgSyncStatuses.getSyncStatus()==1 && sgSyncStatuses.getSyncUpdateStatus() == 1){
|
|
|
+ //只计算未锁定的,已锁定的不能删除
|
|
|
+ LambdaQueryWrapper<TransportSgBaseNumber> sgBaseNumberLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ sgBaseNumberLambdaQueryWrapper.eq(TransportSgBaseNumber::getBaseYear,sgSyncStatuses.getSyncYear());
|
|
|
+ sgBaseNumberLambdaQueryWrapper.eq(TransportSgBaseNumber::getBaseQuarter,sgSyncStatuses.getSyncQuarter());
|
|
|
+ sgBaseNumberLambdaQueryWrapper.isNull(TransportSgBaseNumber::getBaseNotup);
|
|
|
+ baseNumberService.remove(sgBaseNumberLambdaQueryWrapper);
|
|
|
+
|
|
|
Calendar startDate = DateUtils.getQuarterStart(sgSyncStatuses.getSyncYear(), sgSyncStatuses.getSyncQuarter());
|
|
|
Calendar endDate = DateUtils.getQuarterEnd(sgSyncStatuses.getSyncYear(), sgSyncStatuses.getSyncQuarter());
|
|
|
PageHelper.startPage(count, pageSize);
|
|
|
Page<TransportSgBaseNumber> baseNumberPage = baseNumberMapper.getAllForCountDataForUpdate(startDate.getTime(), endDate.getTime());
|
|
|
+ PageHelper.clearPage();
|
|
|
if (baseNumberPage != null && baseNumberPage.size() > 0 && baseNumberPage.getResult() != null && baseNumberPage.getResult().size() > 0) {
|
|
|
- if (baseNumberPage.getTotal() > pageSize ){
|
|
|
+ if (baseNumberPage.getTotal() > pageSize) {
|
|
|
Long totalCount = baseNumberPage.getTotal();
|
|
|
Long totalPages = (totalCount + pageSize - 1) / pageSize;
|
|
|
- for (int i = count; i <= totalPages; i++) {
|
|
|
+ for (int i = 1; i <= totalPages; i++) {
|
|
|
+ System.out.println("=== 本次运行第:"+i+"页");
|
|
|
+ PageHelper.startPage(i, pageSize);
|
|
|
+ Page<TransportSgBaseNumber> baseNumberPages = baseNumberMapper.getAllForCountDataForUpdate(startDate.getTime(), endDate.getTime());
|
|
|
if (i == 1) {
|
|
|
- saveAllTransportSgBaseNumber(sgSyncStatuses.getSyncYear(), sgSyncStatuses.getSyncQuarter(), baseNumberPage.getResult(), null);
|
|
|
+ saveAllTransportSgBaseNumber(sgSyncStatuses.getSyncYear(), sgSyncStatuses.getSyncQuarter(), baseNumberPages.getResult(), null);
|
|
|
} else {
|
|
|
- PageHelper.startPage(i, pageSize);
|
|
|
- Page<TransportSgBaseNumber> baseNumberPages = baseNumberMapper.getAllForCountData(startDate.getTime(), endDate.getTime());
|
|
|
saveAllTransportSgBaseNumber(sgSyncStatuses.getSyncYear(), sgSyncStatuses.getSyncQuarter(), baseNumberPages.getResult(), null);
|
|
|
}
|
|
|
+ PageHelper.clearPage();
|
|
|
}
|
|
|
} else {
|
|
|
saveAllTransportSgBaseNumber(sgSyncStatuses.getSyncYear(), sgSyncStatuses.getSyncQuarter(), baseNumberPage.getResult(), null);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- LambdaQueryWrapper<TransportSgBaseNumber> lambdaQueryWrappera1 = new LambdaQueryWrapper();
|
|
|
- lambdaQueryWrappera1.eq(TransportSgBaseNumber::getBaseYear, sgSyncStatuses.getSyncYear());
|
|
|
- lambdaQueryWrappera1.eq(TransportSgBaseNumber::getBaseQuarter, sgSyncStatuses.getSyncQuarter());
|
|
|
- baseNumberMapper.delete(lambdaQueryWrappera1.eq(TransportSgBaseNumber::getBaseCompyName,"上港集团"));
|
|
|
- //所以企业数据合并成上港
|
|
|
+ //所以企业数据合并成上港的
|
|
|
LambdaQueryWrapper<TransportSgBaseNumber> lambdaQueryWrappera = new LambdaQueryWrapper();
|
|
|
lambdaQueryWrappera.eq(TransportSgBaseNumber::getBaseYear, sgSyncStatuses.getSyncYear());
|
|
|
lambdaQueryWrappera.eq(TransportSgBaseNumber::getBaseQuarter, sgSyncStatuses.getSyncQuarter());
|
|
|
+ sgBaseNumberLambdaQueryWrapper.ne(TransportSgBaseNumber::getBaseNotup,1);
|
|
|
IPage<TransportSgBaseNumber> baseNumberPages = baseNumberMapper.selectPage(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(count, pageSize), lambdaQueryWrappera);
|
|
|
if (baseNumberPages.getTotal() > pageSize) {
|
|
|
Long totalCount = baseNumberPage.getTotal();
|
|
|
Long totalPages = (totalCount + pageSize - 1) / pageSize;
|
|
|
- for (int i = count; i <= totalPages; i++) {
|
|
|
+ for (int i = 1; i <= totalPages; i++) {
|
|
|
if (i == 1) {
|
|
|
baseNumberPages.getRecords().forEach(j -> {
|
|
|
j.setBaseCompyName("上港集团");
|
|
@@ -343,12 +373,6 @@ public class SIPGDataTransportController extends CommonController {
|
|
|
});
|
|
|
baseNumberService.saveOrUpdateBatch(baseNumberPages.getRecords());
|
|
|
}
|
|
|
-
|
|
|
- LambdaQueryWrapper<TransportSgDwNzxBoat> lambdaQueryWrapper = new LambdaQueryWrapper();
|
|
|
- lambdaQueryWrapper.eq(TransportSgDwNzxBoat::getTransUpdate, 1);
|
|
|
- TransportSgDwNzxBoat sgDwNzxBoat = new TransportSgDwNzxBoat();
|
|
|
- sgDwNzxBoat.setTransUpdate(0);
|
|
|
- boatService.update(sgDwNzxBoat, lambdaQueryWrapper);
|
|
|
}
|
|
|
|
|
|
}else {
|
|
@@ -362,6 +386,9 @@ public class SIPGDataTransportController extends CommonController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 组装数据
|
|
|
* @param sgBaseNumberList
|
|
@@ -441,6 +468,9 @@ public class SIPGDataTransportController extends CommonController {
|
|
|
if (needSaveDatas!=null && needSaveDatas.size()>0)
|
|
|
{
|
|
|
System.out.println("=== 存储数据:"+needSaveDatas.toString());
|
|
|
+ needSaveDatas.forEach(i->{
|
|
|
+ i.setUpdateTime(new Date());
|
|
|
+ });
|
|
|
baseNumberService.saveOrUpdateBatch(needSaveDatas);
|
|
|
return needSaveDatas;
|
|
|
}
|
|
@@ -448,6 +478,7 @@ public class SIPGDataTransportController extends CommonController {
|
|
|
else { //未查到
|
|
|
needSaveData.forEach(i->{
|
|
|
i.setBaseId(snowflakeConfig.snowflakeId());
|
|
|
+ i.setUpdateTime(new Date());
|
|
|
});
|
|
|
System.out.println("=== 存储数据:"+needSaveData.toString());
|
|
|
baseNumberService.saveOrUpdateBatch(needSaveData);
|