Merge branch 'dev' of http://122.51.230.86:3000/dianliang/lanan-system into dev
# Conflicts: # dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java
This commit is contained in:
commit
935da0bafc
@ -29,10 +29,15 @@
|
||||
|
||||
<select id="pageNotice" resultMap="BaseResultMap">
|
||||
<include refid="Base_SQL" />
|
||||
and dbn.parent_server = #{map.parentServer}
|
||||
<if test="map.parentServer != null and map.parentServer != ''">
|
||||
and dbn.parent_server = #{map.parentServer}
|
||||
</if>
|
||||
<if test="map.server != null and map.server != ''">
|
||||
and dbn.server = #{map.server}
|
||||
</if>
|
||||
<if test="map.type != null and map.type != ''">
|
||||
and dbn.type = #{map.type}
|
||||
</if>
|
||||
<if test="map.status != null">
|
||||
and dbn.status = #{map.status}
|
||||
</if>
|
||||
|
@ -57,7 +57,7 @@
|
||||
<choose>
|
||||
<when test="map.selectType == 'working'">
|
||||
-- 维修中的订单 --
|
||||
and (drt.tickets_status = '04' OR drt.tickets_status = '05' )
|
||||
and (drt.tickets_status = '04' OR drt.tickets_status = '05' OR drt.tickets_status = '05' OR drt.tickets_status ='01')
|
||||
</when>
|
||||
<when test="map.selectType == 'waitingPay'">
|
||||
-- 待支付的订单 --
|
||||
|
@ -195,7 +195,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
customerInfo.setCustomerName(user.getNickname());
|
||||
customerInfo.setSex("0");
|
||||
customerInfo.setUserAge(user.getUserAge());
|
||||
customerInfoService.save(customerInfo);
|
||||
customerInfoService.insertPartnerCustomerInfo(customerInfo);
|
||||
}
|
||||
//追加订单明细记录
|
||||
orderInfoDetailService.save(new OrderInfoDetail(orderInfo.getId(),"线下订单创建",new Date(),0L,"1"));
|
||||
|
@ -1,6 +1,14 @@
|
||||
package cn.iocoder.yudao.module.partner.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
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.entity.UserCar;
|
||||
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.inspection.service.AppInspectionPartnerService;
|
||||
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
|
||||
import cn.iocoder.yudao.module.partner.mapper.PartnerCustomerInfoMapper;
|
||||
@ -27,10 +35,12 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.SIGN_CREATE;
|
||||
|
||||
/**
|
||||
* 客户信息Service业务层处理
|
||||
@ -55,6 +65,12 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl<PartnerCustomerI
|
||||
private PartnerCustomerInfoMapper customerInfoMapper;
|
||||
@Autowired
|
||||
private PartnerCustomerInfoMapper partnerCustomerInfoMapper;
|
||||
@Resource
|
||||
private CustomerMainService customerMainService;
|
||||
@Autowired
|
||||
private CarMainService carMainService;
|
||||
@Resource
|
||||
private CustomerCarService customerCarService;
|
||||
|
||||
/**
|
||||
* 查询客户信息列表
|
||||
@ -112,83 +128,179 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl<PartnerCustomerI
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertPartnerCustomerInfo(PartnerCustomerInfo partnerCustomerInfo) throws Exception {
|
||||
// 获取当前商户信息
|
||||
ShopMallPartners partners = partnerService.shopInfo();
|
||||
LambdaQueryWrapper<PartnerCustomerInfo> queryWrapper =new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PartnerCustomerInfo::getPartnerId,partners.getPartnerId()).eq(PartnerCustomerInfo::getCustomerPhone,partnerCustomerInfo.getCustomerPhone());
|
||||
|
||||
// 检查客户是否已存在
|
||||
LambdaQueryWrapper<PartnerCustomerInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PartnerCustomerInfo::getPartnerId, partners.getPartnerId())
|
||||
.eq(PartnerCustomerInfo::getCustomerPhone, partnerCustomerInfo.getCustomerPhone());
|
||||
|
||||
PartnerCustomerInfo customerInfo = this.getOne(queryWrapper);
|
||||
if (ObjectUtils.isNotEmpty(customerInfo)){
|
||||
if (ObjectUtils.isNotEmpty(customerInfo)) {
|
||||
throw new Exception("客户已存在");
|
||||
}
|
||||
|
||||
// 查找或创建用户
|
||||
AdminUserDO user = userService.selectUserByPhone(partnerCustomerInfo.getCustomerPhone());
|
||||
if (ObjectUtils.isEmpty(user)){
|
||||
if (ObjectUtils.isEmpty(user)) {
|
||||
RoleDO role = roleService.queryRole("jcyh");
|
||||
|
||||
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
|
||||
user = new AdminUserDO();
|
||||
BeanUtils.copyProperties(partnerCustomerInfo,user);
|
||||
userSaveReqVO.setUsername(partnerCustomerInfo.getCustomerPhone());
|
||||
userSaveReqVO.setNickname(partnerCustomerInfo.getCustomerName());
|
||||
userSaveReqVO.setPassword("123456");
|
||||
Long uid = userService.createUser(userSaveReqVO);
|
||||
user.setId(uid);
|
||||
Set<Long> ids = new HashSet<>();
|
||||
ids.add(role.getId());
|
||||
permissionService.assignUserRole(uid,ids);
|
||||
|
||||
if (role != null) {
|
||||
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
|
||||
user = new AdminUserDO();
|
||||
BeanUtils.copyProperties(partnerCustomerInfo, user);
|
||||
userSaveReqVO.setUsername(partnerCustomerInfo.getCustomerPhone());
|
||||
userSaveReqVO.setNickname(partnerCustomerInfo.getCustomerName());
|
||||
userSaveReqVO.setPassword("123456");
|
||||
Long uid = userService.createUser(userSaveReqVO);
|
||||
user.setId(uid);
|
||||
Set<Long> ids = new HashSet<>();
|
||||
ids.add(role.getId());
|
||||
permissionService.assignUserRole(uid, ids);
|
||||
} else {
|
||||
throw new RuntimeException("无法找到角色 'jcyh'");
|
||||
}
|
||||
}
|
||||
if (!StringUtils.isEmpty(partnerCustomerInfo.getCustomerPhone())&&!StringUtils.isEmpty(partnerCustomerInfo.getRoleCode())){
|
||||
|
||||
// 角色分配
|
||||
if (!StringUtils.isEmpty(partnerCustomerInfo.getRoleCode())) {
|
||||
RoleDO sysRole = roleService.queryRole(partnerCustomerInfo.getRoleCode());
|
||||
Set<Long> ids = new HashSet<>();
|
||||
ids.add(sysRole.getId());
|
||||
permissionService.assignUserRole(user.getId(),ids);
|
||||
|
||||
permissionService.assignUserRole(user.getId(), ids);
|
||||
}
|
||||
|
||||
// 车辆信息处理
|
||||
List<ShopUserCar> userCarList = partnerCustomerInfo.getUserCarList();
|
||||
if (CollectionUtil.isNotEmpty(userCarList)){
|
||||
List<CarMain> saveCarList = new ArrayList<>();
|
||||
List<CustomerCar> saveCustomerCarList = new ArrayList<>();
|
||||
List<ShopUserCar> saveUserCarList = new ArrayList<>();
|
||||
|
||||
UserCar userCar1 = new UserCar();
|
||||
if (CollectionUtil.isNotEmpty(userCarList)) {
|
||||
for (ShopUserCar shopUserCar : userCarList) {
|
||||
LambdaQueryWrapper<ShopUserCar> queryWrapper1 =new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(ShopUserCar::getUserId,user.getId()).eq(ShopUserCar::getCarNo,shopUserCar.getCarNo());
|
||||
ShopUserCar one = userCarService.getOne(queryWrapper1);
|
||||
if (ObjectUtils.isNotEmpty(one)){
|
||||
//保养日期
|
||||
if (null!=shopUserCar.getMaintenanceDate()){
|
||||
one.setMaintenanceDate(shopUserCar.getMaintenanceDate());
|
||||
}
|
||||
if (null!=shopUserCar.getMaintenanceMileage()){
|
||||
one.setMaintenanceMileage(shopUserCar.getMaintenanceMileage());
|
||||
}
|
||||
if (null!=shopUserCar.getInspectionDate()){
|
||||
one.setInspectionDate(shopUserCar.getInspectionDate());
|
||||
}
|
||||
// 生成车辆ID
|
||||
String carId = UUID.randomUUID().toString().replace("-", "");
|
||||
CarMain carMain = new CarMain();
|
||||
carMain.setId(carId);
|
||||
carMain.setUserId(user.getId());
|
||||
carMain.setLicenseNumber(shopUserCar.getCarNo());
|
||||
carMain.setEngineNumber(userCar1.getEngineNumber());
|
||||
carMain.setVin(userCar1.getVin());
|
||||
carMain.setCarModel(shopUserCar.getCarModel());
|
||||
// 设置其它车辆信息
|
||||
carMain.setMaintenanceDate(convertToLocalDateTime(shopUserCar.getMaintenanceDate()));
|
||||
carMain.setMaintenanceMileage(convertToBigDecimal(shopUserCar.getMaintenanceMileage()));
|
||||
carMain.setInspectionDate(convertToLocalDateTime(shopUserCar.getInspectionDate()));
|
||||
carMain.setInsuranceDate(convertToLocalDateTime(shopUserCar.getInsuranceDate()));
|
||||
carMain.setNextMaintenanceDate(convertToLocalDateTime(shopUserCar.getNextMaintenanceDate()));
|
||||
carMain.setNextMaintenanceMileage(convertToBigDecimal(shopUserCar.getNextMaintenanceMileage()));
|
||||
carMain.setNextInspectionDate(convertToLocalDateTime(shopUserCar.getNextInspectionDate()));
|
||||
carMain.setInsuranceExpiryDate(convertToLocalDateTime(shopUserCar.getInsuranceExpiryDate()));
|
||||
carMain.setCarBrand(shopUserCar.getCarBrand());
|
||||
carMain.setCarNature(shopUserCar.getCarNature());
|
||||
carMain.setCarCategory(userCar1.getCarCategory());
|
||||
carMain.setCarRegisterDate(convertToLocalDateTime(shopUserCar.getCarRegisterDate()));
|
||||
carMain.setCarLicenseImg(shopUserCar.getCarLicenseImg());
|
||||
carMain.setCheckDate(convertToLocalDateTime(shopUserCar.getCheckDate()));
|
||||
carMain.setNextCheckDate(convertToLocalDateTime(shopUserCar.getNextCheckDate()));
|
||||
|
||||
if (null!=shopUserCar.getInsuranceDate()){
|
||||
one.setInsuranceDate(shopUserCar.getInsuranceDate());
|
||||
}
|
||||
if (null!=shopUserCar.getNextMaintenanceDate()){
|
||||
one.setNextMaintenanceDate(shopUserCar.getNextMaintenanceDate());
|
||||
}
|
||||
if (null!=shopUserCar.getNextMaintenanceMileage()){
|
||||
one.setNextMaintenanceMileage(shopUserCar.getNextMaintenanceMileage());
|
||||
}
|
||||
if (null!=shopUserCar.getNextInspectionDate()){
|
||||
one.setNextInspectionDate(shopUserCar.getNextInspectionDate());
|
||||
}
|
||||
if (null!=shopUserCar.getInsuranceExpiryDate()){
|
||||
one.setInsuranceExpiryDate(shopUserCar.getInsuranceExpiryDate());
|
||||
}
|
||||
userCarService.updateById(one);
|
||||
}else {
|
||||
shopUserCar.setUserId(user.getId());
|
||||
userCarService.save(shopUserCar);
|
||||
}
|
||||
// 保存车辆信息
|
||||
saveCarList.add(carMain);
|
||||
|
||||
// 客户与车辆的关联关系
|
||||
CustomerCar customerCar = new CustomerCar();
|
||||
customerCar.setId(UUID.randomUUID().toString().replace("-", ""));
|
||||
customerCar.setCusId(user.getId().toString());
|
||||
customerCar.setCarId(carId);
|
||||
customerCar.setIsOwner(userCar1.getIsOwner()); // 是否为车主
|
||||
saveCustomerCarList.add(customerCar);
|
||||
|
||||
// 保存用户车辆信息
|
||||
ShopUserCar userCar = new ShopUserCar();
|
||||
userCar.setUserId(user.getId());
|
||||
userCar.setCarNo(shopUserCar.getCarNo());
|
||||
userCar.setCarModel(shopUserCar.getCarModel());
|
||||
userCar.setMaintenanceDate(shopUserCar.getMaintenanceDate());
|
||||
userCar.setMaintenanceMileage(shopUserCar.getMaintenanceMileage());
|
||||
userCar.setInspectionDate(shopUserCar.getInspectionDate());
|
||||
userCar.setInsuranceDate(shopUserCar.getInsuranceDate());
|
||||
userCar.setNextMaintenanceDate(shopUserCar.getNextMaintenanceDate());
|
||||
userCar.setNextMaintenanceMileage(shopUserCar.getNextMaintenanceMileage());
|
||||
userCar.setNextInspectionDate(shopUserCar.getNextInspectionDate());
|
||||
userCar.setInsuranceExpiryDate(shopUserCar.getInsuranceExpiryDate());
|
||||
saveUserCarList.add(userCar);
|
||||
}
|
||||
}
|
||||
|
||||
// 验证手机号
|
||||
if (!StringUtils.isMobile(partnerCustomerInfo.getCustomerPhone())) {
|
||||
throw new Exception("手机号不符合规范");
|
||||
}
|
||||
|
||||
// 创建客户信息
|
||||
CustomerMain customerMain = new CustomerMain();
|
||||
customerMain.setId(UUID.randomUUID().toString().replace("-", ""));
|
||||
customerMain.setUserId(user.getId());
|
||||
customerMain.setCusName(partnerCustomerInfo.getCustomerName());
|
||||
customerMain.setPhoneNumber(partnerCustomerInfo.getCustomerPhone());
|
||||
customerMain.setSex(partnerCustomerInfo.getSex());
|
||||
customerMain.setIsHangAccount("0");
|
||||
customerMain.setTypeCode("01");
|
||||
// 设置客户初始来源
|
||||
customerMain.setDataFrom("01");
|
||||
// 设置注册方式
|
||||
customerMain.setInviterType("01");
|
||||
|
||||
// 保存客户信息
|
||||
customerMainService.saveOrUpdate(customerMain);
|
||||
|
||||
// 保存车辆信息和客户与车辆关联关系
|
||||
carMainService.saveOrUpdateBatch(saveCarList);
|
||||
customerCarService.saveBatch(saveCustomerCarList);
|
||||
|
||||
// 保存用户车辆信息
|
||||
for (ShopUserCar userCar : saveUserCarList) {
|
||||
// 检查是否已存在
|
||||
LambdaQueryWrapper<ShopUserCar> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(ShopUserCar::getUserId, userCar.getUserId()).eq(ShopUserCar::getCarNo, userCar.getCarNo());
|
||||
ShopUserCar existingUserCar = userCarService.getOne(queryWrapper1);
|
||||
if (existingUserCar != null) {
|
||||
// 更新用户车辆信息
|
||||
userCarService.updateById(userCar);
|
||||
} else {
|
||||
// 保存新用户车辆信息
|
||||
userCarService.save(userCar);
|
||||
}
|
||||
}
|
||||
|
||||
// 填充 partnerCustomerInfo
|
||||
partnerCustomerInfo.setPartnerId(partners.getPartnerId());
|
||||
partnerCustomerInfo.setUserId(user.getId());
|
||||
|
||||
// 插入 partner_customer_info
|
||||
return baseMapper.insertPartnerCustomerInfo(partnerCustomerInfo);
|
||||
}
|
||||
|
||||
/* Date转换为LocalDateTime */
|
||||
private LocalDateTime convertToLocalDateTime(Date date) {
|
||||
if (date != null) {
|
||||
return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* Long转换为BigDecimal */
|
||||
private BigDecimal convertToBigDecimal(Long value) {
|
||||
if (value != null) {
|
||||
return BigDecimal.valueOf(value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改客户信息
|
||||
*
|
||||
|
@ -607,4 +607,19 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机号格式验证
|
||||
* @author lzt
|
||||
* @param customerPhone 手机号
|
||||
* @return 验证结果
|
||||
* @date 2024年10月22日
|
||||
*/
|
||||
public static boolean isMobile(String customerPhone) {
|
||||
if (customerPhone == null || customerPhone.length() != 11) {
|
||||
return false;
|
||||
}
|
||||
String regex = "^1[358]\\d{9}$";
|
||||
return customerPhone.matches(regex);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 工单操作记录-工作类型枚举
|
||||
* 工单操作记录-工作类型枚举(repair_records_type)
|
||||
*
|
||||
* @author vinjor-m
|
||||
*/
|
||||
@ -39,6 +39,10 @@ public enum RecordTypeEnum {
|
||||
* 结束工单
|
||||
*/
|
||||
JSGD("jsgd","结束工单"),
|
||||
/**
|
||||
* 通知客户取车
|
||||
*/
|
||||
TZQC("tzqc","通知客户取车"),
|
||||
/**
|
||||
* 开始施工
|
||||
*/
|
||||
|
@ -11,4 +11,9 @@ public class RepairCons {
|
||||
public static final String TICKETS_WAITING = "waiting";
|
||||
/**工单-所有*/
|
||||
public static final String TICKETS_ALL = "all";
|
||||
|
||||
/**数据字典常量-repair_records_type-*/
|
||||
public static final String DICT_REPAIR_RECORDS_TYPE = "repair_records_type";
|
||||
/**数据字典常量-repair_type-*/
|
||||
public static final String DICT_REPAIR_TYPE = "repair_type";
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 维修工单状态枚举
|
||||
* 维修工单状态枚举(repair_tickets_status)
|
||||
*
|
||||
* @author vinjor-m
|
||||
*/
|
||||
@ -23,6 +23,10 @@ public enum TicketsStatusEnum {
|
||||
* 未结账
|
||||
*/
|
||||
NO_PAY("01","未结账"),
|
||||
/**
|
||||
* 待通知客户取车
|
||||
*/
|
||||
WAITING_NOTICE("07","待通知客户取车"),
|
||||
/**
|
||||
* 挂单/记账
|
||||
*/
|
||||
|
@ -71,4 +71,13 @@ public interface RepairWaresService extends IService<RepairWares> {
|
||||
* @return java.util.List<java.util.Map<java.lang.String,java.lang.String>>
|
||||
**/
|
||||
List<Map<String,String>> getAllTypeList();
|
||||
|
||||
/**
|
||||
* 通过id查询集合
|
||||
* @author PQZ
|
||||
* @date 14:56 2024/10/24
|
||||
* @param idList waresId集合
|
||||
* @return java.util.List<cn.iocoder.yudao.module.project.entity.RepairWares>
|
||||
**/
|
||||
List<RepairWares> listByIds(List<String> idList);
|
||||
}
|
@ -114,4 +114,17 @@ public class RepairWaresServiceImpl extends ServiceImpl<RepairWaresMapper, Repai
|
||||
return waresMapper.selectAllType();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询集合
|
||||
*
|
||||
* @param idList waresId集合
|
||||
* @return java.util.List<cn.iocoder.yudao.module.project.entity.RepairWares>
|
||||
* @author PQZ
|
||||
* @date 14:56 2024/10/24
|
||||
**/
|
||||
@Override
|
||||
public List<RepairWares> listByIds(List<String> idList) {
|
||||
return baseMapper.selectBatchIds(idList);
|
||||
}
|
||||
|
||||
}
|
@ -112,6 +112,13 @@ public class DlRepairSo extends TenantBaseDO {
|
||||
/** 关联的配件申请单的id(dl_ticket_wares表的ID) */
|
||||
private String twId;
|
||||
|
||||
/** 关联主表id */
|
||||
private String mainId;
|
||||
|
||||
/** 关联主表名称 */
|
||||
private String mainTable;
|
||||
|
||||
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
|
@ -31,7 +31,7 @@ public class DlRepairSoi extends TenantBaseDO {
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 采购单/领料单ID(dl_repair_so表的ID)
|
||||
* 采购单/领料单ID/入库单(dl_repair_so表的ID)
|
||||
*/
|
||||
private String soId;
|
||||
|
||||
@ -69,6 +69,14 @@ public class DlRepairSoi extends TenantBaseDO {
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 入库数量
|
||||
*/
|
||||
private Integer inCount;
|
||||
/**
|
||||
* 原始id
|
||||
*/
|
||||
private String rawId;
|
||||
|
||||
/**
|
||||
* 配件信息
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.iocoder.yudao.module.stockOperate.service;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
|
||||
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoReqVO;
|
||||
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoRespVO;
|
||||
@ -10,16 +9,18 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_so(采购单领料单)】的数据库操作Service
|
||||
*
|
||||
* @author 小李
|
||||
* @date 9:09 2024/9/13
|
||||
**/
|
||||
**/
|
||||
public interface DlRepairSoService extends IService<DlRepairSo> {
|
||||
|
||||
/**
|
||||
* 采购单/领料单 新增
|
||||
*
|
||||
* @param repairSoRespVO 采购单对象
|
||||
* @author 小李
|
||||
* @date 10:49 2024/9/14
|
||||
* @param repairSoRespVO 采购单对象
|
||||
**/
|
||||
void createRepairSo(DlRepairSoRespVO repairSoRespVO);
|
||||
|
||||
@ -35,36 +36,45 @@ public interface DlRepairSoService extends IService<DlRepairSo> {
|
||||
/**
|
||||
* 采购单/领料单 作废
|
||||
*
|
||||
* @param repairSoReqVO 作废对象
|
||||
* @author 小李
|
||||
* @date 11:12 2024/9/18
|
||||
* @param repairSoReqVO 作废对象
|
||||
**/
|
||||
void voidRepairSo(DlRepairSoReqVO repairSoReqVO);
|
||||
|
||||
/**
|
||||
* 采购单/领料单 查看
|
||||
*
|
||||
* @param id 主键
|
||||
* @author 小李
|
||||
* @date 9:34 2024/9/22
|
||||
* @param id 主键
|
||||
**/
|
||||
DlRepairSoRespVO getRepairSoById(String id);
|
||||
|
||||
/**
|
||||
* 员工确认领料
|
||||
*
|
||||
* @param id 单据ID 领料单主表
|
||||
* @author 小李
|
||||
* @date 11:58 2024/10/21
|
||||
* @param id 单据ID 领料单主表
|
||||
**/
|
||||
void confirmGet(String id);
|
||||
|
||||
/**
|
||||
* 员工确认退料
|
||||
*
|
||||
* @param id 退料单主表ID
|
||||
* @author 小李
|
||||
* @date 19:41 2024/10/21
|
||||
* @param id 退料单主表ID
|
||||
**/
|
||||
void confirmBack(String id);
|
||||
|
||||
/**
|
||||
* 采购入库
|
||||
*
|
||||
* @param reqVO (接参实体中需传入:采购单id,子表中商品id,子表中入库数量inCount)
|
||||
* @author PQZ
|
||||
* @date 14:32 2024/10/24
|
||||
**/
|
||||
void inWare(DlRepairSoReqVO reqVO);
|
||||
}
|
||||
|
@ -11,35 +11,46 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_soi(采购单领料单子表)】的数据库操作Service
|
||||
*
|
||||
* @author 小李
|
||||
* @date 9:09 2024/9/13
|
||||
**/
|
||||
**/
|
||||
public interface DlRepairSoiService extends IService<DlRepairSoi> {
|
||||
|
||||
/**
|
||||
* 采购单领料单子表 分页
|
||||
*
|
||||
* @param repairSoiReqVO 查询对象
|
||||
* @author 小李
|
||||
* @date 10:44 2024/9/18
|
||||
* @param repairSoiReqVO 查询对象
|
||||
**/
|
||||
IPage<DlRepairSoi> getRepairSoiPage(DlRepairSoiReqVO repairSoiReqVO, Page<DlRepairSoi> page);
|
||||
|
||||
/**
|
||||
* 采购单领料单子表详细 按ID查
|
||||
*
|
||||
* @param ids ids
|
||||
* @author 小李
|
||||
* @date 11:24 2024/9/22
|
||||
* @param ids ids
|
||||
**/
|
||||
List<DlRepairSoiQueryRespVO> getRepairSoiByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 按主表ID查
|
||||
*
|
||||
* @param soId 主表ID
|
||||
* @author 小李
|
||||
* @date 11:22 2024/10/21
|
||||
* @param soId 主表ID
|
||||
**/
|
||||
List<DlRepairSoiQueryRespVO> getRepairSoiBySoId(String soId);
|
||||
|
||||
/**
|
||||
* 根据关联配件id查询关联配件
|
||||
*
|
||||
* @param ids 配件id集合
|
||||
* @return java.util.List<cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi>
|
||||
* @author PQZ
|
||||
* @date 14:39 2024/10/24
|
||||
**/
|
||||
List<DlRepairSoi> listByIds(List<String> ids);
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoReqVO;
|
||||
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoRespVO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlTicketWares;
|
||||
@ -39,10 +41,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -90,6 +89,8 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
@Resource
|
||||
@Lazy
|
||||
private RepairWorkerService repairWorkerService;
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
/**
|
||||
* 采购单/领料单 新增
|
||||
@ -180,7 +181,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
||||
// 如果主表记录的领退料人与操作人一致,即是员工点击的作废,即需要通知仓库
|
||||
boolean flag = so.getUserId().equals(loginUserId);
|
||||
if (flag){
|
||||
if (flag) {
|
||||
repairWorkerService.sentMessage(Long.valueOf(so.getCreator()), (so.getSoType().equals("02") ? "领料单:" : "退料单:") + so.getSoNo() + "已被" + so.getUserName() + "作废");
|
||||
}
|
||||
}
|
||||
@ -200,17 +201,17 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
|
||||
// 查子表
|
||||
List<DlRepairSoi> list = repairSoiService.list(new LambdaQueryWrapper<DlRepairSoi>().eq(DlRepairSoi::getSoId, result.getId()));
|
||||
if(!list.isEmpty()){
|
||||
if (!list.isEmpty()) {
|
||||
//所有有配件的分类
|
||||
List<Map<String,String>> typeMapList = waresService.getAllTypeList();
|
||||
Map<String,String> typeMap = new HashMap<>();
|
||||
for(Map<String,String> map:typeMapList){
|
||||
typeMap.put(map.get("id"),map.get("name"));
|
||||
List<Map<String, String>> typeMapList = waresService.getAllTypeList();
|
||||
Map<String, String> typeMap = new HashMap<>();
|
||||
for (Map<String, String> map : typeMapList) {
|
||||
typeMap.put(map.get("id"), map.get("name"));
|
||||
}
|
||||
//关联查配件信息
|
||||
List<RepairWares> repairWaresList = waresService.listByIds(list.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList()));
|
||||
Map<String,RepairWares> waresMap = repairWaresList.stream().collect(Collectors.toMap(RepairWares::getId, Function.identity()));
|
||||
list.forEach(item->{
|
||||
Map<String, RepairWares> waresMap = repairWaresList.stream().collect(Collectors.toMap(RepairWares::getId, Function.identity()));
|
||||
list.forEach(item -> {
|
||||
item.setWares(waresMap.get(item.getGoodsId()));
|
||||
item.setTypeName(typeMap.get(item.getWares().getType()));
|
||||
});
|
||||
@ -371,7 +372,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
if (CollectionUtil.isEmpty(updateTitems)) {
|
||||
titemService.updateBatchById(updateTitems);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// 更新维修工单
|
||||
DlRepairTickets tickets = ticketsService.getOne(new LambdaQueryWrapper<DlRepairTickets>().eq(DlRepairTickets::getId, ticketWares.getTicketId()));
|
||||
@ -396,6 +397,83 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
// 通知仓库
|
||||
repairWorkerService.sentMessage(Long.valueOf(newSo.getCreator()), newSo.getUserName() + "已确认退料单:" + newSo.getSoNo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 采购入库
|
||||
*
|
||||
* @param reqVO (接参实体中需传入:采购单id,单据编号soNo,备注remark,入库总价totalPrice,子表中商品id,子表中入库数量inCount)
|
||||
* @author PQZ
|
||||
* @date 14:32 2024/10/24
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void inWare(DlRepairSoReqVO reqVO) {
|
||||
/*1、基础数据准备*/
|
||||
//获取当前登录用户
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
AdminUserRespDTO user = userApi.getUser(userId);
|
||||
//采购单
|
||||
DlRepairSo dlRepairSo = getById(reqVO.getId());
|
||||
//需要保存的入库单
|
||||
DlRepairSo inSo = new DlRepairSo();
|
||||
//过滤掉入库数量为null或0的情况(此为无效数据)
|
||||
List<DlRepairSoi> filterWare = reqVO.getSoiList().stream().filter(item -> item.getInCount() != null && item.getInCount() > 0).collect(Collectors.toList());
|
||||
//即将入库采购品
|
||||
List<DlRepairSoi> pmsWaresList = repairSoiService.listByIds(filterWare.stream().map(DlRepairSoi::getId).collect(Collectors.toList()));
|
||||
//初始化本次入库采购品
|
||||
List<DlRepairSoi> inWaresList = new ArrayList<>();
|
||||
//原始配件库相关配件
|
||||
List<RepairWares> waresList = waresService.listByIds(pmsWaresList.stream().map(DlRepairSoi::getWareId).collect(Collectors.toList()));
|
||||
|
||||
/*2、采购单转入库单*/
|
||||
//入库单关联采购单
|
||||
inSo.setMainId(dlRepairSo.getId());
|
||||
inSo.setMainTable("dl_repair_so");
|
||||
//05表示入库单
|
||||
inSo.setSoType("05");
|
||||
//入库单号
|
||||
inSo.setSoNo(reqVO.getSoNo());
|
||||
//入库人
|
||||
inSo.setUserId(userId);
|
||||
inSo.setUserName(user.getNickname());
|
||||
//入库时间
|
||||
inSo.setSoTime(new Date());
|
||||
//入库商品总价
|
||||
inSo.setTotalPrice(reqVO.getTotalPrice());
|
||||
save(inSo);
|
||||
|
||||
/*3、入库配件处理*/
|
||||
Map<String, DlRepairSoi> filterWareMap = filterWare.stream().collect(Collectors.toMap(DlRepairSoi::getId, soi -> soi));
|
||||
pmsWaresList.forEach(item -> {
|
||||
DlRepairSoi filterSoi = filterWareMap.get(item.getId());
|
||||
DlRepairSoi inWares = item;
|
||||
//采购单id
|
||||
inWares.setSoId(inSo.getId());
|
||||
//采购品原始id
|
||||
inWares.setRawId(item.getId());
|
||||
//入库数量
|
||||
inWares.setInCount(filterSoi.getInCount());
|
||||
inWares.setId(null);
|
||||
//采购品中入库数量字段累加
|
||||
item.setInCount(item.getInCount() == null?0:item.getInCount()+filterSoi.getInCount());
|
||||
inWaresList.add(inWares);
|
||||
});
|
||||
//更新采购品
|
||||
repairSoiService.updateBatchById(pmsWaresList);
|
||||
//新增入库采购品
|
||||
repairSoiService.saveBatch(inWaresList);
|
||||
|
||||
/*4、原始配件库处理*/
|
||||
Map<String, DlRepairSoi> wareMap = filterWare.stream().collect(Collectors.toMap(DlRepairSoi::getWareId, soi -> soi));
|
||||
waresList.forEach(item -> {
|
||||
DlRepairSoi filterSoi = wareMap.get(item.getId());
|
||||
item.setStock((item.getStock()==null?new BigDecimal(0):item.getStock()).add(new BigDecimal(filterSoi.getInCount())));
|
||||
});
|
||||
waresService.updateBatchById(waresList);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -107,6 +107,19 @@ public class DlRepairSoiServiceImpl extends ServiceImpl<DlRepairSoiMapper, DlRep
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关联配件id查询关联配件
|
||||
*
|
||||
* @param ids 配件id集合
|
||||
* @return java.util.List<cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi>
|
||||
* @author PQZ
|
||||
* @date 14:39 2024/10/24
|
||||
**/
|
||||
@Override
|
||||
public List<DlRepairSoi> listByIds(List<String> ids) {
|
||||
return baseMapper.selectBatchIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
package cn.iocoder.yudao.module.stockOperate.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ -20,4 +22,7 @@ public class DlRepairSoReqVO extends DlRepairSo {
|
||||
@Schema(description = "时间区间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date[] searchTimeArray;
|
||||
|
||||
/**关联商品*/
|
||||
List<DlRepairSoi> soiList;
|
||||
}
|
||||
|
@ -295,6 +295,18 @@ public class DlRepairTicketsController {
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 从总检的角度差维修中、已完成的工单数量
|
||||
* @author vinjor-M
|
||||
* @date 11:29 2024/10/24
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@GetMapping("/getBossNum")
|
||||
@Operation(summary = "从总检的角度差维修中、已完成的工单数量")
|
||||
public CommonResult<?> getBossNum() {
|
||||
return success(dlRepairTicketsService.getBossNum());
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务顾问通知客户取车
|
||||
*
|
||||
|
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_tickets(维修工单表)】的数据库操作Service
|
||||
@ -165,6 +166,14 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
**/
|
||||
void confirm(DlRepairTicketsRespVO respVO);
|
||||
|
||||
/**
|
||||
* 从总检的角度差维修中、已完成的工单数量
|
||||
* @author vinjor-M
|
||||
* @date 11:30 2024/10/24
|
||||
* @return java.util.Map<java.lang.String,java.lang.Integer>
|
||||
**/
|
||||
Map<String,Integer> getBossNum();
|
||||
|
||||
/**
|
||||
* 服务顾问通知客户取车
|
||||
*
|
||||
|
@ -44,6 +44,7 @@ import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
||||
import cn.iocoder.yudao.module.tickets.tools.WordUtil;
|
||||
import cn.iocoder.yudao.module.tickets.vo.*;
|
||||
import cn.iocoder.yudao.util.SendSmsUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@ -52,8 +53,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.Na;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -62,11 +61,12 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.ORDER_TENANT_NAME;
|
||||
import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_RECORDS_TYPE;
|
||||
import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_TYPE;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
|
||||
@ -306,7 +306,10 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
RepairRecordsPageReqVO entity = new RepairRecordsPageReqVO();
|
||||
entity.setTicketId(id);
|
||||
List<RepairRecordsRespVO> records = repairRecordsService.queryList(entity);
|
||||
result.setRecords(records);
|
||||
// 操作记录类型
|
||||
List<DictDataRespDTO> recordTypeList = dictDataApi.getDictDataList(DICT_REPAIR_RECORDS_TYPE);
|
||||
Map<String,String> typeMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
|
||||
result.setRecords(records.stream().peek(item->item.setType(typeMap.get(item.getType()))).collect(Collectors.toList()));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -431,15 +434,19 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
public IPage<DlRepairTickets> getPageType(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page) {
|
||||
String userRoleCode = getUserRole();
|
||||
if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())) {
|
||||
//维修管理员看所有数据
|
||||
} else if(userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())){
|
||||
//维修管理员和总检,看所有数据
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())) {
|
||||
//总检
|
||||
if (RepairCons.TICKETS_WAITING.equals(repairTicketsReqVO.getSelectType())) {
|
||||
//查待处理的,查需要自己处理的,否则就是查所有
|
||||
repairTicketsReqVO.setUserId(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
|
||||
repairTicketsReqVO.setUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId()));
|
||||
}
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
|
||||
//服务顾问看自己的
|
||||
}else if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
|
||||
//服务顾问
|
||||
repairTicketsReqVO.setAdviserId(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) {
|
||||
//维修工,进一步判断是否是班组长
|
||||
@ -460,8 +467,10 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
return null;
|
||||
}
|
||||
if (RepairCons.TICKETS_WAITING.equals(repairTicketsReqVO.getSelectType())) {
|
||||
//查待处理
|
||||
return baseMapper.getPageType(repairTicketsReqVO, page);
|
||||
} else {
|
||||
//查所有
|
||||
return baseMapper.getPageTypeAll(repairTicketsReqVO, page);
|
||||
}
|
||||
}
|
||||
@ -713,6 +722,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
String userRoleCode = getUserRole();
|
||||
// 当前操作人的id
|
||||
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
||||
//设置查询类型---待总检或待出厂检验的工单
|
||||
repairTicketsReqVO.setSelectType("special");
|
||||
// 维修服务顾问
|
||||
if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
|
||||
repairTicketsReqVO.setNowRepairId(loginUserId);
|
||||
@ -763,7 +774,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
public void confirm(DlRepairTicketsRespVO respVO) {
|
||||
// 更新工单状态
|
||||
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||
.set(DlRepairTickets::getTicketsWorkStatus, "03")
|
||||
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.END.getCode())
|
||||
.set(DlRepairTickets::getTicketsStatus, TicketsStatusEnum.WAITING_NOTICE.getCode())
|
||||
.eq(DlRepairTickets::getId, respVO.getId())
|
||||
);
|
||||
|
||||
@ -771,6 +783,33 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.JSGD.getCode(), respVO.getRemark(), respVO.getImage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 从总检的角度差维修中、已完成的工单数量
|
||||
*
|
||||
* @return java.util.Map<java.lang.String, java.lang.Integer>
|
||||
* @author vinjor-M
|
||||
* @date 11:30 2024/10/24
|
||||
**/
|
||||
@Override
|
||||
public Map<String, Integer> getBossNum() {
|
||||
Map<String,Integer> rtnMap = new HashMap<>();
|
||||
int workingNum = 0;
|
||||
int doneNum = 0;
|
||||
List<DlRepairTickets> repairTickets = this.list();
|
||||
if(!repairTickets.isEmpty()){
|
||||
Map<String,List<DlRepairTickets>> ifFinishMap = repairTickets.stream().collect(Collectors.groupingBy(DlRepairTickets::getIsFinish));
|
||||
if(ifFinishMap.containsKey("0")){
|
||||
workingNum = ifFinishMap.get("0").size();
|
||||
}
|
||||
if(ifFinishMap.containsKey("1")){
|
||||
doneNum = ifFinishMap.get("1").size();
|
||||
}
|
||||
}
|
||||
rtnMap.put("workingNum",workingNum);
|
||||
rtnMap.put("doneNum",doneNum);
|
||||
return rtnMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务顾问通知客户取车
|
||||
*
|
||||
@ -783,9 +822,14 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
public void noticeCus(NoticeCusVO noticeCusVO) {
|
||||
// 获取客户信息
|
||||
DlRepairTickets tickets = baseMapper.selectById(noticeCusVO.getId());
|
||||
// 更新工单状态为待结算(待取车)
|
||||
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||
.set(DlRepairTickets::getTicketsStatus, TicketsStatusEnum.NO_PAY.getCode())
|
||||
.eq(DlRepairTickets::getId, noticeCusVO.getId())
|
||||
);
|
||||
CustomerMain cus = customerService.getById(tickets.getUserId());
|
||||
// 维修项目
|
||||
List<DictDataRespDTO> repairType = dictDataApi.getDictDataList("repair_type");
|
||||
List<DictDataRespDTO> repairType = dictDataApi.getDictDataList(DICT_REPAIR_TYPE);
|
||||
// 默认是维修
|
||||
String type = "维修";
|
||||
DictDataRespDTO dictDataRespDTO = repairType.stream()
|
||||
@ -796,26 +840,21 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
type = dictDataRespDTO.getLabel();
|
||||
}
|
||||
// 构建消息
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String start = format.format(noticeCusVO.getTime()[0]);
|
||||
String end = format.format(noticeCusVO.getTime()[1]);
|
||||
String message = String.format(
|
||||
"尊敬的客户您好:您的爱车%s已%s完毕,请您于%s至%s之内前来取车。若有问题可以联系%s,联系电话:%s"
|
||||
, tickets.getCarNo(), type, start, end, noticeCusVO.getName(), noticeCusVO.getMobile()
|
||||
"尊敬的客户您好:您的爱车%s已%s完毕,请您前来取车。若有问题可以联系%s,联系电话:%s"
|
||||
, tickets.getCarNo(), type, noticeCusVO.getName(), noticeCusVO.getMobile()
|
||||
);
|
||||
// todo 小程序通知客户
|
||||
if(null!=cus && StringUtils.isNotEmpty(cus.getPhoneNumber())){
|
||||
// 短信通知客户
|
||||
SendSmsUtil.sendMsgCommon(new String[]{message}, cus.getPhoneNumber(), "1400852709", "蓝安汽车小程序", "2143603");
|
||||
}
|
||||
|
||||
// todo 短信通知客户
|
||||
// 记录日志
|
||||
String recordStr = noticeCusVO.getName()
|
||||
+ "通知客户:"
|
||||
+ cus.getCusName()
|
||||
+ "于"
|
||||
+ start
|
||||
+ "至"
|
||||
+ end
|
||||
+ "前来取车";
|
||||
repairRecordsService.saveRepairRecord(noticeCusVO.getId(), null, RecordTypeEnum.JSGD.getCode(), recordStr, null);
|
||||
+ "通知客户取车:"+message;
|
||||
repairRecordsService.saveRepairRecord(noticeCusVO.getId(), null, RecordTypeEnum.TZQC.getCode(), recordStr, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -182,9 +182,10 @@
|
||||
</select>
|
||||
|
||||
<select id="getPageType" resultMap="APPBaseResultMap">
|
||||
-- 查待处理数据 --
|
||||
select drt.*
|
||||
from dl_repair_tickets drt
|
||||
where drt.deleted = '0'
|
||||
where (drt.deleted = '0') AND drt.tickets_status IN ('04','05','01','07')
|
||||
<if test="map.ticketNo != null and map.ticketNo != ''">
|
||||
and (
|
||||
drt.ticket_no like concat('%', #{map.ticketNo}, '%')
|
||||
@ -199,36 +200,36 @@
|
||||
)
|
||||
</if>
|
||||
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
|
||||
and drt.create_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]}
|
||||
and (drt.create_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]})
|
||||
</if>
|
||||
<if test="map.adviserId != null and map.adviserId != ''">
|
||||
and drt.adviser_id = #{map.adviserId}
|
||||
</if>
|
||||
<if test="map.isFinish != null and map.isFinish != ''">
|
||||
and drt.is_finish = #{map.isFinish}
|
||||
</if>
|
||||
<if test="map.userIds != null and map.userIds.size > 0 ">
|
||||
and (drt.tickets_status = '05')
|
||||
<choose>
|
||||
<when test="map.isFinish == '0'">
|
||||
and (drt.now_repair_id in
|
||||
<choose>
|
||||
<when test="map.selectType=='special'">
|
||||
-- 小李用的逻辑 --
|
||||
<if test="map.isFinish != null and map.isFinish != ''">
|
||||
AND ( drt.is_finish = #{map.isFinish})
|
||||
</if>
|
||||
<if test="map.nowRepairId != null and map.nowRepairId != ''">
|
||||
AND ( drt.now_repair_id = #{map.nowRepairId})
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
-- 正常查询用的逻辑 --
|
||||
<if test="map.adviserId != null and map.adviserId != ''">
|
||||
-- 查服务顾问 待处理的 工单未完成并且服务顾问是自己的 工单已完成且当前处理人是自己的--
|
||||
AND ( drt.is_finish = '0' AND drt.adviser_id = #{map.adviserId} )
|
||||
OR (drt.is_finish = '1' AND drt.now_repair_id = #{map.adviserId})
|
||||
</if>
|
||||
<if test="map.userIds != null and map.userIds.size > 0">
|
||||
-- 查维修工、总检待处理的 --
|
||||
AND (drt.is_finish = '0')
|
||||
AND (drt.now_repair_id in
|
||||
<foreach collection="map.userIds" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</when>
|
||||
<when test="map.isFinish == '1'">
|
||||
and (
|
||||
<foreach item="item" collection="map.userIds" index="index" open="" separator="or" close="">
|
||||
find_in_set(#{item}, drti.repair_ids) > 0
|
||||
</foreach>
|
||||
)
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="map.nowRepairId != null and map.nowRepairId != ''">
|
||||
and drt.now_repair_id = #{map.nowRepairId}
|
||||
</if>
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
order by drt.create_time desc
|
||||
</select>
|
||||
|
||||
@ -279,9 +280,11 @@
|
||||
and drt.create_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]}
|
||||
</if>
|
||||
<if test="map.adviserId != null and map.adviserId != ''">
|
||||
-- 服务顾问查所有的就是服务顾问是自己的 --
|
||||
and drt.adviser_id = #{map.adviserId}
|
||||
</if>
|
||||
<if test="map.userIds != null and map.userIds.size > 0">
|
||||
-- 维修工或维修厂长查所有的就是维修人是自己的或者是自己班组内的 --
|
||||
and (
|
||||
<foreach item="item" collection="map.userIds" index="index" open="" separator="or" close="">
|
||||
find_in_set(#{item}, drt.now_repair_id) > 0
|
||||
|
Loading…
Reference in New Issue
Block a user