Merge branch 'master' of http://122.51.230.86:3000/dianliang/lanan-system
# Conflicts: # yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/UserRoleMapper.xml
This commit is contained in:
commit
3f891bf327
@ -129,4 +129,6 @@ public class BaseConstants {
|
||||
/** 字典:超时自动总检配置 */
|
||||
public static final String AUTO_INSPECTION = "auto_inspection";
|
||||
|
||||
public static final String MAP_NO_DATA = "map_no_data";
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.app.dict.controller;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 通用的非PC查字典数据
|
||||
*
|
||||
* @author 小李
|
||||
* @date 11:20 2024/11/6
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/userClient/dict")
|
||||
public class DictController {
|
||||
|
||||
@Resource
|
||||
private DictDataApi dictDataApi;
|
||||
|
||||
@GetMapping("/type")
|
||||
@Operation(summary = "根据类型查该类型的所有数据")
|
||||
public CommonResult<?> getDictByType(@RequestParam("type") String type) {
|
||||
return success(dictDataApi.getDictDataList(type));
|
||||
}
|
||||
}
|
@ -1,12 +1,8 @@
|
||||
package cn.iocoder.yudao.module.custom.controller.admin;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerCarService;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
||||
@ -23,11 +19,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.*;
|
||||
@ -48,7 +40,8 @@ public class CustomerMainController {
|
||||
private CustomerMainService customerMainService;
|
||||
@Resource
|
||||
private BusiLabelService busiLabelService;
|
||||
|
||||
@Resource
|
||||
private CustomerCarService customerCarService;
|
||||
/**
|
||||
* 客户管理分页列表查询
|
||||
*
|
||||
@ -85,6 +78,14 @@ public class CustomerMainController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/saveCustomerAndCar")
|
||||
@Operation(summary = "保存客户及车辆信息")
|
||||
public CommonResult<Boolean> saveCustomerAndCar(@RequestBody CustomerMainSaveReqVO saveReqVO) throws Exception {
|
||||
customerCarService.saveCustomerAndCar(saveReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑客户
|
||||
*
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.custom.service;
|
||||
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerCar;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
@ -23,4 +24,15 @@ public interface CustomerCarService extends IService<CustomerCar> {
|
||||
* @date 18:45 2024/8/3
|
||||
**/
|
||||
void bindCustomerCar(String mainId, String mainTable, List<CustomerCar> customerCars);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 保存客户及车辆信息
|
||||
* @author PQZ
|
||||
* @date 15:51 2024/11/12
|
||||
* @param saveReqVO CustomerMainSaveReqVO
|
||||
* @return void
|
||||
**/
|
||||
void saveCustomerAndCar(CustomerMainSaveReqVO saveReqVO) throws Exception;
|
||||
}
|
@ -24,6 +24,7 @@ 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.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -107,17 +108,20 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
|
||||
@Override
|
||||
public CommonResult<String> updateCarMain(CarMainReqVO updateReqVO) {
|
||||
//车牌号license_number,车架号vin,发动机号码engine_number 重复校验
|
||||
int checkResult = isDataKeyValueRepeat(updateReqVO);
|
||||
//如果查重失败
|
||||
if (checkResult != 0) {
|
||||
switch (checkResult) {
|
||||
case 1:
|
||||
return CommonResult.error(4051, "该车牌号已在系统中登记");
|
||||
case 2:
|
||||
return CommonResult.error(4052, "该车架号已在系统中登记");
|
||||
case 3:
|
||||
return CommonResult.error(4053, "该发动机号码已在系统中登记");
|
||||
if(StringUtils.isEmpty(updateReqVO.getId())){
|
||||
//没有车辆id才需要查重
|
||||
int checkResult = isDataKeyValueRepeat(updateReqVO);
|
||||
//如果查重失败
|
||||
if (checkResult != 0) {
|
||||
switch (checkResult) {
|
||||
case 1:
|
||||
return CommonResult.error(4051, "该车牌号已在系统中登记");
|
||||
case 2:
|
||||
return CommonResult.error(4052, "该车架号已在系统中登记");
|
||||
case 3:
|
||||
return CommonResult.error(4053, "该发动机号码已在系统中登记");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//车俩品牌型号级联选择器返回值,第一位是品牌,第二位是型号
|
||||
|
@ -1,19 +1,32 @@
|
||||
package cn.iocoder.yudao.module.custom.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.custom.entity.CarMain;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerCar;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||
import cn.iocoder.yudao.module.custom.mapper.CustomerCarMapper;
|
||||
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.CustomerMainSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CAR;
|
||||
import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CUSTOMER;
|
||||
import static cn.iocoder.yudao.common.BaseConstants.*;
|
||||
import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_CUS;
|
||||
|
||||
/**
|
||||
* 客户车辆管理关联
|
||||
@ -24,6 +37,15 @@ import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CUSTOMER;
|
||||
@Validated
|
||||
public class CustomerCarServiceImpl extends ServiceImpl<CustomerCarMapper, CustomerCar> implements CustomerCarService {
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private CustomerMainService customerMainService;
|
||||
@Resource
|
||||
@Lazy
|
||||
private CarMainService carMainService;
|
||||
@Resource
|
||||
@Lazy
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
/**
|
||||
* 保存客户与车辆的关联关系
|
||||
@ -60,4 +82,66 @@ public class CustomerCarServiceImpl extends ServiceImpl<CustomerCarMapper, Custo
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存客户及车辆信息
|
||||
*
|
||||
* @param saveReqVO CustomerMainSaveReqVO
|
||||
* @return void
|
||||
* @author PQZ
|
||||
* @date 15:51 2024/11/12
|
||||
**/
|
||||
@Override
|
||||
public void saveCustomerAndCar(CustomerMainSaveReqVO saveReqVO) throws Exception {
|
||||
chekData(saveReqVO);
|
||||
//用户信息
|
||||
AdminUserRespDTO userDTO = adminUserApi.getUserByUsername(saveReqVO.getPhoneNumber());
|
||||
UserDTO user = BeanUtils.toBean(userDTO, UserDTO.class);
|
||||
if (null == userDTO){
|
||||
user = new UserDTO();
|
||||
//如果不存在创建用户;
|
||||
user.setUsername(saveReqVO.getPhoneNumber());
|
||||
user.setNickname(saveReqVO.getCusName());
|
||||
//默认密码
|
||||
user.setPassword(PASSWORD_DEFAULT);
|
||||
user.setMobile(saveReqVO.getPhoneNumber());
|
||||
user.setUserType(USER_TYPE_CUS);
|
||||
//创建客户
|
||||
Long userId = adminUserApi.createUser(user);
|
||||
saveReqVO.setUserId(userId);
|
||||
} else {
|
||||
saveReqVO.setUserId(user.getId());
|
||||
}
|
||||
//客户信息
|
||||
CustomerMain customerMain = BeanUtils.toBean(saveReqVO,CustomerMain.class);
|
||||
customerMain.setDataFrom("02");
|
||||
//车辆信息
|
||||
CarMain carMain = saveReqVO.getCar();
|
||||
customerMainService.save(customerMain);
|
||||
carMainService.save(carMain);
|
||||
//关联关系
|
||||
CustomerCar customerCar = new CustomerCar();
|
||||
customerCar.setCusId(customerMain.getId());
|
||||
customerCar.setCarId(carMain.getId());
|
||||
save(customerCar);
|
||||
}
|
||||
|
||||
private void chekData(CustomerMainSaveReqVO saveReqVO) throws Exception {
|
||||
if (StringUtils.isEmpty(saveReqVO.getPhoneNumber())){
|
||||
throw new Exception("联系方式不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(saveReqVO.getCusName())){
|
||||
throw new Exception("客户姓名不能为空");
|
||||
}
|
||||
if (saveReqVO.getCar() == null){
|
||||
throw new Exception("车辆信息不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(saveReqVO.getCar().getLicenseNumber())){
|
||||
throw new Exception("车牌号不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(saveReqVO.getCar().getCarBrand())){
|
||||
throw new Exception("车辆品牌不能为空");
|
||||
}
|
||||
}
|
||||
}
|
@ -41,9 +41,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.*;
|
||||
import static cn.iocoder.yudao.common.DictBaseConstants.DICT_CUS_TYPE;
|
||||
@ -120,7 +118,7 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
|
||||
AdminUserRespDTO userDTO = adminUserApi.getUserByUsername(saveReqVO.getPhoneNumber());
|
||||
user = BeanUtils.toBean(userDTO, UserDTO.class);
|
||||
//存在两种情况,一是该用户已经注册,二是该用户未注册
|
||||
if (null == user){
|
||||
if (null == userDTO){
|
||||
user = new UserDTO();
|
||||
//如果不存在创建用户;
|
||||
user.setUsername(saveReqVO.getPhoneNumber());
|
||||
@ -164,10 +162,10 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
|
||||
}
|
||||
//客户表绑定用户id
|
||||
main.setUserId(userId);
|
||||
//绑定角色
|
||||
Set<String> roleCodes = new HashSet<>();
|
||||
roleCodes.add(dict.getRemark());
|
||||
permissionApi.assignUserRole(userId, roleCodes);
|
||||
//绑定角色----客户不设置角色
|
||||
// Set<String> roleCodes = new HashSet<>();
|
||||
// roleCodes.add(dict.getRemark());
|
||||
// permissionApi.assignUserRole(userId, roleCodes);
|
||||
}
|
||||
/*3、保存客户主表信息*/
|
||||
//暂时写死会员id TODO
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.custom.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.custom.entity.CarMain;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerItem;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||
import cn.iocoder.yudao.module.label.entity.BusiLabel;
|
||||
@ -18,9 +19,6 @@ public class CustomerMainSaveReqVO extends CustomerMain {
|
||||
private List<CarMainRespVO> carList;
|
||||
/**标签信息*/
|
||||
List<BusiLabel> labelList;
|
||||
|
||||
/**
|
||||
* 微信openId
|
||||
*/
|
||||
private String openId;
|
||||
/**客户车辆信息*/
|
||||
private CarMain car;
|
||||
}
|
@ -177,4 +177,7 @@ public class Tickets extends TenantBaseDO {
|
||||
|
||||
/** 工单进行状态 */
|
||||
private String ticketsWorkStatus;
|
||||
|
||||
/** 工单完成情况(0:未完成,1:已完成) */
|
||||
private String isFinish;
|
||||
}
|
||||
|
@ -26,6 +26,10 @@ public class TicketsServiceImpl extends ServiceImpl<TicketsMapper, Tickets> impl
|
||||
**/
|
||||
@Override
|
||||
public void updateTickets(List<String> ticketIds){
|
||||
baseMapper.update(new LambdaUpdateWrapper<Tickets>().in(Tickets::getId, ticketIds).set(Tickets::getTicketsStatus, "02"));
|
||||
baseMapper.update(new LambdaUpdateWrapper<Tickets>()
|
||||
.in(Tickets::getId, ticketIds)
|
||||
.set(Tickets::getTicketsStatus, "02")
|
||||
.set(Tickets::getIsFinish, "1")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -85,12 +85,10 @@
|
||||
SELECT
|
||||
<include refid="baseCarMainColumn"></include>,
|
||||
bcb.brand_name AS brandStr,
|
||||
bcb.logo_img AS logoImg,
|
||||
bcm.model_name AS modelStr
|
||||
bcb.logo_img AS logoImg
|
||||
FROM
|
||||
`base_car_main` tbcm
|
||||
LEFT JOIN base_car_brand bcb ON bcb.deleted = 0 AND tbcm.car_brand = bcb.id
|
||||
LEFT JOIN base_car_model bcm ON bcm.deleted = 0 AND tbcm.car_model = bcm.id
|
||||
WHERE
|
||||
tbcm.deleted = 0
|
||||
AND
|
||||
|
@ -1,9 +1,12 @@
|
||||
package cn.iocoder.yudao.module.staff.controller.app;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.staff.service.ApiAppLoginService;
|
||||
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -19,6 +22,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class ApiAppLoginController {
|
||||
@Autowired
|
||||
private ApiAppLoginService apiAppLoginService;
|
||||
@Autowired
|
||||
private CompanyStaffService companyStaffService;
|
||||
|
||||
/**
|
||||
* 登录获取验证码
|
||||
@ -33,5 +38,16 @@ public class ApiAppLoginController {
|
||||
return apiAppLoginService.loginSmsCode(phone,sysCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户查我的邀请人
|
||||
* @author vinjor-M
|
||||
* @date 10:40 2024/11/6
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@GetMapping("/getMyAdviser")
|
||||
@TenantIgnore
|
||||
public CommonResult<?> getMyAdviser(Long tenantId,String sysCode) {
|
||||
return CommonResult.success(companyStaffService.getMyAdviser(tenantId,sysCode));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.staff.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
|
||||
import cn.iocoder.yudao.module.staff.vo.CompanyStaffReqVO;
|
||||
import cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -17,4 +18,13 @@ import org.apache.ibatis.annotations.Param;
|
||||
public interface CompanyStaffMapper extends BaseMapper<CompanyStaff> {
|
||||
|
||||
IPage<CompanyStaff> selectListPage(@Param("map") CompanyStaffReqVO companyStaffReqVO, Page<CompanyStaff> page);
|
||||
/**
|
||||
* 客户查我的邀请人
|
||||
* @author vinjor-M
|
||||
* @date 11:05 2024/11/6
|
||||
* @param tenantId 租户ID
|
||||
* @param userId userId
|
||||
* @return cn.iocoder.yudao.module.staff.entity.CompanyStaff
|
||||
**/
|
||||
CompanyStaffRespVO selectMyAdviser(@Param("tenantId") Long tenantId, @Param("userId") Long userId);
|
||||
}
|
||||
|
@ -131,4 +131,12 @@ public interface CompanyStaffService extends IService<CompanyStaff> {
|
||||
* @date 17:23 2024/10/15
|
||||
**/
|
||||
void setStaffUnicode();
|
||||
|
||||
/**
|
||||
* 客户查我的邀请人
|
||||
* @author vinjor-M
|
||||
* @date 10:49 2024/11/6
|
||||
* @return cn.iocoder.yudao.module.staff.entity.CompanyStaff
|
||||
**/
|
||||
CompanyStaffRespVO getMyAdviser(Long tenantId,String sysCode);
|
||||
}
|
||||
|
@ -3,9 +3,7 @@ package cn.iocoder.yudao.module.staff.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.BaseConstants;
|
||||
import cn.iocoder.yudao.common.CommonErrorCodeConstants;
|
||||
import cn.iocoder.yudao.common.InviterTypeEnum;
|
||||
import cn.iocoder.yudao.common.*;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
||||
@ -40,6 +38,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -610,4 +609,80 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
|
||||
this.updateBatchById(list);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户查我的邀请人
|
||||
*
|
||||
* @return cn.iocoder.yudao.module.staff.entity.CompanyStaff
|
||||
* @author vinjor-M
|
||||
* @date 10:49 2024/11/6
|
||||
**/
|
||||
@Override
|
||||
public CompanyStaffRespVO getMyAdviser(Long tenantId,String sysCode) {
|
||||
if(null==tenantId){
|
||||
tenantId = 180L;
|
||||
}
|
||||
if(StringUtils.isEmpty(sysCode)){
|
||||
//默认维修业务系统标识
|
||||
sysCode= SystemEnum.REPAIR.getCode();
|
||||
}
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
//员工信息
|
||||
CompanyStaffRespVO staffRespVO = staffMapper.selectMyAdviser(tenantId,userId);
|
||||
if(null!=staffRespVO){
|
||||
//查员工的角色
|
||||
if(sysCode.equals(SystemEnum.REPAIR.getCode())){
|
||||
//维修系统
|
||||
staffRespVO.setRoleName(getUserRoleRepair(staffRespVO.getUserId()));
|
||||
}else if(sysCode.equals(SystemEnum.RESCUE.getCode())){
|
||||
//救援 TODO
|
||||
}else if(sysCode.equals(SystemEnum.INSPECTION.getCode())){
|
||||
//检测 TODO
|
||||
}
|
||||
}
|
||||
return staffRespVO;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @author vinjor-M
|
||||
* @date 11:16 2024/11/6
|
||||
* @param userId 用户ID
|
||||
* @return java.lang.String
|
||||
**/
|
||||
private String getUserRoleRepair(Long userId) {
|
||||
// 当前用户的角色信息
|
||||
List<Long> byUserId = permissionApi.getRoleIdsByUserId(userId);
|
||||
// 所有的角色信息
|
||||
List<RoleReqDTO> roleList = roleApi.getRoleList();
|
||||
// 过滤出登录用户有的角色信息
|
||||
List<RoleReqDTO> collect = roleList.stream().filter(item -> byUserId.contains(item.getId())).collect(Collectors.toList());
|
||||
// 取出角色名称
|
||||
List<String> codes = collect.stream().map(RoleReqDTO::getCode).collect(Collectors.toList());
|
||||
// 维修业务管理员--可以看所有数据,但不能做操作
|
||||
if (codes.contains(RepairRoleEnum.ADMIN.getCode())) {
|
||||
return RepairRoleEnum.ADMIN.getName();
|
||||
}
|
||||
// 总检
|
||||
if (codes.contains(RepairRoleEnum.INSPECTION.getCode())) {
|
||||
return RepairRoleEnum.INSPECTION.getName();
|
||||
}
|
||||
// 服务顾问
|
||||
if (codes.contains(RepairRoleEnum.ADVISOR.getCode())) {
|
||||
return RepairRoleEnum.ADVISOR.getName();
|
||||
}
|
||||
// 维修工(或班组长)
|
||||
if (codes.contains(RepairRoleEnum.REPAIR_STAFF.getCode())) {
|
||||
return RepairRoleEnum.REPAIR_STAFF.getName();
|
||||
}
|
||||
// 维修仓库管理员
|
||||
if (codes.contains(RepairRoleEnum.WAREHOUSE.getCode())) {
|
||||
return RepairRoleEnum.WAREHOUSE.getName();
|
||||
}
|
||||
// 维修财务
|
||||
if (codes.contains(RepairRoleEnum.WXCW.getCode())) {
|
||||
return RepairRoleEnum.WXCW.getName();
|
||||
}
|
||||
// 啥也不是
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
@ -27,4 +27,8 @@ public class CompanyStaffRespVO extends CompanyStaff {
|
||||
* 员工标签
|
||||
**/
|
||||
List<String> labelsArray;
|
||||
/**
|
||||
* 角色名称
|
||||
**/
|
||||
private String roleName;
|
||||
}
|
||||
|
@ -104,4 +104,15 @@
|
||||
</if>
|
||||
order by cs.create_time desc
|
||||
</select>
|
||||
<select id="selectMyAdviser" resultType="cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO">
|
||||
SELECT
|
||||
cs.*
|
||||
FROM
|
||||
base_customer_main bcm
|
||||
LEFT JOIN company_staff cs ON bcm.inviter = cs.user_id AND cs.tenant_id = #{tenantId}
|
||||
WHERE
|
||||
bcm.user_id = #{userId}
|
||||
AND bcm.tenant_id = #{tenantId}
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
@ -409,8 +409,6 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
|
||||
/**
|
||||
* 获取工单详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
@ -126,7 +126,6 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl<PartnerCustomerI
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
|
||||
public int insertPartnerCustomerInfo(PartnerCustomerInfo partnerCustomerInfo) throws Exception {
|
||||
// 获取当前商户信息
|
||||
ShopMallPartners partners = partnerService.shopInfo();
|
||||
|
@ -61,10 +61,23 @@ public enum RecordTypeEnum {
|
||||
TZTL("tztl","通知退料"),
|
||||
/**审批配件申请单*/
|
||||
SPPJSQD("sppjsqd","审批配件申请单"),
|
||||
/**
|
||||
* 添加维修项目
|
||||
*/
|
||||
TJWXXM("tjwxxm", "添加维修项目"),
|
||||
/**
|
||||
* 接单
|
||||
*/
|
||||
jd("jd","接单");
|
||||
jd("jd","接单"),
|
||||
|
||||
/** 作废工单 */
|
||||
ZFGG("zfgg", "作废工单"),
|
||||
|
||||
/** 删除工单 */
|
||||
SCGG("scgg", "删除工单"),
|
||||
|
||||
/** 内返派工 */
|
||||
NFPG("nfpg", "内返派工");
|
||||
|
||||
/**
|
||||
* code
|
||||
|
@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.app.booking.vo;
|
||||
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
|
||||
import cn.iocoder.yudao.module.company.entity.Company;
|
||||
import cn.iocoder.yudao.module.system.api.service.dto.ServicePackageDto;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -20,4 +20,8 @@ public class BookingQueryVO extends DlRepairBooking {
|
||||
|
||||
/** 服务信息 */
|
||||
private ServicePackageDto servicePackage;
|
||||
/** 服务顾问信息 */
|
||||
private AdminUserRespDTO adviser;
|
||||
/** 预约的维修项目名称 */
|
||||
private String repairTypeText;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.app.tickets.controller;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -36,6 +37,7 @@ public class TicketsAPI {
|
||||
**/
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "维修工单表 查看一个工单的详细信息")
|
||||
@TenantIgnore
|
||||
public CommonResult<?> getTicketsById(@RequestParam(value = "id") String id){
|
||||
return success(dlRepairTicketsService.getTicketsById(id));
|
||||
}
|
||||
|
@ -35,4 +35,21 @@ public interface RepairWorkerMapper extends BaseMapper<RepairWorker> {
|
||||
* @date 2024年10月10日
|
||||
**/
|
||||
List<Long> getAllWorkerIds();
|
||||
|
||||
/**
|
||||
* 根据userId查询维修工信息
|
||||
* @author PQZ
|
||||
* @date 17:28 2024/11/4
|
||||
* @param userId 用户id
|
||||
* @return cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO
|
||||
**/
|
||||
RepairWorkerRespVO getByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 查询所有维修工信息
|
||||
* @author PQZ
|
||||
* @date 17:28 2024/11/4
|
||||
* @return cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO
|
||||
**/
|
||||
List<RepairWorkerRespVO> listAllWorker();
|
||||
}
|
||||
|
@ -27,6 +27,15 @@ public interface RepairWorkerService extends IService<RepairWorker> {
|
||||
* @param userList 选中用户集合
|
||||
**/
|
||||
void saveWorkers(List<UserDTO> userList);
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有维修工
|
||||
* @author PQZ
|
||||
* @date 14:07 2024/11/7
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO>
|
||||
**/
|
||||
List<RepairWorkerRespVO> listAllWorker();
|
||||
|
||||
/**
|
||||
* 更新维修工人
|
||||
@ -78,6 +87,17 @@ public interface RepairWorkerService extends IService<RepairWorker> {
|
||||
**/
|
||||
void sentMessage(Long userId,String text);
|
||||
|
||||
/**
|
||||
* 向指定用户发送消息(用户,非员工)
|
||||
*
|
||||
* @author 小李
|
||||
* @date 16:52 2024/11/6
|
||||
* @param ticketId 工单ID
|
||||
* @param text 消息通知内容
|
||||
* @param isSMS 是否需要发短信
|
||||
**/
|
||||
void sentMessageToCus(String ticketId, String text, Boolean isSMS);
|
||||
|
||||
/**
|
||||
* 通过班组长的id查该班组的员工
|
||||
*
|
||||
|
@ -1,26 +1,31 @@
|
||||
package cn.iocoder.yudao.module.base.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.common.RepairRoleEnum;
|
||||
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;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||
import cn.iocoder.yudao.module.base.mapper.RepairRecordsMapper;
|
||||
import cn.iocoder.yudao.module.base.service.RepairRecordsItemService;
|
||||
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.base.vo.RepairWorkerRespVO;
|
||||
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.REPAIR_RECORD_TYPE_RECORD;
|
||||
|
||||
/**
|
||||
* 维修记录 Service 实现类
|
||||
*
|
||||
@ -36,7 +41,11 @@ public class RepairRecordsServiceImpl extends ServiceImpl<RepairRecordsMapper, R
|
||||
private AdminUserApi userApi;
|
||||
@Resource
|
||||
private RepairRecordsItemService itemService;
|
||||
|
||||
@Resource
|
||||
private RepairWorkerService workerService;
|
||||
@Resource
|
||||
@Lazy
|
||||
private PermissionApi permissionApi;
|
||||
|
||||
/**
|
||||
* 保存维修记录
|
||||
@ -80,16 +89,58 @@ public class RepairRecordsServiceImpl extends ServiceImpl<RepairRecordsMapper, R
|
||||
public List<RepairRecordsRespVO> queryList(RepairRecordsPageReqVO pageReqVO) {
|
||||
//根据条件查询维修记录
|
||||
List<RepairRecordsRespVO> list = repairRecordsMapper.queryRepairRecords(pageReqVO);
|
||||
List<Long> userIds = list.stream().map(RepairRecords::getDealUserId).collect(Collectors.toList());
|
||||
//所有维修工
|
||||
List<RepairWorkerRespVO> allWorker = workerService.listAllWorker();
|
||||
//转换成map
|
||||
Map<Long,RepairWorkerRespVO> mapWorker = allWorker.stream().collect(Collectors.toMap(RepairWorker::getUserId,worker -> worker));
|
||||
//用户及角色
|
||||
Map<Long,List<String>> userRoleMap = permissionApi.roleCodesByUserIds(userIds);
|
||||
//为每一条维修记录设置查询附件
|
||||
list.forEach(item -> {
|
||||
List<RepairRecordsItem> itemList = itemService.getByMainId(REPAIR_RECORD_TYPE_RECORD, item.getId(), pageReqVO.getIsOpen());
|
||||
item.setItemList(itemList);
|
||||
String workerName = mapWorker.getOrDefault(item.getDealUserId(),new RepairWorkerRespVO()).getWorkerTypeStr();
|
||||
if (null != workerName) {
|
||||
item.setRoleName(workerName);
|
||||
} else {
|
||||
item.setRoleName(getRoleName(userRoleMap.get(item.getDealUserId())));
|
||||
}
|
||||
//相对路径按照“,”分隔
|
||||
item.setImages(itemList.stream().map(RepairRecordsItem::getImage).collect(Collectors.joining(",")));
|
||||
item.setImages(item.getItemList().stream().map(RepairRecordsItem::getImage).collect(Collectors.joining(",")));
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色匹配名称
|
||||
* @author PQZ
|
||||
* @date 14:52 2024/11/7
|
||||
* @param codes 用户的角色codes集合
|
||||
* @return java.lang.String
|
||||
**/
|
||||
private String getRoleName(List<String> codes) {
|
||||
//维修业务管理员
|
||||
if (codes.contains(RepairRoleEnum.ADMIN.getCode())) {
|
||||
return RepairRoleEnum.ADMIN.getName();
|
||||
}
|
||||
// 总检
|
||||
if (codes.contains(RepairRoleEnum.INSPECTION.getCode())) {
|
||||
return RepairRoleEnum.INSPECTION.getName();
|
||||
}
|
||||
// 服务顾问
|
||||
if (codes.contains(RepairRoleEnum.ADVISOR.getCode())) {
|
||||
return RepairRoleEnum.ADVISOR.getName();
|
||||
}
|
||||
// 维修仓库管理员
|
||||
if (codes.contains(RepairRoleEnum.WAREHOUSE.getCode())) {
|
||||
return RepairRoleEnum.WAREHOUSE.getName();
|
||||
}
|
||||
// 维修财务
|
||||
if (codes.contains(RepairRoleEnum.WXCW.getCode())) {
|
||||
return RepairRoleEnum.WXCW.getName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前用户和工单主表id查询当前在维修的项目信息
|
||||
*
|
||||
|
@ -1,9 +1,10 @@
|
||||
package cn.iocoder.yudao.module.base.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.common.RepairRoleEnum;
|
||||
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.app.controller.admin.NotifyMessageSocket;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||
import cn.iocoder.yudao.module.base.mapper.RepairWorkerMapper;
|
||||
@ -11,13 +12,20 @@ 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.custom.entity.CustomerMain;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
||||
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.notify.NotifyMessageSendApi;
|
||||
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
|
||||
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
||||
import cn.iocoder.yudao.util.SendSmsUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -57,6 +65,21 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
@Resource
|
||||
private DictDataApi dictDataApi;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private RoleApi roleApi;
|
||||
@Resource
|
||||
@Lazy
|
||||
private PermissionApi permissionApi;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private DlRepairTicketsService repairTicketsService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private CustomerMainService customerMainService;
|
||||
|
||||
|
||||
/**
|
||||
* 批量创建维修工人
|
||||
@ -87,6 +110,20 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有维修工
|
||||
*
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO>
|
||||
* @author PQZ
|
||||
* @date 14:07 2024/11/7
|
||||
**/
|
||||
@Override
|
||||
public List<RepairWorkerRespVO> listAllWorker() {
|
||||
return workerMapper.listAllWorker();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWorker(RepairWorkerSaveReqVO updateReqVO) {
|
||||
// 更新
|
||||
@ -115,12 +152,12 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
**/
|
||||
@Override
|
||||
public IPage<RepairWorkerRespVO> queryListPage(RepairWorkerPageReqVO pageReqVO, Page<RepairWorkerRespVO> page) {
|
||||
IPage<RepairWorkerRespVO> respVOIPage= workerMapper.queryListPage(pageReqVO, page);
|
||||
if(!respVOIPage.getRecords().isEmpty()){
|
||||
IPage<RepairWorkerRespVO> respVOIPage = workerMapper.queryListPage(pageReqVO, page);
|
||||
if (!respVOIPage.getRecords().isEmpty()) {
|
||||
// 单位字典
|
||||
List<DictDataRespDTO> recordTypeList = dictDataApi.getDictDataList(DICT_REPAIR_WORK_TYPE);
|
||||
Map<String,String> typeMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
|
||||
respVOIPage.getRecords().stream().peek(item->item.setWorkTypeText(typeMap.get(item.getWorkType()))).collect(Collectors.toList());
|
||||
Map<String, String> typeMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel));
|
||||
respVOIPage.getRecords().stream().peek(item -> item.setWorkTypeText(typeMap.get(item.getWorkType()))).collect(Collectors.toList());
|
||||
}
|
||||
return respVOIPage;
|
||||
}
|
||||
@ -143,11 +180,11 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
// 取所有的员工ID
|
||||
Set<String> ids = titems.stream().flatMap(item -> Arrays.stream(item.getRepairIds().split(","))).collect(Collectors.toSet());
|
||||
List<RepairWorker> repairWorkerList = baseMapper.selectList(new LambdaQueryWrapper<RepairWorker>().in(RepairWorker::getUserId, ids));
|
||||
if(!repairWorkerList.isEmpty()){
|
||||
if (!repairWorkerList.isEmpty()) {
|
||||
// 单位字典
|
||||
List<DictDataRespDTO> recordTypeList = dictDataApi.getDictDataList(DICT_REPAIR_WORK_TYPE);
|
||||
Map<String,String> typeMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
|
||||
repairWorkerList.stream().peek(item->item.setWorkTypeText(typeMap.get(item.getWorkType()))).collect(Collectors.toList());
|
||||
Map<String, String> typeMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel));
|
||||
repairWorkerList.stream().peek(item -> item.setWorkTypeText(typeMap.get(item.getWorkType()))).collect(Collectors.toList());
|
||||
}
|
||||
//翻译工种
|
||||
return repairWorkerList;
|
||||
@ -166,7 +203,7 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
public void sentMessage(Long userId, String text) {
|
||||
try {
|
||||
//获取当前登录用户
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
// LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
// 准备发送参数
|
||||
Map<String, Object> templateParams = new HashMap<>();
|
||||
// 发送模版内容
|
||||
@ -175,8 +212,45 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
sendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
||||
.setUserId(userId)
|
||||
.setTemplateCode(TICKET_EMPLOY).setTemplateParams(templateParams));
|
||||
//发送语音提醒---小李---通过租户上下文去取租户ID
|
||||
// notifyMessageSocket.sendMessage(text, loginUser.getTenantId().toString(), userId.toString());
|
||||
notifyMessageSocket.sendMessage(text, TenantContextHolder.getRequiredTenantId().toString(), userId.toString());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定用户发送消息(用户,非员工)
|
||||
*
|
||||
* @author 小李
|
||||
* @date 16:52 2024/11/6
|
||||
* @param ticketId 工单ID
|
||||
* @param text 消息通知内容
|
||||
* @param isSMS 是否需要发短信
|
||||
**/
|
||||
@Override
|
||||
public void sentMessageToCus(String ticketId, String text, Boolean isSMS) {
|
||||
try {
|
||||
// 获取工单
|
||||
DlRepairTickets tickets = repairTicketsService.getById(ticketId);
|
||||
// 获取用户信息
|
||||
CustomerMain customerMain = customerMainService.getById(tickets.getUserId());
|
||||
// 准备发送参数
|
||||
Map<String, Object> templateParams = new HashMap<>();
|
||||
// 发送模版内容
|
||||
templateParams.put("text", text);
|
||||
// 发送站内信
|
||||
sendApi.sendSingleMessageToMember(new NotifySendSingleToUserReqDTO()
|
||||
.setUserId(customerMain.getUserId())
|
||||
.setTemplateCode(TICKET_EMPLOY).setTemplateParams(templateParams));
|
||||
//发送语音提醒
|
||||
notifyMessageSocket.sendMessage(text, loginUser.getTenantId().toString(), userId.toString());
|
||||
notifyMessageSocket.sendMessage(text, TenantContextHolder.getRequiredTenantId().toString(), String.valueOf(customerMain.getUserId()));
|
||||
|
||||
// 发送短信
|
||||
if (isSMS) {
|
||||
SendSmsUtil.sendMsgCommon(new String[]{text}, customerMain.getPhoneNumber(), "1400852709", "蓝安汽车小程序", "2143603");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -16,5 +16,8 @@ public class RepairRecordsRespVO extends RepairRecords {
|
||||
private List<RepairRecordsItem> itemList;
|
||||
/**维修记录关联附件信息*/
|
||||
private String images;
|
||||
|
||||
/**角色、岗位名称*/
|
||||
private String roleName;
|
||||
/**项目名称*/
|
||||
private String projectName;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import lombok.Data;
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class RepairWorkerRespVO extends RepairWorker {
|
||||
|
||||
private String workerTypeStr;
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,17 +1,25 @@
|
||||
package cn.iocoder.yudao.module.booking.controller.admin;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
|
||||
import cn.iocoder.yudao.module.booking.service.DlRepairBookingService;
|
||||
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingReqVO;
|
||||
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingRespVO;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_TYPE;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
@ -28,6 +36,9 @@ public class DlRepairBookingController {
|
||||
*/
|
||||
@Resource
|
||||
private DlRepairBookingService dlRepairBookingService;
|
||||
@Resource
|
||||
private DictDataApi dictDataApi;
|
||||
|
||||
|
||||
/**
|
||||
* 维修预约表 新增、修改
|
||||
@ -92,9 +103,21 @@ public class DlRepairBookingController {
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "维修预约表 不分页")
|
||||
public CommonResult<?> getBookingList(@RequestParam("userId")Integer userId){
|
||||
return success(dlRepairBookingService.list(new LambdaQueryWrapper<DlRepairBooking>()
|
||||
//维修项目类型字典
|
||||
List<DictDataRespDTO> repairTypeList = dictDataApi.getDictDataList(DICT_REPAIR_TYPE);
|
||||
Map<String,String> repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
|
||||
List<DlRepairBooking> respVOList = dlRepairBookingService.list(new LambdaQueryWrapper<DlRepairBooking>()
|
||||
.eq(DlRepairBooking::getUserId,userId)
|
||||
.orderByDesc(DlRepairBooking::getBookingTime)));
|
||||
.isNull(DlRepairBooking::getTicketsId)
|
||||
.orderByDesc(DlRepairBooking::getBookingTime));
|
||||
List<DlRepairBookingRespVO> rtnList = new ArrayList<>();
|
||||
for(DlRepairBooking booking:respVOList){
|
||||
DlRepairBookingRespVO newEntity = new DlRepairBookingRespVO();
|
||||
BeanUtil.copyProperties(booking,newEntity);
|
||||
newEntity.setRepairText(repairTypeMap.get(newEntity.getRepairType()));
|
||||
rtnList.add(newEntity);
|
||||
}
|
||||
return success(rtnList);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,10 @@ public class DlRepairBooking extends TenantBaseDO {
|
||||
* 项目ID(查PC服务分类的一级项目的ID)
|
||||
*/
|
||||
private String projectId;
|
||||
/**
|
||||
* 预约服务项目(字典repair_type)
|
||||
*/
|
||||
private String repairType;
|
||||
|
||||
/**
|
||||
* 车辆信息(base_car_main的id)
|
||||
|
@ -3,10 +3,13 @@ package cn.iocoder.yudao.module.booking.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.RepairRoleEnum;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.app.booking.vo.BookingQueryVO;
|
||||
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
|
||||
import cn.iocoder.yudao.module.booking.mapper.DlRepairBookingMapper;
|
||||
import cn.iocoder.yudao.module.booking.service.DlRepairBookingService;
|
||||
@ -15,22 +18,33 @@ import cn.iocoder.yudao.module.booking.vo.DlRepairBookingReqVO;
|
||||
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingRespVO;
|
||||
import cn.iocoder.yudao.module.company.entity.Company;
|
||||
import cn.iocoder.yudao.module.company.service.CompanyService;
|
||||
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.permission.RoleApi;
|
||||
import cn.iocoder.yudao.module.system.api.service.ServicePackageApi;
|
||||
import cn.iocoder.yudao.module.system.api.service.dto.ServicePackageDto;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
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.apache.catalina.User;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_TYPE;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_booking(维修预约表)】的数据库操作Service实现
|
||||
*
|
||||
@ -44,12 +58,19 @@ public class DlRepairBookingServiceImpl extends ServiceImpl<DlRepairBookingMappe
|
||||
@Resource
|
||||
@Lazy
|
||||
private CompanyService companyService;
|
||||
@Resource
|
||||
private DictDataApi dictDataApi;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private ServicePackageApi servicePackageApi;
|
||||
@Autowired
|
||||
private RoleApi roleApi;
|
||||
@Autowired
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Resource
|
||||
private RepairWorkerService repairWorkerService;
|
||||
|
||||
/**
|
||||
* 维修预约表 新增、修改
|
||||
@ -59,7 +80,33 @@ public class DlRepairBookingServiceImpl extends ServiceImpl<DlRepairBookingMappe
|
||||
* @param repairBookingRespVO 预约对象
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void updateBooking(DlRepairBookingRespVO repairBookingRespVO){
|
||||
// 构建消息
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
||||
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList("repair_type");
|
||||
DictDataRespDTO dictDataRespDTO = dataList.stream().filter(item -> item.getValue().equals(repairBookingRespVO.getRepairType())).findFirst().orElse(null);
|
||||
String message = String.format(
|
||||
"%s(%s)预约了%s的%s",
|
||||
repairBookingRespVO.getUserName(),
|
||||
repairBookingRespVO.getUserMobile(),
|
||||
formatter.format(repairBookingRespVO.getBookingTime()),
|
||||
dictDataRespDTO != null ? dictDataRespDTO.getLabel() : "维修保养"
|
||||
);
|
||||
|
||||
// 选择了服务顾问
|
||||
if (ObjectUtil.isNotEmpty(repairBookingRespVO.getAdviserId())){
|
||||
// 发送消息通知
|
||||
repairWorkerService.sentMessage(Long.valueOf(repairBookingRespVO.getAdviserId()), message + ",预约的服务顾问为:" + repairBookingRespVO.getAdviserName());
|
||||
}else {
|
||||
// 没选服务顾问
|
||||
// 获取所有的服务顾问
|
||||
List<UserDTO> allServicer = getAllServicer(TenantContextHolder.getRequiredTenantId());
|
||||
// 发送消息通知
|
||||
allServicer.forEach(item -> repairWorkerService.sentMessage(item.getId(), message));
|
||||
}
|
||||
|
||||
// 正常的新增、修改
|
||||
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
||||
Optional.ofNullable(loginUserId).ifPresent(repairBookingRespVO::setUserId);
|
||||
repairBookingRespVO.setBookingStatus("01");
|
||||
@ -118,6 +165,18 @@ public class DlRepairBookingServiceImpl extends ServiceImpl<DlRepairBookingMappe
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<DlRepairBooking> dlRepairBookings = baseMapper.selectBatchIds(ids);
|
||||
//所有服务顾问ID
|
||||
List<Long> adviserIdList = new ArrayList<>();
|
||||
Map<Long,AdminUserRespDTO> userMap = new HashMap<>();
|
||||
dlRepairBookings.forEach(item->{
|
||||
if(StringUtils.isNotEmpty(item.getAdviserId())){
|
||||
adviserIdList.add(Long.valueOf(item.getAdviserId()));
|
||||
}
|
||||
});
|
||||
if(!adviserIdList.isEmpty()){
|
||||
List<AdminUserRespDTO> userDOList = adminUserApi.getUserList(adviserIdList);
|
||||
userMap = userDOList.stream().collect(Collectors.toMap(AdminUserRespDTO::getId, Function.identity()));
|
||||
}
|
||||
List<BookingQueryVO> result = dlRepairBookings.stream().map(item -> BeanUtil.toBean(item, BookingQueryVO.class)).collect(Collectors.toList());
|
||||
// 查企业
|
||||
Set<String> companyIds = result.stream().map(BookingQueryVO::getCorpId).collect(Collectors.toSet());
|
||||
@ -125,10 +184,20 @@ public class DlRepairBookingServiceImpl extends ServiceImpl<DlRepairBookingMappe
|
||||
// 查服务
|
||||
Set<String> serviceIds = result.stream().map(BookingQueryVO::getProjectId).collect(Collectors.toSet());
|
||||
List<ServicePackageDto> servicePackageByIds = servicePackageApi.getServicePackageByIds(new ArrayList<>(serviceIds));
|
||||
//维修项目类型字典
|
||||
List<DictDataRespDTO> repairTypeList = dictDataApi.getDictDataList(DICT_REPAIR_TYPE);
|
||||
Map<String,String> repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
|
||||
// 映射
|
||||
Map<Long, AdminUserRespDTO> finalUserMap = userMap;
|
||||
result.forEach(item -> {
|
||||
companies.stream().filter(i -> i.getId().equals(item.getCorpId())).findFirst().ifPresent(item::setCompany);
|
||||
servicePackageByIds.stream().filter(i -> i.getId().equals(item.getProjectId())).findFirst().ifPresent(item::setServicePackage);
|
||||
if(StringUtils.isNotEmpty(item.getAdviserId())){
|
||||
item.setAdviser(finalUserMap.get(Long.valueOf(item.getAdviserId())));
|
||||
}
|
||||
if(StringUtils.isNotEmpty(item.getRepairType())){
|
||||
item.setRepairTypeText(repairTypeMap.get(item.getRepairType()));
|
||||
}
|
||||
});
|
||||
return result.stream().sorted(Comparator.comparing(BookingQueryVO::getCreateTime).reversed()).collect(Collectors.toList());
|
||||
}
|
||||
|
@ -11,4 +11,5 @@ import lombok.Data;
|
||||
**/
|
||||
@Data
|
||||
public class DlRepairBookingRespVO extends DlRepairBooking {
|
||||
private String repairText;
|
||||
}
|
||||
|
@ -97,8 +97,8 @@ public class DlRepairSoController {
|
||||
**/
|
||||
@GetMapping("/confirmGet")
|
||||
@Operation(summary = "员工确认领料")
|
||||
public CommonResult<?> confirmGet(@RequestParam("id") String id) {
|
||||
dlRepairSoService.confirmGet(id);
|
||||
public CommonResult<?> confirmGet(@RequestParam("id") String id, @RequestParam(value = "image", required = false) String image) {
|
||||
dlRepairSoService.confirmGet(id, image);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
@ -111,8 +111,8 @@ public class DlRepairSoController {
|
||||
**/
|
||||
@GetMapping("/confirmBack")
|
||||
@Operation(summary = "员工确认退料")
|
||||
public CommonResult<?> confirmBack(@RequestParam("id") String id) {
|
||||
dlRepairSoService.confirmBack(id);
|
||||
public CommonResult<?> confirmBack(@RequestParam("id") String id, @RequestParam(value = "image", required = false) String image) {
|
||||
dlRepairSoService.confirmBack(id, image);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public interface DlRepairSoService extends IService<DlRepairSo> {
|
||||
* @author 小李
|
||||
* @date 11:58 2024/10/21
|
||||
**/
|
||||
void confirmGet(String id);
|
||||
void confirmGet(String id, String image);
|
||||
|
||||
/**
|
||||
* 员工确认退料
|
||||
@ -67,7 +67,7 @@ public interface DlRepairSoService extends IService<DlRepairSo> {
|
||||
* @author 小李
|
||||
* @date 19:41 2024/10/21
|
||||
**/
|
||||
void confirmBack(String id);
|
||||
void confirmBack(String id, String image);
|
||||
|
||||
/**
|
||||
* 采购入库
|
||||
|
@ -3,9 +3,11 @@ package cn.iocoder.yudao.module.stockOperate.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.RepairErrorCodeConstants;
|
||||
import cn.iocoder.yudao.common.SoStatusEnum;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
||||
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||
import cn.iocoder.yudao.module.company.entity.Company;
|
||||
import cn.iocoder.yudao.module.company.service.CompanyService;
|
||||
@ -99,6 +101,10 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
@Lazy
|
||||
private RepairWaresService repairWaresService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private RepairRecordsService recordsService;
|
||||
|
||||
/**
|
||||
* 采购单/领料单 新增
|
||||
*
|
||||
@ -236,11 +242,9 @@ 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.setWaresCouldCount(item.getWaresCouldCount() + repairSoiByTwItem.getGoodsCount());
|
||||
dlTwItem.setWaresStatus("02");
|
||||
}else {
|
||||
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() + repairSoiByTwItem.getGoodsCount());
|
||||
dlTwItem.setWaresCouldCount(item.getWaresCouldCount() - repairSoiByTwItem.getGoodsCount());
|
||||
}
|
||||
});
|
||||
newTwItems.add(dlTwItem);
|
||||
@ -252,9 +256,11 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
sois.stream().filter(i -> i.getGoodsId().equals(wares.getId())).findFirst().ifPresent(repairSoiByWares -> {
|
||||
if (so.getSoType().equals("02")){
|
||||
wares.setStock(item.getStock().add(BigDecimal.valueOf(repairSoiByWares.getGoodsCount())));
|
||||
}else {
|
||||
wares.setStock(item.getStock().subtract(BigDecimal.valueOf(repairSoiByWares.getGoodsCount())));
|
||||
}
|
||||
// 采购改了入库逻辑,不能在这里扣库存
|
||||
// else {
|
||||
// wares.setStock(item.getStock().subtract(BigDecimal.valueOf(repairSoiByWares.getGoodsCount())));
|
||||
// }
|
||||
});
|
||||
newWares.add(wares);
|
||||
});
|
||||
@ -309,53 +315,15 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void confirmGet(String id) {
|
||||
// 查子表
|
||||
List<DlRepairSoi> sois = repairSoiService
|
||||
.list(new LambdaQueryWrapper<DlRepairSoi>()
|
||||
.eq(DlRepairSoi::getSoId, id)
|
||||
);
|
||||
// 查库存---生成领料单的时候更新了
|
||||
// List<RepairWares> wares = waresService
|
||||
// .list(new LambdaQueryWrapper<RepairWares>()
|
||||
// .in(RepairWares::getId, sois.stream()
|
||||
// .map(DlRepairSoi::getGoodsId)
|
||||
// .collect(Collectors.toList())
|
||||
// ));
|
||||
// // 更新库存
|
||||
// List<RepairWares> newWares = wares.stream().map(item -> {
|
||||
// RepairWares ware = new RepairWares();
|
||||
// ware.setId(item.getId());
|
||||
// sois.stream().filter(i -> i.getGoodsId().equals(item.getId())).findFirst().ifPresent(i -> {
|
||||
// ware.setStock(item.getStock().subtract(BigDecimal.valueOf(i.getGoodsCount())));
|
||||
// });
|
||||
// return ware;
|
||||
// }).collect(Collectors.toList());
|
||||
// waresService.updateBatchById(newWares);
|
||||
public void confirmGet(String id, String image) {
|
||||
// 更新主表状态 为已领料
|
||||
DlRepairSo dlRepairSo = new DlRepairSo();
|
||||
dlRepairSo.setId(id);
|
||||
dlRepairSo.setSoStatus(SoStatusEnum.PICKED.getCode());
|
||||
baseMapper.updateById(dlRepairSo);
|
||||
|
||||
// 更新申请表的数据----生成领料单的时候更新了
|
||||
// // 查申请表的子表对应的配件信息
|
||||
// List<DlTwItem> twItems = twItemService.list(new LambdaQueryWrapper<DlTwItem>().and(item -> {
|
||||
// item.eq(DlTwItem::getTwId, so.getTwId())
|
||||
// .in(DlTwItem::getWaresId, sois.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList()));
|
||||
// }));
|
||||
// // 更新子表
|
||||
// List<DlTwItem> newTwItems = twItems.stream().map(item -> {
|
||||
// DlTwItem dlTwItem = new DlTwItem();
|
||||
// dlTwItem.setId(item.getId());
|
||||
// dlTwItem.setWaresAlreadyCount(ObjectUtil.isNotEmpty(item.getWaresAlreadyCount()) ? item.getWaresAlreadyCount() + item.getWaresCouldCount() : item.getWaresCouldCount());
|
||||
// dlTwItem.setWaresStatus(dlTwItem.getWaresAlreadyCount().equals(item.getWaresCount()) ? "01" : item.getWaresStatus());
|
||||
// return dlTwItem;
|
||||
// }).collect(Collectors.toList());
|
||||
// twItemService.updateBatchById(newTwItems);
|
||||
|
||||
// 查最新的子表信息
|
||||
DlRepairSo so = baseMapper.selectOne(new LambdaQueryWrapper<DlRepairSo>().eq(DlRepairSo::getId, id));
|
||||
DlRepairSo so = baseMapper.selectById(id);
|
||||
List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, so.getTwId()));
|
||||
// 判断是部分完成还是全部完成
|
||||
DlTicketWares dlTicketWares = new DlTicketWares();
|
||||
@ -365,10 +333,22 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
// 更新主表的状态
|
||||
ticketWaresService.updateById(dlTicketWares);
|
||||
|
||||
// 查主表记录
|
||||
DlRepairSo newSo = baseMapper.selectById(id);
|
||||
// 通知仓库
|
||||
repairWorkerService.sentMessage(Long.valueOf(newSo.getCreator()), newSo.getUserName() + "已确认领料单:" + newSo.getSoNo());
|
||||
repairWorkerService.sentMessage(Long.valueOf(so.getCreator()), so.getUserName() + "已确认领料单:" + so.getSoNo());
|
||||
|
||||
// 记录日志
|
||||
// 查配件申请表
|
||||
DlTicketWares byId = ticketWaresService.getById(so.getTwId());
|
||||
// 取当前操作人的名称
|
||||
String remark = SecurityFrameworkUtils.getLoginUserNickname();
|
||||
// 构建备注
|
||||
/*
|
||||
谁,领了什么配件,领了多少个
|
||||
*/
|
||||
List<String> nameAndCount = list.stream().map(item -> item.getWaresName() + "x" + item.getWaresCount()).collect(Collectors.toList());
|
||||
remark += "确认领料" + String.join(";", nameAndCount);
|
||||
// 记录日志
|
||||
recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.LL.getCode(), remark, image);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -380,105 +360,31 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void confirmBack(String id) {
|
||||
public void confirmBack(String id, String image) {
|
||||
// 更新主表
|
||||
baseMapper.update(new LambdaUpdateWrapper<DlRepairSo>()
|
||||
.set(DlRepairSo::getSoStatus, SoStatusEnum.RETURNED.getCode())
|
||||
.eq(DlRepairSo::getId, id)
|
||||
);
|
||||
// 更新配件申请表----生成退料单的时候更新了
|
||||
// DlRepairSo so = baseMapper.selectOne(new LambdaQueryWrapper<DlRepairSo>().eq(DlRepairSo::getId, id));
|
||||
// // 查配件退料表子表
|
||||
// List<DlRepairSoi> sois = repairSoiService.list(new LambdaQueryWrapper<DlRepairSoi>().eq(DlRepairSoi::getSoId, so.getId()));
|
||||
// // 查申请表子表
|
||||
// List<DlTwItem> twItems = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, so.getTwId()));
|
||||
// // 得到需要更新的数据
|
||||
// List<DlTwItem> newTwItems = twItems.stream().map(item -> {
|
||||
// DlTwItem dlTwItem = new DlTwItem();
|
||||
// dlTwItem.setId(item.getId());
|
||||
// sois.stream().filter(i -> i.getGoodsId().equals(item.getWaresId())).findFirst().ifPresent(i -> {
|
||||
// dlTwItem.setWaresBackCount(
|
||||
// ObjectUtil.isNotEmpty(item.getWaresBackCount())
|
||||
// ? item.getWaresCount() + item.getWaresBackCount()
|
||||
// : i.getGoodsCount());
|
||||
// // 如果退料数就是领料申请数,那就是全退了
|
||||
// if (i.getGoodsCount().equals(dlTwItem.getWaresCount())) {
|
||||
// dlTwItem.setWaresStatus("03");
|
||||
// }
|
||||
// });
|
||||
// return dlTwItem;
|
||||
// }).collect(Collectors.toList());
|
||||
// twItemService.updateBatchById(newTwItems);
|
||||
// // 更新库存
|
||||
// // 查库存
|
||||
// List<RepairWares> wares = waresService.list(new LambdaQueryWrapper<RepairWares>().in(RepairWares::getId, sois.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList())));
|
||||
// // 构建新数据
|
||||
// List<RepairWares> newWares = wares.stream().map(item -> {
|
||||
// RepairWares ware = new RepairWares();
|
||||
// ware.setId(item.getId());
|
||||
// sois.stream().filter(i -> i.getGoodsId().equals(item.getId())).findFirst().ifPresent(i -> {
|
||||
// ware.setStock(item.getStock().add(BigDecimal.valueOf(i.getGoodsCount())));
|
||||
// });
|
||||
// return ware;
|
||||
// }).collect(Collectors.toList());
|
||||
// waresService.updateBatchById(newWares);
|
||||
|
||||
// 更新维修工单----最后完成工单的时候来更新
|
||||
// // 查配件退料表子表
|
||||
// List<DlRepairSoi> sois = repairSoiService.list(new LambdaQueryWrapper<DlRepairSoi>().eq(DlRepairSoi::getSoId, so.getId()));
|
||||
// // 查申请表主表
|
||||
// DlTicketWares ticketWares = ticketWaresService.getOne(new LambdaQueryWrapper<DlTicketWares>().eq(DlTicketWares::getId, so.getTwId()));
|
||||
// // 查维修工单子表为配件的数据
|
||||
// List<DlRepairTitem> titems = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(item -> {
|
||||
// item.eq(DlRepairTitem::getTicketId, ticketWares.getTicketId())
|
||||
// .eq(DlRepairTitem::getItemType, "02")
|
||||
// .in(DlRepairTitem::getPartId, sois.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList()));
|
||||
// }));
|
||||
// // 构建新数据,更新维修工单子表
|
||||
// List<DlRepairTitem> newTitems = titems.stream().map(item -> {
|
||||
// DlRepairTitem titem = new DlRepairTitem();
|
||||
// titem.setId(item.getId());
|
||||
// sois.stream().filter(i -> i.getGoodsId().equals(item.getPartId())).findFirst().ifPresent(i -> {
|
||||
// titem.setItemCount(item.getItemCount() - i.getGoodsCount());
|
||||
// BigDecimal itemDiscount = ObjectUtil.isNotEmpty(item.getItemDiscount()) ? item.getItemDiscount() : BigDecimal.ONE;
|
||||
// titem.setItemMoney(new BigDecimal(titem.getItemCount()).multiply(item.getItemPrice()).multiply(itemDiscount));
|
||||
// });
|
||||
// return titem;
|
||||
// }).collect(Collectors.toList());
|
||||
// // 分开全部退料了的和没有全部退料的数据
|
||||
// List<DlRepairTitem> delTitems = newTitems.stream().filter(item -> item.getItemCount() == 0).collect(Collectors.toList());
|
||||
// if (CollectionUtil.isEmpty(delTitems)) {
|
||||
// titemService.updateBatchById(newTitems);
|
||||
// } else {
|
||||
// titemService.removeBatchByIds(delTitems);
|
||||
// List<DlRepairTitem> updateTitems = newTitems.stream().filter(item -> !delTitems.contains(item)).collect(Collectors.toList());
|
||||
// if (CollectionUtil.isEmpty(updateTitems)) {
|
||||
// titemService.updateBatchById(updateTitems);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// // 更新维修工单
|
||||
// DlRepairTickets tickets = ticketsService.getOne(new LambdaQueryWrapper<DlRepairTickets>().eq(DlRepairTickets::getId, ticketWares.getTicketId()));
|
||||
// // 查最新的子表信息
|
||||
// List<DlRepairTitem> list = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().in(DlRepairTitem::getTicketId, tickets.getId()));
|
||||
// // 计算工单总子项、工单配件总价、工单总价
|
||||
// DlRepairTickets newTickets = new DlRepairTickets();
|
||||
// newTickets.setId(tickets.getId());
|
||||
// newTickets.setCount(list.stream().mapToInt(DlRepairTitem::getItemCount).sum());
|
||||
// newTickets.setPartPrice(list.stream()
|
||||
// .filter(item -> item.getItemType().equals("02"))
|
||||
// .map(DlRepairTitem::getItemMoney)
|
||||
// .reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
// BigDecimal projectPrice = tickets.getProjectPrice() == null ? BigDecimal.ZERO : tickets.getProjectPrice();
|
||||
// BigDecimal otherPrice = tickets.getOtherPrice() != null ? tickets.getOtherPrice() : BigDecimal.ZERO;
|
||||
// BigDecimal partPrice = newTickets.getPartPrice() == null ? BigDecimal.ZERO : newTickets.getPartPrice();
|
||||
// newTickets.setTotalPrice(projectPrice.add(partPrice).add(otherPrice));
|
||||
// ticketsService.updateById(newTickets);
|
||||
|
||||
// 查主表
|
||||
DlRepairSo newSo = baseMapper.selectById(id);
|
||||
// 通知仓库
|
||||
repairWorkerService.sentMessage(Long.valueOf(newSo.getCreator()), newSo.getUserName() + "已确认退料单:" + newSo.getSoNo());
|
||||
// 记录日志
|
||||
// 查子表信息
|
||||
List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, newSo.getTwId()));
|
||||
// 查申请表
|
||||
DlTicketWares byId = ticketWaresService.getById(newSo.getTwId());
|
||||
// 取当前操作人的名称
|
||||
String remark = SecurityFrameworkUtils.getLoginUserNickname();
|
||||
// 构建备注
|
||||
/*
|
||||
谁,退了什么配件,退了多少个
|
||||
*/
|
||||
List<String> nameAndCount = list.stream().map(item -> item.getWaresName() + "(" + item.getWaresCount() + ")").collect(Collectors.toList());
|
||||
remark += "确认退料" + String.join(",", nameAndCount);
|
||||
// 记录日志
|
||||
recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.TL.getCode(), remark, image);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -200,8 +200,10 @@ public class DlRepairTicketsController {
|
||||
**/
|
||||
@GetMapping("/take")
|
||||
@Operation(summary = "接单")
|
||||
public CommonResult<?> updateTake(@RequestParam("id") String id) {
|
||||
dlRepairTicketsService.updateTake(id);
|
||||
public CommonResult<?> updateTake(@RequestParam("id") String id,
|
||||
@RequestParam(value="image",required = false) String image,
|
||||
@RequestParam(value="remark",required = false) String remark) {
|
||||
dlRepairTicketsService.updateTake(id,image);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,27 @@
|
||||
package cn.iocoder.yudao.module.tickets.controller.admin;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.common.RecordTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
||||
import cn.iocoder.yudao.module.tickets.vo.AddProjVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO;
|
||||
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;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.ok;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
@ -30,6 +40,10 @@ public class DlRepairTitemController {
|
||||
*/
|
||||
@Resource
|
||||
private DlRepairTitemService dlRepairTitemService;
|
||||
@Resource
|
||||
private DlRepairTicketsService dlRepairTicketsService;
|
||||
@Resource
|
||||
private RepairRecordsService repairRecordsService;
|
||||
|
||||
/**
|
||||
* 维修工单子表 分页
|
||||
@ -77,13 +91,25 @@ public class DlRepairTitemController {
|
||||
* 更新工单子表,维修项目配件的单价、数量、折扣、单项总价等
|
||||
* @author vinjor-M
|
||||
* @date 16:10 2024/10/31
|
||||
* @param itemList 工单子表列表
|
||||
* @param addProjVO 工单子表列表
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@PutMapping("/updateRepairItem")
|
||||
@Operation(summary = "修改维修工单子表的维修人员和销售人员信息")
|
||||
public CommonResult<?> updateRepairItem(@RequestBody List<DlRepairTitem> itemList){
|
||||
dlRepairTitemService.updateRepairItem(itemList);
|
||||
public CommonResult<?> updateRepairItem(@RequestBody AddProjVO addProjVO){
|
||||
//删除项目
|
||||
if(null!=addProjVO.getDelProjIdList() && !addProjVO.getDelProjIdList().isEmpty()){
|
||||
dlRepairTitemService.removeBatchByIds(addProjVO.getDelProjIdList());
|
||||
//更新主表的id
|
||||
DlRepairTickets repairTickets = new DlRepairTickets();
|
||||
repairTickets.setId(addProjVO.getTicketId());
|
||||
repairTickets.setUpdateTime(LocalDateTime.now());
|
||||
dlRepairTicketsService.updateById(repairTickets);
|
||||
}
|
||||
if(!addProjVO.getItemList().isEmpty()){
|
||||
//更新项目
|
||||
dlRepairTitemService.updateRepairItem(addProjVO.getItemList());
|
||||
}
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ -113,6 +139,41 @@ public class DlRepairTitemController {
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加维修项目
|
||||
* @author vinjor-M
|
||||
* @date 14:28 2024/11/4
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@PostMapping("/addNewProj")
|
||||
@Operation(summary = "添加维修项目")
|
||||
public CommonResult<?> addNewProj(@RequestBody AddProjVO addProjVO){
|
||||
//获取当前登录用户
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
addProjVO.getItemList().forEach(item->{
|
||||
if(null==item.getSaleId()){
|
||||
//默认销售人员是当前用户
|
||||
item.setSaleId(loginUser.getId());
|
||||
item.setSaleName(loginUser.getInfo().get("nickname"));
|
||||
}
|
||||
});
|
||||
dlRepairTitemService.saveBatch(addProjVO.getItemList());
|
||||
//更新主表的更新时间
|
||||
DlRepairTickets repairTickets = new DlRepairTickets();
|
||||
repairTickets.setId(addProjVO.getItemList().get(0).getTicketId());
|
||||
repairTickets.setUpdateTime(LocalDateTime.now());
|
||||
dlRepairTicketsService.updateById(repairTickets);
|
||||
|
||||
List<String> projNameList = addProjVO.getItemList().stream().map(DlRepairTitem::getItemName).collect(Collectors.toList());
|
||||
//最后记录操作日志--创建工单
|
||||
String remark = "添加维修项目"+String.join(", ",projNameList )+"。";
|
||||
if(StringUtils.isNotEmpty(addProjVO.getRemark())){
|
||||
remark += "备注:"+addProjVO.getRemark();
|
||||
}
|
||||
repairRecordsService.saveRepairRecord(addProjVO.getItemList().get(0).getTicketId(), null, RecordTypeEnum.TJWXXM.getCode(), remark, addProjVO.getImage());
|
||||
return CommonResult.success(addProjVO.getItemList().get(0).getTicketId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修工单单个子项
|
||||
*
|
||||
@ -126,5 +187,17 @@ public class DlRepairTitemController {
|
||||
dlRepairTitemService.removeItemById(id);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查某工单维修项目进度
|
||||
* @author vinjor-M
|
||||
* @date 10:57 2024/11/5
|
||||
* @param ticketId 工单id
|
||||
**/
|
||||
@GetMapping("/getProjList")
|
||||
@Operation(summary = "查某工单维修项目进度")
|
||||
public CommonResult<?> getProjList(@RequestParam("ticketId") String ticketId){
|
||||
return success(dlRepairTitemService.getProjList(ticketId,null));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ public class DlTicketWaresController {
|
||||
|
||||
/**
|
||||
* 员工确认领料
|
||||
*
|
||||
* 弃用
|
||||
* @author 小李
|
||||
* @date 22:07 2024/10/16
|
||||
* @param respVO 请求对象
|
||||
@ -145,7 +145,7 @@ public class DlTicketWaresController {
|
||||
|
||||
/**
|
||||
* 仓库确认退料
|
||||
*
|
||||
* 弃用
|
||||
* @author 小李
|
||||
* @date 22:03 2024/10/17
|
||||
* @param respVO 请求对象
|
||||
|
@ -41,22 +41,5 @@ public class DlTwItemController {
|
||||
public CommonResult<?> listTwItem(DlTwItemReqVO reqVO){
|
||||
return success(dlTwItemService.listTwItem(reqVO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 配件客户是否可见
|
||||
*
|
||||
* @author 小李
|
||||
* @date 17:55 2024/10/15
|
||||
* @param reqVO 请求对象
|
||||
**/
|
||||
@GetMapping("/isShow")
|
||||
@Operation(summary = "配件客户是否可见")
|
||||
public CommonResult<?> updateIsShow(DlTwItemReqVO reqVO){
|
||||
DlTwItem dlTwItem = new DlTwItem();
|
||||
dlTwItem.setIsShow(reqVO.getIsShow());
|
||||
dlTwItem.setId(reqVO.getId());
|
||||
dlTwItemService.updateById(dlTwItem);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.tickets.controller.app;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 维修工单子表(DlRepairTitem)表控制层
|
||||
* @author vinjor-M
|
||||
* @date 11:48 2024/11/5
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/repair/titem")
|
||||
public class ApiRepairTitemController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private DlRepairTitemService dlRepairTitemService;
|
||||
/**
|
||||
* 查某工单维修项目进度
|
||||
* @author vinjor-M
|
||||
* @date 10:57 2024/11/5
|
||||
* @param ticketId 工单id
|
||||
**/
|
||||
@GetMapping("/getProjList")
|
||||
@Operation(summary = "查某工单维修项目进度")
|
||||
@TenantIgnore
|
||||
public CommonResult<?> getProjList(@RequestParam("ticketId") String ticketId){
|
||||
return success(dlRepairTitemService.getProjList(ticketId,"1"));
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 工单配件申请/退回表
|
||||
*
|
||||
@ -17,34 +19,31 @@ import lombok.EqualsAndHashCode;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DlTicketWares extends TenantBaseDO {
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
|
||||
/** 主键标识 */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 单据号(自动生成)
|
||||
*/
|
||||
/** 单据号(自动生成) */
|
||||
private String no;
|
||||
|
||||
/**
|
||||
* 工单ID(dl_repair_tickets表的ID)
|
||||
*/
|
||||
/** 工单ID(dl_repair_tickets表的ID) */
|
||||
private String ticketId;
|
||||
|
||||
/**
|
||||
* 类型(01:领料,02:退料,ticket_wares_type)
|
||||
*/
|
||||
private String type;
|
||||
/** 用户ID(dl_customer_main的userId) */
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 状态(01:待审核,02已通过,03:全部完成,04:部分完成,05:已驳回,ticket_wares_status)
|
||||
*/
|
||||
private String status;
|
||||
/** 用户名称(base_customer_main的cusName) */
|
||||
private String userName;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
/** 用户电话(base_customer_main的phoneNumber) */
|
||||
private String userMobile;
|
||||
|
||||
/** 车辆ID(base_car_main的ID) */
|
||||
private String carId;
|
||||
|
||||
/** 客户车辆的车牌号(dl_repair_tickets中的carNo) */
|
||||
private String licenseNumber;
|
||||
|
||||
/** 发起人ID(dl_repair_worker的user_id) */
|
||||
private Long repairId;
|
||||
@ -52,12 +51,18 @@ public class DlTicketWares extends TenantBaseDO {
|
||||
/** 发起人name(dl_repair_worker的user_name) */
|
||||
private String repairName;
|
||||
|
||||
/** 申请人岗位(dl_repair_worker的workType) */
|
||||
private String repairWork;
|
||||
|
||||
/** 维修顾问ID(system_users的ID) */
|
||||
private Long adviserId;
|
||||
|
||||
/** 维修顾问name(system_user的nickname) */
|
||||
private String adviserName;
|
||||
|
||||
/** 客户车辆的车牌号(dl_repair_tickets中的carNo) */
|
||||
private String licenseNumber;
|
||||
/** 状态:01待审批、02已审批,ticket_wares_status */
|
||||
private String status;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
}
|
@ -21,49 +21,35 @@ import java.util.Date;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DlTwItem extends TenantBaseDO {
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
|
||||
/** 主键标识 */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 主表ID(dl_ticket_wares表的ID)
|
||||
*/
|
||||
/** 主表ID(dl_ticket_wares表的ID) */
|
||||
private String twId;
|
||||
|
||||
/**
|
||||
* 配件ID
|
||||
*/
|
||||
/** 配件ID */
|
||||
private String waresId;
|
||||
|
||||
/**
|
||||
* 配件名称
|
||||
*/
|
||||
/** 配件名称 */
|
||||
private String waresName;
|
||||
|
||||
/**
|
||||
* 配件数量
|
||||
*/
|
||||
/** 配件数量 */
|
||||
private Integer waresCount;
|
||||
|
||||
/**
|
||||
* 配件状态(01:已领料,02:未领料,03:已退料,04可确认领料,可确认退料 tw_item_status)
|
||||
*/
|
||||
/** 已领取数量 */
|
||||
private Integer waresAlreadyCount;
|
||||
|
||||
/** 配件状态:使用字典yes_no,1通过,0没通过 */
|
||||
private String waresStatus;
|
||||
|
||||
/** 审核人ID(system_users的ID) */
|
||||
private Long handleId;
|
||||
|
||||
/** 审核人姓名(system_users的nickname) */
|
||||
private String handleName;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 客户是否可见(字典yes_no);已存在于系统中(是:1,否:0) */
|
||||
private String isShow;
|
||||
|
||||
/** 可领取数量 */
|
||||
private Integer waresCouldCount;
|
||||
|
||||
/** 已领料数量 */
|
||||
private Integer waresAlreadyCount;
|
||||
|
||||
/** 已退数量 */
|
||||
private Integer waresBackCount;
|
||||
}
|
@ -8,6 +8,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;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_titem(维修工单子表)】的数据库操作Mapper
|
||||
*
|
||||
@ -31,6 +33,15 @@ public interface DlRepairTitemMapper extends BaseMapper<DlRepairTitem> {
|
||||
* @param dlRepairTitem
|
||||
*/
|
||||
void updateRepairAndSale(DlRepairTitem dlRepairTitem);
|
||||
|
||||
/**
|
||||
* 查某工单维修项目进度
|
||||
* @author vinjor-M
|
||||
* @date 15:33 2024/11/12
|
||||
* @param ticketId 工单id
|
||||
* @return java.util.List<cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO>
|
||||
**/
|
||||
List<DlRepairTitemRespVO> selectProjList(@Param("ticketId")String ticketId,@Param("isOpen")String isOpen);
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,7 +108,7 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
* @date 11:48 2024/10/14
|
||||
* @param id 工单ID
|
||||
**/
|
||||
void updateTake(String id);
|
||||
void updateTake(String id,String image);
|
||||
|
||||
/**
|
||||
* 指派员工,通知施工
|
||||
|
@ -74,4 +74,13 @@ public interface DlRepairTitemService extends IService<DlRepairTitem> {
|
||||
* @date 16:11 2024/10/31
|
||||
**/
|
||||
void updateRepairItem(List<DlRepairTitem> itemList);
|
||||
|
||||
/**
|
||||
* 查某工单维修项目进度
|
||||
* @author vinjor-M
|
||||
* @date 10:58 2024/11/5
|
||||
* @param ticketId 工单ID
|
||||
* @return java.util.List<cn.iocoder.yudao.module.tickets.entity.DlRepairTitem>
|
||||
**/
|
||||
List<DlRepairTitemRespVO> getProjList(String ticketId,String isOpen);
|
||||
}
|
||||
|
@ -5,9 +5,8 @@ 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.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.framework.tenant.core.util.TenantUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
||||
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||
@ -42,6 +41,8 @@ import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlTicketWares;
|
||||
@ -180,6 +181,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
@Resource
|
||||
@Lazy
|
||||
private CompanyService companyService;
|
||||
@Resource
|
||||
private AdminUserService userService;
|
||||
|
||||
/**
|
||||
* 维修工单表 新增
|
||||
@ -217,6 +220,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// });
|
||||
|
||||
|
||||
|
||||
// 门店信息
|
||||
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
||||
DeptRespDTO dept = deptApi.getDept(deptId);
|
||||
@ -245,9 +249,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 新增主表
|
||||
baseMapper.insert(ticketsRespVO);
|
||||
|
||||
//获取当前登录用户
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
// 新增子表
|
||||
itemList.forEach(item -> {
|
||||
item.setTicketId(ticketsRespVO.getId());
|
||||
if(null==item.getSaleId()){
|
||||
//默认销售人员是当前用户
|
||||
item.setSaleId(loginUser.getId());
|
||||
item.setSaleName(loginUser.getInfo().get("nickname"));
|
||||
}
|
||||
if ("01".equals(item.getItemType())) {
|
||||
//维修项目,初始状态,待派工
|
||||
item.setItemStatus(TicketsItemStatusEnum.WAITING_WORK.getCode());
|
||||
@ -268,7 +279,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
if (ObjectUtil.isNotEmpty(repairType)) {
|
||||
repairOrderInfo.setGoodsTitle(repairType.getLabel());
|
||||
} else {
|
||||
repairOrderInfo.setGoodsTitle("维修费用");
|
||||
repairOrderInfo.setGoodsTitle("维修");
|
||||
}
|
||||
repairOrderInfo.setGoodsType("2");
|
||||
CustomerMainRespVO customerById = customerMainService.getCustomerById(ticketsRespVO.getUserId());
|
||||
@ -299,6 +310,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
repairOrderInfoService.saveOrderInfo(repairOrderInfo);
|
||||
//最后记录操作日志--创建工单
|
||||
repairRecordsService.saveRepairRecord(ticketsRespVO.getId(), null, RecordTypeEnum.CJGD.getCode(), "创建工单", ticketsRespVO.getImage());
|
||||
|
||||
// 通知客户
|
||||
// 构建消息
|
||||
String message = String.format("您的爱车%s已开始%s", ticketsRespVO.getCarNo(), repairOrderInfo.getGoodsTitle());
|
||||
repairWorkerService.sentMessageToCus(ticketsRespVO.getId(), message, true);
|
||||
return ticketsRespVO;
|
||||
}
|
||||
|
||||
@ -326,6 +342,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 查工单主表
|
||||
DlRepairTickets dlRepairTickets = baseMapper.selectById(id);
|
||||
DlRepairTicketsRespVO result = BeanUtil.toBean(dlRepairTickets, DlRepairTicketsRespVO.class);
|
||||
AdminUserDO user = userService.getUser(Long.valueOf(dlRepairTickets.getAdviserId()));
|
||||
result.setLinkPhone(user.getMobile());
|
||||
//查车辆
|
||||
if (ObjectUtil.isNotEmpty(dlRepairTickets.getCarId())) {
|
||||
CarMainRespVO carInfo = carMainService.queryCarById(dlRepairTickets.getCarId());
|
||||
@ -333,7 +351,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
}
|
||||
|
||||
//查用户信息
|
||||
CustomerMain customerInfo = customerService.getCustomerById(dlRepairTickets.getUserId());
|
||||
CustomerMain customerInfo = customerService.getById(dlRepairTickets.getUserId());
|
||||
result.setCustomerInfo(customerInfo);
|
||||
// 查工单子表
|
||||
List<DlRepairTitem> itemList = titemService.list(new LambdaQueryWrapper<DlRepairTitem>().eq(DlRepairTitem::getTicketId, id));
|
||||
@ -383,14 +401,27 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
|
||||
/**
|
||||
* 维修工单表 作废
|
||||
* 传对象是因为需要有作废备注
|
||||
*
|
||||
* @param repairTicketsReqVO 工单对象
|
||||
* @author 小李
|
||||
* @date 19:46 2024/9/22
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void setTicketsVoid(DlRepairTicketsReqVO repairTicketsReqVO) {
|
||||
baseMapper.updateById(repairTicketsReqVO);
|
||||
// 作废维修工单
|
||||
DlRepairTickets tickets = new DlRepairTickets();
|
||||
tickets.setId(repairTicketsReqVO.getId());
|
||||
if (ObjectUtil.isNotEmpty(repairTicketsReqVO.getRemark())){
|
||||
tickets.setRemark(repairTicketsReqVO.getRemark());
|
||||
}
|
||||
tickets.setTicketsStatus("03");
|
||||
baseMapper.updateById(tickets);
|
||||
// 删除订单
|
||||
repairOrderInfoService.remove(new LambdaQueryWrapper<RepairOrderInfo>().eq(RepairOrderInfo::getGoodsId, repairTicketsReqVO.getId()));
|
||||
// 记录日志
|
||||
repairRecordsService.saveRepairRecord(repairTicketsReqVO.getId(), null, RecordTypeEnum.ZFGG.getCode(), repairTicketsReqVO.getRemark(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -411,9 +442,18 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
RepairOrderInfo repairOrderInfo = new RepairOrderInfo();
|
||||
repairOrderInfo.setId(one.getId());
|
||||
repairOrderInfo.setPayType(repairTicketsRespVO.getPayType());
|
||||
repairOrderInfoService.updateById(repairOrderInfo);
|
||||
|
||||
// 更新工单
|
||||
baseMapper.updateById(repairTicketsRespVO);
|
||||
// 在这里把工单的状态更新为已完成---需要判断,如果是线上支付,需要在支付回调更新
|
||||
if (!repairTicketsRespVO.getPayType().equals("01")){
|
||||
repairTicketsRespVO.setIsFinish("1");
|
||||
baseMapper.updateById(repairTicketsRespVO);
|
||||
}else {
|
||||
// 线下结账和签单挂账,直接算已支付
|
||||
repairOrderInfo.setPayTime(LocalDateTime.now());
|
||||
repairOrderInfo.setOrderStatus("1");
|
||||
}
|
||||
repairOrderInfoService.updateById(repairOrderInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -817,8 +857,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
repairTicketsReqVO.setUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId()));
|
||||
}
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
|
||||
//服务顾问
|
||||
repairTicketsReqVO.setAdviserId(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
|
||||
//服务顾问,暂时看所有的工单
|
||||
// repairTicketsReqVO.setAdviserId(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) {
|
||||
//维修工,进一步判断是否是班组长
|
||||
boolean ifLeader = repairWorkerService.getIfLeader();
|
||||
@ -910,7 +950,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
* @date 11:48 2024/10/14
|
||||
**/
|
||||
@Override
|
||||
public void updateTake(String id) {
|
||||
@DSTransactional
|
||||
public void updateTake(String id,String image) {
|
||||
// 改变时看看是否已经被接了
|
||||
int update = baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.RECEIVED.getCode())
|
||||
@ -922,7 +963,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
throw exception0(500, "工单已被其他人接单了");
|
||||
}
|
||||
//最后记录操作日志--接单
|
||||
repairRecordsService.saveRepairRecord(id, null, RecordTypeEnum.jd.getCode(), "接单", null);
|
||||
repairRecordsService.saveRepairRecord(id, null, RecordTypeEnum.jd.getCode(), "接单", image);
|
||||
|
||||
// 通知客户
|
||||
// 构建消息
|
||||
DlRepairTickets tickets = baseMapper.selectById(id);
|
||||
RepairWorker worker = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()).last("limit 1"));
|
||||
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList("repair_work_type");
|
||||
DictDataRespDTO dictDataRespDTO = dataList.stream().filter(item -> item.getValue().equals(worker.getWorkType())).findFirst().orElse(null);
|
||||
String message = String.format("您的爱车%s已由%s %s接单了", tickets.getCarNo(), (dictDataRespDTO != null ? dictDataRespDTO.getLabel() : "维修工"), worker.getUserName());
|
||||
repairWorkerService.sentMessageToCus(id, message, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -948,8 +998,20 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
throw exception0(500, "工单已开始");
|
||||
}
|
||||
repairWorkerService.sentMessage(reqVO.getNowRepairId(), "您有新的工单要处理");
|
||||
//最后记录操作日志--指派施工
|
||||
repairRecordsService.saveRepairRecord(reqVO.getId(), null, RecordTypeEnum.ZPSG.getCode(), "指派施工", null);
|
||||
|
||||
//最后记录操作日志--指派施工--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());
|
||||
}else {
|
||||
// 其他
|
||||
//最后记录操作日志--指派施工
|
||||
repairRecordsService.saveRepairRecord(reqVO.getId(), null, code, remark, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1004,7 +1066,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
施工完成又分四种情况:阶段完成、完成并移交下一班组、完成并移交总检、完成工单,其中部分完成同开始施工、施工中的记录上传一致,只上传,不改变
|
||||
*/
|
||||
// 消息生成
|
||||
String message = createMessage(tickets.getNowRepairName(), tickets.getTicketNo(), 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())) {
|
||||
@ -1045,6 +1107,22 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
repairWorkerService.sentMessage(id, message);
|
||||
});
|
||||
}
|
||||
|
||||
//通知客户(开始施工、施工完成)
|
||||
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"));
|
||||
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList("repair_work_type");
|
||||
DictDataRespDTO dictDataRespDTO = dataList.stream().filter(item -> item.getValue().equals(worker.getWorkType())).findFirst().orElse(null);
|
||||
String newMessage = String.format(
|
||||
"您的爱车%s已由%s %s%s",
|
||||
tickets.getCarNo(),
|
||||
(dictDataRespDTO != null ? dictDataRespDTO.getLabel() : "维修工"),
|
||||
worker.getUserName(),
|
||||
(respVO.getRecordType().equals(RecordTypeEnum.KSSG.getCode()) ? "开始施工" : "施工完成")
|
||||
);
|
||||
repairWorkerService.sentMessageToCus(tickets.getId(), newMessage, false);
|
||||
}
|
||||
}
|
||||
|
||||
private String createMessage(String who, String no, String projectName, String type, String finishType, String nextName) {
|
||||
@ -1052,14 +1130,14 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
switch (type) {
|
||||
// 开始施工
|
||||
case "kssg":
|
||||
return result + "开始施工工单:" + no + "中" + projectName + "项目";
|
||||
return result + "开始施工车牌为:" + no + "工单中" + projectName + "项目";
|
||||
// 施工记录
|
||||
case "sgz":
|
||||
return result + "上传了工单:" + no + "中" + projectName + "项目的维修记录";
|
||||
return result + "上传了车牌为:" + no + "工单中" + projectName + "项目的维修记录";
|
||||
// 施工完成
|
||||
case "sgwczj":
|
||||
if (ObjectUtil.isNotEmpty(finishType)) {
|
||||
result = result + "完成了工单:" + no + "中" + projectName + "项目";
|
||||
result = result + "完成了车牌为:" + no + "工单中" + projectName + "项目";
|
||||
switch (finishType) {
|
||||
// 完成并移交下一班组
|
||||
case "01":
|
||||
@ -1074,7 +1152,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
return "异常消息";
|
||||
}
|
||||
} else {
|
||||
return result + "部分完成了工单:" + no + "中" + projectName + "项目";
|
||||
return result + "部分完成了车牌为:" + no + "工单中" + projectName + "项目";
|
||||
}
|
||||
default:
|
||||
return "异常消息";
|
||||
@ -1115,11 +1193,13 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 维修服务顾问
|
||||
if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
|
||||
repairTicketsReqVO.setNowRepairId(loginUserId);
|
||||
repairTicketsReqVO.setIsFinish("1");
|
||||
// 因为完成状态需要在交车之后,所以注掉这个
|
||||
// repairTicketsReqVO.setIsFinish("1");
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) {
|
||||
// 总检
|
||||
repairTicketsReqVO.setNowRepairId(loginUserId);
|
||||
repairTicketsReqVO.setIsFinish("0");
|
||||
// 因为完成状态需要在交车之后,所以注掉这个
|
||||
// repairTicketsReqVO.setIsFinish("0");
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@ -1141,7 +1221,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.ZJ.getCode(), respVO.getRemark(), respVO.getImage());
|
||||
// 更新工单
|
||||
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||
.set(DlRepairTickets::getIsFinish, "1")
|
||||
// 因为完成状态需要在交车之后,所以注掉这个
|
||||
// .set(DlRepairTickets::getIsFinish, "1")
|
||||
.setSql("now_repair_id = adviser_id")
|
||||
.setSql("now_repair_name = adviser_name")
|
||||
.eq(DlRepairTickets::getId, respVO.getId())
|
||||
@ -1155,6 +1236,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 通知服务顾问
|
||||
DlRepairTickets tickets = baseMapper.selectById(respVO.getId());
|
||||
repairWorkerService.sentMessage(Long.valueOf(tickets.getAdviserId()), "您有新的工单可以出厂检验");
|
||||
|
||||
// 通知客户
|
||||
// 构建消息
|
||||
DictDataRespDTO repairType = dictDataApi.getDictData("repair_type", tickets.getRepairType());
|
||||
String message = String.format("您的爱车%s已%s完成", tickets.getCarNo(), (repairType != null ? repairType.getLabel() : "维修保养"));
|
||||
repairWorkerService.sentMessageToCus(tickets.getId(), message, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1166,20 +1253,21 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
**/
|
||||
@Override
|
||||
public boolean syncTicketWaresToTicket(String id) {
|
||||
// 先查满足条件的申请表
|
||||
ArrayList<String> status = new ArrayList<>();
|
||||
status.add("01"); // 待审核
|
||||
status.add("05"); // 已驳回
|
||||
// 查工单所有已通过的配件申请单
|
||||
// 先查满足条件的申请表---配件申请表现在只有待审批和已审批,并且其子表的数据也可能同时有两种情况
|
||||
// ArrayList<String> status = new ArrayList<>();
|
||||
// status.add("01"); // 待审核
|
||||
// status.add("05"); // 已驳回
|
||||
// 查工单所有已通过的配件申请单----这里直接查全部
|
||||
List<DlTicketWares> list = ticketWaresService.list(new LambdaQueryWrapper<DlTicketWares>().and(item -> {
|
||||
item.eq(DlTicketWares::getTicketId, id)
|
||||
.notIn(DlTicketWares::getStatus, status);
|
||||
item.eq(DlTicketWares::getTicketId, id);
|
||||
// .notIn(DlTicketWares::getStatus, status);
|
||||
}));
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
// 查配件申请表的所有已领取数量小于申请数量的子表信息
|
||||
// 查配件申请表的所有已领取数量小于申请数量的子表信息----这里需要加上一个条件,得是审核通过的才行
|
||||
List<String> ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList());
|
||||
List<DlTwItem> twItems = twItemService.list(new LambdaQueryWrapper<DlTwItem>().and(item -> {
|
||||
item.in(DlTwItem::getTwId, ids)
|
||||
.eq(DlTwItem::getWaresStatus, "1")
|
||||
.apply("wares_already_count < wares_count");
|
||||
}));
|
||||
if (CollectionUtil.isNotEmpty(twItems)) {
|
||||
@ -1481,7 +1569,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
if (!flag) {
|
||||
// 通知总检,让其手动操作
|
||||
ids.forEach(id -> {
|
||||
repairWorkerService.sentMessage(id, "待总检工单:" + item.getTicketNo() + "已经超时,但无法自动总检,请手动处理");
|
||||
repairWorkerService.sentMessage(id, "待总检车牌为:" + item.getCarNo() + "工单已经超时,但无法自动总检,请手动处理");
|
||||
});
|
||||
}
|
||||
return flag;
|
||||
@ -1503,7 +1591,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
result.forEach(item -> {
|
||||
repairWorkerService.sentMessage(Long.valueOf(item.getAdviserId()), "您有新的工单可以出厂检验");
|
||||
ids.forEach(id -> {
|
||||
repairWorkerService.sentMessage(id, "工单:" + item.getTicketNo() + "已由系统自动总检并移交服务顾问");
|
||||
repairWorkerService.sentMessage(id, "车牌为:" + item.getCarNo() + "工单已由系统自动总检并移交服务顾问");
|
||||
});
|
||||
// 记录日志
|
||||
repairRecordsService.saveRepairRecord(item.getId(), null, RecordTypeEnum.ZJ.getCode(), "该工单由系统自动总检完成", null);
|
||||
@ -1546,6 +1634,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
baseMapper.deleteById(id);
|
||||
// 删除工单子表
|
||||
titemService.remove(new LambdaQueryWrapper<DlRepairTitem>().eq(DlRepairTitem::getTicketId, id));
|
||||
// 记录操作日志
|
||||
repairRecordsService.saveRepairRecord(id, null, RecordTypeEnum.SCGG.getCode(), null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ 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.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -31,6 +32,8 @@ public class DlRepairTitemServiceImpl extends ServiceImpl<DlRepairTitemMapper, D
|
||||
|
||||
@Resource
|
||||
private DlRepairTicketsService repairTicketsService;
|
||||
@Autowired
|
||||
private DlRepairTitemMapper dlRepairTitemMapper;
|
||||
|
||||
/**
|
||||
* 维修工单子表 分页
|
||||
@ -98,6 +101,7 @@ public class DlRepairTitemServiceImpl extends ServiceImpl<DlRepairTitemMapper, D
|
||||
titem.setItemCount(dlRepairTitemReqVO.getItemCount());
|
||||
titem.setItemPrice(dlRepairTitemReqVO.getItemPrice());
|
||||
titem.setItemDiscount(dlRepairTitemReqVO.getItemDiscount());
|
||||
titem.setItemStatus(dlRepairTitemReqVO.getItemStatus());
|
||||
// 计算总价
|
||||
BigDecimal total = titem.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(titem.getItemDiscount());
|
||||
titem.setItemMoney(total);
|
||||
@ -141,6 +145,19 @@ public class DlRepairTitemServiceImpl extends ServiceImpl<DlRepairTitemMapper, D
|
||||
//重新计划工单价格
|
||||
repairTicketsService.computeTicket(itemList.get(0).getTicketId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查某工单维修项目进度
|
||||
*
|
||||
* @param ticketId 工单ID
|
||||
* @return java.util.List<cn.iocoder.yudao.module.tickets.entity.DlRepairTitem>
|
||||
* @author vinjor-M
|
||||
* @date 10:58 2024/11/5
|
||||
**/
|
||||
@Override
|
||||
public List<DlRepairTitemRespVO> getProjList(String ticketId,String isOpen) {
|
||||
return dlRepairTitemMapper.selectProjList(ticketId,isOpen);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,16 +1,17 @@
|
||||
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;
|
||||
import cn.iocoder.yudao.common.TicketsItemStatusEnum;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
||||
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
||||
import cn.iocoder.yudao.module.project.entity.RepairWares;
|
||||
import cn.iocoder.yudao.module.project.service.RepairWaresService;
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
|
||||
@ -43,7 +44,6 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
@ -99,6 +99,9 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
@Resource
|
||||
private RepairRecordsService repairRecordsService;
|
||||
|
||||
@Resource
|
||||
private CustomerMainService customerMainService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
@ -113,8 +116,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode()) || userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) {
|
||||
//维修管理员和总检,看所有数据
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
|
||||
//服务顾问
|
||||
reqVO.setAdviserId(SecurityFrameworkUtils.getLoginUserId());
|
||||
//服务顾问--暂时看所有的配件申请单
|
||||
// reqVO.setAdviserId(SecurityFrameworkUtils.getLoginUserId());
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) {
|
||||
//维修工,进一步判断是否是班组长
|
||||
boolean ifLeader = repairWorkerService.getIfLeader();
|
||||
@ -132,7 +135,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
}
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())) {
|
||||
// 维修仓库管理员
|
||||
reqVO.setStatus(null);
|
||||
reqVO.setUserRole(5);
|
||||
} else {
|
||||
return null;
|
||||
@ -175,14 +177,41 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void updateTicketWares(DlTicketWaresRespVO respVO) {
|
||||
|
||||
// 新增、修改主表
|
||||
// 查询操作人的工人信息
|
||||
RepairWorker one = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()));
|
||||
respVO.setRepairId(one.getUserId());
|
||||
respVO.setRepairName(one.getUserName());
|
||||
baseMapper.insertOrUpdate(respVO);
|
||||
DlTicketWares ticketWares = BeanUtil.toBean(respVO, DlTicketWares.class);
|
||||
/*
|
||||
设置信息
|
||||
*/
|
||||
// 用户信息
|
||||
DlRepairTickets tickets = repairTicketsService.getById(ticketWares.getTicketId());
|
||||
CustomerMain customerMain = customerMainService.getById(tickets.getUserId());
|
||||
ticketWares.setUserId(customerMain.getUserId());
|
||||
ticketWares.setUserName(customerMain.getCusName());
|
||||
ticketWares.setUserMobile(customerMain.getPhoneNumber());
|
||||
// 车辆信息
|
||||
ticketWares.setCarId(tickets.getCarId());
|
||||
ticketWares.setLicenseNumber(tickets.getCarNo());
|
||||
// 发起人信息
|
||||
RepairWorker worker = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()));
|
||||
ticketWares.setRepairId(worker.getUserId());
|
||||
ticketWares.setRepairName(worker.getUserName());
|
||||
ticketWares.setRepairWork(worker.getWorkType());
|
||||
// 服务顾问信息
|
||||
ticketWares.setAdviserId(Long.valueOf(tickets.getAdviserId()));
|
||||
ticketWares.setAdviserName(tickets.getAdviserName());
|
||||
|
||||
baseMapper.insertOrUpdate(ticketWares);
|
||||
|
||||
// 新增、修改子表
|
||||
List<DlTwItem> list = respVO.getItems().stream().map(item -> item.setTwId(respVO.getId())).collect(Collectors.toList());
|
||||
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, "配件列表为空");
|
||||
}
|
||||
@ -190,7 +219,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
|
||||
// 通知对应的维修服务顾问和总检
|
||||
// 维修服务顾问即创建工单时选的是谁
|
||||
DlRepairTickets tickets = repairTicketsService.getById(respVO.getTicketId());
|
||||
repairWorkerService.sentMessage(Long.valueOf(tickets.getAdviserId()), "您有新的配件申请单需要审核");
|
||||
// 总检查角色包含总检的员工
|
||||
// 取这个角色的角色信息
|
||||
@ -229,117 +257,87 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void auditTicketWares(DlTicketWaresRespVO respVO) {
|
||||
// 设置单据状态
|
||||
//配件申请单id
|
||||
String mainId = respVO.getId();
|
||||
//单据类型,现在只有配件申请单 01
|
||||
String type = respVO.getType();
|
||||
//单据状态 02 通过 05驳回
|
||||
// 取出前端传的单据状态,这里是前端传的,只有两个,01通过,02驳回
|
||||
String status = respVO.getStatus();
|
||||
//配件信息
|
||||
List<DlRepairTitem> repairItemList = respVO.getWares();
|
||||
DlTicketWares updateObj = this.getById(mainId);
|
||||
String ticketMainId = updateObj.getTicketId();
|
||||
updateObj.setStatus(status);
|
||||
this.updateById(updateObj);
|
||||
// 如果是通过并且是领料就还需要把配件信息加入到工单中
|
||||
if (ObjectUtil.isNotEmpty(status) && status.equals("02") && type.equals("01")) {
|
||||
// 更新维修工单
|
||||
if(null!=respVO.getRepairWaresList()){
|
||||
repairItemList= new ArrayList<>();
|
||||
//走的是更新配件库价格
|
||||
Map<String,BigDecimal> updateMap = respVO.getRepairWaresList().stream().collect(Collectors.toMap(RepairWares::getId,RepairWares::getPrice));
|
||||
//更新配件库的价格
|
||||
List<RepairWares> updateWaresList = new ArrayList<>();
|
||||
//去库里面查需要的配件
|
||||
LambdaQueryWrapper<DlTwItem> queryWrapper = new LambdaQueryWrapper<DlTwItem>()
|
||||
.eq(DlTwItem::getTwId, mainId);
|
||||
List<DlTwItem> applyList = twItemService.list(queryWrapper);
|
||||
if (!applyList.isEmpty()) {
|
||||
//查配件库
|
||||
List<RepairWares> waresList = repairWaresService.listByIds(applyList.stream().map(DlTwItem::getWaresId).collect(Collectors.toList()));
|
||||
Map<String, RepairWares> waresMap = waresList.stream().collect(Collectors.toMap(RepairWares::getId, Function.identity()));
|
||||
//组装工单子表数据
|
||||
for (DlTwItem item : applyList) {
|
||||
DlRepairTitem repairTitem = new DlRepairTitem();
|
||||
repairTitem.setTicketId(ticketMainId);
|
||||
repairTitem.setItemCount(item.getWaresCount());
|
||||
repairTitem.setItemName(item.getWaresName());
|
||||
repairTitem.setItemUnit(waresMap.get(item.getWaresId()).getUnit());
|
||||
//取前端传过来的销售价格
|
||||
repairTitem.setItemPrice(updateMap.get(item.getId()));
|
||||
//默认不打折为1
|
||||
repairTitem.setItemDiscount(new BigDecimal(1));
|
||||
repairTitem.setItemMoney(new BigDecimal(repairTitem.getItemCount()).multiply(repairTitem.getItemPrice()));
|
||||
//类型是配件
|
||||
repairTitem.setItemType("02");
|
||||
repairTitem.setPartId(item.getWaresId());
|
||||
repairTitem.setItemStatus(TicketsItemStatusEnum.WAITING_RECEIVE.getCode());
|
||||
repairItemList.add(repairTitem);
|
||||
//组装配件库更新价格
|
||||
RepairWares update = new RepairWares();
|
||||
update.setId(item.getWaresId());
|
||||
update.setPrice(updateMap.get(item.getId()));
|
||||
updateWaresList.add(update);
|
||||
// 取出前端操作的配件申请表的子项id
|
||||
List<String> twItemIds = respVO.getItems().stream().map(DlTwItem::getId).collect(Collectors.toList());
|
||||
// 查所有的子项
|
||||
List<DlTwItem> twItems = twItemService.listByIds(twItemIds);
|
||||
// 取所有的配件信息
|
||||
List<String> wareIds = twItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toList());
|
||||
List<RepairWares> repairWares = repairWaresService.listByIds(wareIds);
|
||||
// 更新配件申请表子表
|
||||
List<DlTwItem> newTwitems = twItemIds.stream().map(item -> {
|
||||
DlTwItem twItem = new DlTwItem();
|
||||
twItem.setId(item);
|
||||
twItem.setWaresStatus(status.equals("01") ? "1" : "0");
|
||||
twItem.setHandleId(SecurityFrameworkUtils.getLoginUserId());
|
||||
twItem.setHandleName(SecurityFrameworkUtils.getLoginUserNickname());
|
||||
return twItem;
|
||||
}).collect(Collectors.toList());
|
||||
twItemService.updateBatchById(newTwitems);
|
||||
// 更新配件申请主表
|
||||
List<DlTwItem> allTwitems = twItemService.list(new LambdaQueryWrapper<DlTwItem>().in(DlTwItem::getTwId, respVO.getId()));
|
||||
List<DlTwItem> passTwitems = allTwitems.stream().filter(item -> item.getWaresStatus().equals("1") || item.getWaresStatus().equals("0")).collect(Collectors.toList());
|
||||
boolean isStatus = CollectionUtil.isNotEmpty(passTwitems) && passTwitems.size() == allTwitems.size();
|
||||
if (isStatus) {
|
||||
baseMapper.update(new LambdaUpdateWrapper<DlTicketWares>().set(DlTicketWares::getStatus, "02").eq(DlTicketWares::getId, respVO.getId()));
|
||||
}
|
||||
// 更新维修工单子表
|
||||
if (status.equals("01")) {
|
||||
DlTicketWares ticketWares = baseMapper.selectById(respVO.getId());
|
||||
List<DlRepairTitem> titems = repairTitemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(i -> {
|
||||
i.in(DlRepairTitem::getTicketId, ticketWares.getTicketId())
|
||||
.eq(DlRepairTitem::getItemType, "02");
|
||||
}));
|
||||
// 要修改的
|
||||
List<DlRepairTitem> updateTitems = titems.stream().filter(item -> wareIds.contains(item.getPartId())).collect(Collectors.toList());
|
||||
// 修改
|
||||
if (CollectionUtil.isNotEmpty(updateTitems)) {
|
||||
List<DlRepairTitem> newTitems = updateTitems.stream().map(item -> {
|
||||
DlRepairTitem titem = new DlRepairTitem();
|
||||
titem.setId(item.getId());
|
||||
DlTwItem twItem = allTwitems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).findFirst().orElse(null);
|
||||
if (twItem != null) {
|
||||
titem.setItemCount(item.getItemCount() + twItem.getWaresCount());
|
||||
titem.setItemMoney(item.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(item.getItemDiscount()));
|
||||
}
|
||||
}
|
||||
if(!updateWaresList.isEmpty()){
|
||||
repairWaresService.updateBatchById(updateWaresList);
|
||||
}
|
||||
}
|
||||
// 更新维修工单子表----需要合并相同的配件,故修改
|
||||
// 先查维修工单的子表中的配件相关的信息
|
||||
List<DlRepairTitem> oldTitem = repairTitemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(i -> i.eq(DlRepairTitem::getTicketId, ticketMainId).eq(DlRepairTitem::getItemType, "02")));
|
||||
// 过滤出新申请的配件里面有没有已经存在于工单子表的
|
||||
List<String> waresIds = oldTitem.stream().map(DlRepairTitem::getPartId).collect(Collectors.toList());
|
||||
List<DlRepairTitem> already = repairItemList.stream().filter(item -> waresIds.contains(item.getPartId())).collect(Collectors.toList());
|
||||
// 更新已经存在的配件
|
||||
if (CollectionUtil.isNotEmpty(already)) {
|
||||
List<DlRepairTitem> updateItems = new ArrayList<>();
|
||||
already.forEach(item -> {
|
||||
DlRepairTitem titem = oldTitem.stream().filter(i -> i.getPartId().equals(item.getPartId())).findFirst().orElse(null);
|
||||
if (titem != null) {
|
||||
DlRepairTitem newItem = new DlRepairTitem();
|
||||
newItem.setId(titem.getId());
|
||||
newItem.setItemCount(titem.getItemCount() + item.getItemCount());
|
||||
// 如果设置了折扣就用,没有就是1
|
||||
BigDecimal itemDiscount = titem.getItemDiscount() == null ? new BigDecimal(1) : titem.getItemDiscount();
|
||||
// titem取价格、newItem取数量
|
||||
newItem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(newItem.getItemCount())).multiply(itemDiscount));
|
||||
updateItems.add(newItem);
|
||||
}
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(updateItems)) {
|
||||
repairTitemService.updateBatchById(updateItems);
|
||||
}
|
||||
}
|
||||
// 新增维修工单中没有的配件
|
||||
List<DlRepairTitem> newItems = repairItemList.stream().filter(item -> !waresIds.contains(item.getPartId())).collect(Collectors.toList());
|
||||
newItems.forEach(item -> {
|
||||
// 主表id
|
||||
item.setTicketId(ticketMainId);
|
||||
// 类型为配件
|
||||
item.setItemType("02");
|
||||
// 状态为未领料
|
||||
item.setItemStatus(TicketsItemStatusEnum.WAITING_RECEIVE.getCode());
|
||||
});
|
||||
repairTitemService.saveBatch(newItems);
|
||||
|
||||
// 重新计算工单
|
||||
boolean flag = repairTicketsService.computeTicket(ticketMainId);
|
||||
if (!flag) {
|
||||
throw exception0(500, "系统异常");
|
||||
}
|
||||
|
||||
// 更新仓库
|
||||
if (CollectionUtil.isNotEmpty(repairItemList)){
|
||||
List<RepairWares> updateWares = repairItemList.stream().map(item -> {
|
||||
RepairWares wares = new RepairWares();
|
||||
wares.setId(item.getPartId());
|
||||
wares.setPrice(item.getItemPrice());
|
||||
return wares;
|
||||
return titem;
|
||||
}).collect(Collectors.toList());
|
||||
repairWaresService.updateBatchById(updateWares);
|
||||
repairTitemService.updateBatchById(newTitems);
|
||||
}
|
||||
// 要新增的
|
||||
if (updateTitems.size() < wareIds.size()) {
|
||||
List<String> titemIds = updateTitems.stream().map(DlRepairTitem::getPartId).collect(Collectors.toList());
|
||||
List<RepairWares> newWares = repairWares.stream().filter(item -> !titemIds.contains(item.getId())).collect(Collectors.toList());
|
||||
// 新增
|
||||
List<DlRepairTitem> newTitems = newWares.stream().map(item -> {
|
||||
DlRepairTitem titem = new DlRepairTitem();
|
||||
titem.setTicketId(ticketWares.getTicketId());
|
||||
titem.setItemType("02");
|
||||
titem.setItemName(item.getName());
|
||||
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.setItemDiscount(BigDecimal.ONE);
|
||||
titem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(titem.getItemDiscount()));
|
||||
titem.setRepairIds(String.valueOf(ticketWares.getRepairId()));
|
||||
titem.setRepairNames(ticketWares.getRepairName());
|
||||
titem.setSaleId(ticketWares.getAdviserId());
|
||||
titem.setSaleName(ticketWares.getAdviserName());
|
||||
titem.setPartId(item.getId());
|
||||
titem.setItemStatus("04");
|
||||
titem.setRemark(twItem != null ? twItem.getRemark() : null);
|
||||
return titem;
|
||||
}).collect(Collectors.toList());
|
||||
repairTitemService.saveBatch(newTitems);
|
||||
}
|
||||
|
||||
// 更新维修工单主表
|
||||
boolean flag = repairTicketsService.computeTicket(ticketWares.getTicketId());
|
||||
if (!flag) {
|
||||
throw exception0(500, "重新计算工单错误");
|
||||
}
|
||||
|
||||
// 发送通过的消息给仓库
|
||||
@ -349,14 +347,12 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
ids.forEach(id -> repairWorkerService.sentMessage(id, "您有新的配件申请单需要处理"));
|
||||
}
|
||||
}
|
||||
// 如果是驳回,通知维修工
|
||||
if (status.equals("05")) {
|
||||
// 发送没有通过的消息给员工
|
||||
DlTicketWares ticketWares = baseMapper.selectById(respVO.getId());
|
||||
repairWorkerService.sentMessage(ticketWares.getRepairId(), "您的配件申请单被驳回了");
|
||||
}
|
||||
// 通知维修工
|
||||
DlTicketWares ticketWares = baseMapper.selectById(respVO.getId());
|
||||
repairWorkerService.sentMessage(ticketWares.getRepairId(), "您有新的配件申请单" + (status.equals("01") ? "审批通过了" : "被驳回了"));
|
||||
|
||||
//插入记录
|
||||
repairRecordsService.saveRepairRecord(respVO.getTicketId(),null,RecordTypeEnum.SPPJSQD.getCode(),"审批配件申请单",null);
|
||||
repairRecordsService.saveRepairRecord(respVO.getTicketId(), null, RecordTypeEnum.SPPJSQD.getCode(), "审批配件申请单", null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -421,6 +417,15 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
}));
|
||||
// 要操作的库存数据
|
||||
List<RepairWares> wares = repairWaresService.list(new LambdaQueryWrapper<RepairWares>().in(RepairWares::getId, respVO.getRepairSois().stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList())));
|
||||
Map<String, String> waresNameMap = wares.stream().collect(Collectors.toMap(RepairWares::getId, RepairWares::getName));
|
||||
String remarkStr = "";
|
||||
for (DlRepairSoi item : respVO.getRepairSois()) {
|
||||
//组装通知领取配件的文字
|
||||
if (!"".equals(remarkStr)) {
|
||||
remarkStr += ";";
|
||||
}
|
||||
remarkStr += waresNameMap.get(item.getGoodsId()) + "x" + item.getGoodsCount();
|
||||
}
|
||||
if (type.equals("02")) { // 领料
|
||||
// 构造新数据
|
||||
List<DlTwItem> newData = oldData.stream().map(item -> {
|
||||
@ -434,12 +439,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
Integer waresAlreadyCount = item.getWaresAlreadyCount() == null ? 0 : item.getWaresAlreadyCount();
|
||||
// 取本来的已领取数量+本次要领取的数量
|
||||
dlTwItem.setWaresAlreadyCount(repairSoi.getGoodsCount() + waresAlreadyCount);
|
||||
// 可领取数量就是申请数量-已领料数量
|
||||
// item是操作的申请配件的数量,dlTwItem取最新的已领取数量
|
||||
dlTwItem.setWaresCouldCount(item.getWaresCount() - dlTwItem.getWaresAlreadyCount());
|
||||
// dlTwItem.setWaresStatus(repairSoi.getGoodsCount().equals(item.getWaresCount()) ? "04" : item.getWaresStatus());
|
||||
// 如果已领取数量等于申请数量,那这个配件就是领料完了,为01已领料,反之不变
|
||||
dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresAlreadyCount()) ? "01" : item.getWaresStatus());
|
||||
// 如果已领取数量等于申请数量,那这个配件就是领料完了,为01已领料,反之不变----这里不变了
|
||||
// dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresAlreadyCount()) ? "01" : item.getWaresStatus());
|
||||
});
|
||||
return dlTwItem;
|
||||
}).collect(Collectors.toList());
|
||||
@ -466,12 +467,9 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
.ifPresent(repairSoi -> {
|
||||
// 取本来的已领取数量-本次要退料的数量
|
||||
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoi.getGoodsCount());
|
||||
// 可领取数量就是上次的可领取+退料数量
|
||||
// item是操作的可领取数量,repairSoi是取本次退料的数量
|
||||
dlTwItem.setWaresCouldCount(item.getWaresCouldCount() + repairSoi.getGoodsCount());
|
||||
// dlTwItem.setWaresStatus(repairSoi.getGoodsCount().equals(item.getWaresCount()) ? "04" : item.getWaresStatus());
|
||||
// 如果可领料数量等于申请数量,那这个配件就是退料完了,为03已退料,反之不变
|
||||
dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresCouldCount()) ? "03" : "02");
|
||||
// 如果可领料数量等于申请数量,那这个配件就是退料完了,为03已退料,反之不变---这里也不变了
|
||||
// dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresAlreadyCount()) ? "1" : "0");
|
||||
});
|
||||
return dlTwItem;
|
||||
}).collect(Collectors.toList());
|
||||
@ -511,8 +509,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
// }
|
||||
//插入记录
|
||||
//最后记录操作日志--创建工单
|
||||
repairRecordsService.saveRepairRecord(respVO.getTicketId(), null, "02".equals(type)?RecordTypeEnum.TZLL.getCode():RecordTypeEnum.TZTL.getCode(),
|
||||
"02".equals(type)?"通知领料":"通知退料", null);
|
||||
repairRecordsService.saveRepairRecord(respVO.getTicketId(), null, "02".equals(type) ? RecordTypeEnum.TZLL.getCode() : RecordTypeEnum.TZTL.getCode(),
|
||||
("02".equals(type) ? "通知领料" : "通知退料") + ",配件明细:" + remarkStr, null);
|
||||
// 通知维修工
|
||||
// 查维修工的userId
|
||||
repairWorkerService.sentMessage(respVO.getRepairId(), type.equals("02") ? "您有新的领料单需要确认" : "您有新的退料单需要确认");
|
||||
@ -528,21 +526,21 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void repairPassTicketWares(DlTicketWaresRespVO respVO) {
|
||||
// 更新领料申请子表
|
||||
twItemService.updateBatchById(respVO.getItems());
|
||||
// 更新领料申请表
|
||||
// 判断是全部完成完成部分完成
|
||||
List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, respVO.getId()));
|
||||
List<DlTwItem> list1 = list.stream().filter(item -> item.getWaresStatus().equals(respVO.getType().equals("01") ? "01" : "03")).collect(Collectors.toList());
|
||||
respVO.setStatus(list1.size() == list.size() ? "03" : "04");
|
||||
baseMapper.updateById(respVO);
|
||||
// 操作库存
|
||||
list.forEach(item -> {
|
||||
repairWaresService.update(new LambdaUpdateWrapper<RepairWares>()
|
||||
.setSql("stock = stock" + (respVO.getType().equals("01") ? "-" : "+") + item.getWaresCount())
|
||||
.eq(RepairWares::getId, item.getWaresId())
|
||||
);
|
||||
});
|
||||
// // 更新领料申请子表
|
||||
// twItemService.updateBatchById(respVO.getItems());
|
||||
// // 更新领料申请表
|
||||
// // 判断是全部完成完成部分完成
|
||||
// List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, respVO.getId()));
|
||||
// List<DlTwItem> list1 = list.stream().filter(item -> item.getWaresStatus().equals(respVO.getType().equals("01") ? "01" : "03")).collect(Collectors.toList());
|
||||
// respVO.setStatus(list1.size() == list.size() ? "03" : "04");
|
||||
// baseMapper.updateById(respVO);
|
||||
// // 操作库存
|
||||
// list.forEach(item -> {
|
||||
// repairWaresService.update(new LambdaUpdateWrapper<RepairWares>()
|
||||
// .setSql("stock = stock" + (respVO.getType().equals("01") ? "-" : "+") + item.getWaresCount())
|
||||
// .eq(RepairWares::getId, item.getWaresId())
|
||||
// );
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
@ -592,8 +590,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
public Map<String, Integer> getWorkerTodo() {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
LambdaQueryWrapper<DlTicketWares> queryWrapper = new LambdaQueryWrapper<DlTicketWares>()
|
||||
.eq(DlTicketWares::getRepairId, loginUser.getId())
|
||||
.eq(DlTicketWares::getType, "01");
|
||||
.eq(DlTicketWares::getRepairId, loginUser.getId());
|
||||
List<DlTicketWares> list = this.list(queryWrapper);
|
||||
Map<String, Integer> rtnMap = new HashMap<>();
|
||||
//所有提交的
|
||||
|
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.tickets.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 维修过程中添加维修项目vo
|
||||
* @author vinjor-M
|
||||
* @date 14:43 2024/11/4
|
||||
**/
|
||||
@Data
|
||||
public class AddProjVO {
|
||||
/** 添加的项目信息 */
|
||||
private List<DlRepairTitem> itemList;
|
||||
/** 签字图片相对路径 */
|
||||
private String image;
|
||||
/** 要删除的项目id */
|
||||
private List<String> delProjIdList;
|
||||
/** 备注内容 */
|
||||
private String remark;
|
||||
/** 工单id */
|
||||
private String ticketId;
|
||||
}
|
@ -33,4 +33,7 @@ public class DlRepairTicketsReqVO extends DlRepairTickets {
|
||||
|
||||
/** 人员角色code */
|
||||
private String roleCode;
|
||||
|
||||
/** 图片路径 */
|
||||
private String image;
|
||||
}
|
||||
|
@ -48,6 +48,8 @@ public class DlRepairTicketsRespVO extends DlRepairTickets {
|
||||
List<DlRepairTitemReqVO> wares;
|
||||
List<DlRepairTitemReqVO> projects;
|
||||
|
||||
private String linkPhone;
|
||||
|
||||
/**
|
||||
* 维修工完成的类别
|
||||
* 01:完成并移交下一班组
|
||||
|
@ -1,9 +1,11 @@
|
||||
package cn.iocoder.yudao.module.tickets.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 维修工单子表 响应VO
|
||||
@ -24,4 +26,9 @@ public class DlRepairTitemRespVO extends DlRepairTitem {
|
||||
private String corpId;
|
||||
|
||||
private String ticketNo;
|
||||
|
||||
/**
|
||||
* 维修项目的维修过程图片
|
||||
**/
|
||||
private List<RepairRecordsItem> recordsItemList;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class DlTicketWaresReqVO extends DlTicketWares {
|
||||
/** 角色 */
|
||||
private Integer userRole;
|
||||
|
||||
/** 查看可以退料的数据时为tru */
|
||||
/** 查看可以退料的数据时为true */
|
||||
private Boolean isBack;
|
||||
|
||||
/** 查看待审核的数据时为true */
|
||||
|
@ -8,26 +8,60 @@
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="queryRepairRecords" resultType="cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO">
|
||||
SELECT *
|
||||
FROM dl_repair_records
|
||||
<resultMap id="baseResultMap" type="cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="ticket_id" property="ticketId"/>
|
||||
<result column="repair_item_id" property="repairItemId"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="deal_user_name" property="dealUserName"/>
|
||||
<result column="deal_user_id" property="dealUserId"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<collection property="itemList" ofType="cn.iocoder.yudao.module.base.entity.RepairRecordsItem" columnPrefix="item_">
|
||||
<id column="id" property="id"/>
|
||||
<result column="record_id" property="recordId"/>
|
||||
<result column="ticket_id" property="ticketId"/>
|
||||
<result column="repair_item_id" property="repairItemId"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="image" property="image"/>
|
||||
<result column="is_open" property="isOpen"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
<select id="queryRepairRecords" resultMap="baseResultMap">
|
||||
SELECT main.*,
|
||||
drt.item_name AS projectName,
|
||||
drri.id AS item_id,
|
||||
drri.record_id AS item_record_id,
|
||||
drri.ticket_id AS item_ticket_id,
|
||||
drri.repair_item_id AS item_repair_item_id,
|
||||
drri.remark AS item_remark,
|
||||
drri.image AS item_image,
|
||||
drri.is_open AS item_is_open,
|
||||
drri.create_time AS item_create_time
|
||||
FROM dl_repair_records main
|
||||
LEFT JOIN dl_repair_titem drt ON main.repair_item_id = drt.id AND drt.deleted = 0
|
||||
LEFT JOIN dl_repair_records_item drri ON main.id = drri.record_id
|
||||
<where>
|
||||
deleted = '0'
|
||||
main.deleted = '0' AND drri.deleted = '0'
|
||||
<if test="entity.ticketId != null and entity.ticketId != ''">
|
||||
AND ticket_id = #{entity.ticketId}
|
||||
AND main.ticket_id = #{entity.ticketId}
|
||||
</if>
|
||||
<if test="entity.repairItemId != null and entity.repairItemId != ''">
|
||||
AND repair_item_id = #{entity.repairItemId}
|
||||
AND main.repair_item_id = #{entity.repairItemId}
|
||||
</if>
|
||||
<if test="entity.dealUserId != null and entity.dealUserId != ''">
|
||||
AND deal_user_id = #{entity.dealUserId}
|
||||
AND main.deal_user_id = #{entity.dealUserId}
|
||||
</if>
|
||||
<if test="entity.type != null and entity.type != ''">
|
||||
AND type = #{entity.type}
|
||||
AND main.type = #{entity.type}
|
||||
</if>
|
||||
<if test="entity.isOpen != null and entity.isOpen != ''">
|
||||
AND drri.is_open = #{entity.type}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
order by main.create_time desc,drri.create_time
|
||||
</select>
|
||||
<select id="selectNowRepairByTicketId" resultType="java.util.Map">
|
||||
SELECT
|
||||
|
@ -37,6 +37,27 @@
|
||||
WHERE
|
||||
main.deleted = 0
|
||||
</select>
|
||||
<select id="getByUserId" resultType="cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO">
|
||||
SELECT
|
||||
main.*,
|
||||
sdd.label AS workerTypeStr
|
||||
FROM
|
||||
dl_repair_worker main
|
||||
LEFT JOIN system_dict_data sdd ON sdd.dict_type = 'repair_work_type' AND main.work_type = sdd.`value`
|
||||
WHERE
|
||||
main.deleted = 0
|
||||
AND main.user_id = #{userId}
|
||||
</select>
|
||||
<select id="listAllWorker" resultType="cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO">
|
||||
SELECT
|
||||
main.*,
|
||||
sdd.label AS workerTypeStr
|
||||
FROM
|
||||
dl_repair_worker main
|
||||
LEFT JOIN system_dict_data sdd ON sdd.dict_type = 'repair_work_type' AND main.work_type = sdd.`value`
|
||||
WHERE
|
||||
main.deleted = 0
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
@ -274,7 +274,7 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
GROUP BY drt.id
|
||||
order by drt.create_time desc
|
||||
order by drt.update_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectItemList" resultType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem">
|
||||
@ -336,6 +336,6 @@
|
||||
)
|
||||
</if>
|
||||
GROUP BY drt.id
|
||||
order by drt.create_time desc
|
||||
order by drt.update_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -3,6 +3,32 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.tickets.mapper.DlRepairTitemMapper">
|
||||
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result column="ticket_id" property="ticketId"/>
|
||||
<result column="item_name" property="itemName"/>
|
||||
<result column="item_count" property="itemCount"/>
|
||||
<result column="item_unit" property="itemUnit"/>
|
||||
<result column="item_price" property="itemPrice"/>
|
||||
<result column="item_discount" property="itemDiscount"/>
|
||||
<result column="item_money" property="itemMoney"/>
|
||||
<result column="project_id" property="projectId"/>
|
||||
<result column="item_status" property="itemStatus"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<collection property="recordsItemList" ofType="cn.iocoder.yudao.module.base.entity.RepairRecordsItem"
|
||||
columnPrefix="item_">
|
||||
<id column="id" property="id"/>
|
||||
<result column="record_id" property="recordId"/>
|
||||
<result column="ticket_id" property="ticketId"/>
|
||||
<result column="repair_item_id" property="repairItemId"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="image" property="image"/>
|
||||
<result column="is_open" property="isOpen"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
<update id="updateRepairAndSale" parameterType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem">
|
||||
UPDATE dl_repair_titem
|
||||
<set>
|
||||
@ -56,4 +82,31 @@
|
||||
FROM dl_repair_titem drti
|
||||
LEFT JOIN dl_repair_tickets drt ON drti.ticket_id = drt.id
|
||||
</select>
|
||||
<select id="selectProjList" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
drt.* ,
|
||||
drri.id AS item_id,
|
||||
drri.record_id AS item_record_id,
|
||||
drri.ticket_id AS item_ticket_id,
|
||||
drri.repair_item_id AS item_repair_item_id,
|
||||
drri.remark AS item_remark,
|
||||
drri.image AS item_image,
|
||||
drri.is_open AS item_is_open,
|
||||
drri.create_time AS item_create_time
|
||||
FROM
|
||||
dl_repair_titem drt
|
||||
LEFT JOIN dl_repair_records_item drri ON drt.id = drri.repair_item_id
|
||||
AND drri.deleted = '0'
|
||||
WHERE
|
||||
drt.deleted = 0
|
||||
AND drt.item_type = '01'
|
||||
AND drt.ticket_id = #{ticketId}
|
||||
<if test="isOpen!=null and isOpen!=''">
|
||||
AND drri.is_open = #{isOpen}
|
||||
</if>
|
||||
ORDER BY
|
||||
drt.item_status DESC,
|
||||
drt.update_time,
|
||||
drri.create_time
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -5,30 +5,42 @@
|
||||
<mapper namespace="cn.iocoder.yudao.module.tickets.mapper.DlTicketWaresMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.tickets.entity.DlTicketWares">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="no" column="no" jdbcType="VARCHAR"/>
|
||||
<result property="ticketId" column="ticket_id" jdbcType="VARCHAR"/>
|
||||
<result property="type" column="type" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="repairId" column="repair_id" />
|
||||
<result property="repairName" column="repair_name" />
|
||||
<result property="adviserId" column="adviser_id" />
|
||||
<result property="adviserName" column="adviser_name" />
|
||||
<result property="licenseNumber" column="license_number" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="no" column="no" jdbcType="VARCHAR"/>
|
||||
<result property="ticketId" column="ticket_id" jdbcType="VARCHAR"/>
|
||||
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||
<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="licenseNumber" column="license_number" jdbcType="VARCHAR"/>
|
||||
<result property="repairId" column="repair_id" jdbcType="INTEGER"/>
|
||||
<result property="repairName" column="repair_name" jdbcType="VARCHAR"/>
|
||||
<result property="repairWork" column="repair_work" jdbcType="VARCHAR"/>
|
||||
<result property="adviserId" column="adviser_id" jdbcType="INTEGER"/>
|
||||
<result property="adviserName" column="adviser_name" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_SQL">
|
||||
select
|
||||
dtw.id as id,no,ticket_id,
|
||||
type,status,dtw.remark as remark,
|
||||
dtw.repair_id as repair_id,
|
||||
dtw.repair_name as repair_name,
|
||||
dtw.adviser_id as adviser_id,
|
||||
dtw.adviser_name as adviser_name,
|
||||
dtw.license_number as license_number,
|
||||
dtw.create_time as create_time
|
||||
dtw.id,
|
||||
dtw.no,
|
||||
dtw.ticket_id,
|
||||
dtw.user_id,
|
||||
dtw.user_name,
|
||||
dtw.user_mobile,
|
||||
dtw.car_id,
|
||||
dtw.license_number,
|
||||
dtw.repair_id,
|
||||
dtw.repair_name,
|
||||
dtw.repair_work,
|
||||
dtw.adviser_id,
|
||||
dtw.adviser_name,
|
||||
dtw.status,
|
||||
dtw.remark,
|
||||
dtw.create_time
|
||||
from dl_ticket_wares dtw
|
||||
left join dl_repair_tickets drt
|
||||
on dtw.ticket_id = drt.id
|
||||
@ -36,43 +48,47 @@
|
||||
</sql>
|
||||
|
||||
<select id="getPage" resultMap="BaseResultMap">
|
||||
<include refid="Base_SQL" />
|
||||
<include refid="Base_SQL"/>
|
||||
<if test="map.query != null and map.query != ''">
|
||||
and (
|
||||
dtw.no like concat('%', #{map.query}, '%')
|
||||
or
|
||||
drt.ticket_no like concat('%', #{map.query}, '%')
|
||||
or
|
||||
dtw.license_number like concat('%', #{map.query}, '%')
|
||||
dtw.no like concat('%', #{map.query}, '%')
|
||||
or
|
||||
drt.ticket_no like concat('%', #{map.query}, '%')
|
||||
or
|
||||
dtw.license_number like concat('%', #{map.query}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="map.type != null and map.type != ''">
|
||||
and (dtw.type = #{map.type})
|
||||
<if test="map.licenseNumber != null and map.licenseNumber != ''">
|
||||
and dtw.license_number like concat('%', #{map.licenseNumber}, '%')
|
||||
</if>
|
||||
<if test="map.userMobile != null and map.userMobile != ''">
|
||||
and dtw.user_mobile like concat('%', #{map.userMobile}, '%')
|
||||
</if>
|
||||
<if test="map.repairName != null and map.repairName != ''">
|
||||
and dtw.repair_name like concat('%', #{map.repairName}, '%')
|
||||
</if>
|
||||
<if test="map.status != null and map.status != ''">
|
||||
and (dtw.status = #{map.status})
|
||||
</if>
|
||||
<if test="map.userIds != null and map.userIds.size > 0">
|
||||
and (
|
||||
dtw.repair_id in
|
||||
<foreach collection="map.userIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
dtw.repair_id in
|
||||
<foreach collection="map.userIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="map.userRole != null">
|
||||
and (
|
||||
<choose>
|
||||
<when test="map.userRole == 5 and map.isToBeReviewed">
|
||||
dtw.status = '01'
|
||||
</when>
|
||||
<when test="map.userRole == 5 and map.isBack == null">
|
||||
dtw.status not in ('01', '05', '03')
|
||||
</when>
|
||||
<when test="map.userRole == 5 and map.isBack">
|
||||
dtw.status in ('03', '04')
|
||||
</when>
|
||||
</choose>
|
||||
and exists (
|
||||
select 1 from dl_tw_item dti where dti.tw_id = dtw.id and dti.deleted = '0'
|
||||
<choose>
|
||||
<when test="map.userRole == 5 and map.isBack == false">
|
||||
and (dti.wares_count > dti.wares_already_count and dti.wares_status = '1')
|
||||
</when>
|
||||
<when test="map.userRole == 5 and map.isBack == true">
|
||||
and (dti.wares_already_count > 0 and dti.wares_status = '1')
|
||||
</when>
|
||||
</choose>
|
||||
)
|
||||
</if>
|
||||
<if test="map.adviserId != null and map.adviserId != ''">
|
||||
|
@ -5,24 +5,30 @@
|
||||
<mapper namespace="cn.iocoder.yudao.module.tickets.mapper.DlTwItemMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.tickets.entity.DlTwItem">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="twId" column="tw_id" jdbcType="VARCHAR"/>
|
||||
<result property="waresId" column="wares_id" jdbcType="VARCHAR"/>
|
||||
<result property="waresName" column="wares_name" jdbcType="VARCHAR"/>
|
||||
<result property="waresCount" column="wares_count" jdbcType="INTEGER"/>
|
||||
<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" />
|
||||
<result property="waresBackCount" column="wares_back_count" />
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="twId" column="tw_id" jdbcType="VARCHAR"/>
|
||||
<result property="waresId" column="wares_id" jdbcType="VARCHAR"/>
|
||||
<result property="waresName" column="wares_name" jdbcType="VARCHAR"/>
|
||||
<result property="waresCount" column="wares_count" jdbcType="INTEGER"/>
|
||||
<result property="waresAlreadyCount" column="wares_already_count" jdbcType="INTEGER"/>
|
||||
<result property="waresStatus" column="wares_status" jdbcType="VARCHAR"/>
|
||||
<result property="handleId" column="handle_id" jdbcType="INTEGER"/>
|
||||
<result property="handleName" column="handle_name" jdbcType="VARCHAR"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_SQL">
|
||||
select
|
||||
id,tw_id,wares_id,
|
||||
wares_name,wares_count,wares_status,remark,
|
||||
is_show,wares_could_count, wares_already_count, wares_back_count
|
||||
id,
|
||||
tw_id,
|
||||
wares_id,
|
||||
wares_name,
|
||||
wares_count,
|
||||
wares_already_count,
|
||||
wares_status,
|
||||
handle_id,
|
||||
handle_name,
|
||||
remark
|
||||
from dl_tw_item dti
|
||||
where dti.deleted = '0'
|
||||
</sql>
|
||||
|
@ -4,6 +4,7 @@ import cn.iocoder.yudao.module.system.api.permission.dto.DeptDataPermissionRespD
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@ -73,6 +74,15 @@ public interface PermissionApi {
|
||||
**/
|
||||
List<Long> getRoleIdsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 通过用户id查询角色
|
||||
* @author PQZ
|
||||
* @date 14:29 2024/11/7
|
||||
* @param userIds 用户id集合
|
||||
* @return key用户id,value角色codes
|
||||
**/
|
||||
Map<Long,List<String>> roleCodesByUserIds(List<Long> userIds);
|
||||
|
||||
/**
|
||||
* 根据权限ID拿拥有该权限的所有人
|
||||
* @author 小李
|
||||
|
@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.module.system.api.user.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserRoleDTO {
|
||||
private Long userId;
|
||||
private String roleCode;
|
||||
}
|
@ -1,12 +1,14 @@
|
||||
package cn.iocoder.yudao.module.system.api.permission;
|
||||
|
||||
import cn.iocoder.yudao.module.system.api.permission.dto.DeptDataPermissionRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO;
|
||||
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -77,6 +79,21 @@ public class PermissionApiImpl implements PermissionApi {
|
||||
return roleIds.stream().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户id查询角色
|
||||
*
|
||||
* @param userIds 用户id集合
|
||||
* @return key用户id,value角色codes
|
||||
* @author PQZ
|
||||
* @date 14:29 2024/11/7
|
||||
**/
|
||||
@Override
|
||||
public Map<Long, List<String>> roleCodesByUserIds(List<Long> userIds) {
|
||||
List<UserRoleDTO> userRoleDTOList = permissionService.userRoleDTOList(userIds);
|
||||
Map<Long, List<String>> resultMap = userRoleDTOList.stream().collect(Collectors.groupingBy(UserRoleDTO::getUserId,Collectors.mapping(UserRoleDTO::getRoleCode,Collectors.toList())));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据权限ID拿拥有该权限的所有人
|
||||
* @author 小李
|
||||
|
@ -40,6 +40,7 @@ public interface NotifyMessageMapper extends BaseMapperX<NotifyMessageDO> {
|
||||
.eqIfPresent(NotifyMessageDO::getReadStatus, reqVO.getReadStatus())
|
||||
.betweenIfPresent(NotifyMessageDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eq(NotifyMessageDO::getUserId, userId)
|
||||
.eq(NotifyMessageDO::getUserType, 1)
|
||||
.orderByDesc(NotifyMessageDO::getId));
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.permission;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -44,4 +44,13 @@ public interface UserRoleMapper extends BaseMapperX<UserRoleDO> {
|
||||
IPage<UserDTO> selectListByRoleId(@Param("page") Page<UserDTO> page,@Param("role") RolePageReqVO role);
|
||||
|
||||
List<UserDTO> selectByRoleId(Integer roleId);
|
||||
|
||||
/**
|
||||
* 通过用户id查询用户关联角色code
|
||||
* @author PQZ
|
||||
* @date 14:39 2024/11/7
|
||||
* @param userIds 用户id集合
|
||||
* @return java.util.List<cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO>
|
||||
**/
|
||||
List<UserRoleDTO> userCodes(@Param("userIds") List<Long> userIds);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class NotifyMessageServiceImpl implements NotifyMessageService {
|
||||
@Override
|
||||
@TenantIgnore
|
||||
public Long getWXUnreadNotifyMessageCount(Long userId) {
|
||||
return notifyMessageMapper.selectUnreadCountByUserIdAndUserType(userId, null);
|
||||
return notifyMessageMapper.selectUnreadCountByUserIdAndUserType(userId, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.system.service.permission;
|
||||
|
||||
import cn.iocoder.yudao.module.system.api.permission.dto.DeptDataPermissionRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -26,6 +27,15 @@ public interface PermissionService {
|
||||
*/
|
||||
boolean hasAnyPermissions(Long userId, String... permissions);
|
||||
|
||||
/**
|
||||
* 查询用户及角色
|
||||
* @author PQZ
|
||||
* @date 14:42 2024/11/7
|
||||
* @param userIds 用户id
|
||||
* @return java.util.List<cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO>
|
||||
**/
|
||||
List<UserRoleDTO> userRoleDTOList(List<Long> userIds);
|
||||
|
||||
/**
|
||||
* 判断是否有角色,任一一个即可
|
||||
*
|
||||
|
@ -10,6 +10,7 @@ import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.system.api.permission.dto.DeptDataPermissionRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleMenuDO;
|
||||
@ -38,7 +39,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
|
||||
import static javafx.scene.input.KeyCode.H;
|
||||
|
||||
/**
|
||||
* 权限 Service 实现类
|
||||
@ -87,6 +87,19 @@ public class PermissionServiceImpl implements PermissionService {
|
||||
return roleService.hasAnySuperAdmin(convertSet(roles, RoleDO::getId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户及角色
|
||||
*
|
||||
* @param userIds 用户id
|
||||
* @return java.util.List<cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO>
|
||||
* @author PQZ
|
||||
* @date 14:42 2024/11/7
|
||||
**/
|
||||
@Override
|
||||
public List<UserRoleDTO> userRoleDTOList(List<Long> userIds) {
|
||||
return userRoleMapper.userCodes(userIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断指定角色,是否拥有该 permission 权限
|
||||
*
|
||||
|
@ -20,23 +20,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND sur.role_id = ( SELECT id FROM system_role WHERE `code` = #{roleCode} ))
|
||||
</select>
|
||||
<select id="selectListByRoleId" resultType="cn.iocoder.yudao.module.system.api.user.dto.UserDTO"
|
||||
parameterType="cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO">
|
||||
select distinct su.*
|
||||
from system_users su
|
||||
left join system_user_role sr on su.id = sr.user_id
|
||||
left join system_role sr2 on sr.role_id = sr2.id
|
||||
<where>
|
||||
su.deleted = 0 and sr2.service_package_id = 'jiance'
|
||||
<if test="role.roleId != null">
|
||||
and sr.role_id = #{role.roleId}
|
||||
</if>
|
||||
<if test="role.nickname != null">
|
||||
and su.nickname like CONCAT('%',#{role.nickname},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
parameterType="cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO">
|
||||
select su.*
|
||||
from system_user_role sr
|
||||
left join system_users su on sr.user_id = su.id
|
||||
left join system_role sr2 on sr.role_id = sr2.id
|
||||
<where>
|
||||
su.deleted = 0 and sr2.service_package_id = 'jiance'
|
||||
<if test="role.roleId != null">
|
||||
and sr.role_id = #{role.roleId}
|
||||
</if>
|
||||
<if test="role.nickname != null">
|
||||
and su.nickname like CONCAT('%',#{role.nickname},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="userCodes" resultType="cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO">
|
||||
SELECT
|
||||
su.id AS userId,sr.code AS roleCode
|
||||
FROM
|
||||
system_users su
|
||||
LEFT JOIN system_user_role sur ON su.id = sur.user_id AND sur.deleted = 0
|
||||
LEFT JOIN system_role sr ON sur.role_id = sr.id AND sr.deleted = 0
|
||||
WHERE su.deleted = 0
|
||||
AND su.id IN
|
||||
<foreach item="item" collection="userIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="selectByRoleId" resultType="cn.iocoder.yudao.module.system.api.user.dto.UserDTO">
|
||||
SELECT
|
||||
*
|
||||
|
@ -47,6 +47,7 @@ spring:
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://122.51.230.86:3306/lanan_platform_dev?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
# url: jdbc:mysql://122.51.230.86:3306/lanan_platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
|
||||
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
|
||||
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||
|
Loading…
Reference in New Issue
Block a user