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 aa07d7e1..250223cb 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 @@ -3,6 +3,7 @@ package com.bonus.material.clz.controller; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.convert.Convert; +import cn.hutool.core.date.DateTime; import com.alibaba.fastjson.JSONObject; import com.alibaba.nacos.common.utils.StringUtils; import com.bonus.common.biz.config.PoiOutPage; @@ -182,7 +183,17 @@ public class ClzSltAgreementInfoController extends BaseController { List oneOfList = clzSltAgreementInfoMapper.getLeaseList(sltAgreementInfo); //设定班组实际出场时间 if(!oneOfList.isEmpty()){ - String date = clzSltAgreementInfoMapper.getTeamOutTime(oneOfList.get(0)); + + String date = "暂无" ; + //先判断是否在场 + String exitTime = clzSltAgreementInfoMapper.getTeamSjOutTime(oneOfList.get(0)); + if( exitTime!=null && !exitTime.isEmpty() ){ + + }else{ + date = clzSltAgreementInfoMapper.getTeamOutTime(oneOfList.get(0)); + } + + if(date!=null && !date.isEmpty()){ oneOfList.get(0).setActualExitTime(date); } @@ -280,7 +291,16 @@ public class ClzSltAgreementInfoController extends BaseController { loseList.addAll(overdueReturnedList); //设定班组实际出场时间 if(!loseList.isEmpty()){ - String date = clzSltAgreementInfoMapper.getTeamOutTime(loseList.get(0)); + + String date = "暂无" ; + //先判断是否在场 + String exitTime = clzSltAgreementInfoMapper.getTeamSjOutTime(oneOfList.get(0)); + if( exitTime!=null && !exitTime.isEmpty() ){ + + }else{ + date = clzSltAgreementInfoMapper.getTeamOutTime(loseList.get(0)); + } + if(date!=null && !date.isEmpty()){ loseList.get(0).setActualExitTime(date); } @@ -442,7 +462,15 @@ public class ClzSltAgreementInfoController extends BaseController { } //设定班组实际出场时间 if(!listAll.isEmpty()){ - String date = clzSltAgreementInfoMapper.getTeamOutTime(listAll.get(0)); + String date = "暂无" ; + //先判断是否在场 + String exitTime = clzSltAgreementInfoMapper.getTeamSjOutTime(listAll.get(0)); + if( exitTime!=null && !exitTime.isEmpty() ){ + + }else{ + date = clzSltAgreementInfoMapper.getTeamOutTime(listAll.get(0)); + } + if(date!=null && !date.isEmpty()){ listAll.get(0).setActualExitTime(date); } @@ -551,7 +579,19 @@ public class ClzSltAgreementInfoController extends BaseController { private BigDecimal calculateRentalCostByTeamExitTime(MaterialSltAgreementInfo bean, BigDecimal leasePrice, BigDecimal num) { // 模拟班组退场时间(后续会通过参数传入) - Date teamExitTime = simulateTeamExitTime(); + // Date teamExitTime = simulateTeamExitTime(); + 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(); + } + // 物资是否已退还(根据endTime字段判断) boolean isReturned = bean.getEndTime() != null; @@ -565,7 +605,7 @@ public class ClzSltAgreementInfoController extends BaseController { Date materialReturnTime = bean.getEndTime(); // 计算超期天数 - long overdueDays = calculateOverdueDays(materialReturnTime, teamExitTime); + long overdueDays = calculateOverdueDays(materialReturnTime, exitTime); if (overdueDays <= 0) { // 1.3 在班组退场之前归还的物资不收费 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/ClzSltAgreementInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/ClzSltAgreementInfoMapper.java index 916eabb5..328ae46d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/ClzSltAgreementInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/ClzSltAgreementInfoMapper.java @@ -123,4 +123,6 @@ public interface ClzSltAgreementInfoMapper { List getClzTeamList(MaterialSltAgreementInfo bean); String getTeamOutTime(MaterialSltAgreementInfo materialSltAgreementInfo); + + String getTeamSjOutTime(MaterialSltAgreementInfo materialSltAgreementInfo); } 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 1746a9b9..8ad0f2ef 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 @@ -1,6 +1,7 @@ package com.bonus.material.clz.service.impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateTime; import cn.hutool.core.util.IdUtil; import com.bonus.common.biz.constant.GlobalConstants; import com.bonus.common.biz.domain.ProjectTreeBuild; @@ -32,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; import java.math.RoundingMode; +import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -775,9 +777,17 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic */ private List getLeaseList(MaterialSltAgreementInfo info) { List oneOfList = clzSltAgreementInfoMapper.getLeaseList(info); + String date = null ; //设定班组实际出场时间 if(!oneOfList.isEmpty()){ - String date = clzSltAgreementInfoMapper.getTeamOutTime(oneOfList.get(0)); + //先判断是否在场 + String exitTime = clzSltAgreementInfoMapper.getTeamSjOutTime(oneOfList.get(0)); + if( exitTime!=null && !exitTime.isEmpty() ){ + + }else{ + date = clzSltAgreementInfoMapper.getTeamOutTime(oneOfList.get(0)); + } + if(date!=null && !date.isEmpty()){ oneOfList.get(0).setActualExitTime(date); } @@ -816,7 +826,19 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic */ private BigDecimal calculateRentalCostByTeamExitTime(MaterialSltAgreementInfo bean, BigDecimal leasePrice, BigDecimal num) { // 模拟班组退场时间(后续会通过参数传入) - Date teamExitTime = simulateTeamExitTime(); + // Date teamExitTime = simulateTeamExitTime(); + 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(); + } + // 物资是否已退还(根据endTime字段判断) boolean isReturned = bean.getEndTime() != null; @@ -830,7 +852,7 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic Date materialReturnTime = bean.getEndTime(); // 计算超期天数 - long overdueDays = calculateOverdueDays(materialReturnTime, teamExitTime); + long overdueDays = calculateOverdueDays(materialReturnTime, exitTime); if (overdueDays <= 0) { // 1.3 在班组退场之前归还的物资不收费 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 490a3d85..d1dfabc5 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 @@ -98,6 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" res.agreementId, res.unitName, res.unitId, + res.wsProId, res.projectName, res.companyId, res.typeId, @@ -118,9 +119,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sai.agreement_id as agreementId, bui.unit_id as unitId, bui.unit_name as unitName, + bp.external_id as wsProId, bp.pro_name as projectName, sai.company_id as companyId, sai.type_id as typeId, + sai.ma_id as maId, mt.unit_value as unitValue, mt1.type_name as typeName, @@ -148,6 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" res.unitId, res.unitName, res.projectName, + res.wsProId, res.companyId, res.typeId, res.typeName, @@ -170,6 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bui.unit_id as unitId, bui.unit_name as unitName, bp.pro_name as projectName, + bp.external_id as wsProId, sai.company_id as companyId, sai.type_id as typeId, sai.ma_id as maId, @@ -177,7 +182,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mt1.type_name as typeName, mt.type_name as modelName, mt.unit_name as mtUnitName, - sai.buy_price as buyPrice, + mt.buy_price as buyPrice, sai.num as num, sai.start_time as startTime, sai.end_time as endTime, @@ -384,14 +389,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where `code` = #{sltApplyCode} + + update clz_bm_agreement_info set is_slt = 1, update_time = now()