申请审核 1%
This commit is contained in:
parent
70995ffe73
commit
2c7868b96a
@ -73,5 +73,19 @@ public class DlTicketWaresController {
|
||||
dlTicketWaresService.removeTicketWares(id);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核
|
||||
*
|
||||
* @author 小李
|
||||
* @date 21:15 2024/10/15
|
||||
* @param respVO 请求对象
|
||||
**/
|
||||
@PostMapping("/audit")
|
||||
@Operation(summary = "审核")
|
||||
public CommonResult<?> auditTicketWares(@RequestBody DlTicketWaresRespVO respVO){
|
||||
dlTicketWaresService.auditTicketWares(respVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,6 @@ import cn.iocoder.yudao.module.tickets.vo.DlTwItemReqVO;
|
||||
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 javax.annotation.Resource;
|
||||
|
@ -41,4 +41,13 @@ public interface DlTicketWaresService extends IService<DlTicketWares> {
|
||||
* @param id id
|
||||
**/
|
||||
void removeTicketWares(String id);
|
||||
|
||||
/**
|
||||
* 审核
|
||||
*
|
||||
* @author 小李
|
||||
* @date 21:15 2024/10/15
|
||||
* @param respVO 请求对象
|
||||
**/
|
||||
void auditTicketWares(DlTicketWaresRespVO respVO);
|
||||
}
|
||||
|
@ -1,19 +1,26 @@
|
||||
package cn.iocoder.yudao.module.tickets.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||
import cn.iocoder.yudao.module.project.entity.RepairWares;
|
||||
import cn.iocoder.yudao.module.project.service.RepairWaresService;
|
||||
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.DlTicketWaresMapper;
|
||||
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.vo.DlTicketWaresReqVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlTicketWaresRespVO;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -21,6 +28,7 @@ import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@ -49,6 +57,10 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
@Lazy
|
||||
private RepairWorkerService repairWorkerService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private DlRepairTitemService repairTitemService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
@ -126,6 +138,54 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
// 删除子表
|
||||
twItemService.remove(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核
|
||||
*
|
||||
* @author 小李
|
||||
* @date 21:15 2024/10/15
|
||||
* @param respVO 请求对象
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void auditTicketWares(DlTicketWaresRespVO respVO){
|
||||
// 设置单据状态
|
||||
baseMapper.update(new LambdaUpdateWrapper<DlTicketWares>()
|
||||
.set(DlTicketWares::getStatus, respVO.getStatus())
|
||||
.eq(DlTicketWares::getId, respVO.getId())
|
||||
);
|
||||
// 如果是通过就还需要把配件信息加入到工单中
|
||||
if (ObjectUtil.isNotEmpty(respVO.getStatus()) && respVO.getStatus().equals("02")){
|
||||
// 更新维修工单
|
||||
// 计算配件的总价
|
||||
BigDecimal reduce = respVO.getWares().stream().map(DlRepairTitem::getItemMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
repairTicketsService.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||
// 工单子项总数量增加上配件的数量
|
||||
.setSql("count = count" + respVO.getWares().size())
|
||||
// 工单配件总价
|
||||
.setSql("part_price = part_price" + reduce)
|
||||
// 工单总价
|
||||
.setSql("total_price = total_price" + reduce)
|
||||
// 参考成本
|
||||
.setSql("cost = cost" + reduce)
|
||||
// 参考毛利
|
||||
.setSql("profit = profit" + reduce)
|
||||
// 领料状态
|
||||
.set(DlRepairTickets::getPartStatus, "02")
|
||||
.eq(DlRepairTickets::getId, respVO.getTicketId())
|
||||
);
|
||||
// 更新维修工单子表
|
||||
respVO.getWares().forEach(item -> {
|
||||
// 主表id
|
||||
item.setTicketId(respVO.getTicketId());
|
||||
// 类型为配件
|
||||
item.setItemType("02");
|
||||
// 状态为未领料
|
||||
item.setItemStatus("08");
|
||||
});
|
||||
repairTitemService.saveBatch(respVO.getWares());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.tickets.vo;
|
||||
|
||||
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 lombok.Data;
|
||||
@ -17,4 +18,7 @@ public class DlTicketWaresRespVO extends DlTicketWares {
|
||||
|
||||
/** 子表list */
|
||||
private List<DlTwItem> items;
|
||||
|
||||
/** 工单子表需要的记录 */
|
||||
private List<DlRepairTitem> wares;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user