Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9bb6c0b201 | ||
|
5da4a45e7d | ||
|
01c781478e | ||
|
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.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
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.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.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
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.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.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.company.vo.CompanyRespVO;
|
||||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
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.dept.dto.DeptRespDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
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.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
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 io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
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 org.springframework.beans.factory.annotation.Autowired;
|
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.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -43,6 +37,10 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
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)表控制层
|
* 企业信息表(每个租户的下属企业信息);(dl_company)表控制层
|
||||||
*
|
*
|
||||||
@ -198,4 +196,23 @@ public class CompanyController {
|
|||||||
}
|
}
|
||||||
return success(companyService.getById(dept.getCorpId()));
|
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("企业名称")
|
@ExcelProperty("企业名称")
|
||||||
private String corpName ;
|
private String corpName ;
|
||||||
|
/** 企业简称 */
|
||||||
|
@ExcelProperty("企业简称")
|
||||||
|
private String simpleName ;
|
||||||
/** 统一社会信用代码 */
|
/** 统一社会信用代码 */
|
||||||
@ExcelProperty("统一社会信用代码")
|
@ExcelProperty("统一社会信用代码")
|
||||||
private String orgCard ;
|
private String orgCard ;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.custom.controller.admin;
|
package cn.iocoder.yudao.module.custom.controller.admin;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.iocoder.yudao.module.custom.entity.CarMain;
|
import cn.iocoder.yudao.module.custom.entity.CarMain;
|
||||||
import cn.iocoder.yudao.module.custom.service.CarMainService;
|
import cn.iocoder.yudao.module.custom.service.CarMainService;
|
||||||
import cn.iocoder.yudao.module.custom.service.UserCarService;
|
import cn.iocoder.yudao.module.custom.service.UserCarService;
|
||||||
@ -215,8 +216,10 @@ public class CarMainController {
|
|||||||
@PostMapping("/getByLicenseNumber")
|
@PostMapping("/getByLicenseNumber")
|
||||||
@Operation(summary = "根据车牌查单条记录")
|
@Operation(summary = "根据车牌查单条记录")
|
||||||
public CommonResult<?> getByLicenseNumber(@RequestBody CarMain carMain) {
|
public CommonResult<?> getByLicenseNumber(@RequestBody CarMain carMain) {
|
||||||
CarMain one = carMainService.getOne(new LambdaQueryWrapper<CarMain>().eq(CarMain::getLicenseNumber, carMain.getLicenseNumber()));
|
// 可能查到多条,只用一条就是,理论上讲是不会有多条的
|
||||||
return success(one);
|
// CarMain one = carMainService.list(new LambdaQueryWrapper<CarMain>().eq(CarMain::getLicenseNumber, carMain.getLicenseNumber()));
|
||||||
|
List<CarMain> list = carMainService.list(new LambdaQueryWrapper<CarMain>().eq(CarMain::getLicenseNumber, carMain.getLicenseNumber()).last("limit 1"));
|
||||||
|
return success(CollectionUtil.isNotEmpty(list) ? list.get(0) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,8 @@ public class TicketsServiceImpl extends ServiceImpl<TicketsMapper, Tickets> impl
|
|||||||
baseMapper.update(new LambdaUpdateWrapper<Tickets>()
|
baseMapper.update(new LambdaUpdateWrapper<Tickets>()
|
||||||
.in(Tickets::getId, ticketIds)
|
.in(Tickets::getId, ticketIds)
|
||||||
.set(Tickets::getTicketsStatus, "02")
|
.set(Tickets::getTicketsStatus, "02")
|
||||||
.set(Tickets::getIsFinish, "1")
|
// 不在这儿结束
|
||||||
|
// .set(Tickets::getIsFinish, "1")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,9 @@ public enum RecordTypeEnum {
|
|||||||
/** 删除工单 */
|
/** 删除工单 */
|
||||||
SCGG("scgg", "删除工单"),
|
SCGG("scgg", "删除工单"),
|
||||||
|
|
||||||
|
/** 删除工单 */
|
||||||
|
JC("jc", "交车"),
|
||||||
|
|
||||||
/** 内返派工 */
|
/** 内返派工 */
|
||||||
NFPG("nfpg", "内返派工");
|
NFPG("nfpg", "内返派工");
|
||||||
|
|
||||||
|
@ -27,6 +27,10 @@ public enum TicketsStatusEnum {
|
|||||||
* 待通知客户取车
|
* 待通知客户取车
|
||||||
*/
|
*/
|
||||||
WAITING_NOTICE("07","待通知客户取车"),
|
WAITING_NOTICE("07","待通知客户取车"),
|
||||||
|
/**
|
||||||
|
* 已交车
|
||||||
|
*/
|
||||||
|
OVER("08","已交车"),
|
||||||
/**
|
/**
|
||||||
* 挂单/记账
|
* 挂单/记账
|
||||||
*/
|
*/
|
||||||
|
@ -123,6 +123,12 @@ public class RepairWorkerController {
|
|||||||
return success(workerService.listByLeads());
|
return success(workerService.listByLeads());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/listLeadsAll")
|
||||||
|
@Operation(summary = "通过班组长的id查该班组的员工(不去掉班组长)")
|
||||||
|
public CommonResult<?> listLeadsAll() {
|
||||||
|
return success(workerService.listLeadsAll());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查当前登录用户是否维修班组长
|
* 查当前登录用户是否维修班组长
|
||||||
* @author vinjor-M
|
* @author vinjor-M
|
||||||
|
@ -106,6 +106,14 @@ public interface RepairWorkerService extends IService<RepairWorker> {
|
|||||||
**/
|
**/
|
||||||
List<RepairWorker> listByLeads();
|
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
|
* @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());
|
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 -> {
|
sois.stream().filter(i -> i.getGoodsId().equals(item.getWaresId())).findFirst().ifPresent(repairSoiByTwItem -> {
|
||||||
if (so.getSoType().equals("02")){
|
if (so.getSoType().equals("02")){
|
||||||
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoiByTwItem.getGoodsCount());
|
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoiByTwItem.getGoodsCount());
|
||||||
dlTwItem.setWaresStatus("02");
|
// 不操作配件申请表子表的状态
|
||||||
|
// dlTwItem.setWaresStatus("02");
|
||||||
}else {
|
}else {
|
||||||
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() + repairSoiByTwItem.getGoodsCount());
|
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() + repairSoiByTwItem.getGoodsCount());
|
||||||
}
|
}
|
||||||
@ -325,13 +326,13 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
|||||||
// 查最新的子表信息
|
// 查最新的子表信息
|
||||||
DlRepairSo so = baseMapper.selectById(id);
|
DlRepairSo so = baseMapper.selectById(id);
|
||||||
List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, so.getTwId()));
|
List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, so.getTwId()));
|
||||||
// 判断是部分完成还是全部完成
|
// 判断是部分完成还是全部完成----不需要判断了
|
||||||
DlTicketWares dlTicketWares = new DlTicketWares();
|
// DlTicketWares dlTicketWares = new DlTicketWares();
|
||||||
dlTicketWares.setId(so.getTwId());
|
// dlTicketWares.setId(so.getTwId());
|
||||||
List<DlTwItem> flag = list.stream().filter(item -> !item.getWaresStatus().equals("01")).collect(Collectors.toList());
|
// List<DlTwItem> flag = list.stream().filter(item -> !item.getWaresStatus().equals("01")).collect(Collectors.toList());
|
||||||
dlTicketWares.setStatus(CollectionUtil.isEmpty(flag) ? "03" : "04");
|
// dlTicketWares.setStatus(CollectionUtil.isEmpty(flag) ? "03" : "04");
|
||||||
// 更新主表的状态
|
// 更新主表的状态
|
||||||
ticketWaresService.updateById(dlTicketWares);
|
// ticketWaresService.updateById(dlTicketWares);
|
||||||
|
|
||||||
// 通知仓库
|
// 通知仓库
|
||||||
repairWorkerService.sentMessage(Long.valueOf(so.getCreator()), so.getUserName() + "已确认领料单:" + so.getSoNo());
|
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.setInCount(filterSoi.getInCount());
|
||||||
inWares.setId(null);
|
inWares.setId(null);
|
||||||
//采购品中入库数量字段累加
|
//采购品中入库数量字段累加---这里item.getInCount 是null的时候,应该是filterSoi的inCount而不是0
|
||||||
item.setInCount(item.getInCount() == null ? 0 : item.getInCount() + filterSoi.getInCount());
|
item.setInCount(item.getInCount() == null ? filterSoi.getInCount() : item.getInCount() + filterSoi.getInCount());
|
||||||
inWaresList.add(inWares);
|
inWaresList.add(inWares);
|
||||||
});
|
});
|
||||||
//更新采购品
|
//更新采购品
|
||||||
|
@ -297,6 +297,19 @@ public class DlRepairTicketsController {
|
|||||||
return CommonResult.ok();
|
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
|
* @author vinjor-M
|
||||||
@ -323,6 +336,19 @@ public class DlRepairTicketsController {
|
|||||||
return CommonResult.ok();
|
return CommonResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否工单子表的任何一个类目没有价格或价格为0
|
||||||
|
*
|
||||||
|
* @param id 工单ID
|
||||||
|
* @author 小李
|
||||||
|
* @date 15:00 2024/11/16
|
||||||
|
**/
|
||||||
|
@GetMapping("/hasPrice")
|
||||||
|
@Operation(summary = "判断是否工单子表的任何一个类目没有价格或价格为0")
|
||||||
|
public CommonResult<?> hasPrice(@RequestParam("id")String id){
|
||||||
|
return success(dlRepairTicketsService.hasPrice(id));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增工单子项
|
* 新增工单子项
|
||||||
*
|
*
|
||||||
|
@ -168,5 +168,18 @@ public class DlTicketWaresController {
|
|||||||
public CommonResult<?> getWorkerTodo(){
|
public CommonResult<?> getWorkerTodo(){
|
||||||
return success(dlTicketWaresService.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.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.module.tickets.entity.DlTwItem;
|
import cn.iocoder.yudao.module.tickets.entity.DlTwItem;
|
||||||
import cn.iocoder.yudao.module.tickets.service.DlTwItemService;
|
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.DlTwItemReqVO;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
@ -41,5 +39,19 @@ public class DlTwItemController {
|
|||||||
public CommonResult<?> listTwItem(DlTwItemReqVO reqVO){
|
public CommonResult<?> listTwItem(DlTwItemReqVO reqVO){
|
||||||
return success(dlTwItemService.listTwItem(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 remark;
|
||||||
|
|
||||||
|
/** 多个图片地址,英文逗号分隔(拍照上传配件申请单时用) */
|
||||||
|
private String images;
|
||||||
}
|
}
|
@ -235,4 +235,21 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
|||||||
* @param id 工单ID
|
* @param id 工单ID
|
||||||
**/
|
**/
|
||||||
void removeTicketById(String id);
|
void removeTicketById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务顾问交车
|
||||||
|
* @author vinjor-M
|
||||||
|
* @date 16:51 2024/11/13
|
||||||
|
* @param respVO
|
||||||
|
**/
|
||||||
|
void overOrder(DlRepairTicketsRespVO respVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否工单子表的任何一个类目没有价格或价格为0
|
||||||
|
*
|
||||||
|
* @param id 工单ID
|
||||||
|
* @author 小李
|
||||||
|
* @date 15:00 2024/11/16
|
||||||
|
**/
|
||||||
|
Boolean hasPrice(String id);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.tickets.service;
|
package cn.iocoder.yudao.module.tickets.service;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.tickets.entity.DlTwItem;
|
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.DlTwItemReqVO;
|
||||||
import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO;
|
import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
@ -23,4 +24,13 @@ public interface DlTwItemService extends IService<DlTwItem> {
|
|||||||
* @param reqVO 请求对象
|
* @param reqVO 请求对象
|
||||||
**/
|
**/
|
||||||
List<DlTwItemRespVO> listTwItem(DlTwItemReqVO 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.hutool.core.util.ObjectUtil;
|
||||||
import cn.iocoder.yudao.common.*;
|
import cn.iocoder.yudao.common.*;
|
||||||
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
|
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.LoginUser;
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
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.entity.RepairWorker;
|
||||||
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
||||||
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||||
@ -220,7 +222,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
// });
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 门店信息
|
// 门店信息
|
||||||
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
||||||
DeptRespDTO dept = deptApi.getDept(deptId);
|
DeptRespDTO dept = deptApi.getDept(deptId);
|
||||||
@ -254,7 +255,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
// 新增子表
|
// 新增子表
|
||||||
itemList.forEach(item -> {
|
itemList.forEach(item -> {
|
||||||
item.setTicketId(ticketsRespVO.getId());
|
item.setTicketId(ticketsRespVO.getId());
|
||||||
if(null==item.getSaleId()){
|
if (null == item.getSaleId()) {
|
||||||
//默认销售人员是当前用户
|
//默认销售人员是当前用户
|
||||||
item.setSaleId(loginUser.getId());
|
item.setSaleId(loginUser.getId());
|
||||||
item.setSaleName(loginUser.getInfo().get("nickname"));
|
item.setSaleName(loginUser.getInfo().get("nickname"));
|
||||||
@ -413,7 +414,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
// 作废维修工单
|
// 作废维修工单
|
||||||
DlRepairTickets tickets = new DlRepairTickets();
|
DlRepairTickets tickets = new DlRepairTickets();
|
||||||
tickets.setId(repairTicketsReqVO.getId());
|
tickets.setId(repairTicketsReqVO.getId());
|
||||||
if (ObjectUtil.isNotEmpty(repairTicketsReqVO.getRemark())){
|
if (ObjectUtil.isNotEmpty(repairTicketsReqVO.getRemark())) {
|
||||||
tickets.setRemark(repairTicketsReqVO.getRemark());
|
tickets.setRemark(repairTicketsReqVO.getRemark());
|
||||||
}
|
}
|
||||||
tickets.setTicketsStatus("03");
|
tickets.setTicketsStatus("03");
|
||||||
@ -445,10 +446,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
|
|
||||||
// 更新工单
|
// 更新工单
|
||||||
// 在这里把工单的状态更新为已完成---需要判断,如果是线上支付,需要在支付回调更新
|
// 在这里把工单的状态更新为已完成---需要判断,如果是线上支付,需要在支付回调更新
|
||||||
if (!repairTicketsRespVO.getPayType().equals("01")){
|
if (!repairTicketsRespVO.getPayType().equals("01")) {
|
||||||
repairTicketsRespVO.setIsFinish("1");
|
// 不在这儿结束
|
||||||
|
// repairTicketsRespVO.setIsFinish("1");
|
||||||
baseMapper.updateById(repairTicketsRespVO);
|
baseMapper.updateById(repairTicketsRespVO);
|
||||||
}else {
|
} else {
|
||||||
// 线下结账和签单挂账,直接算已支付
|
// 线下结账和签单挂账,直接算已支付
|
||||||
repairOrderInfo.setPayTime(LocalDateTime.now());
|
repairOrderInfo.setPayTime(LocalDateTime.now());
|
||||||
repairOrderInfo.setOrderStatus("1");
|
repairOrderInfo.setOrderStatus("1");
|
||||||
@ -850,6 +852,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
String userRoleCode = getUserRole();
|
String userRoleCode = getUserRole();
|
||||||
if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())) {
|
if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())) {
|
||||||
//维修管理员看所有数据
|
//维修管理员看所有数据
|
||||||
|
} else if (userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())) {
|
||||||
|
//仓管看到所有数据
|
||||||
} else if (userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) {
|
} else if (userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) {
|
||||||
//总检
|
//总检
|
||||||
if (RepairCons.TICKETS_WAITING.equals(repairTicketsReqVO.getSelectType())) {
|
if (RepairCons.TICKETS_WAITING.equals(repairTicketsReqVO.getSelectType())) {
|
||||||
@ -876,7 +880,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
if ("".equals(userIdsStr)) {
|
if ("".equals(userIdsStr)) {
|
||||||
userIdsStr = String.valueOf(worker.getUserId());
|
userIdsStr = String.valueOf(worker.getUserId());
|
||||||
} else {
|
} else {
|
||||||
userIdsStr = "," + worker.getUserId();
|
userIdsStr = userIdsStr + "," + worker.getUserId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
repairTicketsReqVO.setUserIds(userIds);
|
repairTicketsReqVO.setUserIds(userIds);
|
||||||
@ -951,7 +955,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
@DSTransactional
|
@DSTransactional
|
||||||
public void updateTake(String id,String image) {
|
public void updateTake(String id, String image) {
|
||||||
// 改变时看看是否已经被接了
|
// 改变时看看是否已经被接了
|
||||||
int update = baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
int update = baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||||
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.RECEIVED.getCode())
|
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.RECEIVED.getCode())
|
||||||
@ -999,21 +1003,75 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
}
|
}
|
||||||
repairWorkerService.sentMessage(reqVO.getNowRepairId(), "您有新的工单要处理");
|
repairWorkerService.sentMessage(reqVO.getNowRepairId(), "您有新的工单要处理");
|
||||||
|
|
||||||
//最后记录操作日志--指派施工--pull下来的逻辑
|
|
||||||
String code = RecordTypeEnum.ZPSG.getCode();
|
|
||||||
String remark ="指派施工";
|
|
||||||
// 获取当前操作人的身份----小李新加的逻辑
|
// 获取当前操作人的身份----小李新加的逻辑
|
||||||
String userRole = getUserRole();
|
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 = "指派施工";
|
||||||
|
|
||||||
// 总检
|
// 总检
|
||||||
if (userRole.equals(RepairRoleEnum.INSPECTION.getCode())){
|
if (userRole.equals(RepairRoleEnum.INSPECTION.getCode())) {
|
||||||
repairRecordsService.saveRepairRecord(reqVO.getId(), null, RecordTypeEnum.NFPG.getCode(), reqVO.getRemark(), reqVO.getImage());
|
repairRecordsService.saveRepairRecord(reqVO.getId(), null, RecordTypeEnum.NFPG.getCode(), reqVO.getRemark(), reqVO.getImage());
|
||||||
}else {
|
} else {
|
||||||
// 其他
|
// 其他
|
||||||
//最后记录操作日志--指派施工
|
//最后记录操作日志--指派施工
|
||||||
repairRecordsService.saveRepairRecord(reqVO.getId(), null, code, remark, null);
|
repairRecordsService.saveRepairRecord(reqVO.getId(), null, code, remark, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指派施工,施工项目中不包含选中人员处理
|
||||||
|
*
|
||||||
|
* @param ticketId 工单id
|
||||||
|
* @param nowRepairId 当前处理人id
|
||||||
|
* @param nowRepairName 当前处理人名称
|
||||||
|
* @author PQZ
|
||||||
|
* @date 16:30 2024/11/13
|
||||||
|
**/
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新工单状态(针对开始施工、施工中记录、施工完成)
|
* 更新工单状态(针对开始施工、施工中记录、施工完成)
|
||||||
*
|
*
|
||||||
@ -1066,7 +1124,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
施工完成又分四种情况:阶段完成、完成并移交下一班组、完成并移交总检、完成工单,其中部分完成同开始施工、施工中的记录上传一致,只上传,不改变
|
施工完成又分四种情况:阶段完成、完成并移交下一班组、完成并移交总检、完成工单,其中部分完成同开始施工、施工中的记录上传一致,只上传,不改变
|
||||||
*/
|
*/
|
||||||
// 消息生成
|
// 消息生成
|
||||||
String message = createMessage(tickets.getNowRepairName(), tickets.getCarNo(),null==titem?"":titem.getItemName(), respVO.getRecordType(), respVO.getFinishType(), respVO.getNextName());
|
String message = createMessage(tickets.getNowRepairName(), tickets.getCarNo(), null == titem ? "" : titem.getItemName(), respVO.getRecordType(), respVO.getFinishType(), respVO.getNextName());
|
||||||
// 通知服务顾问
|
// 通知服务顾问
|
||||||
// 如果员工完成了订单
|
// 如果员工完成了订单
|
||||||
if (RecordTypeEnum.SGWCZJ.getCode().equals(respVO.getRecordType()) && "03".equals(respVO.getFinishType())) {
|
if (RecordTypeEnum.SGWCZJ.getCode().equals(respVO.getRecordType()) && "03".equals(respVO.getFinishType())) {
|
||||||
@ -1109,7 +1167,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
}
|
}
|
||||||
|
|
||||||
//通知客户(开始施工、施工完成)
|
//通知客户(开始施工、施工完成)
|
||||||
if (respVO.getRecordType().equals(RecordTypeEnum.KSSG.getCode()) || respVO.getRecordType().equals(RecordTypeEnum.SGWCZJ.getCode())){
|
if (respVO.getRecordType().equals(RecordTypeEnum.KSSG.getCode()) || respVO.getRecordType().equals(RecordTypeEnum.SGWCZJ.getCode())) {
|
||||||
// 构建消息
|
// 构建消息
|
||||||
RepairWorker worker = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()).last("limit 1"));
|
RepairWorker worker = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()).last("limit 1"));
|
||||||
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList("repair_work_type");
|
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList("repair_work_type");
|
||||||
@ -1192,7 +1250,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
repairTicketsReqVO.setSelectType("special");
|
repairTicketsReqVO.setSelectType("special");
|
||||||
// 维修服务顾问
|
// 维修服务顾问
|
||||||
if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
|
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");
|
// repairTicketsReqVO.setIsFinish("1");
|
||||||
} else if (userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) {
|
} else if (userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) {
|
||||||
@ -1221,11 +1283,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.ZJ.getCode(), respVO.getRemark(), respVO.getImage());
|
repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.ZJ.getCode(), respVO.getRemark(), respVO.getImage());
|
||||||
// 更新工单
|
// 更新工单
|
||||||
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||||
// 因为完成状态需要在交车之后,所以注掉这个
|
// 因为完成状态需要在交车之后,所以注掉这个
|
||||||
// .set(DlRepairTickets::getIsFinish, "1")
|
// .set(DlRepairTickets::getIsFinish, "1")
|
||||||
.setSql("now_repair_id = adviser_id")
|
.setSql("now_repair_id = adviser_id")
|
||||||
.setSql("now_repair_name = adviser_name")
|
.setSql("now_repair_name = adviser_name")
|
||||||
.eq(DlRepairTickets::getId, respVO.getId())
|
.eq(DlRepairTickets::getId, respVO.getId())
|
||||||
);
|
);
|
||||||
|
|
||||||
boolean flag = syncTicketWaresToTicket(respVO.getId());
|
boolean flag = syncTicketWaresToTicket(respVO.getId());
|
||||||
@ -1407,6 +1469,29 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
repairRecordsService.saveRepairRecord(noticeCusVO.getId(), null, RecordTypeEnum.TZQC.getCode(), recordStr, null);
|
repairRecordsService.saveRepairRecord(noticeCusVO.getId(), null, RecordTypeEnum.TZQC.getCode(), recordStr, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否工单子表的任何一个类目没有价格或价格为0
|
||||||
|
*
|
||||||
|
* @param id 工单ID
|
||||||
|
* @author 小李
|
||||||
|
* @date 15:00 2024/11/16
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public Boolean hasPrice(String id) {
|
||||||
|
List<DlRepairTitem> titems = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().in(DlRepairTitem::getTicketId, id));
|
||||||
|
for (DlRepairTitem item : titems) {
|
||||||
|
// 如果有为空的,直接报错
|
||||||
|
if (ObjectUtil.isEmpty(item.getItemPrice())) {
|
||||||
|
throw exception0(500, "工单中有项目或配件没有设置价格,请服务顾问填写项目价格,仓库填写配件价格");
|
||||||
|
}
|
||||||
|
// 如果有为0的,那就提示,让操作人选择
|
||||||
|
if (item.getItemPrice().equals(new BigDecimal("0.00"))){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重新计算工单的一些数值,子表也要重新计算
|
* 重新计算工单的一些数值,子表也要重新计算
|
||||||
*
|
*
|
||||||
@ -1428,7 +1513,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
titem.setId(item.getId());
|
titem.setId(item.getId());
|
||||||
// 取出折扣
|
// 取出折扣
|
||||||
BigDecimal discount = item.getItemDiscount() == null ? new BigDecimal("1") : item.getItemDiscount();
|
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;
|
return titem;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
// 更新
|
// 更新
|
||||||
@ -1637,6 +1723,28 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
// 记录操作日志
|
// 记录操作日志
|
||||||
repairRecordsService.saveRepairRecord(id, null, RecordTypeEnum.SCGG.getCode(), null, null);
|
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.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.iocoder.yudao.common.RecordTypeEnum;
|
import cn.iocoder.yudao.common.RecordTypeEnum;
|
||||||
import cn.iocoder.yudao.common.RepairRoleEnum;
|
import cn.iocoder.yudao.common.RepairRoleEnum;
|
||||||
import cn.iocoder.yudao.common.SoStatusEnum;
|
import cn.iocoder.yudao.common.SoStatusEnum;
|
||||||
@ -201,21 +202,27 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
ticketWares.setAdviserId(Long.valueOf(tickets.getAdviserId()));
|
ticketWares.setAdviserId(Long.valueOf(tickets.getAdviserId()));
|
||||||
ticketWares.setAdviserName(tickets.getAdviserName());
|
ticketWares.setAdviserName(tickets.getAdviserName());
|
||||||
|
|
||||||
|
// 图片
|
||||||
|
if (ObjectUtil.isNotEmpty(respVO.getImages())){
|
||||||
|
ticketWares.setImages(respVO.getImages());
|
||||||
|
}
|
||||||
baseMapper.insertOrUpdate(ticketWares);
|
baseMapper.insertOrUpdate(ticketWares);
|
||||||
|
|
||||||
// 新增、修改子表
|
// 新增、修改子表
|
||||||
List<DlTwItem> list = respVO.getItems().stream()
|
if (CollectionUtil.isNotEmpty(respVO.getItems())){
|
||||||
.map(item -> {
|
List<DlTwItem> list = respVO.getItems().stream()
|
||||||
DlTwItem twItem = BeanUtil.toBean(item, DlTwItem.class);
|
.map(item -> {
|
||||||
twItem.setTwId(ticketWares.getId());
|
DlTwItem twItem = BeanUtil.toBean(item, DlTwItem.class);
|
||||||
twItem.setWaresStatus("");
|
twItem.setTwId(ticketWares.getId());
|
||||||
twItem.setWaresAlreadyCount(0);
|
twItem.setWaresStatus("");
|
||||||
return twItem;
|
twItem.setWaresAlreadyCount(0);
|
||||||
}).collect(Collectors.toList());
|
return twItem;
|
||||||
if (CollectionUtil.isEmpty(list)) {
|
}).collect(Collectors.toList());
|
||||||
throw exception0(500, "配件列表为空");
|
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);
|
DlTwItem twItem = allTwitems.stream().filter(i -> i.getWaresId().equals(item.getId())).findFirst().orElse(null);
|
||||||
titem.setItemCount(twItem != null ? twItem.getWaresCount() : 0);
|
titem.setItemCount(twItem != null ? twItem.getWaresCount() : 0);
|
||||||
titem.setItemUnit(item.getUnit());
|
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.setItemDiscount(BigDecimal.ONE);
|
||||||
titem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(titem.getItemDiscount()));
|
titem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(titem.getItemDiscount()));
|
||||||
titem.setRepairIds(String.valueOf(ticketWares.getRepairId()));
|
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.project.service.RepairWaresService;
|
||||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
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.entity.DlTwItem;
|
||||||
import cn.iocoder.yudao.module.tickets.mapper.DlTwItemMapper;
|
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.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.DlTwItemReqVO;
|
||||||
import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO;
|
import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
@ -22,6 +25,7 @@ import java.util.Map;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_UNIT;
|
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实现
|
* 针对表【dl_tw_item(工单配件申请/退回子表)】的数据库操作Service实现
|
||||||
@ -40,6 +44,9 @@ public class DlTwItemServiceImpl extends ServiceImpl<DlTwItemMapper, DlTwItem>
|
|||||||
@Resource
|
@Resource
|
||||||
@Lazy
|
@Lazy
|
||||||
private RepairWaresService waresService;
|
private RepairWaresService waresService;
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private DlTicketWaresService ticketWaresService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据主表查看全部
|
* 根据主表查看全部
|
||||||
@ -78,6 +85,34 @@ public class DlTwItemServiceImpl extends ServiceImpl<DlTwItemMapper, DlTwItem>
|
|||||||
}
|
}
|
||||||
return null;
|
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 String image;
|
||||||
|
|
||||||
|
/** 当前操作人包含集合,主要用在服务顾问那儿 */
|
||||||
|
private List<Long> nowRepairIds;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@
|
|||||||
from dl_repair_tickets drt
|
from dl_repair_tickets drt
|
||||||
left join dl_repair_titem drti
|
left join dl_repair_titem drti
|
||||||
on drt.id = drti.ticket_id AND drti.deleted = '0'
|
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 != ''">
|
<if test="map.ticketNo != null and map.ticketNo != ''">
|
||||||
and (
|
and (
|
||||||
drt.ticket_no like concat('%', #{map.ticketNo}, '%')
|
drt.ticket_no like concat('%', #{map.ticketNo}, '%')
|
||||||
@ -235,13 +235,23 @@
|
|||||||
</if>
|
</if>
|
||||||
<choose>
|
<choose>
|
||||||
<when test="map.selectType=='special'">
|
<when test="map.selectType=='special'">
|
||||||
-- 小李用的逻辑 --
|
-- 小李用的逻辑--isFinish不需要了 --
|
||||||
<if test="map.isFinish != null and map.isFinish != ''">
|
<!-- <if test="map.isFinish != null and map.isFinish != ''">
|
||||||
AND ( drt.is_finish = #{map.isFinish})
|
AND ( drt.is_finish = #{map.isFinish})
|
||||||
</if>
|
</if> -->
|
||||||
|
-- 总检查待处理还是用这个 --
|
||||||
<if test="map.nowRepairId != null and map.nowRepairId != ''">
|
<if test="map.nowRepairId != null and map.nowRepairId != ''">
|
||||||
AND ( drt.now_repair_id = #{map.nowRepairId})
|
AND ( drt.now_repair_id = #{map.nowRepairId})
|
||||||
</if>
|
</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>
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
-- 正常查询用的逻辑 --
|
-- 正常查询用的逻辑 --
|
||||||
@ -255,10 +265,11 @@
|
|||||||
)
|
)
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
|
-- 服务顾问和仓管查待办都是查未结束的工单 --
|
||||||
|
AND drt.is_finish = '0'
|
||||||
<if test="map.adviserId != null and map.adviserId != ''">
|
<if test="map.adviserId != null and map.adviserId != ''">
|
||||||
-- 查服务顾问 待处理的 工单未完成并且服务顾问是自己的 工单已完成且当前处理人是自己的--
|
-- 查服务顾问 当前处理人或服务顾问是自己的--
|
||||||
AND ( drt.is_finish = '0' AND drt.adviser_id = #{map.adviserId} )
|
AND ( drt.adviser_id = #{map.adviserId} OR drt.now_repair_id = #{map.adviserId})
|
||||||
OR (drt.is_finish = '1' AND drt.now_repair_id = #{map.adviserId})
|
|
||||||
</if>
|
</if>
|
||||||
<if test="map.userIds != null and map.userIds.size > 0">
|
<if test="map.userIds != null and map.userIds.size > 0">
|
||||||
-- 查总检待处理的 --
|
-- 查总检待处理的 --
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
<result property="status" column="status" jdbcType="VARCHAR"/>
|
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="images" column="images" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_SQL">
|
<sql id="Base_SQL">
|
||||||
@ -40,7 +41,8 @@
|
|||||||
dtw.adviser_name,
|
dtw.adviser_name,
|
||||||
dtw.status,
|
dtw.status,
|
||||||
dtw.remark,
|
dtw.remark,
|
||||||
dtw.create_time
|
dtw.create_time,
|
||||||
|
dtw.images
|
||||||
from dl_ticket_wares dtw
|
from dl_ticket_wares dtw
|
||||||
left join dl_repair_tickets drt
|
left join dl_repair_tickets drt
|
||||||
on dtw.ticket_id = drt.id
|
on dtw.ticket_id = drt.id
|
||||||
|
Loading…
Reference in New Issue
Block a user