| | |
| | | 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.ProjectType; |
| | | import zy.cloud.wms.manager.service.CstmrService; |
| | | import zy.cloud.wms.manager.service.ItemService; |
| | | import zy.cloud.wms.manager.service.ProjectTypeService; |
| | | |
| | | import java.util.*; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private ItemService itemService; |
| | | @Autowired |
| | | private CstmrService cstmrService; |
| | | @Autowired |
| | | private ProjectTypeService projectTypeService; |
| | | |
| | | @RequestMapping(value = "/item/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | @ManagerAuth |
| | | public R add(Item item) { |
| | | |
| | | 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("参数错误,请输入正确的客户编号"); |
| | | } |
| | | ProjectType id = projectTypeService.selectOne(new EntityWrapper<ProjectType>() |
| | | .eq("id", item.getType())); |
| | | if (!Cools.isEmpty(id)) { |
| | | item.setType(id.getTypeName()); |
| | | }else { |
| | | return R.error("参数错误,找不到该项目类型"); |
| | | } |
| | | |
| | | item.setHostId(getHostId()); |
| | | item.setCreateBy(getUserId()); |
| | | item.setCreateTime(new Date()); |
| | |
| | | @RequestMapping(value = "/item/update/auth") |
| | | @ManagerAuth |
| | | public R update(Item item){ |
| | | if (Cools.isEmpty(item) || null==item.getUuid()){ |
| | | return R.error(); |
| | | 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("参数错误,请输入正确的客户编号"); |
| | | } |
| | | 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); |