package com.hssx.cloudmodel.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.hssx.cloudmodel.entity.Mould; import com.hssx.cloudmodel.entity.User; import com.hssx.cloudmodel.entity.vo.MouldVO; import com.hssx.cloudmodel.entity.vo.UserVO; import com.hssx.cloudmodel.service.*; import com.hssx.cloudmodel.util.HttpRespMsg; import com.hssx.cloudmodel.util.PageUtil; import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.List; /** * @author 吴涛涛 * @since 2019-07-30 */ @Controller @RequestMapping("/mould") public class MouldController { @Autowired private MouldService mouldService; @Autowired private UserService userService; @Autowired private ProjectService projectService; /** * 添加/修改模具设备 * 添加参数:equipmentId 设备id, modelNo 模具编号 ,modelName 模具名称 * 修改参数:id 模具id, settingLife 使用年限, initialModulus 初始模次 equipmentId 设备id, * produceCompanyId 生产方公司id,ocCycle 每模平均周期,rfid rfid码,area 工厂地址,factoryId 工厂id,factoryName 工厂名称 * equipmentName 设备名称 * @return */ @ApiOperation("添加/修改模具") @RequestMapping("/addOrUpdate") @ResponseBody public HttpRespMsg addOrUpdate(Mould mould, String token) { HttpRespMsg msg = new HttpRespMsg(); QueryWrapper qw = new QueryWrapper<>(); qw.eq("head_imgurl",token); User user = userService.getOne(qw); msg = mouldService.addAndUpdateMould(mould,user); return msg; } /** * 给项目分配模具获取该公司下的模具列表 * parentId 当前人parentId ,id当前人id * @return */ @ApiOperation("获取该公司下的模具列表") @RequestMapping("/modelList") @ResponseBody public HttpRespMsg addAndUpdateProject(User user) { HttpRespMsg msg = new HttpRespMsg(); msg = projectService.getModelListByCompanyId(user); return msg; } /** * 给项目分配模具获取该公司下的模具列表 * token 当前人唯一权限 pageNum 当前页码,pageSize 每页条数 projectId 项目id筛选(默认传-1) * serchType 搜索类型0-模具编号,1-模具名称(默认传0) keyName 关键字查询 * @return */ @ApiOperation("模具列表") @RequestMapping("/list") @ResponseBody public HttpRespMsg list(UserVO userVO, PageUtil page,String token) { System.out.println("keyName"+userVO.getKeyName()); HttpRespMsg msg = new HttpRespMsg(); User user = userService.getOne(new QueryWrapper().eq("head_imgurl", token)); BeanUtils.copyProperties(user,userVO); msg = projectService.getModelListByUser(userVO,page); return msg; } /** * 模具详情 * 参数 id 模具id * @return */ @ApiOperation("模具详情") @RequestMapping("/detail") @ResponseBody public HttpRespMsg detail(MouldVO mouldVO){ HttpRespMsg msg = mouldService.getMoildDetail(mouldVO); return msg; } }