维修模块优化
This commit is contained in:
parent
1cfbfcb013
commit
b347771ae3
|
|
@ -11,6 +11,7 @@ import com.bonus.material.repair.domain.RepairPartDetails;
|
|||
import com.bonus.material.repair.domain.RepairTask;
|
||||
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceSummaryVo;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
|
||||
import com.bonus.material.repair.service.RepairService;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
|
|
@ -88,7 +89,8 @@ public class RepairController extends BaseController {
|
|||
@ApiOperation(value = "获取维修物资设备列表---不分页")
|
||||
@GetMapping("/getAppRepairMaTypeList")
|
||||
public AjaxResult getAppRepairMaTypeList(RepairTaskDetails bean) {
|
||||
List<RepairDeviceListVo> list = service.getRepairMaTypeList(bean);
|
||||
//List<RepairDeviceListVo> list = service.getRepairMaTypeList(bean);
|
||||
List<RepairDeviceSummaryVo> list = service.getRepairDeviceSummary(bean, true);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
package com.bonus.material.repair.domain.vo;
|
||||
|
||||
import com.bonus.common.biz.domain.BaseVO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
public class RepairDeviceSummaryVo extends BaseVO {
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long[] ids;
|
||||
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Long taskId;
|
||||
|
||||
@ApiModelProperty(value = "类型id")
|
||||
private Long typeNameId;
|
||||
|
||||
@ApiModelProperty(value = "设备编码")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "规格型号id")
|
||||
private Long typeId;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "管理模式")
|
||||
private Integer manageType;
|
||||
|
||||
@ApiModelProperty(value = "设备表主键id")
|
||||
private Long[] maIds;
|
||||
|
||||
@ApiModelProperty(value = "维修人员")
|
||||
private String[] repairers;
|
||||
|
||||
@ApiModelProperty(value = "维修总量")
|
||||
private int typeRepairNum;
|
||||
|
||||
@ApiModelProperty(value = "已修数量")
|
||||
private int typeRepairedNum;
|
||||
|
||||
@ApiModelProperty(value = "维修报废数量")
|
||||
private int typeScrapNum;
|
||||
|
||||
// @ApiModelProperty(value = "维修费用记录条数")
|
||||
// private Integer typeCostRecords;
|
||||
|
||||
@ApiModelProperty(value = "维修费用合计")
|
||||
private BigDecimal typeCostSum;
|
||||
|
||||
@ApiModelProperty(value = "内层物资类型集合")
|
||||
private List<RepairDeviceVO> repairDeviceList = new ArrayList<>();
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package com.bonus.material.repair.domain.vo;
|
||||
|
||||
import com.bonus.material.repair.domain.RepairPart;
|
||||
import com.bonus.material.basic.domain.BmFileInfo;
|
||||
import com.bonus.material.repair.domain.RepairPartDetails;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -67,6 +67,12 @@ public class RepairDeviceVO {
|
|||
@ApiModelProperty(value = "维修报废数量")
|
||||
private int scrapNum;
|
||||
|
||||
@ApiModelProperty(value = "维修费用记录条数")
|
||||
private Integer totalCostRecords;
|
||||
|
||||
@ApiModelProperty(value = "维修费用小计计")
|
||||
private BigDecimal totalCost;
|
||||
|
||||
@ApiModelProperty(value = "编码--内部维修配件集合")
|
||||
private List<RepairPartDetails> codeInRepairPartList;
|
||||
|
||||
|
|
@ -85,6 +91,9 @@ public class RepairDeviceVO {
|
|||
@ApiModelProperty(value = "数量--报废维修配件集合")
|
||||
private List<RepairPartDetails> numberScrapRepairPartList;
|
||||
|
||||
@ApiModelProperty(value = "报废附件")
|
||||
private List<BmFileInfo> fileList;
|
||||
|
||||
// 手动覆盖 getter 方法,确保 List 始终被初始化
|
||||
public List<RepairPartDetails> getCodeInRepairPartList() {
|
||||
if (this.codeInRepairPartList == null) {this.codeInRepairPartList = new ArrayList<>();}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.bonus.material.repair.domain.RepairPartDetails;
|
|||
import com.bonus.material.repair.domain.RepairTask;
|
||||
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -30,6 +31,8 @@ public interface RepairMapper {
|
|||
*/
|
||||
RepairTask getRepairTaskInfoByTaskId(Long taskId);
|
||||
|
||||
List<RepairDeviceVO> getRepairDeviceList(RepairTaskDetails bean);
|
||||
|
||||
/**
|
||||
* 获取维修详细列表
|
||||
* @param bean 维修任务详情--查询条件
|
||||
|
|
|
|||
|
|
@ -6,10 +6,9 @@ import com.bonus.material.repair.domain.RepairApplyRecord;
|
|||
import com.bonus.material.repair.domain.RepairTask;
|
||||
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceSummaryVo;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -32,6 +31,10 @@ public interface RepairService {
|
|||
*/
|
||||
List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean, boolean isGroup);
|
||||
|
||||
|
||||
List<RepairDeviceSummaryVo> getRepairDeviceSummary(RepairTaskDetails bean, boolean isGroup);
|
||||
|
||||
|
||||
default List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean) {
|
||||
return getRepairMaTypeList(bean, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import com.bonus.material.basic.domain.BmFileInfo;
|
|||
import com.bonus.material.basic.mapper.BmFileInfoMapper;
|
||||
import com.bonus.material.repair.domain.*;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceSummaryVo;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
|
||||
import com.bonus.material.repair.domain.vo.RepairTicketVo;
|
||||
import com.bonus.material.repair.mapper.RepairAuditDetailsMapper;
|
||||
|
|
@ -26,9 +27,7 @@ import org.springframework.dao.DataAccessException;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -70,6 +69,35 @@ public class RepairServiceImpl implements RepairService {
|
|||
return repairMapper.exportRepairTaskList(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RepairDeviceSummaryVo> getRepairDeviceSummary(RepairTaskDetails bean, boolean isGroup) {
|
||||
List<RepairDeviceSummaryVo> repairDeviceSummaryVoList = new ArrayList<>();
|
||||
List<RepairDeviceVO> repairDeviceList = repairMapper.getRepairDeviceList(bean);
|
||||
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);
|
||||
int repairNumSum = tempList.stream().mapToInt(RepairDeviceVO::getRepairNum).sum();
|
||||
int repairedNumSum = tempList.stream().mapToInt(RepairDeviceVO::getRepairedNum).sum();
|
||||
//BigDecimal typeCostSum = tempList.stream().map(RepairDeviceVO::getRepairedNum).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
vo.setRepairDeviceList(tempList);
|
||||
vo.setIds(ids);
|
||||
vo.setTypeRepairNum(repairNumSum);
|
||||
vo.setTypeRepairedNum(repairedNumSum);
|
||||
vo.setTaskId(tempList.get(0).getTaskId());
|
||||
vo.setCode(tempList.get(0).getCode());
|
||||
vo.setTypeName(tempList.get(0).getTypeName());
|
||||
vo.setTypeId(tempList.get(0).getTypeId());
|
||||
vo.setType(tempList.get(0).getType());
|
||||
vo.setManageType(tempList.get(0).getManageType());
|
||||
repairDeviceSummaryVoList.add(vo);
|
||||
}
|
||||
}
|
||||
return repairDeviceSummaryVoList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean, boolean isGroup) {
|
||||
if (Objects.isNull(bean)) {
|
||||
|
|
|
|||
|
|
@ -256,6 +256,53 @@
|
|||
tt.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getRepairDeviceList" resultType="com.bonus.material.repair.domain.vo.RepairDeviceVO">
|
||||
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,
|
||||
rad.repair_num as repairNum,
|
||||
rad.repaired_num as repairedNum,
|
||||
rad.scrap_num as scrapNum,
|
||||
rad.status as status,
|
||||
su.nick_name as repairer,
|
||||
rad.update_time as updateTime,
|
||||
rad.type_id as typeId,
|
||||
rad.create_time,
|
||||
count(rc.id) AS totalCostRecords,
|
||||
sum(rc.costs) AS totalCost
|
||||
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 repair_cost rc ON rad.id = rc.repair_id
|
||||
where rad.task_id = #{taskId}
|
||||
<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="getRepairMaTypeList" resultType="com.bonus.material.repair.domain.vo.RepairDeviceListVo">
|
||||
select
|
||||
rad.id as id,
|
||||
|
|
|
|||
Loading…
Reference in New Issue