|
|
@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
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.ResultBean;
|
|
|
|
import com.dsic.gj_erp.bean.jcsj.DmCzplp;
|
|
|
|
import com.dsic.gj_erp.bean.jcsj.DmCzplp;
|
|
|
|
import com.dsic.gj_erp.bean.jcsj.DmCzplpNew;
|
|
|
|
import com.dsic.gj_erp.bean.jcsj.DmCzplpNew;
|
|
|
@ -46,6 +47,7 @@ public class 中日程批量表合并导入控制器 {
|
|
|
|
private final DmZrcjhOldService oldService;
|
|
|
|
private final DmZrcjhOldService oldService;
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("upload")
|
|
|
|
@PostMapping("upload")
|
|
|
|
|
|
|
|
@AuthFunction
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public ResultBean<?> upload(@RequestParam("file") MultipartFile file,String dcCh, HttpServletRequest req) throws IOException {
|
|
|
|
public ResultBean<?> upload(@RequestParam("file") MultipartFile file,String dcCh, HttpServletRequest req) throws IOException {
|
|
|
|
ExcelZrcAndPlb excelZrcAndPlb = new ExcelZrcAndPlb();
|
|
|
|
ExcelZrcAndPlb excelZrcAndPlb = new ExcelZrcAndPlb();
|
|
|
@ -59,6 +61,9 @@ public class 中日程批量表合并导入控制器 {
|
|
|
|
String bzr = (String) req.getAttribute("yhms");
|
|
|
|
String bzr = (String) req.getAttribute("yhms");
|
|
|
|
String day=DateUtil.date().toString("yyyy/MM/dd");
|
|
|
|
String day=DateUtil.date().toString("yyyy/MM/dd");
|
|
|
|
for(ZrcAndPlb item:objList){
|
|
|
|
for(ZrcAndPlb item:objList){
|
|
|
|
|
|
|
|
if (item.getMfd()==null){
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
String[] fds = item.getMfd().split("/");
|
|
|
|
String[] fds = item.getMfd().split("/");
|
|
|
|
List<DmCzplpNew> fdList = czplpNewService.list(new QueryWrapper<DmCzplpNew>().eq("dc_pl", item.getDcPl()).eq("dc_ch", dcCh));
|
|
|
|
List<DmCzplpNew> fdList = czplpNewService.list(new QueryWrapper<DmCzplpNew>().eq("dc_pl", item.getDcPl()).eq("dc_ch", dcCh));
|
|
|
|
boolean remove = czplpNewService.remove(new QueryWrapper<DmCzplpNew>().eq("dc_pl", item.getDcPl()).eq("dc_ch", dcCh));
|
|
|
|
boolean remove = czplpNewService.remove(new QueryWrapper<DmCzplpNew>().eq("dc_pl", item.getDcPl()).eq("dc_ch", dcCh));
|
|
|
@ -75,15 +80,16 @@ public class 中日程批量表合并导入控制器 {
|
|
|
|
if (ObjectUtil.isNotEmpty(dmZrcjhOne)) {
|
|
|
|
if (ObjectUtil.isNotEmpty(dmZrcjhOne)) {
|
|
|
|
//存进备份表
|
|
|
|
//存进备份表
|
|
|
|
DmZrcjhOld old= BeanUtil.copyProperties(dmZrcjhOne, DmZrcjhOld.class);
|
|
|
|
DmZrcjhOld old= BeanUtil.copyProperties(dmZrcjhOne, DmZrcjhOld.class);
|
|
|
|
|
|
|
|
old.setXh(null);
|
|
|
|
oldService.save(old);
|
|
|
|
oldService.save(old);
|
|
|
|
String dmZrcjhOneBzr = dmZrcjhOne.getBzr();
|
|
|
|
String dmZrcjhOneBzr = dmZrcjhOne.getBzr();
|
|
|
|
String dmZrcjhOneBzrq = dmZrcjhOne.getBzrq();
|
|
|
|
String dmZrcjhOneBzrq = dmZrcjhOne.getBzrq();
|
|
|
|
if (!dmZrcjhOneBzr.contains(bzr)) {
|
|
|
|
if (!dmZrcjhOneBzr.contains(bzr)) {
|
|
|
|
dmZrcjh.setBzr(StrUtil.format("{}@{}",dmZrcjhOneBzr , bzr));
|
|
|
|
dmZrcjh.setBzr(StrUtil.format("{}@{}",dmZrcjhOneBzr , bzr));
|
|
|
|
dmZrcjh.setBzrq(StrUtil.format("{}@{}",dmZrcjhOneBzrq , day));
|
|
|
|
dmZrcjh.setBzrq(StrUtil.format("{}@{}",dmZrcjhOneBzrq , day));
|
|
|
|
dmZrcjh.setXh(dmZrcjhOne.getXh());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
zrcjhService.updateById(dmZrcjh);
|
|
|
|
dmZrcjh.setXh(dmZrcjhOne.getXh());
|
|
|
|
|
|
|
|
zrcjhList.add(dmZrcjh);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
dmZrcjh.setBzr(bzr);
|
|
|
|
dmZrcjh.setBzr(bzr);
|
|
|
|
dmZrcjh.setBzrq(day);
|
|
|
|
dmZrcjh.setBzrq(day);
|
|
|
@ -111,7 +117,7 @@ public class 中日程批量表合并导入控制器 {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
zrcjhService.saveBatch(zrcjhList,500);
|
|
|
|
zrcjhService.saveOrUpdateBatch(zrcjhList,500);
|
|
|
|
|
|
|
|
|
|
|
|
if (!plList.isEmpty()) {
|
|
|
|
if (!plList.isEmpty()) {
|
|
|
|
czplpNewService.saveBatch(plList,500);
|
|
|
|
czplpNewService.saveBatch(plList,500);
|
|
|
@ -139,7 +145,7 @@ public class 中日程批量表合并导入控制器 {
|
|
|
|
dmCzplpService.saveBatch(dmCzplpList);
|
|
|
|
dmCzplpService.saveBatch(dmCzplpList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return new ResultBean<>();
|
|
|
|
return new ResultBean<>(zrcjhList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void updateCzPlp(DmCzplpNew czplpNew,DmCzplpNew czplp){
|
|
|
|
private void updateCzPlp(DmCzplpNew czplpNew,DmCzplpNew czplp){
|
|
|
|