租赁协议

This commit is contained in:
liang.chao 2024-12-17 20:08:40 +08:00
parent 6db52fe17d
commit 7403872145
1 changed files with 18 additions and 16 deletions

View File

@ -45,10 +45,8 @@ import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.*;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map;
/** /**
* @Authorliang.chao * @Authorliang.chao
@ -343,7 +341,7 @@ public class OrderController extends BaseController {
bmContract.setStatus(1); bmContract.setStatus(1);
List<BmContract> list = bmContractService.list(bmContract); List<BmContract> list = bmContractService.list(bmContract);
String content = list.get(0).getContent(); String content = list.get(0).getContent();
if (StringUtils.isBlank(content)){ if (StringUtils.isBlank(content)) {
content = bmContractService.lisTemplate(bmContract).get(0).getContent(); content = bmContractService.lisTemplate(bmContract).get(0).getContent();
} }
StrSubstitutor sub = new StrSubstitutor(replacements); StrSubstitutor sub = new StrSubstitutor(replacements);
@ -352,11 +350,12 @@ public class OrderController extends BaseController {
} }
@ApiOperation(value = "购物车协议(查看)") @ApiOperation(value = "购物车协议(查看)")
@GetMapping("/bookCarAgreement") @PostMapping("/bookCarAgreement")
public AjaxResult getbookCarAgreement(OrderInfoDto orderInfoDto, Map<String, Object> replacements) throws ParseException, IOException { public AjaxResult getbookCarAgreement(@RequestBody OrderInfoDto orderInfoDto) throws ParseException {
if (orderInfoDto != null) { if (orderInfoDto != null) {
SimpleDateFormat inputFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH); SimpleDateFormat inputFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Map<String, String> replacements = new HashMap<>();
//装备所属公司 //装备所属公司
replacements.put("czCompanyName", orderInfoDto.getCzcompanyName()); replacements.put("czCompanyName", orderInfoDto.getCzcompanyName());
//承租方所属公司 //承租方所属公司
@ -374,16 +373,19 @@ public class OrderController extends BaseController {
orderDetail += "<p><br>机具名称:" + orderDetailDto.getDeviceName() + "<br>租期:" + beginTime + "" + endTime + "<br>天数:" + orderDetailDto.getDays() + "天 <br>租金:" + orderDetailDto.getDayLeasePrice() + "元/天<br>数量:" + orderDetailDto.getNum() + "</p>"; orderDetail += "<p><br>机具名称:" + orderDetailDto.getDeviceName() + "<br>租期:" + beginTime + "" + endTime + "<br>天数:" + orderDetailDto.getDays() + "天 <br>租金:" + orderDetailDto.getDayLeasePrice() + "元/天<br>数量:" + orderDetailDto.getNum() + "</p>";
} }
replacements.put("orderTable", orderDetail); replacements.put("orderTable", orderDetail);
}
BmContract bmContract = new BmContract(); BmContract bmContract = new BmContract();
bmContract.setStatus(1); bmContract.setStatus(1);
List<BmContract> list = bmContractService.list(bmContract); List<BmContract> list = bmContractService.list(bmContract);
String content = list.get(0).getContent(); String content = list.get(0).getContent();
if (StringUtils.isBlank(content)){ if (StringUtils.isBlank(content)) {
content = bmContractService.lisTemplate(bmContract).get(0).getContent(); content = bmContractService.lisTemplate(bmContract).get(0).getContent();
} }
StrSubstitutor sub = new StrSubstitutor(replacements); StrSubstitutor sub = new StrSubstitutor(replacements);
String result = sub.replace(content); String result = sub.replace(content);
return AjaxResult.success(result); return AjaxResult.success(result);
} else {
return AjaxResult.error("参数错误");
}
} }
} }