| | |
| | | @ApiOperation("新建") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:jkcabinet:create") |
| | | public ApiResponse create(@RequestBody JkCabinet jkCabinet) { |
| | | public ApiResponse create(@RequestBody JkCabinet jkCabinet,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkCabinet.setLoginUserInfo(this.getLoginUser(token)); |
| | | return ApiResponse.success(jkCabinetService.create(jkCabinet)); |
| | | } |
| | | |
| | | @ApiOperation("根据ID删除") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:jkcabinet:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkCabinetService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("批量删除") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:jkcabinet:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | jkCabinetService.deleteByIdInBatch(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("根据ID修改") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:jkcabinet:update") |
| | | public ApiResponse updateById(@RequestBody JkCabinet jkCabinet) { |
| | | public ApiResponse updateById(@RequestBody JkCabinet jkCabinet,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkCabinet.setLoginUserInfo(this.getLoginUser(token)); |
| | | jkCabinetService.updateById(jkCabinet); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("根据ID修改状态") |
| | | @PostMapping("/updateStatusById") |
| | | @CloudRequiredPermission("business:jkcabinet:update") |
| | | public ApiResponse updateStatusById(@RequestBody JkCabinet jkCabinet,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkCabinet.setLoginUserInfo(this.getLoginUser(token)); |
| | | jkCabinetService.updateStatusById(jkCabinet); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("分页查询") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:jkcabinet:query") |
| | | public ApiResponse<PageData<JkCabinet>> findPage (@RequestBody PageWrap<JkCabinet> pageWrap) { |
| | | public ApiResponse<PageData<JkCabinet>> findPage (@RequestBody PageWrap<JkCabinet> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkCabinetService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("列表查询") |
| | | @PostMapping("/list") |
| | | @CloudRequiredPermission("business:jkcabinet:query") |
| | | public ApiResponse<List<JkCabinet>> findList (@RequestBody JkCabinet jkCabinet,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkCabinetService.findList(jkCabinet)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("导出Excel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:jkcabinet:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<JkCabinet> pageWrap, HttpServletResponse response) { |
| | | public void exportExcel (@RequestBody PageWrap<JkCabinet> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ExcelExporter.build(JkCabinet.class).export(jkCabinetService.findPage(pageWrap).getRecords(), "钥匙柜基本信息表", response); |
| | | } |
| | | |
| | | @ApiOperation("根据ID查询") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:jkcabinet:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(jkCabinetService.findById(id)); |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkCabinetService.getDetail(id)); |
| | | } |
| | | } |
| | |
| | | @ApiOperation("新建") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:jkcabinetgrid:create") |
| | | public ApiResponse create(@RequestBody JkCabinetGrid jkCabinetGrid) { |
| | | public ApiResponse create(@RequestBody JkCabinetGrid jkCabinetGrid,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkCabinetGridService.create(jkCabinetGrid)); |
| | | } |
| | | |
| | | @ApiOperation("根据ID删除") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:jkcabinetgrid:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkCabinetGridService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | |
| | | @ApiOperation("批量删除") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:jkcabinetgrid:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | |
| | | @ApiOperation("根据ID修改") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:jkcabinetgrid:update") |
| | | public ApiResponse updateById(@RequestBody JkCabinetGrid jkCabinetGrid) { |
| | | public ApiResponse updateById(@RequestBody JkCabinetGrid jkCabinetGrid,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkCabinetGridService.updateById(jkCabinetGrid); |
| | | return ApiResponse.success(null); |
| | | } |
| | |
| | | @ApiOperation("分页查询") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:jkcabinetgrid:query") |
| | | public ApiResponse<PageData<JkCabinetGrid>> findPage (@RequestBody PageWrap<JkCabinetGrid> pageWrap) { |
| | | public ApiResponse<PageData<JkCabinetGrid>> findPage (@RequestBody PageWrap<JkCabinetGrid> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkCabinetGridService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导出Excel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:jkcabinetgrid:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<JkCabinetGrid> pageWrap, HttpServletResponse response) { |
| | | public void exportExcel (@RequestBody PageWrap<JkCabinetGrid> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ExcelExporter.build(JkCabinetGrid.class).export(jkCabinetGridService.findPage(pageWrap).getRecords(), "钥匙柜柜格基本信息表", response); |
| | | } |
| | | |
| | | @ApiOperation("根据ID查询") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:jkcabinetgrid:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkCabinetGridService.findById(id)); |
| | | } |
| | | } |
| | |
| | | @ApiOperation("新建") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:jkcabinetlog:create") |
| | | public ApiResponse create(@RequestBody JkCabinetLog jkCabinetLog) { |
| | | public ApiResponse create(@RequestBody JkCabinetLog jkCabinetLog,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkCabinetLogService.create(jkCabinetLog)); |
| | | } |
| | | |
| | | @ApiOperation("根据ID删除") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:jkcabinetlog:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkCabinetLogService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | |
| | | @ApiOperation("批量删除") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:jkcabinetlog:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | |
| | | @ApiOperation("根据ID修改") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:jkcabinetlog:update") |
| | | public ApiResponse updateById(@RequestBody JkCabinetLog jkCabinetLog) { |
| | | public ApiResponse updateById(@RequestBody JkCabinetLog jkCabinetLog,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkCabinetLogService.updateById(jkCabinetLog); |
| | | return ApiResponse.success(null); |
| | | } |
| | |
| | | @ApiOperation("分页查询") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:jkcabinetlog:query") |
| | | public ApiResponse<PageData<JkCabinetLog>> findPage (@RequestBody PageWrap<JkCabinetLog> pageWrap) { |
| | | public ApiResponse<PageData<JkCabinetLog>> findPage (@RequestBody PageWrap<JkCabinetLog> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkCabinetLogService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导出Excel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:jkcabinetlog:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<JkCabinetLog> pageWrap, HttpServletResponse response) { |
| | | public void exportExcel (@RequestBody PageWrap<JkCabinetLog> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ExcelExporter.build(JkCabinetLog.class).export(jkCabinetLogService.findPage(pageWrap).getRecords(), "钥匙柜开关门记录", response); |
| | | } |
| | | |
| | | @ApiOperation("根据ID查询") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:jkcabinetlog:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkCabinetLogService.findById(id)); |
| | | } |
| | | } |
| | |
| | | @ApiOperation("新建") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:jkkeys:create") |
| | | public ApiResponse create(@RequestBody JkKeys jkKeys) { |
| | | public ApiResponse create(@RequestBody JkKeys jkKeys,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkKeys.setLoginUserInfo(this.getLoginUser(token)); |
| | | return ApiResponse.success(jkKeysService.create(jkKeys)); |
| | | } |
| | | |
| | | @ApiOperation("根据ID删除") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:jkkeys:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkKeysService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | |
| | | @ApiOperation("批量删除") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:jkkeys:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | |
| | | @ApiOperation("根据ID修改") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:jkkeys:update") |
| | | public ApiResponse updateById(@RequestBody JkKeys jkKeys) { |
| | | public ApiResponse updateById(@RequestBody JkKeys jkKeys,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkKeys.setLoginUserInfo(this.getLoginUser(token)); |
| | | jkKeysService.updateById(jkKeys); |
| | | return ApiResponse.success(null); |
| | | } |
| | |
| | | @ApiOperation("分页查询") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:jkkeys:query") |
| | | public ApiResponse<PageData<JkKeys>> findPage (@RequestBody PageWrap<JkKeys> pageWrap) { |
| | | public ApiResponse<PageData<JkKeys>> findPage (@RequestBody PageWrap<JkKeys> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkKeysService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导出Excel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:jkkeys:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<JkKeys> pageWrap, HttpServletResponse response) { |
| | | public void exportExcel (@RequestBody PageWrap<JkKeys> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ExcelExporter.build(JkKeys.class).export(jkKeysService.findPage(pageWrap).getRecords(), "钥匙基本信息表", response); |
| | | } |
| | | |
| | | @ApiOperation("根据ID查询") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:jkkeys:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkKeysService.findById(id)); |
| | | } |
| | | } |
| | |
| | | * api 地址 https://open.dingtalk.com/document/orgapp/asynchronous-sending-of-enterprise-session-messages |
| | | * @throws ApiException |
| | | */ |
| | | public void workInfoOANotice(Long agentId,String userIds,OapiMessageCorpconversationAsyncsendV2Request.Msg msg)throws ApiException { |
| | | public void workInfoOANotice(Long agentId,String userIds,OapiMessageCorpconversationAsyncsendV2Request.Msg msg){ |
| | | try{ |
| | | DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2"); |
| | | OapiMessageCorpconversationAsyncsendV2Request request = new OapiMessageCorpconversationAsyncsendV2Request(); |
| | | request.setAgentId(agentId); |
| | |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),rsp.getMessage()); |
| | | } |
| | | }catch (ApiException apiException){ |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | * unionIdList 待办通知人员集合 |
| | | * @throws Exception |
| | | */ |
| | | public String toDoNotice(String title,List<String> unionIdList,List<CreateTodoTaskRequest.CreateTodoTaskRequestContentFieldList> fieldList) throws Exception { |
| | | public String toDoNotice(String title,List<String> unionIdList,List<CreateTodoTaskRequest.CreateTodoTaskRequestContentFieldList> fieldList,String url) { |
| | | try{ |
| | | com.aliyun.dingtalktodo_1_0.Client client = DingTalk.createV1Client(); |
| | | CreateTodoTaskHeaders createTodoTaskHeaders = new CreateTodoTaskHeaders(); |
| | | createTodoTaskHeaders.xAcsDingtalkAccessToken = "43cf8213909f34ef81e7447905b822fb";//getToken(); |
| | | createTodoTaskHeaders.xAcsDingtalkAccessToken = getToken(); |
| | | //待办截止前的提醒 |
| | | CreateTodoTaskRequest.CreateTodoTaskRequestRemindNotifyConfigs remindNotifyConfigs = new CreateTodoTaskRequest.CreateTodoTaskRequestRemindNotifyConfigs() |
| | | .setDingNotify("1") |
| | |
| | | } |
| | | } |
| | | return null; |
| | | }catch (Exception e){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"钉钉待办任务通知发送失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理全部人的待办信息 |
| | | * 处理全部人的待办信息 (流程审批完成、本级审批完成 使用) |
| | | * @param unionId |
| | | * @param taskId |
| | | * api地址 https://open.dingtalk.com/document/orgapp/updates-dingtalk-to-do-tasks |
| | | * @throws Exception |
| | | */ |
| | | public void updToDoNoticeInfoStatus(String unionId,String taskId) throws Exception { |
| | | public void updToDoNoticeInfoStatus(String unionId,String taskId){ |
| | | try { |
| | | com.aliyun.dingtalktodo_1_0.Client client = DingTalk.createV1Client(); |
| | | UpdateTodoTaskHeaders updateTodoTaskHeaders = new UpdateTodoTaskHeaders(); |
| | | updateTodoTaskHeaders.xAcsDingtalkAccessToken = "43cf8213909f34ef81e7447905b822fb";//getToken(); |
| | | updateTodoTaskHeaders.xAcsDingtalkAccessToken = getToken(); |
| | | UpdateTodoTaskRequest updateTodoTaskRequest = new UpdateTodoTaskRequest() |
| | | .setOperatorId(unionId) |
| | | .setDone(true); |
| | | try { |
| | | UpdateTodoTaskResponse response = client.updateTodoTaskWithOptions(unionId, taskId, updateTodoTaskRequest, updateTodoTaskHeaders, new RuntimeOptions()); |
| | | log.error("待办通知发送成功,发送内容:{}"+JSONObject.toJSONString(response)); |
| | | } catch (TeaException err) { |
| | |
| | | // err 中含有 code 和 message 属性,可帮助开发定位问题 |
| | | log.error("待办通知发送失败,失败原因:{}"+err.message); |
| | | } |
| | | |
| | | } catch (Exception _err) { |
| | | TeaException err = new TeaException(_err.getMessage(), _err); |
| | | if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) { |
| | |
| | | * api 地址 https://open.dingtalk.com/document/orgapp/update-dingtalk-to-do-status |
| | | * @throws Exception |
| | | */ |
| | | public void updUserToDoNoticeInfoStatus(String unionId,String taskId,String dealUnionId) throws Exception { |
| | | public void updUserToDoNoticeInfoStatus(String unionId,String taskId,String dealUnionId){ |
| | | try { |
| | | com.aliyun.dingtalktodo_1_0.Client client = DingTalk.createV1Client(); |
| | | UpdateTodoTaskExecutorStatusHeaders updateTodoTaskExecutorStatusHeaders = new UpdateTodoTaskExecutorStatusHeaders(); |
| | | updateTodoTaskExecutorStatusHeaders.xAcsDingtalkAccessToken = "43cf8213909f34ef81e7447905b822fb";//getToken(); |
| | | updateTodoTaskExecutorStatusHeaders.xAcsDingtalkAccessToken = getToken(); |
| | | UpdateTodoTaskExecutorStatusRequest.UpdateTodoTaskExecutorStatusRequestExecutorStatusList executorStatusList0 = new UpdateTodoTaskExecutorStatusRequest.UpdateTodoTaskExecutorStatusRequestExecutorStatusList() |
| | | .setId(dealUnionId) |
| | | .setIsDone(true); |
| | |
| | | .setExecutorStatusList(java.util.Arrays.asList( |
| | | executorStatusList0 |
| | | )); |
| | | try { |
| | | UpdateTodoTaskExecutorStatusResponse response = client.updateTodoTaskExecutorStatusWithOptions(unionId, taskId, updateTodoTaskExecutorStatusRequest, updateTodoTaskExecutorStatusHeaders, new RuntimeOptions()); |
| | | log.error("待办通知发送成功,发送内容:{}"+JSONObject.toJSONString(response)); |
| | | } catch (TeaException err) { |
| | |
| | | carUseBook.setType(Constants.ZERO); |
| | | |
| | | |
| | | dingTalk.workInfoOANotice(4015267031L,"1568490244651036",dingTalk.getCarUseNoticeMsg(carUseBook,"用车申请")); |
| | | // dingTalk.workInfoOANotice(4015267031L,"1568490244651036",dingTalk.getCarUseNoticeMsg(carUseBook,"用车申请")); |
| | | |
| | | |
| | | // dingTalk.toDoNotice("小豆丁提交的公务车用车",java.util.Arrays.asList("iPsP86axviPHiSP4nm5YgQNCQiEiE","XiPYJKRAv9eCoO4UPM20HQQiEiE","eWbHiSp3uRtrMtiiOX5LXamgiEiE") ,dingTalk.getToDoCarUseBookFiledInfo(carUseBook)); |
| | | dingTalk.toDoNotice("小豆丁提交的公务车用车",java.util.Arrays.asList("iPsP86axviPHiSP4nm5YgQNCQiEiE","XiPYJKRAv9eCoO4UPM20HQQiEiE","eWbHiSp3uRtrMtiiOX5LXamgiEiE") ,dingTalk.getToDoCarUseBookFiledInfo(carUseBook),""); |
| | | // |
| | | |
| | | // dingTalk.updUserToDoNoticeInfoStatus("iPsP86axviPHiSP4nm5YgQNCQiEiE", |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.doumee.dao.business.model.JkCabinetGrid; |
| | | import com.github.yulichang.base.mapper.MPJJoinMapper; |
| | | import com.github.yulichang.interfaces.MPJBaseJoin; |
| | | |
| | | /** |
| | | * @author 江蹄蹄 |
| | | * @date 2025/09/28 09:01 |
| | | */ |
| | | public interface JkCabinetGridMapper extends BaseMapper<JkCabinetGrid> { |
| | | public interface JkCabinetGridMapper extends MPJJoinMapper<JkCabinetGrid> { |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.doumee.dao.business.model.JkCabinetLog; |
| | | import com.github.yulichang.base.mapper.MPJJoinMapper; |
| | | |
| | | /** |
| | | * @author 江蹄蹄 |
| | | * @date 2025/09/28 09:01 |
| | | */ |
| | | public interface JkCabinetLogMapper extends BaseMapper<JkCabinetLog> { |
| | | public interface JkCabinetLogMapper extends MPJJoinMapper<JkCabinetLog> { |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.doumee.dao.business.model.JkKeys; |
| | | import com.github.yulichang.base.mapper.MPJJoinMapper; |
| | | |
| | | /** |
| | | * @author 江蹄蹄 |
| | | * @date 2025/09/28 09:01 |
| | | */ |
| | | public interface JkKeysMapper extends BaseMapper<JkKeys> { |
| | | public interface JkKeysMapper extends MPJJoinMapper<JkKeys> { |
| | | |
| | | } |
| | |
| | | //@ExcelColumn(name="司机编码(关联memberId)") |
| | | private Integer driverId; |
| | | |
| | | @ApiModelProperty(value = "钉钉待办任务主键") |
| | | private String ddToDoId; |
| | | |
| | | @ApiModelProperty(value = "钉钉待办任务归属人主键") |
| | | private String ddBelongToUnionId; |
| | | |
| | | @ApiModelProperty(value = "司机姓名", example = "1") |
| | | @TableField(exist = false) |
| | | private String driverName; |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.service.business.third.model.LoginUserModel; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import java.util.Date; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 钥匙柜基本信息表 |
| | |
| | | @ExcelColumn(name="通讯地址") |
| | | private String linkAddr; |
| | | |
| | | @ApiModelProperty(value = "状态 0未绑定 1在位 2借出", example = "1") |
| | | @ExcelColumn(name="状态 0未绑定 1在位 2借出") |
| | | @ApiModelProperty(value = "状态 0启用 1禁用", example = "1") |
| | | @ExcelColumn(name="状态 0启用 1禁用") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "运行状态 0=在线 1=离线", example = "1") |
| | | @ExcelColumn(name="运行状态 0=在线 1=离线") |
| | | private Integer runStatus; |
| | | |
| | | |
| | | @ApiModelProperty(value = "端口", example = "1") |
| | | @ExcelColumn(name="端口") |
| | | private Integer port; |
| | | |
| | | @ApiModelProperty(value = "设备管理员编码(关联member)", example = "1") |
| | | @ApiModelProperty(value = "设备管理员编码(关联member) 多个以,分割", example = "1") |
| | | @ExcelColumn(name="设备管理员编码(关联member)") |
| | | private Integer managerId; |
| | | private String managerId; |
| | | |
| | | @ApiModelProperty(value = "验证人编码(关联member)", example = "1") |
| | | @ExcelColumn(name="验证人编码(关联member)") |
| | | private String authMemberId; |
| | | |
| | | |
| | | @ApiModelProperty(value = "使用时长(秒)", example = "1") |
| | | @ExcelColumn(name="使用时长(秒)") |
| | |
| | | @ExcelColumn(name="是否双重验证 0否 1是") |
| | | private Integer doubleAuth; |
| | | |
| | | @ApiModelProperty(value = "验证人编码(关联member)", example = "1") |
| | | @ExcelColumn(name="验证人编码(关联member)") |
| | | private Integer authMemberId; |
| | | |
| | | @ApiModelProperty(value = "排数", example = "1") |
| | | @ExcelColumn(name="排数") |
| | | private Integer rowNum; |
| | |
| | | @ApiModelProperty(value = "列数", example = "1") |
| | | @ExcelColumn(name="列数") |
| | | private Integer columnNum; |
| | | |
| | | @ApiModelProperty(value = "排序顺序:0=从左向右;1=从上向下", example = "1") |
| | | @ExcelColumn(name="排序顺序") |
| | | private Integer sortType; |
| | | |
| | | @ApiModelProperty(value = "最后通讯时间") |
| | | @ExcelColumn(name="最后通讯时间") |
| | |
| | | @ExcelColumn(name="起始编码") |
| | | private Integer noIndex; |
| | | |
| | | @ApiModelProperty(value = "经纬度信息 参数值:经度,纬度") |
| | | @TableField(exist = false) |
| | | private String jwd; |
| | | |
| | | @ApiModelProperty(value = "柜格数量", example = "1") |
| | | @TableField(exist = false) |
| | | private Integer gridNum; |
| | | |
| | | @ApiModelProperty(value = "设备管理人员数组", example = "1") |
| | | @TableField(exist = false) |
| | | private List<String> managerIdList; |
| | | |
| | | @ApiModelProperty(value = "验证人编码数组", example = "1") |
| | | @TableField(exist = false) |
| | | private List<String> authMemberIdList; |
| | | |
| | | |
| | | } |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.service.business.third.model.LoginUserModel; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | @ExcelColumn(name="序列号") |
| | | private String serialNo; |
| | | |
| | | @ApiModelProperty(value = "状态 0未绑定 1在位 2借出", example = "1") |
| | | @ExcelColumn(name="状态 0未绑定 1在位 2借出") |
| | | @ApiModelProperty(value = "状态 0启用;1禁用", example = "1") |
| | | @ExcelColumn(name="状态 0启用;1=禁用") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "运行状态", example = "1") |
| | | @ApiModelProperty(value = "运行状态 0正常 1故障 ", example = "1") |
| | | @ExcelColumn(name="运行状态") |
| | | private Integer workingStatus; |
| | | |
| | | @ApiModelProperty(value = "绑定状态 0未绑定;1已绑定", example = "1") |
| | | @TableField(exist = false) |
| | | private Integer bindStatus; |
| | | |
| | | @ApiModelProperty(value = "钥匙柜名称", example = "1") |
| | | @TableField(exist = false) |
| | | private String cabinetName; |
| | | |
| | | @ApiModelProperty(value = "钥匙编码", example = "1") |
| | | @TableField(exist = false) |
| | | private String keyCode; |
| | | } |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.service.business.third.model.LoginUserModel; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | |
| | | @ApiModelProperty(value = "钥匙编号", example = "1") |
| | | @ExcelColumn(name="钥匙编号") |
| | | private Integer code; |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "车牌号") |
| | | @ExcelColumn(name="车牌号") |
| | |
| | | @ExcelColumn(name="领取规则 0随车 1随派车单") |
| | | private Integer roleType; |
| | | |
| | | @ApiModelProperty(value = "状态 0未绑定 1在位 2借出", example = "1") |
| | | @ExcelColumn(name="状态 0未绑定 1在位 2借出") |
| | | @ApiModelProperty(value = " 状态 0未绑定 1在位 2借出 3维修保养", example = "1") |
| | | @ExcelColumn(name=" 状态 0未绑定 1在位 2借出 3维修保养") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "存放位置", example = "1") |
| | | @TableField(exist = false) |
| | | private String gridCode; |
| | | |
| | | @ApiModelProperty(value = "绑定钥匙柜", example = "1") |
| | | @TableField(exist = false) |
| | | private String cabinetName; |
| | | |
| | | @ApiModelProperty(value = "是否绑定:0=否;1=是;", example = "1") |
| | | @TableField(exist = false) |
| | | private Integer isBinding; |
| | | |
| | | } |
| | |
| | | @ExcelColumn(name="施工事由") |
| | | private String constructionReason; |
| | | |
| | | @ApiModelProperty(value = "钉钉待办任务主键") |
| | | private String ddToDoId; |
| | | |
| | | @ApiModelProperty(value = "钉钉待办任务归属人主键") |
| | | private String ddBelongToUnionId; |
| | | @ApiModelProperty(value = "普通访客申请随访人员") |
| | | @TableField(exist = false) |
| | | private List<Visits> withUserList; |
| | |
| | | package com.doumee.service.business; |
| | | |
| | | //import com.doumee.service.business.third.model.PageData; |
| | | //import com.doumee.service.business.third.model.PageWrap; |
| | | import com.doumee.dao.business.model.JkCabinetGrid; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | |
| | | * @return long |
| | | */ |
| | | long count(JkCabinetGrid jkCabinetGrid); |
| | | |
| | | /** |
| | | * 绑定钥匙 |
| | | * @param jkCabinetGrid |
| | | */ |
| | | void bindingKeys(JkCabinetGrid jkCabinetGrid); |
| | | |
| | | void unBindKeys(List<Integer> idList); |
| | | } |
| | |
| | | */ |
| | | void updateById(JkCabinet jkCabinet); |
| | | |
| | | void updateStatusById(JkCabinet jkCabinet); |
| | | |
| | | /** |
| | | * 批量主键更新 |
| | | * |
| | |
| | | */ |
| | | JkCabinet findById(Integer id); |
| | | |
| | | JkCabinet getDetail(Integer id); |
| | | /** |
| | | * 条件查询单条记录 |
| | | * |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.dingTalk.DingTalk; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.haikang.model.HKConstants; |
| | | import com.doumee.core.haikang.model.param.BaseResponse; |
| | |
| | | private SmsEmailMapper smsEmailMapper; |
| | | @Autowired |
| | | private EmayService emayService; |
| | | @Autowired |
| | | private DingTalk dingTalk; |
| | | @Override |
| | | public Integer create(Approve approve) { |
| | | approveMapper.insert(approve); |
| | |
| | | Arrays.asList(member.getSystemOpenid().split(",")) |
| | | ); |
| | | } |
| | | |
| | | }else if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.visitReporting)){ |
| | | //访客报备 |
| | | SmsEmailServiceImpl.sendVisitReportSms(systemDictDataBiz, |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | if(Constants.equalsInteger(i,Constants.ZERO) && CollectionUtils.isNotEmpty(memberList)){ |
| | | //生成第一批钉钉审批通知信息 |
| | | List<String> erpId = memberList.stream().filter(m->StringUtils.isNotBlank(m.getErpId())).map(m->m.getErpId()).collect(Collectors.toList()); |
| | | if(CollectionUtils.isNotEmpty(erpId)){ |
| | | if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.useCar)){ |
| | | CarUseBook carUseBook = carUseBookMapper.selectJoinOne(CarUseBook.class, |
| | | new MPJLambdaWrapper<CarUseBook>() |
| | | .selectAll(CarUseBook.class) |
| | | .selectAs(Member::getName,CarUseBook::getMemberName) |
| | | .leftJoin(Member.class,Member::getId,CarUseBook::getMemberId) |
| | | .eq(CarUseBook::getId,businessId) |
| | | .last(" limit 1 ") |
| | | ); |
| | | if(Objects.nonNull(carUseBook)){ |
| | | if(CollectionUtils.isNotEmpty(erpId)){ |
| | | String ddTalkId = dingTalk.toDoNotice(StringUtils.isNotBlank(carUseBook.getMemberName())?(carUseBook.getMemberName()+"提交的公务用车申请"):"公务车用车申请", |
| | | erpId , |
| | | dingTalk.getToDoCarUseBookFiledInfo(carUseBook),"pages/staff/vehicle/sendACarDetail?id="+carUseBook.getId()); |
| | | carUseBookMapper.update(new UpdateWrapper<CarUseBook>().lambda() |
| | | .set(CarUseBook::getDdBelongToUnionId,erpId.get(Constants.ZERO)) |
| | | .set(CarUseBook::getDdToDoId,ddTalkId).eq(CarUseBook::getId,carUseBook.getId())); |
| | | } |
| | | } |
| | | }else if(Constants.equalsInteger(noticeType,Constants.noticesObjectType.visit) || Constants.equalsInteger(noticeType,Constants.noticesObjectType.visitReporting)) { |
| | | Visits visits = visitsMapper.selectById(businessId); |
| | | if (Objects.nonNull(visits)) { |
| | | //TODO 缺少域名前缀内容 |
| | | String ddTalkId = dingTalk.toDoNotice(visits.getName() + "的访客申请", |
| | | erpId, |
| | | dingTalk.getToDoVisitFiledInfo(visits), "pages/appointmentDetails/appointmentDetails?id=" + visits.getId()); |
| | | visitsMapper.update(new UpdateWrapper<Visits>().lambda() |
| | | .set(Visits::getDdBelongToUnionId,erpId.get(Constants.ZERO)) |
| | | .set(Visits::getDdToDoId, ddTalkId).eq(Visits::getId, visits.getId())); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | approveMapper.updateById(approve); |
| | | //是否处理 业务数据 |
| | | Boolean dealBusinessBean = false; |
| | | Boolean dealDDToDo = false; |
| | | //审批驳回情况 |
| | | if(approveDTO.getStatus().equals(Constants.THREE)){ |
| | | dealBusinessBean = true; |
| | |
| | | .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList()))); |
| | | } |
| | | /**开启下一级别的数据为待审核**/ |
| | | |
| | | List<Approve> waitAuditList = approveJoinMapper.selectJoinList(Approve.class, |
| | | new MPJLambdaWrapper<Approve>() |
| | | .selectAll(Approve.class) |
| | |
| | | // } |
| | | }else if(approve.getApproveType().equals(Constants.ONE)){ |
| | | //会签 且终审 |
| | | if(!Constants.equalsInteger(approveList.size(),Constants.ZERO)&&Constants.equalsInteger(approve.getIsEndCheck(),Constants.ZERO)){ |
| | | //标记钉钉通知自己已处理 |
| | | dealDDToDo = true; |
| | | } |
| | | |
| | | //无他人审批的情况 则修改数据状态 |
| | | if(Constants.equalsInteger(approveList.size(),Constants.ZERO)&&Constants.equalsInteger(approve.getIsEndCheck(),Constants.ONE)){ |
| | | dealBusinessBean = true; |
| | | }else{ |
| | | if(Constants.equalsInteger(approveList.size(),Constants.ZERO)&&Constants.equalsInteger(approve.getIsEndCheck(),Constants.ZERO)){ |
| | | /**开启下一级别的数据为待审核**/ |
| | | |
| | | List<Approve> waitAuditList = approveJoinMapper.selectJoinList(Approve.class, |
| | | new MPJLambdaWrapper<Approve>() |
| | | .selectAll(Approve.class) |
| | |
| | | List<String> memberPhone = waitAuditList.stream().filter(i->StringUtils.isNotBlank(i.getMemberPhone())).map(i->i.getMemberPhone()).collect(Collectors.toList()); |
| | | List<String> openIdList =waitAuditList.stream().filter(i->StringUtils.isNotBlank(i.getSystemOpenid())).map(i->i.getSystemOpenid()).collect(Collectors.toList()); |
| | | |
| | | |
| | | this.sendNextLvSms(approve,approveDTO,memberPhone,openIdList); |
| | | |
| | | } |
| | |
| | | // } |
| | | } |
| | | } |
| | | this.passNextNotices(dealBusinessBean,notices,approve,approveList,approveCopyList,approveDTO); |
| | | this.passNextNotices(dealBusinessBean,notices,approve,approveList,approveCopyList,approveDTO,dealDDToDo); |
| | | } |
| | | //处理业务数据 |
| | | if(dealBusinessBean){ |
| | |
| | | public void sendNextLvSms(Approve approve ,ApproveDTO approveDTO , List<String> memberPhone ,List<String> openIdList){ |
| | | WxPlatNotice wxPlatNotice = new WxPlatNotice(); |
| | | //物流车预约 |
| | | List<Member> memberList = memberMapper.selectList(new QueryWrapper<Member>().lambda() |
| | | .in(Member::getPhone,memberPhone) |
| | | .eq(Member::getIsdeleted,Constants.ZERO) |
| | | .eq(Member::getStatus,Constants.ZERO) |
| | | .isNotNull(Member::getErpId) |
| | | ); |
| | | if(approveDTO.getObjType().equals(Constants.approveObjectType.reason)){ |
| | | SmsEmailServiceImpl.sendPlatformBookSms(systemDictDataBiz, |
| | | emayService,smsEmailMapper,smsConfigMapper,platformBooksMapper,approveDTO.getObjId(), |
| | |
| | | SmsConstants.carUseBookContent.carUseBookWaitAudit, |
| | | approveDTO.getCheckInfo(),memberPhone); |
| | | //发送公众号通知 |
| | | if(CollectionUtils.isNotEmpty(openIdList)){ |
| | | CarUseBook carUseBook = carUseBookMapper.selectById(approve.getObjId()); |
| | | if(Objects.nonNull(carUseBook)){ |
| | | CarUseBook carUseBook = carUseBookMapper.selectJoinOne(CarUseBook.class, |
| | | new MPJLambdaWrapper<CarUseBook>() |
| | | .selectAll(CarUseBook.class) |
| | | .selectAs(Member::getName,CarUseBook::getMemberName) |
| | | .leftJoin(Member.class,Member::getId,CarUseBook::getMemberId) |
| | | .eq(CarUseBook::getId,approve.getObjId()) |
| | | .last(" limit 1 ") |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(openIdList)&&Objects.nonNull(carUseBook)){ |
| | | SystemUser systemUser = systemUserMapper.selectById(carUseBook.getCreator()); |
| | | if(Objects.nonNull(systemUser)){ |
| | | carUseBook.setMemberName(systemUser.getRealname()); |
| | |
| | | openIdList,1); |
| | | } |
| | | } |
| | | //发送钉钉待办 公务车申请 |
| | | if(Objects.nonNull(carUseBook)&&Objects.nonNull(memberList)){ |
| | | //标记当前审批人已完成 |
| | | dingTalk.updToDoNoticeInfoStatus(carUseBook.getDdBelongToUnionId(),carUseBook.getDdToDoId()); |
| | | //TODO 缺少域名前缀内容 |
| | | String ddTalkId = dingTalk.toDoNotice(StringUtils.isNotBlank(carUseBook.getMemberName())?(carUseBook.getMemberName()+"提交的公务用车申请"):"公务车用车申请", |
| | | memberList.stream().map(i->i.getErpId()).collect(Collectors.toList()) , |
| | | dingTalk.getToDoCarUseBookFiledInfo(carUseBook),"pages/staff/vehicle/sendACarDetail?id="+carUseBook.getId()); |
| | | carUseBookMapper.update(new UpdateWrapper<CarUseBook>().lambda() |
| | | .set(CarUseBook::getDdToDoId,ddTalkId).eq(CarUseBook::getId,carUseBook.getId())); |
| | | } |
| | | }else |
| | | //访客申请/报备 |
| | |
| | | openIdList |
| | | ); |
| | | } |
| | | if(Objects.nonNull(visits)&&Objects.nonNull(memberList)){ |
| | | //标记当前审批人已完成 |
| | | dingTalk.updToDoNoticeInfoStatus(visits.getDdBelongToUnionId(),visits.getDdToDoId()); |
| | | //TODO 缺少域名前缀内容 |
| | | String ddTalkId = dingTalk.toDoNotice(visits.getName()+"的访客申请", |
| | | memberList.stream().map(i->i.getErpId()).collect(Collectors.toList()) , |
| | | dingTalk.getToDoVisitFiledInfo(visits),"pages/appointmentDetails/appointmentDetails?id="+visits.getId()); |
| | | visitsMapper.update(new UpdateWrapper<Visits>().lambda() |
| | | .set(Visits::getDdToDoId,ddTalkId).eq(Visits::getId,visits.getId())); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | * @param dealBusinessBean 是否需要进行更新业务数据状态 |
| | | * @param approve 审批记录 |
| | | * @param approveList 同级待审批数据 |
| | | * @param dealDDToDo 是否处理 当前审批信息人的钉钉的工作通知 |
| | | * |
| | | */ |
| | | public void passNextNotices(Boolean dealBusinessBean,Notices notices,Approve approve,List<Approve> approveList,List<Approve> copyList,ApproveDTO approveDTO){ |
| | | public void passNextNotices(Boolean dealBusinessBean,Notices notices,Approve approve,List<Approve> approveList,List<Approve> copyList,ApproveDTO approveDTO,Boolean dealDDToDo){ |
| | | //未开启下一级时,操作后的待审批人 |
| | | String memberNames =notices.getParam5() |
| | | .replaceAll(","+notices.getRemark(),"") |
| | | .replaceAll(notices.getRemark()+",","") |
| | | .replaceAll(notices.getRemark(),""); |
| | | |
| | | |
| | | |
| | | //1、修改自己的数据记录 |
| | | noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda() |
| | |
| | | } |
| | | } |
| | | } |
| | | if(dealDDToDo){ |
| | | if(approveDTO.getObjType().equals(Constants.approveObjectType.unConstructionVisit) |
| | | ||approveDTO.getObjType().equals(Constants.approveObjectType.constructionVisit) |
| | | ||approveDTO.getObjType().equals(Constants.approveObjectType.visitReporting)) { |
| | | Member member = memberMapper.selectById(approve.getChekorId()); |
| | | // 访客 三类业务数据 |
| | | Visits visits = visitsMapper.selectById(approveDTO.getObjId()); |
| | | if(Objects.nonNull(member)&&Objects.nonNull(member.getErpId()) |
| | | &&Objects.nonNull(visits)&&Objects.nonNull(visits.getDdToDoId())&&Objects.nonNull(visits.getDdBelongToUnionId())){ |
| | | dingTalk.updUserToDoNoticeInfoStatus(visits.getDdBelongToUnionId(),visits.getDdToDoId(),member.getErpId()); |
| | | } |
| | | }else if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals( |
| | | Constants.approveObjectType.unCityUseCar)){ |
| | | Member member = memberMapper.selectById(approve.getChekorId()); |
| | | CarUseBook carUseBook = carUseBookJoinMapper.selectById(approveDTO.getObjId()); |
| | | if(Objects.nonNull(member)&&Objects.nonNull(member.getErpId()) |
| | | &&Objects.nonNull(carUseBook)&&Objects.nonNull(carUseBook.getDdToDoId())&&Objects.nonNull(carUseBook.getDdBelongToUnionId())){ |
| | | dingTalk.updUserToDoNoticeInfoStatus(carUseBook.getDdBelongToUnionId(),carUseBook.getDdToDoId(),member.getErpId()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | public void dealBusinessData(ApproveDTO approveDTO,Approve approve){ |
| | | WxPlatNotice wxPlatNotice = new WxPlatNotice(); |
| | | Visits visits = new Visits(); |
| | | CarUseBook carUseBook = new CarUseBook(); |
| | | if(approveDTO.getObjType().equals(Constants.approveObjectType.unConstructionVisit) |
| | | ||approveDTO.getObjType().equals(Constants.approveObjectType.constructionVisit) |
| | | ||approveDTO.getObjType().equals(Constants.approveObjectType.visitReporting)){ |
| | | // 访客 三类业务数据 |
| | | Visits visits = visitsMapper.selectById(approveDTO.getObjId()); |
| | | visits = visitsMapper.selectById(approveDTO.getObjId()); |
| | | if(Objects.isNull(visits)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到申请记录"); |
| | | } |
| | |
| | | Arrays.asList(visits.getOpenid().split(",")) |
| | | ); |
| | | } |
| | | //钉钉通知 访客被访人或报备提交人 |
| | | Member beVisitMember = memberMapper.selectById(Constants.equalsInteger(visits.getType(),Constants.TWO)?visits.getMemberId():visits.getReceptMemberId()); |
| | | if(Objects.nonNull(beVisitMember)&&StringUtils.isNotBlank(beVisitMember.getDdId())){ |
| | | dingTalk.workInfoOANotice(Long.valueOf(systemDictDataBiz.queryByCode(Constants.DD_TALK,Constants.AGENT_ID).getCode()), |
| | | beVisitMember.getDdId(), |
| | | dingTalk.getVisitNoticeMsg(visits,visits.getName()+"的"+(Constants.equalsInteger(visits.getType(),Constants.TWO)?"访客报备":"访客申请")+","+ |
| | | (Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)? "已审批通过":"已审批驳回")) |
| | | ); |
| | | } |
| | | |
| | | } |
| | | if(StringUtils.isNotBlank(visits.getDdBelongToUnionId()) |
| | | && StringUtils.isNotBlank(visits.getDdToDoId())){ |
| | | //标记当前钉钉审批已完成 |
| | | dingTalk.updToDoNoticeInfoStatus(visits.getDdBelongToUnionId(),visits.getDdToDoId()); |
| | | } |
| | | }else if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals( |
| | | Constants.approveObjectType.unCityUseCar)){ |
| | | this.updDriver(approveDTO,approve,true); |
| | | CarUseBook carUseBook = carUseBookJoinMapper.selectById(approveDTO.getObjId()); |
| | | carUseBook = carUseBookJoinMapper.selectById(approveDTO.getObjId()); |
| | | if(Objects.nonNull(carUseBook)){ |
| | | SystemUser systemUser = systemUserMapper.selectById(carUseBook.getCreator()); |
| | | //发送通知短息 |
| | |
| | | Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)?WxPlatConstants.carUseBookContent.carUseBookAuditSuccess: WxPlatConstants.carUseBookContent.carUseBookAuditFail, |
| | | Arrays.asList(systemUser.getOpenid().split(",")),0); |
| | | } |
| | | } |
| | | //钉钉通知发起人 |
| | | Member creatMember = memberMapper.selectById(carUseBook.getMemberId()); |
| | | if(Objects.nonNull(creatMember)&&StringUtils.isNotBlank(creatMember.getDdId())){ |
| | | dingTalk.workInfoOANotice(Long.valueOf(systemDictDataBiz.queryByCode(Constants.DD_TALK,Constants.AGENT_ID).getCode()), |
| | | creatMember.getErpId(), |
| | | dingTalk.getCarUseNoticeMsg(carUseBook,carUseBook.getMemberName() + "提交的公务用车,"+ |
| | | (Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)? "已审批通过":"已审批驳回")) |
| | | ); |
| | | } |
| | | if(StringUtils.isNotBlank(carUseBook.getDdBelongToUnionId()) |
| | | && StringUtils.isNotBlank(carUseBook.getDdToDoId())){ |
| | | //标记当前钉钉审批已完成 |
| | | dingTalk.updToDoNoticeInfoStatus(carUseBook.getDdBelongToUnionId(),carUseBook.getDdToDoId()); |
| | | } |
| | | |
| | | }else if(approveDTO.getObjType().equals(Constants.approveObjectType.reason)){ |
| | |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)){ |
| | | List<Approve> approveList = approveMapper.selectList(new QueryWrapper<Approve>().lambda().eq(Approve::getObjId,approve.getObjId()) |
| | | .eq(Approve::getObjType,approve.getObjType()) |
| | | .eq(Approve::getType,Constants.ONE)); |
| | | if(CollectionUtils.isNotEmpty(approveList)){ |
| | | //处理通过 显示所有的抄送记录 |
| | | approveMapper.update(null,new UpdateWrapper<Approve>().lambda().set(Approve::getStatus,Constants.TWO) |
| | | .set(Approve::getCheckDate,new Date()) |
| | |
| | | .eq(Approve::getObjType,approve.getObjType()) |
| | | .eq(Approve::getType,Constants.ONE) |
| | | ); |
| | | List<Member> memberList = memberMapper.selectList(new QueryWrapper<Member>().lambda() |
| | | .eq(Member::getIsdeleted,Constants.ZERO) |
| | | .eq(Member::getStatus,Constants.ZERO) |
| | | .isNotNull(Member::getDdId) |
| | | .in(Member::getId,approveList.stream().map(i->i.getChekorId()).collect(Collectors.toList()))); |
| | | if(CollectionUtils.isNotEmpty(memberList)){ |
| | | if(Objects.nonNull(visits)||Objects.nonNull(carUseBook)){ |
| | | dingTalk.workInfoOANotice(Long.valueOf(systemDictDataBiz.queryByCode(Constants.DD_TALK,Constants.AGENT_ID).getCode()), |
| | | StringUtils.join(memberList.stream().map(i->i.getDdId()).collect(Collectors.toList()),","), |
| | | Objects.nonNull(visits)? |
| | | dingTalk.getVisitNoticeMsg(visits,visits.getName()+"的"+(Constants.equalsInteger(visits.getType(),Constants.TWO)?"访客报备":"访客申请")+",抄送给您,请知晓"): |
| | | dingTalk.getCarUseNoticeMsg(carUseBook,carUseBook.getMemberName() + "提交的公务用车,抄送给您,请知晓") |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.dingTalk.DingTalk; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.dao.business.dao.*; |
| | | import com.doumee.dao.business.vo.GeneralDataVO; |
| | |
| | | |
| | | @Autowired |
| | | private ApproveMapper approveMapper; |
| | | |
| | | @Autowired |
| | | private DingTalk dingTalk; |
| | | |
| | | |
| | | @Override |
| | |
| | | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), |
| | | Arrays.asList(checkUser.getOpenid().split(","))); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(member.getDdId())){ |
| | | dingTalk.workInfoOANotice(Long.valueOf(systemDictDataBiz.queryByCode(Constants.DD_TALK,Constants.AGENT_ID).getCode()), |
| | | member.getDdId(), |
| | | dingTalk.getHiddenDangerNoticeMsg(hiddenDanger)); |
| | | } |
| | | |
| | | return hiddenDanger.getId(); |
| | | } |
| | | |
| | |
| | | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(), |
| | | Arrays.asList(checkUser.getOpenid().split(","))); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(member.getDdId())){ |
| | | dingTalk.workInfoOANotice(Long.valueOf(systemDictDataBiz.queryByCode(Constants.DD_TALK,Constants.AGENT_ID).getCode()), |
| | | member.getDdId(), |
| | | dingTalk.getHiddenDangerNoticeMsg(hiddenDanger)); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.alibaba.druid.sql.visitor.functions.Concat; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.dao.business.JkKeysMapper; |
| | | import com.doumee.dao.business.model.Cars; |
| | | import com.doumee.dao.business.model.JkCabinet; |
| | | import com.doumee.dao.business.model.JkKeys; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.JkCabinetGridMapper; |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import com.github.yulichang.toolkit.MPJWrappers; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import com.github.xiaoymin.knife4j.core.util.CollectionUtils; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 钥匙柜柜格基本信息表Service实现 |
| | |
| | | |
| | | @Autowired |
| | | private JkCabinetGridMapper jkCabinetGridMapper; |
| | | |
| | | @Autowired |
| | | private JkKeysMapper jkKeysMapper; |
| | | |
| | | @Override |
| | | public Integer create(JkCabinetGrid jkCabinetGrid) { |
| | |
| | | @Override |
| | | public PageData<JkCabinetGrid> findPage(PageWrap<JkCabinetGrid> pageWrap) { |
| | | IPage<JkCabinetGrid> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<JkCabinetGrid> queryWrapper = new QueryWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetGrid::getId, pageWrap.getModel().getId()); |
| | | JkCabinetGrid model = pageWrap.getModel(); |
| | | MPJLambdaWrapper<JkCabinetGrid> wrapper = new MPJLambdaWrapper<JkCabinetGrid>() |
| | | .selectAll(JkCabinetGrid.class) |
| | | .selectAs(JkCabinet::getName,JkCabinetGrid::getCabinetName) |
| | | .selectAs(JkKeys::getCode,JkCabinetGrid::getKeyCode) |
| | | .leftJoin(JkCabinet.class,JkCabinet::getId,JkCabinetGrid::getCabinetId) |
| | | .leftJoin(JkKeys.class,JkKeys::getId,JkCabinetGrid::getKeyId) |
| | | .eq(JkCabinetGrid::getIsdeleted,Constants.ZERO) |
| | | .eq(Objects.nonNull(model.getCabinetId()),JkCabinetGrid::getCabinetId,model.getCabinetId()) |
| | | .eq(Objects.nonNull(model.getStatus()),JkCabinetGrid::getStatus,model.getStatus()) |
| | | .isNull(Objects.nonNull(model.getBindStatus())&&Constants.equalsInteger(model.getBindStatus(),Constants.ZERO),JkCabinetGrid::getKeyId) |
| | | .isNotNull(Objects.nonNull(model.getBindStatus())&&Constants.equalsInteger(model.getBindStatus(),Constants.ONE),JkCabinetGrid::getKeyId) |
| | | .like(StringUtils.isNotBlank(model.getKeyCode()),JkKeys::getCode,model.getKeyCode()); |
| | | IPage<JkCabinetGrid> iPage = jkCabinetGridMapper.selectJoinPage(page,JkCabinetGrid.class,wrapper); |
| | | for (JkCabinetGrid jkCabinetGrid:iPage.getRecords()) { |
| | | jkCabinetGrid.setBindStatus(Objects.isNull(jkCabinetGrid.getKeyId())?Constants.ZERO:Constants.ONE); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetGrid::getCreator, pageWrap.getModel().getCreator()); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(JkCabinetGrid::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.lambda().le(JkCabinetGrid::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | } |
| | | if (pageWrap.getModel().getEditor() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetGrid::getEditor, pageWrap.getModel().getEditor()); |
| | | } |
| | | if (pageWrap.getModel().getEditDate() != null) { |
| | | queryWrapper.lambda().ge(JkCabinetGrid::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.lambda().le(JkCabinetGrid::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | } |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetGrid::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getInfo() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetGrid::getInfo, pageWrap.getModel().getInfo()); |
| | | } |
| | | if (pageWrap.getModel().getCabinetId() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetGrid::getCabinetId, pageWrap.getModel().getCabinetId()); |
| | | } |
| | | if (pageWrap.getModel().getCode() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetGrid::getCode, pageWrap.getModel().getCode()); |
| | | } |
| | | if (pageWrap.getModel().getKeyId() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetGrid::getKeyId, pageWrap.getModel().getKeyId()); |
| | | } |
| | | if (pageWrap.getModel().getSerialNo() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetGrid::getSerialNo, pageWrap.getModel().getSerialNo()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetGrid::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | if (pageWrap.getModel().getWorkingStatus() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetGrid::getWorkingStatus, pageWrap.getModel().getWorkingStatus()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | return PageData.from(jkCabinetGridMapper.selectPage(page, queryWrapper)); |
| | | return PageData.from(iPage); |
| | | } |
| | | |
| | | @Override |
| | |
| | | QueryWrapper<JkCabinetGrid> wrapper = new QueryWrapper<>(jkCabinetGrid); |
| | | return jkCabinetGridMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void bindingKeys(JkCabinetGrid jkCabinetGrid){ |
| | | if(Objects.isNull(jkCabinetGrid) |
| | | || Objects.isNull(jkCabinetGrid.getId()) |
| | | || Objects.isNull(jkCabinetGrid.getKeyId())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | JkCabinetGrid model = jkCabinetGridMapper.selectById(jkCabinetGrid.getId()); |
| | | if(Objects.isNull(model)|| Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(Objects.nonNull(model.getKeyId())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"已绑定,请勿重复绑定"); |
| | | } |
| | | JkKeys keysModel = jkKeysMapper.selectById(jkCabinetGrid.getKeyId()); |
| | | if(Objects.isNull(keysModel)|| Constants.equalsInteger(keysModel.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!Constants.equalsInteger(keysModel.getStatus(), (Constants.ZERO))){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"钥匙已被绑定,请选择其他钥匙绑定"); |
| | | } |
| | | //更新钥匙柜信息 |
| | | jkCabinetGridMapper.update(new UpdateWrapper<JkCabinetGrid>().lambda() |
| | | .set(JkCabinetGrid::getKeyId,jkCabinetGrid.getKeyId()) |
| | | .set(JkCabinetGrid::getEditDate, DateUtil.getCurrDateTime()) |
| | | .eq(JkCabinetGrid::getId,jkCabinetGrid.getId())); |
| | | //标记钥匙信息 |
| | | jkKeysMapper.update(new UpdateWrapper<JkKeys>().lambda() |
| | | .set(JkKeys::getStatus,Constants.ONE) |
| | | .eq(JkKeys::getId,jkCabinetGrid.getKeyId()) |
| | | ); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | public void unBindKeys(List<Integer> idList){ |
| | | if(CollectionUtils.isEmpty(idList)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(idList.size()==Constants.ONE){ |
| | | JkCabinetGrid model = jkCabinetGridMapper.selectById(idList.get(Constants.ZERO)); |
| | | if(Objects.isNull(model)|| Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(Objects.isNull(model.getKeyId())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前规格未绑定钥匙,请刷新查看"); |
| | | }else{ |
| | | //更新钥匙柜信息 |
| | | jkCabinetGridMapper.update(new UpdateWrapper<JkCabinetGrid>().lambda() |
| | | .set(JkCabinetGrid::getKeyId,null) |
| | | .set(JkCabinetGrid::getEditDate, DateUtil.getCurrDateTime()) |
| | | .eq(JkCabinetGrid::getId,model.getId())); |
| | | JkKeys keysModel = jkKeysMapper.selectById(model.getKeyId()); |
| | | if(Objects.nonNull(keysModel) && !Constants.equalsInteger(keysModel.getStatus(),Constants.ZERO)){ |
| | | jkKeysMapper.update(new UpdateWrapper<JkKeys>().lambda() |
| | | .set(JkKeys::getStatus,Constants.ZERO) |
| | | .eq(JkKeys::getId,keysModel.getId()) |
| | | ); |
| | | } |
| | | } |
| | | }else{ |
| | | List<JkCabinetGrid> jkCabinetGridList = jkCabinetGridMapper.selectList(new QueryWrapper<JkCabinetGrid>().lambda() |
| | | .eq(JkCabinetGrid::getIsdeleted,Constants.ZERO) |
| | | .isNotNull(JkCabinetGrid::getKeyId) |
| | | .in(JkCabinetGrid::getId,idList)); |
| | | if(CollectionUtils.isNotEmpty(jkCabinetGridList)){ |
| | | jkCabinetGridMapper.update(new UpdateWrapper<JkCabinetGrid>().lambda() |
| | | .set(JkCabinetGrid::getKeyId,null) |
| | | .set(JkCabinetGrid::getEditDate, DateUtil.getCurrDateTime()) |
| | | .eq(JkCabinetGrid::getId,jkCabinetGridList.stream().map(i->i.getId()).collect(Collectors.toList()))); |
| | | List<Integer> keyIdList = jkCabinetGridList.stream().filter(i->Objects.nonNull(i.getKeyId())).map(i->i.getKeyId()).collect(Collectors.toList()); |
| | | if(CollectionUtils.isNotEmpty(keyIdList)){ |
| | | jkKeysMapper.update(new UpdateWrapper<JkKeys>().lambda() |
| | | .set(JkKeys::getStatus,Constants.ZERO) |
| | | .in(JkKeys::getId,keyIdList) |
| | | ); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | IPage<JkCabinetLog> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<JkCabinetLog> queryWrapper = new QueryWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | JkCabinetLog model = pageWrap.getModel(); |
| | | |
| | | |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetLog::getId, pageWrap.getModel().getId()); |
| | | } |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.dao.business.JkCabinetGridMapper; |
| | | import com.doumee.dao.business.JkKeysMapper; |
| | | import com.doumee.dao.business.model.JkCabinetGrid; |
| | | import com.doumee.dao.business.model.JkKeys; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import com.doumee.core.utils.Utils; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 钥匙柜基本信息表Service实现 |
| | |
| | | @Autowired |
| | | private JkCabinetMapper jkCabinetMapper; |
| | | |
| | | @Autowired |
| | | private JkCabinetGridMapper jkCabinetGridMapper; |
| | | |
| | | @Autowired |
| | | private JkKeysMapper jkKeysMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | public Integer create(JkCabinet jkCabinet) { |
| | | if(Objects.isNull(jkCabinet) |
| | | || StringUtils.isBlank(jkCabinet.getCode()) |
| | | || StringUtils.isBlank(jkCabinet.getName()) |
| | | || StringUtils.isBlank(jkCabinet.getDevId()) |
| | | || StringUtils.isBlank(jkCabinet.getLinkAddr()) |
| | | || StringUtils.isBlank(jkCabinet.getCode()) |
| | | |
| | | || Objects.isNull(jkCabinet.getPort()) |
| | | || CollectionUtils.isEmpty(jkCabinet.getManagerIdList()) |
| | | || CollectionUtils.isEmpty(jkCabinet.getAuthMemberIdList()) |
| | | || Objects.isNull(jkCabinet.getDoubleAuth()) |
| | | |
| | | || Objects.isNull(jkCabinet.getRowNum()) |
| | | || jkCabinet.getRowNum() <= Constants.ZERO |
| | | || Objects.isNull(jkCabinet.getColumnNum()) |
| | | || jkCabinet.getColumnNum() <= Constants.ZERO |
| | | || Objects.isNull(jkCabinet.getNoType()) |
| | | || Objects.isNull(jkCabinet.getSortType()) |
| | | || ( |
| | | Constants.equalsInteger(jkCabinet.getNoType(),Constants.ONE) |
| | | && ( Objects.isNull(jkCabinet.getNoIndex()) || Objects.isNull(jkCabinet.getNoLength()) || StringUtils.isBlank(jkCabinet.getNoPrefix()) ) |
| | | ) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | //查询编号是否重复 |
| | | if(jkCabinetMapper.selectCount(new QueryWrapper<JkCabinet>().lambda().eq(JkCabinet::getCode,jkCabinet.getCode()).eq(JkCabinet::getIsdeleted,Constants.ZERO))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"钥匙柜设备编号已存在!"); |
| | | } |
| | | if(jkCabinetMapper.selectCount(new QueryWrapper<JkCabinet>().lambda().eq(JkCabinet::getDevId,jkCabinet.getDevId()).eq(JkCabinet::getIsdeleted,Constants.ZERO))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"钥匙柜设备ID已存在!"); |
| | | } |
| | | LoginUserInfo loginUserInfo = jkCabinet.getLoginUserInfo(); |
| | | jkCabinet.setCreateDate(new Date()); |
| | | jkCabinet.setEditDate(jkCabinet.getCreateDate()); |
| | | jkCabinet.setCreator(loginUserInfo.getId()); |
| | | jkCabinet.setEditor(loginUserInfo.getId()); |
| | | jkCabinet.setIsdeleted(Constants.ZERO); |
| | | jkCabinet.setStatus(Constants.ZERO); |
| | | jkCabinet.setRunStatus(Constants.ONE); |
| | | if(StringUtils.isNotBlank(jkCabinet.getJwd())&&jkCabinet.getJwd().split(",").length>Constants.ONE){ |
| | | jkCabinet.setLongitude(new BigDecimal(jkCabinet.getJwd().split(",")[Constants.ZERO])); |
| | | jkCabinet.setLatitude(new BigDecimal(jkCabinet.getJwd().split(",")[Constants.ONE])); |
| | | } |
| | | jkCabinet.setManagerId(String.join(",",jkCabinet.getManagerIdList())); |
| | | jkCabinet.setAuthMemberId(String.join(",",jkCabinet.getAuthMemberIdList())); |
| | | jkCabinetMapper.insert(jkCabinet); |
| | | this.createGrid(jkCabinet); |
| | | return jkCabinet.getId(); |
| | | } |
| | | |
| | | |
| | | public void createGrid(JkCabinet jkCabinet){ |
| | | LoginUserInfo loginUserInfo = jkCabinet.getLoginUserInfo(); |
| | | Integer startNo = Constants.equalsInteger(jkCabinet.getNoType(),Constants.ZERO)?1:jkCabinet.getNoIndex() ; |
| | | List<JkCabinetGrid> jkCabinetGridList = new ArrayList<>(); |
| | | Integer maxNum = jkCabinet.getRowNum() * jkCabinet.getColumnNum(); |
| | | for (int i = 0; i < maxNum; i++) { |
| | | JkCabinetGrid grid = new JkCabinetGrid(); |
| | | grid.setCreateDate(new Date()); |
| | | grid.setEditDate(jkCabinet.getCreateDate()); |
| | | grid.setCreator(loginUserInfo.getId()); |
| | | grid.setEditor(loginUserInfo.getId()); |
| | | grid.setIsdeleted(Constants.ZERO); |
| | | grid.setStatus(Constants.ZERO); |
| | | grid.setCabinetId(jkCabinet.getId()); |
| | | if(Constants.equalsInteger(jkCabinet.getNoType(),Constants.ZERO)){ |
| | | grid.setCode(StringUtils.leftPad(startNo.toString(),maxNum.toString().length()+1,"0")); |
| | | }else{ |
| | | grid.setCode(jkCabinet.getNoPrefix() + StringUtils.leftPad(startNo.toString(),jkCabinet.getNoLength(),"0")); |
| | | } |
| | | |
| | | jkCabinetGridList.add(grid); |
| | | startNo = startNo + 1; |
| | | } |
| | | jkCabinetGridMapper.insert(jkCabinetGridList); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id) { |
| | | jkCabinetMapper.deleteById(id); |
| | | JkCabinet jkCabinet = jkCabinetMapper.selectById(id); |
| | | if(Constants.equalsInteger(jkCabinet.getStatus(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非禁用数据,无法进行删除"); |
| | | } |
| | | //查询钥匙柜下的柜格信息 |
| | | List<JkCabinetGrid> jkCabinetGridList = jkCabinetGridMapper.selectList(new QueryWrapper<JkCabinetGrid>().lambda().eq(JkCabinetGrid::getIsdeleted,Constants.ZERO) |
| | | .eq(JkCabinetGrid::getCabinetId,jkCabinet.getId()) |
| | | ); |
| | | if(Objects.nonNull(jkCabinetGridList)){ |
| | | jkCabinetGridMapper.update(null,new UpdateWrapper<JkCabinetGrid>().lambda().set(JkCabinetGrid::getIsdeleted,Constants.ONE) |
| | | .in(JkCabinetGrid::getId,jkCabinetGridList.stream().map(i->i.getId()).collect(Collectors.toList())) |
| | | ); |
| | | List<Integer> keyIdList = jkCabinetGridList.stream().filter(i->Objects.nonNull(i.getKeyId())).map(i->i.getKeyId()).collect(Collectors.toList()); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(keyIdList)){ |
| | | jkKeysMapper.update(null,new UpdateWrapper<JkKeys>().lambda() |
| | | .set(JkKeys::getStatus,Constants.ZERO) |
| | | .in(JkKeys::getId,keyIdList) |
| | | ); |
| | | } |
| | | } |
| | | jkCabinetMapper.update(null,new UpdateWrapper<JkCabinet>().lambda() |
| | | .set(JkCabinet::getIsdeleted,Constants.ONE) |
| | | .eq(JkCabinet::getId,jkCabinet.getId())); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void updateById(JkCabinet jkCabinet) { |
| | | if(Objects.isNull(jkCabinet) |
| | | || Objects.isNull(jkCabinet.getId()) |
| | | || StringUtils.isBlank(jkCabinet.getCode()) |
| | | || StringUtils.isBlank(jkCabinet.getName()) |
| | | || StringUtils.isBlank(jkCabinet.getDevId()) |
| | | || StringUtils.isBlank(jkCabinet.getLinkAddr()) |
| | | || StringUtils.isBlank(jkCabinet.getCode()) |
| | | || CollectionUtils.isEmpty(jkCabinet.getManagerIdList()) |
| | | || CollectionUtils.isEmpty(jkCabinet.getAuthMemberIdList()) |
| | | || Objects.isNull(jkCabinet.getPort()) |
| | | || Objects.isNull(jkCabinet.getDoubleAuth()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | jkCabinet.setRowNum(null); |
| | | jkCabinet.setColumnNum(null); |
| | | jkCabinet.setSortType(null); |
| | | jkCabinet.setNoType(null); |
| | | jkCabinet.setNoIndex(null); |
| | | jkCabinet.setNoLength(null); |
| | | jkCabinet.setNoPrefix(null); |
| | | //查询编号是否重复 |
| | | if(jkCabinetMapper.selectCount(new QueryWrapper<JkCabinet>().lambda().ne(JkCabinet::getId,jkCabinet.getId()).eq(JkCabinet::getCode,jkCabinet.getCode()).eq(JkCabinet::getIsdeleted,Constants.ZERO))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"钥匙柜设备编号已存在!"); |
| | | } |
| | | if(jkCabinetMapper.selectCount(new QueryWrapper<JkCabinet>().lambda().ne(JkCabinet::getId,jkCabinet.getId()).eq(JkCabinet::getDevId,jkCabinet.getDevId()).eq(JkCabinet::getIsdeleted,Constants.ZERO))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"钥匙柜设备ID已存在!"); |
| | | } |
| | | LoginUserInfo loginUserInfo = jkCabinet.getLoginUserInfo(); |
| | | jkCabinet.setEditDate(new Date()); |
| | | jkCabinet.setEditor(loginUserInfo.getId()); |
| | | if(StringUtils.isNotBlank(jkCabinet.getJwd())&&jkCabinet.getJwd().split(",").length>Constants.ONE){ |
| | | jkCabinet.setLongitude(new BigDecimal(jkCabinet.getJwd().split(",")[Constants.ZERO])); |
| | | jkCabinet.setLatitude(new BigDecimal(jkCabinet.getJwd().split(",")[Constants.ONE])); |
| | | } |
| | | jkCabinet.setManagerId(String.join(",",jkCabinet.getManagerIdList())); |
| | | jkCabinet.setAuthMemberId(String.join(",",jkCabinet.getAuthMemberIdList())); |
| | | jkCabinetMapper.updateById(jkCabinet); |
| | | } |
| | | |
| | | @Override |
| | | public void updateStatusById(JkCabinet jkCabinet) { |
| | | if(Objects.isNull(jkCabinet) |
| | | || Objects.isNull(jkCabinet.getId()) |
| | | || Objects.isNull(jkCabinet.getStatus())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | jkCabinetMapper.update(null,new UpdateWrapper<JkCabinet>() |
| | | .lambda().set(JkCabinet::getStatus,jkCabinet.getStatus()) |
| | | .set(JkCabinet::getEditDate, DateUtil.getCurrDateTime()) |
| | | .eq(JkCabinet::getId,jkCabinet.getId())); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void updateByIdInBatch(List<JkCabinet> jkCabinets) { |
| | |
| | | return jkCabinetMapper.selectById(id); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public JkCabinet getDetail(Integer id){ |
| | | JkCabinet jkCabinet = jkCabinetMapper.selectById(id); |
| | | if(Objects.nonNull(jkCabinet.getLongitude()) |
| | | && Objects.nonNull(jkCabinet.getLatitude())){ |
| | | jkCabinet.setJwd(jkCabinet.getLongitude() + "," + jkCabinet.getLatitude()); |
| | | } |
| | | jkCabinet.setGridNum(jkCabinet.getColumnNum()*jkCabinet.getRowNum()); |
| | | return jkCabinet; |
| | | } |
| | | |
| | | @Override |
| | | public JkCabinet findOne(JkCabinet jkCabinet) { |
| | | QueryWrapper<JkCabinet> wrapper = new QueryWrapper<>(jkCabinet); |
| | |
| | | |
| | | @Override |
| | | public List<JkCabinet> findList(JkCabinet jkCabinet) { |
| | | jkCabinet.setIsdeleted(Constants.ZERO); |
| | | jkCabinet.setStatus(Constants.ZERO); |
| | | QueryWrapper<JkCabinet> wrapper = new QueryWrapper<>(jkCabinet); |
| | | return jkCabinetMapper.selectList(wrapper); |
| | | } |
| | |
| | | @Override |
| | | public PageData<JkCabinet> findPage(PageWrap<JkCabinet> pageWrap) { |
| | | IPage<JkCabinet> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<JkCabinet> queryWrapper = new QueryWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getId, pageWrap.getModel().getId()); |
| | | JkCabinet model = pageWrap.getModel(); |
| | | IPage<JkCabinet> iPage = jkCabinetMapper.selectPage(page, new QueryWrapper<JkCabinet>() |
| | | .lambda() |
| | | .eq(JkCabinet::getIsdeleted,Constants.ZERO) |
| | | .like(StringUtils.isNotBlank(model.getName()),JkCabinet::getName, model.getName()) |
| | | .like(StringUtils.isNotBlank(model.getCode()),JkCabinet::getCode, model.getCode()) |
| | | .eq(Objects.nonNull(model.getStatus()),JkCabinet::getStatus, model.getStatus()) |
| | | .eq(Objects.nonNull(model.getRunStatus()),JkCabinet::getRunStatus, model.getRunStatus()) |
| | | ); |
| | | for (JkCabinet jkCabinet:iPage.getRecords()) { |
| | | jkCabinet.setGridNum(jkCabinet.getColumnNum()*jkCabinet.getRowNum()); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getCreator, pageWrap.getModel().getCreator()); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(JkCabinet::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.lambda().le(JkCabinet::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | } |
| | | if (pageWrap.getModel().getEditor() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getEditor, pageWrap.getModel().getEditor()); |
| | | } |
| | | if (pageWrap.getModel().getEditDate() != null) { |
| | | queryWrapper.lambda().ge(JkCabinet::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.lambda().le(JkCabinet::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | } |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getInfo() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getInfo, pageWrap.getModel().getInfo()); |
| | | } |
| | | if (pageWrap.getModel().getCode() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getCode, pageWrap.getModel().getCode()); |
| | | } |
| | | if (pageWrap.getModel().getName() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getName, pageWrap.getModel().getName()); |
| | | } |
| | | if (pageWrap.getModel().getDevId() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getDevId, pageWrap.getModel().getDevId()); |
| | | } |
| | | if (pageWrap.getModel().getSerialNo() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getSerialNo, pageWrap.getModel().getSerialNo()); |
| | | } |
| | | if (pageWrap.getModel().getLinkAddr() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getLinkAddr, pageWrap.getModel().getLinkAddr()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | if (pageWrap.getModel().getPort() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getPort, pageWrap.getModel().getPort()); |
| | | } |
| | | if (pageWrap.getModel().getManagerId() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getManagerId, pageWrap.getModel().getManagerId()); |
| | | } |
| | | if (pageWrap.getModel().getUseTime() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getUseTime, pageWrap.getModel().getUseTime()); |
| | | } |
| | | if (pageWrap.getModel().getDoubleAuth() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getDoubleAuth, pageWrap.getModel().getDoubleAuth()); |
| | | } |
| | | if (pageWrap.getModel().getAuthMemberId() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getAuthMemberId, pageWrap.getModel().getAuthMemberId()); |
| | | } |
| | | if (pageWrap.getModel().getRowNum() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getRowNum, pageWrap.getModel().getRowNum()); |
| | | } |
| | | if (pageWrap.getModel().getColumnNum() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getColumnNum, pageWrap.getModel().getColumnNum()); |
| | | } |
| | | if (pageWrap.getModel().getHaertTime() != null) { |
| | | queryWrapper.lambda().ge(JkCabinet::getHaertTime, Utils.Date.getStart(pageWrap.getModel().getHaertTime())); |
| | | queryWrapper.lambda().le(JkCabinet::getHaertTime, Utils.Date.getEnd(pageWrap.getModel().getHaertTime())); |
| | | } |
| | | if (pageWrap.getModel().getLocation() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getLocation, pageWrap.getModel().getLocation()); |
| | | } |
| | | if (pageWrap.getModel().getLongitude() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getLongitude, pageWrap.getModel().getLongitude()); |
| | | } |
| | | if (pageWrap.getModel().getLatitude() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getLatitude, pageWrap.getModel().getLatitude()); |
| | | } |
| | | if (pageWrap.getModel().getNoType() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getNoType, pageWrap.getModel().getNoType()); |
| | | } |
| | | if (pageWrap.getModel().getNoPrefix() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getNoPrefix, pageWrap.getModel().getNoPrefix()); |
| | | } |
| | | if (pageWrap.getModel().getNoLength() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getNoLength, pageWrap.getModel().getNoLength()); |
| | | } |
| | | if (pageWrap.getModel().getNoIndex() != null) { |
| | | queryWrapper.lambda().eq(JkCabinet::getNoIndex, pageWrap.getModel().getNoIndex()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | return PageData.from(jkCabinetMapper.selectPage(page, queryWrapper)); |
| | | return PageData.from(iPage); |
| | | } |
| | | |
| | | @Override |
| | |
| | | QueryWrapper<JkCabinet> wrapper = new QueryWrapper<>(jkCabinet); |
| | | return jkCabinetMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.CarsMapper; |
| | | import com.doumee.dao.business.model.Cars; |
| | | import com.doumee.dao.business.model.JkCabinet; |
| | | import com.doumee.dao.business.model.JkCabinetGrid; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import com.doumee.core.utils.Utils; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.interfaces.MPJBaseJoin; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 钥匙基本信息表Service实现 |
| | |
| | | @Autowired |
| | | private JkKeysMapper jkKeysMapper; |
| | | |
| | | @Autowired |
| | | private CarsMapper carsMapper; |
| | | |
| | | @Override |
| | | public Integer create(JkKeys jkKeys) { |
| | | if(Objects.isNull(jkKeys) |
| | | || Objects.isNull(jkKeys.getCarId()) |
| | | || Objects.isNull(jkKeys.getRoleType()) |
| | | || StringUtils.isBlank(jkKeys.getCode()) |
| | | || StringUtils.isBlank(jkKeys.getRfidLable()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | //查询编号是否重复 |
| | | if(jkKeysMapper.selectCount(new QueryWrapper<JkKeys>().lambda().eq(JkKeys::getCode,jkKeys.getCode()).eq(JkKeys::getIsdeleted,Constants.ZERO))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"钥匙编号已存在!"); |
| | | } |
| | | Cars cars = carsMapper.selectById(jkKeys.getCarId()); |
| | | if(Objects.isNull(cars)||Constants.equalsInteger(cars.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"车辆信息未查询到!"); |
| | | } |
| | | JkKeys carsKeys = jkKeysMapper.selectOne(new QueryWrapper<JkKeys>().lambda().eq(JkKeys::getCarId,jkKeys.getCarId()).eq(JkKeys::getIsdeleted,Constants.ZERO).last("limit 1")); |
| | | if(Objects.nonNull(carsKeys)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前车辆已被钥匙["+carsKeys.getCode()+"]绑定使用!"); |
| | | } |
| | | JkKeys rfidKeys = jkKeysMapper.selectOne(new QueryWrapper<JkKeys>().lambda().eq(JkKeys::getRfidLable,jkKeys.getRfidLable()).eq(JkKeys::getIsdeleted,Constants.ZERO).last("limit 1")); |
| | | if(Objects.nonNull(rfidKeys)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前RFID标签已被钥匙["+rfidKeys.getCode()+"]使用!"); |
| | | } |
| | | LoginUserInfo loginUserInfo = jkKeys.getLoginUserInfo(); |
| | | jkKeys.setCreateDate(new Date()); |
| | | jkKeys.setEditDate(jkKeys.getCreateDate()); |
| | | jkKeys.setCreator(loginUserInfo.getId()); |
| | | jkKeys.setEditor(loginUserInfo.getId()); |
| | | jkKeys.setIsdeleted(Constants.ZERO); |
| | | jkKeys.setStatus(Constants.ZERO); |
| | | jkKeysMapper.insert(jkKeys); |
| | | return jkKeys.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id) { |
| | | JkKeys jkKeys = jkKeysMapper.selectById(id); |
| | | if(Objects.isNull(jkKeys)||Constants.equalsInteger(jkKeys.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!Constants.equalsInteger(jkKeys.getStatus(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"钥匙已绑定,无法进行删除"); |
| | | } |
| | | jkKeysMapper.deleteById(id); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public void updateById(JkKeys jkKeys) { |
| | | if(Objects.isNull(jkKeys) |
| | | || Objects.isNull(jkKeys.getId()) |
| | | || Objects.isNull(jkKeys.getCarId()) |
| | | || Objects.isNull(jkKeys.getRoleType()) |
| | | || StringUtils.isBlank(jkKeys.getCode()) |
| | | || StringUtils.isBlank(jkKeys.getRfidLable()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | //查询编号是否重复 |
| | | if(jkKeysMapper.selectCount(new QueryWrapper<JkKeys>().lambda().ne(JkKeys::getId,jkKeys.getId()).eq(JkKeys::getCode,jkKeys.getCode()).eq(JkKeys::getIsdeleted,Constants.ZERO))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"钥匙编号已存在!"); |
| | | } |
| | | Cars cars = carsMapper.selectById(jkKeys.getCarId()); |
| | | if(Objects.isNull(cars)||Constants.equalsInteger(cars.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"车辆信息未查询到!"); |
| | | } |
| | | JkKeys carsKeys = jkKeysMapper.selectOne(new QueryWrapper<JkKeys>().lambda().ne(JkKeys::getId,jkKeys.getId()).eq(JkKeys::getCarId,jkKeys.getCarId()).eq(JkKeys::getIsdeleted,Constants.ZERO).last("limit 1")); |
| | | if(Objects.nonNull(carsKeys)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前车辆已被钥匙["+carsKeys.getCode()+"]绑定使用!"); |
| | | } |
| | | JkKeys rfidKeys = jkKeysMapper.selectOne(new QueryWrapper<JkKeys>().lambda().ne(JkKeys::getId,jkKeys.getId()).eq(JkKeys::getRfidLable,jkKeys.getRfidLable()).eq(JkKeys::getIsdeleted,Constants.ZERO).last("limit 1")); |
| | | if(Objects.nonNull(rfidKeys)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前RFID标签已被钥匙["+rfidKeys.getCode()+"]使用!"); |
| | | } |
| | | LoginUserInfo loginUserInfo = jkKeys.getLoginUserInfo(); |
| | | jkKeys.setEditDate(new Date()); |
| | | jkKeys.setEditor(loginUserInfo.getId()); |
| | | jkKeysMapper.updateById(jkKeys); |
| | | } |
| | | |
| | |
| | | IPage<JkKeys> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<JkKeys> queryWrapper = new QueryWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(JkKeys::getId, pageWrap.getModel().getId()); |
| | | JkKeys model = pageWrap.getModel(); |
| | | MPJLambdaWrapper<JkKeys> wrapper = new MPJLambdaWrapper<JkKeys>() |
| | | .selectAll(JkKeys.class) |
| | | .selectAs(JkCabinetGrid::getCode,JkKeys::getGridCode) |
| | | .selectAs(JkCabinet::getName,JkKeys::getCabinetName) |
| | | .leftJoin(Cars.class,Cars::getId,JkKeys::getCarId) |
| | | .leftJoin(JkCabinetGrid.class,JkCabinetGrid::getKeyId,JkKeys::getId) |
| | | .leftJoin(JkCabinet.class,JkCabinet::getId,JkCabinetGrid::getCabinetId) |
| | | .eq(JkKeys::getIsdeleted,Constants.ZERO) |
| | | .like(StringUtils.isNotBlank(model.getCode()),JkKeys::getCode,model.getCode()) |
| | | .like(StringUtils.isNotBlank(model.getCarCode()),JkKeys::getCarCode,model.getCode()); |
| | | IPage<JkKeys> iPage = jkKeysMapper.selectJoinPage(page,JkKeys.class,wrapper); |
| | | for (JkKeys jkKeys:iPage.getRecords()) { |
| | | jkKeys.setIsBinding(StringUtils.isBlank(jkKeys.getGridCode())?Constants.ZERO:Constants.ONE); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.lambda().eq(JkKeys::getCreator, pageWrap.getModel().getCreator()); |
| | | return PageData.from(iPage); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(JkKeys::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.lambda().le(JkKeys::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | } |
| | | if (pageWrap.getModel().getEditor() != null) { |
| | | queryWrapper.lambda().eq(JkKeys::getEditor, pageWrap.getModel().getEditor()); |
| | | } |
| | | if (pageWrap.getModel().getEditDate() != null) { |
| | | queryWrapper.lambda().ge(JkKeys::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.lambda().le(JkKeys::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | } |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(JkKeys::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getInfo() != null) { |
| | | queryWrapper.lambda().eq(JkKeys::getInfo, pageWrap.getModel().getInfo()); |
| | | } |
| | | if (pageWrap.getModel().getCode() != null) { |
| | | queryWrapper.lambda().eq(JkKeys::getCode, pageWrap.getModel().getCode()); |
| | | } |
| | | if (pageWrap.getModel().getCarCode() != null) { |
| | | queryWrapper.lambda().eq(JkKeys::getCarCode, pageWrap.getModel().getCarCode()); |
| | | } |
| | | if (pageWrap.getModel().getCarId() != null) { |
| | | queryWrapper.lambda().eq(JkKeys::getCarId, pageWrap.getModel().getCarId()); |
| | | } |
| | | if (pageWrap.getModel().getRfidLable() != null) { |
| | | queryWrapper.lambda().eq(JkKeys::getRfidLable, pageWrap.getModel().getRfidLable()); |
| | | } |
| | | if (pageWrap.getModel().getRoleType() != null) { |
| | | queryWrapper.lambda().eq(JkKeys::getRoleType, pageWrap.getModel().getRoleType()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(JkKeys::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | return PageData.from(jkKeysMapper.selectPage(page, queryWrapper)); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public long count(JkKeys jkKeys) { |
| | |
| | | if(Objects.nonNull(deptIdList)){ |
| | | List<Company> companyList = companyMapper.selectList(new QueryWrapper<Company>().lambda().in(Company::getErpId,deptIdList) |
| | | .eq(Company::getType,Constants.ONE).eq(Company::getIsdeleted,Constants.ZERO) |
| | | // .isNotNull(Company::getHkId) 暂时无法同步开航 先注释 |
| | | // .isNotNull(Company::getHkId) 暂时无法同步海康 先注释 |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(companyList)){ |
| | | member.setHkOrgId(companyList.get(Constants.ZERO).getHkId()); |