Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
7567d59c59
@ -29,10 +29,15 @@
|
||||
|
||||
<select id="pageNotice" resultMap="BaseResultMap">
|
||||
<include refid="Base_SQL" />
|
||||
and dbn.parent_server = #{map.parentServer}
|
||||
<if test="map.parentServer != null and map.parentServer != ''">
|
||||
and dbn.parent_server = #{map.parentServer}
|
||||
</if>
|
||||
<if test="map.server != null and map.server != ''">
|
||||
and dbn.server = #{map.server}
|
||||
</if>
|
||||
<if test="map.type != null and map.type != ''">
|
||||
and dbn.type = #{map.type}
|
||||
</if>
|
||||
<if test="map.status != null">
|
||||
and dbn.status = #{map.status}
|
||||
</if>
|
||||
|
@ -57,7 +57,7 @@
|
||||
<choose>
|
||||
<when test="map.selectType == 'working'">
|
||||
-- 维修中的订单 --
|
||||
and (drt.tickets_status = '04' OR drt.tickets_status = '05' )
|
||||
and (drt.tickets_status = '04' OR drt.tickets_status = '05' OR drt.tickets_status = '05' OR drt.tickets_status ='01')
|
||||
</when>
|
||||
<when test="map.selectType == 'waitingPay'">
|
||||
-- 待支付的订单 --
|
||||
|
@ -320,5 +320,19 @@ public class DlRepairTicketsController {
|
||||
dlRepairTicketsService.noticeCus(noticeCusVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工单子项
|
||||
*
|
||||
* @author 小李
|
||||
* @date 19:59 2024/10/24
|
||||
* @param respVO 主要有两个参数,主表ID,itemList(这个需要前端处理成子表的对象能接收的数据)
|
||||
**/
|
||||
@PostMapping("/addItems")
|
||||
@Operation(summary = "新增工单子项")
|
||||
public CommonResult<?> addItems(@RequestBody DlRepairTicketsRespVO respVO) {
|
||||
dlRepairTicketsService.addItems(respVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,5 +69,45 @@ public class DlRepairTitemController {
|
||||
public CommonResult<?> updateRepairAndSale(@RequestBody DlRepairTitemReqVO dlRepairTitemReqVO){
|
||||
return success(dlRepairTitemService.updateRepairAndSale(dlRepairTitemReqVO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看单个维修子表的数据
|
||||
*
|
||||
* @author 小李
|
||||
* @param id 子表ID
|
||||
**/
|
||||
@GetMapping("/getById")
|
||||
@Operation(summary = "查看单个维修子表的数据")
|
||||
public CommonResult<?> getItemById(@RequestParam("id") String id){
|
||||
return success(dlRepairTitemService.getItemById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改单个工单子项的内容
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:41 2024/10/24
|
||||
* @param dlRepairTitemReqVO 对象
|
||||
**/
|
||||
@PostMapping("/updateById")
|
||||
@Operation(summary = "修改单个工单子项的内容")
|
||||
public CommonResult<?> updateItemById(@RequestBody DlRepairTitemReqVO dlRepairTitemReqVO){
|
||||
dlRepairTitemService.updateItemById(dlRepairTitemReqVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修工单单个子项
|
||||
*
|
||||
* @author 小李
|
||||
* @date 20:18 2024/10/24
|
||||
* @param id 工单子项ID
|
||||
**/
|
||||
@DeleteMapping("/removeById")
|
||||
@Operation(summary = "维修工单单个子项")
|
||||
public CommonResult<?> removeItemById(@RequestParam("id") String id){
|
||||
dlRepairTitemService.removeItemById(id);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,4 +182,22 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
* @param noticeCusVO 请求对象
|
||||
**/
|
||||
void noticeCus(NoticeCusVO noticeCusVO);
|
||||
|
||||
/**
|
||||
* 重新计算工单的一些数值
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:47 2024/10/24
|
||||
* @param ticketId 工单ID
|
||||
**/
|
||||
boolean computeTicket(String ticketId);
|
||||
|
||||
/**
|
||||
* 新增工单子项
|
||||
*
|
||||
* @author 小李
|
||||
* @date 19:59 2024/10/24
|
||||
* @param respVO 主要有两个参数,主表ID,itemList(这个需要前端处理成子表的对象能接收的数据)
|
||||
**/
|
||||
void addItems(DlRepairTicketsRespVO respVO);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.tickets.service;
|
||||
|
||||
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.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -41,4 +42,29 @@ public interface DlRepairTitemService extends IService<DlRepairTitem> {
|
||||
*/
|
||||
DlRepairTitem updateRepairAndSale(DlRepairTitem dlRepairTitem);
|
||||
|
||||
/**
|
||||
* 查看单个维修子表的数据
|
||||
*
|
||||
* @author 小李
|
||||
* @param id 子表ID
|
||||
**/
|
||||
DlRepairTitem getItemById(String id);
|
||||
|
||||
/**
|
||||
* 修改单个工单子项的内容
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:41 2024/10/24
|
||||
* @param dlRepairTitemReqVO 对象
|
||||
**/
|
||||
void updateItemById(DlRepairTitemReqVO dlRepairTitemReqVO);
|
||||
|
||||
/**
|
||||
* 维修工单单个子项
|
||||
*
|
||||
* @author 小李
|
||||
* @date 20:18 2024/10/24
|
||||
* @param id 工单子项ID
|
||||
**/
|
||||
void removeItemById(String id);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import cn.iocoder.yudao.module.custom.service.CustomerCarService;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
||||
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
||||
import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoSaveReqVO;
|
||||
import cn.iocoder.yudao.module.other.entity.DlRepairOther;
|
||||
@ -39,9 +40,13 @@ import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
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.service.DlRepairTicketsService;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlTicketWaresService;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlTwItemService;
|
||||
import cn.iocoder.yudao.module.tickets.tools.WordUtil;
|
||||
import cn.iocoder.yudao.module.tickets.vo.*;
|
||||
import cn.iocoder.yudao.util.SendSmsUtil;
|
||||
@ -138,11 +143,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
private RepairWorkerService repairWorkerService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private RepairRecordsService recordsService;
|
||||
private RepairRecordsService repairRecordsService;
|
||||
|
||||
@Resource
|
||||
private RepairRecordsService repairRecordsService;
|
||||
@Lazy
|
||||
private DlTicketWaresService ticketWaresService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private DlTwItemService twItemService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -187,10 +197,10 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 新增子表
|
||||
itemList.forEach(item -> {
|
||||
item.setTicketId(ticketsRespVO.getId());
|
||||
if("01".equals(item.getItemType())){
|
||||
if ("01".equals(item.getItemType())) {
|
||||
//维修项目,初始状态,待派工
|
||||
item.setItemStatus(TicketsItemStatusEnum.WAITING_WORK.getCode());
|
||||
}else if("02".equals(item.getItemType())){
|
||||
} else if ("02".equals(item.getItemType())) {
|
||||
//维修配件,初始状态,待领料
|
||||
item.setItemStatus(TicketsItemStatusEnum.WAITING_RECEIVE.getCode());
|
||||
}
|
||||
@ -333,7 +343,18 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
* @date 8:50 2024/9/23
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void setTicketsPaid(DlRepairTicketsRespVO repairTicketsRespVO) {
|
||||
// 更新订单状态
|
||||
RepairOrderInfo one = repairOrderInfoService.getOne(new LambdaQueryWrapper<RepairOrderInfo>().eq(RepairOrderInfo::getGoodsId, repairTicketsRespVO.getId()));
|
||||
if (ObjectUtil.isEmpty(one)){
|
||||
throw exception0(500, "系统异常");
|
||||
}
|
||||
RepairOrderInfo repairOrderInfo = new RepairOrderInfo();
|
||||
repairOrderInfo.setId(one.getId());
|
||||
repairOrderInfo.setPayType(repairTicketsRespVO.getPayType());
|
||||
repairOrderInfoService.updateById(repairOrderInfo);
|
||||
// 更新工单
|
||||
baseMapper.updateById(repairTicketsRespVO);
|
||||
}
|
||||
|
||||
@ -435,13 +456,13 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
String userRoleCode = getUserRole();
|
||||
if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())) {
|
||||
//维修管理员看所有数据
|
||||
} else if(userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())){
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) {
|
||||
//总检
|
||||
if (RepairCons.TICKETS_WAITING.equals(repairTicketsReqVO.getSelectType())) {
|
||||
//查待处理的,查需要自己处理的,否则就是查所有
|
||||
repairTicketsReqVO.setUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId()));
|
||||
}
|
||||
}else if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
|
||||
//服务顾问
|
||||
repairTicketsReqVO.setAdviserId(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) {
|
||||
@ -577,9 +598,9 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
@DSTransactional
|
||||
public void updateStatus(DlRepairTicketsRespVO respVO) {
|
||||
// 如果是开始施工,但项目还在施工中,就不能施工
|
||||
if (RecordTypeEnum.KSSG.getCode().equals(respVO.getRecordType())){
|
||||
if (RecordTypeEnum.KSSG.getCode().equals(respVO.getRecordType())) {
|
||||
DlRepairTitem titem = titemService.getById(respVO.getItem().getId());
|
||||
if (TicketsItemStatusEnum.WORKING.getCode().equals(titem.getItemStatus())){
|
||||
if (TicketsItemStatusEnum.WORKING.getCode().equals(titem.getItemStatus())) {
|
||||
throw exception0(500, "选择的项目在施工中,不能重新开始施工");
|
||||
}
|
||||
}
|
||||
@ -603,7 +624,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
);
|
||||
}
|
||||
// 记录日志
|
||||
recordsService.saveRepairRecord(respVO.getId(), respVO.getItem().getId(), respVO.getRecordType(), respVO.getRemark(), respVO.getImage());
|
||||
repairRecordsService.saveRepairRecord(respVO.getId(), respVO.getItem().getId(), respVO.getRecordType(), respVO.getRemark(), respVO.getImage());
|
||||
|
||||
// 通知服务顾问和维修总检
|
||||
DlRepairTickets tickets = baseMapper.selectById(respVO.getId());
|
||||
@ -621,7 +642,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
String message = createMessage(tickets.getNowRepairName(), tickets.getTicketNo(), titem.getItemName(), respVO.getRecordType(), respVO.getFinishType(), respVO.getNextName());
|
||||
// 通知服务顾问
|
||||
// 如果员工完成了订单
|
||||
if (RecordTypeEnum.SGWCZJ.getCode().equals(respVO.getRecordType())&& "03".equals(respVO.getFinishType())) {
|
||||
if (RecordTypeEnum.SGWCZJ.getCode().equals(respVO.getRecordType()) && "03".equals(respVO.getFinishType())) {
|
||||
repairWorkerService.sentMessage(Long.valueOf(tickets.getAdviserId()), "您有新的工单可以出厂检验");
|
||||
// 需要把工单的当前操作人移交服务顾问
|
||||
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||
@ -754,6 +775,47 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
.setSql("now_repair_name = adviser_name")
|
||||
.eq(DlRepairTickets::getId, respVO.getId())
|
||||
);
|
||||
// todo 这儿有点问题,先搁置
|
||||
/*
|
||||
如果同一个配件,申请了多次,按理应该在工单中合在一起
|
||||
但如果同一个配件在申请多次的情况下,打的折扣不一样,就不能合在一起
|
||||
我怎么知道工单中的配件是那一次申请的
|
||||
两个方案,让工单的配件关联申请表,或者,让配件申请表记录打的折扣
|
||||
*/
|
||||
// // 先查满足条件的申请表
|
||||
// ArrayList<String> status = new ArrayList<>();
|
||||
// status.add("01"); // 待审核
|
||||
// status.add("05"); // 已驳回
|
||||
// // 查工单所有已通过的配件申请单
|
||||
// List<DlTicketWares> list = ticketWaresService.list(new LambdaQueryWrapper<DlTicketWares>().and(item -> {
|
||||
// item.eq(DlTicketWares::getTicketId, respVO.getId())
|
||||
// .notIn(DlTicketWares::getStatus, status);
|
||||
// }));
|
||||
// // 查配件申请表的所有已领取数量小于申请数量的子表信息
|
||||
// List<String> ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList());
|
||||
// List<DlTwItem> twItems = twItemService.list(new LambdaQueryWrapper<DlTwItem>().and(item -> {
|
||||
// item.in(DlTwItem::getTwId, ids)
|
||||
// .apply("wares_already_count < wares_count");
|
||||
// }));
|
||||
// if (CollectionUtil.isNotEmpty(twItems)) {
|
||||
// // 更新工单子表(主要是把已领料的字段同步给工单配件的数量字段)
|
||||
// // 查询工单子表(三个查询条件,属于那个工单,属于配件类型,属于需要改变的(即申请表的已领取数量小于申请数量的))
|
||||
// List<String> waresId = twItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toList());
|
||||
// List<DlRepairTitem> items = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(item -> {
|
||||
// item.eq(DlRepairTitem::getTicketId, respVO.getId())
|
||||
// .eq(DlRepairTitem::getItemType, "02")
|
||||
// .in(DlRepairTitem::getPartId, waresId);
|
||||
// }));
|
||||
// // 同一个配件可能申请过多次,属于是一个工单配件可能是对应多个申请表配件
|
||||
// items.stream().map(item -> {
|
||||
// DlRepairTitem titem = new DlRepairTitem();
|
||||
// titem.setId(item.getId());
|
||||
// List<DlTwItem> wares = twItems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).collect(Collectors.toList());
|
||||
// int sum = wares.stream().mapToInt(DlTwItem::getWaresAlreadyCount).sum();
|
||||
//
|
||||
// })
|
||||
// }
|
||||
|
||||
// 通知服务顾问
|
||||
DlRepairTickets tickets = baseMapper.selectById(respVO.getId());
|
||||
repairWorkerService.sentMessage(Long.valueOf(tickets.getAdviserId()), "您有新的工单可以出厂检验");
|
||||
@ -832,7 +894,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
.filter(item -> item.getValue().equals(tickets.getRepairType()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (dictDataRespDTO != null){
|
||||
if (dictDataRespDTO != null) {
|
||||
type = dictDataRespDTO.getLabel();
|
||||
}
|
||||
// 构建消息
|
||||
@ -850,6 +912,72 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
+ "通知客户取车:"+message;
|
||||
repairRecordsService.saveRepairRecord(noticeCusVO.getId(), null, RecordTypeEnum.TZQC.getCode(), recordStr, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新计算工单的一些数值
|
||||
*
|
||||
* @param ticketId 工单ID
|
||||
* @author 小李
|
||||
* @date 15:47 2024/10/24
|
||||
**/
|
||||
@Override
|
||||
public boolean computeTicket(String ticketId) {
|
||||
// 查子表
|
||||
List<DlRepairTitem> list = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().eq(DlRepairTitem::getTicketId, ticketId));
|
||||
// 计算
|
||||
DlRepairTickets tickets = new DlRepairTickets();
|
||||
// 计算子项总数
|
||||
int count = list.stream().mapToInt(DlRepairTitem::getItemCount).sum();
|
||||
tickets.setId(ticketId);
|
||||
tickets.setCount(count);
|
||||
// 分类计算各自的总价和最终工单总价
|
||||
Map<String, List<DlRepairTitem>> map = list.stream().collect(Collectors.groupingBy(DlRepairTitem::getItemType));
|
||||
// 01项目,02,配件,03,其他
|
||||
tickets.setTotalPrice(BigDecimal.ZERO);
|
||||
map.forEach((k, v) -> {
|
||||
BigDecimal reduce = v.stream().map(DlRepairTitem::getItemMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
tickets.setTotalPrice(tickets.getTotalPrice().add(reduce));
|
||||
if (k.equals("01")) {
|
||||
tickets.setProjectPrice(reduce);
|
||||
} else if (k.equals("02")) {
|
||||
tickets.setPartPrice(reduce);
|
||||
} else if (k.equals("03")) {
|
||||
tickets.setOtherPrice(reduce);
|
||||
}
|
||||
});
|
||||
return baseMapper.updateById(tickets) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工单子项
|
||||
*
|
||||
* @author 小李
|
||||
* @date 19:59 2024/10/24
|
||||
* @param respVO 主要有两个参数,主表ID,itemList(这个需要前端处理成子表的对象能接收的数据)
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void addItems(DlRepairTicketsRespVO respVO){
|
||||
// 先判断是否施工人员和销售人员是否都设置了
|
||||
respVO.getItemList().forEach(item -> {
|
||||
if (ObjectUtil.isEmpty(item.getRepairIds())){
|
||||
throw exception0(500, "施工人员尚未设置");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(item.getSaleId())){
|
||||
throw exception0(500, "销售人员尚未设置");
|
||||
}
|
||||
});
|
||||
// 新增子表
|
||||
List<DlRepairTitem> itemList = respVO.getItemList();
|
||||
itemList.forEach(item -> item.setTicketId(respVO.getId()));
|
||||
titemService.saveBatch(itemList);
|
||||
|
||||
// 更新主表
|
||||
boolean flag = computeTicket(respVO.getId());
|
||||
if (!flag){
|
||||
throw exception0(500, "系统错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,16 +2,23 @@ package cn.iocoder.yudao.module.tickets.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
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.vo.DlRepairTitemReqVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_titem(维修工单子表)】的数据库操作Service实现
|
||||
*
|
||||
@ -22,6 +29,9 @@ import java.util.List;
|
||||
public class DlRepairTitemServiceImpl extends ServiceImpl<DlRepairTitemMapper, DlRepairTitem>
|
||||
implements DlRepairTitemService {
|
||||
|
||||
@Resource
|
||||
private DlRepairTicketsService repairTicketsService;
|
||||
|
||||
/**
|
||||
* 维修工单子表 分页
|
||||
*
|
||||
@ -60,6 +70,63 @@ public class DlRepairTitemServiceImpl extends ServiceImpl<DlRepairTitemMapper, D
|
||||
baseMapper.updateRepairAndSale(dlRepairTitem);
|
||||
return dlRepairTitem;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看单个维修子表的数据
|
||||
*
|
||||
* @author 小李
|
||||
* @param id 子表ID
|
||||
**/
|
||||
@Override
|
||||
public DlRepairTitem getItemById(String id){
|
||||
return baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改单个工单子项的内容
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:41 2024/10/24
|
||||
* @param dlRepairTitemReqVO 对象
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void updateItemById(DlRepairTitemReqVO dlRepairTitemReqVO){
|
||||
// 更新工单子表
|
||||
DlRepairTitem titem = new DlRepairTitem();
|
||||
titem.setId(dlRepairTitemReqVO.getId());
|
||||
titem.setItemCount(dlRepairTitemReqVO.getItemCount());
|
||||
titem.setItemPrice(dlRepairTitemReqVO.getItemPrice());
|
||||
titem.setItemDiscount(dlRepairTitemReqVO.getItemDiscount());
|
||||
// 计算总价
|
||||
BigDecimal total = titem.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(titem.getItemDiscount());
|
||||
titem.setItemMoney(total);
|
||||
baseMapper.updateById(titem);
|
||||
|
||||
// 重新计算工单的一些数值
|
||||
boolean flag = repairTicketsService.computeTicket(dlRepairTitemReqVO.getTicketId());
|
||||
if (!flag){
|
||||
throw exception0(500, "系统异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修工单单个子项
|
||||
*
|
||||
* @author 小李
|
||||
* @date 20:18 2024/10/24
|
||||
* @param id 工单子项ID
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void removeItemById(String id){
|
||||
// 先查出来备用
|
||||
DlRepairTitem titem = baseMapper.selectById(id);
|
||||
// 删除数据
|
||||
baseMapper.deleteById(id);
|
||||
// 更新主表
|
||||
repairTicketsService.computeTicket(titem.getTicketId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -185,7 +185,7 @@
|
||||
-- 查待处理数据 --
|
||||
select drt.*
|
||||
from dl_repair_tickets drt
|
||||
where (drt.deleted = '0') AND drt.tickets_status IN ('04','05','01')
|
||||
where (drt.deleted = '0') AND drt.tickets_status IN ('04','05','01','07')
|
||||
<if test="map.ticketNo != null and map.ticketNo != ''">
|
||||
and (
|
||||
drt.ticket_no like concat('%', #{map.ticketNo}, '%')
|
||||
|
Loading…
Reference in New Issue
Block a user