diff --git a/shoot-hand/ics-admin/src/main/java/com/ics/admin/controller/RepairDeviceTypeController.java b/shoot-hand/ics-admin/src/main/java/com/ics/admin/controller/RepairDeviceTypeController.java index 5e577a2..4a4f168 100644 --- a/shoot-hand/ics-admin/src/main/java/com/ics/admin/controller/RepairDeviceTypeController.java +++ b/shoot-hand/ics-admin/src/main/java/com/ics/admin/controller/RepairDeviceTypeController.java @@ -130,12 +130,29 @@ public class RepairDeviceTypeController extends BaseController { @RequiresPermissions("RepairDeviceType:type:edit") @PostMapping("update") public R editSave(@RequestBody RepairDeviceType repairDeviceType) { - int i = repairDeviceTypeService.updateRepairDeviceType(repairDeviceType); - if (i<=0){ - return R.error("修改失败"); + + List repairRelationals = repairRelationalService.selectByTypeId(repairDeviceType.getId()); + for (RepairRelational repairRelational : repairRelationals) { + if (repairRelational.getKind()==1){ + IcsCustomerStaff staff = new IcsCustomerStaff(); + staff.setId(repairRelational.getUserId()); + staff.setDataType("1"); + customerStaffService.updateIcsCustomerStaff(staff); + }else if (repairRelational.getKind()==3){ + IcsCustomerStaff staff1 = new IcsCustomerStaff(); + staff1.setId(repairRelational.getUserId()); + staff1.setDataType("1"); + customerStaffService.updateIcsCustomerStaff(staff1); + } } + + int i1 = repairRelationalService.deleteByTypeId(repairDeviceType.getId()); if (i1>=0){ + + + + //保存成功后,添加设备与派单员关联关系 RepairRelational repairRelational = new RepairRelational(); repairRelational.setTypeId(repairDeviceType.getId()); @@ -162,8 +179,12 @@ public class RepairDeviceTypeController extends BaseController { } //修改用户信息 - } + } + int i = repairDeviceTypeService.updateRepairDeviceType(repairDeviceType); + if (i<=0){ + return R.error("修改失败"); + } return toAjax(i); } diff --git a/shoot-hand/ics-web/src/main/java/com/ics/controller/mobile/WxLoginAPIController.java b/shoot-hand/ics-web/src/main/java/com/ics/controller/mobile/WxLoginAPIController.java index 7fc8c6e..9fe10c1 100644 --- a/shoot-hand/ics-web/src/main/java/com/ics/controller/mobile/WxLoginAPIController.java +++ b/shoot-hand/ics-web/src/main/java/com/ics/controller/mobile/WxLoginAPIController.java @@ -256,45 +256,12 @@ public class WxLoginAPIController extends BaseController { StaffOpen staffOpen = staffOpenService.selectStaffOpenByStaffIdAndOpenId(customerStaff.getId(),openid); if (staffOpen != null) { - // 根据 用户绑定的企业 绑定对应的设备 - ArrayList ids = new ArrayList<>(); - Customer customer = customerService.selectCustomerById(customerStaff.getIcsCustomerId()); - if (null != customer) { - String roomId = customer.getRoomId(); - List roomIds = StrUtil.split(roomId, ','); - List collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList()); - //获取了房间集合,循环对应集合, - for (Long id : collect) { - List roomEquipment = roomEquipmentService.selectByRoomId(id); - if (CollUtil.isNotEmpty(roomEquipment)) { - for (RoomEquipment equipment : roomEquipment) { - ids.add(equipment.getEquipmentId()); - } - } - List detailEquipments = detailEquipmentService.selectByRoomId(id); - if (CollUtil.isNotEmpty(detailEquipments)) { - for (DetailEquipment detailEquipment : detailEquipments) { - ids.add(detailEquipment.getEquipmentId()); - } - } - } - } - if (CollUtil.isNotEmpty(ids)) { - for (Long id : ids) { - UserEquipment userEquipment = new UserEquipment(); - userEquipment.setEquipmentId(id); - userEquipment.setUserId(customerStaff.getId()); - userEquipment.setStartTime(customer.getStartDate()); - userEquipment.setEndDate(customer.getEndDate()); - userEquipmentService.insertUserEquipment(userEquipment); - } - } + }else { StaffOpen staffOpen1 = new StaffOpen(); staffOpen1.setOpenid(openid); staffOpen1.setStaffId(customerStaff.getId()); -// staffOpen1.setParkId(Long.valueOf(parkId)); -// staffOpen1.setTenantId(Long.valueOf(tenantId)); + staffOpenService.insertStaffOpen(staffOpen1); } if (parkId != null) { @@ -318,14 +285,14 @@ public class WxLoginAPIController extends BaseController { icsCustomerStaff.setUsername(phoneNumber); icsCustomerStaff.setGender("0"); icsCustomerStaff.setStatus("0"); + icsCustomerStaff.setDataType("1"); icsCustomerStaff.setOpenid(openid); int i = icsCustomerStaffService.insertIcsCustomerStaff(icsCustomerStaff); StaffOpen staffOpen1 = new StaffOpen(); staffOpen1.setOpenid(openid); staffOpen1.setStaffId(icsCustomerStaff.getId()); -// staffOpen1.setParkId(Long.valueOf(parkId)); -// staffOpen1.setTenantId(Long.valueOf(tenantId)); + staffOpenService.insertStaffOpen(staffOpen1); Map token = tokenService.createStaffToken(icsCustomerStaff); @@ -333,35 +300,6 @@ public class WxLoginAPIController extends BaseController { ajax.put(Constants.TOKEN, token); ajax.put("user", icsCustomerStaff); ajax.put("openid", openid); - - -// IcsCustomerStaff customerStaff1 = icsCustomerStaffService.selectUserByMobile(phoneNumber); -// //如果手机号等于null 就新增用户 -// if (null == customerStaff1) { -// icsCustomerStaff.setUsername(phoneNumber); -// icsCustomerStaff.setDataType(Constants.CUSTOMER_VISIT); -// icsCustomerStaff.setOpenid(openid); -// icsCustomerStaff.setGender("0"); -// icsCustomerStaff.setStatus("0"); -// int i = icsCustomerStaffService.insertIcsCustomerStaff(icsCustomerStaff); -// Map token = tokenService.createStaffToken(icsCustomerStaff); -// R ajax = R.ok(); -// ajax.put(Constants.TOKEN, token); -// ajax.put("user", icsCustomerStaff); -// ajax.put("openid", openid); -// return ajax; -// } else { -// String openid1 = customerStaff1.getOpenid(); -// customerStaff1.setOpenid(openid1 + "," + openid); -// icsCustomerStaffService.updateIcsCustomerStaff(customerStaff1); -// User user = new User(); -// PublishFactory.recordLoginInfo(customerStaff1.getUsername(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")); -// BeanUtils.copyBeanProp(user, customerStaff1); -// Map token = tokenService.createToken(user); -// R ajax = R.ok(); -// ajax.put(Constants.TOKEN, token); -// ajax.put("user", user); -// ajax.put("openid", openid); return ajax; } } catch (Exception e) {