Merge branch 'dev' of http://122.51.230.86:3000/dianliang/lanan-system into dev
This commit is contained in:
commit
730d2065a5
@ -55,6 +55,8 @@ public class BaseConstants {
|
||||
public static final Integer BATCH_SIZE = 100;
|
||||
/**资质临期通知模板*/
|
||||
public static final String QUALS_INTERIM_PERIOD = "quals_interim_period";
|
||||
/**站内信模版*/
|
||||
public static final String TICKET_EMPLOY = "ticket_employ";
|
||||
/**资质过期通知模板*/
|
||||
public static final String QUALS_EXPIRED = "quals_expired";
|
||||
/** 资产临期通知模板 */
|
||||
@ -119,7 +121,10 @@ public class BaseConstants {
|
||||
public static final String REPAIR_RECORD_TYPE_ZJ = "zj";
|
||||
/**结束工单*/
|
||||
public static final String REPAIR_RECORD_TYPE_JSGD = "jsgd";
|
||||
|
||||
/** 开始施工 */
|
||||
public static final String REPAIR_RECORD_TYPE_KSSG = "kssg";
|
||||
/** 施工中 */
|
||||
public static final String REPAIR_RECORD_TYPE_SGZ = "sgz";
|
||||
|
||||
|
||||
}
|
||||
|
@ -40,13 +40,23 @@ public interface CarMainService extends IService<CarMain> {
|
||||
void deleteCarMain(String id);
|
||||
|
||||
/**
|
||||
* 获得车辆信息
|
||||
* 获得车辆及关联客户信息
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 车辆信息
|
||||
*/
|
||||
CarMain getCarMain(String id);
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询车辆信息
|
||||
* @author PQZ
|
||||
* @date 18:08 2024/10/18
|
||||
* @param id 车辆id
|
||||
* @return cn.iocoder.yudao.module.custom.vo.CarMainRespVO
|
||||
**/
|
||||
CarMainRespVO queryCarById(String id);
|
||||
|
||||
/**
|
||||
* 获得车辆信息分页
|
||||
*
|
||||
|
@ -180,6 +180,19 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
|
||||
return carMainRespVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询车辆信息
|
||||
*
|
||||
* @param id 车辆id
|
||||
* @return cn.iocoder.yudao.module.custom.vo.CarMainRespVO
|
||||
* @author PQZ
|
||||
* @date 18:08 2024/10/18
|
||||
**/
|
||||
@Override
|
||||
public CarMainRespVO queryCarById(String id) {
|
||||
return baseMapper.findOne(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得车辆信息分页
|
||||
*
|
||||
|
@ -85,6 +85,7 @@
|
||||
SELECT
|
||||
<include refid="baseCarMainColumn"></include>,
|
||||
bcb.brand_name AS brandStr,
|
||||
bcb.logo_img AS logoImg,
|
||||
bcm.model_name AS modelStr
|
||||
FROM
|
||||
`base_car_main` tbcm
|
||||
|
@ -0,0 +1,81 @@
|
||||
package cn.iocoder.yudao.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 工单操作记录-工作类型枚举
|
||||
*
|
||||
* @author vinjor-m
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum RecordTypeEnum {
|
||||
/**
|
||||
* 创建工单
|
||||
*/
|
||||
CJGD("cjgd","创建工单"),
|
||||
/**
|
||||
* 指派施工
|
||||
*/
|
||||
ZPSG("zpsg","指派施工"),
|
||||
/**
|
||||
* 领料
|
||||
*/
|
||||
LL("ll","领料"),
|
||||
/**
|
||||
* 退料
|
||||
*/
|
||||
TL("tl","退料"),
|
||||
/**
|
||||
* 施工完成(自检)
|
||||
*/
|
||||
SGWCZJ("sgwczj","施工完成(自检)"),
|
||||
/**
|
||||
* 总检
|
||||
*/
|
||||
ZJ("zj","总检"),
|
||||
/**
|
||||
* 结束工单
|
||||
*/
|
||||
JSGD("jsgd","结束工单"),
|
||||
/**
|
||||
* 开始施工
|
||||
*/
|
||||
KSSG("kssg","开始施工"),
|
||||
/**
|
||||
* 施工中
|
||||
*/
|
||||
SGZ("sgz","施工中"),
|
||||
/**
|
||||
* 接单
|
||||
*/
|
||||
jd("jd","接单");
|
||||
|
||||
/**
|
||||
* code
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 根据code返回对应的枚举
|
||||
* @author vinjor-M
|
||||
* @date 14:23 2024/10/16
|
||||
* @param code code
|
||||
* @return cn.iocoder.yudao.common.SystemEnum
|
||||
**/
|
||||
public static RecordTypeEnum getEnumByCode(String code) {
|
||||
for (RecordTypeEnum thisEnum : RecordTypeEnum.values()) {
|
||||
if (thisEnum.getCode().equalsIgnoreCase(code)) {
|
||||
// 找到对应的枚举
|
||||
return thisEnum;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("无效的枚举code:" + code);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.common;
|
||||
|
||||
/**
|
||||
* 维修系统常量
|
||||
* @author vinjor-M
|
||||
* @date 17:44 2024/10/18
|
||||
**/
|
||||
public class RepairCons {
|
||||
|
||||
/**工单-待处理*/
|
||||
public static final String TICKETS_WAITING = "waiting";
|
||||
/**工单-所有*/
|
||||
public static final String TICKETS_ALL = "all";
|
||||
}
|
@ -8,14 +8,5 @@ package cn.iocoder.yudao.common;
|
||||
**/
|
||||
public class RepairConstants {
|
||||
|
||||
public static final String SERVICE_ADVISOR = "维修服务顾问";
|
||||
|
||||
public static final String GENERAL_INSPECTION = "维修总检";
|
||||
|
||||
public static final String TEAM_LEADER = "班组长";
|
||||
|
||||
public static final String REPAIR_STAFF = "维修工";
|
||||
|
||||
public static final String REPAIR_WAREHOUSE = "维修仓库管理员";
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,65 @@
|
||||
package cn.iocoder.yudao.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 维修工单状态枚举
|
||||
*
|
||||
* @author vinjor-m
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum TicketsStatusEnum {
|
||||
/**
|
||||
* 未派工
|
||||
*/
|
||||
NO_WORK("04","未派工"),
|
||||
/**
|
||||
* 施工中
|
||||
*/
|
||||
WORKING("05","施工中"),
|
||||
/**
|
||||
* 未结账
|
||||
*/
|
||||
NO_PAY("01","未结账"),
|
||||
/**
|
||||
* 挂单/记账
|
||||
*/
|
||||
ACCOUNTING("06","挂单/记账"),
|
||||
/**
|
||||
* 已结账
|
||||
*/
|
||||
CHECK_OUT("02","已结账"),
|
||||
/**
|
||||
* 已作废
|
||||
*/
|
||||
CANCEL("03","已作废");
|
||||
|
||||
/**
|
||||
* 角色code
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 根据角色code返回对应的枚举
|
||||
* @author vinjor-M
|
||||
* @date 14:23 2024/10/16
|
||||
* @param code 角色code
|
||||
* @return cn.iocoder.yudao.common.SystemEnum
|
||||
**/
|
||||
public static TicketsStatusEnum getRepairRole(String code) {
|
||||
for (TicketsStatusEnum roleEnum : TicketsStatusEnum.values()) {
|
||||
if (roleEnum.getCode().equalsIgnoreCase(code)) {
|
||||
// 找到对应的枚举
|
||||
return roleEnum;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("无效的角色code:" + code);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package cn.iocoder.yudao.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 维修工单施工状态枚举
|
||||
*
|
||||
* @author vinjor-m
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum TicketsWorkStatusEnum {
|
||||
/**
|
||||
* 等待接单
|
||||
*/
|
||||
WAITING_RECEIVING("01","等待接单"),
|
||||
/**
|
||||
* 已接单
|
||||
*/
|
||||
RECEIVED("04","已接单"),
|
||||
/**
|
||||
* 施工中
|
||||
*/
|
||||
DOING("02","施工中"),
|
||||
/**
|
||||
* 已完成
|
||||
*/
|
||||
END("03","已完成"),
|
||||
|
||||
/** 待终检 */
|
||||
END_CHECK("05", "待终检");
|
||||
|
||||
/**
|
||||
* 角色code
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 根据角色code返回对应的枚举
|
||||
* @author vinjor-M
|
||||
* @date 14:23 2024/10/16
|
||||
* @param code 角色code
|
||||
* @return cn.iocoder.yudao.common.SystemEnum
|
||||
**/
|
||||
public static TicketsWorkStatusEnum getRepairRole(String code) {
|
||||
for (TicketsWorkStatusEnum roleEnum : TicketsWorkStatusEnum.values()) {
|
||||
if (roleEnum.getCode().equalsIgnoreCase(code)) {
|
||||
// 找到对应的枚举
|
||||
return roleEnum;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("无效的角色code:" + code);
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,16 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
|
||||
import cn.iocoder.yudao.module.base.service.RepairRecordsItemService;
|
||||
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 维修记录 管理 API
|
||||
@ -20,6 +24,37 @@ public class RepairRecordsController {
|
||||
|
||||
@Resource
|
||||
private RepairRecordsService repairRecordsService;
|
||||
@Resource
|
||||
private RepairRecordsItemService repairRecordsItemService;
|
||||
|
||||
/**
|
||||
* 根据当前用户和工单主表id查询当前在维修的项目信息
|
||||
* @author vinjor-M
|
||||
* @date 13:50 2024/10/19
|
||||
* @param ticketId 工单ID
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@GetMapping("/listByTicketId")
|
||||
@Operation(summary = "根据当前用户和工单主表id查询当前在维修的项目信息")
|
||||
public CommonResult<?> selectNowRepairByTicketId(@RequestParam("ticketId") String ticketId) {
|
||||
return repairRecordsService.selectNowRepairByTicketId(ticketId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修记录图片授权客户查看接口--收回查看权限也走这个
|
||||
* @author vinjor-M
|
||||
* @date 13:50 2024/10/19
|
||||
* @param itemList 子表集和
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@PostMapping("/updateItemBatch")
|
||||
@Operation(summary = "维修记录图片授权客户查看接口--收回查看权限也走这个")
|
||||
public CommonResult<?> updateItemBatch(@RequestBody List<RepairRecordsItem> itemList) {
|
||||
if(!itemList.isEmpty()){
|
||||
repairRecordsItemService.updateBatchById(itemList);
|
||||
}
|
||||
return CommonResult.success("");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 维修记录 Mapper
|
||||
@ -26,6 +27,13 @@ public interface RepairRecordsMapper extends BaseMapper<RepairRecords> {
|
||||
*/
|
||||
List<RepairRecordsRespVO> queryRepairRecords(@Param("entity") RepairRecordsPageReqVO entity);
|
||||
|
||||
|
||||
/**
|
||||
* 根据当前用户和工单主表id查询当前在维修的项目信息
|
||||
* @author vinjor-M
|
||||
* @date 13:36 2024/10/19
|
||||
* @param ticketId 工单ID
|
||||
* @return java.util.Map<java.lang.String,java.lang.String>
|
||||
**/
|
||||
Map<String,String> selectNowRepairByTicketId(@Param("ticketId")String ticketId);
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.base.service;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairRecords;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
|
||||
@ -19,7 +20,7 @@ public interface RepairRecordsService extends IService<RepairRecords> {
|
||||
*
|
||||
* @param ticketId 工单id
|
||||
* @param repairItemId 工单子表id
|
||||
* @param type 工作类型(数据字典:repair_records_type;后端已初始化常量,可直接引用base包中BaseConstants下106-119行)
|
||||
* @param type 工作类型(数据字典:repair_records_type;后端对应 RecordTypeEnum 枚举)
|
||||
* @param remark 备注
|
||||
* @param images 图片(相对路径按照“,”分隔)
|
||||
* @author PQZ
|
||||
@ -36,4 +37,12 @@ public interface RepairRecordsService extends IService<RepairRecords> {
|
||||
**/
|
||||
List<RepairRecordsRespVO> queryList(RepairRecordsPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 根据当前用户和工单主表id查询当前在维修的项目信息
|
||||
* @author vinjor-M
|
||||
* @date 13:35 2024/10/19
|
||||
* @param ticketId 工单id
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
CommonResult<?> selectNowRepairByTicketId(String ticketId);
|
||||
}
|
||||
|
@ -69,6 +69,15 @@ public interface RepairWorkerService extends IService<RepairWorker> {
|
||||
**/
|
||||
List<RepairWorker> listByTicketId(String ticketId);
|
||||
|
||||
/**
|
||||
* 向指定用户发送消息
|
||||
* @author PQZ
|
||||
* @date 16:27 2024/10/18
|
||||
* @param userId 用户id
|
||||
* @param text 消息通知内容
|
||||
**/
|
||||
void sentMessage(Long userId,String text);
|
||||
|
||||
/**
|
||||
* 通过班组长的id查该班组的员工
|
||||
*
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.base.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairRecords;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
|
||||
@ -42,7 +43,7 @@ public class RepairRecordsServiceImpl extends ServiceImpl<RepairRecordsMapper, R
|
||||
*
|
||||
* @param ticketId 工单id
|
||||
* @param repairItemId 工单子表id
|
||||
* @param type 工作类型(数据字典:repair_records_type;后端已初始化常量,可直接引用base包中BaseConstants下106-119行)
|
||||
* @param type 工作类型(数据字典:repair_records_type;后端对应 RecordTypeEnum 枚举)
|
||||
* @param remark 备注
|
||||
* @param images 图片(相对路径按照“,”分隔)
|
||||
* @author PQZ
|
||||
@ -88,4 +89,17 @@ public class RepairRecordsServiceImpl extends ServiceImpl<RepairRecordsMapper, R
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前用户和工单主表id查询当前在维修的项目信息
|
||||
*
|
||||
* @param ticketId 工单id
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
* @author vinjor-M
|
||||
* @date 13:35 2024/10/19
|
||||
**/
|
||||
@Override
|
||||
public CommonResult<?> selectNowRepairByTicketId(String ticketId) {
|
||||
return CommonResult.success(repairRecordsMapper.selectNowRepairByTicketId(ticketId));
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,18 @@ package cn.iocoder.yudao.module.base.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.app.controller.admin.NotifyMessageSocket;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||
import cn.iocoder.yudao.module.base.mapper.RepairWorkerMapper;
|
||||
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairWorkerSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
||||
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
||||
@ -16,14 +21,18 @@ 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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.TICKET_EMPLOY;
|
||||
|
||||
/**
|
||||
* 维修工人 Service 实现类
|
||||
*
|
||||
@ -39,6 +48,12 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
@Resource
|
||||
@Lazy
|
||||
private DlRepairTitemService dlRepairTitemService;
|
||||
@Resource
|
||||
private NotifyMessageSendApi sendApi;
|
||||
@Autowired
|
||||
private NotifyMessageSocket notifyMessageSocket;
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
|
||||
/**
|
||||
@ -50,7 +65,7 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
**/
|
||||
@Override
|
||||
public void saveWorkers(List<UserDTO> userList) {
|
||||
if (CollectionUtil.isNotEmpty(userList)){
|
||||
if (CollectionUtil.isNotEmpty(userList)) {
|
||||
//获取已有的维修工人ID列表
|
||||
List<Long> existingWorkerIds = workerMapper.getAllWorkerIds();
|
||||
|
||||
@ -98,18 +113,18 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
**/
|
||||
@Override
|
||||
public IPage<RepairWorkerRespVO> queryListPage(RepairWorkerPageReqVO pageReqVO, Page<RepairWorkerRespVO> page) {
|
||||
return workerMapper.queryListPage(pageReqVO,page);
|
||||
return workerMapper.queryListPage(pageReqVO, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过工单ID查到工单ID中所选择的员工信息
|
||||
*
|
||||
* @param ticketId 工单ID
|
||||
* @author 小李
|
||||
* @date 15:53 2024/10/14
|
||||
* @param ticketId 工单ID
|
||||
**/
|
||||
@Override
|
||||
public List<RepairWorker> listByTicketId(String ticketId){
|
||||
public List<RepairWorker> listByTicketId(String ticketId) {
|
||||
// 查工单的项目信息
|
||||
List<DlRepairTitem> titems = dlRepairTitemService.list(new LambdaQueryWrapper<DlRepairTitem>()
|
||||
.and(item -> {
|
||||
@ -122,6 +137,34 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定用户发送消息
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param text 消息通知内容
|
||||
* @author PQZ
|
||||
* @date 16:27 2024/10/18
|
||||
**/
|
||||
@Override
|
||||
public void sentMessage(Long userId, String text) {
|
||||
try {
|
||||
//获取当前登录用户
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
// 准备发送参数
|
||||
Map<String, Object> templateParams = new HashMap<>();
|
||||
// 发送模版内容
|
||||
templateParams.put("text", text);
|
||||
// 发送站内信
|
||||
sendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
||||
.setUserId(userId)
|
||||
.setTemplateCode(TICKET_EMPLOY).setTemplateParams(templateParams));
|
||||
//发送语音提醒
|
||||
notifyMessageSocket.sendMessage(text, loginUser.getTenantId().toString(), userId.toString());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过班组长的id查该班组的员工
|
||||
*
|
||||
@ -129,7 +172,7 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
* @date 16:55 2024/10/14
|
||||
**/
|
||||
@Override
|
||||
public List<RepairWorker> listByLeads(){
|
||||
public List<RepairWorker> listByLeads() {
|
||||
// 取班组长的记录
|
||||
RepairWorker worker = baseMapper.selectOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()));
|
||||
// 根据班组长的工种查所有该工程的工人
|
||||
@ -149,7 +192,7 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
public boolean getIfLeader() {
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
LambdaQueryWrapper<RepairWorker> queryWrapper = new LambdaQueryWrapper<RepairWorker>()
|
||||
.eq(RepairWorker::getUserId,userId);
|
||||
.eq(RepairWorker::getUserId, userId);
|
||||
List<RepairWorker> list = this.list(queryWrapper);
|
||||
return !list.isEmpty() && "1".equals(list.get(0).getIsLeads());
|
||||
}
|
||||
|
@ -128,4 +128,13 @@ public class RepairProjectController {
|
||||
List<RepairProject> list = repairProjectService.list(new LambdaQueryWrapper<RepairProject>().eq(RepairProject::getName, name));
|
||||
return success(list.stream().max(Comparator.comparing(RepairProject::getCreateTime)).orElse(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取维修项目和分类
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getRepairProjectAndCateGory")
|
||||
public CommonResult getRepairProjectAndCateGory(){
|
||||
return success(repairProjectService.getRepairProjectAndCateGory());
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.project.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.project.entity.RepairProject;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectAppvo;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectRespVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
@ -9,6 +10,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 维修项目 Mapper
|
||||
*
|
||||
@ -28,4 +31,9 @@ public interface RepairProjectMapper extends BaseMapper<RepairProject> {
|
||||
**/
|
||||
IPage<RepairProjectRespVO> selectListPage(@Param("entity") RepairProjectPageReqVO pageReqVO, Page<RepairProjectRespVO> page);
|
||||
|
||||
/**
|
||||
* 查询维修项目和维修项目分类信息
|
||||
* @return
|
||||
*/
|
||||
List<RepairProjectAppvo> selectProjectAndCateGory();
|
||||
}
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.project.service;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.project.entity.RepairProject;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectAppvo;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectRespVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectSaveReqVO;
|
||||
@ -9,6 +10,8 @@ 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;
|
||||
|
||||
/**
|
||||
* 维修项目 Service 接口
|
||||
*
|
||||
@ -56,4 +59,9 @@ public interface RepairProjectService extends IService<RepairProject> {
|
||||
IPage<RepairProjectRespVO> queryListPage(RepairProjectPageReqVO pageReqVO, Page<RepairProjectRespVO> page);
|
||||
|
||||
|
||||
/**
|
||||
* 查询服务分类和维修项目列表
|
||||
* @return
|
||||
*/
|
||||
List<RepairProjectAppvo> getRepairProjectAndCateGory();
|
||||
}
|
@ -1,9 +1,13 @@
|
||||
package cn.iocoder.yudao.module.project.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.project.entity.RepairProject;
|
||||
import cn.iocoder.yudao.module.project.mapper.RepairProjectMapper;
|
||||
import cn.iocoder.yudao.module.project.service.RepairProjectService;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectAppvo;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectRespVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectSaveReqVO;
|
||||
@ -14,6 +18,9 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 维修项目 Service 实现类
|
||||
@ -82,5 +89,36 @@ public class RepairProjectServiceImpl extends ServiceImpl<RepairProjectMapper, R
|
||||
return repairProjectMapper.selectListPage(pageReqVO,page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询服务分类和维修项目列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<RepairProjectAppvo> getRepairProjectAndCateGory() {
|
||||
List<RepairProjectAppvo> repairProjectAppvos = repairProjectMapper.selectProjectAndCateGory();
|
||||
// 提取并去重 typeId
|
||||
List<String> uniqueTypeIds = repairProjectAppvos.stream()
|
||||
.map(RepairProjectAppvo::getTypeId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<RepairProjectAppvo> list = new ArrayList<>();
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.project.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.project.entity.RepairProject;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class RepairProjectAppvo extends RepairProject{
|
||||
private String typeName;
|
||||
private String typeId;
|
||||
private List<RepairProject> groupList;
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.tickets.controller.admin;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.common.RepairCons;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||
@ -9,6 +10,7 @@ import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -171,6 +173,10 @@ public class DlRepairTicketsController {
|
||||
@RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize){
|
||||
Page<DlRepairTickets> page = new Page<>(pageNo, pageSize);
|
||||
if(StringUtils.isEmpty(repairTicketsReqVO.getSelectType())){
|
||||
//查询类型为空,默认查待处理的
|
||||
repairTicketsReqVO.setSelectType(RepairCons.TICKETS_WAITING);
|
||||
}
|
||||
return success(dlRepairTicketsService.getPageType(repairTicketsReqVO, page));
|
||||
}
|
||||
|
||||
@ -213,5 +219,34 @@ public class DlRepairTicketsController {
|
||||
dlRepairTicketsService.updateRepair(reqVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新工单状态
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:46 2024/10/18
|
||||
* @param respVO 请求对象
|
||||
**/
|
||||
@PostMapping("/updateStatus")
|
||||
@Operation(summary = "更新工单状态")
|
||||
public CommonResult<?> updateStatus(@RequestBody DlRepairTicketsRespVO respVO){
|
||||
dlRepairTicketsService.updateStatus(respVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 配件客户是否可见
|
||||
*
|
||||
* @author 小李
|
||||
* @date 21:52 2024/10/18
|
||||
* @param id 工单ID
|
||||
* @param show 是否可见
|
||||
**/
|
||||
@GetMapping("/show")
|
||||
@Operation(summary = "配件客户是否可见")
|
||||
public CommonResult<?> updateShow(@RequestParam("id") String id, @RequestParam("show") String show){
|
||||
dlRepairTicketsService.updateShow(id, show);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,5 +48,18 @@ public class DlRepairTitemController {
|
||||
Page<DlRepairTitemRespVO> page = new Page<>(pageNo, pageSize);
|
||||
return success(dlRepairTitemService.getTItemPage(repairTitemRespVO, page));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前操作人操作的工单中的项目
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:01 2024/10/18
|
||||
* @param ticketId 工单ID
|
||||
**/
|
||||
@GetMapping("/listProject")
|
||||
@Operation(summary = "获取当前操作人操作的工单中的项目")
|
||||
public CommonResult<?> getProjectList(@RequestParam("ticketId") String ticketId){
|
||||
return success(dlRepairTitemService.getProjectList(ticketId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,19 @@ public class DlTicketWaresController {
|
||||
return success(dlTicketWaresService.getPage(reqVO, page));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前工单下的配件申请单
|
||||
* @author PQZ
|
||||
* @date 13:43 2024/10/19
|
||||
* @param reqVO DlTicketWaresReqVO实体
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "不分页查询待审批的配件申请单")
|
||||
public CommonResult<?> list(DlTicketWaresReqVO reqVO){
|
||||
return success(dlTicketWaresService.listByTicket(reqVO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增、修改
|
||||
*
|
||||
|
@ -184,4 +184,7 @@ public class DlRepairTickets extends TenantBaseDO {
|
||||
|
||||
/** 工单当前施工人name */
|
||||
private String nowRepairName;
|
||||
|
||||
/** 配件是否可见(yes_no,1:可见,0:不可见) */
|
||||
private String partShow;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class DlTwItem extends TenantBaseDO {
|
||||
private Integer waresCount;
|
||||
|
||||
/**
|
||||
* 配件状态(01:已领料,02:未领料,03:已退料 tw_item_status)
|
||||
* 配件状态(01:已领料,02:未领料,03:已退料,04可确认领料,可确认退料 tw_item_status)
|
||||
*/
|
||||
private String waresStatus;
|
||||
|
||||
@ -57,4 +57,10 @@ public class DlTwItem extends TenantBaseDO {
|
||||
|
||||
/** 客户是否可见(字典yes_no);已存在于系统中(是:1,否:0) */
|
||||
private String isShow;
|
||||
|
||||
/** 可领取数量 */
|
||||
private Integer waresCouldCount;
|
||||
|
||||
/** 已领料数量 */
|
||||
private Integer waresAlreadyCount;
|
||||
}
|
@ -27,13 +27,21 @@ public interface DlRepairTicketsMapper extends BaseMapper<DlRepairTickets> {
|
||||
IPage<DlRepairTickets> getTicketsPage(@Param("map") DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page);
|
||||
|
||||
/**
|
||||
* 分类查询工单分页
|
||||
* 分类查询工单分页----待处理的
|
||||
*
|
||||
* @author 小李
|
||||
* @date 16:26 2024/10/12
|
||||
* @param repairTicketsReqVO 查询对象
|
||||
**/
|
||||
IPage<DlRepairTickets> getPageType(@Param("map") DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page);
|
||||
/**
|
||||
* 分类查询工单分页----所有记录
|
||||
*
|
||||
* @author 小李
|
||||
* @date 16:26 2024/10/12
|
||||
* @param repairTicketsReqVO 查询对象
|
||||
**/
|
||||
IPage<DlRepairTickets> getPageTypeAll(@Param("map") DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -116,4 +116,23 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
* @param reqVO 请求对象
|
||||
**/
|
||||
void updateRepair(DlRepairTicketsReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 更新工单状态
|
||||
*
|
||||
* @param respVO 请求对象
|
||||
* @author 小李
|
||||
* @date 15:46 2024/10/18
|
||||
**/
|
||||
void updateStatus(DlRepairTicketsRespVO respVO);
|
||||
|
||||
/**
|
||||
* 配件客户是否可见
|
||||
*
|
||||
* @author 小李
|
||||
* @date 21:52 2024/10/18
|
||||
* @param id 工单ID
|
||||
* @param show 是否可见
|
||||
**/
|
||||
void updateShow(String id, String show);
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ 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;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_titem(维修工单子表)】的数据库操作Service
|
||||
*
|
||||
@ -22,4 +24,14 @@ public interface DlRepairTitemService extends IService<DlRepairTitem> {
|
||||
* @param repairTitemRespVO 查询对象
|
||||
**/
|
||||
IPage<DlRepairTitemRespVO> getTItemPage(DlRepairTitemRespVO repairTitemRespVO, Page<DlRepairTitemRespVO> page);
|
||||
|
||||
/**
|
||||
* 获取当前操作人操作的工单中的项目
|
||||
*
|
||||
* @param ticketId 工单ID
|
||||
* @author 小李
|
||||
* @date 15:01 2024/10/18
|
||||
**/
|
||||
List<DlRepairTitem> getProjectList(String ticketId);
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ 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;
|
||||
|
||||
/**
|
||||
* 针对表【dl_ticket_wares(工单配件申请/退回表)】的数据库操作Service
|
||||
*
|
||||
@ -24,6 +26,15 @@ public interface DlTicketWaresService extends IService<DlTicketWares> {
|
||||
**/
|
||||
IPage<DlTicketWares> getPage(DlTicketWaresReqVO reqVO, Page<DlTicketWares> page);
|
||||
|
||||
/**
|
||||
* 查询当前工单下的配件申请单
|
||||
* @author PQZ
|
||||
* @date 13:44 2024/10/19
|
||||
* @param reqVO DlTicketWaresReqVO
|
||||
* @return java.util.List<cn.iocoder.yudao.module.tickets.entity.DlTicketWares>
|
||||
**/
|
||||
List<DlTicketWares> listByTicket(DlTicketWaresReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 新增、修改
|
||||
*
|
||||
|
@ -3,17 +3,21 @@ package cn.iocoder.yudao.module.tickets.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.RepairErrorCodeConstants;
|
||||
import cn.iocoder.yudao.common.RepairRoleEnum;
|
||||
import cn.iocoder.yudao.common.*;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
||||
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
|
||||
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
|
||||
import cn.iocoder.yudao.module.booking.service.DlRepairBookingService;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerCar;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||
import cn.iocoder.yudao.module.custom.service.CarMainService;
|
||||
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.service.RepairOrderInfoService;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoSaveReqVO;
|
||||
@ -50,6 +54,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -133,6 +139,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
private RepairWorkerService repairWorkerService;
|
||||
@Resource
|
||||
private RepairWorkerService workerService;
|
||||
@Resource
|
||||
@Lazy
|
||||
private RepairRecordsService recordsService;
|
||||
@Autowired
|
||||
private RepairRecordsService repairRecordsService;
|
||||
|
||||
|
||||
/**
|
||||
* 维修工单表 新增
|
||||
@ -166,7 +178,9 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
List<DlRepairTitem> collect = itemList.stream().filter(item -> item.getItemType().equals("02")).collect(Collectors.toList());
|
||||
ticketsRespVO.setPartStatus(CollectionUtil.isEmpty(collect) ? "01" : "02");
|
||||
// 工单进行状态 默认是等待接单
|
||||
ticketsRespVO.setTicketsWorkStatus("01");
|
||||
ticketsRespVO.setTicketsWorkStatus(TicketsWorkStatusEnum.WAITING_RECEIVING.getCode());
|
||||
// 工单状态 默认是待派工
|
||||
ticketsRespVO.setTicketsStatus(TicketsStatusEnum.NO_WORK.getCode());
|
||||
|
||||
// 新增主表
|
||||
baseMapper.insert(ticketsRespVO);
|
||||
@ -216,6 +230,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
bookingService.updateById(dlRepairBooking);
|
||||
}
|
||||
repairOrderInfoService.saveOrderInfo(repairOrderInfo);
|
||||
//最后记录操作日志--创建工单
|
||||
repairRecordsService.saveRepairRecord(ticketsRespVO.getId(),null, RecordTypeEnum.CJGD.getCode(),"创建工单",null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -242,6 +258,15 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 查工单主表
|
||||
DlRepairTickets dlRepairTickets = baseMapper.selectById(id);
|
||||
DlRepairTicketsRespVO result = BeanUtil.toBean(dlRepairTickets, DlRepairTicketsRespVO.class);
|
||||
//查车辆
|
||||
if (ObjectUtil.isNotEmpty(dlRepairTickets.getCarId())){
|
||||
CarMainRespVO carInfo = carMainService.queryCarById(dlRepairTickets.getCarId());
|
||||
result.setCarInfo(carInfo);
|
||||
}
|
||||
|
||||
//查用户信息
|
||||
CustomerMain customerInfo = customerService.getCustomerById(dlRepairTickets.getUserId());
|
||||
result.setCustomerInfo(customerInfo);
|
||||
// 查工单子表
|
||||
List<DlRepairTitem> itemList = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().eq(DlRepairTitem::getTicketId, id));
|
||||
List<DlRepairTitemReqVO> items = itemList.stream().map(item -> BeanUtil.toBean(item, DlRepairTitemReqVO.class)).collect(Collectors.toList());
|
||||
@ -252,6 +277,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
List<RepairProject> repairProjects = projectService.listByIds(ids);
|
||||
items.forEach(item -> repairProjects.stream().filter(i -> i.getId().equals(item.getProjectId())).findFirst().ifPresent(item::setProject));
|
||||
}
|
||||
result.setProjects(projects);
|
||||
|
||||
// 取配件
|
||||
List<DlRepairTitemReqVO> wares = items.stream().filter(item -> item.getItemType().equals("02")).collect(Collectors.toList());
|
||||
@ -260,6 +286,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
List<RepairWares> repairWares = waresService.listByIds(ids);
|
||||
items.forEach(item -> repairWares.stream().filter(i -> i.getId().equals(item.getPartId())).findFirst().ifPresent(item::setWare));
|
||||
}
|
||||
result.setWares(wares);
|
||||
// 取附加
|
||||
List<DlRepairTitemReqVO> others = items.stream().filter(item -> item.getItemType().equals("03")).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(others)) {
|
||||
@ -268,6 +295,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
items.forEach(item -> dlRepairOthers.stream().filter(i -> i.getId().equals(item.getOtherId())).findFirst().ifPresent(item::setOther));
|
||||
}
|
||||
result.setItems(items);
|
||||
// 查询工单操作记录
|
||||
RepairRecordsPageReqVO entity = new RepairRecordsPageReqVO();
|
||||
entity.setTicketId(id);
|
||||
List<RepairRecordsRespVO> records = repairRecordsService.queryList(entity);
|
||||
result.setRecords(records);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -414,7 +446,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
return baseMapper.getPageType(repairTicketsReqVO, page);
|
||||
if(RepairCons.TICKETS_WAITING.equals(repairTicketsReqVO.getSelectType())){
|
||||
return baseMapper.getPageType(repairTicketsReqVO, page);
|
||||
}else{
|
||||
return baseMapper.getPageTypeAll(repairTicketsReqVO, page);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -473,14 +509,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
public void updateTake(String id){
|
||||
// 改变时看看是否已经被接了
|
||||
int update = baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||
.set(DlRepairTickets::getTicketsWorkStatus, "02")
|
||||
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.RECEIVED.getCode())
|
||||
.and(item -> {
|
||||
item.eq(DlRepairTickets::getId, id)
|
||||
.eq(DlRepairTickets::getTicketsWorkStatus, "01");
|
||||
.eq(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.WAITING_RECEIVING.getCode());
|
||||
}));
|
||||
if (update != 1){
|
||||
throw exception0(500, "工单已被其他人接单了");
|
||||
}
|
||||
//最后记录操作日志--接单
|
||||
repairRecordsService.saveRepairRecord(id,null, RecordTypeEnum.jd.getCode(), "接单",null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -491,19 +529,70 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
* @param reqVO 请求对象
|
||||
**/
|
||||
@Override
|
||||
public void updateRepair(DlRepairTicketsReqVO reqVO){
|
||||
// 指派的时候看下是不是已经有人接单了
|
||||
public void updateRepair(DlRepairTicketsReqVO reqVO) {
|
||||
// 指派的时候看下是不是已经有人接单了----vinjor-m 服务顾问指派,不需要判断是否已有人接单
|
||||
int update = baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||
.set(DlRepairTickets::getNowRepairId, reqVO.getNowRepairId())
|
||||
.set(DlRepairTickets::getNowRepairName, reqVO.getNowRepairName())
|
||||
.and(item -> {
|
||||
item.eq(DlRepairTickets::getId, reqVO.getId())
|
||||
.eq(DlRepairTickets::getTicketsWorkStatus, "01");
|
||||
})
|
||||
//工单状态设置为---施工中
|
||||
.set(DlRepairTickets::getTicketsStatus, TicketsStatusEnum.WORKING.getCode())
|
||||
//维修状态设置为待接单
|
||||
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.WAITING_RECEIVING.getCode())
|
||||
.and(item -> item.eq(DlRepairTickets::getId, reqVO.getId()))
|
||||
);
|
||||
if (update != 1){
|
||||
if (update != 1) {
|
||||
throw exception0(500, "工单已开始");
|
||||
}
|
||||
workerService.sentMessage(reqVO.getNowRepairId(),"您有新的工单要处理");
|
||||
//最后记录操作日志--指派施工
|
||||
repairRecordsService.saveRepairRecord(reqVO.getId(),null, RecordTypeEnum.ZPSG.getCode(),"指派施工",null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新工单状态
|
||||
*
|
||||
* @param respVO 请求对象
|
||||
* @author 小李
|
||||
* @date 15:46 2024/10/18
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void updateStatus(DlRepairTicketsRespVO respVO){
|
||||
if(StringUtils.isNotEmpty(respVO.getTicketsWorkStatus())){
|
||||
// 更新工单主表
|
||||
LambdaUpdateWrapper<DlRepairTickets> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(DlRepairTickets::getId, respVO.getId());
|
||||
wrapper.set(DlRepairTickets::getTicketsWorkStatus, respVO.getTicketsWorkStatus());
|
||||
if (ObjectUtil.isNotEmpty(respVO.getIsFinish())){
|
||||
wrapper.set(DlRepairTickets::getIsFinish, respVO.getIsFinish());
|
||||
}
|
||||
baseMapper.update(wrapper);
|
||||
}
|
||||
if(null!=respVO.getItem() && StringUtils.isNotEmpty(respVO.getItem().getItemStatus())){
|
||||
// 更新工单子表
|
||||
titemService.update(new LambdaUpdateWrapper<DlRepairTitem>()
|
||||
.set(DlRepairTitem::getItemStatus, respVO.getItem().getItemStatus())
|
||||
.eq(DlRepairTitem::getId, respVO.getItem().getId())
|
||||
);
|
||||
}
|
||||
// 记录日志
|
||||
recordsService.saveRepairRecord(respVO.getId(), respVO.getItem().getId(), respVO.getRecordType(), respVO.getRemark(), respVO.getImage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 配件客户是否可见
|
||||
*
|
||||
* @author 小李
|
||||
* @date 21:52 2024/10/18
|
||||
* @param id 工单ID
|
||||
* @param show 是否可见 1可见, 0不可见
|
||||
**/
|
||||
@Override
|
||||
public void updateShow(String id, String show){
|
||||
DlRepairTickets dlRepairTickets = new DlRepairTickets();
|
||||
dlRepairTickets.setId(id);
|
||||
dlRepairTickets.setPartShow(show);
|
||||
baseMapper.updateById(dlRepairTickets);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,14 @@ import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import cn.iocoder.yudao.module.tickets.mapper.DlRepairTitemMapper;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_titem(维修工单子表)】的数据库操作Service实现
|
||||
*
|
||||
@ -30,6 +33,21 @@ public class DlRepairTitemServiceImpl extends ServiceImpl<DlRepairTitemMapper, D
|
||||
public IPage<DlRepairTitemRespVO> getTItemPage(DlRepairTitemRespVO repairTitemRespVO, Page<DlRepairTitemRespVO> page){
|
||||
return baseMapper.getTItemPage(repairTitemRespVO, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前操作人操作的工单中的项目
|
||||
*
|
||||
* @param ticketId 工单ID
|
||||
* @author 小李
|
||||
* @date 15:01 2024/10/18
|
||||
**/
|
||||
@Override
|
||||
public List<DlRepairTitem> getProjectList(String ticketId){
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<DlRepairTitem>().and(item -> {
|
||||
item.eq(DlRepairTitem::getItemType, "01")
|
||||
.eq(DlRepairTitem::getTicketId, ticketId);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,8 +33,10 @@ 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.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
@ -44,10 +46,10 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
|
||||
*
|
||||
* @author 小李
|
||||
* @date 11:56 2024/10/15
|
||||
**/
|
||||
**/
|
||||
@Service
|
||||
public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, DlTicketWares>
|
||||
implements DlTicketWaresService {
|
||||
implements DlTicketWaresService {
|
||||
|
||||
|
||||
@Resource
|
||||
@ -76,29 +78,30 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
@Resource
|
||||
@Lazy
|
||||
private RepairWaresService repairWaresService;
|
||||
|
||||
@Resource
|
||||
private RepairWorkerService workerService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param reqVO 请求对象
|
||||
* @author 小李
|
||||
* @date 12:01 2024/10/15
|
||||
* @param reqVO 请求对象
|
||||
**/
|
||||
@Override
|
||||
public IPage<DlTicketWares> getPage(DlTicketWaresReqVO reqVO, Page<DlTicketWares> page){
|
||||
public IPage<DlTicketWares> getPage(DlTicketWaresReqVO reqVO, Page<DlTicketWares> page) {
|
||||
// 确认查看者身份
|
||||
String userRoleCode = repairTicketsService.getUserRole();
|
||||
if(userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())|| userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())){
|
||||
if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode()) || userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) {
|
||||
//维修管理员和总检,看所有数据
|
||||
}else if(userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())){
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
|
||||
//服务顾问
|
||||
reqVO.setAdviserId(SecurityFrameworkUtils.getLoginUserId());
|
||||
}else if(userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())){
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) {
|
||||
//维修工,进一步判断是否是班组长
|
||||
boolean ifLeader = workerService.getIfLeader();
|
||||
if(ifLeader){
|
||||
if (ifLeader) {
|
||||
//班组长,看本班组所有数据
|
||||
RepairWorker one = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()));
|
||||
// 查自己班组的员工信息
|
||||
@ -106,30 +109,55 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
// 所有的员工信息
|
||||
List<Long> userIds = list.stream().map(RepairWorker::getUserId).collect(Collectors.toList());
|
||||
reqVO.setUserIds(userIds);
|
||||
}else{
|
||||
} else {
|
||||
//普通维修工
|
||||
reqVO.setUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId()));
|
||||
}
|
||||
}else if(userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())){
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())) {
|
||||
// 维修仓库管理员
|
||||
reqVO.setStatus(null);
|
||||
reqVO.setUserRole(5);
|
||||
}else{
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return baseMapper.getPage(reqVO, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前工单下的配件申请单
|
||||
*
|
||||
* @param reqVO DlTicketWaresReqVO
|
||||
* @return java.util.List<cn.iocoder.yudao.module.tickets.entity.DlTicketWares>
|
||||
* @author PQZ
|
||||
* @date 13:44 2024/10/19
|
||||
**/
|
||||
@Override
|
||||
public List<DlTicketWares> listByTicket(DlTicketWaresReqVO reqVO) {
|
||||
// 确认查看者身份
|
||||
String userRoleCode = repairTicketsService.getUserRole();
|
||||
List<DlTicketWares> result = new ArrayList<>();
|
||||
//维修业务管理员、总检、服务顾问均可以进行审批
|
||||
if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())|| userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())||userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())){
|
||||
LambdaQueryWrapper<DlTicketWares> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(DlTicketWares::getTicketId,reqVO.getTicketId());
|
||||
if (null != reqVO.getStatus()){
|
||||
lambdaQueryWrapper.eq(DlTicketWares::getStatus,reqVO.getStatus());
|
||||
}
|
||||
result = list(lambdaQueryWrapper);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增、修改
|
||||
*
|
||||
* @param respVO 请求对象
|
||||
* @author 小李
|
||||
* @date 12:14 2024/10/15
|
||||
* @param respVO 请求对象
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void updateTicketWares(DlTicketWaresRespVO respVO){
|
||||
public void updateTicketWares(DlTicketWaresRespVO respVO) {
|
||||
// 新增、修改主表
|
||||
// 查询操作人的工人信息
|
||||
RepairWorker one = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()));
|
||||
@ -138,7 +166,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
baseMapper.insertOrUpdate(respVO);
|
||||
// 新增、修改子表
|
||||
List<DlTwItem> list = respVO.getItems().stream().map(item -> item.setTwId(respVO.getId())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(list)){
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
throw exception0(500, "配件列表为空");
|
||||
}
|
||||
twItemService.saveOrUpdateBatch(list);
|
||||
@ -147,13 +175,13 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id id
|
||||
* @author 小李
|
||||
* @date 12:21 2024/10/15
|
||||
* @param id id
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void removeTicketWares(String id){
|
||||
public void removeTicketWares(String id) {
|
||||
// 删除主表
|
||||
baseMapper.deleteById(id);
|
||||
// 删除子表
|
||||
@ -163,20 +191,20 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
/**
|
||||
* 审核
|
||||
*
|
||||
* @param respVO 请求对象
|
||||
* @author 小李
|
||||
* @date 21:15 2024/10/15
|
||||
* @param respVO 请求对象
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void auditTicketWares(DlTicketWaresRespVO respVO){
|
||||
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") && respVO.getType().equals("01")){
|
||||
if (ObjectUtil.isNotEmpty(respVO.getStatus()) && respVO.getStatus().equals("02") && respVO.getType().equals("01")) {
|
||||
// 更新维修工单
|
||||
// 计算配件的总价
|
||||
BigDecimal reduce = respVO.getWares().stream().map(DlRepairTitem::getItemMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
@ -205,7 +233,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
item.setItemStatus("08");
|
||||
});
|
||||
repairTitemService.saveBatch(respVO.getWares());
|
||||
}else if (ObjectUtil.isNotEmpty(respVO.getStatus()) && respVO.getStatus().equals("02") && respVO.getType().equals("02")){
|
||||
} else if (ObjectUtil.isNotEmpty(respVO.getStatus()) && respVO.getStatus().equals("02") && respVO.getType().equals("02")) {
|
||||
// 如果通过退料,也需要更新
|
||||
// 更新维修工单
|
||||
// 计算配件的总价
|
||||
@ -234,7 +262,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
list.forEach(item -> {
|
||||
respVO.getWares().stream().filter(i -> i.getPartId().equals(item.getPartId())).findFirst().ifPresent(i -> {
|
||||
// 如果只是退部分就减少数量
|
||||
if (!i.getItemCount().equals(item.getItemCount())){
|
||||
if (!i.getItemCount().equals(item.getItemCount())) {
|
||||
repairTitemService.update(new LambdaUpdateWrapper<DlRepairTitem>()
|
||||
.setSql("item_count = item_count - " + i.getItemCount())
|
||||
.setSql("item_money = item_money - " + i.getItemMoney())
|
||||
@ -242,7 +270,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
x.eq(DlRepairTitem::getTicketId, respVO.getTicketId()).eq(DlRepairTitem::getPartId, item.getPartId());
|
||||
})
|
||||
);
|
||||
}else {
|
||||
} else {
|
||||
// 如果是全部退了,就直接删掉数据
|
||||
repairTitemService.removeById(item.getId());
|
||||
}
|
||||
@ -254,47 +282,88 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
/**
|
||||
* 仓库通知领料
|
||||
*
|
||||
* @param respVO 请求对象
|
||||
* @author 小李
|
||||
* @date 20:45 2024/10/16
|
||||
* @param respVO 请求对象
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void passTicketWares(DlTicketWaresRespVO respVO){
|
||||
public void passTicketWares(DlTicketWaresRespVO respVO) {
|
||||
// 查工单子表中的配件信息
|
||||
List<DlRepairTitem> list = repairTitemService.list(new LambdaQueryWrapper<DlRepairTitem>()
|
||||
.eq(DlRepairTitem::getTicketId, respVO.getTicketId())
|
||||
.in(DlRepairTitem::getPartId, respVO.getRepairSois()
|
||||
.stream()
|
||||
.map(DlRepairSoi::getGoodsId)
|
||||
.collect(Collectors.toList())));
|
||||
// 计算总价
|
||||
BigDecimal reduce = list.stream().map(DlRepairTitem::getItemMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
respVO.getRepairSo().setItemCount(list.size());
|
||||
respVO.getRepairSo().setTotalPrice(reduce);
|
||||
List<DlRepairTitem> list = repairTitemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(i -> {
|
||||
i.eq(DlRepairTitem::getTicketId, respVO.getTicketId())
|
||||
.in(DlRepairTitem::getPartId, respVO.getRepairSois()
|
||||
.stream()
|
||||
.map(DlRepairSoi::getGoodsId)
|
||||
.collect(Collectors.toList()));
|
||||
})
|
||||
);
|
||||
// 计算总价 (通知领料的数量可能和请求的不一样,所以需要这样计算)
|
||||
BigDecimal reduce = list.stream()
|
||||
/*
|
||||
item:维修工单子表中的每一个配件
|
||||
map中是找到与item对应的领料单子表的配件,记soi
|
||||
将item的价格设置给soi的价格
|
||||
*/
|
||||
.map(item -> {
|
||||
DlRepairSoi repairSoi = respVO.getRepairSois().stream()
|
||||
.filter(i -> i.getGoodsId().equals(item.getPartId())).findFirst()
|
||||
.orElse(null);
|
||||
if (repairSoi != null) {
|
||||
repairSoi.setGoodsPrice(item.getItemPrice());
|
||||
}
|
||||
return repairSoi;
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
// 计算soi的价格
|
||||
.map(i -> new BigDecimal(i.getGoodsCount()).multiply(i.getGoodsPrice()))
|
||||
// 计算总价
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// 生成领料单
|
||||
respVO.getRepairSo().setTotalPrice(reduce);
|
||||
respVO.getRepairSo().setItemCount(list.size());
|
||||
repairSoService.save(respVO.getRepairSo());
|
||||
// 生成领料单子表
|
||||
respVO.getRepairSois().forEach(item -> {
|
||||
item.setSoId(respVO.getRepairSo().getId());
|
||||
DlRepairTitem titem = list.stream().filter(i -> i.getPartId().equals(item.getGoodsId())).collect(Collectors.toList()).get(0);
|
||||
item.setGoodsPrice(titem.getItemPrice());
|
||||
});
|
||||
repairSoiService.saveBatch(respVO.getRepairSois());
|
||||
// 更新领料申请子表
|
||||
twItemService.updateBatchById(respVO.getItems());
|
||||
// 更新配件申请子表
|
||||
/*
|
||||
同理,通知领料的数量可能与实际需要的数量不一致,需要重新计算状态
|
||||
*/
|
||||
// 先查老数据
|
||||
List<DlTwItem> oldData = twItemService.list(new LambdaQueryWrapper<DlTwItem>().in(DlTwItem::getId, respVO.getItems().stream().map(DlTwItem::getId).collect(Collectors.toList())));
|
||||
// 构造新数据
|
||||
List<DlTwItem> newData = oldData.stream().map(item -> {
|
||||
DlTwItem dlTwItem = new DlTwItem();
|
||||
dlTwItem.setId(item.getId());
|
||||
respVO.getRepairSois().stream()
|
||||
.filter(i -> i.getGoodsId().equals(item.getWaresId()))
|
||||
.findFirst()
|
||||
.ifPresent(repairSoi -> {
|
||||
dlTwItem.setWaresCouldCount(repairSoi.getGoodsCount());
|
||||
dlTwItem.setWaresStatus(repairSoi.getGoodsCount().equals(item.getWaresCount()) ? "04" : item.getWaresStatus());
|
||||
});
|
||||
return dlTwItem;
|
||||
}).collect(Collectors.toList());
|
||||
twItemService.updateBatchById(newData);
|
||||
|
||||
// 通知维修工
|
||||
// 查维修工的userId
|
||||
repairWorkerService.sentMessage(respVO.getRepairId(), "您有新的领料单需要确认");
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工确认领料
|
||||
*
|
||||
* @param respVO 请求对象
|
||||
* @author 小李
|
||||
* @date 22:07 2024/10/16
|
||||
* @param respVO 请求对象
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void repairPassTicketWares(DlTicketWaresRespVO respVO){
|
||||
public void repairPassTicketWares(DlTicketWaresRespVO respVO) {
|
||||
// 更新领料申请子表
|
||||
twItemService.updateBatchById(respVO.getItems());
|
||||
// 更新领料申请表
|
||||
@ -315,12 +384,12 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
/**
|
||||
* 仓库确认退料
|
||||
*
|
||||
* @param respVO 请求对象
|
||||
* @author 小李
|
||||
* @date 22:03 2024/10/17
|
||||
* @param respVO 请求对象
|
||||
**/
|
||||
@Override
|
||||
public void passBackTicketWares(DlTicketWaresRespVO respVO){
|
||||
public void passBackTicketWares(DlTicketWaresRespVO respVO) {
|
||||
// 更新申请单子表状态
|
||||
twItemService.updateBatchById(respVO.getItems());
|
||||
}
|
||||
|
@ -6,11 +6,13 @@ import cn.iocoder.yudao.module.project.entity.RepairWares;
|
||||
import cn.iocoder.yudao.module.project.service.RepairWaresService;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlTwItem;
|
||||
import cn.iocoder.yudao.module.tickets.mapper.DlTwItemMapper;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlTicketWaresService;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlTwItemService;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlTwItemReqVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -30,6 +32,10 @@ public class DlTwItemServiceImpl extends ServiceImpl<DlTwItemMapper, DlTwItem>
|
||||
@Resource
|
||||
private RepairWaresService repairWaresService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private DlTicketWaresService ticketWaresService;
|
||||
|
||||
/**
|
||||
* 根据主表查看全部
|
||||
*
|
||||
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.tickets.utils;
|
||||
|
||||
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 工单操作常用util
|
||||
* @author vinjor-M
|
||||
* @date 16:15 2024/10/18
|
||||
**/
|
||||
@Component
|
||||
public class TicketsOperateUtil {
|
||||
@Autowired
|
||||
private RepairRecordsService repairRecordsService;
|
||||
|
||||
|
||||
}
|
@ -25,4 +25,6 @@ public class DlRepairTicketsReqVO extends DlRepairTickets {
|
||||
|
||||
/** 工单中项目指定的施工人员的ids */
|
||||
private List<Long> userIds;
|
||||
/** 查询类型(waiting 待处理的 | all 所有数据) */
|
||||
private String selectType;
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package cn.iocoder.yudao.module.tickets.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
|
||||
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import lombok.Data;
|
||||
@ -19,10 +22,30 @@ public class DlRepairTicketsRespVO extends DlRepairTickets {
|
||||
private List<DlRepairTitem> itemList;
|
||||
/** 关联的预约单信息 */
|
||||
private DlRepairBooking booking;
|
||||
/** 操作记录*/
|
||||
private List<RepairRecordsRespVO> records;
|
||||
|
||||
/** 上面有地方在用,只能新用一个了,子表数组 */
|
||||
private List<DlRepairTitemReqVO> items;
|
||||
|
||||
/** 预约记录ID */
|
||||
private String bookingId;
|
||||
|
||||
/** 图片路径 */
|
||||
private String image;
|
||||
|
||||
/** 子表单条数据 */
|
||||
private DlRepairTitem item;
|
||||
|
||||
/** 记录类型 */
|
||||
private String recordType;
|
||||
|
||||
|
||||
/** 客户信息 */
|
||||
private CustomerMain customerInfo;
|
||||
/** 车辆信息 */
|
||||
private CarMainRespVO carInfo;
|
||||
List<DlRepairTitemReqVO> wares;
|
||||
List<DlRepairTitemReqVO> projects;
|
||||
|
||||
}
|
||||
|
@ -29,5 +29,21 @@
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
<select id="selectNowRepairByTicketId" resultType="java.util.Map">
|
||||
SELECT
|
||||
drr.repair_item_id,
|
||||
drt.item_name
|
||||
FROM
|
||||
dl_repair_records drr
|
||||
LEFT JOIN dl_repair_titem drt ON drr.repair_item_id = drt.id
|
||||
WHERE
|
||||
drr.ticket_id = #{ticketId}
|
||||
AND drr.repair_item_id IS NOT NULL
|
||||
AND drr.type = 'kssg'
|
||||
AND drr.deleted = '0'
|
||||
ORDER BY
|
||||
drr.create_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -33,4 +33,16 @@
|
||||
ORDER BY
|
||||
drp.create_time DESC
|
||||
</select>
|
||||
<select id="selectProjectAndCateGory" resultType="cn.iocoder.yudao.module.project.vo.RepairProjectAppvo">
|
||||
SELECT
|
||||
drp.*,
|
||||
dbt.id AS typeId,
|
||||
dbt.name AS typeName
|
||||
FROM
|
||||
dl_repair_project drp
|
||||
LEFT JOIN dl_base_type dbt ON drp.type = dbt.id
|
||||
AND dbt.deleted = 0 AND dbt.type = "03"
|
||||
WHERE
|
||||
drp.deleted = 0
|
||||
</select>
|
||||
</mapper>
|
@ -45,28 +45,53 @@
|
||||
<result property="isFinish" column="is_finish" />
|
||||
<result property="nowRepairId" column="now_repair_id" />
|
||||
<result property="nowRepairName" column="now_repair_name" />
|
||||
<result property="partShow" column="part_show" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="APPBaseResultMap" type="cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="ticketNo" column="ticket_no" jdbcType="VARCHAR"/>
|
||||
<result property="repairType" column="repair_type" jdbcType="VARCHAR"/>
|
||||
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
|
||||
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
|
||||
<result property="userMobile" column="user_mobile" jdbcType="VARCHAR"/>
|
||||
<result property="carId" column="car_id" jdbcType="VARCHAR"/>
|
||||
<result property="carNo" column="car_no" jdbcType="VARCHAR"/>
|
||||
<result property="carVin" column="car_vin" jdbcType="VARCHAR"/>
|
||||
<result property="carBrandId" column="car_brand_id" jdbcType="VARCHAR"/>
|
||||
<result property="carBrandName" column="car_brand_name" jdbcType="VARCHAR"/>
|
||||
<result property="carBrandType" column="car_brand_type" jdbcType="VARCHAR"/>
|
||||
<result property="adviserId" column="adviser_id" jdbcType="VARCHAR"/>
|
||||
<result property="adviserName" column="adviser_name" jdbcType="VARCHAR"/>
|
||||
<result property="payType" column="pay_type" jdbcType="VARCHAR"/>
|
||||
<result property="repairAdvice" column="repair_advice" jdbcType="VARCHAR"/>
|
||||
<result property="qualityMileage" column="quality_mileage" jdbcType="VARCHAR"/>
|
||||
<result property="qualityDay" column="quality_day" jdbcType="VARCHAR"/>
|
||||
<result property="endCheck" column="end_check" jdbcType="VARCHAR"/>
|
||||
<result property="partDisposal" column="part_disposal" jdbcType="VARCHAR"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="ticketType" column="ticket_type" jdbcType="VARCHAR"/>
|
||||
<result property="corpId" column="corp_id" jdbcType="VARCHAR"/>
|
||||
<result property="deptId" column="dept_id" jdbcType="BIGINT"/>
|
||||
<result property="count" column="count"/>
|
||||
<result property="projectPrice" column="project_price"/>
|
||||
<result property="partPrice" column="part_price"/>
|
||||
<result property="otherPrice" column="other_price"/>
|
||||
<result property="totalPrice" column="total_price"/>
|
||||
<result property="ticketsStatus" column="tickets_status"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="inTime" column="in_time" />
|
||||
<result property="outTime" column="out_time" />
|
||||
<result property="cost" column="cost" />
|
||||
<result property="profit" column="profit" />
|
||||
<result property="partStatus" column="part_status" />
|
||||
<result property="ticketsWorkStatus" column="tickets_work_status" />
|
||||
<result property="isFinish" column="is_finish" />
|
||||
<result property="nowRepairId" column="now_repair_id" />
|
||||
<result property="nowRepairName" column="now_repair_name" />
|
||||
<result property="partShow" column="part_show" />
|
||||
<association property="booking" javaType="cn.iocoder.yudao.module.booking.entity.DlRepairBooking" select="selectBookingById" column="id"/>
|
||||
<collection property="itemList" column="id" ofType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem" columnPrefix="item_">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="ticketId" column="ticket_id" />
|
||||
<result property="itemName" column="item_name" />
|
||||
<result property="itemCount" column="item_count" />
|
||||
<result property="itemUnit" column="item_unit" />
|
||||
<result property="itemPrice" column="item_price" />
|
||||
<result property="itemDiscount" column="item_discount" />
|
||||
<result property="itemMoney" column="item_money" />
|
||||
<result property="repairIds" column="repair_ids" />
|
||||
<result property="repairNames" column="repair_names" />
|
||||
<result property="saleId" column="sale_id" />
|
||||
<result property="saleName" column="sale_name" />
|
||||
<result property="itemType" column="item_type" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="partId" column="part_id" />
|
||||
<result property="otherId" column="other_id" />
|
||||
<result property="itemTypeId" column="item_type_id" />
|
||||
<result property="itemStatus" column="item_status" />
|
||||
<result property="remark" column="remark" />
|
||||
</collection>
|
||||
<collection property="itemList" column="id" ofType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem" select="selectItemList" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_SQL">
|
||||
@ -109,7 +134,8 @@
|
||||
tickets_work_status,
|
||||
is_finish,
|
||||
now_repair_id,
|
||||
now_repair_name
|
||||
now_repair_name,
|
||||
part_show
|
||||
from dl_repair_tickets drt
|
||||
where drt.deleted = '0'
|
||||
</sql>
|
||||
@ -155,30 +181,9 @@
|
||||
order by drt.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getPageType" resultMap="BaseResultMap">
|
||||
select drt.*,
|
||||
drti.id AS item_id,
|
||||
drti.ticket_id AS item_ticket_id,
|
||||
drti.item_name AS item_item_name,
|
||||
drti.item_count AS item_item_count,
|
||||
drti.item_unit AS item_item_unit,
|
||||
drti.item_price AS item_item_price,
|
||||
drti.item_discount AS item_item_discount,
|
||||
drti.item_money AS item_item_money,
|
||||
drti.repair_ids AS item_repair_ids,
|
||||
drti.repair_names AS item_repair_names,
|
||||
drti.sale_id AS item_sale_id,
|
||||
drti.sale_name AS item_sale_name,
|
||||
drti.item_type AS item_item_type,
|
||||
drti.project_id AS item_project_id,
|
||||
drti.part_id AS item_part_id,
|
||||
drti.other_id AS item_other_id,
|
||||
drti.item_type_id AS item_type_id,
|
||||
drti.item_status AS item_item_status,
|
||||
drti.remark AS item_remark
|
||||
<select id="getPageType" resultMap="APPBaseResultMap">
|
||||
select drt.*
|
||||
from dl_repair_tickets drt
|
||||
left join dl_repair_titem drti
|
||||
on drt.id = drti.ticket_id AND drti.deleted = '0'
|
||||
where drt.deleted = '0'
|
||||
<if test="map.ticketNo != null and map.ticketNo != ''">
|
||||
and (
|
||||
@ -202,20 +207,85 @@
|
||||
<if test="map.isFinish != null and map.isFinish != ''">
|
||||
and drt.is_finish = #{map.isFinish}
|
||||
</if>
|
||||
<if test="map.userIds != null and map.userIds.size > 0">
|
||||
and (
|
||||
<foreach item="item" collection="map.userIds" index="index" open="" separator="or" close="">
|
||||
find_in_set(#{item}, drti.repair_ids) > 0
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="map.isFinish != null and map.isFinish != '' and map.isFinish == 0 and map.userIds != null and map.userIds.size > 0">
|
||||
and (drt.now_repair_id in
|
||||
<foreach collection="map.userIds" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
<if test="map.userIds != null and map.userIds.size > 0 ">
|
||||
and (drt.tickets_status = '05')
|
||||
<choose>
|
||||
<when test="map.isFinish == '0'">
|
||||
and (drt.now_repair_id in
|
||||
<foreach collection="map.userIds" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</when>
|
||||
<when test="map.isFinish == '1'">
|
||||
and (
|
||||
<foreach item="item" collection="map.userIds" index="index" open="" separator="or" close="">
|
||||
find_in_set(#{item}, drti.repair_ids) > 0
|
||||
</foreach>
|
||||
)
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
order by drt.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectItemList" resultType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem">
|
||||
select drti.id ,
|
||||
drti.ticket_id ,
|
||||
drti.item_name ,
|
||||
drti.item_count ,
|
||||
drti.item_unit ,
|
||||
drti.item_price ,
|
||||
drti.item_discount ,
|
||||
drti.item_money ,
|
||||
drti.repair_ids ,
|
||||
drti.repair_names ,
|
||||
drti.sale_id ,
|
||||
drti.sale_name ,
|
||||
drti.item_type ,
|
||||
drti.project_id ,
|
||||
drti.part_id ,
|
||||
drti.other_id ,
|
||||
drti.item_type_id ,
|
||||
drti.item_status ,
|
||||
drti.remark
|
||||
from dl_repair_titem drti
|
||||
where drti.ticket_id = #{id} AND drti.deleted = '0'
|
||||
</select>
|
||||
|
||||
<select id="getPageTypeAll" resultMap="APPBaseResultMap">
|
||||
select drt.*
|
||||
from dl_repair_tickets drt
|
||||
left join dl_repair_titem drti
|
||||
on drt.id = drti.ticket_id AND drti.deleted = '0'
|
||||
where drt.deleted = '0'
|
||||
<if test="map.ticketNo != null and map.ticketNo != ''">
|
||||
and (
|
||||
drt.ticket_no like concat('%', #{map.ticketNo}, '%')
|
||||
or
|
||||
drt.car_no like concat('%', #{map.ticketNo}, '%')
|
||||
or
|
||||
drt.user_name like concat('%', #{map.ticketNo}, '%')
|
||||
or
|
||||
drt.user_mobile like concat('%', #{map.ticketNo}, '%')
|
||||
or
|
||||
drt.remark like concat('%', #{map.ticketNo}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
|
||||
and drt.create_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]}
|
||||
</if>
|
||||
<if test="map.adviserId != null and map.adviserId != ''">
|
||||
and drt.adviser_id = #{map.adviserId}
|
||||
</if>
|
||||
<if test="map.userIds != null and map.userIds.size > 0">
|
||||
and (
|
||||
<foreach item="item" collection="map.userIds" index="index" open="" separator="or" close="">
|
||||
find_in_set(#{item}, drt.now_repair_id) > 0
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
GROUP BY drt.id
|
||||
order by drt.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -13,13 +13,15 @@
|
||||
<result property="waresStatus" column="wares_status" jdbcType="VARCHAR"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="isShow" column="is_show" />
|
||||
<result property="waresCouldCount" column="wares_could_count" />
|
||||
<result property="waresAlreadyCount" column="wares_already_count" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_SQL">
|
||||
select
|
||||
id,tw_id,wares_id,
|
||||
wares_name,wares_count,wares_status,remark,
|
||||
is_show
|
||||
is_show,wares_could_count, wares_already_count
|
||||
from dl_tw_item dti
|
||||
where dti.deleted = '0'
|
||||
</sql>
|
||||
|
Loading…
Reference in New Issue
Block a user