维修app创建工单后指定施工人员和销售
This commit is contained in:
parent
374a82a78d
commit
8859ec6706
@ -19,7 +19,9 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,7 +88,7 @@ public class RepairProjectServiceImpl extends ServiceImpl<RepairProjectMapper, R
|
|||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public IPage<RepairProjectRespVO> queryListPage(RepairProjectPageReqVO pageReqVO, Page<RepairProjectRespVO> page) {
|
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
|
@Override
|
||||||
public List<RepairProjectAppvo> getRepairProjectAndCateGory() {
|
public List<RepairProjectAppvo> getRepairProjectAndCateGory() {
|
||||||
List<RepairProjectAppvo> repairProjectAppvos = repairProjectMapper.selectProjectAndCateGory();
|
List<RepairProjectAppvo> repairProjectAppvos = repairProjectMapper.selectProjectAndCateGory();
|
||||||
// 提取并去重 typeId
|
|
||||||
List<String> uniqueTypeIds = repairProjectAppvos.stream()
|
// 使用 LinkedHashMap 按 typeId 分组,排除 typeId 为 null 的条目
|
||||||
.map(RepairProjectAppvo::getTypeId)
|
Map<String, List<RepairProjectAppvo>> groupedByTypeId = new LinkedHashMap<>();
|
||||||
.distinct()
|
for (RepairProjectAppvo appvo : repairProjectAppvos) {
|
||||||
.collect(Collectors.toList());
|
if (ObjectUtil.isNotEmpty(appvo.getTypeId())) {
|
||||||
List<RepairProjectAppvo> list = new ArrayList<>();
|
groupedByTypeId.computeIfAbsent(appvo.getTypeId(), k -> new ArrayList<>()).add(appvo);
|
||||||
for (String uniqueTypeId : uniqueTypeIds) {
|
|
||||||
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.setTypeName(filteredList.get(0).getTypeName());
|
|
||||||
repairProjectAppvo.setGroupList(BeanUtil.copyToList(filteredList, RepairProject.class));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
list.add(repairProjectAppvo);
|
|
||||||
}
|
}
|
||||||
return list;
|
|
||||||
|
// 创建结果列表
|
||||||
|
List<RepairProjectAppvo> resultList = new ArrayList<>();
|
||||||
|
for (Map.Entry<String, List<RepairProjectAppvo>> entry : groupedByTypeId.entrySet()) {
|
||||||
|
RepairProjectAppvo repairProjectAppvo = new RepairProjectAppvo();
|
||||||
|
repairProjectAppvo.setTypeId(entry.getKey());
|
||||||
|
List<RepairProjectAppvo> filteredList = entry.getValue();
|
||||||
|
repairProjectAppvo.setTypeName(filteredList.get(0).getTypeName());
|
||||||
|
|
||||||
|
// 只在最后一次调用 copyToList
|
||||||
|
repairProjectAppvo.setGroupList(BeanUtil.copyToList(filteredList, RepairProject.class));
|
||||||
|
resultList.add(repairProjectAppvo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -45,8 +45,7 @@ public class DlRepairTicketsController {
|
|||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "维修工单表 新增")
|
@Operation(summary = "维修工单表 新增")
|
||||||
public CommonResult<?> createTicket(@RequestBody DlRepairTicketsRespVO ticketsRespVO) {
|
public CommonResult<?> createTicket(@RequestBody DlRepairTicketsRespVO ticketsRespVO) {
|
||||||
dlRepairTicketsService.createTickets(ticketsRespVO);
|
return CommonResult.success(dlRepairTicketsService.createTickets(ticketsRespVO));
|
||||||
return CommonResult.ok();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,10 +7,7 @@ import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO;
|
|||||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO;
|
import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
@ -23,7 +20,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|||||||
* @date 18:21 2024/9/13
|
* @date 18:21 2024/9/13
|
||||||
**/
|
**/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/repair/titem")
|
@RequestMapping("/repair/titem")
|
||||||
public class DlRepairTitemController {
|
public class DlRepairTitemController {
|
||||||
/**
|
/**
|
||||||
* 服务对象
|
* 服务对象
|
||||||
@ -61,5 +58,16 @@ public class DlRepairTitemController {
|
|||||||
public CommonResult<?> getProjectList(@RequestParam("ticketId") String ticketId){
|
public CommonResult<?> getProjectList(@RequestParam("ticketId") String ticketId){
|
||||||
return success(dlRepairTitemService.getProjectList(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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,12 @@ public interface DlRepairTitemMapper extends BaseMapper<DlRepairTitem> {
|
|||||||
* @param repairTitemRespVO 查询对象
|
* @param repairTitemRespVO 查询对象
|
||||||
**/
|
**/
|
||||||
IPage<DlRepairTitemRespVO> getTItemPage(@Param("map") DlRepairTitemRespVO repairTitemRespVO, Page<DlRepairTitemRespVO> page);
|
IPage<DlRepairTitemRespVO> getTItemPage(@Param("map") DlRepairTitemRespVO repairTitemRespVO, Page<DlRepairTitemRespVO> page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新工单子表中维修人员、销售人员信息(app)
|
||||||
|
* @param dlRepairTitem
|
||||||
|
*/
|
||||||
|
void updateRepairAndSale(DlRepairTitem dlRepairTitem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
|||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 11:33 2024/9/20
|
* @date 11:33 2024/9/20
|
||||||
**/
|
**/
|
||||||
void createTickets(DlRepairTicketsRespVO ticketsRespVO);
|
DlRepairTicketsRespVO createTickets(DlRepairTicketsRespVO ticketsRespVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修工单表 分页
|
* 维修工单表 分页
|
||||||
|
@ -34,4 +34,11 @@ public interface DlRepairTitemService extends IService<DlRepairTitem> {
|
|||||||
**/
|
**/
|
||||||
List<DlRepairTitem> getProjectList(String ticketId);
|
List<DlRepairTitem> getProjectList(String ticketId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新工单子表中维修人员、销售人员信息(app)
|
||||||
|
* @param dlRepairTitem
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
DlRepairTitem updateRepairAndSale(DlRepairTitem dlRepairTitem);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
@DSTransactional
|
@DSTransactional
|
||||||
public void createTickets(DlRepairTicketsRespVO ticketsRespVO) {
|
public DlRepairTicketsRespVO createTickets(DlRepairTicketsRespVO ticketsRespVO) {
|
||||||
|
|
||||||
// 门店信息
|
// 门店信息
|
||||||
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
||||||
@ -232,6 +232,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
repairOrderInfoService.saveOrderInfo(repairOrderInfo);
|
repairOrderInfoService.saveOrderInfo(repairOrderInfo);
|
||||||
//最后记录操作日志--创建工单
|
//最后记录操作日志--创建工单
|
||||||
repairRecordsService.saveRepairRecord(ticketsRespVO.getId(),null, RecordTypeEnum.CJGD.getCode(),"创建工单",null);
|
repairRecordsService.saveRepairRecord(ticketsRespVO.getId(),null, RecordTypeEnum.CJGD.getCode(),"创建工单",null);
|
||||||
|
return ticketsRespVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,6 +48,18 @@ public class DlRepairTitemServiceImpl extends ServiceImpl<DlRepairTitemMapper, D
|
|||||||
.eq(DlRepairTitem::getTicketId, ticketId);
|
.eq(DlRepairTitem::getTicketId, ticketId);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新工单子表中维修人员、销售人员信息(app)
|
||||||
|
*
|
||||||
|
* @param dlRepairTitem
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DlRepairTitem updateRepairAndSale(DlRepairTitem dlRepairTitem) {
|
||||||
|
baseMapper.updateRepairAndSale(dlRepairTitem);
|
||||||
|
return dlRepairTitem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,27 @@
|
|||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="cn.iocoder.yudao.module.tickets.mapper.DlRepairTitemMapper">
|
<mapper namespace="cn.iocoder.yudao.module.tickets.mapper.DlRepairTitemMapper">
|
||||||
<select id="getTItemPage" resultType="cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO">
|
<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,
|
SELECT drti.id,
|
||||||
drti.ticket_id,
|
drti.ticket_id,
|
||||||
drti.item_name,
|
drti.item_name,
|
||||||
|
Loading…
Reference in New Issue
Block a user