whycq
2022-03-30 0aa1c9d1a42e2ac5639228d23dfedbc03ded6fb5
src/main/java/zy/cloud/wms/manager/controller/ItemController.java
@@ -24,6 +24,7 @@
import zy.cloud.wms.manager.service.ProjectPlanService;
import zy.cloud.wms.manager.service.ProjectTypeService;
import java.text.SimpleDateFormat;
import java.util.*;
@RestController
@@ -113,10 +114,10 @@
        if (Cools.isEmpty(item)) {
            return R.error("参数为空,请联系管理员");
        }
        item.setType("1");
        if (!item.getType().equals("1")) {
            throw new CoolException("目前仅支持集成项目");
        }
        //item.setType("1");
//        if (!item.getType().equals("1")) {
//            throw new CoolException("目前仅支持集成项目");
//        }
        Item name = itemService.selectOne(new EntityWrapper<Item>()
                .eq("name", item.getName()));
        if (!Cools.isEmpty(name)) {
@@ -139,17 +140,35 @@
   @RequestMapping(value = "/item/update/auth")
   @ManagerAuth
    public R update(Item item){
        EntityWrapper<Item> wapper = new EntityWrapper<Item>();
        Item newitem = itemService.selectOne(wapper.eq("id", item.getId()));
        if (Cools.isEmpty(item)) {
            return R.error("参数为空,请联系管理员");
        }
        item.setType("1");
        if (!item.getType().equals("1")) {
            throw new CoolException("目前仅支持集成项目");
        }
//        item.setType("1");
//        if (!item.getType().equals("1")) {
//            throw new CoolException("目前仅支持集成项目");
//        }
//        item.setRealMonth(1);
//        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(item.getPlandeAmt()!=null && item.getRealdeAmt()!=null){
            item.setExcessAmount(item.getRealdeAmt()-item.getPlandeAmt());
        }
        //超出天数
        if(item.getRealinDate()!=null && item.getPlaninDate()!=null){
            Double days = (double) ((item.getRealinDate().getTime() - item.getPlaninDate().getTime()) / (1000*3600*24));
            Integer day= (int) Math.ceil(days);
            item.setExcessTime(day);
        }
        item.setUpdateBy(getUserId());
        item.setUpdateTime(new Date());
        itemService.update(item,new EntityWrapper<Item>()