diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/book/controller/BookCarController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/book/controller/BookCarController.java index d2f98d1..e2adaae 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/book/controller/BookCarController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/book/controller/BookCarController.java @@ -6,6 +6,8 @@ import com.bonus.common.core.web.page.TableDataInfo; import com.bonus.material.book.domain.BookCarDetailDto; import com.bonus.material.book.domain.BookCarInfoDto; import com.bonus.material.book.service.BookCarService; +import com.bonus.material.contract.domain.BmContract; +import com.bonus.material.contract.service.BmContractService; import com.bonus.material.device.domain.vo.DevInfoVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -26,6 +28,9 @@ public class BookCarController extends BaseController { @Resource private BookCarService bookCarService; + @Resource + private BmContractService bmContractService; + /** * 添加预约车 */ @@ -64,4 +69,12 @@ public class BookCarController extends BaseController { return bookCarService.getBookCarDetailByMaId(devInfo); } + + @ApiOperation(value = "购物车免责声明") + @GetMapping("/disclaimer") + public AjaxResult disclaimer() { + BmContract bmContract = bmContractService.disclaimer(); + return AjaxResult.success(bmContract); + } + } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/mapper/BmContractMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/mapper/BmContractMapper.java index 7fa8d63..876c406 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/mapper/BmContractMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/mapper/BmContractMapper.java @@ -27,4 +27,6 @@ public interface BmContractMapper { Integer updateStatusOther(BmContract bmContract); List lisTemplate(BmContract bmContract); + + BmContract disclaimer(); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/service/BmContractService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/service/BmContractService.java index 5970dd5..d8bfe48 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/service/BmContractService.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/service/BmContractService.java @@ -22,4 +22,6 @@ public interface BmContractService { Integer updateStatus(BmContract bmContract); List lisTemplate(BmContract bmContract); + + BmContract disclaimer(); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/service/impl/BmContractServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/service/impl/BmContractServiceImpl.java index 9b1cfcf..09ad721 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/service/impl/BmContractServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/contract/service/impl/BmContractServiceImpl.java @@ -120,6 +120,11 @@ public class BmContractServiceImpl implements BmContractService { return bmContractMapper.lisTemplate(bmContract); } + @Override + public BmContract disclaimer() { + return bmContractMapper.disclaimer(); + } + private String getString() { //根据前台传过来的数据,生成需求编号 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java index 37004d2..08bdc0b 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/controller/OrderController.java @@ -20,6 +20,7 @@ import com.bonus.system.api.domain.SysFile; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.text.StrSubstitutor; import org.apache.poi.xwpf.usermodel.*; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; @@ -173,7 +174,7 @@ public class OrderController extends BaseController { } } - @ApiOperation(value = "租赁协议(查看)") + /*@ApiOperation(value = "租赁协议(查看)") @GetMapping("/leaseAgreement") public AjaxResult getleaseAgreement(String orderId, Map replacements) throws IOException, ParseException { OrderInfoDto orderInfoDto = orderService.getAgreementByOrderId(orderId); @@ -220,5 +221,41 @@ public class OrderController extends BaseController { MultipartFile file = new MockMultipartFile("contract", "contract.docx", MediaType.APPLICATION_OCTET_STREAM_VALUE, wordBytes); return sysFileService.upload(file); + }*/ + + + @ApiOperation(value = "租赁协议(查看)") + @GetMapping("/leaseAgreement") + public AjaxResult getleaseAgreement(String orderId, Map replacements) throws ParseException { + OrderInfoDto orderInfoDto = orderService.getAgreementByOrderId(orderId); + List orderDetailsByOrderId = orderMapper.selectOrderDetailsByOderId(orderId); + String dateStr = orderInfoDto.getOrderTime().toString(); + SimpleDateFormat inputFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH); + SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + Date date = inputFormat.parse(dateStr); + String formattedDate = outputFormat.format(date); + //订单日期 + replacements.put("${orderTime}", formattedDate); + //装备所属公司 + replacements.put("${czcompanyName}", orderInfoDto.getCzcompanyName()); + //承租方所属公司 + replacements.put("${companyName}", orderInfoDto.getCompanyName()); + //订单金额 + replacements.put("${cost}", orderInfoDto.getCost().toString()); + //订单详情 + String orderDetail = ""; + for (OrderDetailDto orderDetailDto : orderDetailsByOrderId) { + orderDetail += "

机具名称:" + orderDetailDto.getDeviceName() + "  租期:" + orderDetailDto.getRentBeginTime() + "至" + orderDetailDto.getRentEndTime() + "  天数:" + orderDetailDto.getDays() + "天  租金:" + orderDetailDto.getDayLeasePrice() + "元/天  数量:" + orderDetailDto.getNum() + "

"; + } + replacements.put("${orderTable}", orderDetail); + + BmContract bmContract = new BmContract(); + bmContract.setStatus(1); + List list = bmContractService.list(bmContract); + String content = list.get(0).getContent(); + StrSubstitutor sub = new StrSubstitutor(replacements); + String result = sub.replace(content); + return AjaxResult.success(result); } } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/controller/ReplyController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/controller/ReplyController.java index 44cf6f7..860ed94 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/controller/ReplyController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/controller/ReplyController.java @@ -52,4 +52,15 @@ public class ReplyController extends BaseController { } } + @PostMapping("/del") + @ApiOperation("删除快捷回复") + public AjaxResult del(@RequestBody BmReply bmReply) { + Integer i = replyService.del(bmReply); + if (i > 0) { + return AjaxResult.success("删除成功"); + } else { + return AjaxResult.error("删除失败"); + } + } + } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/mapper/ReplyMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/mapper/ReplyMapper.java index 96dffec..3e8a6d7 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/mapper/ReplyMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/mapper/ReplyMapper.java @@ -14,4 +14,6 @@ public interface ReplyMapper { Integer add(BmReply bmReply); Integer edit(BmReply bmReply); + + Integer del(BmReply bmReply); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/service/ReplyService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/service/ReplyService.java index 57ae288..94c4745 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/service/ReplyService.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/service/ReplyService.java @@ -14,4 +14,6 @@ public interface ReplyService { Integer add(BmReply bmReply); Integer edit(BmReply bmReply); + + Integer del(BmReply bmReply); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/service/impl/ReplyServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/service/impl/ReplyServiceImpl.java index afc203e..5c1ef64 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/service/impl/ReplyServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/reply/service/impl/ReplyServiceImpl.java @@ -35,4 +35,9 @@ public class ReplyServiceImpl implements ReplyService { bmReply.setUpdater(SecurityUtils.getLoginUser().getUserid().intValue()); return replyMapper.edit(bmReply); } + + @Override + public Integer del(BmReply bmReply) { + return replyMapper.del(bmReply); + } } diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/contract/BmContractMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/contract/BmContractMapper.xml index 42dcf73..423fe57 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/contract/BmContractMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/contract/BmContractMapper.xml @@ -54,4 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + \ No newline at end of file diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/reply/ReplyMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/reply/ReplyMapper.xml index 31cc7da..d9aa5e0 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/reply/ReplyMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/reply/ReplyMapper.xml @@ -23,6 +23,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + + delete from bm_reply where id = #{id} +