维修app创建工单后指定施工人员和销售

This commit is contained in:
许允枞 2024-10-21 13:09:45 +08:00
parent 374a82a78d
commit 8859ec6706
9 changed files with 88 additions and 32 deletions

View File

@ -19,7 +19,9 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -86,7 +88,7 @@ public class RepairProjectServiceImpl extends ServiceImpl<RepairProjectMapper, R
**/
@Override
public IPage<RepairProjectRespVO> queryListPage(RepairProjectPageReqVO pageReqVO, Page<RepairProjectRespVO> page) {
return repairProjectMapper.selectListPage(pageReqVO,page);
return repairProjectMapper.selectListPage(pageReqVO, page);
}
/**
@ -97,28 +99,29 @@ public class RepairProjectServiceImpl extends ServiceImpl<RepairProjectMapper, R
@Override
public List<RepairProjectAppvo> getRepairProjectAndCateGory() {
List<RepairProjectAppvo> repairProjectAppvos = repairProjectMapper.selectProjectAndCateGory();
// 提取并去重 typeId
List<String> uniqueTypeIds = repairProjectAppvos.stream()
.map(RepairProjectAppvo::getTypeId)
.distinct()
.collect(Collectors.toList());
List<RepairProjectAppvo> list = new ArrayList<>();
for (String uniqueTypeId : uniqueTypeIds) {
// 使用 LinkedHashMap typeId 分组排除 typeId null 的条目
Map<String, List<RepairProjectAppvo>> groupedByTypeId = new LinkedHashMap<>();
for (RepairProjectAppvo appvo : repairProjectAppvos) {
if (ObjectUtil.isNotEmpty(appvo.getTypeId())) {
groupedByTypeId.computeIfAbsent(appvo.getTypeId(), k -> new ArrayList<>()).add(appvo);
}
}
// 创建结果列表
List<RepairProjectAppvo> resultList = new ArrayList<>();
for (Map.Entry<String, List<RepairProjectAppvo>> entry : groupedByTypeId.entrySet()) {
RepairProjectAppvo repairProjectAppvo = new RepairProjectAppvo();
repairProjectAppvo.setTypeId(uniqueTypeId);
if (ObjectUtil.isNotEmpty(uniqueTypeId)) {
List<RepairProjectAppvo> filteredList = repairProjectAppvos.stream()
.filter(appvo -> uniqueTypeId.equals(appvo.getTypeId()))
.collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(filteredList)) {
repairProjectAppvo.setTypeId(entry.getKey());
List<RepairProjectAppvo> filteredList = entry.getValue();
repairProjectAppvo.setTypeName(filteredList.get(0).getTypeName());
// 只在最后一次调用 copyToList
repairProjectAppvo.setGroupList(BeanUtil.copyToList(filteredList, RepairProject.class));
}
}
list.add(repairProjectAppvo);
}
return list;
resultList.add(repairProjectAppvo);
}
return resultList;
}
}

View File

@ -45,8 +45,7 @@ public class DlRepairTicketsController {
@PostMapping("/create")
@Operation(summary = "维修工单表 新增")
public CommonResult<?> createTicket(@RequestBody DlRepairTicketsRespVO ticketsRespVO) {
dlRepairTicketsService.createTickets(ticketsRespVO);
return CommonResult.ok();
return CommonResult.success(dlRepairTicketsService.createTickets(ticketsRespVO));
}
/**

View File

@ -7,10 +7,7 @@ import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO;
import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -23,7 +20,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
* @date 18:21 2024/9/13
**/
@RestController
@RequestMapping("/repair/titem")
@RequestMapping("/repair/titem")
public class DlRepairTitemController {
/**
* 服务对象
@ -61,5 +58,16 @@ public class DlRepairTitemController {
public CommonResult<?> getProjectList(@RequestParam("ticketId") String ticketId){
return success(dlRepairTitemService.getProjectList(ticketId));
}
/**
* 修改维修工单子表的维修人员和销售人员信息(app)
* @param dlRepairTitemReqVO
* @return
*/
@PutMapping("/updateRepairAndSale")
@Operation(summary = "修改维修工单子表的维修人员和销售人员信息")
public CommonResult<?> updateRepairAndSale(@RequestBody DlRepairTitemReqVO dlRepairTitemReqVO){
return success(dlRepairTitemService.updateRepairAndSale(dlRepairTitemReqVO));
}
}

View File

@ -25,6 +25,12 @@ public interface DlRepairTitemMapper extends BaseMapper<DlRepairTitem> {
* @param repairTitemRespVO 查询对象
**/
IPage<DlRepairTitemRespVO> getTItemPage(@Param("map") DlRepairTitemRespVO repairTitemRespVO, Page<DlRepairTitemRespVO> page);
/**
* 更新工单子表中维修人员销售人员信息app
* @param dlRepairTitem
*/
void updateRepairAndSale(DlRepairTitem dlRepairTitem);
}

View File

@ -25,7 +25,7 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
* @author 小李
* @date 11:33 2024/9/20
**/
void createTickets(DlRepairTicketsRespVO ticketsRespVO);
DlRepairTicketsRespVO createTickets(DlRepairTicketsRespVO ticketsRespVO);
/**
* 维修工单表 分页

View File

@ -34,4 +34,11 @@ public interface DlRepairTitemService extends IService<DlRepairTitem> {
**/
List<DlRepairTitem> getProjectList(String ticketId);
/**
* 更新工单子表中维修人员销售人员信息app
* @param dlRepairTitem
* @return
*/
DlRepairTitem updateRepairAndSale(DlRepairTitem dlRepairTitem);
}

View File

@ -155,7 +155,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
**/
@Override
@DSTransactional
public void createTickets(DlRepairTicketsRespVO ticketsRespVO) {
public DlRepairTicketsRespVO createTickets(DlRepairTicketsRespVO ticketsRespVO) {
// 门店信息
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
@ -232,6 +232,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
repairOrderInfoService.saveOrderInfo(repairOrderInfo);
//最后记录操作日志--创建工单
repairRecordsService.saveRepairRecord(ticketsRespVO.getId(),null, RecordTypeEnum.CJGD.getCode(),"创建工单",null);
return ticketsRespVO;
}
/**

View File

@ -48,6 +48,18 @@ public class DlRepairTitemServiceImpl extends ServiceImpl<DlRepairTitemMapper, D
.eq(DlRepairTitem::getTicketId, ticketId);
}));
}
/**
* 更新工单子表中维修人员销售人员信息app
*
* @param dlRepairTitem
* @return
*/
@Override
public DlRepairTitem updateRepairAndSale(DlRepairTitem dlRepairTitem) {
baseMapper.updateRepairAndSale(dlRepairTitem);
return dlRepairTitem;
}
}

View File

@ -3,6 +3,26 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.tickets.mapper.DlRepairTitemMapper">
<update id="updateRepairAndSale" parameterType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem">
UPDATE dl_repair_titem
<set>
<if test="repairIds != null">
repair_ids = #{repairIds},
</if>
<if test="repairNames != null">
repair_names = #{repairNames},
</if>
<if test="saleId != null">
sale_id = #{saleId},
</if>
<if test="saleName != null">
sale_name = #{saleName},
</if>
</set>
WHERE ticket_id = #{ticketId}
</update>
<select id="getTItemPage" resultType="cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO">
SELECT drti.id,
drti.ticket_id,