Compare commits

..

No commits in common. "3fbc9e04225c2f607e7489cc6c872d7c6491784b" and "a8a8fa0aea21d4923dfa15560cc0646929f4e34a" have entirely different histories.

7 changed files with 33 additions and 60 deletions

View File

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

View File

@ -63,14 +63,21 @@ 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())) {
InspectionFile folder = inspectionFileService.getOne(Wrappers.<InspectionFile>lambdaQuery().eq(InspectionFile::getId, inspectionEquInfo.getFolderId())); List<InspectionFile> fileList = inspectionFileService.list(Wrappers.<InspectionFile>lambdaQuery()
if (ObjectUtil.isNull(folder)) { .eq(InspectionFile::getFatherId, inspectionEquInfo.getFolderId()));
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,10 +42,8 @@ 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;
@ -122,8 +120,6 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
private DlInspectionProjectService projectService; private DlInspectionProjectService projectService;
@Autowired @Autowired
private FileService fileService; private FileService fileService;
@Autowired
private IInspectionAppointmentService inspectionAppointmentService;
/** /**
* 查询请填写功能名称 * 查询请填写功能名称
@ -209,20 +205,6 @@ 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());
@ -743,23 +725,24 @@ 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<>(); // 线程安全 Map<String, Long> result = new ConcurrentHashMap<>(); // 使用ConcurrentHashMap以确保线程安全
// 这里 `5` 而不是 `6`因为 i `0` 开始 // 定义一个数组来保存所有的CompletableFuture
CompletableFuture<Void>[] futures = new CompletableFuture[6]; CompletableFuture<Void>[] futures = new CompletableFuture[6];
for (int i = 0; i < 6; i++) { // 改为 `0~4` for (int i = 1; i < 6; i++) {
final String status = String.valueOf(i + 1); final String status = String.valueOf(i);
// 深拷贝对象防止多线程修改冲突 // 复制一份inspectionInfo对象避免多线程修改同一个对象导致的问题
InspectionInfo infoCopy = JSON.parseObject(JSON.toJSONString(inspectionInfo), InspectionInfo.class); InspectionInfo infoCopy = BeanUtil.toBean(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(() -> {
@ -776,15 +759,8 @@ 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,10 +33,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectInspectionAppointmentById" parameterType="Long" resultMap="InspectionAppointmentResult"> <select id="selectInspectionAppointmentById" parameterType="Long" resultMap="InspectionAppointmentResult">
select ia.*,su.nickname as buyName, su.mobile as buyPhoneNum <include refid="selectInspectionAppointmentVo"/>
from inspection_appointment ia where id = #{id}
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,12 +355,6 @@ 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;