| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.constant.RoleEnum; |
| | | import com.whyc.constant.WorkflowEnum; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.Fbs9100SetParamTempMapper; |
| | |
| | | private WorkflowLinkService linkService; |
| | | |
| | | //该设备放电申请 |
| | | public Response searchTemp(int devId) { |
| | | Fbs9100SetParamTemp temp = mapper.searchTemp(devId); |
| | | public Response searchTemp(int battGroupId) { |
| | | Fbs9100SetParamTemp temp = mapper.searchTemp(battGroupId); |
| | | return new Response().setII(1, temp == null ? false : true, temp, "设备放电申请"); |
| | | } |
| | | |
| | |
| | | main.setStatus(mainStatus); |
| | | main.setType(mainType); |
| | | main.setId(id); |
| | | mainService.add(main); |
| | | mainService.addWorkMain(main); |
| | | //link添加 |
| | | WorkflowLink link = new WorkflowLink(); |
| | | link.setMainId(id); |
| | | link.setParentId(0); |
| | | link.setDealDesc("管理员处理中"); |
| | | link.setCreateTime(new Date()); |
| | | link.setDealRoleId(0);//默认申请给管理层 |
| | | link.setDealUserId(null); |
| | | link.setDealRoleId(RoleEnum.ADMIN.getId());//默认申请给管理层 |
| | | link.setDealType(WorkflowEnum.TYPE_DELIVER.getValue()); |
| | | link.setStatus(WorkflowEnum.STATUS_PENDING.getValue());//默认待处理 |
| | | linkService.add(link); |
| | |
| | | //判断是否存在该设备id的记录 |
| | | QueryWrapper wrapper = Wrappers.query(); |
| | | wrapper.eq("dev_id", tmp.getDevId()); |
| | | wrapper.eq("battGroupId", tmp.getBattGroupId()); |
| | | wrapper.last("limit 1"); |
| | | Fbs9100SetParamTemp paramTemp = mapper.selectOne(wrapper); |
| | | if (paramTemp != null) { |
| | | UpdateWrapper uWrapper = Wrappers.update(); |
| | | uWrapper.eq("dev_id", tmp.getDevId()); |
| | | uWrapper.eq("battGroupId", tmp.getBattGroupId()); |
| | | mapper.delete(uWrapper); |
| | | } |
| | | mapper.insert(tmp); |