| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import zy.cloud.wms.common.web.BaseController; |
| | | import zy.cloud.wms.manager.entity.Cstmr; |
| | | import zy.cloud.wms.manager.entity.Item; |
| | | import zy.cloud.wms.manager.entity.ProjectPlan; |
| | | import zy.cloud.wms.manager.entity.ProjectType; |
| | | import zy.cloud.wms.manager.service.CstmrService; |
| | | import zy.cloud.wms.manager.service.ItemService; |
| | | import zy.cloud.wms.manager.service.ProjectPlanService; |
| | | import zy.cloud.wms.manager.service.ProjectTypeService; |
| | | |
| | | import java.util.*; |
| | |
| | | @Autowired |
| | | private ItemService itemService; |
| | | @Autowired |
| | | private CstmrService cstmrService; |
| | | @Autowired |
| | | private ProjectTypeService projectTypeService; |
| | | private ProjectPlanService planService; |
| | | |
| | | @RequestMapping(value = "/item/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | hostEq(wrapper); |
| | | wrapper.orderBy("status",false); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(itemService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | |
| | | if (Cools.isEmpty(item)) { |
| | | return R.error("参数为空,请联系管理员"); |
| | | } |
| | | Cstmr user_code = cstmrService.selectOne(new EntityWrapper<Cstmr>() |
| | | .eq("user_code", item.getCstmrUuid())); |
| | | if (!Cools.isEmpty(user_code)) { |
| | | item.setCstmr(user_code.getName()); |
| | | }else { |
| | | return R.error("参数错误,请输入正确的客户编号"); |
| | | |
| | | if (!item.getType().equals("1")) { |
| | | throw new CoolException("目前仅支持集成项目"); |
| | | } |
| | | ProjectType id = projectTypeService.selectOne(new EntityWrapper<ProjectType>() |
| | | .eq("id", item.getType())); |
| | | if (!Cools.isEmpty(id)) { |
| | | item.setType(id.getTypeName()); |
| | | }else { |
| | | return R.error("参数错误,找不到该项目类型"); |
| | | Item name = itemService.selectOne(new EntityWrapper<Item>() |
| | | .eq("name", item.getName())); |
| | | if (!Cools.isEmpty(name)) { |
| | | throw new CoolException("不可有重复项目名"); |
| | | } |
| | | |
| | | item.setHostId(getHostId()); |
| | |
| | | item.setStatus(1); |
| | | item.setUpdateBy(getUserId()); |
| | | item.setUpdateTime(new Date()); |
| | | itemService.insert(item); |
| | | itemService.insertAll(item); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | if (Cools.isEmpty(item)) { |
| | | return R.error("参数为空,请联系管理员"); |
| | | } |
| | | Cstmr user_code = cstmrService.selectOne(new EntityWrapper<Cstmr>() |
| | | .eq("user_code", item.getCstmrUuid())); |
| | | if (!Cools.isEmpty(user_code)) { |
| | | item.setCstmr(user_code.getName()); |
| | | }else { |
| | | return R.error("参数错误,请输入正确的客户编号"); |
| | | |
| | | if (!item.getType().equals("1")) { |
| | | throw new CoolException("目前仅支持集成项目"); |
| | | } |
| | | ProjectType id = projectTypeService.selectOne(new EntityWrapper<ProjectType>() |
| | | .eq("id", item.getType())); |
| | | if (!Cools.isEmpty(id)) { |
| | | item.setType(id.getTypeName()); |
| | | }else { |
| | | return R.error("参数错误,找不到该项目类型"); |
| | | } |
| | | // if (Cools.isEmpty(item) || null==item.getUuid()){ |
| | | // return R.error(); |
| | | // } |
| | | item.setUpdateBy(getUserId()); |
| | | item.setUpdateTime(new Date()); |
| | | itemService.updateById(item); |
| | |
| | | @RequestMapping(value = "/item/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam("ids[]") String param){ |
| | | |
| | | if (param != null){ |
| | | itemService.delete(new EntityWrapper<Item>() |
| | | .eq("id",param)); |
| | | planService.delete(new EntityWrapper<ProjectPlan>() |
| | | .eq("item_id",param)); |
| | | } |
| | | |
| | | // List<Item> list = JSONArray.parseArray(param, Item.class); |
| | | // if (Cools.isEmpty(list)){ |
| | | // return R.error(); |