From 6f03c54bb96026ee621a372d19f0b4981dbd08a9 Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Thu, 19 Dec 2024 10:21:02 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E7=BB=BC=E5=90=88=E6=9F=A5=E8=AF=A2-?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E4=BF=A1=E6=81=AF=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ComprehensiveController.java | 8 ++ .../material/order/service/OrderService.java | 2 + .../order/service/impl/OrderServiceImpl.java | 79 +++++++++++++++++++ 3 files changed, 89 insertions(+) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/comprehensive/controller/ComprehensiveController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/comprehensive/controller/ComprehensiveController.java index 4059af1..7a589ab 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/comprehensive/controller/ComprehensiveController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/comprehensive/controller/ComprehensiveController.java @@ -6,6 +6,7 @@ import com.bonus.material.comprehensive.entity.RentDetailDto; import com.bonus.material.device.domain.DevInfo; import com.bonus.material.device.domain.vo.DevInfoVo; import com.bonus.material.device.service.DevInfoService; +import com.bonus.material.order.domain.OrderInfoDto; import com.bonus.material.order.service.OrderService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -44,4 +45,11 @@ public class ComprehensiveController extends BaseController { List list = orderService.getRentDetails(devInfo); return AjaxResult.success(getDataTable(list)); } + @ApiOperation(value = "综合查询-订单信息查询") + @GetMapping("/orderDetails") + public AjaxResult getOrderDetails(OrderInfoDto orderInfoDto) { + startPage(); + List list = orderService.getOrderInfos(orderInfoDto); + return AjaxResult.success(getDataTable(list)); + } } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/OrderService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/OrderService.java index 353bd34..c58c9c4 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/OrderService.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/OrderService.java @@ -26,4 +26,6 @@ public interface OrderService { OrderInfoDto getAgreementByOrderId(String orderId); List getRentDetails(DevInfoVo devInfo); + + List getOrderInfos(OrderInfoDto orderInfoDto); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java index 68b7bcd..36ee2d0 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java @@ -234,4 +234,83 @@ public class OrderServiceImpl implements OrderService { public List getRentDetails(DevInfoVo devInfo) { return orderMapper.getRentDetails(devInfo); } + + @Override + public List getOrderInfos(OrderInfoDto devInfo) { + List orderInfoDtos = orderMapper.getOrderDetails(devInfo); + for (OrderInfoDto dto : orderInfoDtos) { + dto.setPhoneNumber(Sm4Utils.decrypt(dto.getPhoneNumber())); + List list = new ArrayList(); + String ids = dto.getIds(); + for (String id : ids.split(",")) { + OrderDetailDto orderDetailDto = orderMapper.selectOrderDetailsById(id); + list.add(orderDetailDto); + } + BigDecimal totalRentalPrice = BigDecimal.ZERO; + BigDecimal totalReliefPrice = BigDecimal.ZERO; + for (OrderDetailDto detailDto : list) { + if (Objects.nonNull(detailDto) && String.valueOf(OrderStatusEnum.ORDER_FINISHED.getStatus()).equals(detailDto.getOrderStatus())) { + detailDto.setDays(detailDto.getDateDays() == null ? detailDto.getDays() : String.valueOf(detailDto.getDateDays())); + if (detailDto.getChangeCost() != null) { + totalRentalPrice = totalRentalPrice.add(detailDto.getChangeCost()); + } else { + if (detailDto.getDateDays() != null && detailDto.getDateDays() > 0 + && detailDto.getDayLeasePrice() != null) { + BigDecimal newTotalPrice = detailDto.getDayLeasePrice().multiply(new BigDecimal(detailDto.getDateDays())) + .setScale(2, RoundingMode.HALF_UP); + totalRentalPrice = totalRentalPrice.add(newTotalPrice); + detailDto.setCosts(newTotalPrice); + } + } + if (detailDto.getReliefChangeCost() != null) { + totalReliefPrice.add(detailDto.getReliefChangeCost()); + } else if (detailDto.getReliefCost() != null) { + totalReliefPrice.add(detailDto.getReliefCost()); + } + } + } + dto.setTotalRentalPrice(totalRentalPrice); + dto.setDetailsList(list); + Optional minOrderStatus = list.stream() + .min((p1, p2) -> Integer.compare(Integer.parseInt(p1.getOrderStatus()), Integer.parseInt(p2.getOrderStatus()))); + if (minOrderStatus.isPresent()) { + dto.setOrderStatus(minOrderStatus.get().getOrderStatus()); + } + //根据订单id去lease_repair_record表中查询是否已填写退租检修信息 + int count = leaseRepairRecordMapper.selectLeaseContent(String.valueOf(dto.getOrderId())); + if (count > 0) { + dto.setIsLeaseContent(1); + } else { + dto.setIsLeaseContent(0); + } + dto.setPartBacked(list.stream().anyMatch(o -> OrderStatusEnum.ORDER_UNDER_LEASE.getStatus().toString().equals(o.getOrderStatus()))); + //TODO计算总费用 + LeaseRepair leaseRepair = new LeaseRepair(); + leaseRepair.setOrderId(String.valueOf(dto.getOrderId())); + List leaseRepairRecords = leaseRepairRecordMapper.getLeaseRepairRecordList(leaseRepair); + BigDecimal totalRepairScrapLossPrice = BigDecimal.ZERO; + if (!CollectionUtils.isEmpty(leaseRepairRecords)) { + for (LeaseRepairRecord leaseRepairRecord : leaseRepairRecords) { + if (leaseRepairRecord.getRepairChangePrice() != null) { + totalRepairScrapLossPrice = totalRepairScrapLossPrice.add(leaseRepairRecord.getRepairChangePrice()); + } else if (leaseRepairRecord.getRepairPrice() != null) { + totalRepairScrapLossPrice = totalRepairScrapLossPrice.add(leaseRepairRecord.getRepairPrice()); + } + if (leaseRepairRecord.getScrapChangePrice() != null) { + totalRepairScrapLossPrice = totalRepairScrapLossPrice.add(leaseRepairRecord.getScrapChangePrice()); + } else if (leaseRepairRecord.getScrapPrice() != null) { + totalRepairScrapLossPrice = totalRepairScrapLossPrice.add(leaseRepairRecord.getScrapPrice()); + } + if (leaseRepairRecord.getLossChangePrice() != null) { + totalRepairScrapLossPrice = totalRepairScrapLossPrice.add(leaseRepairRecord.getLossChangePrice()); + } else if (leaseRepairRecord.getLossPrice() != null) { + totalRepairScrapLossPrice = totalRepairScrapLossPrice.add(leaseRepairRecord.getLossPrice()); + } + } + dto.setTotalRepairScrapLossPrice(totalRepairScrapLossPrice); + } + dto.setTotalRealPrice(BigDecimal.ZERO.add(totalRentalPrice).add(totalRepairScrapLossPrice).subtract(totalReliefPrice)); + } + return orderInfoDtos; + } } From 48d82a54d1cc08b9fb2b1684da26016444ac322f Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Thu, 19 Dec 2024 11:15:03 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=A3=80=E4=BF=AE=E8=AF=A6=E6=83=85code?= =?UTF-8?q?=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/material/lease/LeaseRepairRecordMapper.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/lease/LeaseRepairRecordMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/lease/LeaseRepairRecordMapper.xml index e8351d6..789a95d 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/lease/LeaseRepairRecordMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/lease/LeaseRepairRecordMapper.xml @@ -469,6 +469,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + select * from sys_user where user_id = #{userId} + + \ No newline at end of file From 763f79f860ff33f5fb606d4df469c75ab27029ee Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Thu, 19 Dec 2024 15:11:13 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bonus/material/user/controller/UserController.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/user/controller/UserController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/user/controller/UserController.java index c66bbd1..42a37d5 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/user/controller/UserController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/user/controller/UserController.java @@ -7,10 +7,7 @@ import com.bonus.material.user.entity.UserDto; import com.bonus.material.user.service.UserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; @@ -34,7 +31,7 @@ public class UserController extends BaseController { @ApiOperation(value = "修改个人信息") @PostMapping("/editUser") - public AjaxResult editUser(UserDto userDto) { + public AjaxResult editUser(@RequestBody UserDto userDto) { Integer i = userService.editUser(userDto); if (i > 0){ return success("修改成功"); From 7fa6cc8a2679d8accb1eec8eb4a6dfaf6af7faa1 Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Thu, 19 Dec 2024 15:29:40 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E7=A7=9F=E8=B5=81=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/controller/OrderController.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) 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 b9b235b..a85cc75 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 @@ -218,13 +218,17 @@ public class OrderController extends BaseController { Date date = inputFormat.parse(dateStr); String formattedDate = outputFormat.format(date); //订单日期 - replacements.put("${orderTime}", formattedDate); + replacements.put("${createTime}", formattedDate); //装备所属公司 - replacements.put("${czcompanyName}", orderInfoDto.getCzcompanyName()); + replacements.put("${sellerCompanyName}", orderInfoDto.getCzcompanyName()); //承租方所属公司 - replacements.put("${companyName}", orderInfoDto.getCompanyName()); + replacements.put("${buyerCompanyName}", orderInfoDto.getCompanyName()); //订单金额 replacements.put("${cost}", orderInfoDto.getCost().toString()); + //出租方电话 + replacements.put("${sellerCompanyPhone}", orderInfoDto.getPersonPhone()); + //承租方电话 + replacements.put("${buyerCompanyPhone}", orderInfoDto.getPhoneNumber()); //订单详情 StringBuilder orderDetail = new StringBuilder(); for (OrderDetailDto orderDetailDto : orderDetailsByOrderId) { @@ -284,12 +288,18 @@ public class OrderController extends BaseController { SimpleDateFormat inputFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH); SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map replacements = new HashMap<>(); + //订单日期 + replacements.put("${createTime}", DateUtils.getDate()); //装备所属公司 - replacements.put("${czcompanyName}", orderInfoDto.getCzcompanyName()); + replacements.put("${sellerCompanyName}", orderInfoDto.getCzcompanyName()); //承租方所属公司 - replacements.put("${companyName}", orderInfoDto.getCompanyName()); + replacements.put("${buyerCompanyName}", orderInfoDto.getCompanyName()); //订单金额 replacements.put("${cost}", orderInfoDto.getCost().toString()); + //出租方电话 + replacements.put("${sellerCompanyPhone}", orderInfoDto.getPersonPhone()); + //承租方电话 + replacements.put("${buyerCompanyPhone}", SecurityUtils.getLoginUser().getSysUser().getPhonenumber()); //订单详情 StringBuilder orderDetail = new StringBuilder(); List detailsList = orderInfoDto.getDetailsList(); From a90d3226ef9e92f08ebbe53f66416c7fa944ff0c Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Thu, 19 Dec 2024 16:11:40 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E7=A7=9F=E8=B5=81=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/contract/service/impl/BmContractServiceImpl.java | 2 -- 1 file changed, 2 deletions(-) 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 1ac7cb0..3e36f30 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 @@ -58,7 +58,6 @@ public class BmContractServiceImpl implements BmContractService { bmFileInfo.setTaskType(MaterialConstants.APPENDICES_OF_CONTRACT); // 合同照片附件 bmFileInfo.setFileType(0L); - bmFileInfo.setFileName(URLEncoder.encode(bmFileInfo.getFileName(), StandardCharsets.UTF_8.toString())); bmFileInfo.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString()); bmFileInfoMapper.insertBmFileInfo(bmFileInfo); } @@ -82,7 +81,6 @@ public class BmContractServiceImpl implements BmContractService { bmFileInfo.setTaskType(MaterialConstants.APPENDICES_OF_CONTRACT); // 合同照片附件 bmFileInfo.setFileType(0L); - bmFileInfo.setFileName(URLEncoder.encode(bmFileInfo.getFileName(), StandardCharsets.UTF_8.toString())); bmFileInfo.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString()); bmFileInfoMapper.insertBmFileInfo(bmFileInfo); } From 7df4065ac42d1ccf02bd8f698fd2c0b7f13d13ea Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Thu, 19 Dec 2024 16:40:47 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E8=A7=A3=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/material/user/service/impl/UserServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/user/service/impl/UserServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/user/service/impl/UserServiceImpl.java index 72e4b32..961a552 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/user/service/impl/UserServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/user/service/impl/UserServiceImpl.java @@ -1,5 +1,6 @@ package com.bonus.material.user.service.impl; +import com.bonus.common.core.utils.encryption.Sm4Utils; import com.bonus.material.user.entity.UserDto; import com.bonus.material.user.mapper.UserMapper; import com.bonus.material.user.service.UserService; @@ -17,7 +18,9 @@ public class UserServiceImpl implements UserService { private UserMapper userMapper; @Override public UserDto getUserById(Long userId) { - return userMapper.getUserById(userId); + UserDto user = userMapper.getUserById(userId); + user.setPassword(Sm4Utils.decrypt(user.getPassword())); + return user; } @Override