|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.dsic.gj_erp.jszb.control;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.bean.copier.CopyOptions;
|
|
|
|
|
import cn.hutool.core.util.ObjUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
|
@ -39,6 +40,7 @@ public class JszbController {
|
|
|
|
|
List<PartFlowInfo> list = flowInfoService.list(Wrappers.<PartFlowInfo>lambdaQuery()
|
|
|
|
|
.eq(PartFlowInfo::getCh, ch)
|
|
|
|
|
.eq(StrUtil.isEmpty(end) && StrUtil.isNotEmpty(begin), PartFlowInfo::getPl, begin)
|
|
|
|
|
.isNotNull(PartFlowInfo::getPl)
|
|
|
|
|
.between(StrUtil.isAllNotEmpty(begin, end), PartFlowInfo::getPl, begin, end)
|
|
|
|
|
.orderByAsc(PartFlowInfo::getPl,PartFlowInfo::getFd)
|
|
|
|
|
);
|
|
|
|
@ -51,31 +53,77 @@ public class JszbController {
|
|
|
|
|
EasyExcel.read(file.getInputStream(), PartFlowInfo.class, objectListener).sheet(0).headRowNumber(1).doRead();
|
|
|
|
|
|
|
|
|
|
List<PartFlowInfo> objList = objectListener.getObjectList();
|
|
|
|
|
try {
|
|
|
|
|
ExcelFlowInfoListener objectListener1 = new ExcelFlowInfoListener();
|
|
|
|
|
EasyExcel.read(file.getInputStream(), PartFlowInfo.class, objectListener1).sheet(1).headRowNumber(1).doRead();
|
|
|
|
|
List<PartFlowInfo> objList2 = objectListener1.getObjectList();
|
|
|
|
|
|
|
|
|
|
List<PartFlowInfo> _list=new ArrayList<>();
|
|
|
|
|
item2:
|
|
|
|
|
for (PartFlowInfo item2:objList2){
|
|
|
|
|
for (PartFlowInfo item1:objList){
|
|
|
|
|
if (ObjUtil.equal(item1.getCh(),item2.getCh())&&ObjUtil.equal(item1.getPartName(),item2.getPartName())){
|
|
|
|
|
continue item2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_list.add(item2);
|
|
|
|
|
}
|
|
|
|
|
objList.addAll(_list);
|
|
|
|
|
}catch (Exception ignored){}
|
|
|
|
|
|
|
|
|
|
List<String> errors = objectListener.getErrors();
|
|
|
|
|
|
|
|
|
|
if (!objList.isEmpty()){
|
|
|
|
|
String ch=objList.get(0).getDcch();
|
|
|
|
|
List<PartFlowInfo> list = flowInfoService.list(Wrappers.<PartFlowInfo>lambdaQuery().eq(PartFlowInfo::getCh, ch));
|
|
|
|
|
|
|
|
|
|
List<PartFlowInfo> updateList=new ArrayList<>();
|
|
|
|
|
objList.forEach(item->{
|
|
|
|
|
PartFlowInfo one = flowInfoService.getOne(Wrappers.<PartFlowInfo>lambdaQuery()
|
|
|
|
|
.eq(StrUtil.isNotEmpty(item.getCh()),PartFlowInfo::getCh, item.getCh())
|
|
|
|
|
.eq(StrUtil.isNotEmpty(item.getCh()),PartFlowInfo::getPartName,item.getPartName())
|
|
|
|
|
.eq(StrUtil.isNotEmpty(item.getProject()),PartFlowInfo::getCh,item.getProject())
|
|
|
|
|
.eq(StrUtil.isNotEmpty(item.getProject()),PartFlowInfo::getPartName,item.getPartName0())
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (ObjUtil.isEmpty(one)){
|
|
|
|
|
one = new PartFlowInfo();
|
|
|
|
|
a:
|
|
|
|
|
for (PartFlowInfo item1:objList){
|
|
|
|
|
for (PartFlowInfo item2:list){
|
|
|
|
|
if ((ObjUtil.equal(item1.getCh(),item2.getCh())&&ObjUtil.equal(item1.getPartName(),item2.getPartName())
|
|
|
|
|
||(ObjUtil.equal(item1.getProject(),item2.getCh())&&ObjUtil.equal(item1.getPartName0(),item2.getPartName())))){
|
|
|
|
|
CopyOptions copyOptions = CopyOptions.create().setIgnoreNullValue(true);
|
|
|
|
|
copyOptions.setIgnoreProperties("id");
|
|
|
|
|
BeanUtil.copyProperties(item1,item2,copyOptions);
|
|
|
|
|
updateList.add(item2);
|
|
|
|
|
continue a;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(item1.getProject()!=null){
|
|
|
|
|
item1.setCh(item1.getProject());
|
|
|
|
|
item1.setFd(item1.getBlock());
|
|
|
|
|
item1.setPartName(item1.getPartName0());
|
|
|
|
|
}
|
|
|
|
|
updateList.add(item1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BeanUtil.copyProperties(item,one,"id");
|
|
|
|
|
// objList.forEach(item->{
|
|
|
|
|
// PartFlowInfo one = flowInfoService.getOne(Wrappers.<PartFlowInfo>lambdaQuery()
|
|
|
|
|
// .eq(StrUtil.isNotEmpty(item.getCh()),PartFlowInfo::getCh, item.getCh())
|
|
|
|
|
// .eq(StrUtil.isNotEmpty(item.getCh()),PartFlowInfo::getPartName,item.getPartName())
|
|
|
|
|
// .eq(StrUtil.isNotEmpty(item.getProject()),PartFlowInfo::getCh,item.getProject())
|
|
|
|
|
// .eq(StrUtil.isNotEmpty(item.getProject()),PartFlowInfo::getPartName,item.getPartName0())
|
|
|
|
|
// );
|
|
|
|
|
//
|
|
|
|
|
// if (ObjUtil.isEmpty(one)){
|
|
|
|
|
// one = new PartFlowInfo();
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// BeanUtil.copyProperties(item,one,"id");
|
|
|
|
|
//
|
|
|
|
|
// if(item.getProject()!=null){
|
|
|
|
|
// one.setCh(item.getProject());
|
|
|
|
|
// one.setFd(item.getBlock());
|
|
|
|
|
// one.setPartName(item.getPartName0());
|
|
|
|
|
// }
|
|
|
|
|
// updateList.add(one);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
if(item.getProject()!=null){
|
|
|
|
|
one.setCh(item.getProject());
|
|
|
|
|
one.setFd(item.getBlock());
|
|
|
|
|
one.setPartName(item.getPartName0());
|
|
|
|
|
flowInfoService.saveOrUpdateBatch(updateList);
|
|
|
|
|
}
|
|
|
|
|
updateList.add(one);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
flowInfoService.saveOrUpdateBatch(updateList);
|
|
|
|
|
return new ResultBean<>(errors);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|