#
whycq
2022-09-13 35ddd989b73d815777055bcdf05118d6cdd892e6
src/main/java/zy/cloud/wms/manager/controller/ItemController.java
@@ -19,6 +19,7 @@
import zy.cloud.wms.manager.service.*;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
@RestController
@@ -115,6 +116,7 @@
        /**
         * 控管
         */
        if (Cools.isEmpty(item)) {
            return R.error("参数为空,请联系管理员");
        }
@@ -128,27 +130,32 @@
        if (!Cools.isEmpty(name)) {
            throw new CoolException("不可有重复项目名");
        }
        if (item.getRealMonth() < 0){
            throw new CoolException("实施周期不可为负数");
        }
//        if (item.getRealMonth() < 0){
//            throw new CoolException("实施周期不可为负数");
//        }
        if (Cools.isEmpty(item.getCstmrUuid())) {
            throw new CoolException("请选择客户");
        }
        Cstmr cstmr = cstmrService.selectOne(new EntityWrapper<Cstmr>()
                .eq("id",Long.parseLong(item.getUuid())));
                .eq("id",Long.parseLong(item.getCstmrUuid())));
        if (Cools.isEmpty(cstmr)) {
            throw new CoolException("找不到该客户,请检查");
        }
        item.setCustMan(cstmr.getName());
        item.setCustMobile(cstmr.getTel());
        item.setCustAdress(cstmr.getAddr());
        item.setHostId(getHostId());
        if (Cools.isEmpty(item.getHostId()) || item.getHostId() == 0){
            item.setHostId(1L);
        }else {
            item.setHostId(getHostId());
        }
        item.setCreateBy(getUserId());
        item.setCreateTime(new Date());
        item.setStatus(1);
        item.setUpdateBy(getUserId());
        item.setUpdateTime(new Date());
        Long span = (item.getEndTime().getTime() - item.getStartTime().getTime()) / 1000 / 60 / 60 / 24;
        item.setRealMonth(Math.toIntExact(span));
        itemService.insertAll(item);
        return R.ok();
    }
@@ -161,6 +168,7 @@
        if (Cools.isEmpty(item)) {
            return R.error("参数为空,请联系管理员");
        }
//        item.setType("1");
//        if (!item.getType().equals("1")) {
//            throw new CoolException("目前仅支持集成项目");
@@ -169,12 +177,17 @@
//        if (item.getRealMonth() < 0){
//            throw new CoolException("实施周期不可为负数");
//        }
        if(!(newitem.getStartTime()==null || newitem.getEndTime()==null || newitem.getRealStartTime()==null || newitem.getRealEndTime()==null)){
            item.setStartTime(newitem.getStartTime());
            item.setEndTime(newitem.getEndTime());
            item.setRealEndTime(newitem.getRealEndTime());
            item.setRealStartTime(newitem.getRealStartTime());
        }
        //↓↓↓写这段代码的真该抽大嘴巴子
//        if(!(newitem.getStartTime()==null || newitem.getEndTime()==null || newitem.getRealStartTime()==null || newitem.getRealEndTime()==null)){
//            item.setStartTime(newitem.getStartTime());
//            item.setEndTime(newitem.getEndTime());
//            item.setRealEndTime(newitem.getRealEndTime());
//            item.setRealStartTime(newitem.getRealStartTime());
//        }
        //超出运费
        if(item.getPlandeAmt()!=null && item.getRealdeAmt()!=null){
            item.setExcessAmount(item.getRealdeAmt()-item.getPlandeAmt());