Merge branch 'lc20240808'
This commit is contained in:
commit
4efbea7893
|
|
@ -59,7 +59,8 @@ public class SltAgreementApply {
|
||||||
*结算总费用
|
*结算总费用
|
||||||
*/
|
*/
|
||||||
private String cost;
|
private String cost;
|
||||||
|
private String repairIds;
|
||||||
|
|
||||||
private List<SltAgreementRelation> relations;
|
private SltAgreementRelation relation;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,10 @@ public class SltAgreementInfo {
|
||||||
*机具id
|
*机具id
|
||||||
*/
|
*/
|
||||||
private String maId;
|
private String maId;
|
||||||
|
/**
|
||||||
|
*配件单价
|
||||||
|
*/
|
||||||
|
private String partPrice;
|
||||||
/**
|
/**
|
||||||
*领料数量
|
*领料数量
|
||||||
*/
|
*/
|
||||||
|
|
@ -67,6 +71,10 @@ public class SltAgreementInfo {
|
||||||
*领料id
|
*领料id
|
||||||
*/
|
*/
|
||||||
private String leaseId;
|
private String leaseId;
|
||||||
|
/**
|
||||||
|
*配件数量
|
||||||
|
*/
|
||||||
|
private String partNum;
|
||||||
/**
|
/**
|
||||||
*退料id
|
*退料id
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ public class SltAgreementRelation {
|
||||||
private String leaseCostOne;
|
private String leaseCostOne;
|
||||||
private String leaseCostThree;
|
private String leaseCostThree;
|
||||||
private String scrapCost;
|
private String scrapCost;
|
||||||
|
private String preScrapCost;
|
||||||
private String repairCost;
|
private String repairCost;
|
||||||
private String isSltOne;
|
private String isSltOne;
|
||||||
private String isSltThree;
|
private String isSltThree;
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ public class RepairApplyRecord implements Serializable {
|
||||||
private List<RepairPartDetails> partList;
|
private List<RepairPartDetails> partList;
|
||||||
private String partStrList;
|
private String partStrList;
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
|
private Integer partId;
|
||||||
/**
|
/**
|
||||||
* 损坏照片id
|
* 损坏照片id
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -161,4 +161,6 @@ public interface RepairMapper {
|
||||||
List<RepairTask> exportRepairTaskList(RepairTask bean);
|
List<RepairTask> exportRepairTaskList(RepairTask bean);
|
||||||
|
|
||||||
int addRepairCost(@Param("bean") RepairApplyRecord bean, @Param("costs") BigDecimal costs,@Param("partType") String partType);
|
int addRepairCost(@Param("bean") RepairApplyRecord bean, @Param("costs") BigDecimal costs,@Param("partType") String partType);
|
||||||
|
|
||||||
|
String selectPartPrice(Long partId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,11 @@ import com.bonus.sgzb.base.domain.vo.DictVo;
|
||||||
import com.bonus.sgzb.base.mapper.RepairMapper;
|
import com.bonus.sgzb.base.mapper.RepairMapper;
|
||||||
import com.bonus.sgzb.base.service.RepairService;
|
import com.bonus.sgzb.base.service.RepairService;
|
||||||
import com.bonus.sgzb.common.core.exception.ServiceException;
|
import com.bonus.sgzb.common.core.exception.ServiceException;
|
||||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
|
||||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.sgzb.system.api.domain.SysUser;
|
import com.bonus.sgzb.system.api.domain.SysUser;
|
||||||
import com.bonus.sgzb.system.api.model.LoginUser;
|
import com.bonus.sgzb.system.api.model.LoginUser;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -58,8 +58,6 @@ public class RepairServiceImpl implements RepairService {
|
||||||
bean.setCreateBy(loginUser.getUserid());
|
bean.setCreateBy(loginUser.getUserid());
|
||||||
List<RepairPartDetails> partList = bean.getPartList();
|
List<RepairPartDetails> partList = bean.getPartList();
|
||||||
BigDecimal sfCosts = new BigDecimal("0");
|
BigDecimal sfCosts = new BigDecimal("0");
|
||||||
BigDecimal bsfCosts = new BigDecimal("0");
|
|
||||||
Integer partNum = 0;
|
|
||||||
String nbType = "1";
|
String nbType = "1";
|
||||||
String fcType = "2";
|
String fcType = "2";
|
||||||
String sfPart = "1";
|
String sfPart = "1";
|
||||||
|
|
@ -103,6 +101,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
if (nbType.equals(bean.getRepairType())) {
|
if (nbType.equals(bean.getRepairType())) {
|
||||||
for (RepairPartDetails partDetails : partList) {
|
for (RepairPartDetails partDetails : partList) {
|
||||||
if (partDetails.getPartId() != null) {
|
if (partDetails.getPartId() != null) {
|
||||||
|
// 有维修配件时
|
||||||
if (partDetails.getPartCost() == null || partDetails.getPartCost().isEmpty()) {
|
if (partDetails.getPartCost() == null || partDetails.getPartCost().isEmpty()) {
|
||||||
partDetails.setPartCost("0");
|
partDetails.setPartCost("0");
|
||||||
}
|
}
|
||||||
|
|
@ -111,14 +110,21 @@ public class RepairServiceImpl implements RepairService {
|
||||||
partDetails.setTypeId(bean.getTypeId());
|
partDetails.setTypeId(bean.getTypeId());
|
||||||
partDetails.setCreateBy(loginUser.getUserid());
|
partDetails.setCreateBy(loginUser.getUserid());
|
||||||
partDetails.setCompanyId(bean.getCompanyId());
|
partDetails.setCompanyId(bean.getCompanyId());
|
||||||
|
// 根据partid 找到配件单价
|
||||||
|
String partPrice = mapper.selectPartPrice(partDetails.getPartId());
|
||||||
|
partDetails.setPartCost(partPrice);
|
||||||
mapper.addPart(partDetails);
|
mapper.addPart(partDetails);
|
||||||
bean.setPartPrice(partDetails.getPartCost());
|
bean.setPartPrice(partDetails.getPartCost());
|
||||||
partNum += partDetails.getPartNum();
|
bean.setPartId(partDetails.getPartId().intValue());
|
||||||
|
bean.setPartNum(partDetails.getPartNum());
|
||||||
bean.setRepairContent(partDetails.getRepairContent());
|
bean.setRepairContent(partDetails.getRepairContent());
|
||||||
bean.setPartType(partDetails.getPartType());
|
bean.setPartType(partDetails.getPartType());
|
||||||
|
mapper.addRecord(bean);
|
||||||
|
} else {
|
||||||
|
// 不选维修配件时
|
||||||
|
mapper.addRecord(bean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bean.setPartNum(partNum);
|
|
||||||
}
|
}
|
||||||
if (fcType.equals(bean.getRepairType())) {
|
if (fcType.equals(bean.getRepairType())) {
|
||||||
bean.setPartName(partList.get(0).getPartName());
|
bean.setPartName(partList.get(0).getPartName());
|
||||||
|
|
@ -129,40 +135,26 @@ public class RepairServiceImpl implements RepairService {
|
||||||
} else {
|
} else {
|
||||||
bean.setSupplierId(partList.get(0).getSupplierId());
|
bean.setSupplierId(partList.get(0).getSupplierId());
|
||||||
}
|
}
|
||||||
if (bean.getPartPrice() == null || bean.getPartPrice().isEmpty()) {
|
if (partList.get(0).getPartPrice() == null || partList.get(0).getPartPrice().isEmpty()) {
|
||||||
bean.setPartPrice("0");
|
bean.setPartPrice("0");
|
||||||
} else {
|
} else {
|
||||||
bean.setPartPrice(partList.get(0).getPartPrice());
|
bean.setPartPrice(partList.get(0).getPartPrice());
|
||||||
}
|
}
|
||||||
bean.setPartNum(partList.get(0).getPartNum());
|
bean.setPartNum(partList.get(0).getPartNum());
|
||||||
|
mapper.addRecord(bean);
|
||||||
}
|
}
|
||||||
for (RepairPartDetails partDetails : partList) {
|
for (RepairPartDetails partDetails : partList) {
|
||||||
|
if (StringUtils.isNotBlank(partDetails.getPartCost())) {
|
||||||
if (sfPart.equals(partDetails.getPartType())) {
|
|
||||||
if (StringUtils.isBlank(partDetails.getPartCost())) {
|
|
||||||
partDetails.setPartCost("0");
|
|
||||||
}
|
|
||||||
BigDecimal partCost = new BigDecimal(partDetails.getPartCost());
|
BigDecimal partCost = new BigDecimal(partDetails.getPartCost());
|
||||||
BigDecimal partNumber = new BigDecimal(partDetails.getPartNum());
|
BigDecimal partNumber = new BigDecimal(partDetails.getPartNum());
|
||||||
sfCosts = sfCosts.add(partCost.multiply(partNumber));
|
sfCosts = sfCosts.add(partCost.multiply(partNumber));
|
||||||
} else if (bsfPart.equals(partDetails.getPartType())) {
|
|
||||||
if (StringUtils.isBlank(partDetails.getPartCost())) {
|
|
||||||
partDetails.setPartCost("0");
|
|
||||||
}
|
|
||||||
BigDecimal partCost = new BigDecimal(partDetails.getPartCost());
|
|
||||||
bsfCosts = bsfCosts.add(partCost);
|
|
||||||
} else {
|
|
||||||
throw new ServiceException("请选择配件收费类型");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!"0".equals(sfCosts.toString())) {
|
if (!"0".equals(sfCosts.toString())) {
|
||||||
mapper.addRepairCost(bean, sfCosts, sfPart);
|
mapper.addRepairCost(bean, sfCosts, sfPart);
|
||||||
}
|
}
|
||||||
if (!"0".equals(bsfCosts.toString())) {
|
|
||||||
mapper.addRepairCost(bean, bsfCosts, bsfPart);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
mapper.addRecord(bean);
|
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,4 +145,8 @@ public interface RepairAuditDetailsMapper
|
||||||
List<RepairPart> getPartRecord(RepairAuditDetails bean);
|
List<RepairPart> getPartRecord(RepairAuditDetails bean);
|
||||||
|
|
||||||
int updateRepairCost(@Param("inputDetails")RepairAuditDetails inputDetails, @Param("status") String status);
|
int updateRepairCost(@Param("inputDetails")RepairAuditDetails inputDetails, @Param("status") String status);
|
||||||
|
|
||||||
|
List<String> getRepairApplyRecordId(Long repairId);
|
||||||
|
|
||||||
|
void updateRecodeStatus(String id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,4 +70,6 @@ public interface SltAgreementInfoMapper {
|
||||||
int updateOutSourceCosts(SltAgreementInfo sltAgreementInfo);
|
int updateOutSourceCosts(SltAgreementInfo sltAgreementInfo);
|
||||||
|
|
||||||
int updateBmAgreementInfo(@Param("agreementId") String agreementId);
|
int updateBmAgreementInfo(@Param("agreementId") String agreementId);
|
||||||
|
|
||||||
|
int updateRecodeIsSlt(String id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -241,6 +241,12 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
repairTestInputMapper.insertRepairInputDetails(repairInputDetails);
|
repairTestInputMapper.insertRepairInputDetails(repairInputDetails);
|
||||||
}
|
}
|
||||||
repairAuditDetailsMapper.updateRepairCost(inputDetails,status);
|
repairAuditDetailsMapper.updateRepairCost(inputDetails,status);
|
||||||
|
// 根据repairId找到taskId和 typeId 、maid
|
||||||
|
List<String> repairApplyRecordId = repairAuditDetailsMapper.getRepairApplyRecordId(inputDetails.getRepairId());
|
||||||
|
// 再去repair_apply_record 中查,并给一个标识表示审核完成
|
||||||
|
for (String id : repairApplyRecordId) {
|
||||||
|
repairAuditDetailsMapper.updateRecodeStatus(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scrapNumList != null && scrapNumList.size() > 0) {
|
if (scrapNumList != null && scrapNumList.size() > 0) {
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
||||||
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, loseList, list);
|
List<SltAgreementRelation> relations = getRelations(leaseListOne, leaseListThree, repairList, scrapList, preScrapList, loseList, list);
|
||||||
sltInfoVo.setRelations(relations);
|
sltInfoVo.setRelations(relations);
|
||||||
return sltInfoVo;
|
return sltInfoVo;
|
||||||
}
|
}
|
||||||
|
|
@ -237,7 +237,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> 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<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();
|
||||||
|
|
@ -245,6 +245,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
||||||
BigDecimal leaseCostOne = BigDecimal.ZERO;
|
BigDecimal leaseCostOne = BigDecimal.ZERO;
|
||||||
BigDecimal leaseCostThree = BigDecimal.ZERO;
|
BigDecimal leaseCostThree = BigDecimal.ZERO;
|
||||||
BigDecimal scrapCost = BigDecimal.ZERO;
|
BigDecimal scrapCost = BigDecimal.ZERO;
|
||||||
|
BigDecimal preScrapCost = BigDecimal.ZERO;
|
||||||
BigDecimal repairCost = BigDecimal.ZERO;
|
BigDecimal repairCost = BigDecimal.ZERO;
|
||||||
for (SltAgreementInfo lease : leaseListOne) {
|
for (SltAgreementInfo lease : leaseListOne) {
|
||||||
if (lease.getAgreementId().equals(info.getAgreementId().toString())) {
|
if (lease.getAgreementId().equals(info.getAgreementId().toString())) {
|
||||||
|
|
@ -268,7 +269,8 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
||||||
}
|
}
|
||||||
for (SltAgreementInfo repair : repairList) {
|
for (SltAgreementInfo repair : repairList) {
|
||||||
if (repair.getAgreementId().equals(info.getAgreementId().toString())) {
|
if (repair.getAgreementId().equals(info.getAgreementId().toString())) {
|
||||||
BigDecimal allCost = new BigDecimal(repair.getAllCosts());
|
// 暂时先计算配件总价,后期需要加上委外维修费用
|
||||||
|
BigDecimal allCost = new BigDecimal(repair.getPartAllCosts());
|
||||||
repairCost = repairCost.add(allCost);
|
repairCost = repairCost.add(allCost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -278,6 +280,12 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
||||||
scrapCost = scrapCost.add(cost);
|
scrapCost = scrapCost.add(cost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (SltAgreementInfo scrap : preScrapList) {
|
||||||
|
if (scrap.getAgreementId().equals(info.getAgreementId().toString())) {
|
||||||
|
BigDecimal cost = new BigDecimal(scrap.getCosts());
|
||||||
|
preScrapCost = preScrapCost.add(cost);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (SltAgreementInfo lose : loseList) {
|
for (SltAgreementInfo lose : loseList) {
|
||||||
if (lose.getAgreementId().equals(info.getAgreementId().toString())) {
|
if (lose.getAgreementId().equals(info.getAgreementId().toString())) {
|
||||||
//TODO 上面已经set过值,这里为什么还要set值
|
//TODO 上面已经set过值,这里为什么还要set值
|
||||||
|
|
@ -307,6 +315,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
||||||
relation.setLeaseCostThree(leaseCostThree.toString());
|
relation.setLeaseCostThree(leaseCostThree.toString());
|
||||||
relation.setRepairCost(repairCost.toString());
|
relation.setRepairCost(repairCost.toString());
|
||||||
relation.setScrapCost(scrapCost.toString());
|
relation.setScrapCost(scrapCost.toString());
|
||||||
|
relation.setPreScrapCost(preScrapCost.toString());
|
||||||
relation.setLoseCost(loseCost.toString());
|
relation.setLoseCost(loseCost.toString());
|
||||||
relations.add(relation);
|
relations.add(relation);
|
||||||
}
|
}
|
||||||
|
|
@ -316,8 +325,16 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public AjaxResult submitFee(SltAgreementApply apply) {
|
public AjaxResult submitFee(SltAgreementApply apply) {
|
||||||
|
SltAgreementRelation relation = apply.getRelation();
|
||||||
|
if (StringUtils.isNotBlank(apply.getRepairIds())) {
|
||||||
|
for (String id : apply.getRepairIds().split(",")) {
|
||||||
|
sltAgreementInfoMapper.updateRecodeIsSlt(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
sltAgreementInfoMapper.updateInfoStatus(apply.getAgreementId());
|
sltAgreementInfoMapper.updateInfoStatus(apply.getAgreementId());
|
||||||
int i = sltAgreementInfoMapper.updateBmAgreementInfo(apply.getAgreementId());
|
sltAgreementInfoMapper.updateBmAgreementInfo(apply.getAgreementId());
|
||||||
|
relation.setAgreementId(apply.getAgreementId());
|
||||||
|
int i = sltAgreementInfoMapper.insRelation(relation);
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
return AjaxResult.success("结算成功");
|
return AjaxResult.success("结算成功");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
<mapper namespace="com.bonus.sgzb.base.mapper.RepairMapper">
|
<mapper namespace="com.bonus.sgzb.base.mapper.RepairMapper">
|
||||||
<insert id="addRecord">
|
<insert id="addRecord">
|
||||||
insert into repair_apply_record (task_id,ma_id,type_id,repair_num,scrap_num,repair_type,create_by,create_time,repair_content,company_id,scrap_reason,scrap_type,supplier_id,part_num,part_price,part_type,part_name,repairer,file_ids,remark)
|
insert into repair_apply_record (task_id,ma_id,type_id,repair_num,scrap_num,repair_type,create_by,create_time,repair_content,company_id,scrap_reason,scrap_type,supplier_id,part_num,part_price,part_type,part_name,repairer,file_ids,remark,part_id)
|
||||||
values (#{taskId},#{maId},#{typeId},#{repairNum},#{scrapNum},#{repairType},#{createBy},now(),#{repairContent},#{companyId},#{scrapReason},#{scrapType},#{supplierId},#{partNum},#{partPrice},#{partType},#{partName},#{repairer},#{fileIds},#{remark});
|
values (#{taskId},#{maId},#{typeId},#{repairNum},#{scrapNum},#{repairType},#{createBy},now(),#{repairContent},#{companyId},#{scrapReason},#{scrapType},#{supplierId},#{partNum},#{partPrice},#{partType},#{partName},#{repairer},#{fileIds},#{remark},#{partId});
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="addPart">
|
<insert id="addPart">
|
||||||
insert into repair_part_details (task_id,ma_id,type_id,part_id,part_num,part_cost,part_type,create_by,create_time,company_id,repair_content)
|
insert into repair_part_details (task_id,ma_id,type_id,part_id,part_num,part_cost,part_type,create_by,create_time,company_id,repair_content)
|
||||||
|
|
@ -272,6 +272,9 @@
|
||||||
from repair_apply_details
|
from repair_apply_details
|
||||||
where task_id = #{taskId}
|
where task_id = #{taskId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectPartPrice" resultType="java.lang.String">
|
||||||
|
select ifnull(buy_price,0) from ma_part_type where pa_id = #{partId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -223,6 +223,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
set part_type = #{status}
|
set part_type = #{status}
|
||||||
where repair_id = #{inputDetails.repairId}
|
where repair_id = #{inputDetails.repairId}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateRecodeStatus">
|
||||||
|
update repair_apply_record set status = 1 where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteRepairAuditDetailsById" parameterType="Long">
|
<delete id="deleteRepairAuditDetailsById" parameterType="Long">
|
||||||
delete from repair_audit_details where id = #{id}
|
delete from repair_audit_details where id = #{id}
|
||||||
|
|
@ -451,5 +454,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
from repair_apply_details
|
from repair_apply_details
|
||||||
where id = #{repairId}
|
where id = #{repairId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getRepairApplyRecordId" resultType="java.lang.String">
|
||||||
|
SELECT DISTINCT
|
||||||
|
rar.id
|
||||||
|
FROM
|
||||||
|
repair_apply_record rar
|
||||||
|
LEFT JOIN repair_cost rc ON rar.task_id = rc.task_id
|
||||||
|
AND rar.type_id = rc.type_id
|
||||||
|
AND ( rar.ma_id = rc.ma_id OR rar.ma_id IS NULL )
|
||||||
|
WHERE
|
||||||
|
rc.repair_id = #{repairId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -31,8 +31,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
values (#{code},#{creator},now(),'0',#{companyId},#{cost});
|
values (#{code},#{creator},now(),'0',#{companyId},#{cost});
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insRelation">
|
<insert id="insRelation">
|
||||||
insert into slt_agreement_relation (apply_id,agreement_id,add_cost,sub_cost,remark,cost,status,lease_cost,repair_cost,scrap_cost,lose_cost)
|
insert into slt_agreement_relation (apply_id,agreement_id,add_cost,sub_cost,remark,cost,status,lease_one_cost,lease_three_cost,repair_cost,scrap_cost,lose_cost)
|
||||||
values (#{applyId},#{agreementId},#{addCost},#{subCost},#{remark},#{cost},'0',#{leaseCost},#{repairCost},#{scrapCost},#{loseCost});
|
values (#{applyId},#{agreementId},#{addCost},#{subCost},#{remark},#{cost},'0',#{leaseCostOne},#{leaseCostThree},#{repairCost},#{scrapCost},#{loseCost});
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insDetails">
|
<insert id="insDetails">
|
||||||
insert into slt_agreement_details
|
insert into slt_agreement_details
|
||||||
|
|
@ -112,6 +112,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<update id="updateBmAgreementInfo">
|
<update id="updateBmAgreementInfo">
|
||||||
update bm_agreement_info set is_slt = 1 where agreement_id = #{agreementId}
|
update bm_agreement_info set is_slt = 1 where agreement_id = #{agreementId}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateRecodeIsSlt">
|
||||||
|
update repair_apply_record set is_slt = 1 where id = #{id}
|
||||||
|
</update>
|
||||||
<select id="getSltAgreementInfo" resultType="com.bonus.sgzb.material.domain.AgreementInfo">
|
<select id="getSltAgreementInfo" resultType="com.bonus.sgzb.material.domain.AgreementInfo">
|
||||||
SELECT bai.agreement_id, bai.agreement_code , contract_code,file_url ,file_name,sign_time,
|
SELECT bai.agreement_id, bai.agreement_code , contract_code,file_url ,file_name,sign_time,
|
||||||
bui.unit_id,bui.unit_name , bp.lot_id as projectId , bp.lot_name as projectName,
|
bui.unit_id,bui.unit_name , bp.lot_id as projectId , bp.lot_name as projectName,
|
||||||
|
|
@ -192,38 +195,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where tta.agreement_id = #{bean.agreementId} and tt.task_type = #{taskType}
|
where tta.agreement_id = #{bean.agreementId} and tt.task_type = #{taskType}
|
||||||
</select>
|
</select>
|
||||||
<select id="getRepairDetailsList" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
<select id="getRepairDetailsList" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||||
select tta.agreement_id as agreementId,
|
SELECT
|
||||||
bui.unit_name as unitName,
|
rar.id,
|
||||||
bp.lot_name as projectName,
|
rar.is_slt AS isSlt,
|
||||||
rc.type_id as typeId,
|
tta.agreement_id AS agreementId,
|
||||||
rc.id,
|
bui.unit_name AS unitName,
|
||||||
rc.ma_id as maId,
|
bp.lot_name AS projectName,
|
||||||
mt1.type_name as typeName,
|
rar.type_id AS typeId,
|
||||||
mt.type_name as modelName,
|
rar.ma_id AS maId,
|
||||||
mt.unit_name as nuitName,
|
mt1.type_name AS typeName,
|
||||||
rc.repair_num as num,
|
mt.type_name AS modelName,
|
||||||
rc.costs as costs,
|
mt.unit_name AS nuitName,
|
||||||
rc.out_source_costs as outSourceCosts,
|
rar.repair_num AS num,
|
||||||
rc.costs AS partAllCosts,
|
rar.part_num AS partNum,
|
||||||
ROUND(rc.costs + IFNULL(rc.out_source_costs ,0), 2) AS allCosts,
|
rar.part_price AS partPrice,
|
||||||
|
rar.part_num * rar.part_price AS partAllCosts,
|
||||||
mpt.pa_name partModelName,
|
mpt.pa_name partModelName,
|
||||||
mpt2.pa_name partName,
|
mpt2.pa_name partName
|
||||||
case rc.part_type when '0' then '不收费' when '1' then '收费' else '' end as partType,
|
FROM
|
||||||
rc.status as repairStatus,
|
repair_apply_record rar
|
||||||
rc.company_id as companyId
|
LEFT JOIN tm_task_agreement tta ON rar.task_id = tta.task_id
|
||||||
from repair_cost rc
|
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
|
||||||
left join tm_task_agreement tta on rc.task_id = tta.task_id
|
|
||||||
LEFT JOIN repair_part_details rpd on rc.task_id = rpd.task_id and rc.type_id = rpd.type_id and (rc.ma_id = rpd.ma_id OR rpd.ma_id IS NULL)
|
|
||||||
LEFT JOIN ma_part_type mpt on rpd.part_id = mpt.pa_id
|
|
||||||
LEFT JOIN ma_part_type mpt2 on mpt.parent_id = mpt2.pa_id
|
|
||||||
LEFT JOIN bm_agreement_info bai on tta.agreement_id = bai.agreement_id
|
|
||||||
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
|
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
|
||||||
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
||||||
left join ma_type mt on rc.type_id = mt.type_id
|
LEFT JOIN ma_type mt ON rar.type_id = mt.type_id
|
||||||
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||||
where rc.status in ('0','1')
|
LEFT JOIN ma_part_type mpt ON rar.part_id = mpt.pa_id
|
||||||
|
LEFT JOIN ma_part_type mpt2 ON mpt.parent_id = mpt2.pa_id
|
||||||
|
where rar.repair_type in (1,2) and rar.part_num != 0 and rar.status = 1
|
||||||
<if test="taskList != null and taskList.size() > 0">
|
<if test="taskList != null and taskList.size() > 0">
|
||||||
and rc.task_id in
|
and rar.task_id in
|
||||||
<foreach item="task" collection="taskList" open="(" separator="," close=")">
|
<foreach item="task" collection="taskList" open="(" separator="," close=")">
|
||||||
#{task.taskId}
|
#{task.taskId}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue