123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- package com.hssx.cloudmodel.controller;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.hssx.cloudmodel.entity.InjectionMolding;
- 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.MouldService;
- import com.hssx.cloudmodel.service.ProjectService;
- import com.hssx.cloudmodel.service.UserService;
- 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.scheduling.annotation.EnableScheduling;
- import org.springframework.scheduling.annotation.Scheduled;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.ResponseBody;
- /**
- * @author 吴涛涛
- * @since 2019-07-30
- */
- @Controller
- @RequestMapping("/mould")
- @EnableScheduling
- public class MouldController {
- @Autowired
- private MouldService mouldService;
- @Autowired
- private UserService userService;
- @Autowired
- private ProjectService projectService;
- /**
- * 添加/修改模具设备
- * 添加参数:equipmentId 设备id, modelNo 模具编号 ,modelName 模具名称 ,maintainCount 保养设定次数:"1,2,3"
- * 修改参数:id 模具id, settingLife 使用年限, initialModulus 初始模次 equipmentId 设备id,
- * produceCompanyId 生产方公司id,ocCycle 每模平均周期,rfid rfid码,maintainCount 保养设定次数:"1,2,3"
- *
- * materialType 材料牌号,color 颜色,size 模具尺寸,machineTonnage 吨位,mallWeight 成品重量(单位:G),headWeight 料头重量(单位:G)
- * maxShotWeight 最大射胶量(单位:G),minShotWeight 最小射胶量(单位:G),cycle 成型周期,commonModelTemperature 公模(动模)模温
- * motherModelTemperature 母模(定模)模温
- * 模具更新时多传的参数 preUpdateId 要被更新的模具的id dynamicId
- * @return
- */
- @ApiOperation("添加/修改模具")
- @RequestMapping("/addOrUpdate")
- @ResponseBody
- public HttpRespMsg addOrUpdate(Mould mould, InjectionMolding injectionMolding, String token, @RequestParam(required = false) Integer dynamicId) {
- HttpRespMsg msg = new HttpRespMsg();
- QueryWrapper<User> qw = new QueryWrapper<>();
- qw.eq("head_imgurl",token);
- User user = userService.getOne(qw);
- msg = mouldService.addAndUpdateMould(mould,user,dynamicId,injectionMolding);
- return msg;
- }
- /**
- * 更换模具云模盒
- * mouldId 模具id equipmentId 云模盒设备id token 用户身份凭证
- * @return
- */
- @ApiOperation("更换模具云模盒")
- @RequestMapping("/changeMouldEquipment")
- @ResponseBody
- public HttpRespMsg changeMouldEquipment(Mould mould,Integer mouldId, String token) {
- HttpRespMsg msg = new HttpRespMsg();
- msg = mouldService.changeMouldEquipment(mould,mouldId,token);
- 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;
- }
- /**
- * 给编辑项目时返回的项目里的模具和可供选择的模具
- * projectId 项目id ,token 人员身份凭证
- * @return
- */
- @ApiOperation("给编辑项目时返回的项目里的模具和可供选择的模具")
- @RequestMapping("/chooseModelList")
- @ResponseBody
- public HttpRespMsg chooseModelList(UserVO userVO) {
- HttpRespMsg msg = new HttpRespMsg();
- msg = projectService.getModelListByCompanyIdAndProjectId(userVO);
- return msg;
- }
- /**
- * 给项目分配模具获取该公司下的模具列表
- * token 当前人唯一权限 pageNum 当前页码,pageSize 每页条数 projectId 项目id筛选(默认传-1)
- * searchType 搜索类型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<User>().eq("head_imgurl", token));
- BeanUtils.copyProperties(user,userVO);
- msg = projectService.getModelListByUser(userVO,page);
- return msg;
- }
- /**
- * 模具详情
- * 参数 id 模具id,token 当前用户凭证
- * @return
- */
- @ApiOperation("模具详情")
- @RequestMapping("/detail")
- @ResponseBody
- public HttpRespMsg detail(MouldVO mouldVO){
- HttpRespMsg msg = mouldService.getMoildDetail(mouldVO);
- return msg;
- }
- /**
- * 模具详情
- * 参数 id 模具id
- * @return
- */
- @ApiOperation("删除模具")
- @RequestMapping("/delMould")
- @ResponseBody
- public HttpRespMsg delMould(Mould mould){
- HttpRespMsg msg = new HttpRespMsg();
- msg = mouldService.delMoule(mould);
- return msg;
- }
- /**
- * 模具保养提醒
- */
- @ApiOperation("模具保养提醒")
- @RequestMapping("/maintenanceReminder")
- @ResponseBody
- @Scheduled(cron = "0 0 12 * * ?")//配置时间点触发(每日中午12点)
- public HttpRespMsg maintenanceReminder() throws Exception {
- HttpRespMsg msg = mouldService.maintenanceReminder();
- return msg;
- }
- /**
- * 丢包数据检测
- */
- @ApiOperation("丢包数据检测")
- @RequestMapping("/packageLoss")
- @ResponseBody
- @Scheduled(cron = "0 0 23 * * ?")//配置时间点触发(每日中午23点)
- public HttpRespMsg packageLoss() throws Exception {
- HttpRespMsg msg = mouldService.packageLoss();
- return msg;
- }
- /**
- * 是否开启模具保养提醒
- * 参数 isMaintain 是否开启保养 0-是 1-否
- */
- @ApiOperation("模具保养提醒")
- @RequestMapping("/isMaintain")
- @ResponseBody
- public HttpRespMsg isMaintain(Mould mould) throws Exception {
- HttpRespMsg msg = mouldService.isMaintain(mould);
- return msg;
- }
- /**
- * 需要保养的模具列表
- * 参数 token 用户凭证
- */
- @ApiOperation("需要保养的模具列表")
- @RequestMapping("/maintainMouldList")
- @ResponseBody
- public HttpRespMsg maintainMouldList(UserVO userVO) throws Exception {
- HttpRespMsg msg = mouldService.maintainMouldList(userVO);
- return msg;
- }
- /**
- * 报废提醒的模具列表
- * 参数 token 用户凭证
- */
- @ApiOperation("报废提醒的模具列表")
- @RequestMapping("/scrapMouldList")
- @ResponseBody
- public HttpRespMsg scrapMouldList(UserVO userVO) throws Exception {
- HttpRespMsg msg = mouldService.scrapMouldList(userVO);
- return msg;
- }
- /**
- * 模具地图概览
- * token 当前人唯一权限
- * @return
- */
- @ApiOperation("模具地图概览")
- @RequestMapping("/listMap")
- @ResponseBody
- public HttpRespMsg listMap(UserVO userVO, String token) {
- HttpRespMsg msg = new HttpRespMsg();
- User user = userService.getOne(new QueryWrapper<User>().eq("head_imgurl", token));
- BeanUtils.copyProperties(user,userVO);
- msg = projectService.getModelListMapByUser(userVO);
- return msg;
- }
- // /**
- // * 本地E盘文件上传到腾讯云
- // * @return
- // */
- // @ApiOperation("本地E盘文件上传到腾讯云")
- // @RequestMapping("/listMap")
- // @ResponseBody
- // public HttpRespMsg uploadQcloud(UserVO userVO, String token) {
- // HttpRespMsg msg = new HttpRespMsg();
- // }
- /**
- * 运行次数更新
- */
- @ApiOperation("运行次数更新")
- @RequestMapping("/updateRuntimesTask")
- @ResponseBody
- @Scheduled(cron = "0 */5 * * * ?")//定时任务,每5分钟检测一次
- public HttpRespMsg updateRuntimesTask() throws Exception {
- HttpRespMsg msg = mouldService.updateRuntimesTask();
- return msg;
- }
- /**
- * 运行次数更新(23:00-24:00)
- */
- @ApiOperation("运行次数更新(23:00-24:00)")
- @RequestMapping("/updateLastTimeRuntimesTask")
- @ResponseBody
- @Scheduled(cron = "0 0 1 * * ?")//定时任务,每天1点触发
- public HttpRespMsg updateLastTimeRuntimesTask() throws Exception {
- HttpRespMsg msg = mouldService.updateLastTimeRuntimesTask();
- return msg;
- }
- }
|