| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.common.utils.arg; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.FTP.FtpUtil; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.sql.Wrapper; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | |
| | | @GetMapping("/pageReply") |
| | | public R<IPage<WorkReportVo>> pageReply(WorkReportVo workReport, Query query) { |
| | | IPage<WorkReportVo> pages = workReportService.selectWorkReplyPage(Condition.getPage(query), workReport); |
| | | // List<WorkReportVo> records = pages.getRecords(); |
| | | // for (WorkReportVo record : records) { |
| | | // record.setReplyRealName(getReplyRealName(record)); |
| | | // record.setReplyDeptName(getReplyDeptName(record)); |
| | | // } |
| | | return R.data(pages); |
| | | } |
| | | |
| | |
| | | * @param workReport 工作汇报信息对象 |
| | | */ |
| | | @PostMapping("/submit") |
| | | public R submit(@RequestBody WorkReport workReport) { |
| | | if (null!=workReport.getId()){ |
| | | workReport.setReplyTime(new Date()); |
| | | workReport.setReplyDeptIds(getReplyDeptIds(workReport.getReceivedIds())); |
| | | }else { |
| | | public R submit(@RequestBody WorkReport workReport){ |
| | | boolean status = false; |
| | | if (null==workReport.getId()){ |
| | | workReport.setReportTime(new Date()); |
| | | workReport.setReplyDeptIds(getReplyDeptIds(workReport.getReceivedIds())); |
| | | //新增 |
| | | status = workReportService.save(workReport); |
| | | |
| | | //数据同步 |
| | | String s1 = |
| | | "insert into sys_work_report(id,type,content,work_desc,report_time,received_ids,dept_id,reply_dept_ids,category,user_id) " + |
| | | "values(" + "'" + workReport.getId() + "'" + "," + |
| | | "'" + workReport.getType() + "'" + "," + |
| | | "'" + workReport.getContent() + "'" + "," + |
| | | "'" + workReport.getWorkDesc() + "'" + "," + |
| | | "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(workReport.getReportTime()) + "'" + "," + |
| | | "'" + workReport.getReceivedIds() + "'" + "," + |
| | | "'" + workReport.getDeptId() + "'" + "," + |
| | | "'" + workReport.getReplyDeptIds() + "'" + "," + |
| | | "'" + workReport.getCategory() + "'" + "," + |
| | | "'" +workReport.getUserId() + "'" + ")"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | }else { |
| | | workReport.setReplyDeptIds(getReplyDeptIds(workReport.getReceivedIds())); |
| | | if (null==workReport.getReplyTime()){ |
| | | workReport.setReplyTime(new Date()); |
| | | } |
| | | |
| | | //修改 |
| | | status = workReportService.updateById(workReport); |
| | | |
| | | //内网同步 |
| | | String s1 = |
| | | "update sys_work_report set type = " + "'" + workReport.getType() + "'" + |
| | | ",content = " + "'" + workReport.getContent() + "'" + |
| | | ",work_desc = " + "'" + workReport.getWorkDesc() + "'" + |
| | | ",received_ids = " + "'" + workReport.getReceivedIds() + "'" + |
| | | ",reply_content = " + "'" + workReport.getReplyContent() + "'" + |
| | | ",reply_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(workReport.getReplyTime()) + "'" + |
| | | ",dept_id = " + "'" + workReport.getDeptId() + "'" + |
| | | ",reply_dept_ids = " + "'" + workReport.getReplyDeptIds() + "'" + |
| | | ",category = " + "'" + workReport.getCategory() + "'" + |
| | | ",user_id = " + "'" + workReport.getUserId() + "'" + |
| | | " " +"where id = " + "'" + workReport.getId() + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | } |
| | | return R.status(workReportService.saveOrUpdate(workReport)); |
| | | return R.status(status); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/remove") |
| | | public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) { |
| | | //内网删除 |
| | | List<Long> list = Func.toLongList(ids); |
| | | list.forEach(id ->{ |
| | | //内网同步 |
| | | String s1 = "delete from sys_work_report where id = " + "'" + id + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | }); |
| | | return R.status(workReportService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | |
| | | // user.setCardid(idCardNo); |
| | | // User userDetail = userService.getOne(Condition.getQueryWrapper(user)); |
| | | User userDetail = userService.getById(userId); |
| | | replyRealNameInfo = replyRealNameInfo.append(userDetail.getRealName()).append(","); |
| | | if (null!=userDetail) { |
| | | replyRealNameInfo = replyRealNameInfo.append(userDetail.getRealName()).append(","); |
| | | } |
| | | } |
| | | //截取 |
| | | return replyRealNameInfo.substring(0, replyRealNameInfo.length() - 1); |
| | | if (replyRealNameInfo.length()>0) { |
| | | return replyRealNameInfo.substring(0, replyRealNameInfo.length() - 1); |
| | | } |
| | | return replyRealNameInfo.toString(); |
| | | } |
| | | |
| | | } |