This commit is contained in:
parent
6262a382c2
commit
01d5b2bdb4
|
|
@ -114,6 +114,16 @@ public class RepairController extends BaseController {
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 维修已完成--Ⅱ级页面详情列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "维修已完成--Ⅱ级页面详情列表")
|
||||||
|
@GetMapping("/getAppRepairMaTypeListNew")
|
||||||
|
public AjaxResult getAppRepairMaTypeListNew(RepairTaskDetails bean) {
|
||||||
|
List<RepairDeviceSummaryVo> list = service.getAppRepairMaTypeListNew(bean);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取维修任务机具列表--三级页面详情列表
|
* 获取维修任务机具列表--三级页面详情列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -206,6 +216,7 @@ public class RepairController extends BaseController {
|
||||||
* 任务维修完成--提交修饰审核
|
* 任务维修完成--提交修饰审核
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "任务维修完成--提交至修饰审核")
|
@ApiOperation(value = "任务维修完成--提交至修饰审核")
|
||||||
|
@PreventRepeatSubmit
|
||||||
@PostMapping("/endRepairTask")
|
@PostMapping("/endRepairTask")
|
||||||
public AjaxResult endRepairTask(@RequestBody ArrayList<RepairTask> taskList) {
|
public AjaxResult endRepairTask(@RequestBody ArrayList<RepairTask> taskList) {
|
||||||
return service.endRepairTask(taskList);
|
return service.endRepairTask(taskList);
|
||||||
|
|
|
||||||
|
|
@ -79,4 +79,6 @@ public class RepairDeviceSummaryVo extends BaseVO {
|
||||||
|
|
||||||
@ApiModelProperty(value = "待修数量")
|
@ApiModelProperty(value = "待修数量")
|
||||||
private BigDecimal waitRepairNum;
|
private BigDecimal waitRepairNum;
|
||||||
|
|
||||||
|
private BigDecimal completeNum;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,8 @@ public class RepairDeviceVO {
|
||||||
*/
|
*/
|
||||||
private String dataStatus;
|
private String dataStatus;
|
||||||
|
|
||||||
|
private BigDecimal completeNum;
|
||||||
|
|
||||||
// 手动覆盖 getter 方法,确保 List 始终被初始化
|
// 手动覆盖 getter 方法,确保 List 始终被初始化
|
||||||
public List<RepairPartDetails> getCodeInRepairPartList() {
|
public List<RepairPartDetails> getCodeInRepairPartList() {
|
||||||
if (this.codeInRepairPartList == null) {this.codeInRepairPartList = new ArrayList<>();}
|
if (this.codeInRepairPartList == null) {this.codeInRepairPartList = new ArrayList<>();}
|
||||||
|
|
|
||||||
|
|
@ -420,4 +420,18 @@ public interface RepairMapper {
|
||||||
List<RepairTaskDetails> getTestRecordDetails(TestRecord bean);
|
List<RepairTaskDetails> getTestRecordDetails(TestRecord bean);
|
||||||
|
|
||||||
List<PartType> getPartDetails(RepairTaskDetails bean1);
|
List<PartType> getPartDetails(RepairTaskDetails bean1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询机具列表--三级页面详情列表--新
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RepairDeviceVO> getAppRepairMaTypeListNew(RepairTaskDetails bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取机具列表--三级页面详情列表--新
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RepairPartDetails> getDetailsListAppTwo(RepairPartDetails bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -152,4 +152,11 @@ public interface RepairService {
|
||||||
List<TestRecord> getTestRecord(TestRecord dto);
|
List<TestRecord> getTestRecord(TestRecord dto);
|
||||||
|
|
||||||
List<RepairTaskDetails> getTestRecordDetails(TestRecord bean);
|
List<RepairTaskDetails> getTestRecordDetails(TestRecord bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取维修任务机具列表--app
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RepairDeviceSummaryVo> getAppRepairMaTypeListNew(RepairTaskDetails bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,10 @@ public class RepairServiceImpl implements RepairService {
|
||||||
.map(RepairDeviceVO::getScrapNum)
|
.map(RepairDeviceVO::getScrapNum)
|
||||||
.map(num -> Optional.ofNullable(num).orElse(BigDecimal.ZERO))
|
.map(num -> Optional.ofNullable(num).orElse(BigDecimal.ZERO))
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
BigDecimal completeNum = tempList.stream()
|
||||||
|
.map(RepairDeviceVO::getCompleteNum)
|
||||||
|
.map(num -> Optional.ofNullable(num).orElse(BigDecimal.ZERO))
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
|
||||||
Integer dataStatusSum = tempList.stream()
|
Integer dataStatusSum = tempList.stream()
|
||||||
.map(RepairDeviceVO::getDataStatus)
|
.map(RepairDeviceVO::getDataStatus)
|
||||||
|
|
@ -225,6 +229,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
.setDataStatusNum(dataStatusSum)
|
.setDataStatusNum(dataStatusSum)
|
||||||
.setUnitValue(tempList.get(0).getUnitValue())
|
.setUnitValue(tempList.get(0).getUnitValue())
|
||||||
.setWaitRepairNum(waitRepairNum)
|
.setWaitRepairNum(waitRepairNum)
|
||||||
|
.setCompleteNum(completeNum)
|
||||||
.setTypeCost(typeCostSum);
|
.setTypeCost(typeCostSum);
|
||||||
repairDeviceSummaryVoList.add(vo);
|
repairDeviceSummaryVoList.add(vo);
|
||||||
}
|
}
|
||||||
|
|
@ -1553,7 +1558,16 @@ public class RepairServiceImpl implements RepairService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RepairPartDetails> getDetailsListApp(RepairPartDetails bean) {
|
public List<RepairPartDetails> getDetailsListApp(RepairPartDetails bean) {
|
||||||
return repairMapper.getDetailsListApp(bean);
|
try {
|
||||||
|
List<RepairPartDetails> list = repairMapper.getDetailsListApp(bean);
|
||||||
|
if (list.size()<=0){
|
||||||
|
list=repairMapper.getDetailsListAppTwo(bean);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -1679,6 +1693,75 @@ public class RepairServiceImpl implements RepairService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RepairDeviceSummaryVo> getAppRepairMaTypeListNew(RepairTaskDetails bean) {
|
||||||
|
try {
|
||||||
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
|
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
|
||||||
|
List<Long> typeIdList = backApplyInfoMapper.selectTypeIdList(userId);
|
||||||
|
if (CollectionUtils.isEmpty(typeIdList)) {
|
||||||
|
bean.setUserId(userId == 0 ? null : userId);
|
||||||
|
}
|
||||||
|
List<RepairDeviceSummaryVo> repairDeviceSummaryVoList = new ArrayList<>();
|
||||||
|
List<RepairDeviceVO> repairDeviceList = repairMapper.getAppRepairMaTypeListNew(bean);
|
||||||
|
if (CollectionUtil.isNotEmpty(repairDeviceList)) {
|
||||||
|
if (CollectionUtil.isNotEmpty(typeIdList)) {
|
||||||
|
repairDeviceList = repairDeviceList.stream()
|
||||||
|
.filter(item -> typeIdList.contains(item.getFirstId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<Long, List<RepairDeviceVO>> map = repairDeviceList.stream().collect(Collectors.groupingBy(RepairDeviceVO::getTypeId));
|
||||||
|
for (Long key : map.keySet()) {
|
||||||
|
List<RepairDeviceVO> tempList = map.get(key);
|
||||||
|
if (CollectionUtil.isNotEmpty(tempList)) {
|
||||||
|
RepairDeviceSummaryVo vo = new RepairDeviceSummaryVo();
|
||||||
|
Long[] ids = tempList.stream().map(RepairDeviceVO::getId).toArray(Long[]::new);
|
||||||
|
BigDecimal repairNumSum = tempList.stream()
|
||||||
|
.map(RepairDeviceVO::getRepairNum)
|
||||||
|
.map(num -> Optional.ofNullable(num).orElse(BigDecimal.ZERO))
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
BigDecimal repairedNumSum = tempList.stream()
|
||||||
|
.map(RepairDeviceVO::getRepairedNum)
|
||||||
|
.map(num -> Optional.ofNullable(num).orElse(BigDecimal.ZERO))
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
BigDecimal scrapNumSum = tempList.stream()
|
||||||
|
.map(RepairDeviceVO::getScrapNum)
|
||||||
|
.map(num -> Optional.ofNullable(num).orElse(BigDecimal.ZERO))
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
BigDecimal completeNum = tempList.stream()
|
||||||
|
.map(RepairDeviceVO::getCompleteNum)
|
||||||
|
.map(num -> Optional.ofNullable(num).orElse(BigDecimal.ZERO))
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
|
||||||
|
Integer dataStatusSum = tempList.stream()
|
||||||
|
.map(RepairDeviceVO::getDataStatus)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.map(status -> "1".equals(status) ? 1 : 0) // 安全转换
|
||||||
|
.reduce(0, Integer::sum);
|
||||||
|
BigDecimal waitRepairNum = repairNumSum.subtract(repairedNumSum).subtract(scrapNumSum);
|
||||||
|
BigDecimal typeCostSum = tempList.stream().map(RepairDeviceVO::getTotalCost).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
vo.setRepairDeviceList(tempList)
|
||||||
|
.setIds(ids).setTypeRepairNum(repairNumSum).setTypeRepairedNum(repairedNumSum)
|
||||||
|
.setTypeScrapNum(scrapNumSum).setTaskId(tempList.get(0).getTaskId())
|
||||||
|
.setCode(tempList.get(0).getCode()).setTypeName(tempList.get(0).getTypeName())
|
||||||
|
.setTypeId(tempList.get(0).getTypeId()).setType(tempList.get(0).getType())
|
||||||
|
.setUnitName(tempList.get(0).getUnitName()).setManageType(tempList.get(0).getManageType())
|
||||||
|
.setDataStatusNum(dataStatusSum)
|
||||||
|
.setUnitValue(tempList.get(0).getUnitValue())
|
||||||
|
.setWaitRepairNum(waitRepairNum)
|
||||||
|
.setCompleteNum(completeNum)
|
||||||
|
.setTypeCost(typeCostSum);
|
||||||
|
repairDeviceSummaryVoList.add(vo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return repairDeviceSummaryVoList;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("查询修试查询-维修配件查询列表", e.getMessage());
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询修试查询-维修配件查询列表
|
* 查询修试查询-维修配件查询列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -416,6 +416,7 @@
|
||||||
sum(ifnull(rad.repaired_num,0) + ifnull(rad.this_repaired_num,0)) as repairedNum,
|
sum(ifnull(rad.repaired_num,0) + ifnull(rad.this_repaired_num,0)) as repairedNum,
|
||||||
sum(ifnull(rad.scrap_num,0) + ifnull(rad.this_scrap_num,0)) as scrapNum,
|
sum(ifnull(rad.scrap_num,0) + ifnull(rad.this_scrap_num,0)) as scrapNum,
|
||||||
rad.status as status,
|
rad.status as status,
|
||||||
|
rad.status as completeNum,
|
||||||
su.nick_name as repairer,
|
su.nick_name as repairer,
|
||||||
rad.update_time as updateTime,
|
rad.update_time as updateTime,
|
||||||
rad.type_id as typeId,
|
rad.type_id as typeId,
|
||||||
|
|
@ -1267,6 +1268,101 @@
|
||||||
and rar.part_id IS NOT NULL
|
and rar.part_id IS NOT NULL
|
||||||
and mpt2.pa_name IS NOT NULL
|
and mpt2.pa_name IS NOT NULL
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getAppRepairMaTypeListNew" resultType="com.bonus.material.repair.domain.vo.RepairDeviceVO">
|
||||||
|
<![CDATA[
|
||||||
|
select
|
||||||
|
rad.id as id,
|
||||||
|
rad.task_id as taskId,
|
||||||
|
rad.ma_id as maId,
|
||||||
|
mt2.type_name as typeName,
|
||||||
|
mt2.type_id as typeNameId,
|
||||||
|
mt.type_name as type,
|
||||||
|
mt.unit_name as unitName,
|
||||||
|
mt.manage_type as manageType,
|
||||||
|
mm.ma_code as code,
|
||||||
|
ifnull(rad.repair_num, 0) as repairNum,
|
||||||
|
sum(ifnull(rad.repaired_num,0) + ifnull(rad.this_repaired_num,0)) as repairedNum,
|
||||||
|
sum(ifnull(rad.scrap_num,0) + ifnull(rad.this_scrap_num,0)) as scrapNum,
|
||||||
|
rad.status as status,
|
||||||
|
rad.status as completeNum,
|
||||||
|
su.nick_name as repairer,
|
||||||
|
rad.update_time as updateTime,
|
||||||
|
rad.type_id as typeId,
|
||||||
|
rad.back_id as backId,
|
||||||
|
rad.level as level,
|
||||||
|
rad.parent_id as parentId,
|
||||||
|
rad.create_time,
|
||||||
|
bai.CODE AS backCode,
|
||||||
|
mt4.type_id AS firstId,
|
||||||
|
( SELECT COUNT(*) FROM repair_cost rc WHERE rc.repair_id = rad.id ) AS totalCostRecords,
|
||||||
|
( SELECT COALESCE(SUM(rc.costs), 0) FROM repair_cost rc WHERE rc.repair_id = rad.id ) AS totalCost,
|
||||||
|
rad2.`status` as dataStatus,
|
||||||
|
mt.unit_value AS unitValue
|
||||||
|
from
|
||||||
|
repair_apply_details rad
|
||||||
|
left join ma_type mt on rad.type_id = mt.type_id
|
||||||
|
left join ma_machine mm on mm.ma_id = rad.ma_id
|
||||||
|
left join sys_user su on rad.repairer = su.user_id
|
||||||
|
left join ma_type mt2 on mt.parent_id = mt2.type_id
|
||||||
|
LEFT JOIN back_apply_info bai ON rad.back_id = bai.id
|
||||||
|
left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0'
|
||||||
|
left join ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0'
|
||||||
|
left join repair_apply_details rad2 on rad2.task_id=rad.task_id and rad2.ma_id <=> rad.ma_id and rad2.type_id=rad.type_id and rad2.is_ds='1'
|
||||||
|
]]>
|
||||||
|
<if test="userId != null">
|
||||||
|
JOIN ma_type_repair mtr
|
||||||
|
ON mtr.type_id = rad.type_id
|
||||||
|
AND mtr.user_id = #{userId}
|
||||||
|
</if>
|
||||||
|
where
|
||||||
|
rad.task_id = #{taskId}
|
||||||
|
and rad.is_ds=0
|
||||||
|
and (
|
||||||
|
rad.repaired_num!=0 or
|
||||||
|
rad.this_repaired_num!=0 or
|
||||||
|
rad.scrap_num!=0 or
|
||||||
|
rad.this_scrap_num!=0
|
||||||
|
)
|
||||||
|
<if test="companyId != null and companyId != ''">
|
||||||
|
and rad.company_id = #{companyId}
|
||||||
|
</if>
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
AND (locate(#{keyword}, mm.ma_code) > 0
|
||||||
|
or locate(#{keyword}, su.nick_name) > 0
|
||||||
|
or locate(#{keyword}, mt2.type_name) > 0
|
||||||
|
or locate(#{keyword}, mt.type_name) > 0)
|
||||||
|
</if>
|
||||||
|
<if test="type != null and type != ''">
|
||||||
|
AND mt.type_id = #{type}
|
||||||
|
</if>
|
||||||
|
<if test="typeName != null and typeName != ''">
|
||||||
|
AND mt2.type_id = #{typeName}
|
||||||
|
</if>
|
||||||
|
GROUP BY rad.id
|
||||||
|
order by rad.create_time desc
|
||||||
|
</select>
|
||||||
|
<select id="getDetailsListAppTwo" resultType="com.bonus.material.repair.domain.RepairPartDetails">
|
||||||
|
SELECT mm.ma_code as maCode,
|
||||||
|
mt.type_name as typeModelName,
|
||||||
|
mt1.type_name as typeName,
|
||||||
|
su.nick_name as repairer,
|
||||||
|
rad.update_time as createTime,
|
||||||
|
rad.repairer as createBy
|
||||||
|
FROM repair_apply_details rad
|
||||||
|
LEFT JOIN ma_machine mm on mm.ma_id = rad.ma_id
|
||||||
|
LEFT JOIN ma_type mt on mt.type_id = rad.type_id
|
||||||
|
LEFT JOIN ma_type mt1 on mt1.type_id = mt.parent_id
|
||||||
|
LEFT JOIN sys_user su on rad.update_by=su.user_id
|
||||||
|
WHERE rad.task_id = #{taskId}
|
||||||
|
and rad.type_id = #{typeId}
|
||||||
|
and (
|
||||||
|
rad.repaired_num!=0 or
|
||||||
|
rad.this_repaired_num!=0 or
|
||||||
|
rad.scrap_num!=0 or
|
||||||
|
rad.this_repaired_num!=0
|
||||||
|
)
|
||||||
|
and rad.is_ds = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="updateRepairedAndScrapNum">
|
<update id="updateRepairedAndScrapNum">
|
||||||
update
|
update
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue