| | |
| | | private final StateHouseholdService stateHouseholdService; |
| | | private final StateProcessTemplateService stateProcessTemplateService; |
| | | private final StateProjectService stateProjectService; |
| | | |
| | | // 新增协议 |
| | | @PostMapping(UrlConstants.STATE_AGREEMENT_SAVE) |
| | | public AjaxResult<Boolean> createAgreement(@RequestBody StateAgreementSaveBO saveBO) { |
| | | |
| | | //根据协议类型和房产id进行排重 每个协议只能存在一份 |
| | | LambdaQueryWrapper<StateAgreement> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(StateAgreement::getAgreementFileType, saveBO.getAgreementFileType()); |
| | |
| | | if (ObjectUtil.isNotEmpty(stateAgreement) && Objects.isNull(saveBO.getId())) { |
| | | throw new GlobalException("每种协议类型只能存在一份"); |
| | | } |
| | | |
| | | if (!CollectionUtils.isEmpty(saveBO.getFileBOList())) { |
| | | saveBO.setFileUrl(JSON.toJSONString(saveBO.getFileBOList())); |
| | | String appendFileName = saveBO.getFileBOList().stream().map(FileBO::getOriginalFilename).collect(Collectors.joining(",")); |
| | |
| | | } |
| | | return AjaxResult.success(stateAgreementService.saveOrUpdate(saveBO)); |
| | | } |
| | | |
| | | // 模拟转征收 |
| | | @PostMapping(UrlConstants.STATE_AGREEMENT_UPDATE) |
| | | public AjaxResult<Boolean> updateAgreement(@RequestBody UpdateAgreementBO bo) { |
| | | return AjaxResult.success(stateAgreementService.updateStateAgreement(bo.getHouseId())); |
| | | } |
| | | |
| | | // 更新协议 |
| | | @PostMapping(UrlConstants.STATE_AGREEMENT_UPDATE_AGREEMENT) |
| | | public AjaxResult<StateAgreementSaveBO> updateAgreement(@RequestBody StateAgreementSaveBO saveBO) { |
| | | if (!CollectionUtils.isEmpty(saveBO.getFileBOList())) { |
| | |
| | | stateAgreementService.saveOrUpdate(saveBO); |
| | | return AjaxResult.success(saveBO); |
| | | } |
| | | |
| | | // 协议详情 - 编辑 -删除按钮 |
| | | @GetMapping(UrlConstants.STATE_AGREEMENT_DEL) |
| | | public AjaxResult<Boolean> deleteAgreement(@RequestParam String agreementId) { |
| | | StateAgreement stateAgreement = stateAgreementService.getById(agreementId); |
| | |
| | | .set(StateAgreement::getFileUrl, null); |
| | | return AjaxResult.success(stateAgreementService.update(updateWrapper)); |
| | | } |
| | | |
| | | return AjaxResult.success(stateAgreementService.removeById(agreementId)); |
| | | } |
| | | |
| | | // 协议管理 - 页面查询 |
| | | @PostMapping(UrlConstants.STATE_AGREEMENT_LIST) |
| | | public AjaxResult<PageInfo<StateAgreementVO>> listStateAgreement(@RequestBody StateAgreementBO request) { |
| | | return AjaxResult.success(stateAgreementService.listDataByCondition(request)); |
| | | } |
| | | |
| | | // 协议详情 |
| | | @GetMapping(UrlConstants.STATE_AGREEMENT_DETAIL) |
| | | public AjaxResult<List<AgreementDetailVO>> getAgreementDetail(@RequestParam String stateHouseId) { |
| | | return AjaxResult.success(stateAgreementService.listAgreementDetailByHouseId(stateHouseId)); |
| | | } |
| | | |
| | | //生成协议word |
| | | @GetMapping(UrlConstants.STATE_AGREEMENT_GENERATE) |
| | | public void generateAgreementDetail(@RequestParam String stateHouseholdId, @RequestParam String stateAgreementId, HttpServletResponse response) throws Exception { |
| | | public void generateAgreementDetail( |
| | | @RequestParam String stateHouseholdId, |
| | | @RequestParam String stateAgreementId, |
| | | HttpServletResponse response |
| | | ) throws Exception { |
| | | StateAgreementBO request = new StateAgreementBO(); |
| | | request.setStateHouseholdId(stateHouseholdId); |
| | | Map<String, Object> wordData = stateAgreementService.getWordData(stateHouseholdId, stateAgreementId); |
| | |
| | | default: |
| | | templatePath = "templates/word_template.docx"; |
| | | } |
| | | |
| | | |
| | | XWPFDocument document = WordExportUtil.exportWord07(templatePath, wordData); |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | |
| | | processStartBO.setVariable(variable); |
| | | stateProcessTemplateService.start(processStartBO); |
| | | } |
| | | |
| | | return AjaxResult.success(stateAgreementService.saveOrUpdateBatch(agreementList)); |
| | | } |
| | | } |