1
This commit is contained in:
parent
5f5f55712a
commit
c179d59cc2
@ -3,8 +3,12 @@ package cn.iocoder.yudao.module.tickets.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.common.RecordTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
||||
import cn.iocoder.yudao.module.tickets.vo.AddProjVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO;
|
||||
@ -15,6 +19,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -36,6 +41,8 @@ public class DlRepairTitemController {
|
||||
@Resource
|
||||
private DlRepairTitemService dlRepairTitemService;
|
||||
@Resource
|
||||
private DlRepairTicketsService dlRepairTicketsService;
|
||||
@Resource
|
||||
private RepairRecordsService repairRecordsService;
|
||||
|
||||
/**
|
||||
@ -84,13 +91,25 @@ public class DlRepairTitemController {
|
||||
* 更新工单子表,维修项目配件的单价、数量、折扣、单项总价等
|
||||
* @author vinjor-M
|
||||
* @date 16:10 2024/10/31
|
||||
* @param itemList 工单子表列表
|
||||
* @param addProjVO 工单子表列表
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@PutMapping("/updateRepairItem")
|
||||
@Operation(summary = "修改维修工单子表的维修人员和销售人员信息")
|
||||
public CommonResult<?> updateRepairItem(@RequestBody List<DlRepairTitem> itemList){
|
||||
dlRepairTitemService.updateRepairItem(itemList);
|
||||
public CommonResult<?> updateRepairItem(@RequestBody AddProjVO addProjVO){
|
||||
//删除项目
|
||||
if(null!=addProjVO.getDelProjIdList() && !addProjVO.getDelProjIdList().isEmpty()){
|
||||
dlRepairTitemService.removeBatchByIds(addProjVO.getDelProjIdList());
|
||||
//更新主表的id
|
||||
DlRepairTickets repairTickets = new DlRepairTickets();
|
||||
repairTickets.setId(addProjVO.getTicketId());
|
||||
repairTickets.setUpdateTime(LocalDateTime.now());
|
||||
dlRepairTicketsService.updateById(repairTickets);
|
||||
}
|
||||
if(!addProjVO.getItemList().isEmpty()){
|
||||
//更新项目
|
||||
dlRepairTitemService.updateRepairItem(addProjVO.getItemList());
|
||||
}
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ -129,7 +148,22 @@ public class DlRepairTitemController {
|
||||
@PostMapping("/addNewProj")
|
||||
@Operation(summary = "添加维修项目")
|
||||
public CommonResult<?> addNewProj(@RequestBody AddProjVO addProjVO){
|
||||
//获取当前登录用户
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
addProjVO.getItemList().forEach(item->{
|
||||
if(null==item.getSaleId()){
|
||||
//默认销售人员是当前用户
|
||||
item.setSaleId(loginUser.getId());
|
||||
item.setSaleName(loginUser.getInfo().get("nickname"));
|
||||
}
|
||||
});
|
||||
dlRepairTitemService.saveBatch(addProjVO.getItemList());
|
||||
//更新主表的更新时间
|
||||
DlRepairTickets repairTickets = new DlRepairTickets();
|
||||
repairTickets.setId(addProjVO.getItemList().get(0).getTicketId());
|
||||
repairTickets.setUpdateTime(LocalDateTime.now());
|
||||
dlRepairTicketsService.updateById(repairTickets);
|
||||
|
||||
List<String> projNameList = addProjVO.getItemList().stream().map(DlRepairTitem::getItemName).collect(Collectors.toList());
|
||||
//最后记录操作日志--创建工单
|
||||
String remark = "添加维修项目"+String.join(", ",projNameList )+"。";
|
||||
|
@ -16,6 +16,10 @@ public class AddProjVO {
|
||||
private List<DlRepairTitem> itemList;
|
||||
/** 签字图片相对路径 */
|
||||
private String image;
|
||||
/** 要删除的项目id */
|
||||
private List<String> delProjIdList;
|
||||
/** 备注内容 */
|
||||
private String remark;
|
||||
/** 工单id */
|
||||
private String ticketId;
|
||||
}
|
||||
|
@ -274,7 +274,7 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
GROUP BY drt.id
|
||||
order by drt.create_time desc
|
||||
order by drt.update_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectItemList" resultType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem">
|
||||
@ -336,6 +336,6 @@
|
||||
)
|
||||
</if>
|
||||
GROUP BY drt.id
|
||||
order by drt.create_time desc
|
||||
order by drt.update_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user