材料站结算修改
This commit is contained in:
parent
4f5f2eb0f2
commit
a431f69a95
|
|
@ -3,6 +3,7 @@ package com.bonus.material.clz.controller;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.nacos.common.utils.StringUtils;
|
import com.alibaba.nacos.common.utils.StringUtils;
|
||||||
import com.bonus.common.biz.config.PoiOutPage;
|
import com.bonus.common.biz.config.PoiOutPage;
|
||||||
|
|
@ -182,7 +183,17 @@ public class ClzSltAgreementInfoController extends BaseController {
|
||||||
List<MaterialSltAgreementInfo> oneOfList = clzSltAgreementInfoMapper.getLeaseList(sltAgreementInfo);
|
List<MaterialSltAgreementInfo> oneOfList = clzSltAgreementInfoMapper.getLeaseList(sltAgreementInfo);
|
||||||
//设定班组实际出场时间
|
//设定班组实际出场时间
|
||||||
if(!oneOfList.isEmpty()){
|
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()){
|
if(date!=null && !date.isEmpty()){
|
||||||
oneOfList.get(0).setActualExitTime(date);
|
oneOfList.get(0).setActualExitTime(date);
|
||||||
}
|
}
|
||||||
|
|
@ -280,7 +291,16 @@ public class ClzSltAgreementInfoController extends BaseController {
|
||||||
loseList.addAll(overdueReturnedList);
|
loseList.addAll(overdueReturnedList);
|
||||||
//设定班组实际出场时间
|
//设定班组实际出场时间
|
||||||
if(!loseList.isEmpty()){
|
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()){
|
if(date!=null && !date.isEmpty()){
|
||||||
loseList.get(0).setActualExitTime(date);
|
loseList.get(0).setActualExitTime(date);
|
||||||
}
|
}
|
||||||
|
|
@ -442,7 +462,15 @@ public class ClzSltAgreementInfoController extends BaseController {
|
||||||
}
|
}
|
||||||
//设定班组实际出场时间
|
//设定班组实际出场时间
|
||||||
if(!listAll.isEmpty()){
|
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()){
|
if(date!=null && !date.isEmpty()){
|
||||||
listAll.get(0).setActualExitTime(date);
|
listAll.get(0).setActualExitTime(date);
|
||||||
}
|
}
|
||||||
|
|
@ -551,7 +579,19 @@ public class ClzSltAgreementInfoController extends BaseController {
|
||||||
|
|
||||||
private BigDecimal calculateRentalCostByTeamExitTime(MaterialSltAgreementInfo bean, BigDecimal leasePrice, BigDecimal num) {
|
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字段判断)
|
// 物资是否已退还(根据endTime字段判断)
|
||||||
boolean isReturned = bean.getEndTime() != null;
|
boolean isReturned = bean.getEndTime() != null;
|
||||||
|
|
@ -565,7 +605,7 @@ public class ClzSltAgreementInfoController extends BaseController {
|
||||||
Date materialReturnTime = bean.getEndTime();
|
Date materialReturnTime = bean.getEndTime();
|
||||||
|
|
||||||
// 计算超期天数
|
// 计算超期天数
|
||||||
long overdueDays = calculateOverdueDays(materialReturnTime, teamExitTime);
|
long overdueDays = calculateOverdueDays(materialReturnTime, exitTime);
|
||||||
|
|
||||||
if (overdueDays <= 0) {
|
if (overdueDays <= 0) {
|
||||||
// 1.3 在班组退场之前归还的物资不收费
|
// 1.3 在班组退场之前归还的物资不收费
|
||||||
|
|
|
||||||
|
|
@ -123,4 +123,6 @@ public interface ClzSltAgreementInfoMapper {
|
||||||
List<MaterialSltAgreementInfo> getClzTeamList(MaterialSltAgreementInfo bean);
|
List<MaterialSltAgreementInfo> getClzTeamList(MaterialSltAgreementInfo bean);
|
||||||
|
|
||||||
String getTeamOutTime(MaterialSltAgreementInfo materialSltAgreementInfo);
|
String getTeamOutTime(MaterialSltAgreementInfo materialSltAgreementInfo);
|
||||||
|
|
||||||
|
String getTeamSjOutTime(MaterialSltAgreementInfo materialSltAgreementInfo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.bonus.material.clz.service.impl;
|
package com.bonus.material.clz.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.bonus.common.biz.constant.GlobalConstants;
|
import com.bonus.common.biz.constant.GlobalConstants;
|
||||||
import com.bonus.common.biz.domain.ProjectTreeBuild;
|
import com.bonus.common.biz.domain.ProjectTreeBuild;
|
||||||
|
|
@ -32,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -775,9 +777,17 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
|
||||||
*/
|
*/
|
||||||
private List<MaterialSltAgreementInfo> getLeaseList(MaterialSltAgreementInfo info) {
|
private List<MaterialSltAgreementInfo> getLeaseList(MaterialSltAgreementInfo info) {
|
||||||
List<MaterialSltAgreementInfo> oneOfList = clzSltAgreementInfoMapper.getLeaseList(info);
|
List<MaterialSltAgreementInfo> oneOfList = clzSltAgreementInfoMapper.getLeaseList(info);
|
||||||
|
String date = null ;
|
||||||
//设定班组实际出场时间
|
//设定班组实际出场时间
|
||||||
if(!oneOfList.isEmpty()){
|
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()){
|
if(date!=null && !date.isEmpty()){
|
||||||
oneOfList.get(0).setActualExitTime(date);
|
oneOfList.get(0).setActualExitTime(date);
|
||||||
}
|
}
|
||||||
|
|
@ -816,7 +826,19 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
|
||||||
*/
|
*/
|
||||||
private BigDecimal calculateRentalCostByTeamExitTime(MaterialSltAgreementInfo bean, BigDecimal leasePrice, BigDecimal num) {
|
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字段判断)
|
// 物资是否已退还(根据endTime字段判断)
|
||||||
boolean isReturned = bean.getEndTime() != null;
|
boolean isReturned = bean.getEndTime() != null;
|
||||||
|
|
@ -830,7 +852,7 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
|
||||||
Date materialReturnTime = bean.getEndTime();
|
Date materialReturnTime = bean.getEndTime();
|
||||||
|
|
||||||
// 计算超期天数
|
// 计算超期天数
|
||||||
long overdueDays = calculateOverdueDays(materialReturnTime, teamExitTime);
|
long overdueDays = calculateOverdueDays(materialReturnTime, exitTime);
|
||||||
|
|
||||||
if (overdueDays <= 0) {
|
if (overdueDays <= 0) {
|
||||||
// 1.3 在班组退场之前归还的物资不收费
|
// 1.3 在班组退场之前归还的物资不收费
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
res.agreementId,
|
res.agreementId,
|
||||||
res.unitName,
|
res.unitName,
|
||||||
res.unitId,
|
res.unitId,
|
||||||
|
res.wsProId,
|
||||||
res.projectName,
|
res.projectName,
|
||||||
res.companyId,
|
res.companyId,
|
||||||
res.typeId,
|
res.typeId,
|
||||||
|
|
@ -118,9 +119,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
sai.agreement_id as agreementId,
|
sai.agreement_id as agreementId,
|
||||||
bui.unit_id as unitId,
|
bui.unit_id as unitId,
|
||||||
bui.unit_name as unitName,
|
bui.unit_name as unitName,
|
||||||
|
bp.external_id as wsProId,
|
||||||
bp.pro_name as projectName,
|
bp.pro_name as projectName,
|
||||||
sai.company_id as companyId,
|
sai.company_id as companyId,
|
||||||
sai.type_id as typeId,
|
sai.type_id as typeId,
|
||||||
|
|
||||||
sai.ma_id as maId,
|
sai.ma_id as maId,
|
||||||
mt.unit_value as unitValue,
|
mt.unit_value as unitValue,
|
||||||
mt1.type_name as typeName,
|
mt1.type_name as typeName,
|
||||||
|
|
@ -148,6 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
res.unitId,
|
res.unitId,
|
||||||
res.unitName,
|
res.unitName,
|
||||||
res.projectName,
|
res.projectName,
|
||||||
|
res.wsProId,
|
||||||
res.companyId,
|
res.companyId,
|
||||||
res.typeId,
|
res.typeId,
|
||||||
res.typeName,
|
res.typeName,
|
||||||
|
|
@ -170,6 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
bui.unit_id as unitId,
|
bui.unit_id as unitId,
|
||||||
bui.unit_name as unitName,
|
bui.unit_name as unitName,
|
||||||
bp.pro_name as projectName,
|
bp.pro_name as projectName,
|
||||||
|
bp.external_id as wsProId,
|
||||||
sai.company_id as companyId,
|
sai.company_id as companyId,
|
||||||
sai.type_id as typeId,
|
sai.type_id as typeId,
|
||||||
sai.ma_id as maId,
|
sai.ma_id as maId,
|
||||||
|
|
@ -177,7 +182,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
mt1.type_name as typeName,
|
mt1.type_name as typeName,
|
||||||
mt.type_name as modelName,
|
mt.type_name as modelName,
|
||||||
mt.unit_name as mtUnitName,
|
mt.unit_name as mtUnitName,
|
||||||
sai.buy_price as buyPrice,
|
mt.buy_price as buyPrice,
|
||||||
sai.num as num,
|
sai.num as num,
|
||||||
sai.start_time as startTime,
|
sai.start_time as startTime,
|
||||||
sai.end_time as endTime,
|
sai.end_time as endTime,
|
||||||
|
|
@ -391,7 +396,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
clz_bm_agreement_info bai
|
clz_bm_agreement_info bai
|
||||||
left join bm_unit bu on bai.unit_id = bu.unit_id
|
left join bm_unit bu on bai.unit_id = bu.unit_id
|
||||||
WHERE
|
WHERE
|
||||||
bai.project_id = #{proId}
|
bu.unit_name IS NOT NULL
|
||||||
|
AND bai.project_id = #{proId}
|
||||||
|
GROUP BY
|
||||||
|
bu.unit_id
|
||||||
</select>
|
</select>
|
||||||
<select id="getTeamOutTime" resultType="java.lang.String">
|
<select id="getTeamOutTime" resultType="java.lang.String">
|
||||||
select
|
select
|
||||||
|
|
@ -405,6 +413,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
order by bzj.sjccsj desc limit 1
|
order by bzj.sjccsj desc limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getTeamSjOutTime" resultType="java.lang.String">
|
||||||
|
select
|
||||||
|
|
||||||
|
bz.sjjcsj as time
|
||||||
|
from
|
||||||
|
bm_unit bu
|
||||||
|
left join `micro-tool`.bzgl_bz bz on bz.bzz_idcard = bu.bzz_idcard
|
||||||
|
|
||||||
|
where bu.unit_id = #{unitId} AND bz.project_id = #{wsProId}
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="updateClzAgreementInfoByIds">
|
<update id="updateClzAgreementInfoByIds">
|
||||||
update clz_bm_agreement_info
|
update clz_bm_agreement_info
|
||||||
set is_slt = 1, update_time = now()
|
set is_slt = 1, update_time = now()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue