whycq0520
2022-03-24 03b41fa7164bb7dc5a8bd17a06cfceed43e65617
src/main/java/zy/cloud/wms/manager/controller/ItemController.java
@@ -11,6 +11,7 @@
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.exception.CoolException;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import zy.cloud.wms.common.web.BaseController;
@@ -47,10 +48,14 @@
                  @RequestParam(required = false)String orderByType,
                  @RequestParam Map<String, Object> param){
        EntityWrapper<Item> wrapper = new EntityWrapper<>();
        HashSet<String> excludeField = new HashSet<>();
        allLike(Item.class,excludeField,wrapper, (String) param.get("id"));
        excludeTrash(param);
        convert(param, wrapper);
        hostEq(wrapper);
        wrapper.orderBy("status",true);
//        wrapper.orderBy("status",true);
        wrapper.orderBy("id",false);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        return R.ok(itemService.selectPage(new Page<>(curr, limit), wrapper));
    }
@@ -68,6 +73,39 @@
        }
    }
    @RequestMapping(value = "/item/list/chaoPirce")
    @ManagerAuth
    public R list1(@RequestParam(defaultValue = "1")Integer curr,
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
                  @RequestParam Map<String, Object> param){
        val id = param.get("id");
        String uuid=null;
        if(id!=null){
            uuid = id.toString();
        }
        Page<Item> projectPlanPage = itemService.chaoPirce(toPage(curr,limit,param,Item.class),uuid);
        return R.ok(projectPlanPage);
    }
    @RequestMapping(value = "/item/list/chaoTime")
    @ManagerAuth
    public R list2(@RequestParam(defaultValue = "1")Integer curr,
                   @RequestParam(defaultValue = "10")Integer limit,
                   @RequestParam(required = false)String orderByField,
                   @RequestParam(required = false)String orderByType,
                   @RequestParam Map<String, Object> param){
        val id = param.get("id");
        String uuid=null;
        if(id!=null){
            uuid = id.toString();
        }
        Page<Item> projectPlanPage = itemService.chaoTime(toPage(curr,limit,param,Item.class),uuid);
        return R.ok(projectPlanPage);
    }
    @RequestMapping(value = "/item/add/auth")
    @ManagerAuth
    public R add(Item item) {
@@ -75,7 +113,7 @@
        if (Cools.isEmpty(item)) {
            return R.error("参数为空,请联系管理员");
        }
        item.setType("1");
        if (!item.getType().equals("1")) {
            throw new CoolException("目前仅支持集成项目");
        }
@@ -83,6 +121,9 @@
                .eq("name", item.getName()));
        if (!Cools.isEmpty(name)) {
            throw new CoolException("不可有重复项目名");
        }
        if (item.getRealMonth() < 0){
            throw new CoolException("实施周期不可为负数");
        }
        item.setHostId(getHostId());
@@ -101,10 +142,14 @@
        if (Cools.isEmpty(item)) {
            return R.error("参数为空,请联系管理员");
        }
        item.setType("1");
        if (!item.getType().equals("1")) {
            throw new CoolException("目前仅支持集成项目");
        }
//        item.setRealMonth(1);
//        if (item.getRealMonth() < 0){
//            throw new CoolException("实施周期不可为负数");
//        }
        item.setUpdateBy(getUserId());
        item.setUpdateTime(new Date());
        itemService.update(item,new EntityWrapper<Item>()