Compare commits

...

3 Commits

Author SHA1 Message Date
许允枞
3fbc9e0422 更新 2025-03-25 16:58:56 +08:00
许允枞
ca071db8ce 更新 2025-03-25 16:25:38 +08:00
许允枞
5f57de111a 更新 2025-03-25 14:55:51 +08:00
7 changed files with 59 additions and 32 deletions

View File

@ -60,7 +60,6 @@ public class InspectionAppointmentController extends BaseController
/** /**
* 获取请填写功能名称详细信息 * 获取请填写功能名称详细信息
*/ */
@PreAuthorize("@ss.hasPermi('system:appointment:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public CommonResult getInfo(@PathVariable("id") Long id) public CommonResult getInfo(@PathVariable("id") Long id)
{ {
@ -80,7 +79,6 @@ public class InspectionAppointmentController extends BaseController
/** /**
* 修改请填写功能名称 * 修改请填写功能名称
*/ */
@PreAuthorize("@ss.hasPermi('system:appointment:edit')")
@PutMapping @PutMapping
public CommonResult edit(@RequestBody InspectionAppointment inspectionAppointment) public CommonResult edit(@RequestBody InspectionAppointment inspectionAppointment)
{ {

View File

@ -96,6 +96,10 @@ public class InspectionInfo extends TenantBaseDO
private String customerSource; private String customerSource;
/** 引车员id*/ /** 引车员id*/
private Long leadManId; private Long leadManId;
/** 接车员id*/
private Long meetManId;
/** 是否接车*/
private String isMeetCar;
@TableField(exist = false) @TableField(exist = false)
private String lastTitle; private String lastTitle;
@ -171,4 +175,6 @@ public class InspectionInfo extends TenantBaseDO
private Integer additionalRecording; private Integer additionalRecording;
@TableField(exist = false) @TableField(exist = false)
private String orderId; private String orderId;
@TableField(exist = false)
private Long appointmentId;
} }

View File

@ -202,15 +202,13 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
throw new Exception("信息有误"); throw new Exception("信息有误");
} }
} else { } else {
LambdaQueryWrapper<PartnerWorker> queryWrapperWork = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ShopMallPartners> queryWrapper = new LambdaQueryWrapper<>();
queryWrapperWork.eq(PartnerWorker::getUserId, user.getId()); queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType, "jc").eq(ShopMallPartners::getIsBanned, "0").last("limit 1");
queryWrapperWork.orderByAsc(PartnerWorker::getPartnerId); partner = this.getOne(queryWrapper);
queryWrapperWork.last("limit 1"); if (ObjectUtil.isEmpty(partner)) {
PartnerWorker worker = partnerWorkerService.getOne(queryWrapperWork);
if (ObjectUtil.isEmpty(worker)) {
throw new Exception("信息有误"); throw new Exception("信息有误");
} }
partner.setPartnerId(worker.getPartnerId()); partner.setPartnerId(partner.getPartnerId());
} }
return partner; return partner;
} }

View File

@ -63,21 +63,14 @@ public class InspectionEquInfoServiceImpl extends ServiceImpl<InspectionEquInfoM
public InspectionEquInfo selectInspectionEquInfoById(Long id) { public InspectionEquInfo selectInspectionEquInfoById(Long id) {
InspectionEquInfo inspectionEquInfo = baseMapper.selectInspectionEquInfoById(id); InspectionEquInfo inspectionEquInfo = baseMapper.selectInspectionEquInfoById(id);
//查询文件附件 //查询文件表文件夹id是否存在
if (ObjectUtil.isNotEmpty(inspectionEquInfo.getFolderId())) { if (ObjectUtil.isNotEmpty(inspectionEquInfo.getFolderId())) {
List<InspectionFile> fileList = inspectionFileService.list(Wrappers.<InspectionFile>lambdaQuery() InspectionFile folder = inspectionFileService.getOne(Wrappers.<InspectionFile>lambdaQuery().eq(InspectionFile::getId, inspectionEquInfo.getFolderId()));
.eq(InspectionFile::getFatherId, inspectionEquInfo.getFolderId())); if (ObjectUtil.isNull(folder)) {
inspectionEquInfo.setFolderId(null);
}
}
List<FileDO> copyFileList = new ArrayList<>();
for (InspectionFile inspectionFile : fileList) {
FileDO fileDO = new FileDO();
//把文件名后缀截取掉
fileDO.setUrl(inspectionFile.getFilePath());
fileDO.setName(inspectionFile.getFileName());
copyFileList.add(fileDO);
}
inspectionEquInfo.setFileList(copyFileList);
}
return inspectionEquInfo; return inspectionEquInfo;
} }

View File

@ -42,8 +42,10 @@ import cn.iocoder.yudao.module.system.dal.mysql.permission.RoleMapper;
import cn.iocoder.yudao.module.system.service.permission.RoleService; 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.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.iocoder.yudao.util.StringUtils; import cn.iocoder.yudao.util.StringUtils;
@ -120,6 +122,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
private DlInspectionProjectService projectService; private DlInspectionProjectService projectService;
@Autowired @Autowired
private FileService fileService; private FileService fileService;
@Autowired
private IInspectionAppointmentService inspectionAppointmentService;
/** /**
* 查询请填写功能名称 * 查询请填写功能名称
@ -205,6 +209,20 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
//赊账的情况 //赊账的情况
orderInfo.setOrderStatus("0"); orderInfo.setOrderStatus("0");
orderInfoService.save(orderInfo); orderInfoService.save(orderInfo);
//判断有没有传预约信息
if (ObjectUtil.isNotNull(inspectionInfo.getAppointmentId())) {
//修改预约信息表的orderId
InspectionAppointment appointment = new InspectionAppointment();
appointment.setOrderId(orderInfo.getId());
inspectionAppointmentService.update(Wrappers.<InspectionAppointment>lambdaUpdate()
.eq(InspectionAppointment::getId, inspectionInfo.getAppointmentId())
.set(InspectionAppointment::getOrderId, orderInfo.getId()));
//修改订单的核销时间
orderInfoService.update(Wrappers.<OrderInfo>lambdaUpdate()
.eq(OrderInfo::getId, orderInfo.getId())
.set(OrderInfo::getValidationTime, new Date()));
}
inspectionInfo.setInspectionOrderId(orderInfo.getId()); inspectionInfo.setInspectionOrderId(orderInfo.getId());
inspectionInfo.setPartnerId(partners.getPartnerId()); inspectionInfo.setPartnerId(partners.getPartnerId());
inspectionInfo.setWorkerName(workerUser.getNickname()); inspectionInfo.setWorkerName(workerUser.getNickname());
@ -725,24 +743,23 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
List<UserRoleDO> byUserId = roleService.getByUserId(loginUser.getId()); List<UserRoleDO> byUserId = roleService.getByUserId(loginUser.getId());
inspectionInfo.setLeadManId(loginUser.getId()); inspectionInfo.setLeadManId(loginUser.getId());
List<Long> roleIds = byUserId.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList()); List<Long> roleIds = byUserId.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());
if (!"1".equals(inspectionInfo.getStatus())) { if (!"1".equals(inspectionInfo.getStatus())) {
// 进行中 已完成
inspectionInfo.setDealUserId(loginUser.getId()); inspectionInfo.setDealUserId(loginUser.getId());
} }
Map<String, Long> result = new ConcurrentHashMap<>(); // 使用ConcurrentHashMap以确保线程安全 Map<String, Long> result = new ConcurrentHashMap<>(); // 线程安全
// 定义一个数组来保存所有的CompletableFuture // 这里 `5` 而不是 `6`因为 i `0` 开始
CompletableFuture<Void>[] futures = new CompletableFuture[6]; CompletableFuture<Void>[] futures = new CompletableFuture[6];
for (int i = 1; i < 6; i++) { for (int i = 0; i < 6; i++) { // 改为 `0~4`
final String status = String.valueOf(i); final String status = String.valueOf(i + 1);
// 复制一份inspectionInfo对象避免多线程修改同一个对象导致的问题 // 深拷贝对象防止多线程修改冲突
InspectionInfo infoCopy = BeanUtil.toBean(inspectionInfo, InspectionInfo.class); InspectionInfo infoCopy = JSON.parseObject(JSON.toJSONString(inspectionInfo), InspectionInfo.class);
infoCopy.setStatus(status); infoCopy.setStatus(status);
// 为每个任务创建一个新的Page对象
Page<InspectionInfo> page = new Page<>(1, 10); Page<InspectionInfo> page = new Page<>(1, 10);
futures[i] = CompletableFuture.runAsync(() -> { futures[i] = CompletableFuture.runAsync(() -> {
@ -759,8 +776,15 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("Failed to execute tasks in parallel", e); throw new RuntimeException("Failed to execute tasks in parallel", e);
} finally { } finally {
// 关闭线程池
executor.shutdown(); executor.shutdown();
try {
if (!executor.awaitTermination(10, TimeUnit.SECONDS)) {
executor.shutdownNow();
}
} catch (InterruptedException e) {
executor.shutdownNow();
} }
} }
} }
}

View File

@ -33,8 +33,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectInspectionAppointmentById" parameterType="Long" resultMap="InspectionAppointmentResult"> <select id="selectInspectionAppointmentById" parameterType="Long" resultMap="InspectionAppointmentResult">
<include refid="selectInspectionAppointmentVo"/> select ia.*,su.nickname as buyName, su.mobile as buyPhoneNum
where id = #{id} from inspection_appointment ia
left join system_users su on su.id = ia.user_id
where ia.id = #{id}
</select> </select>
<insert id="insertInspectionAppointment" parameterType="cn.iocoder.yudao.module.inspection.entity.InspectionAppointment"> <insert id="insertInspectionAppointment" parameterType="cn.iocoder.yudao.module.inspection.entity.InspectionAppointment">

View File

@ -355,6 +355,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND iwn.deal_user_id = #{inspectionInfo.dealUserId} AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
ORDER BY iwn.update_time DESC ORDER BY iwn.update_time DESC
</if> </if>
<!-- 待接车 -->
<if test="inspectionInfo.status == 6">
AND ii.is_meet_car = '0'
AND ii.meet_man_id = #{inspectionInfo.dealUserId}
ORDER BY iwn.update_time DESC
</if>
</where> </where>
) AS subquery ) AS subquery
WHERE rn = 1; WHERE rn = 1;