重庆需求变更代码提交

This commit is contained in:
liang.chao 2024-09-27 15:01:37 +08:00
parent b28c58aa76
commit b1c60a2b9e
10 changed files with 92 additions and 11 deletions

View File

@ -0,0 +1,27 @@
package com.bonus.sgzb.base.api.domain;
import lombok.Data;
import java.math.BigDecimal;
/**
* @Authorliang.chao
* @Date2024/9/27 - 9:44
*/
@Data
public class ApplyRelation {
/**
* 费用描述
*/
private String costRemark;
/**
* 费用价格
*/
private BigDecimal addCost;
/**
* 协议id
*/
private String agreementId;
}

View File

@ -65,7 +65,7 @@ public class SltAgreementInfo {
@ExcelProperty(index = 6, value = "开始日期") @ExcelProperty(index = 6, value = "开始日期")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime; private String startTime;
/** /**
* 退料时间 * 退料时间
*/ */
@ -73,7 +73,7 @@ public class SltAgreementInfo {
@ExcelProperty(index = 7, value = "结算日期") @ExcelProperty(index = 7, value = "结算日期")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime; private String endTime;
/** /**
* 0在用1退回 * 0在用1退回
*/ */

View File

@ -65,4 +65,5 @@ public class SltAgreementRelation {
*数据所属 *数据所属
*/ */
private String companyId; private String companyId;
private List<ApplyRelation> applyRelation;
} }

View File

@ -32,6 +32,10 @@ public class SltInfoVo {
* 丢失费用列表 * 丢失费用列表
*/ */
List<SltAgreementInfo> loseList; List<SltAgreementInfo> loseList;
/**
* 额外增加费用明细
*/
List<ApplyRelation> addCostList;
List<SltAgreementRelation> relations; List<SltAgreementRelation> relations;

View File

@ -210,4 +210,10 @@ public class ProjUsingRecord {
@ApiModelProperty(value = "实时库存") @ApiModelProperty(value = "实时库存")
private Integer num; private Integer num;
/**
* 在用标识
*/
@ApiModelProperty(value = "在用标识")
private Integer useFlag;
} }

View File

@ -34,13 +34,13 @@ public class ProjectMonthDetail {
*/ */
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date startTime; private String startTime;
/** /**
* 结束日期 * 结束日期
*/ */
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date endTime; private String endTime;
/** /**
* 结算天数 * 结算天数
*/ */

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.material.mapper; package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.base.api.domain.ApplyRelation;
import com.bonus.sgzb.base.api.domain.SltAgreementApply; import com.bonus.sgzb.base.api.domain.SltAgreementApply;
import com.bonus.sgzb.base.api.domain.SltAgreementInfo; import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
import com.bonus.sgzb.base.api.domain.SltAgreementRelation; import com.bonus.sgzb.base.api.domain.SltAgreementRelation;
@ -72,4 +73,8 @@ public interface SltAgreementInfoMapper {
int updateBmAgreementInfo(@Param("agreementId") String agreementId); int updateBmAgreementInfo(@Param("agreementId") String agreementId);
int updateRecodeIsSlt(String id); int updateRecodeIsSlt(String id);
int insertApplyRelation(ApplyRelation applyRelation1);
List<ApplyRelation> getAddLoseList(AgreementInfo bean);
} }

View File

@ -2,10 +2,7 @@ package com.bonus.sgzb.material.service.impl;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.bonus.sgzb.base.api.domain.SltAgreementApply; import com.bonus.sgzb.base.api.domain.*;
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
import com.bonus.sgzb.base.api.domain.SltAgreementRelation;
import com.bonus.sgzb.base.api.domain.SltInfoVo;
import com.bonus.sgzb.common.core.exception.ServiceException; import com.bonus.sgzb.common.core.exception.ServiceException;
import com.bonus.sgzb.common.core.utils.DateTimeHelper; import com.bonus.sgzb.common.core.utils.DateTimeHelper;
@ -64,17 +61,29 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
List<SltAgreementInfo> preScrapList = getPreScrapList(list); List<SltAgreementInfo> preScrapList = getPreScrapList(list);
//丢失费用列表 //丢失费用列表
List<SltAgreementInfo> loseList = getLoseList(list); List<SltAgreementInfo> loseList = getLoseList(list);
//额外增加费用
List<ApplyRelation> addCostList = getAddLoseList(list);
sltInfoVo.setLeaseListOne(leaseListOne); sltInfoVo.setLeaseListOne(leaseListOne);
sltInfoVo.setLeaseListThree(leaseListThree); sltInfoVo.setLeaseListThree(leaseListThree);
sltInfoVo.setRepairList(repairList); sltInfoVo.setRepairList(repairList);
sltInfoVo.setScrapList(scrapList); sltInfoVo.setScrapList(scrapList);
sltInfoVo.setPreScrapList(preScrapList); sltInfoVo.setPreScrapList(preScrapList);
sltInfoVo.setLoseList(loseList); sltInfoVo.setLoseList(loseList);
List<SltAgreementRelation> relations = getRelations(leaseListOne, leaseListThree, repairList, scrapList, preScrapList, loseList, list); sltInfoVo.setAddCostList(addCostList);
List<SltAgreementRelation> relations = getRelations(leaseListOne, leaseListThree, repairList, scrapList, preScrapList, loseList, addCostList, list);
sltInfoVo.setRelations(relations); sltInfoVo.setRelations(relations);
return sltInfoVo; return sltInfoVo;
} }
private List<ApplyRelation> getAddLoseList(List<AgreementInfo> list) {
List<ApplyRelation> applyRelations = new ArrayList<>();
for (AgreementInfo bean : list) {
List<ApplyRelation> addLoseList = sltAgreementInfoMapper.getAddLoseList(bean);
applyRelations.addAll(addLoseList);
}
return applyRelations;
}
@Override @Override
public List<SltAgreementInfo> getPreScrapList(List<AgreementInfo> list) { public List<SltAgreementInfo> getPreScrapList(List<AgreementInfo> list) {
List<SltAgreementInfo> scrapList = new ArrayList<>(); List<SltAgreementInfo> scrapList = new ArrayList<>();
@ -214,7 +223,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
return leaseList; return leaseList;
} }
private List<SltAgreementRelation> getRelations(List<SltAgreementInfo> leaseListOne, List<SltAgreementInfo> leaseListThree, List<SltAgreementInfo> repairList, List<SltAgreementInfo> scrapList, List<SltAgreementInfo> preScrapList, List<SltAgreementInfo> loseList, List<AgreementInfo> list) { private List<SltAgreementRelation> getRelations(List<SltAgreementInfo> leaseListOne, List<SltAgreementInfo> leaseListThree, List<SltAgreementInfo> repairList, List<SltAgreementInfo> scrapList, List<SltAgreementInfo> preScrapList, List<SltAgreementInfo> loseList, List<ApplyRelation> addCostList, List<AgreementInfo> list) {
List<SltAgreementRelation> relations = new ArrayList<>(); List<SltAgreementRelation> relations = new ArrayList<>();
for (AgreementInfo info : list) { for (AgreementInfo info : list) {
SltAgreementRelation relation = new SltAgreementRelation(); SltAgreementRelation relation = new SltAgreementRelation();
@ -224,6 +233,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
BigDecimal scrapCost = BigDecimal.ZERO; BigDecimal scrapCost = BigDecimal.ZERO;
BigDecimal preScrapCost = BigDecimal.ZERO; BigDecimal preScrapCost = BigDecimal.ZERO;
BigDecimal repairCost = BigDecimal.ZERO; BigDecimal repairCost = BigDecimal.ZERO;
BigDecimal addCost = BigDecimal.ZERO;
for (SltAgreementInfo lease : leaseListOne) { for (SltAgreementInfo lease : leaseListOne) {
if (lease.getAgreementId().equals(info.getAgreementId().toString())) { if (lease.getAgreementId().equals(info.getAgreementId().toString())) {
relation.setAgreementId(lease.getAgreementId()); relation.setAgreementId(lease.getAgreementId());
@ -274,6 +284,13 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
loseCost = loseCost.add(cost); loseCost = loseCost.add(cost);
} }
} }
for (ApplyRelation applyRelation : addCostList) {
if (applyRelation.getAgreementId().equals(info.getAgreementId().toString())) {
BigDecimal cost = applyRelation.getAddCost();
addCost = addCost.add(cost);
}
}
// 判断是否已经结算(01承担方) // 判断是否已经结算(01承担方)
boolean b = leaseListOne.stream().allMatch(t -> "1".equals(t.getIsSlt())); boolean b = leaseListOne.stream().allMatch(t -> "1".equals(t.getIsSlt()));
if (b) { if (b) {
@ -294,6 +311,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
relation.setScrapCost(scrapCost); relation.setScrapCost(scrapCost);
relation.setPreScrapCost(preScrapCost); relation.setPreScrapCost(preScrapCost);
relation.setLoseCost(loseCost); relation.setLoseCost(loseCost);
relation.setAddCost(addCost);
relations.add(relation); relations.add(relation);
} }
return relations; return relations;
@ -303,6 +321,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
@Transactional @Transactional
public AjaxResult submitFee(SltAgreementApply apply) { public AjaxResult submitFee(SltAgreementApply apply) {
SltAgreementRelation relation = apply.getRelation(); SltAgreementRelation relation = apply.getRelation();
BigDecimal addPrice = new BigDecimal(0);
if (StringUtils.isNotBlank(apply.getRepairIds())) { if (StringUtils.isNotBlank(apply.getRepairIds())) {
for (String id : apply.getRepairIds().split(",")) { for (String id : apply.getRepairIds().split(",")) {
sltAgreementInfoMapper.updateRecodeIsSlt(id); sltAgreementInfoMapper.updateRecodeIsSlt(id);
@ -311,6 +330,15 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
sltAgreementInfoMapper.updateInfoStatus(apply.getAgreementId()); sltAgreementInfoMapper.updateInfoStatus(apply.getAgreementId());
sltAgreementInfoMapper.updateBmAgreementInfo(apply.getAgreementId()); sltAgreementInfoMapper.updateBmAgreementInfo(apply.getAgreementId());
relation.setAgreementId(apply.getAgreementId()); relation.setAgreementId(apply.getAgreementId());
List<ApplyRelation> applyRelation = relation.getApplyRelation();
if (applyRelation != null && applyRelation.size() > 0) {
for (ApplyRelation applyRelation1 : applyRelation) {
addPrice = addPrice.add(applyRelation1.getAddCost());
applyRelation1.setAgreementId(apply.getAgreementId());
sltAgreementInfoMapper.insertApplyRelation(applyRelation1);
}
}
relation.setAddCost(addPrice);
int i = sltAgreementInfoMapper.insRelation(relation); int i = sltAgreementInfoMapper.insRelation(relation);
if (i > 0) { if (i > 0) {
return AjaxResult.success("结算成功"); return AjaxResult.success("结算成功");

View File

@ -122,5 +122,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY bai.agreement_id, GROUP BY bai.agreement_id,
mt.type_id) AS subquery2 ON subquery1.type_id = subquery2.type_id mt.type_id) AS subquery2 ON subquery1.type_id = subquery2.type_id
AND subquery1.agreement_id = subquery2.agreement_id AND subquery1.agreement_id = subquery2.agreement_id
<if test="useFlag == 1">
WHERE IFNULL(subquery1.outNum, 0) - IFNULL(subquery2.backNum, 0) > 0
</if>
</select> </select>
</mapper> </mapper>

View File

@ -61,11 +61,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="partType != null">#{partType},</if> <if test="partType != null">#{partType},</if>
</trim> </trim>
</insert> </insert>
<insert id="insertApplyRelation">
insert into slt_agreement_add_cost (cost_remark,add_cost,agreement_id)
values (#{costRemark},#{addCost},#{agreementId})
</insert>
<update id="updateInfoStatus"> <update id="updateInfoStatus">
update slt_agreement_info update slt_agreement_info
set is_slt = '1', set is_slt = '1',
slt_time = now(), slt_time = now(),
update_time = now(), update_time = now()
where agreement_id = #{agreementId} where agreement_id = #{agreementId}
</update> </update>
<update id="updateRelation"> <update id="updateRelation">
@ -591,4 +595,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
group by sad.type_id,sad.ma_id,sad.scrap_type group by sad.type_id,sad.ma_id,sad.scrap_type
</select> </select>
<select id="getAddLoseList" resultType="com.bonus.sgzb.base.api.domain.ApplyRelation">
select cost_remark,add_cost,agreement_id from slt_agreement_add_cost where agreement_id = #{agreementId}
</select>
</mapper> </mapper>