This commit is contained in:
parent
076e233b9b
commit
303621a8d5
|
|
@ -68,6 +68,9 @@ public class RepairPartDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "配件费用")
|
||||
private BigDecimal partCost;
|
||||
|
||||
@ApiModelProperty(value = "配件费用")
|
||||
private BigDecimal backCost;
|
||||
|
||||
/** 类型(0不收费,1收费) */
|
||||
@Excel(name = "类型", readConverterExp = "0=不收费,1收费")
|
||||
private Integer partType;
|
||||
|
|
|
|||
|
|
@ -111,9 +111,9 @@ public interface RepairMapper {
|
|||
/**
|
||||
* 完成维修--更改维修状态
|
||||
* @param ids 主键集合
|
||||
* @param userId 用户id
|
||||
* @param userName
|
||||
*/
|
||||
int batchQualified(@Param("ids") ArrayList<Long> ids, @Param("userId") Long userId);
|
||||
int batchQualified(@Param("ids") ArrayList<Long> ids, @Param("userName") String userName);
|
||||
|
||||
/**
|
||||
* 根据已修数量、已报废数量--更新维修状态
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import com.bonus.material.back.domain.BackApplyInfo;
|
|||
import com.bonus.material.back.mapper.BackApplyInfoMapper;
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.material.basic.mapper.BmFileInfoMapper;
|
||||
import com.bonus.material.ma.domain.PartType;
|
||||
import com.bonus.material.ma.mapper.PartTypeMapper;
|
||||
import com.bonus.material.repair.domain.*;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceSummaryVo;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
|
||||
|
|
@ -77,6 +79,9 @@ public class RepairServiceImpl implements RepairService {
|
|||
@Resource
|
||||
private TmTaskAgreementMapper taskAgreementMapper;
|
||||
|
||||
@Resource
|
||||
private PartTypeMapper partTypeMapper;
|
||||
|
||||
// 1:内部维修 2:外部返厂维修 3:报废
|
||||
private final int INNER_REPAIR = 1; // 需要严格匹配枚举值 RepairTypeEnum.INNER_REPAIR.getTypeId();
|
||||
private final int RETURN_FACTORY = 2; // 需要严格匹配枚举值 RepairTypeEnum.RETURN_FACTORY.getTypeId();
|
||||
|
|
@ -508,6 +513,9 @@ public class RepairServiceImpl implements RepairService {
|
|||
bean.setRepairer(repairPartDetails.getRepairer());
|
||||
bean.setRemark(repairPartDetails.getRemark());
|
||||
repairMapper.updateRepairer(bean);
|
||||
} else {
|
||||
bean.setRepairer(SecurityUtils.getUsername());
|
||||
repairMapper.updateRepairer(bean);
|
||||
}
|
||||
|
||||
// 统一处理配件集合数据
|
||||
|
|
@ -825,11 +833,16 @@ public class RepairServiceImpl implements RepairService {
|
|||
repairMapper.addRecord(repairApplyRecord);
|
||||
}
|
||||
}
|
||||
|
||||
// 根据配件id 统计配件费用
|
||||
PartType type = partTypeMapper.selectPartTypeByPaId(partList.get(0).getPartId());
|
||||
if (type != null) {
|
||||
partList.get(0).setPartPrice(type.getBuyPrice());
|
||||
}
|
||||
BigDecimal sfCosts = countPartCosts(partList, BigDecimal.ZERO);
|
||||
// TODO: 判断是否是收费配件,因数据存在多条,可能有些是免费配件 有些收费,所以这里用价格统一做处理,后续讨论
|
||||
// SQL: 新增【维修费用记录表】
|
||||
repairMapper.addRepairCost(repairApplyRecord, sfCosts, sfCosts.equals(BigDecimal.ZERO) ? "0" : "1");
|
||||
repairApplyRecord.setRepairNum(partList.get(0).getPartNum() != null ? BigDecimal.valueOf(partList.get(0).getPartNum()) : BigDecimal.ZERO);
|
||||
repairMapper.addRepairCost(repairApplyRecord, sfCosts, partList.get(0).getPartType().toString());
|
||||
}
|
||||
|
||||
// 外部维修
|
||||
|
|
@ -861,11 +874,12 @@ public class RepairServiceImpl implements RepairService {
|
|||
repairMapper.addRecord(repairApplyRecord);
|
||||
|
||||
// 配件费用计算
|
||||
BigDecimal sfCosts = countPartCosts(partList, BigDecimal.ZERO);
|
||||
BigDecimal sfCosts = partList.get(0).getBackCost() != null ? partList.get(0).getBackCost() : BigDecimal.ZERO;
|
||||
|
||||
// TODO: 判断是否是收费配件,因数据存在多条,可能有些是免费配件 有些收费,所以这里用价格统一做处理,后续讨论
|
||||
// SQL: 新增【维修费用记录表】
|
||||
repairMapper.addRepairCost(repairApplyRecord, sfCosts, sfCosts.equals(BigDecimal.ZERO) ? "0" : "1");
|
||||
repairApplyRecord.setRepairNum(partList.get(0).getPartNum() != null ? BigDecimal.valueOf(partList.get(0).getPartNum()) : BigDecimal.ZERO);
|
||||
repairMapper.addRepairCost(repairApplyRecord, sfCosts, partList.get(0).getPartType().toString());
|
||||
}
|
||||
|
||||
// 如果是报废类型,进行上传附件相关处理
|
||||
|
|
@ -1178,7 +1192,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int batchQualified(ArrayList<Long> ids) {
|
||||
return repairMapper.batchQualified(ids, SecurityUtils.getLoginUser().getUserid());
|
||||
return repairMapper.batchQualified(ids, SecurityUtils.getUsername());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -275,19 +275,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt2.type_name AS typeName,
|
||||
mt1.type_name AS typeModelName,
|
||||
mm.ma_code AS maCode,
|
||||
a.repairer AS repairPersonName,
|
||||
MAX( rar.create_time ) AS repairTime
|
||||
rad.repairer AS repairPersonName,
|
||||
rar.create_time AS repairTime
|
||||
FROM
|
||||
repair_apply_record rar
|
||||
LEFT JOIN ma_type mt1 ON rar.type_id = mt1.type_id
|
||||
repair_apply_details rad
|
||||
LEFT JOIN ma_type mt1 ON rad.type_id = mt1.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
|
||||
AND mt2.del_flag = '0'
|
||||
LEFT JOIN ma_machine mm ON rar.ma_id = mm.ma_id
|
||||
LEFT JOIN ( SELECT task_id, type_id, GROUP_CONCAT( DISTINCT repairer ) AS repairer FROM repair_apply_details GROUP BY task_id, type_id ) a ON a.task_id = rar.task_id
|
||||
AND a.type_id = rar.type_id
|
||||
LEFT JOIN ma_machine mm ON rad.ma_id = mm.ma_id
|
||||
LEFT JOIN repair_apply_record rar ON rad.task_id = rar.task_id
|
||||
and rad.type_id = rar.type_id and rar.ma_id = rad.ma_id
|
||||
WHERE
|
||||
rar.task_id = #{taskId} and rar.type_id = #{typeId}
|
||||
rad.task_id = #{taskId} and rad.type_id = #{typeId}
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
mt2.type_name LIKE CONCAT('%', #{keyWord}, '%')
|
||||
|
|
|
|||
|
|
@ -186,8 +186,9 @@
|
|||
update repair_apply_details
|
||||
set status = '1',
|
||||
repaired_num = repair_num - ifnull(scrap_num, 0),
|
||||
update_by = #{userId},
|
||||
update_time = now()
|
||||
update_by = #{userName},
|
||||
update_time = now(),
|
||||
repairer = #{userName}
|
||||
where id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
|
|
@ -705,7 +706,9 @@
|
|||
repair_apply_details
|
||||
set
|
||||
repairer = #{repairer},
|
||||
remark = #{remark},
|
||||
<if test="remark != '' and remark != null">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
update_time = now()
|
||||
where
|
||||
id = #{id}
|
||||
|
|
|
|||
Loading…
Reference in New Issue