Merge branch 'repair' of http://122.51.230.86:3000/dianliang/lanan-system into repair
This commit is contained in:
commit
6f7b1d0b86
@ -39,6 +39,6 @@ public class TicketsAPI {
|
||||
@Operation(summary = "维修工单表 查看一个工单的详细信息")
|
||||
@TenantIgnore
|
||||
public CommonResult<?> getTicketsById(@RequestParam(value = "id") String id){
|
||||
return success(dlRepairTicketsService.getTicketsById(id));
|
||||
return success(dlRepairTicketsService.getTicketsById(id,null));
|
||||
}
|
||||
}
|
||||
|
@ -74,13 +74,14 @@ public class DlRepairTicketsController {
|
||||
* 获得一个工单的详细信息
|
||||
*
|
||||
* @param id 工单ID
|
||||
* @param ifApp 是否是APP发起的查询
|
||||
* @author 小李
|
||||
* @date 16:05 2024/9/21
|
||||
**/
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "查看一个工单的详细信息")
|
||||
public CommonResult<?> getTicketsById(@RequestParam("id") String id) {
|
||||
return success(dlRepairTicketsService.getTicketsById(id));
|
||||
public CommonResult<?> getTicketsById(@RequestParam("id") String id,@RequestParam("ifApp")Boolean ifApp) {
|
||||
return success(dlRepairTicketsService.getTicketsById(id,ifApp));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.tickets.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -42,6 +43,15 @@ public interface DlRepairTitemMapper extends BaseMapper<DlRepairTitem> {
|
||||
* @return java.util.List<cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO>
|
||||
**/
|
||||
List<DlRepairTitemRespVO> selectProjList(@Param("ticketId")String ticketId,@Param("isOpen")String isOpen);
|
||||
|
||||
/**
|
||||
* 根据工单ID查询所有配件明细--带着分组名称和ID
|
||||
* @author vinjor-M
|
||||
* @date 10:44 2024/11/19
|
||||
* @param ticketId 工单ID
|
||||
* @return java.util.List<cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO>
|
||||
**/
|
||||
List<DlRepairTitemReqVO> selectByTicketId(@Param("ticketId")String ticketId);
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,10 +42,11 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
* 获得一个工单的详细信息
|
||||
*
|
||||
* @param id 工单ID
|
||||
* @param ifApp 是否是APP发起的查询
|
||||
* @author 小李
|
||||
* @date 16:05 2024/9/21
|
||||
**/
|
||||
DlRepairTicketsRespVO getTicketsById(String id);
|
||||
DlRepairTicketsRespVO getTicketsById(String id,Boolean ifApp);
|
||||
|
||||
/**
|
||||
* 维修工单表 作废
|
||||
|
@ -52,6 +52,7 @@ import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlTicketWares;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlTwItem;
|
||||
import cn.iocoder.yudao.module.tickets.mapper.DlRepairTicketsMapper;
|
||||
import cn.iocoder.yudao.module.tickets.mapper.DlRepairTitemMapper;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlTicketWaresService;
|
||||
@ -105,6 +106,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
@Resource
|
||||
private DlRepairTitemService titemService;
|
||||
@Resource
|
||||
private DlRepairTitemMapper repairTitemMapper;
|
||||
@Resource
|
||||
private DlRepairTicketsMapper repairTicketsMapper;
|
||||
|
||||
@Resource
|
||||
@ -339,11 +342,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
* 获得一个工单的详细信息
|
||||
*
|
||||
* @param id 工单ID
|
||||
* @param ifApp 是否是APP发起的查询
|
||||
* @author 小李
|
||||
* @date 16:05 2024/9/21
|
||||
**/
|
||||
@Override
|
||||
public DlRepairTicketsRespVO getTicketsById(String id) {
|
||||
public DlRepairTicketsRespVO getTicketsById(String id,Boolean ifApp) {
|
||||
// 查工单主表
|
||||
DlRepairTickets dlRepairTickets = baseMapper.selectById(id);
|
||||
DlRepairTicketsRespVO result = BeanUtil.toBean(dlRepairTickets, DlRepairTicketsRespVO.class);
|
||||
@ -370,21 +374,59 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
}
|
||||
result.setProjects(projects);
|
||||
|
||||
// 取配件
|
||||
if(ifApp){
|
||||
//app的逻辑
|
||||
List<AppWaresGroupVO> waresGroupList = new ArrayList<>();
|
||||
//查这个工单的配件
|
||||
List<DlRepairTitemReqVO> waresList = repairTitemMapper.selectByTicketId(id);
|
||||
if (CollectionUtil.isNotEmpty(waresList)) {
|
||||
//先过滤出itenTypeId为null或空,或者itemTypeName为null或空的,为单独一个组
|
||||
List<DlRepairTitemReqVO> nullList = waresList.stream().filter(item->StringUtils.isEmpty(item.getItemTypeId()) || StringUtils.isEmpty(item.getItemTypeName())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(nullList)) {
|
||||
AppWaresGroupVO waresGroupVO = new AppWaresGroupVO();
|
||||
waresGroupVO.setWares(nullList);
|
||||
waresGroupVO.setGroupName("未知分组");
|
||||
waresGroupVO.setNums(nullList.size());
|
||||
waresGroupVO.setTotalAmount(nullList.stream().peek(item->{
|
||||
if(null==item.getItemMoney()){
|
||||
item.setItemMoney(new BigDecimal(0));
|
||||
}
|
||||
}).map(DlRepairTitem::getItemMoney).reduce(BigDecimal.ZERO,BigDecimal::add));
|
||||
waresGroupList.add(waresGroupVO);
|
||||
}
|
||||
//过滤出有分类的进行分组
|
||||
Map<String,List<DlRepairTitemReqVO>> groupListMap = waresList.stream().filter(item->StringUtils.isNotEmpty(item.getItemTypeId()) && StringUtils.isNotEmpty(item.getItemTypeName())).collect(Collectors.groupingBy(DlRepairTitem::getItemTypeId));
|
||||
for (String key:groupListMap.keySet()){
|
||||
AppWaresGroupVO waresGroupVO = new AppWaresGroupVO();
|
||||
waresGroupVO.setWares(groupListMap.get(key));
|
||||
waresGroupVO.setGroupName(groupListMap.get(key).get(0).getItemTypeName());
|
||||
waresGroupVO.setGroupId(key);
|
||||
waresGroupVO.setNums(groupListMap.get(key).size());
|
||||
waresGroupVO.setTotalAmount(groupListMap.get(key).stream().peek(item->{
|
||||
if(null==item.getItemMoney()){
|
||||
item.setItemMoney(new BigDecimal(0));
|
||||
}
|
||||
}).map(DlRepairTitem::getItemMoney).reduce(BigDecimal.ZERO,BigDecimal::add));
|
||||
waresGroupList.add(waresGroupVO);
|
||||
}
|
||||
}
|
||||
result.setWaresGroupList(waresGroupList);
|
||||
}else{
|
||||
// 取配件----原有逻辑-电脑端
|
||||
List<DlRepairTitemReqVO> wares = items.stream().filter(item -> item.getItemType().equals("02")).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(wares)) {
|
||||
// 单位字典
|
||||
List<DictDataRespDTO> recordTypeList = dictDataApi.getDictDataList(DICT_REPAIR_UNIT);
|
||||
Map<String, String> unitMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel));
|
||||
|
||||
Set<String> ids = wares.stream().map(DlRepairTitemReqVO::getPartId).collect(Collectors.toSet());
|
||||
List<RepairWares> repairWares = waresService.listByIds(ids);
|
||||
items.forEach(item -> {
|
||||
repairWares.stream().filter(i -> i.getId().equals(item.getPartId())).findFirst().ifPresent(item::setWare);
|
||||
item.setItemUnit(unitMap.get(item.getItemUnit()));
|
||||
item.setUnitText(unitMap.get(item.getItemUnit()));
|
||||
});
|
||||
}
|
||||
result.setWares(wares);
|
||||
}
|
||||
// 取附加
|
||||
List<DlRepairTitemReqVO> others = items.stream().filter(item -> item.getItemType().equals("03")).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(others)) {
|
||||
|
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.tickets.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app使用的配件明细,按分类分组后的
|
||||
* @author vinjor-M
|
||||
* @date 10:10 2024/11/19
|
||||
**/
|
||||
@Data
|
||||
public class AppWaresGroupVO {
|
||||
/** 分组ID(分类ID) */
|
||||
private String groupId;
|
||||
/** 分组名称(分类名称) */
|
||||
private String groupName;
|
||||
/** 数量 */
|
||||
private Integer nums;
|
||||
/** 总价 */
|
||||
private BigDecimal totalAmount;
|
||||
/** 配件明细 */
|
||||
private List<DlRepairTitemReqVO> wares;
|
||||
}
|
@ -63,4 +63,6 @@ public class DlRepairTicketsRespVO extends DlRepairTickets {
|
||||
/** 维修班组长是否可以重新派工--当前施工人是自己或者本班组内的人员 */
|
||||
private Boolean canOperate;
|
||||
|
||||
/** app分组回显专用--配件明细 */
|
||||
List<AppWaresGroupVO> waresGroupList;
|
||||
}
|
||||
|
@ -23,4 +23,9 @@ public class DlRepairTitemReqVO extends DlRepairTitem {
|
||||
// 附加详情
|
||||
private DlRepairOther other;
|
||||
|
||||
/** 配件分类名称 */
|
||||
private String itemTypeName;
|
||||
/** 配件单位名称 */
|
||||
private String unitText;
|
||||
|
||||
}
|
||||
|
@ -109,4 +109,37 @@
|
||||
drt.update_time,
|
||||
drri.create_time
|
||||
</select>
|
||||
<select id="selectByTicketId" resultType="cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO">
|
||||
SELECT
|
||||
drt.id,
|
||||
drt.ticket_id,
|
||||
drt.item_name ,
|
||||
drt.item_count ,
|
||||
drt.item_unit ,
|
||||
drt.item_price ,
|
||||
drt.item_discount ,
|
||||
drt.item_money ,
|
||||
drt.item_type ,
|
||||
drt.part_id ,
|
||||
drt.item_status ,
|
||||
drt.remark ,
|
||||
drt.tenant_id ,
|
||||
drt.deleted ,
|
||||
drt.creator ,
|
||||
drt.create_time ,
|
||||
drt.updater ,
|
||||
drt.update_time,
|
||||
drw.type AS item_type_id,
|
||||
dbt.`name` AS item_type_name,
|
||||
sdd.label AS unit_text
|
||||
FROM
|
||||
dl_repair_titem drt
|
||||
LEFT JOIN dl_repair_wares drw ON drt.part_id = drw.id
|
||||
LEFT JOIN dl_base_type dbt ON drw.type = dbt.id
|
||||
LEFT JOIN system_dict_data sdd ON drw.unit = sdd.value AND sdd.dict_type='repair_unit'
|
||||
WHERE drt.ticket_id = #{ticketId}
|
||||
AND drt.item_type = '02'
|
||||
AND drt.deleted = '0'
|
||||
ORDER BY drw.type,drt.create_time
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user