From 20f399eb3558396b893ca953b4c471378ed64971 Mon Sep 17 00:00:00 2001 From: mashuai Date: Tue, 14 Oct 2025 20:06:23 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MaterialBackApplyInfoController.java | 40 ++++++++ .../MaterialLeaseInfoController.java | 12 ++- .../domain/back/MaterialBackApplyInfo.java | 5 + .../clz/domain/back/MaterialBackExportVO.java | 4 +- .../domain/lease/MaterialLeaseApplyInfo.java | 6 +- .../vo/MaterialRetainedEquipmentInfo.java | 7 +- .../clz/domain/vo/MaterialTotalMentInfo.java | 9 +- .../clz/mapper/MaterialMachineMapper.java | 7 ++ .../impl/MaterialMachineServiceImpl.java | 26 +++++ .../material/clz/MaterialMachineMapper.xml | 94 +++++++++++++++++++ 10 files changed, 202 insertions(+), 8 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialBackApplyInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialBackApplyInfoController.java index e961a069..e11ba524 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialBackApplyInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialBackApplyInfoController.java @@ -10,6 +10,7 @@ import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.log.annotation.SysLog; import com.bonus.common.log.enums.OperaType; +import com.bonus.material.clz.domain.back.MaterialBackExportVO; import com.bonus.material.common.annotation.PreventRepeatSubmit; import com.bonus.material.clz.domain.back.MaterialBackApplyTotalInfo; import com.bonus.material.clz.domain.back.MaterialBackApplyDetails; @@ -51,6 +52,27 @@ public class MaterialBackApplyInfoController extends BaseController { return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); } + @ApiOperation(value = "导出退料任务列表") + @PreventRepeatSubmit + @SysLog(title = "退料任务", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出退料任务") + @PostMapping("/export") + public void export(HttpServletResponse response, MaterialBackApplyInfo backApplyInfo) { + backApplyInfo.setIsExport(true); + String fileName = "退料记录"; + if (backApplyInfo.getStartTime() != null && backApplyInfo.getEndTime() != null) { + fileName = "退料记录"+ "(退料时间" +backApplyInfo.getStartTime() + "至" + backApplyInfo.getEndTime()+ ")"; + } + List list = materialBackApplyInfoService.selectBackApplyInfoList(backApplyInfo); + // 根据list集合数,去填充序号 + for (int i = 0; i < list.size(); i++) { + list.get(i).setSerialNumber(i + 1); + } + ExcelUtil util = new ExcelUtil<>(MaterialBackApplyInfo.class); + // 获取当前年月日时分秒导出时间,用括号拼接在后面 + String title = "班组退料记录" + "(" + "导出时间:" + DateUtils.getTime() + ")"; + util.exportExcel(response, list, fileName, title); + } + /** * 查询总站点退料记录数据 * @param backApplyInfo @@ -274,4 +296,22 @@ public class MaterialBackApplyInfoController extends BaseController { public AjaxResult getMachine(MaterialBackApplyInfo dto) { return materialBackApplyInfoService.getMachine(dto); } + + @ApiOperation("导出材料站退料记录") + @PostMapping("/exportBackInfoExcl") + public void exportBackInfoExcl(HttpServletResponse response, MaterialBackApplyInfo bean) { + String fileName = "退料记录"; + if (bean.getStartTime() != null && bean.getEndTime() != null) { + fileName = "退料记录"+ "(退料时间" +bean.getStartTime() + "至" + bean.getEndTime()+ ")"; + } + List list = materialBackApplyInfoService.exportBackInfoExcl(bean); + // 根据list集合数,去填充序号 + for (int i = 0; i < list.size(); i++) { + list.get(i).setSerialNumber(i + 1); + } + ExcelUtil util = new ExcelUtil<>(MaterialBackExportVO.class); + // 获取当前年月日时分秒导出时间,用括号拼接在后面 + String title = "材料站退料记录" + "(" + "导出时间:" + DateUtils.getTime() + ")"; + util.exportExcel(response, list, fileName, title); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialLeaseInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialLeaseInfoController.java index 29486e3a..e0bd8843 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialLeaseInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialLeaseInfoController.java @@ -126,9 +126,19 @@ public class MaterialLeaseInfoController extends BaseController { @SysLog(title = "领料任务", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出领料任务") @PostMapping("/export") public void export(HttpServletResponse response, MaterialLeaseApplyInfo leaseApplyInfo) { + String fileName = "领料记录"; + if (leaseApplyInfo.getStartTime() != null && leaseApplyInfo.getEndTime() != null) { + fileName = "领料记录"+ "(领料时间" +leaseApplyInfo.getStartTime() + "至" + leaseApplyInfo.getEndTime()+ ")"; + } List list = materialLeaseInfoService.selectLeaseApplyInfoList(leaseApplyInfo); + // 根据list集合数,去填充序号 + for (int i = 0; i < list.size(); i++) { + list.get(i).setSerialNumber(i + 1); + } ExcelUtil util = new ExcelUtil<>(MaterialLeaseApplyInfo.class); - util.exportExcel(response, list, "领料任务数据"); + // 获取当前年月日时分秒导出时间,用括号拼接在后面 + String title = "班组领料记录" + "(" + "导出时间:" + DateUtils.getTime() + ")"; + util.exportExcel(response, list, fileName, title); } /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyInfo.java index 8fe531a7..d38d2edb 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyInfo.java @@ -29,6 +29,10 @@ public class MaterialBackApplyInfo implements Serializable { private Boolean isExport; + @ApiModelProperty(value = "序号") + @Excel(name = "序号", isSequence = true, sort = 0, width = 5) + private Integer serialNumber; + @ApiModelProperty(value = "是否退料 0 否,1 是") private Integer isBack; @@ -202,6 +206,7 @@ public class MaterialBackApplyInfo implements Serializable { private String backStyle; @ApiModelProperty(value = "分公司") + @Excel(name = "分公司",sort = 3) private String impUnitName; @ApiModelProperty(value = "分包单位") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackExportVO.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackExportVO.java index 5cefbe0b..aa70187c 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackExportVO.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackExportVO.java @@ -17,8 +17,8 @@ import java.util.Date; public class MaterialBackExportVO { @ApiModelProperty(value = "序号") - @Excel(name = "序号", isSequence = true, sort = 0) - private String serialNumber; + @Excel(name = "序号", isSequence = true, sort = 0, width = 5) + private Integer serialNumber; @Excel(name = "分公司") @ApiModelProperty(value = "分公司") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java index 8f6d2b33..b2c6938b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java @@ -24,6 +24,10 @@ public class MaterialLeaseApplyInfo extends BaseEntity { private static final long serialVersionUID = 1L; + @ApiModelProperty(value = "序号") + @Excel(name = "序号", isSequence = true, sort = 0, width = 5) + private Integer serialNumber; + @ApiModelProperty(value = "是否出库 0 否,1 是") private Integer isOut; @@ -64,7 +68,6 @@ public class MaterialLeaseApplyInfo extends BaseEntity { @Excel(name = "领料班组",sort = 6) private String teamName; - @Excel(name = "租赁工程",sort = 7) @ApiModelProperty(value = "租赁工程") private String leaseProject; @@ -327,7 +330,6 @@ public class MaterialLeaseApplyInfo extends BaseEntity { private String departName; @ApiModelProperty(value = "工程名称") - @Excel(name = "工程名称") private String proName; @ApiModelProperty(value = "是否人为修改:0:否,1:是") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialRetainedEquipmentInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialRetainedEquipmentInfo.java index 26a6b6bf..b5e99b60 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialRetainedEquipmentInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialRetainedEquipmentInfo.java @@ -98,11 +98,11 @@ public class MaterialRetainedEquipmentInfo { private String allNumStr; @ApiModelProperty(value = "购置单价") - @Excel(name = "购置单价", cellType = Excel.ColumnType.NUMERIC,align = HorizontalAlignment.RIGHT) + //@Excel(name = "购置单价", cellType = Excel.ColumnType.NUMERIC,align = HorizontalAlignment.RIGHT) private BigDecimal buyPrice; @ApiModelProperty(value = "原值") - @Excel(name = "原值(万元)", cellType = Excel.ColumnType.NUMERIC,align = HorizontalAlignment.RIGHT) + //@Excel(name = "原值(万元)", cellType = Excel.ColumnType.NUMERIC,align = HorizontalAlignment.RIGHT) private BigDecimal totalPrice; @ApiModelProperty(value = "五年以内成新率") @@ -279,4 +279,7 @@ public class MaterialRetainedEquipmentInfo { @ApiModelProperty(value = "是否班组标志(0 是 1 否)") private String bzFlag; + + @ApiModelProperty(value = "租赁费用(万元)") + private BigDecimal rentPrice; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialTotalMentInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialTotalMentInfo.java index 23d28b3c..137a2bab 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialTotalMentInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialTotalMentInfo.java @@ -4,7 +4,6 @@ import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import org.apache.poi.ss.usermodel.HorizontalAlignment; import java.math.BigDecimal; @@ -83,4 +82,12 @@ public class MaterialTotalMentInfo { @ApiModelProperty(value = "绳索类在用数量") @Excel(name = "绳索类在用数量") private BigDecimal useRopeNum; + + @ApiModelProperty(value = "投入费用(万元)") + @Excel(name = "投入费用(万元)") + private BigDecimal totalPrice; + + @ApiModelProperty(value = "租赁费用(万元)") + @Excel(name = "租赁费用(万元)") + private BigDecimal rentPrice; } \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialMachineMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialMachineMapper.java index 1e12f3c1..92d27354 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialMachineMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialMachineMapper.java @@ -327,4 +327,11 @@ public interface MaterialMachineMapper { * @return */ List getSubList(MaterialStorageInfo bean); + + /** + * 租赁费用 + * @param bean + * @return + */ + List getLeaseInfo(MaterialRetainedEquipmentInfo bean); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java index f15f6217..7b2d07dd 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java @@ -896,6 +896,10 @@ public class MaterialMachineServiceImpl implements MaterialMachineService { BigDecimal inCountNum = BigDecimal.ZERO; // 绳索类站内数量 BigDecimal inRopeNum = BigDecimal.ZERO; + // 投入总费用(万元),保留3位小数 + BigDecimal totalPrice = BigDecimal.ZERO; + // 租赁总费用(万元),保留3位小数 + BigDecimal rentPrice = BigDecimal.ZERO; // 获取在用量 List useInfoList = materialMachineMapper.getUsInfoList(bean); @@ -986,6 +990,13 @@ public class MaterialMachineServiceImpl implements MaterialMachineService { .filter(Objects::nonNull) .distinct() .count()); + // 合计list中的totalPrice费用至totalCost + totalPrice = useInfoList.stream() + .map(MaterialRetainedEquipmentInfo::getTotalPrice) + .filter(Objects::nonNull) + .reduce(BigDecimal::add) + .orElse(BigDecimal.ZERO) + .setScale(3, RoundingMode.HALF_UP); } else { info.setProNum(0); info.setDepartNum(0); @@ -1003,6 +1014,21 @@ public class MaterialMachineServiceImpl implements MaterialMachineService { info.setCountNum(inCountNum.add(useCountNum).add(useCountNumSub)); // 绳索类保有量 info.setRopeNum(inRopeNum.add(useRopeNum).add(useRopeNumSub)); + // 投入费用(万元) + info.setTotalPrice(totalPrice); + /*// 租赁费用(万元) + List leaseInfoList = materialMachineMapper.getLeaseInfo(bean); + if (CollectionUtils.isNotEmpty(leaseInfoList)) { + rentPrice = leaseInfoList.stream() + .map(MaterialRetainedEquipmentInfo::getRentPrice) + .filter(Objects::nonNull) + .reduce(BigDecimal::add) + .orElse(BigDecimal.ZERO) + .setScale(3, RoundingMode.HALF_UP); + } else { + info.setRentPrice(BigDecimal.ZERO); + }*/ + info.setRentPrice(rentPrice); return info; } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml index d275d98d..8ffb565f 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml @@ -2577,4 +2577,98 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sai.type_id, sai.ma_id + + From 3bd67c598bf080f4e00398e31ae582a8985afc49 Mon Sep 17 00:00:00 2001 From: bonus <1203338439@qq.com> Date: Tue, 14 Oct 2025 21:41:16 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9D=90=E6=96=99=E7=AB=99=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E8=B6=85=E6=9C=9F=E8=B4=B9=E7=94=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ClzSltAgreementInfoController.java | 30 +++++++------ .../domain/vo/MaterialSltAgreementInfo.java | 7 ++++ .../impl/ClzSltAgreementInfoServiceImpl.java | 42 ++++++++++++++----- .../material/clz/ClzAgreementInfoMapper.xml | 2 +- 4 files changed, 53 insertions(+), 28 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/ClzSltAgreementInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/ClzSltAgreementInfoController.java index dff9b393..40bfffd7 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/ClzSltAgreementInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/ClzSltAgreementInfoController.java @@ -182,9 +182,10 @@ public class ClzSltAgreementInfoController extends BaseController { List oneOfList = clzSltAgreementInfoMapper.getLeaseList(sltAgreementInfo); //设定班组实际出场时间 + String date = null; if(!oneOfList.isEmpty()){ - String date = "暂无" ; + //先判断是否在场 String exitTime = clzSltAgreementInfoMapper.getTeamSjOutTime(oneOfList.get(0)); if( exitTime!=null && !exitTime.isEmpty() ){ @@ -196,7 +197,10 @@ public class ClzSltAgreementInfoController extends BaseController { if(date!=null && !date.isEmpty()){ oneOfList.get(0).setActualExitTime(date); + }else{ + oneOfList.get(0).setActualExitTime("暂无"); } + actualTimeAndNames.add(oneOfList.get(0).getUnitName() + "(" + oneOfList.get(0).getActualExitTime()+")"); projectNames.add(oneOfList.get(0).getProjectName()); unitNames.add(oneOfList.get(0).getUnitName()); @@ -216,7 +220,7 @@ public class ClzSltAgreementInfoController extends BaseController { if (Objects.isNull(bean.getLeaseDays())) { bean.setLeaseDay(0L); } - + bean.setActualExitTime(date); BigDecimal leasePrice = bean.getLeasePrice(); BigDecimal num = bean.getNum(); // 根据班组退场时间计算租赁费用 @@ -290,9 +294,9 @@ public class ClzSltAgreementInfoController extends BaseController { List overdueReturnedList = getOverdueReturnedMaterials(sltAgreementInfo); loseList.addAll(overdueReturnedList); //设定班组实际出场时间 + String date = null; if(!loseList.isEmpty()){ - String date = "暂无" ; //先判断是否在场 String exitTime = clzSltAgreementInfoMapper.getTeamSjOutTime(oneOfList.get(0)); if( exitTime!=null && !exitTime.isEmpty() ){ @@ -303,6 +307,8 @@ public class ClzSltAgreementInfoController extends BaseController { if(date!=null && !date.isEmpty()){ loseList.get(0).setActualExitTime(date); + }else{ + loseList.get(0).setActualExitTime("暂无"); } actualTimeAndNames.add(loseList.get(0).getUnitName() + "(" + loseList.get(0).getActualExitTime()+")"); projectNames.add(loseList.get(0).getProjectName()); @@ -462,7 +468,7 @@ public class ClzSltAgreementInfoController extends BaseController { } //设定班组实际出场时间 if(!listAll.isEmpty()){ - String date = "暂无" ; + String date = null ; //先判断是否在场 String exitTime = clzSltAgreementInfoMapper.getTeamSjOutTime(listAll.get(0)); if( exitTime!=null && !exitTime.isEmpty() ){ @@ -593,27 +599,19 @@ public class ClzSltAgreementInfoController extends BaseController { } - // 物资是否已退还(根据endTime字段判断) - boolean isReturned = bean.getEndTime() != null; - - if (!isReturned) { - // 1.4 如果当前领用物资还未退还,不收取任何租赁费用,直接计作丢失,收取物资原值 不在租赁费用中体现 - return BigDecimal.ZERO; - } // 物资已退还,按照天数来计算费用 Date materialReturnTime = bean.getEndTime(); + if(materialReturnTime == null){ + materialReturnTime = DateTime.now(); + } // 计算超期天数 long overdueDays = calculateOverdueDays(materialReturnTime, exitTime); if (overdueDays <= 0) { // 1.3 在班组退场之前归还的物资不收费 return BigDecimal.ZERO; - } else if (overdueDays >= 16) { - // 1.2 超期15天以上也就是16天及以上计为丢失,算作丢失的话直接收取原值、所有租赁费用不收费了 - // 注意:丢失费用应该在getLoseList中处理,这里不收费 - return BigDecimal.ZERO; } else { // 计算超期费用 return calculateOverdueCost(bean, leasePrice, num, overdueDays); @@ -629,7 +627,7 @@ public class ClzSltAgreementInfoController extends BaseController { if (overdueDays <= 7) { // 超期1~7天不收费 overdueCost = BigDecimal.ZERO; - } else if (overdueDays <= 15) { + } else { // 超期第8天~第15天双倍计费 // 前7天不收费,只计算第8天开始的双倍费用 long doubleBillingDays = overdueDays - 7; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialSltAgreementInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialSltAgreementInfo.java index 67e19d93..6e0c1322 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialSltAgreementInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialSltAgreementInfo.java @@ -156,6 +156,13 @@ public class MaterialSltAgreementInfo extends BaseEntity { @ApiModelProperty(value = "租赁天数") private Long leaseDay; + /** + * 超期天数 + */ + @Excel(name = "超期天数") + @ApiModelProperty(value = "超期天数") + private Long overDay; + /** * 租赁费用 */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java index 8ad0f2ef..8fb42a74 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java @@ -807,7 +807,33 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic if (Objects.isNull(bean.getLeaseDays())) { bean.setLeaseDay(0L); } + // 物资已退还,按照天数来计算费用 + Date materialReturnTime = bean.getEndTime(); + if(materialReturnTime == null){ + materialReturnTime = DateTime.now(); + } + String teamExitTime = bean.getActualExitTime(); + if (teamExitTime == null) { + teamExitTime = DateTime.now().toString("yyyy-MM-dd"); + } + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + Date exitTime = null; + try { + exitTime = format.parse(teamExitTime); + }catch (Exception e){ + e.printStackTrace(); + } + // 计算超期天数 + long overdueDays = calculateOverdueDays(materialReturnTime, exitTime); + if(overdueDays < 8 ){ + bean.setOverDay(0L); + }else{ + bean.setOverDay(overdueDays-7); + } + + + bean.setActualExitTime(date); BigDecimal leasePrice = bean.getLeasePrice(); BigDecimal num = bean.getNum(); // 根据班组退场时间计算租赁费用 @@ -840,27 +866,21 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic } - // 物资是否已退还(根据endTime字段判断) - boolean isReturned = bean.getEndTime() != null; - if (!isReturned) { - // 1.4 如果当前领用物资还未退还,不收取任何租赁费用,直接计作丢失,收取物资原值 不在租赁费用中体现 - return BigDecimal.ZERO; - } // 物资已退还,按照天数来计算费用 Date materialReturnTime = bean.getEndTime(); + if(materialReturnTime == null){ + materialReturnTime = DateTime.now(); + } + // 计算超期天数 long overdueDays = calculateOverdueDays(materialReturnTime, exitTime); if (overdueDays <= 0) { // 1.3 在班组退场之前归还的物资不收费 return BigDecimal.ZERO; - } else if (overdueDays >= 16) { - // 1.2 超期15天以上也就是16天及以上计为丢失,算作丢失的话直接收取原值、所有租赁费用不收费了 - // 注意:丢失费用应该在getLoseList中处理,这里不收费 - return BigDecimal.ZERO; } else { // 计算超期费用 return calculateOverdueCost(bean, leasePrice, num, overdueDays); @@ -876,7 +896,7 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic if (overdueDays <= 7) { // 超期1~7天不收费 overdueCost = BigDecimal.ZERO; - } else if (overdueDays <= 15) { + } else { // 超期第8天~第15天双倍计费 // 前7天不收费,只计算第8天开始的双倍费用 long doubleBillingDays = overdueDays - 7; diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/ClzAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/ClzAgreementInfoMapper.xml index d1dfabc5..6237edfc 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/ClzAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/ClzAgreementInfoMapper.xml @@ -193,7 +193,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id left join ma_type mt on sai.type_id = mt.type_id left join ma_type mt1 on mt.parent_id = mt1.type_id - where sai.agreement_id = #{agreementId} and sai.end_time is null + where sai.agreement_id = #{agreementId} and sai.end_time is null and sai.is_slt=1 ) res GROUP BY res.typeId,res.startTime,res.endTime From f77c901cb07886ce005792dfb1014f8015ec94ba Mon Sep 17 00:00:00 2001 From: hayu <1604366271@qq.com> Date: Tue, 14 Oct 2025 21:41:55 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/material/back/BackApplyInfoMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml index f96805ba..0299ede2 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml @@ -194,7 +194,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" (bai.create_by REGEXP '^[0-9]+$' AND su.user_id = bai.create_by) -- 数字ID关联 OR (NOT bai.create_by REGEXP '^[0-9]+$' AND su.nick_name = bai.create_by) -- 汉字昵称关联 - ) + ) and su.del_flag='0' WHERE bai.id = #{id} LIMIT 1