Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
01f5aa9017 | ||
|
f61004114d | ||
|
28ebcfc6dc | ||
|
0147ee5b7c | ||
|
c4da06e591 | ||
|
6c396bfbbd | ||
|
bc79d9df53 | ||
|
32f55301df | ||
|
eaf06a2d77 | ||
|
fecc6bb4da | ||
|
1b6a1dab5b | ||
|
1151c2dbe5 | ||
|
4920ad7b25 |
@ -2,38 +2,32 @@ package cn.iocoder.yudao.module.company.controller.admin;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.common.CommonErrorCodeConstants;
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import cn.iocoder.yudao.module.company.entity.Company;
|
||||
import cn.iocoder.yudao.module.company.service.CompanyService;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyReqVO;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyRespVO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyReqVO;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import cn.iocoder.yudao.module.company.service.CompanyService;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
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.servlet.http.HttpServletResponse;
|
||||
@ -43,6 +37,10 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 企业信息表(每个租户的下属企业信息);(dl_company)表控制层
|
||||
*
|
||||
@ -198,4 +196,23 @@ public class CompanyController {
|
||||
}
|
||||
return success(companyService.getById(dept.getCorpId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查某租户下某个业务系统的企业信息
|
||||
* @author vinjor-M
|
||||
* @date 15:08 2024/11/15
|
||||
* @param tenantId 租户ID
|
||||
* @param systemCode 系统标识
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@GetMapping("/getCompanyByTenantId")
|
||||
@Operation(summary = "查某租户下某个业务系统的企业信息")
|
||||
public CommonResult<?> getCompanyByTenantId(String tenantId,String systemCode){
|
||||
LambdaQueryWrapper<Company> queryWrapper = new LambdaQueryWrapper<Company>()
|
||||
.eq(TenantBaseDO::getTenantId,tenantId)
|
||||
.like(Company::getServiceCodes,systemCode)
|
||||
.orderByDesc(BaseDO::getCreateTime);
|
||||
List<Company> list = this.companyService.list(queryWrapper);
|
||||
return success(list.isEmpty()?null:list.get(0));
|
||||
}
|
||||
}
|
@ -30,6 +30,9 @@ public class Company extends TenantBaseDO {
|
||||
/** 企业名称 */
|
||||
@ExcelProperty("企业名称")
|
||||
private String corpName ;
|
||||
/** 企业简称 */
|
||||
@ExcelProperty("企业简称")
|
||||
private String simpleName ;
|
||||
/** 统一社会信用代码 */
|
||||
@ExcelProperty("统一社会信用代码")
|
||||
private String orgCard ;
|
||||
|
@ -76,6 +76,9 @@ public enum RecordTypeEnum {
|
||||
/** 删除工单 */
|
||||
SCGG("scgg", "删除工单"),
|
||||
|
||||
/** 删除工单 */
|
||||
JC("jc", "交车"),
|
||||
|
||||
/** 内返派工 */
|
||||
NFPG("nfpg", "内返派工");
|
||||
|
||||
|
@ -27,6 +27,10 @@ public enum TicketsStatusEnum {
|
||||
* 待通知客户取车
|
||||
*/
|
||||
WAITING_NOTICE("07","待通知客户取车"),
|
||||
/**
|
||||
* 已交车
|
||||
*/
|
||||
OVER("08","已交车"),
|
||||
/**
|
||||
* 挂单/记账
|
||||
*/
|
||||
|
@ -123,6 +123,12 @@ public class RepairWorkerController {
|
||||
return success(workerService.listByLeads());
|
||||
}
|
||||
|
||||
@GetMapping("/listLeadsAll")
|
||||
@Operation(summary = "通过班组长的id查该班组的员工(不去掉班组长)")
|
||||
public CommonResult<?> listLeadsAll() {
|
||||
return success(workerService.listLeadsAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查当前登录用户是否维修班组长
|
||||
* @author vinjor-M
|
||||
|
@ -106,6 +106,14 @@ public interface RepairWorkerService extends IService<RepairWorker> {
|
||||
**/
|
||||
List<RepairWorker> listByLeads();
|
||||
|
||||
/**
|
||||
* 通过班组长的id查该班组的员工(不去掉班组长)
|
||||
* @author PQZ
|
||||
* @date 15:20 2024/11/13
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.entity.RepairWorker>
|
||||
**/
|
||||
List<RepairWorker> listLeadsAll();
|
||||
|
||||
/**
|
||||
* 查当前登录用户是否维修班组长
|
||||
* @author vinjor-M
|
||||
|
@ -272,6 +272,21 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
return workerList.stream().filter(item -> !Objects.equals(item.getUserId(), worker.getUserId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过班组长的id查该班组的员工()不去掉班组长
|
||||
*
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.entity.RepairWorker>
|
||||
* @author PQZ
|
||||
* @date 15:20 2024/11/13
|
||||
**/
|
||||
@Override
|
||||
public List<RepairWorker> listLeadsAll() {
|
||||
// 取班组长的记录
|
||||
RepairWorker worker = baseMapper.selectOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()));
|
||||
// 根据班组长的工种查所有该工程的工人
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getWorkType, worker.getWorkType()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查当前登录用户是否维修班组长
|
||||
*
|
||||
|
@ -242,7 +242,8 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
sois.stream().filter(i -> i.getGoodsId().equals(item.getWaresId())).findFirst().ifPresent(repairSoiByTwItem -> {
|
||||
if (so.getSoType().equals("02")){
|
||||
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoiByTwItem.getGoodsCount());
|
||||
dlTwItem.setWaresStatus("02");
|
||||
// 不操作配件申请表子表的状态
|
||||
// dlTwItem.setWaresStatus("02");
|
||||
}else {
|
||||
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() + repairSoiByTwItem.getGoodsCount());
|
||||
}
|
||||
@ -325,13 +326,13 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
// 查最新的子表信息
|
||||
DlRepairSo so = baseMapper.selectById(id);
|
||||
List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, so.getTwId()));
|
||||
// 判断是部分完成还是全部完成
|
||||
DlTicketWares dlTicketWares = new DlTicketWares();
|
||||
dlTicketWares.setId(so.getTwId());
|
||||
List<DlTwItem> flag = list.stream().filter(item -> !item.getWaresStatus().equals("01")).collect(Collectors.toList());
|
||||
dlTicketWares.setStatus(CollectionUtil.isEmpty(flag) ? "03" : "04");
|
||||
// 判断是部分完成还是全部完成----不需要判断了
|
||||
// DlTicketWares dlTicketWares = new DlTicketWares();
|
||||
// dlTicketWares.setId(so.getTwId());
|
||||
// List<DlTwItem> flag = list.stream().filter(item -> !item.getWaresStatus().equals("01")).collect(Collectors.toList());
|
||||
// dlTicketWares.setStatus(CollectionUtil.isEmpty(flag) ? "03" : "04");
|
||||
// 更新主表的状态
|
||||
ticketWaresService.updateById(dlTicketWares);
|
||||
// ticketWaresService.updateById(dlTicketWares);
|
||||
|
||||
// 通知仓库
|
||||
repairWorkerService.sentMessage(Long.valueOf(so.getCreator()), so.getUserName() + "已确认领料单:" + so.getSoNo());
|
||||
@ -447,8 +448,8 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
//入库数量
|
||||
inWares.setInCount(filterSoi.getInCount());
|
||||
inWares.setId(null);
|
||||
//采购品中入库数量字段累加
|
||||
item.setInCount(item.getInCount() == null ? 0 : item.getInCount() + filterSoi.getInCount());
|
||||
//采购品中入库数量字段累加---这里item.getInCount 是null的时候,应该是filterSoi的inCount而不是0
|
||||
item.setInCount(item.getInCount() == null ? filterSoi.getInCount() : item.getInCount() + filterSoi.getInCount());
|
||||
inWaresList.add(inWares);
|
||||
});
|
||||
//更新采购品
|
||||
|
@ -297,6 +297,19 @@ public class DlRepairTicketsController {
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务顾问交车
|
||||
* @author vinjor-M
|
||||
* @date 16:51 2024/11/13
|
||||
* @param respVO
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@PostMapping("/overOrder")
|
||||
@Operation(summary = "服务顾问交车")
|
||||
public CommonResult<?> overOrder(@RequestBody DlRepairTicketsRespVO respVO) {
|
||||
dlRepairTicketsService.overOrder(respVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
/**
|
||||
* 从总检的角度差维修中、已完成的工单数量
|
||||
* @author vinjor-M
|
||||
|
@ -168,5 +168,18 @@ public class DlTicketWaresController {
|
||||
public CommonResult<?> getWorkerTodo(){
|
||||
return success(dlTicketWaresService.getWorkerTodo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查单个配件申请单的信息
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:55 2024/11/14
|
||||
* @param id id
|
||||
**/
|
||||
@GetMapping("/getById")
|
||||
@Operation(summary = "查单个配件申请单的信息")
|
||||
public CommonResult<?> getById(@RequestParam("id") String id){
|
||||
return success(dlTicketWaresService.getById(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,12 +3,10 @@ package cn.iocoder.yudao.module.tickets.controller.admin;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlTwItem;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlTwItemService;
|
||||
import cn.iocoder.yudao.module.tickets.vo.AddTwiVO;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@ -41,5 +39,19 @@ public class DlTwItemController {
|
||||
public CommonResult<?> listTwItem(DlTwItemReqVO reqVO){
|
||||
return success(dlTwItemService.listTwItem(reqVO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 给配件申请表子表添加数据
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:47 2024/11/13
|
||||
* @param addTwiVO 对象
|
||||
**/
|
||||
@PostMapping("/addTwi")
|
||||
@Operation(summary = "给配件申请表子表添加数据")
|
||||
public CommonResult<?> addTwi(@RequestBody AddTwiVO addTwiVO){
|
||||
dlTwItemService.addTwi(addTwiVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,4 +65,7 @@ public class DlTicketWares extends TenantBaseDO {
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 多个图片地址,英文逗号分隔(拍照上传配件申请单时用) */
|
||||
private String images;
|
||||
}
|
@ -235,4 +235,12 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
* @param id 工单ID
|
||||
**/
|
||||
void removeTicketById(String id);
|
||||
|
||||
/**
|
||||
* 服务顾问交车
|
||||
* @author vinjor-M
|
||||
* @date 16:51 2024/11/13
|
||||
* @param respVO
|
||||
**/
|
||||
void overOrder(DlRepairTicketsRespVO respVO);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.tickets.service;
|
||||
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlTwItem;
|
||||
import cn.iocoder.yudao.module.tickets.vo.AddTwiVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlTwItemReqVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@ -23,4 +24,13 @@ public interface DlTwItemService extends IService<DlTwItem> {
|
||||
* @param reqVO 请求对象
|
||||
**/
|
||||
List<DlTwItemRespVO> listTwItem(DlTwItemReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 给配件申请表子表添加数据
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:47 2024/11/13
|
||||
* @param addTwiVO 对象
|
||||
**/
|
||||
void addTwi(AddTwiVO addTwiVO);
|
||||
}
|
||||
|
@ -5,8 +5,10 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.*;
|
||||
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
|
||||
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.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
||||
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||
@ -850,6 +852,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
String userRoleCode = getUserRole();
|
||||
if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())) {
|
||||
//维修管理员看所有数据
|
||||
}else if (userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())) {
|
||||
//仓管看到所有数据
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) {
|
||||
//总检
|
||||
if (RepairCons.TICKETS_WAITING.equals(repairTicketsReqVO.getSelectType())) {
|
||||
@ -876,7 +880,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
if ("".equals(userIdsStr)) {
|
||||
userIdsStr = String.valueOf(worker.getUserId());
|
||||
} else {
|
||||
userIdsStr = "," + worker.getUserId();
|
||||
userIdsStr = userIdsStr + "," + worker.getUserId();
|
||||
}
|
||||
}
|
||||
repairTicketsReqVO.setUserIds(userIds);
|
||||
@ -999,11 +1003,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
}
|
||||
repairWorkerService.sentMessage(reqVO.getNowRepairId(), "您有新的工单要处理");
|
||||
|
||||
// 获取当前操作人的身份----小李新加的逻辑
|
||||
String userRole = getUserRole();
|
||||
if (userRole.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) {
|
||||
//指派施工,施工项目中不包含选中人员处理
|
||||
setTicketItem(reqVO.getId(),reqVO.getNowRepairId(),reqVO.getNowRepairName());
|
||||
}
|
||||
//最后记录操作日志--指派施工--pull下来的逻辑
|
||||
String code = RecordTypeEnum.ZPSG.getCode();
|
||||
String remark ="指派施工";
|
||||
// 获取当前操作人的身份----小李新加的逻辑
|
||||
String userRole = getUserRole();
|
||||
|
||||
// 总检
|
||||
if (userRole.equals(RepairRoleEnum.INSPECTION.getCode())){
|
||||
repairRecordsService.saveRepairRecord(reqVO.getId(), null, RecordTypeEnum.NFPG.getCode(), reqVO.getRemark(), reqVO.getImage());
|
||||
@ -1014,6 +1023,54 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 指派施工,施工项目中不包含选中人员处理
|
||||
* @author PQZ
|
||||
* @date 16:30 2024/11/13
|
||||
* @param ticketId 工单id
|
||||
* @param nowRepairId 当前处理人id
|
||||
* @param nowRepairName 当前处理人名称
|
||||
**/
|
||||
private void setTicketItem(String ticketId,Long nowRepairId,String nowRepairName){
|
||||
//查询所有维修工
|
||||
List<RepairWorker> list = repairWorkerService.list();
|
||||
//查询当前工单下所有项目
|
||||
LambdaQueryWrapper<DlRepairTitem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(DlRepairTitem::getTicketId,ticketId);
|
||||
List<DlRepairTitem> itemList = titemService.list(lambdaQueryWrapper);
|
||||
//过滤出不包括当前指派人的值
|
||||
List<DlRepairTitem> filterList = itemList.stream().filter(item -> !item.getRepairNames().contains(nowRepairName)).collect(Collectors.toList());
|
||||
List<DlRepairTitem> saveList = new ArrayList<>();
|
||||
//当前处理人工作组
|
||||
Map<Long,RepairWorker> workerMap = list.stream().collect(Collectors.toMap(RepairWorker::getUserId,worker -> worker));
|
||||
String workType = workerMap.get(nowRepairId).getWorkType();
|
||||
filterList.forEach(item -> {
|
||||
//深拷贝
|
||||
DlRepairTitem saveItem = BeanUtils.toBean(item,DlRepairTitem.class);
|
||||
if (StringUtils.isNotEmpty(saveItem.getRepairIds())){
|
||||
//取出用户id
|
||||
List<Long> repairIds = Arrays.stream(saveItem.getRepairIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
||||
repairIds.forEach(idItem -> {
|
||||
// 获取对应的 worker
|
||||
RepairWorker worker = workerMap.get(idItem);
|
||||
// 检查 worker 是否存在并比较 workType
|
||||
if (worker != null && workType.equals(worker.getWorkType())) {
|
||||
saveList.add(saveItem);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
saveList.forEach(item -> {
|
||||
String newRepairId = item.getRepairIds()+","+nowRepairId;
|
||||
String newRepairName = item.getRepairNames() + "," + nowRepairName;
|
||||
item.setRepairIds(newRepairId);
|
||||
item.setRepairNames(newRepairName);
|
||||
});
|
||||
titemService.updateBatchById(saveList);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新工单状态(针对开始施工、施工中记录、施工完成)
|
||||
*
|
||||
@ -1192,7 +1249,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
repairTicketsReqVO.setSelectType("special");
|
||||
// 维修服务顾问
|
||||
if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
|
||||
repairTicketsReqVO.setNowRepairId(loginUserId);
|
||||
// 查所有的服务顾问
|
||||
List<UserDTO> userDTOS = roleApi.selectUserListByRoleCode(TenantContextHolder.getRequiredTenantId(), RepairRoleEnum.ADVISOR.getCode());
|
||||
List<Long> ids = userDTOS.stream().map(UserDTO::getId).collect(Collectors.toList());
|
||||
repairTicketsReqVO.setNowRepairIds(ids);
|
||||
// repairTicketsReqVO.setNowRepairId(loginUserId);
|
||||
// 因为完成状态需要在交车之后,所以注掉这个
|
||||
// repairTicketsReqVO.setIsFinish("1");
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) {
|
||||
@ -1428,7 +1489,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
titem.setId(item.getId());
|
||||
// 取出折扣
|
||||
BigDecimal discount = item.getItemDiscount() == null ? new BigDecimal("1") : item.getItemDiscount();
|
||||
titem.setItemMoney(item.getItemPrice().multiply(BigDecimal.valueOf(item.getItemCount())).multiply(discount));
|
||||
BigDecimal itemPrice = item.getItemPrice() == null ? BigDecimal.ZERO : item.getItemPrice();
|
||||
titem.setItemMoney(itemPrice.multiply(BigDecimal.valueOf(item.getItemCount())).multiply(discount));
|
||||
return titem;
|
||||
}).collect(Collectors.toList());
|
||||
// 更新
|
||||
@ -1637,6 +1699,28 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 记录操作日志
|
||||
repairRecordsService.saveRepairRecord(id, null, RecordTypeEnum.SCGG.getCode(), null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务顾问交车
|
||||
*
|
||||
* @param respVO
|
||||
* @author vinjor-M
|
||||
* @date 16:51 2024/11/13
|
||||
**/
|
||||
@Override
|
||||
public void overOrder(DlRepairTicketsRespVO respVO) {
|
||||
// 更新工单状态
|
||||
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.END.getCode())
|
||||
.set(DlRepairTickets::getTicketsStatus, TicketsStatusEnum.OVER.getCode())
|
||||
//交车时才能把工单置为完成
|
||||
.set(DlRepairTickets::getIsFinish,"1")
|
||||
.eq(DlRepairTickets::getId, respVO.getId())
|
||||
);
|
||||
|
||||
// 记录日志
|
||||
repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.JC.getCode(), respVO.getRemark(), respVO.getImage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@ 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.RecordTypeEnum;
|
||||
import cn.iocoder.yudao.common.RepairRoleEnum;
|
||||
import cn.iocoder.yudao.common.SoStatusEnum;
|
||||
@ -201,21 +202,27 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
ticketWares.setAdviserId(Long.valueOf(tickets.getAdviserId()));
|
||||
ticketWares.setAdviserName(tickets.getAdviserName());
|
||||
|
||||
// 图片
|
||||
if (ObjectUtil.isNotEmpty(respVO.getImages())){
|
||||
ticketWares.setImages(respVO.getImages());
|
||||
}
|
||||
baseMapper.insertOrUpdate(ticketWares);
|
||||
|
||||
// 新增、修改子表
|
||||
List<DlTwItem> list = respVO.getItems().stream()
|
||||
.map(item -> {
|
||||
DlTwItem twItem = BeanUtil.toBean(item, DlTwItem.class);
|
||||
twItem.setTwId(ticketWares.getId());
|
||||
twItem.setWaresStatus("");
|
||||
twItem.setWaresAlreadyCount(0);
|
||||
return twItem;
|
||||
}).collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
throw exception0(500, "配件列表为空");
|
||||
if (CollectionUtil.isNotEmpty(respVO.getItems())){
|
||||
List<DlTwItem> list = respVO.getItems().stream()
|
||||
.map(item -> {
|
||||
DlTwItem twItem = BeanUtil.toBean(item, DlTwItem.class);
|
||||
twItem.setTwId(ticketWares.getId());
|
||||
twItem.setWaresStatus("");
|
||||
twItem.setWaresAlreadyCount(0);
|
||||
return twItem;
|
||||
}).collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
throw exception0(500, "配件列表为空");
|
||||
}
|
||||
twItemService.saveOrUpdateBatch(list);
|
||||
}
|
||||
twItemService.saveOrUpdateBatch(list);
|
||||
|
||||
// 通知对应的维修服务顾问和总检
|
||||
// 维修服务顾问即创建工单时选的是谁
|
||||
@ -319,7 +326,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
DlTwItem twItem = allTwitems.stream().filter(i -> i.getWaresId().equals(item.getId())).findFirst().orElse(null);
|
||||
titem.setItemCount(twItem != null ? twItem.getWaresCount() : 0);
|
||||
titem.setItemUnit(item.getUnit());
|
||||
titem.setItemPrice(item.getPrice() != null ? item.getPrice() : BigDecimal.ZERO);
|
||||
titem.setItemPrice((item.getPrice() != null) ? item.getPrice() : BigDecimal.ZERO);
|
||||
titem.setItemDiscount(BigDecimal.ONE);
|
||||
titem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(titem.getItemDiscount()));
|
||||
titem.setRepairIds(String.valueOf(ticketWares.getRepairId()));
|
||||
|
@ -6,9 +6,12 @@ import cn.iocoder.yudao.module.project.entity.RepairWares;
|
||||
import cn.iocoder.yudao.module.project.service.RepairWaresService;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlTicketWares;
|
||||
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.AddTwiVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlTwItemReqVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -22,6 +25,7 @@ import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_UNIT;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
|
||||
/**
|
||||
* 针对表【dl_tw_item(工单配件申请/退回子表)】的数据库操作Service实现
|
||||
@ -40,6 +44,9 @@ public class DlTwItemServiceImpl extends ServiceImpl<DlTwItemMapper, DlTwItem>
|
||||
@Resource
|
||||
@Lazy
|
||||
private RepairWaresService waresService;
|
||||
@Resource
|
||||
@Lazy
|
||||
private DlTicketWaresService ticketWaresService;
|
||||
|
||||
/**
|
||||
* 根据主表查看全部
|
||||
@ -78,6 +85,34 @@ public class DlTwItemServiceImpl extends ServiceImpl<DlTwItemMapper, DlTwItem>
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 给配件申请表子表添加数据
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:47 2024/11/13
|
||||
* @param addTwiVO 对象
|
||||
**/
|
||||
@Override
|
||||
public void addTwi(AddTwiVO addTwiVO){
|
||||
// 构建子表数据
|
||||
if (CollectionUtil.isEmpty(addTwiVO.getItems())){
|
||||
throw exception0(500, "请选择配件");
|
||||
}
|
||||
List<DlTwItem> twItems = addTwiVO.getItems().stream().map(item -> {
|
||||
DlTwItem twItem = new DlTwItem();
|
||||
twItem.setTwId(addTwiVO.getId());
|
||||
twItem.setWaresId(item.getId());
|
||||
twItem.setWaresName(item.getName());
|
||||
twItem.setWaresCount(item.getCount());
|
||||
twItem.setWaresAlreadyCount(0);
|
||||
twItem.setWaresStatus("");
|
||||
twItem.setRemark(item.getRemark());
|
||||
return twItem;
|
||||
}).collect(Collectors.toList());
|
||||
// 新增
|
||||
baseMapper.insert(twItems);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.tickets.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 给配件申请表子表添加数据
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:41 2024/11/13
|
||||
**/
|
||||
@Data
|
||||
public class AddTwiVO {
|
||||
|
||||
private String id;
|
||||
|
||||
private List<AddTwiVoItem> items;
|
||||
|
||||
/**
|
||||
* 配件的信息
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:45 2024/11/13
|
||||
**/
|
||||
@Data
|
||||
public static class AddTwiVoItem {
|
||||
|
||||
/** 配件ID */
|
||||
private String id;
|
||||
|
||||
/** 配件名称 */
|
||||
private String name;
|
||||
|
||||
/** 配件数量 */
|
||||
private Integer count;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
}
|
||||
}
|
@ -36,4 +36,7 @@ public class DlRepairTicketsReqVO extends DlRepairTickets {
|
||||
|
||||
/** 图片路径 */
|
||||
private String image;
|
||||
|
||||
/** 当前操作人包含集合,主要用在服务顾问那儿 */
|
||||
private List<Long> nowRepairIds;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@
|
||||
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') AND drt.tickets_status IN ('04','05','01','07')
|
||||
where (drt.deleted = '0') AND drt.tickets_status IN ('04','05','01','07','06','02')
|
||||
<if test="map.ticketNo != null and map.ticketNo != ''">
|
||||
and (
|
||||
drt.ticket_no like concat('%', #{map.ticketNo}, '%')
|
||||
@ -235,13 +235,23 @@
|
||||
</if>
|
||||
<choose>
|
||||
<when test="map.selectType=='special'">
|
||||
-- 小李用的逻辑 --
|
||||
<if test="map.isFinish != null and map.isFinish != ''">
|
||||
-- 小李用的逻辑--isFinish不需要了 --
|
||||
<!-- <if test="map.isFinish != null and map.isFinish != ''">
|
||||
AND ( drt.is_finish = #{map.isFinish})
|
||||
</if>
|
||||
</if> -->
|
||||
-- 总检查待处理还是用这个 --
|
||||
<if test="map.nowRepairId != null and map.nowRepairId != ''">
|
||||
AND ( drt.now_repair_id = #{map.nowRepairId})
|
||||
</if>
|
||||
-- 服务顾问查待处理(服务顾问之间可以相互查) --
|
||||
<if test="map.nowRepairIds != null and map.nowRepairIds.size > 0">
|
||||
AND (
|
||||
drt.now_repair_id in
|
||||
<foreach collection="map.nowRepairIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
-- 正常查询用的逻辑 --
|
||||
@ -255,10 +265,11 @@
|
||||
)
|
||||
</when>
|
||||
<otherwise>
|
||||
-- 服务顾问和仓管查待办都是查未结束的工单 --
|
||||
AND drt.is_finish = '0'
|
||||
<if test="map.adviserId != null and map.adviserId != ''">
|
||||
-- 查服务顾问 待处理的 工单未完成并且服务顾问是自己的 工单已完成且当前处理人是自己的--
|
||||
AND ( drt.is_finish = '0' AND drt.adviser_id = #{map.adviserId} )
|
||||
OR (drt.is_finish = '1' AND drt.now_repair_id = #{map.adviserId})
|
||||
-- 查服务顾问 当前处理人或服务顾问是自己的--
|
||||
AND ( drt.adviser_id = #{map.adviserId} OR drt.now_repair_id = #{map.adviserId})
|
||||
</if>
|
||||
<if test="map.userIds != null and map.userIds.size > 0">
|
||||
-- 查总检待处理的 --
|
||||
|
@ -21,6 +21,7 @@
|
||||
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="images" column="images" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_SQL">
|
||||
@ -40,7 +41,8 @@
|
||||
dtw.adviser_name,
|
||||
dtw.status,
|
||||
dtw.remark,
|
||||
dtw.create_time
|
||||
dtw.create_time,
|
||||
dtw.images
|
||||
from dl_ticket_wares dtw
|
||||
left join dl_repair_tickets drt
|
||||
on dtw.ticket_id = drt.id
|
||||
|
Loading…
Reference in New Issue
Block a user