| | |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.directive.entity.Directive; |
| | | import org.springblade.modules.directive.entity.DirectiveFile; |
| | | import org.springblade.modules.directive.service.DirectiveService; |
| | | import org.springblade.modules.directive.vo.DirectiveVo; |
| | | import org.springblade.modules.workreport.vo.WorkReportVo; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Date; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 自定义分页--接收到的指令 |
| | | * @param query page,size |
| | | * @param directive 指令对象 |
| | | */ |
| | | @GetMapping("/pageReply") |
| | | public R<IPage<DirectiveVo>> pageReply(DirectiveVo directive, Query query) { |
| | | IPage<DirectiveVo> pages = directiveService.selectDirectiveReplyPage(Condition.getPage(query), directive); |
| | | // List<WorkReportVo> records = pages.getRecords(); |
| | | // for (WorkReportVo record : records) { |
| | | // record.setReplyRealName(getReplyRealName(record)); |
| | | // record.setReplyDeptName(getReplyDeptName(record)); |
| | | // } |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | * @param directive 指令信息对象 |
| | | */ |
| | |
| | | |
| | | |
| | | /** |
| | | * 指令信息新增,同时新增到轨迹表中 |
| | | * 指令信息新增,同时新增图片到指令文件表中 |
| | | * @param directive 指令信息对象 |
| | | */ |
| | | @PostMapping("/saveDirectiveAndLocus") |
| | | public R saveDirectiveAndLocus(@RequestBody Directive directive) { |
| | | //先查询是否已有指令信息,如果有,则更新,没有则插入 |
| | | DirectiveVo directiveVo = directiveService.selectDirectiveInfo(directive); |
| | | @PostMapping("/saveDirectiveAndFile") |
| | | public R saveDirectiveAndFile(@RequestBody DirectiveVo directive) { |
| | | //新增指令信息 |
| | | boolean status = false; |
| | | status = directiveService.save(directive); |
| | | if (status){ |
| | | //新增图片 |
| | | if (null!=directive.getUrl() && directive.getUrl()!=""){ |
| | | String[] directiveUrl = directive.getUrl().split(","); |
| | | for (String url : directiveUrl) { |
| | | DirectiveFile directiveFile = new DirectiveFile(); |
| | | directiveFile.setType(1); |
| | | directiveFile.setDirectiveId(directive.getId()); |
| | | directiveFile.setUrl(url); |
| | | status = directiveService.saveDirectiveFile(directiveFile); |
| | | if (!status){ |
| | | return R.status(false); |
| | | } |
| | | } |
| | | } |
| | | return R.status(status); |
| | | } |
| | | //返回数据 |
| | | return R.status(false); |
| | | return R.status(status); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 指令信息修改,同时新增图片到指令文件表中 |
| | | * @param directive 指令信息对象 |
| | | */ |
| | | @PostMapping("/updateDirectiveAndFile") |
| | | public R updateDirectiveAndFile(@RequestBody DirectiveVo directive) { |
| | | //新增指令信息 |
| | | boolean update = directiveService.updateById(directive); |
| | | boolean status = false; |
| | | if (update){ |
| | | //先删除图片 |
| | | int i = directiveService.deleleByDirectiveId(directive.getId()); |
| | | //新增图片 |
| | | if (null!=directive.getUrl() && directive.getUrl()!=""){ |
| | | String[] directiveUrl = directive.getUrl().split(","); |
| | | for (String url : directiveUrl) { |
| | | DirectiveFile directiveFile = new DirectiveFile(); |
| | | directiveFile.setType(1); |
| | | directiveFile.setDirectiveId(directive.getId()); |
| | | directiveFile.setUrl(url); |
| | | status = directiveService.saveDirectiveFile(directiveFile); |
| | | if (!status){ |
| | | R.status(false); |
| | | } |
| | | } |
| | | } |
| | | return R.status(status); |
| | | } |
| | | //返回数据 |
| | | return R.status(status); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/remove") |
| | | public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) { |
| | | //图片也删除 |
| | | if (null!=ids && ids!=""){ |
| | | String[] directiveIds = ids.split(","); |
| | | for (String directiveId : directiveIds) { |
| | | directiveService.deleleByDirectiveId(Long.parseLong(directiveId)); |
| | | } |
| | | } |
| | | return R.status(directiveService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |