Merge branch 'repair' of http://122.51.230.86:3000/dianliang/lanan-system into repair
This commit is contained in:
commit
b482acf254
@ -37,6 +37,7 @@ public class InspectionStepInfo extends Model<InspectionStepInfo> {
|
||||
//创建人id
|
||||
private Integer creator;
|
||||
//更新时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
//更新人id
|
||||
private Integer updater;
|
||||
|
@ -1458,6 +1458,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
||||
public InspectionInfoVo inspectionDetail(Long inspectionInfoId) {
|
||||
InspectionInfo info = inspectionInfoService.getById(inspectionInfoId);
|
||||
OrderInfo order = orderService.getById(info.getInspectionOrderId());
|
||||
InspectionGoodsSku sku = skuService.getById(order.getSkuId());
|
||||
AdminUserDO buyUser = userService.getUser(info.getUserId());
|
||||
AdminUserDO worker = userService.getUser(info.getWorkId());
|
||||
InspectionInfoVo res =new InspectionInfoVo();
|
||||
@ -1485,7 +1486,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
||||
res.setStatus(info.getStatus());
|
||||
res.setGoodsId(order.getGoodsId());
|
||||
res.setGoodsPrice(order.getGoodsPrice());
|
||||
res.setGoodsName(order.getGoodsTitle());
|
||||
res.setGoodsName(sku.getSkuName());
|
||||
res.setIsOnline(order.getIsOnline());
|
||||
res.setIsRetrial(info.getIsRetrial());
|
||||
res.setIsPass(info.getIsPass());
|
||||
|
@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -90,6 +91,21 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
||||
//更新
|
||||
this.updateById(workNode);
|
||||
|
||||
// 插入步骤信息
|
||||
InspectionStepInfo inspectionStepInfo = new InspectionStepInfo();
|
||||
inspectionStepInfo.setInspectionInfoId(inspectionId);
|
||||
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
|
||||
.eq(DlInspectionProject::getId, workNode.getProjectId()));
|
||||
if (ObjectUtil.isNotNull(project)) {
|
||||
inspectionStepInfo.setTitle(project.getProjectName());
|
||||
} else {
|
||||
inspectionStepInfo.setTitle("检测项目");
|
||||
}
|
||||
inspectionStepInfo.setCreateTime(DateUtil.date());
|
||||
inspectionStepInfo.setCreator(Integer.parseInt(SecurityFrameworkUtils.getLoginUserId() + ""));
|
||||
inspectionStepInfo.setWorkNodeId(workNodeId);
|
||||
inspectionStepService.save(inspectionStepInfo);
|
||||
|
||||
//查询用户 信息
|
||||
//修改工单表中当前施工人
|
||||
// inspectionInfo.setWorkId(workerUser.getId());
|
||||
@ -143,6 +159,16 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
||||
// 更新流程
|
||||
// this.updateById(workNode);
|
||||
baseMapper.cancelAnOrder(workNode);
|
||||
|
||||
// 删除步骤信息
|
||||
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
|
||||
.eq(DlInspectionProject::getId, workNode.getProjectId()));
|
||||
inspectionStepService.remove(new LambdaQueryWrapper<InspectionStepInfo>()
|
||||
.and(i ->
|
||||
i.eq(InspectionStepInfo::getInspectionInfoId, inspectionId)
|
||||
.eq(InspectionStepInfo::getWorkNodeId, workNodeId)
|
||||
.eq(InspectionStepInfo::getTitle, project.getProjectName())
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -179,40 +205,46 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
||||
LambdaQueryWrapper<InspectionWorkNode> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(InspectionWorkNode::getInspectionInfoId, workNode.getInspectionInfoId());
|
||||
//是否还有进行中或者待开始的状态
|
||||
queryWrapper.in(InspectionWorkNode::getStatus, "0","1");
|
||||
queryWrapper.in(InspectionWorkNode::getStatus, "0", "1");
|
||||
List<InspectionWorkNode> inspectionWorkNodes = this.list(queryWrapper);
|
||||
boolean flag = true;
|
||||
//判断是否是最后一个流程
|
||||
if (inspectionWorkNodes.size() == 1 && inspectionWorkNodes.get(0).getId().equals(workNode.getId())){
|
||||
if (inspectionWorkNodes.size() == 1 && inspectionWorkNodes.get(0).getId().equals(workNode.getId())) {
|
||||
flag = false;
|
||||
}
|
||||
|
||||
|
||||
// 插入步骤信息
|
||||
InspectionStepInfo inspectionStepInfo = new InspectionStepInfo();
|
||||
inspectionStepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(workNode.getInspectionInfoId())));
|
||||
|
||||
//根据projectId查询项目名称
|
||||
// 更新或插入步骤信息
|
||||
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
|
||||
.eq(DlInspectionProject::getId, workNode.getProjectId()));
|
||||
String stepTitle = "";
|
||||
if (ObjectUtil.isNotNull(project)) {
|
||||
inspectionStepInfo.setTitle(project.getProjectName());
|
||||
InspectionStepInfo stepInfo = inspectionStepService.getOne(new LambdaQueryWrapper<InspectionStepInfo>()
|
||||
.and(i -> i.eq(InspectionStepInfo::getInspectionInfoId, workNode.getInspectionInfoId())
|
||||
.eq(InspectionStepInfo::getWorkNodeId, workNode.getId())
|
||||
.eq(InspectionStepInfo::getTitle, ObjectUtil.isNotEmpty(project) ? project.getProjectName() : workNode.getProjectName())
|
||||
));
|
||||
if (ObjectUtil.isNotEmpty(stepInfo)) {
|
||||
stepInfo.setUpdateTime(DateUtil.date());
|
||||
stepInfo.setUpdater(Integer.parseInt(SecurityFrameworkUtils.getLoginUserId() + ""));
|
||||
} else {
|
||||
inspectionStepInfo.setTitle("项目检测完成");
|
||||
stepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(workNode.getInspectionInfoId())));
|
||||
if (ObjectUtil.isNotNull(project)) {
|
||||
stepInfo.setTitle(project.getProjectName());
|
||||
} else {
|
||||
stepInfo.setTitle("项目检测完成");
|
||||
}
|
||||
stepInfo.setWorkNodeId(workNode.getId());
|
||||
stepInfo.setCreateTime(DateUtil.date());
|
||||
stepInfo.setCreator(Integer.parseInt(String.valueOf(loginUser.getId())));
|
||||
stepInfo.setUpdater(Integer.parseInt(String.valueOf(loginUser.getId())));
|
||||
stepInfo.setUpdateTime(DateUtil.date());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(inspectionWorkNode.getRemark())) {
|
||||
inspectionStepInfo.setContent(inspectionWorkNode.getRemark());
|
||||
stepInfo.setContent(inspectionWorkNode.getRemark());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(inspectionWorkNode.getDealImages())) {
|
||||
inspectionStepInfo.setImages(inspectionWorkNode.getDealImages());
|
||||
stepInfo.setImages(inspectionWorkNode.getDealImages());
|
||||
}
|
||||
inspectionStepInfo.setWorkNodeId(workNode.getId());
|
||||
inspectionStepInfo.setCreateTime(DateUtil.date());
|
||||
inspectionStepInfo.setCreator(Integer.parseInt(String.valueOf(loginUser.getId())));
|
||||
inspectionStepService.save(inspectionStepInfo);
|
||||
inspectionStepService.saveOrUpdate(stepInfo);
|
||||
if (!flag) {
|
||||
stepTitle = "检测结束";
|
||||
//设置工单状态为已完成
|
||||
inspectionInfo.setStatus("1");
|
||||
//设置工单通过
|
||||
@ -223,12 +255,12 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
||||
inspectionInfo.setMakeCert("1");
|
||||
|
||||
//步骤结束
|
||||
inspectionStepInfo = new InspectionStepInfo();
|
||||
inspectionStepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(workNode.getInspectionInfoId())));
|
||||
inspectionStepInfo.setTitle(stepTitle);
|
||||
inspectionStepInfo.setCreateTime(DateUtil.date());
|
||||
inspectionStepInfo.setCreator(Integer.parseInt(String.valueOf(loginUser.getId())));
|
||||
inspectionStepService.save(inspectionStepInfo);
|
||||
stepInfo = new InspectionStepInfo();
|
||||
stepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(workNode.getInspectionInfoId())));
|
||||
stepInfo.setTitle("检测结束");
|
||||
stepInfo.setCreateTime(DateUtil.date());
|
||||
stepInfo.setCreator(Integer.parseInt(String.valueOf(loginUser.getId())));
|
||||
inspectionStepService.save(stepInfo);
|
||||
}
|
||||
// else {
|
||||
// //修改工单表当前流程
|
||||
@ -345,7 +377,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
||||
|
||||
List<Integer> roleIds = new ArrayList<>();
|
||||
/*获取所有的角色id*/
|
||||
if(CollUtil.isNotEmpty(workNodes.getWorkNodes())){
|
||||
if (CollUtil.isNotEmpty(workNodes.getWorkNodes())) {
|
||||
roleIds = workNodes.getWorkNodes().stream().map(inspectionWorkNode -> inspectionWorkNode.getRoleId()).collect(Collectors.toList());
|
||||
}
|
||||
//根据角色id获取所有用户
|
||||
@ -431,7 +463,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
||||
*
|
||||
* @param inspectionWorkNode
|
||||
*/
|
||||
public void retrial(InspectionWorkNode inspectionWorkNode){
|
||||
public void retrial(InspectionWorkNode inspectionWorkNode) {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
//通过流程节点id查询流程
|
||||
InspectionWorkNode workNode = this.getById(inspectionWorkNode.getId());
|
||||
@ -454,7 +486,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
||||
Integer roleId = workNode.getRoleId();
|
||||
List<UserDTO> listByUserId = roleService.getListByUserId(roleId);
|
||||
List<Long> ids = listByUserId.stream().map(UserDTO::getId).collect(Collectors.toList());
|
||||
if (ObjectUtil.isNotNull(info.getLeadManId())){
|
||||
if (ObjectUtil.isNotNull(info.getLeadManId())) {
|
||||
ids.add(info.getLeadManId());
|
||||
}
|
||||
sendSocketMessage(ids);
|
||||
|
@ -269,56 +269,112 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by ins.start_time desc
|
||||
</select>
|
||||
<select id="selectByUser" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
||||
SELECT
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT
|
||||
ii.*,
|
||||
iwn.id AS workNodeId,
|
||||
iwn.status AS workNodeStatus,
|
||||
oi.order_no AS orderNo,
|
||||
oi.phonenumber AS buyPhone,
|
||||
ip.project_name AS projectName,
|
||||
su.nickname AS leadManName
|
||||
FROM
|
||||
su.nickname AS leadManName,
|
||||
ROW_NUMBER() OVER (PARTITION BY ii.id ORDER BY iwn.update_time DESC) as rn -- 根据需要调整排序逻辑
|
||||
FROM
|
||||
inspection_info ii
|
||||
LEFT JOIN
|
||||
LEFT JOIN
|
||||
inspection_work_node iwn ON ii.id = iwn.inspection_info_id
|
||||
LEFT JOIN
|
||||
LEFT JOIN
|
||||
order_info oi ON ii.inspection_order_id = oi.id
|
||||
LEFT JOIN
|
||||
LEFT JOIN
|
||||
inspection_project ip ON iwn.project_id = ip.id
|
||||
LEFT JOIN
|
||||
LEFT JOIN
|
||||
system_users su ON ii.lead_man_id = su.id
|
||||
<where>
|
||||
<!-- 车牌号模糊查询 -->
|
||||
<if test="inspectionInfo.carNum != null">
|
||||
AND ii.car_num LIKE CONCAT('%', #{inspectionInfo.carNum}, '%')
|
||||
</if>
|
||||
<!-- 待接受 -->
|
||||
<if test="inspectionInfo.status == 1">
|
||||
AND <!-- 工单负责人或角色ID匹配 -->
|
||||
(ii.lead_man_id = #{inspectionInfo.leadManId}
|
||||
OR iwn.role_id IN
|
||||
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>)
|
||||
AND ii.status = '0'
|
||||
AND iwn.status = '0'
|
||||
-- AND ii.now_order_num = iwn.order_num
|
||||
ORDER BY ii.create_time DESC
|
||||
</if>
|
||||
<!-- 进行中 -->
|
||||
<if test="inspectionInfo.status == 2">
|
||||
AND ii.status = '0'
|
||||
AND iwn.status = '1'
|
||||
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
|
||||
ORDER BY iwn.update_time DESC
|
||||
</if>
|
||||
<!-- 已完成 -->
|
||||
<if test="inspectionInfo.status == 3">
|
||||
AND iwn.status = '2'
|
||||
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
|
||||
ORDER BY iwn.update_time DESC
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<!-- 车牌号模糊查询 -->
|
||||
<if test="inspectionInfo.carNum != null">
|
||||
AND ii.car_num LIKE CONCAT('%', #{inspectionInfo.carNum}, '%')
|
||||
</if>
|
||||
<!-- 待接受 -->
|
||||
<if test="inspectionInfo.status == 1">
|
||||
AND <!-- 工单负责人或角色ID匹配 -->
|
||||
(ii.lead_man_id = #{inspectionInfo.leadManId}
|
||||
OR iwn.role_id IN
|
||||
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>)
|
||||
AND ii.status = '0'
|
||||
AND iwn.status = '0'
|
||||
-- AND ii.now_order_num = iwn.order_num
|
||||
ORDER BY ii.create_time DESC
|
||||
</if>
|
||||
<!-- 进行中 -->
|
||||
<if test="inspectionInfo.status == 2">
|
||||
AND ii.status = '0'
|
||||
AND iwn.status = '1'
|
||||
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
|
||||
ORDER BY iwn.update_time DESC
|
||||
</if>
|
||||
<!-- 已完成 -->
|
||||
<if test="inspectionInfo.status == 3">
|
||||
AND iwn.status = '2'
|
||||
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
|
||||
ORDER BY iwn.update_time DESC
|
||||
</if>
|
||||
</where>
|
||||
) AS subquery
|
||||
WHERE rn = 1;
|
||||
<!-- 之前的查询,修改为了一个工单只出现一条,不分项目 -->
|
||||
<!-- SELECT-->
|
||||
<!-- ii.*,-->
|
||||
<!-- iwn.id AS workNodeId,-->
|
||||
<!-- iwn.status AS workNodeStatus,-->
|
||||
<!-- oi.order_no AS orderNo,-->
|
||||
<!-- oi.phonenumber AS buyPhone,-->
|
||||
<!-- ip.project_name AS projectName,-->
|
||||
<!-- su.nickname AS leadManName-->
|
||||
<!-- FROM-->
|
||||
<!-- inspection_info ii-->
|
||||
<!-- LEFT JOIN-->
|
||||
<!-- inspection_work_node iwn ON ii.id = iwn.inspection_info_id-->
|
||||
<!-- LEFT JOIN-->
|
||||
<!-- order_info oi ON ii.inspection_order_id = oi.id-->
|
||||
<!-- LEFT JOIN-->
|
||||
<!-- inspection_project ip ON iwn.project_id = ip.id-->
|
||||
<!-- LEFT JOIN-->
|
||||
<!-- system_users su ON ii.lead_man_id = su.id-->
|
||||
<!-- <where>-->
|
||||
<!-- <!– 车牌号模糊查询 –>-->
|
||||
<!-- <if test="inspectionInfo.carNum != null">-->
|
||||
<!-- AND ii.car_num LIKE CONCAT('%', #{inspectionInfo.carNum}, '%')-->
|
||||
<!-- </if>-->
|
||||
<!-- <!– 待接受 –>-->
|
||||
<!-- <if test="inspectionInfo.status == 1">-->
|
||||
<!-- AND <!– 工单负责人或角色ID匹配 –>-->
|
||||
<!-- (ii.lead_man_id = #{inspectionInfo.leadManId}-->
|
||||
<!-- OR iwn.role_id IN-->
|
||||
<!-- <foreach collection="roleIds" item="roleId" open="(" separator="," close=")">-->
|
||||
<!-- #{roleId}-->
|
||||
<!-- </foreach>)-->
|
||||
<!-- AND ii.status = '0'-->
|
||||
<!-- AND iwn.status = '0'-->
|
||||
<!-- -- AND ii.now_order_num = iwn.order_num-->
|
||||
<!-- ORDER BY ii.create_time DESC-->
|
||||
<!-- </if>-->
|
||||
<!-- <!– 进行中 –>-->
|
||||
<!-- <if test="inspectionInfo.status == 2">-->
|
||||
<!-- AND ii.status = '0'-->
|
||||
<!-- AND iwn.status = '1'-->
|
||||
<!-- AND iwn.deal_user_id = #{inspectionInfo.dealUserId}-->
|
||||
<!-- ORDER BY iwn.update_time DESC-->
|
||||
<!-- </if>-->
|
||||
<!-- <!– 已完成 –>-->
|
||||
<!-- <if test="inspectionInfo.status == 3">-->
|
||||
<!-- AND iwn.status = '2'-->
|
||||
<!-- AND iwn.deal_user_id = #{inspectionInfo.dealUserId}-->
|
||||
<!-- ORDER BY iwn.update_time DESC-->
|
||||
<!-- </if>-->
|
||||
<!-- </where>-->
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user