diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/MaStatusEnum.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/MaStatusEnum.java index b8c4b3b..34393cb 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/MaStatusEnum.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/MaStatusEnum.java @@ -2,6 +2,8 @@ package com.bonus.common.biz.enums; import lombok.Getter; +import java.util.Objects; + /** * @author bonus */ @@ -41,7 +43,7 @@ public enum MaStatusEnum { public static Integer getCodeByName(String msg) { MaStatusEnum[] maStatusEnums = values(); for (MaStatusEnum maStatusEnum : maStatusEnums) { - if (maStatusEnum.getName() == msg) { + if (Objects.equals(maStatusEnum.getName(), msg)) { return maStatusEnum.getCode(); } } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/controller/BmCompanyAddressController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/controller/BmCompanyAddressController.java index b5e02d4..cdc08fb 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/controller/BmCompanyAddressController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/controller/BmCompanyAddressController.java @@ -2,6 +2,8 @@ package com.bonus.material.basic.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; +import javax.validation.constraints.NotNull; + import com.bonus.common.log.enums.OperaType; import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.common.annotation.PreventRepeatSubmit; @@ -10,8 +12,6 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -100,7 +100,10 @@ public class BmCompanyAddressController extends BaseController { //@RequiresPermissions("basic:address:edit") @SysLog(title = "企业信息", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改企业信息") @PostMapping("/edit") - public AjaxResult edit(@RequestBody BmCompanyAddress bmCompanyAddress) { + public AjaxResult edit(@NotNull @RequestBody BmCompanyAddress bmCompanyAddress) { + if (bmCompanyAddress == null || bmCompanyAddress.getId() == null) { + return error("ID不能为空"); + } try { bmCompanyAddress.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId()); return toAjax(bmCompanyAddressService.updateBmCompanyAddress(bmCompanyAddress)); diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/controller/BmMessageController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/controller/BmMessageController.java index eff2deb..4c322b2 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/controller/BmMessageController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/controller/BmMessageController.java @@ -3,7 +3,6 @@ package com.bonus.material.basic.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.bonus.common.log.enums.OperaType; -import com.bonus.material.common.annotation.PreventRepeatSubmit; import com.fasterxml.jackson.core.JsonProcessingException; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -15,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.bonus.common.log.annotation.SysLog; -import com.bonus.common.security.annotation.RequiresPermissions; import com.bonus.material.basic.domain.BmMessage; import com.bonus.material.basic.service.IBmMessageService; import com.bonus.common.core.web.controller.BaseController; diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/controller/BmSlideShowController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/controller/BmSlideShowController.java index 702b959..9b62317 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/controller/BmSlideShowController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/controller/BmSlideShowController.java @@ -16,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.bonus.common.log.annotation.SysLog; -import com.bonus.common.security.annotation.RequiresPermissions; import com.bonus.material.basic.domain.BmSlideShow; import com.bonus.material.basic.service.IBmSlideShowService; import com.bonus.common.core.web.controller.BaseController; diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/service/impl/BmMessageServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/service/impl/BmMessageServiceImpl.java index 13445ab..a40a0b5 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/service/impl/BmMessageServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/service/impl/BmMessageServiceImpl.java @@ -12,7 +12,6 @@ import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.SpringUtils; import com.bonus.common.redis.service.RedisService; import com.bonus.common.security.utils.SecurityUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.material.basic.mapper.BmMessageMapper; import com.bonus.material.basic.domain.BmMessage; @@ -94,6 +93,7 @@ public class BmMessageServiceImpl implements IBmMessageService { } } + @Override public List selectBmMessageListFromCacheOne(BmMessage bmMessage) { Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId(); Long toCompany = bmMessage.getToCompany(); diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/service/impl/ToDoServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/service/impl/ToDoServiceImpl.java index 4cf677c..f56c807 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/service/impl/ToDoServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/service/impl/ToDoServiceImpl.java @@ -10,7 +10,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.ArrayList; -import java.util.Date; import java.util.List; @Service diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/book/service/impl/BookCarServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/book/service/impl/BookCarServiceImpl.java index 5dcc312..78119fe 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/book/service/impl/BookCarServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/book/service/impl/BookCarServiceImpl.java @@ -3,7 +3,6 @@ package com.bonus.material.book.service.impl; import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.biz.domain.BmFileInfo; -import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.book.domain.BookCarInfoDto; 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 3e36f30..fac697b 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 @@ -13,8 +13,6 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevInfoController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevInfoController.java index 732d1e1..1908edd 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevInfoController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevInfoController.java @@ -3,8 +3,6 @@ package com.bonus.material.device.controller; import cn.hutool.core.convert.Convert; import com.bonus.common.biz.config.ListPagingUtil; import com.bonus.common.biz.domain.BmCompanyInfo; -import com.bonus.common.core.constant.Constants; -import com.bonus.common.core.utils.ServletUtils; import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; @@ -17,8 +15,6 @@ import com.bonus.material.device.domain.vo.DevInfoVo; import com.bonus.material.device.service.DevInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import lombok.extern.java.Log; -import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -27,7 +23,6 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; -import javax.validation.constraints.NotNull; import java.io.IOException; import java.util.List; import java.util.Map; diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java index 905663a..1782f86 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java @@ -1,7 +1,6 @@ package com.bonus.material.device.service.impl; import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.convert.Convert; import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.biz.domain.*; import com.bonus.common.biz.enums.MaStatusEnum; @@ -119,14 +118,14 @@ public class DevInfoServiceImpl implements DevInfoService { } /*else if (item.getFileType().equals(Long.valueOf(EXAMINATION_PDF))) { devInfoVo.getExaminationPdf().add(item); }*/ else if (item.getFileType().equals(Long.valueOf(INSURANCE_PDF))) { - devInfoVo.getInsurancePdf().add(item); + // devInfoVo.getInsurancePdf().add(item); } }); } Table table = new Table(); table.setExaminationPdf(devInfoVo.getExaminationPdf()); - table.setInsurancePdf(devInfoVo.getInsurancePdf()); +// table.setInsurancePdf(devInfoVo.getInsurancePdf()); table.setIdentifyCode(devInfoVo.getIdentifyCode()); MaDevQc qc = maDevQcMapper.getQcListByOne(maId); if (Objects.nonNull(qc)) { @@ -408,6 +407,12 @@ public class DevInfoServiceImpl implements DevInfoService { }); fileInfoList.addAll(devInfo.getDetailsFileList()); } + + /** + * 合格证与检测证明合二为一 + * 修改人:syruan + * 修改时间:2025/02/20 + * 描述:经沟通,田聪聪提出需求,检测证明与合格证合二为一 if (CollectionUtil.isNotEmpty(devInfo.getTableList().get(i).getInsurancePdf())) { devInfo.getTableList().get(i).getInsurancePdf().removeIf(Objects::isNull); devInfo.getTableList().get(i).getInsurancePdf().forEach(item -> { @@ -415,7 +420,7 @@ public class DevInfoServiceImpl implements DevInfoService { item.setFileType(Long.valueOf(INSURANCE_PDF)); }); fileInfoList.addAll(devInfo.getTableList().get(i).getInsurancePdf()); - } + } */ if (CollectionUtil.isNotEmpty(devInfo.getTableList().get(i).getExaminationPdf())) { devInfo.getTableList().get(i).getExaminationPdf().removeIf(Objects::isNull); devInfo.getTableList().get(i).getExaminationPdf().forEach(item -> { @@ -479,14 +484,18 @@ public class DevInfoServiceImpl implements DevInfoService { }); fileInfoList.addAll(devInfo.getDetailsFileList()); } - if (CollectionUtil.isNotEmpty(table.getInsurancePdf())) { - table.getInsurancePdf().removeIf(Objects::isNull); - table.getInsurancePdf().forEach(item -> { - item.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE); - item.setFileType(Long.valueOf(INSURANCE_PDF)); - }); - fileInfoList.addAll(table.getInsurancePdf()); - } + // 合格证与检测证明合二为一 + // 修改人:syruan + // 修改时间:2025/02/20 + // 描述:经沟通,田聪聪提出需求,检测证明与合格证合二为一 +// if (CollectionUtil.isNotEmpty(table.getInsurancePdf())) { +// table.getInsurancePdf().removeIf(Objects::isNull); +// table.getInsurancePdf().forEach(item -> { +// item.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE); +// item.setFileType(Long.valueOf(INSURANCE_PDF)); +// }); +// fileInfoList.addAll(table.getInsurancePdf()); +// } if (CollectionUtil.isNotEmpty(table.getExaminationPdf())) { table.getExaminationPdf().removeIf(Objects::isNull); table.getExaminationPdf().forEach(item -> { diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/MaDevRmServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/MaDevRmServiceImpl.java index f3787d3..dea45eb 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/MaDevRmServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/MaDevRmServiceImpl.java @@ -9,7 +9,6 @@ import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.device.domain.MaDevRm; import com.bonus.material.device.mapper.BmFileInfoMapper; -import com.bonus.material.device.mapper.DevInfoMapper; import com.bonus.material.device.mapper.MaDevRmMapper; import com.bonus.material.device.service.MaDevRmService; import org.apache.commons.collections4.CollectionUtils; diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/lease/service/impl/LeaseRepairRecordServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/lease/service/impl/LeaseRepairRecordServiceImpl.java index 9c2ace7..354d59a 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/lease/service/impl/LeaseRepairRecordServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/lease/service/impl/LeaseRepairRecordServiceImpl.java @@ -282,7 +282,7 @@ public class LeaseRepairRecordServiceImpl implements LeaseRepairRecordService { } } String userName = SecurityUtils.getLoginUser().getUsername(); - result += orderMapper.updateOrderStatus(leasePriceRecord.getOrderId(), null, String.valueOf(OrderStatusEnum.ORDER_TERMINATED.getStatus()), userName); + result += orderMapper.updateOrderStatus(leasePriceRecord.getOrderId(), null, String.valueOf(OrderStatusEnum.ORDER_TERMINATED.getStatus()), userName, null); if (result > 0) { return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/lease/service/impl/MaLeaseInfoServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/lease/service/impl/MaLeaseInfoServiceImpl.java index 5d2ea5c..0f47852 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/lease/service/impl/MaLeaseInfoServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/lease/service/impl/MaLeaseInfoServiceImpl.java @@ -32,7 +32,6 @@ import javax.annotation.Resource; import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; /** * 租赁需求大厅实现层 @@ -344,7 +343,7 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService { */ @Override public List leaseList(MaLease maLease) { - List list = new ArrayList<>(); + List list; list = leaseInfoMapper.leaseList(maLease); int result = 0; //查询列表中数据,如果需求截止日期超过当前,则修改状态为已过期 @@ -366,6 +365,7 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService { return list; } + @Override public List getLeaseStatusCount(MaLeaseInfo info) { //true:出租方 false:承租方 if (info.isFlag()) { 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 24c92c0..ed152c0 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 @@ -289,9 +289,9 @@ public class OrderController extends BaseController { XWPFDocument document = new XWPFDocument(inputStream); SimpleDateFormat inputFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH); SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd"); - Date date1 = inputFormat.parse(orderInfoDto.getStartTime().toString()); + Date date1 = inputFormat.parse(String.valueOf(orderInfoDto.getDetailsList().get(0).getRentBeginTime())); String startTime = outputFormat.format(date1); - Date date2 = inputFormat.parse(orderInfoDto.getEndTime().toString()); + Date date2 = inputFormat.parse(String.valueOf(orderInfoDto.getDetailsList().get(0).getRentEndTime())); String endTime = outputFormat.format(date2); Map replacements = new HashMap<>(); //订单日期 @@ -365,7 +365,10 @@ public class OrderController extends BaseController { String text = run.getText(0); if (text != null) { for (Map.Entry entry : replacements.entrySet()) { - text = text.replace(entry.getKey(), entry.getValue()); + // 检查 entry.getValue() 是否为 null + if (entry.getValue() != null) { + text = text.replace(entry.getKey(), entry.getValue()); + } } run.setText(text, 0); } @@ -487,7 +490,7 @@ public class OrderController extends BaseController { // 遍历订单详情并动态插入数据行 SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - int num = 1; + int num = orderDetails.size(); for (OrderDetailDto detail : orderDetails) { XWPFTableRow newRow = table.insertNewTableRow(headerRowIndex + 1); @@ -498,7 +501,7 @@ public class OrderController extends BaseController { int cellIndex = 0; // 序号 newRow.getCell(cellIndex++).setText(String.valueOf(num)); - num++; + num--; // 机具名称 newRow.getCell(cellIndex++).setText(detail.getDeviceName()); @@ -522,7 +525,7 @@ public class OrderController extends BaseController { newRow.getCell(cellIndex++).setText(detail.getCosts() + "元"); // 备注 - newRow.getCell(cellIndex).setText("这是备注"); + newRow.getCell(cellIndex).setText(""); // 填充最后一行(合计行) XWPFTableRow footerRow = table.getRow(footerRowIndex); int footerCellIndex = 0; diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/domain/OrderDetailDto.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/domain/OrderDetailDto.java index 6976b1b..3c625ec 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/domain/OrderDetailDto.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/domain/OrderDetailDto.java @@ -32,6 +32,9 @@ public class OrderDetailDto { @ApiModelProperty(value = "订单code") private String orderCode; + @ApiModelProperty(value = "订单备注") + private String orderRemark; + @ApiModelProperty(value = "设备id") private Integer maId; @@ -164,6 +167,7 @@ public class OrderDetailDto { @ApiModelProperty(value = "卖方出租方公司名称") private String sellerCompanyName; + @ApiModelProperty(value = "单位") private String unitName; diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/mapper/OrderMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/mapper/OrderMapper.java index cab155f..e8136ef 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/mapper/OrderMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/mapper/OrderMapper.java @@ -34,7 +34,7 @@ public interface OrderMapper { void updateMaStatus(OrderDetailDto orderDetailDto); - Integer updateOrderStatus(@Param("orderId") Integer orderId, @Param("maIds") List maIds, @Param("orderStatus") String orderStatus,@Param("userName") String userName); + Integer updateOrderStatus(@Param("orderId") Integer orderId, @Param("maIds") List maIds, @Param("orderStatus") String orderStatus,@Param("userName") String userName, @Param("remark") String remark); Integer updateDevCount(OrderDetailDto orderDetailDto); Integer updateAddDevCount(OrderDetailDto orderDetailDto); 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 d65ad84..b798c96 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 @@ -17,6 +17,7 @@ import com.bonus.material.basic.domain.BmMessage; import com.bonus.material.basic.mapper.BmMessageMapper; import com.bonus.material.common.config.RemoteConfig; 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.mapper.DevInfoMapper; import com.bonus.material.largeScreen.entity.OrderData; @@ -57,7 +58,7 @@ public class OrderServiceImpl implements OrderService { private BmMessageMapper bmMessageMapper; @Resource - DevInfoMapper devInfoMapper; + private DevInfoMapper devInfoMapper; @Resource private LeaseRepairRecordMapper leaseRepairRecordMapper; @@ -74,27 +75,26 @@ public class OrderServiceImpl implements OrderService { for (OrderInfoDto orderInfoDto : orderInfoDtos) { // 首先判断库存是否足够 List orderDetailDtos = orderInfoDto.getDetailsList(); + orderDetailDtos.removeIf(Objects::isNull); + if (orderDetailDtos.isEmpty()) { + throw new RuntimeException("请正确添加设备"); + } for (OrderDetailDto orderDetailDto : orderDetailDtos) { - // 如果是数量设备 ,改库存 - /* if ("1".equals(orderDetailDto.getManageType())) { - // 再查询库存是否足够 - DevInfo devInfo = orderMapper.getdeviceCount(orderDetailDto); - if (devInfo.getDeviceCount() == 0) { - // 查询库存是否为0,是的话让它下架 - orderDetailDto.setMaStatus(MaStatusEnum.ON_HIRE.getCode().toString()); - orderMapper.updateDeviceStatus(orderDetailDto); - throw new RuntimeException(devInfo.getDeviceName() + "已下架,无法下单"); - } else if (devInfo.getDeviceCount() < orderDetailDto.getNum()) { - throw new RuntimeException(devInfo.getDeviceName() + "库存不足,无法下单"); - } else { - // 改库存 - orderMapper.updateDevCount(orderDetailDto); - } - } else {*/ - //如果是编码设备,改设备状态为在租 - orderDetailDto.setMaStatus(MaStatusEnum.UNDER_RENT.getCode().toString()); - orderMapper.updateDeviceStatus(orderDetailDto); -// } + // 先判断要租赁的设备状态是否正常 + DevInfo maInfo = devInfoMapper.getMaStatusByMaId(Long.valueOf(orderDetailDto.getMaId())); + if (maInfo == null || maInfo.getMaStatus() == null) { + throw new RuntimeException("设备信息异常"); + } + if (!maInfo.getMaStatus().equals(MaStatusEnum.LISTING.getCode())) { + throw new RuntimeException("设备非上架状态,无法下单!"); + } + + //如果是编码设备,改设备状态为在租 + orderDetailDto.setMaStatus(MaStatusEnum.UNDER_RENT.getCode().toString()); + Integer updateDeviceStatus = orderMapper.updateDeviceStatus(orderDetailDto); + if (updateDeviceStatus < 1) { + throw new RuntimeException("设备状态修改失败"); + } // 更改购物车状态为已下单 orderMapper.updateMaStatus(orderDetailDto); } @@ -288,7 +288,7 @@ public class OrderServiceImpl implements OrderService { } } String userName = SecurityUtils.getLoginUser().getUsername(); - Integer i = orderMapper.updateOrderStatus(orderInfoDto.getOrderId(), orderInfoDto.getMaIds(), orderInfoDto.getOrderStatus(), userName); + Integer i = orderMapper.updateOrderStatus(orderInfoDto.getOrderId(), orderInfoDto.getMaIds(), orderInfoDto.getOrderStatus(), userName, orderInfoDto.getOrderRemark()); if (!CollectionUtils.isEmpty(dtos)) { OptionalInt minOrderStatus = dtos.stream().mapToInt(o -> Integer.parseInt(o.getOrderStatus())).min(); if (minOrderStatus.isPresent()) { @@ -309,7 +309,7 @@ public class OrderServiceImpl implements OrderService { } } try { - if (dtos.size() > 0 && CollectionUtil.isNotEmpty(dtos)) { + if (!dtos.isEmpty() && CollectionUtil.isNotEmpty(dtos)) { for (OrderDetailDto dto : dtos) { BmMessage bmMessage = new BmMessage(); bmMessage.setCreateTime(DateUtils.getNowDate()); @@ -325,12 +325,10 @@ public class OrderServiceImpl implements OrderService { if (OrderStatusEnum.TO_ORDER_PLACED.getStatus().toString().equals(orderInfoDto.getOrderStatus()) || OrderStatusEnum.ORDER_AWAITING_RECEIPT.getStatus().toString().equals(orderInfoDto.getOrderStatus()) || OrderStatusEnum.ORDER_UNDER_LEASE.getStatus().toString().equals(orderInfoDto.getOrderStatus()) || OrderStatusEnum.ORDER_FINISHED.getStatus().toString().equals(orderInfoDto.getOrderStatus()) || OrderStatusEnum.ORDER_CANCEL.getStatus().toString().equals(orderInfoDto.getOrderStatus())) { - //bmMessage.setToUser(Long.parseLong(dto.geuser())); bmMessage.setToCompany(Long.valueOf(dto.getSellerCompany())); } else if (OrderStatusEnum.ORDER_RECEIVE.getStatus().toString().equals(orderInfoDto.getOrderStatus()) || OrderStatusEnum.ORDER_PENDING_SHIPMENT.getStatus().toString().equals(orderInfoDto.getOrderStatus()) || OrderStatusEnum.ORDER_REPAIRED.getStatus().toString().equals(orderInfoDto.getOrderStatus()) || OrderStatusEnum.ORDER_TERMINATED.getStatus().toString().equals(orderInfoDto.getOrderStatus())) { // 已接单、已出库、已检修、已结算 通知承租方 - //bmMessage.setToUser(Long.parseLong(dto.geuse())); bmMessage.setToCompany(Long.valueOf(dto.getBuyerCompany())); } String msgKey = MaterialConstants.CACHE_MATERIAL_MALL_MESSAGE + bmMessage.getFromCompany() + ":" + bmMessage.getToCompany(); 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 42a37d5..a3b57fa 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 @@ -10,7 +10,6 @@ import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import java.util.List; /** * @Author:liang.chao diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/lease/MaLeaseInfoMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/lease/MaLeaseInfoMapper.xml index 6bc7a04..985db09 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/lease/MaLeaseInfoMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/lease/MaLeaseInfoMapper.xml @@ -273,6 +273,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE m.lease_status = '0' and m.publish_company = #{companyId} and m.city_code = #{cityCode} + + and FIND_IN_SET(#{typeId}, type_ids) > 0 + and ( locate(#{keyWord},m.lease_name) > 0 diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml index bc77f7f..fe5d12f 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml @@ -44,28 +44,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ,receiving_user = #{userName} ,receiving_time = now() + ,order_remark = #{remark} ,pre_outbound_user = #{userName} ,pre_outbound_time = now() + ,order_remark = #{remark} ,take_over_user = #{userName} ,take_over_time = now() + ,order_remark = #{remark} ,rent_over_user = #{userName} ,rent_over_time = now() + ,order_remark = #{remark} -- ah-simple 临时改动 START ,rent_over_user = #{userName} ,rent_over_time = now() + ,order_remark = #{remark} -- ah-simple 临时改动 END ,refuse_user = #{userName} ,refuse_time = now() + ,order_remark = #{remark} where order_id = #{orderId}