This commit is contained in:
Vinjor 2024-10-22 16:37:05 +08:00
parent a7dcde4c65
commit cb43c66d43
12 changed files with 198 additions and 11 deletions

View File

@ -6,22 +6,17 @@ import cn.iocoder.yudao.module.project.service.RepairWaresService;
import cn.iocoder.yudao.module.project.vo.RepairWaresPageReqVO;
import cn.iocoder.yudao.module.project.vo.RepairWaresRespVO;
import cn.iocoder.yudao.module.project.vo.RepairWaresSaveReqVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Comparator;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 配件库")
@ -129,5 +124,15 @@ public class RepairWaresController {
return success(waresService.getWaresByName(name));
}
/**
* 查询所有有配件的分类
* @author vinjor-M
* @date 10:51 2024/10/22
**/
@GetMapping("/getAllTypeList")
@Operation(summary = "查询所有有配件的分配")
public CommonResult<?> getAllTypeList() {
return success(waresService.getAllTypeList());
}
}

View File

@ -9,6 +9,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 配件库 Mapper
*
@ -35,4 +38,12 @@ public interface RepairWaresMapper extends BaseMapper<RepairWares> {
* @date 18:03 2024/9/25
**/
RepairWaresRespVO getWaresByName(@Param("name") String name);
/**
* 查询所有有配件的分配
* @author vinjor-M
* @date 10:54 2024/10/22
* @return java.util.List<java.util.Map<java.lang.String,java.lang.String>>
**/
List<Map<String,String>> selectAllType();
}

View File

@ -8,6 +8,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
* 配件库 Service 接口
*
@ -60,4 +63,12 @@ public interface RepairWaresService extends IService<RepairWares> {
* @date 18:03 2024/9/25
**/
RepairWaresRespVO getWaresByName(String name);
/**
* 查询所有有配件的分配
* @author vinjor-M
* @date 10:53 2024/10/22
* @return java.util.List<java.util.Map<java.lang.String,java.lang.String>>
**/
List<Map<String,String>> getAllTypeList();
}

View File

@ -16,6 +16,8 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 配件库 Service 实现类
@ -100,4 +102,16 @@ public class RepairWaresServiceImpl extends ServiceImpl<RepairWaresMapper, Repai
return waresMapper.getWaresByName(name);
}
/**
* 查询所有有配件的分配
*
* @return java.util.List<java.util.Map < java.lang.String, java.lang.String>>
* @author vinjor-M
* @date 10:53 2024/10/22
**/
@Override
public List<Map<String, String>> getAllTypeList() {
return waresMapper.selectAllType();
}
}

View File

@ -17,6 +17,17 @@ import org.apache.ibatis.annotations.Param;
public interface DlRepairSoMapper extends BaseMapper<DlRepairSo> {
IPage<DlRepairSo> getRepairSoPage(@Param("map") DlRepairSoReqVO repairSoReqVO, Page<DlRepairSo> page);
/**
* 根据条件查询指定数量待确认的领料单 待确认的退料单
* @author vinjor-M
* @date 16:09 2024/10/22
* @param type 02 领料单 |04 退料单
* @param userId 用户ID
* @param status 04 待领料状态 |07 待退料状态
* @return java.lang.Integer
**/
Integer selectCountNum(@Param("type") String type,@Param("userId") Long userId,@Param("status") String status);
}

View File

@ -73,6 +73,20 @@ public class DlTicketWaresController {
return CommonResult.ok();
}
/**
* 新建配件申请单
* @author vinjor-M
* @date 14:35 2024/10/22
* @param respVO 请求体
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@PostMapping("/newApplyOrder")
@Operation(summary = "新增、修改")
public CommonResult<?> newApplyOrder(@RequestBody DlTicketWaresRespVO respVO){
dlTicketWaresService.createApplyOrder(respVO);
return CommonResult.ok();
}
/**
* 删除
*
@ -142,5 +156,17 @@ public class DlTicketWaresController {
dlTicketWaresService.passBackTicketWares(respVO);
return CommonResult.ok();
}
/**
* 维修工的角度查提交的配件申请单\待确认领料单\待确认退料单 待处理数量
* @author vinjor-M
* @date 15:32 2024/10/22
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@GetMapping("/getWorkerTodo")
@Operation(summary = "维修工的角度查提交的配件申请单")
public CommonResult<?> getWorkerTodo(){
return success(dlTicketWaresService.getWorkerTodo());
}
}

View File

@ -57,4 +57,6 @@ public class DlTicketWares extends TenantBaseDO {
/** 维修顾问namesystem_user的nickname */
private String adviserName;
/** 客户车辆的车牌号dl_repair_tickets中的carNo */
private String licenseNumber;
}

View File

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
* 针对表dl_ticket_wares(工单配件申请/退回表)的数据库操作Service
@ -88,4 +89,19 @@ public interface DlTicketWaresService extends IService<DlTicketWares> {
* @param respVO 请求对象
**/
void passBackTicketWares(DlTicketWaresRespVO respVO);
/**
* 创建配件申请单
* @author vinjor-M
* @date 14:48 2024/10/22
* @param respVO 请求体
**/
void createApplyOrder(DlTicketWaresRespVO respVO);
/**
* 维修工的角度查提交的配件申请单 待处理数量
* @author vinjor-M
* @date 15:38 2024/10/22
**/
Map<String,Integer> getWorkerTodo();
}

View File

@ -3,12 +3,15 @@ package cn.iocoder.yudao.module.tickets.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.RepairRoleEnum;
import cn.iocoder.yudao.common.SoStatusEnum;
import cn.iocoder.yudao.framework.security.core.LoginUser;
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.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.stockOperate.mapper.DlRepairSoMapper;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoService;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
@ -28,15 +31,13 @@ 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;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
@ -48,8 +49,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
* @date 11:56 2024/10/15
**/
@Service
public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, DlTicketWares>
implements DlTicketWaresService {
public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, DlTicketWares> implements DlTicketWaresService {
@Resource
@ -81,6 +81,9 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
@Resource
private RepairWorkerService workerService;
@Autowired
@Lazy
private DlRepairSoMapper dlRepairSoMapper;
/**
* 分页查询
@ -398,6 +401,71 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
// 更新申请单子表状态
twItemService.updateBatchById(respVO.getItems());
}
/**
* 创建配件申请单
*
* @param respVO 请求体
* @author vinjor-M
* @date 14:48 2024/10/22
**/
@Override
public void createApplyOrder(DlTicketWaresRespVO respVO) {
//默认待审核
respVO.setStatus("01");
//查维修单信息
DlRepairTickets tickets = repairTicketsService.getById(respVO.getTicketId());
respVO.setLicenseNumber(tickets.getCarNo());
respVO.setAdviserId(Long.valueOf(tickets.getAdviserId()));
respVO.setAdviserName(tickets.getAdviserName());
this.save(respVO);
if(!respVO.getItems().isEmpty()){
List<DlTwItem> list = respVO.getItems().stream().map(dlTwItem -> dlTwItem.setTwId(respVO.getId())).collect(Collectors.toList());
twItemService.saveBatch(list);
}
}
/**
* 维修工的角度查提交的配件申请单\待确认领料单\待确认退料单 待处理数量
*
* @author vinjor-M
* @date 15:38 2024/10/22
**/
@Override
public Map<String, Integer> getWorkerTodo() {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
LambdaQueryWrapper<DlTicketWares> queryWrapper = new LambdaQueryWrapper<DlTicketWares>()
.eq(DlTicketWares::getRepairId,loginUser.getId());
List<DlTicketWares> list = this.list(queryWrapper);
Map<String, Integer> rtnMap = new HashMap<>();
//所有提交的
Integer submitNum = list.size();
//已通过的
Integer allowNum = 0;
//未通过的
Integer noAllowNum = 0;
//待确认领料单
Integer waitingReceiveNum = dlRepairSoMapper.selectCountNum("02",loginUser.getId(), SoStatusEnum.TO_BE_PICKED.getCode());
//待确认退料单
Integer waitingBackNum = dlRepairSoMapper.selectCountNum("04",loginUser.getId(), SoStatusEnum.TO_BE_RETURNED.getCode());
for (DlTicketWares wares:list){
if("02".equals(wares.getStatus())){
//已通过
allowNum++;
}else if("05".equals(wares.getStatus())){
//被驳回
noAllowNum++;
}
}
rtnMap.put("submitNum",submitNum);
rtnMap.put("allowNum",allowNum);
rtnMap.put("noAllowNum",noAllowNum);
rtnMap.put("waitingReceiveNum",waitingReceiveNum);
rtnMap.put("waitingBackNum",waitingBackNum);
return rtnMap;
}
}

View File

@ -24,6 +24,9 @@
<if test="entity.name != null and entity.name != ''">
and drw.name like concat('%', #{entity.name}, '%')
</if>
<if test="entity.type != null and entity.type != ''">
and drw.type =#{entity.type}
</if>
</where>
GROUP BY
drw.id
@ -44,4 +47,12 @@
LEFT JOIN dl_base_warehouse dbw ON drw.warehouse = dbw.id AND dbw.deleted = 0
where drw.name = #{name} order by drw.create_time desc limit 1
</select>
<select id="selectAllType" resultType="java.util.Map">
SELECT
tmp.type as id,
dbt.`name`
FROM
( SELECT DISTINCT type FROM dl_repair_wares ) tmp
LEFT JOIN dl_base_type dbt ON tmp.type = dbt.id
</select>
</mapper>

View File

@ -86,4 +86,15 @@
</if>
order by so.create_time desc
</select>
<select id="selectCountNum" resultType="java.lang.Integer">
SELECT
COUNT(id)
FROM
dl_repair_so
WHERE
user_id = #{userId}
AND so_type = #{type}
AND so_status = #{status}
AND deleted = 0
</select>
</mapper>

View File

@ -180,6 +180,7 @@ logging:
cn.iocoder.yudao.module.staff.mapper: debug #
cn.iocoder.yudao.module.property.mapper: debug #
cn.iocoder.yudao.module.tickets.mapper: debug #
cn.iocoder.yudao.module.project.mapper: debug #
debug: false