|
|
|
@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.dsic.gj_erp.annotation.AuthFunction;
|
|
|
|
|
import com.dsic.gj_erp.bean.ResultBean;
|
|
|
|
|
import com.dsic.gj_erp.bean.jcsj.DmCzplp;
|
|
|
|
|
import com.dsic.gj_erp.bean.jcsj.DmCzplpNew;
|
|
|
|
@ -46,6 +47,7 @@ public class 中日程批量表合并导入控制器 {
|
|
|
|
|
private final DmZrcjhOldService oldService;
|
|
|
|
|
|
|
|
|
|
@PostMapping("upload")
|
|
|
|
|
@AuthFunction
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public ResultBean<?> upload(@RequestParam("file") MultipartFile file,String dcCh, HttpServletRequest req) throws IOException {
|
|
|
|
|
ExcelZrcAndPlb excelZrcAndPlb = new ExcelZrcAndPlb();
|
|
|
|
@ -75,15 +77,16 @@ public class 中日程批量表合并导入控制器 {
|
|
|
|
|
if (ObjectUtil.isNotEmpty(dmZrcjhOne)) {
|
|
|
|
|
//存进备份表
|
|
|
|
|
DmZrcjhOld old= BeanUtil.copyProperties(dmZrcjhOne, DmZrcjhOld.class);
|
|
|
|
|
old.setXh(null);
|
|
|
|
|
oldService.save(old);
|
|
|
|
|
String dmZrcjhOneBzr = dmZrcjhOne.getBzr();
|
|
|
|
|
String dmZrcjhOneBzrq = dmZrcjhOne.getBzrq();
|
|
|
|
|
if (!dmZrcjhOneBzr.contains(bzr)) {
|
|
|
|
|
dmZrcjh.setBzr(StrUtil.format("{}@{}",dmZrcjhOneBzr , bzr));
|
|
|
|
|
dmZrcjh.setBzrq(StrUtil.format("{}@{}",dmZrcjhOneBzrq , day));
|
|
|
|
|
dmZrcjh.setXh(dmZrcjhOne.getXh());
|
|
|
|
|
}
|
|
|
|
|
zrcjhService.updateById(dmZrcjh);
|
|
|
|
|
dmZrcjh.setXh(dmZrcjhOne.getXh());
|
|
|
|
|
zrcjhList.add(dmZrcjh);
|
|
|
|
|
} else {
|
|
|
|
|
dmZrcjh.setBzr(bzr);
|
|
|
|
|
dmZrcjh.setBzrq(day);
|
|
|
|
@ -99,8 +102,8 @@ public class 中日程批量表合并导入控制器 {
|
|
|
|
|
fdList.stream().filter(fst -> plb.getDcPl().equals(fst.getDcPl()))
|
|
|
|
|
.findFirst().ifPresent(it->updateCzPlp(plb,it));
|
|
|
|
|
}catch (Exception ignored){}
|
|
|
|
|
plList.add(plb);
|
|
|
|
|
}
|
|
|
|
|
plList.add(plb);
|
|
|
|
|
|
|
|
|
|
//旧表数据,仅当首次导入时写入即可
|
|
|
|
|
if (!remove){
|
|
|
|
@ -111,7 +114,7 @@ public class 中日程批量表合并导入控制器 {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
zrcjhService.saveBatch(zrcjhList,500);
|
|
|
|
|
zrcjhService.saveOrUpdateBatch(zrcjhList,500);
|
|
|
|
|
|
|
|
|
|
if (!plList.isEmpty()) {
|
|
|
|
|
czplpNewService.saveBatch(plList,500);
|
|
|
|
@ -139,7 +142,7 @@ public class 中日程批量表合并导入控制器 {
|
|
|
|
|
dmCzplpService.saveBatch(dmCzplpList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new ResultBean<>();
|
|
|
|
|
return new ResultBean<>(zrcjhList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateCzPlp(DmCzplpNew czplpNew,DmCzplpNew czplp){
|
|
|
|
|