| | |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.iot.domain.Device; |
| | | import com.ruoyi.iot.domain.DeviceOrder; |
| | | import com.ruoyi.iot.domain.DeviceOrderTime; |
| | | import com.ruoyi.iot.service.IDeviceOrderService; |
| | | import com.ruoyi.iot.service.IDeviceOrderTimeService; |
| | | import com.ruoyi.iot.service.IDeviceService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Autowired |
| | | private IDeviceService deviceService; |
| | | |
| | | @Autowired |
| | | private IDeviceOrderTimeService deviceOrderTimeService; |
| | | |
| | | /** |
| | | * 查询全部设备安装单订单信息 |
| | | * |
| | | * @param deviceOrder |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 根据登录的联营商查询设备订单超时的时间间隔 |
| | | * |
| | | * @param deviceOrderTime |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @PreAuthorize("@ss.hasAnyPermi('iot:deviceOrder:list')") |
| | | @GetMapping("/selecttimeout") |
| | | @ApiOperation(value = "根据登录的联营商查询设备订单超时的时间间隔") |
| | | public AjaxResult selectTimeout(DeviceOrderTime deviceOrderTime) throws Exception { |
| | | DeviceOrderTime userDeviceOrder = deviceOrderTimeService.selectDeviceOrderTimeByUserId(deviceOrderTime.getUserId(), deviceOrderTime.getOrderType()); |
| | | if (userDeviceOrder != null) { |
| | | List<DeviceOrderTime> rowsA = deviceOrderTimeService.selectReceiveTimeoutById(deviceOrderTime); |
| | | List<DeviceOrderTime> rowsB = deviceOrderTimeService.selectFinishTimeoutById(deviceOrderTime); |
| | | AjaxResult ajax = new AjaxResult(); |
| | | ajax.put("receiveTimeout", rowsA); |
| | | ajax.put("finishTimeout", rowsB); |
| | | return AjaxResult.success("查询成功", ajax); |
| | | } else { |
| | | deviceOrderTime.setReceiveTimeout(0); |
| | | deviceOrderTime.setFinishTimeout(0); |
| | | int row = deviceOrderTimeService.insertDeviceOrderTimeout(deviceOrderTime); |
| | | if (row > 0) { |
| | | List<DeviceOrderTime> rowsA = deviceOrderTimeService.selectReceiveTimeoutById(deviceOrderTime); |
| | | List<DeviceOrderTime> rowsB = deviceOrderTimeService.selectFinishTimeoutById(deviceOrderTime); |
| | | AjaxResult ajax = new AjaxResult(); |
| | | ajax.put("receiveTimeout", rowsA); |
| | | ajax.put("finishTimeout", rowsB); |
| | | return AjaxResult.success("查询成功", ajax); |
| | | } else { |
| | | return AjaxResult.error("添加数据失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据登录的联营商修改设备订单超时的时间间隔 |
| | | * |
| | | * @param deviceOrderTime |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @PreAuthorize("@ss.hasAnyPermi('iot:deviceOrder:list')") |
| | | @Log(title = "修改设备订单信息", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/updatetimeout") |
| | | @ApiOperation(value = "根据登录的联营商修改设备订单超时的时间间隔") |
| | | public AjaxResult assignDeviceOrderTimeout(DeviceOrderTime deviceOrderTime) throws Exception { |
| | | DeviceOrderTime userDeviceOrder = deviceOrderTimeService.selectDeviceOrderTimeByUserId(deviceOrderTime.getUserId(), deviceOrderTime.getOrderType()); |
| | | if (userDeviceOrder != null) { |
| | | return toAjax(deviceOrderTimeService.updateDeviceOrderTimeoutById(deviceOrderTime)); |
| | | } else { |
| | | int rowsB = deviceOrderTimeService.insertDeviceOrderTimeout(deviceOrderTime); |
| | | if (rowsB > 0) { |
| | | return toAjax(deviceOrderTimeService.updateDeviceOrderTimeoutById(deviceOrderTime)); |
| | | } else { |
| | | return AjaxResult.error("添加数据失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询未派单/已派单/已接单/已完成的安装单/维修单数维修单数量 |
| | | * |
| | | * @param deviceOrder |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @PreAuthorize("@ss.hasAnyPermi('iot:deviceOrder:list')") |
| | | @GetMapping("/get") |
| | | @ApiOperation(value = "获取未派单/已派单/已接单/已完成的安装单/维修单数量") |
| | | public AjaxResult selectDeviceOrderCount(DeviceOrder deviceOrder) throws Exception { |
| | | if (deviceOrder != null) { |
| | | //根据登录的用户来查询自己未派单的安装单/维修单数量 |
| | | int count = iDeviceOrderService.selectDeviceOrderCountByUndeliveredorders(deviceOrder); |
| | | //根据登录的用户来查询自己已派单的安装单/维修单数量 |
| | | int total = iDeviceOrderService.selectDeviceOrderCountByDispatchedorders(deviceOrder); |
| | | //根据登录的用户来查询自己已接单的安装单/维修单数量 |
| | | int number = iDeviceOrderService.selectDeviceOrderCountByReceivedorders(deviceOrder); |
| | | //根据登录的用户来查询自己已完成的安装单/维修单数量 |
| | | int amount = iDeviceOrderService.selectDeviceOrderCountByCompleted(deviceOrder); |
| | | AjaxResult ajax = new AjaxResult(); |
| | | //未派单的安装单/维修单的数量 |
| | | ajax.put("deviceOrderUndeliveredorders", count); |
| | | //已派单的安装单/维修单的数量 |
| | | ajax.put("deviceOrderDispatchedorders", total); |
| | | //已接单的安装单/维修单的数量 |
| | | ajax.put("deviceOrderReceivedorders", number); |
| | | //已完成的安装单/维修单的数量 |
| | | ajax.put("deviceOrderCompleted", amount); |
| | | return AjaxResult.success("查询成功", ajax); |
| | | } else { |
| | | return AjaxResult.error("未查询到有关信息"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 添加安装设备订单信息 |
| | |
| | | SysUser sysUser = getLoginUser().getUser(); |
| | | //拿到修改安装单的用户id |
| | | deviceOrder.setUpdateUserId(sysUser.getUserId()); |
| | | deviceOrder.setFinshTime(new Date()); |
| | | deviceOrder.setFinishTime(new Date()); |
| | | int rows = iDeviceOrderService.updateDeviceOrder(deviceOrder); |
| | | if (rows > 0) { |
| | | Device device = new Device(); |
| | |
| | | SysUser sysUser = getLoginUser().getUser(); |
| | | //拿到修维修单的用户id |
| | | deviceOrder.setUpdateUserId(sysUser.getUserId()); |
| | | deviceOrder.setFinshTime(new Date()); |
| | | deviceOrder.setFinishTime(new Date()); |
| | | int rows = iDeviceOrderService.updateDeviceOrder(deviceOrder); |
| | | if (rows > 0) { |
| | | Device device1 = deviceService.selectDeviceByDeviceId(deviceOrder.getDeviceId()); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 安装单维修单图片上传 |
| | | * 安装单/维修单图片上传 |
| | | * |
| | | * @param file |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | |
| | | @Log(title = "安装单图片上传", businessType = BusinessType.INSERT) |
| | | @Log(title = "安装单/维修单图片上传", businessType = BusinessType.INSERT) |
| | | @PostMapping("/profile/avatar") |
| | | @ApiOperation("安装单图片上传") |
| | | @ApiOperation("安装单/维修单图片上传") |
| | | public AjaxResult imgurl(@RequestParam("avatarfile") MultipartFile file) throws Exception { |
| | | // 判断头像文件不为空 |
| | | if (!file.isEmpty()) { |