五、核心代码
5.1 查询合同
@RequestMapping(value = "/getByPage", method = RequestMethod.GET) @ApiOperation(value = "查询合同") public Result<IPage<Agreement>> getByPage(@ModelAttribute Agreement agreement ,@ModelAttribute PageVo page){ QueryWrapper<Agreement> qw = new QueryWrapper<>(); User currUser = securityUtil.getCurrUser(); QueryWrapper<User> userQw = new QueryWrapper<>(); userQw.eq("id",currUser.getId()); userQw.inSql("id","SELECT user_id FROM a_user_role WHERE del_flag = 0 AND role_id = '1536606659751841799'"); if(iUserService.count(userQw) < 1L) { qw.eq("sign_id",currUser.getId()); } if(!ZwzNullUtils.isNull(agreement.getTitle())) { qw.like("title",agreement.getTitle()); } if(!ZwzNullUtils.isNull(agreement.getFirstParty())) { qw.like("first_party",agreement.getFirstParty()); } if(!ZwzNullUtils.isNull(agreement.getSecondParty())) { qw.like("second_party",agreement.getSecondParty()); } if(!ZwzNullUtils.isNull(agreement.getAuditStatus())) { qw.eq("audit_status",agreement.getAuditStatus()); } if(!ZwzNullUtils.isNull(agreement.getSignStatus())) { qw.eq("sign_status",agreement.getSignStatus()); } long zwzNowCuo = System.currentTimeMillis() / 1000; IPage<Agreement> data = iAgreementService.page(PageUtil.initMpPage(page),qw); for (Agreement vo : data.getRecords()) { long cuo = zwzDateToCuo(vo.getDate()); vo.setDateTemp((cuo - zwzNowCuo) / DAY_CUO); } return new ResultUtil<IPage<Agreement>>().setData(data); }
5.2 新增合同
@RequestMapping(value = "/insert", method = RequestMethod.POST) @ApiOperation(value = "新增合同") public Result<Agreement> insert(Agreement agreement){ User currUser = securityUtil.getCurrUser(); agreement.setAuditStatus("未审批"); agreement.setAuditUser(""); agreement.setAuditTime(""); agreement.setSignStatus("未签订"); agreement.setFile2(""); agreement.setSignTime(""); agreement.setSignId(currUser.getId()); agreement.setSignUser(currUser.getNickname()); iAgreementService.saveOrUpdate(agreement); return new ResultUtil<Agreement>().setData(agreement); }
5.3 审批合同
@RequestMapping(value = "/audit", method = RequestMethod.POST) @ApiOperation(value = "审批合同") public Result<Object> audit(@RequestParam String id){ Agreement as = iAgreementService.getById(id); if(as == null) { return ResultUtil.error("合同不存在"); } User currUser = securityUtil.getCurrUser(); as.setAuditStatus("已审批"); as.setAuditTime(DateUtil.now()); as.setAuditUser(currUser.getNickname()); iAgreementService.saveOrUpdate(as); return ResultUtil.success(); }
5.4 驳回合同
@RequestMapping(value = "/notAudit", method = RequestMethod.POST) @ApiOperation(value = "驳回合同") public Result<Object> notAudit(@RequestParam String id){ Agreement as = iAgreementService.getById(id); if(as == null) { return ResultUtil.error("合同不存在"); } User currUser = securityUtil.getCurrUser(); as.setAuditStatus("已驳回"); as.setAuditTime(DateUtil.now()); as.setAuditUser(currUser.getNickname()); iAgreementService.saveOrUpdate(as); return ResultUtil.success(); }
5.5 签订合同
@RequestMapping(value = "/sign", method = RequestMethod.POST) @ApiOperation(value = "签订合同") public Result<Object> sign(@RequestParam String id,@RequestParam String fileUrl){ Agreement as = iAgreementService.getById(id); if(as == null) { return ResultUtil.error("合同不存在"); } as.setSignStatus("已签订"); as.setFile2(fileUrl); as.setSignTime(DateUtil.now()); iAgreementService.saveOrUpdate(as); return ResultUtil.success(); }
六、免责说明
- 本项目仅供个人学习使用,商用授权请联系博主,否则后果自负。
- 博主拥有本软件构建后的应用系统全部内容所有权及独立的知识产权,拥有最终解释权。
- 如有问题,欢迎在仓库 Issue 留言,看到后会第一时间回复,相关意见会酌情考虑,但没有一定被采纳的承诺或保证。
下载本系统代码或使用本系统的用户,必须同意以下内容,否则请勿下载!
- 出于自愿而使用/开发本软件,了解使用本软件的风险,且同意自己承担使用本软件的风险。
- 利用本软件构建的网站的任何信息内容以及导致的任何版权纠纷和法律争议及后果和博主无关,博主对此不承担任何责任。
- 在任何情况下,对于因使用或无法使用本软件而导致的任何难以合理预估的损失(包括但不仅限于商业利润损失、业务中断与业务信息丢失),博主概不承担任何责任。
- 必须了解使用本软件的风险,博主不承诺提供一对一的技术支持、使用担保,也不承担任何因本软件而产生的难以预料的问题的相关责任。