Compare commits

..

No commits in common. "f3f37bc908f39a5173908f6238da4719532ad9d4" and "d9dfac5d4c477f232c0ea225c5a715be608bb65c" have entirely different histories.

10 changed files with 58 additions and 308 deletions

View File

@ -96,13 +96,4 @@ public class InspectionInfoController extends BaseController
{ {
return toAjax(inspectionInfoService.deleteInspectionInfoByIds(id)); return toAjax(inspectionInfoService.deleteInspectionInfoByIds(id));
} }
/**
* 根据当前登陆人获取可以选择的工单
* @return
*/
@GetMapping("geStelectInspection")
public CommonResult geStelectInspection(){
return success(inspectionInfoService.geStelectInspection());
}
} }

View File

@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.inspection.entity; package cn.iocoder.yudao.module.inspection.entity;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
@ -144,10 +143,4 @@ public class InspectionInfo extends TenantBaseDO
private String isPayOnline; private String isPayOnline;
//是否上门取车0否1是 //是否上门取车0否1是
private String isPickCar; private String isPickCar;
/** 当前流程节点 */
private Integer nowOrderNum;
/** 开始检测时需要 传入 选择项目的id、角色id、排序 */
private List<InspectionWorkNode> inspectionWorkNodes;
private String workNodeId;
} }

View File

@ -1,81 +0,0 @@
package cn.iocoder.yudao.module.inspection.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 检测流程表
* </p>
*
* @author dianliang
* @since 2024-10-31
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("inspection_work_node")
public class InspectionWorkNode extends TenantBaseDO {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
/**
* 检测工单主键
*/
private Long inspectionInfoId;
/**
* 项目主键
*/
private String projectId;
/**
* 角色主键
*/
private Integer roleId;
/**
* 排序
*/
private Integer orderNum;
/**
* 记录类型inspection_records_type
*/
private String type;
/**
* 记录描述
*/
private String remark;
/**
* 维修图片
*/
private String dealImages;
/**
* 处理人
*/
private String dealUserName;
/**
* 处理人员工表id
*/
private Integer dealUserId;
}

View File

@ -1,16 +0,0 @@
package cn.iocoder.yudao.module.inspection.mapper;
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 检测流程表 Mapper 接口
* </p>
*
* @author dianliang
* @since 2024-10-31
*/
public interface InspectionWorkNodeMapper extends BaseMapper<InspectionWorkNode> {
}

View File

@ -75,9 +75,4 @@ public interface IInspectionInfoService extends IService<InspectionInfo>
Map<String,Object> workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime); Map<String,Object> workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime);
/**
* 根据当前登陆人获取可以选择的工单
* @return
*/
List<InspectionInfo> geStelectInspection();
} }

View File

@ -1,16 +0,0 @@
package cn.iocoder.yudao.module.inspection.service;
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 检测流程表 服务类
* </p>
*
* @author dianliang
* @since 2024-10-31
*/
public interface IInspectionWorkNodeService extends IService<InspectionWorkNode> {
}

View File

@ -2,13 +2,9 @@ package cn.iocoder.yudao.module.inspection.service.impl;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.LoginUser;
@ -21,9 +17,7 @@ import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService;
import cn.iocoder.yudao.module.payment.service.IOrderInfoDetailService; import cn.iocoder.yudao.module.payment.service.IOrderInfoDetailService;
import cn.iocoder.yudao.module.payment.service.OrderInfoService; import cn.iocoder.yudao.module.payment.service.OrderInfoService;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService; import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.util.SendSmsUtil; import cn.iocoder.yudao.util.SendSmsUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -55,7 +49,8 @@ import javax.annotation.Resource;
* @date 2023-08-13 * @date 2023-08-13
*/ */
@Service @Service
public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper, InspectionInfo> implements IInspectionInfoService { public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,InspectionInfo> implements IInspectionInfoService
{
@Autowired @Autowired
private AdminUserService userService; private AdminUserService userService;
@Autowired @Autowired
@ -77,15 +72,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
private IDelOrderInfoService delInspectionOrderService; private IDelOrderInfoService delInspectionOrderService;
@Autowired @Autowired
private IDelInspectionInfoService delInspectionInfoService; private IDelInspectionInfoService delInspectionInfoService;
@Autowired
private IInspectionWorkNodeService workNodeService;
@Autowired
private InspectionStepInfoService inspectionStepInfoService;
@Resource @Resource
private CustomerMainService customerMainService; private CustomerMainService customerMainService;
@Autowired
private RoleService roleService;
/** /**
* 查询请填写功能名称 * 查询请填写功能名称
* *
@ -93,7 +81,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
* @return 请填写功能名称 * @return 请填写功能名称
*/ */
@Override @Override
public InspectionInfo selectInspectionInfoById(Long id) { public InspectionInfo selectInspectionInfoById(Long id)
{
return baseMapper.selectInspectionInfoById(id); return baseMapper.selectInspectionInfoById(id);
} }
@ -104,7 +93,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
* @return 请填写功能名称 * @return 请填写功能名称
*/ */
@Override @Override
public IPage<InspectionInfo> selectInspectionInfoList(Page<InspectionInfo> page, InspectionInfo inspectionInfo) { public IPage<InspectionInfo> selectInspectionInfoList(Page<InspectionInfo> page, InspectionInfo inspectionInfo)
{
return baseMapper.selectInspectionInfoList(page,inspectionInfo); return baseMapper.selectInspectionInfoList(page,inspectionInfo);
} }
@ -119,19 +109,15 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
public int insertInspectionInfo(InspectionInfo inspectionInfo) throws Exception { public int insertInspectionInfo(InspectionInfo inspectionInfo) throws Exception {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partners = appInspectionPartnerService.shopInfo(); ShopMallPartners partners = appInspectionPartnerService.shopInfo();
// LambdaQueryWrapper<PartnerWorker> workerQueryWrapper =new LambdaQueryWrapper<>(); LambdaQueryWrapper<PartnerWorker> workerQueryWrapper =new LambdaQueryWrapper<>();
// workerQueryWrapper.eq(PartnerWorker::getUserId,loginUser.getId()).eq(PartnerWorker::getPartnerId,partners.getPartnerId()); workerQueryWrapper.eq(PartnerWorker::getUserId,loginUser.getId()).eq(PartnerWorker::getPartnerId,partners.getPartnerId());
// PartnerWorker worker = workerService.getOne(workerQueryWrapper); PartnerWorker worker = workerService.getOne(workerQueryWrapper);
// if (ObjectUtils.isNotEmpty(worker)){ if (ObjectUtils.isNotEmpty(worker)){
// inspectionInfo.setWorkId(worker.getId()); inspectionInfo.setWorkId(worker.getId());
// }else { }else {
// throw new Exception("请先将接待员加入员工"); throw new Exception("请先将接待员加入员工");
// }
if (ObjectUtils.isEmpty(inspectionInfo.getInspectionWorkNodes())) {
throw new RuntimeException("请选择检测项目");
} }
//当前登陆人 就是检测人 AdminUserDO workerUser =userService.getUser(worker.getUserId());
AdminUserDO workerUser = userService.getUser(loginUser.getId());
String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"未知客户"; String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"未知客户";
String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone())?inspectionInfo.getBuyPhone():StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():""; String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone())?inspectionInfo.getBuyPhone():StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"";
AdminUserDO user = userService.getUserByMobile(buyPhone); AdminUserDO user = userService.getUserByMobile(buyPhone);
@ -227,23 +213,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
} }
//追加订单明细记录 //追加订单明细记录
orderInfoDetailService.save(new OrderInfoDetail(orderInfo.getId(),"线下订单创建",new Date(),0L,"1")); orderInfoDetailService.save(new OrderInfoDetail(orderInfo.getId(),"线下订单创建",new Date(),0L,"1"));
//默认当前流程的顺序为1 return baseMapper.insert(inspectionInfo);
inspectionInfo.setNowOrderNum(1);
//添加检测工单
baseMapper.insert(inspectionInfo);
//补充检测流程
List<InspectionWorkNode> inspectionWorkNodes = inspectionInfo.getInspectionWorkNodes();
//将检测工单流程补充检测工单id
inspectionWorkNodes.stream().forEach(inspectionWorkNode -> inspectionWorkNode.setInspectionInfoId(inspectionInfo.getId()));
workNodeService.saveBatch(inspectionWorkNodes);
//检测步骤表插入检测开始
InspectionStepInfo stepInfo = new InspectionStepInfo();
stepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(inspectionInfo.getId())));
stepInfo.setTitle("检测开始");
stepInfo.setContent("检测开始");
boolean save = inspectionStepInfoService.save(stepInfo);
return save ? 1 : 0;
} }
@Override @Override
@ -314,7 +284,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int deleteInspectionInfoByIds(Long id) { public int deleteInspectionInfoByIds(Long id)
{
InspectionInfo info = this.getById(id); InspectionInfo info = this.getById(id);
baseMapper.deleteInspectionInfoById(id); baseMapper.deleteInspectionInfoById(id);
OrderInfo orderInfo = orderInfoService.getById(info.getInspectionOrderId()); OrderInfo orderInfo = orderInfoService.getById(info.getInspectionOrderId());
@ -336,10 +307,10 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteInspectionInfoById(Long id) { public int deleteInspectionInfoById(Long id)
{
return baseMapper.deleteInspectionInfoById(id); return baseMapper.deleteInspectionInfoById(id);
} }
@Override @Override
public List<InspectionInfo> workOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime){ public List<InspectionInfo> workOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime){
return baseMapper.workOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime); return baseMapper.workOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime);
@ -364,51 +335,4 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
public Map<String, Object> workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) { public Map<String, Object> workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) {
return baseMapper.workOrderData(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime); return baseMapper.workOrderData(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime);
} }
/**
* 根据当前登陆人获取可以选择的工单
*
* @return
*/
@Override
public List<InspectionInfo> geStelectInspection() {
//获取当前登录人
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
//获取当前登陆人的角色
List<UserRoleDO> byUserId = roleService.getByUserId(loginUser.getId());
List<Long> roleIds = byUserId.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());
//查询所有工单为进行中的
List<InspectionInfo> inspectionInfos = baseMapper.selectList(new LambdaQueryWrapper<InspectionInfo>()
.eq(InspectionInfo::getStatus, 0));
//根据工单id查询工单流程节点
List<Long> infoIds = inspectionInfos.stream().map(inspectionInfo -> inspectionInfo.getId()).collect(Collectors.toList());
if (ObjectUtils.isNotEmpty(infoIds)) {
List<InspectionWorkNode> inspectionWorkNodes = workNodeService.list(new LambdaQueryWrapper<InspectionWorkNode>()
.in(InspectionWorkNode::getInspectionInfoId, infoIds)
.eq(InspectionWorkNode::getDealUserId, null));
//工单集合
List<InspectionInfo> inspectionInfoList = new ArrayList<>();
//根据工单id查询工单流程节点
Map<Long, List<InspectionWorkNode>> inspectionWorkNodeMap = inspectionWorkNodes.stream().collect(Collectors.groupingBy(InspectionWorkNode::getInspectionInfoId));
for (InspectionInfo inspectionInfo : inspectionInfos) {
List<InspectionWorkNode> inspectionWorkNodeList = inspectionWorkNodeMap.get(inspectionInfo.getId());
//遍历工单流程节点 流程为key
if (CollectionUtil.isNotEmpty(inspectionWorkNodeList)) {
Map<Integer, InspectionWorkNode> inspectionWorkMap = inspectionWorkNodeList.stream().collect(Collectors.toMap(InspectionWorkNode::getOrderNum, item -> item));
InspectionWorkNode inspectionWorkNode = inspectionWorkMap.get(inspectionInfo.getNowOrderNum());
if (inspectionWorkNode != null){
//判断当前项目 当前登录人员 是否可以处理
if (roleIds.contains(inspectionWorkNode.getRoleId())){
inspectionInfo.setWorkNodeId(inspectionWorkNode.getId());
inspectionInfoList.add(inspectionInfo);
}
}
}
}
return inspectionInfoList;
}
return null;
}
} }

View File

@ -1,20 +0,0 @@
package cn.iocoder.yudao.module.inspection.service.impl;
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
import cn.iocoder.yudao.module.inspection.mapper.InspectionWorkNodeMapper;
import cn.iocoder.yudao.module.inspection.service.IInspectionWorkNodeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 检测流程表 服务实现类
* </p>
*
* @author dianliang
* @since 2024-10-31
*/
@Service
public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNodeMapper, InspectionWorkNode> implements IInspectionWorkNodeService {
}

View File

@ -168,11 +168,4 @@ public interface RoleService {
List<RoleDO> pageByQuery(RoleDO roleDO); List<RoleDO> pageByQuery(RoleDO roleDO);
IPage<UserDTO> selectListByRoleId(RolePageReqVO role); IPage<UserDTO> selectListByRoleId(RolePageReqVO role);
/**
* 根据用户id查询角色
* @param userId
* @return
*/
List<UserRoleDO> getByUserId(Long userId);
} }

View File

@ -359,19 +359,6 @@ public class RoleServiceImpl implements RoleService {
return userRoleMapper.selectListByRoleId(page,role); return userRoleMapper.selectListByRoleId(page,role);
} }
/**
* 根据用户id查询角色
*
* @param userId
* @return
*/
@Override
public List<UserRoleDO> getByUserId(Long userId) {
List<UserRoleDO> userRoleDOS = userRoleMapper.selectList(new LambdaQueryWrapper<UserRoleDO>()
.eq(UserRoleDO::getUserId, userId));
return userRoleDOS;
}
/** /**
* 获得自身的代理对象解决 AOP 生效问题 * 获得自身的代理对象解决 AOP 生效问题
* *