#
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
@@ -129,9 +130,9 @@
        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("请选择客户");
        }
@@ -153,6 +154,8 @@
        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();
    }