| | |
| | | import com.ruoyi.system.vo.CheckAcceptRecordVO; |
| | | import com.ruoyi.system.vo.TContractVO; |
| | | import com.ruoyi.web.controller.tool.NumberToChineseUtils; |
| | | import com.ruoyi.web.controller.tool.TencentCosUtil; |
| | | import com.ruoyi.web.controller.tool.WordUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | |
| | | } |
| | | @Autowired |
| | | private WordUtil wordUtil; |
| | | @Autowired |
| | | private TencentCosUtil tencentCosUtil; |
| | | @ApiOperation(value = "生成合同附件") |
| | | @PostMapping("/set") |
| | | @Log(title = "生成合同附件", businessType = BusinessType.EXPORT) |
| | |
| | | fill(templateParam, "checkTime", ""); |
| | | } |
| | | |
| | | String url = ""; |
| | | if (StringUtils.isNotEmpty(contract.getSignature())){ |
| | | url = tencentCosUtil.downLoadFileImg(contract.getSignature()); |
| | | } |
| | | |
| | | |
| | | return wordUtil.generatePdf( |
| | | "/usr/local/project/file/", |
| | | templateFileName, |
| | | templateParam, |
| | | "租赁合同", |
| | | "/usr/local/project/file/"); |
| | | "/usr/local/project/file/",url); |
| | | } |
| | | |
| | | private BigDecimal extracted(TContract contract,TContractDTO dto) { |
| | | TContractRentType tContractRentType = null; |
| | | if (contract.getIsIncreasing()){ |
| | | tContractRentType = new TContractRentType(); |
| | | tContractRentType.setContractId(contract.getId()); |
| | | tContractRentType.setIncreasingDecreasing(dto.getIncreasingDecreasing()); |
| | | tContractRentType.setIncreasingDecreasingType(dto.getIncreasingDecreasingType()); |
| | | tContractRentType.setNumericalValue(dto.getNumericalValue()); |
| | | tContractRentType.setChangeTime(dto.getChangeTime()); |
| | | tContractRentType.setCycleTime(dto.getCycleTime()); |
| | | tContractRentType = contractRentTypeService.lambdaQuery().eq(TContractRentType::getContractId, contract.getId()) |
| | | .last("limit 1").one(); |
| | | if (tContractRentType==null){ |
| | | tContractRentType = new TContractRentType(); |
| | | tContractRentType.setContractId(contract.getId()); |
| | | tContractRentType.setIncreasingDecreasing(dto.getIncreasingDecreasing()); |
| | | tContractRentType.setIncreasingDecreasingType(dto.getIncreasingDecreasingType()); |
| | | tContractRentType.setNumericalValue(dto.getNumericalValue()); |
| | | tContractRentType.setChangeTime(dto.getChangeTime()); |
| | | tContractRentType.setCycleTime(dto.getCycleTime()); |
| | | } |
| | | } |
| | | // 生成第一笔账单 |
| | | // 第一次应缴费日期 |
| | |
| | | @PostMapping("/generateContractPreview") |
| | | public R<String> generateContractPreview(@RequestBody TContractDTO dto) |
| | | { |
| | | String contractName = dto.getContractName(); |
| | | if (StringUtils.isEmpty(contractName)){ |
| | | return R.fail("合同名称不能为空"); |
| | | } |
| | | LocalDateTime startTime = dto.getStartTime(); |
| | | if (startTime == null){ |
| | | return R.fail("合同生效日期不能为空"); |
| | | } |
| | | LocalDateTime endTime = dto.getEndTime(); |
| | | if (endTime == null){ |
| | | return R.fail("合同生效日期不能为空"); |
| | | } |
| | | |
| | | BigDecimal monthRent = dto.getMonthRent(); |
| | | if (monthRent == null){ |
| | | return R.fail("月租金不能为空"); |
| | | } |
| | | |
| | | BigDecimal deposit = dto.getDeposit(); |
| | | if (deposit == null){ |
| | | return R.fail("押金不能为空"); |
| | | } |
| | | |
| | | String payType = dto.getPayType(); |
| | | if (StringUtils.isEmpty(payType)){ |
| | | return R.fail("租金支付方式不能为空"); |
| | | } |
| | | |
| | | LocalDateTime startPayTime = dto.getStartPayTime(); |
| | | if (startPayTime == null){ |
| | | return R.fail("开始计费日期不能为空"); |
| | | } |
| | | |
| | | String partyOneName = dto.getPartyOneName(); |
| | | if (StringUtils.isEmpty(partyOneName)){ |
| | | return R.fail("甲方名称不能为空"); |
| | | } |
| | | |
| | | String partyOnePerson = dto.getPartyOnePerson(); |
| | | if (StringUtils.isEmpty(partyOnePerson)){ |
| | | return R.fail("甲方联系人不能为空"); |
| | | } |
| | | |
| | | String partyOnePhone = dto.getPartyOnePhone(); |
| | | if (StringUtils.isEmpty(partyOnePhone)){ |
| | | return R.fail("甲方联系电话不能为空"); |
| | | } |
| | | |
| | | String partyTwoName = dto.getPartyTwoName(); |
| | | if (StringUtils.isEmpty(partyTwoName)){ |
| | | return R.fail("乙方名称不能为空"); |
| | | } |
| | | String partyTwoPerson = dto.getPartyTwoPerson(); |
| | | if (StringUtils.isEmpty(partyTwoPerson)){ |
| | | return R.fail("乙方联系人不能为空"); |
| | | } |
| | | String partyTwoPhone = dto.getPartyTwoPhone(); |
| | | if (StringUtils.isEmpty(partyTwoPhone)){ |
| | | return R.fail("乙方联系电话不能为空"); |
| | | } |
| | | |
| | | TContract contract = new TContract(); |
| | | BeanUtil.copyProperties(dto,contract); |
| | | return R.ok(generateContract(contract,dto)); |