This commit is contained in:
mashuai 2025-07-30 13:50:08 +08:00
parent 33df1a7311
commit 5064809f9e
5 changed files with 22 additions and 5 deletions

View File

@ -82,5 +82,17 @@ public interface BmAgreementInfoMapper
BmAgreementInfo queryByTeamIdAndProjectIdCl(BmAgreementInfo bmAgreementInfo);
/**
* 新增材料站协议信息
* @param bmAgreementInfo
* @return
*/
int insertBmAgreementInfoClz(BmAgreementInfo bmAgreementInfo);
/**
* 查询材料站协议列表
* @param nowDate
* @return
*/
int selectNumByMonthClz(Date nowDate);
}

View File

@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
@ -394,7 +395,7 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
if (null == bean.getLeasePrice()) {
bean.setLeasePrice(BigDecimal.valueOf(0.00));
}else{
bean.setLeasePrice(bean.getLeasePrice().setScale(2, BigDecimal.ROUND_HALF_UP));
bean.setLeasePrice(bean.getLeasePrice().setScale(2, RoundingMode.HALF_UP));
}
if (null == bean.getNum()) {
bean.setNum(BigDecimal.valueOf(0L));
@ -405,7 +406,7 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
BigDecimal leasePrice = bean.getLeasePrice();
BigDecimal num = bean.getNum();
BigDecimal leaseDays = new BigDecimal(bean.getLeaseDays());
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays).setScale(2, RoundingMode.HALF_UP);
bean.setCosts(costs);
}
return leaseList;

View File

@ -992,7 +992,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
Date nowDate = DateUtils.getNowDate();
String format = dateFormat.format(nowDate);
String result = format.replace("-", "");
int num = bmAgreementInfoMapper.selectNumByMonth(nowDate);
int num = bmAgreementInfoMapper.selectNumByMonthClz(nowDate);
return MaterialConstants.AGREEMENT_PREFIX + result + String.format("-%03d", num + 1);
}

View File

@ -194,4 +194,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
unit_id = #{unitId}
and project_id = #{projectId}
</select>
<select id="selectNumByMonthClz" resultType="java.lang.Integer">
select count(*) from clz_bm_agreement_info where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m')
</select>
</mapper>

View File

@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
saa.remark,bai.protocol,saa.cost as costs,
case when (saa.id is null or saa.status = '0') then '0' when saa.status = '1' then '1' when saa.status = '2' then '2' when saa.status = '3' then '3' end as sltStatus
FROM clz_slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
LEFT JOIN clz_bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
LEFT JOIN clz_slt_agreement_apply saa on saa.agreement_id = bai.agreement_id
@ -106,7 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
DATE(sai.end_time) as endTime,
DATEDIFF(IF(sai.end_time is null,CURDATE(),sai.end_time), sai.start_time) + 1 as leaseDays
from clz_slt_agreement_info sai
LEFT JOIN bm_agreement_info bai on sai.agreement_id = bai.agreement_id
LEFT JOIN clz_bm_agreement_info bai on sai.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
left join ma_type mt on sai.type_id = mt.type_id