Commit ef11ee50 by HlQ

[add] 点位设计详情页面添加设备序列号列表字段

[chg] 优化工单流转逻辑
1 parent e29cfbb6
......@@ -168,6 +168,12 @@ public class PointInfoServiceImpl extends MPJBaseServiceImpl<PointInfoMapper, Po
" \n #### 联系人:{}", existPoint.getProjectName(), existPoint.getContact());
dingMod.robotPush(DING_GROUP_TOKEN, buildMsg("点位设计提醒", content));
}
if (ObjUtil.isNotNull(dto.getSourceType()) && dto.getSourceType().equals(20)) {
String content = StrUtil.format("### 门店回执单已上传请及时处理" +
" \n #### 项目名称:{}" +
" \n #### 联系人:{}", existPoint.getProjectName(), existPoint.getContact());
dingMod.robotPush(DING_GROUP_TOKEN, buildMsg("点位设计提醒", content));
}
saveFile(finalId, infile, dto);
}));
if (ObjUtil.isNotNull(dto.getIsConstruct()) && dto.getIsConstruct().equals(1)) {
......@@ -267,11 +273,13 @@ public class PointInfoServiceImpl extends MPJBaseServiceImpl<PointInfoMapper, Po
MPJLambdaWrapper<PointInfo> wrapper = new MPJLambdaWrapper<PointInfo>()
.selectAll(PointInfo.class)
.selectCollection(RPointWx.class, PointInfoVO::getWxNameList, map -> map.result(RPointWx::getWxName))
.selectCollection(RPointDevice.class, PointInfoVO::getDeviceNoList, map -> map.result(RPointDevice::getDeviceNo))
.selectAs(Account::getName, PointInfoVO::getAccountName)
.selectAs(Contract::getTotalAmount, PointInfoVO::getContractAmount)
.leftJoin(Account.class, Account::getId, PointInfo::getAccountId)
.leftJoin(Contract.class, Contract::getContractNo, PointInfo::getContractNo)
.leftJoin(RPointWx.class, RPointWx::getPointId, PointInfo::getId)
.leftJoin(RPointDevice.class, RPointDevice::getPointId, PointInfo::getId)
.eq(ObjUtil.isNotEmpty(id), PointInfo::getId, id)
.eq(StrUtil.isNotBlank(uuid), PointInfo::getUuid, uuid)
.orderByDesc(PointInfo::getCreateTime);
......
......@@ -125,17 +125,24 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
@Transactional(rollbackFor = Exception.class)
public Long circTask(TaskDTO data, String token) {
UserVO user = (UserVO) StpUtil.getTokenSession().get("curLoginUser");
Task task = converter.convert(data, Task.class);
if (task.getId() == null) {
task.setCreateUser(user.getId());
handleTaskTemp(data);
Task task = prepareTask(data, user);
sendNotifications(data, task, user);
handleFiles(data, task, user);
return task.getId();
}
// 可能直接提工单,而不是预工单确认之后生成的工单
/**
* <p>创建工单前,先判断预工单是否已经确认。</p>
* <p>如果未确认,将预工单状态改为已确认。后面的流程进行创建工单。</p>
*
* @param data 前端传参
*/
private void handleTaskTemp(TaskDTO data) {
if (ObjUtil.isNotNull(data.getTaskTempId())) {
Task existTask = this.lambdaQuery().eq(Task::getTaskTempId, data.getTaskTempId()).one();
Assert.isNull(existTask, "工单已创建,无需再次确认");
taskTempService.lambdaUpdate()
.set(TaskTemp::getStatus, 3)
.set(TaskTemp::getOperator, data.getActiveUser())
......@@ -143,14 +150,23 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
.eq(TaskTemp::getId, data.getTaskTempId())
.update(new TaskTemp());
}
}
if (data.getId() == null) {
//添加新工单
/**
* 根据前端是否传参工单id,来判断是更新工单还是新增工单,并创建对应的工单日志
*
* @param data 前端传参
* @param user 当前登录用户
* @return vion.model.Task
*/
private Task prepareTask(TaskDTO data, UserVO user) {
Task task = converter.convert(data, Task.class);
if (task.getId() == null) {
task.setCreateUser(user.getId());
task.setUuid(IdUtil.nanoId());
this.save(task);
List<FaultLog> saveList = new ArrayList<>();
// 预工单提交,客户名称不在系统用户表内
// 预工单提交,客户名称不在系统用户表内。单独处理客户提交的预工单日志
FaultLog faultLog = new FaultLog();
faultLog.setTaskId(task.getId());
faultLog.setStoreId(task.getStoreId());
......@@ -159,7 +175,8 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
faultLog.setCreateTime(task.getRepairTime());
saveList.add(faultLog);
//添加工单处理日志
// 添加工单处理日志
// 预工单确认,变为工单,添加日志
FaultLog faultLog1 = new FaultLog();
faultLog1.setTaskId(task.getId());
faultLog1.setStoreId(task.getStoreId());
......@@ -170,28 +187,52 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
faultLogService.saveBatch(saveList);
} else {
this.updateById(task);
handleFaultLog(data, user, task);
}
return task;
}
//根据状态判断是否要添加工单处理日志(状态:1待确认2进行中3已完成4挂起)
/**
* 工单日志处理
*
* @param data 前端传参
* @param user 当前登录用户
* @param task 工单
*/
private void handleFaultLog(TaskDTO data, UserVO user, Task task) {
FaultLog faultLog = new FaultLog();
faultLog.setTaskId(task.getId());
faultLog.setStoreId(task.getStoreId());
faultLog.setOperator(user.getId());
faultLog.setRemark(task.getRemark());
faultLog.setManHour(data.getManHour());
if (task.getStatus() == 2) {
faultLog.setContent("工单正在处理中");
}
if (task.getStatus() == 3) {
faultLog.setContent("工单处理完成");
}
if (task.getStatus() == 4) {
faultLog.setContent("工单挂起");
faultLog.setContent(getFaultLogContent(task.getStatus()));
faultLogService.save(faultLog);
}
if (task.getStatus() == 5) {
faultLog.setContent("工单已关闭");
private String getFaultLogContent(int status) {
switch (status) {
case 2:
return "工单正在处理中";
case 3:
return "工单处理完成";
case 4:
return "工单挂起";
case 5:
return "工单已关闭";
default:
return "";
}
faultLogService.save(faultLog);
}
/**
* 钉钉提醒和微信提醒
*
* @param data 前端传参
* @param task 工单
* @param user 当前登录用户
*/
private void sendNotifications(TaskDTO data, Task task, UserVO user) {
// todo 异步发送钉钉消息通知
Store store = storeService.getById(task.getStoreId());
Task existTask = this.getById(task.getId());
......@@ -230,7 +271,16 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
String sentMsg = wechatMod.sendMsg("H3zWJysLWrcxrUlrgqPnjDV7LyWLaml_Ap9WsLuQDCs", openid, wxMpTemplateDataList, null);
});
}
}
/**
* 文件处理
*
* @param data 前端传参
* @param task 工单
* @param user 当前登录用户
*/
private void handleFiles(TaskDTO data, Task task, UserVO user) {
Opt.ofNullable(data.getFiles())
.ifPresent(fileList ->
Arrays.stream(fileList).forEach(infile -> {
......@@ -257,7 +307,6 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
fileInfo.setUploader(user.getUsername());
fileService.save(fileInfo);
}));
return task.getId();
}
@Override
......
......@@ -229,8 +229,12 @@ public class PointInfoVO {
*/
private String uuid;
/** 绑定单子的微信昵称列表 */
private List<String> wxNameList;
/** 单子施工后的设备序列号列表 */
private List<String> deviceNoList;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!