Commit 828b8914 by HlQ

[add]

1.工单管理添加项目、人员、汇总报表
2.工单添加邮箱字段,为支持海外用户
[fix] 查询用户列表过滤离职员工
1 parent 912a1499
......@@ -84,7 +84,7 @@ public class RoleController {
List<User> userList = Opt.ofEmptyAble(userRoleList)
.map(l -> l.stream().map(RUserRole::getUserId).collect(Collectors.toList()))
.filter(CollUtil::isNotEmpty)
.map(userIdList -> userService.lambdaQuery().in(User::getId, userIdList).list())
.map(userIdList -> userService.lambdaQuery().in(User::getId, userIdList).ne(User::getStatus, 5).list())
.orElse(ListUtil.empty());
return converter.convert(userList, UserVO.class);
}
......
......@@ -2,31 +2,34 @@ package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.text.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.liaochong.myexcel.core.DefaultExcelBuilder;
import com.github.liaochong.myexcel.core.watermark.Watermark;
import vion.utils.excel.AttachmentExportUtil;
import com.github.liaochong.myexcel.utils.WatermarkUtil;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import vion.config.FaultTypeConverter;
import vion.config.UserNameConverter;
import vion.dto.TaskDTO;
import vion.model.FaultLog;
import vion.model.Task;
import vion.service.IFaultLogService;
import vion.service.ITaskService;
import vion.utils.excel.AttachmentExportUtil;
import vion.vo.TaskVO;
import vion.vo.UserVO;
import jakarta.servlet.http.HttpServletResponse;
import java.awt.*;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/api")
......@@ -135,4 +138,28 @@ public class TaskController {
public String urgeTask(Long taskId, String remark) {
return taskService.urgeTask(taskId, remark);
}
@GetMapping("/task/peopleAnal")
@SaCheckPermission(value = "task:peopleAnal", orRole = "admin")
public List<Map<String, Object>> peopleAnalysis(@DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate,
Integer source) {
return taskService.peopleAnalysis(startDate, endDate, source);
}
@GetMapping("/task/proAnal")
@SaCheckPermission(value = "task:proAnal", orRole = "admin")
public List<Map<String, Object>> proAnalysis(@DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate,
Integer source) {
return taskService.proAnalysis(startDate, endDate, source);
}
@GetMapping("/task/summaryAnal")
@SaCheckPermission(value = "task:summaryAnal", orRole = "admin")
public Map<String, Map<String, List<Task>>> summaryAnalysis(@DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate,
Integer source) {
return taskService.summaryAnalysis(startDate, endDate, source);
}
}
......@@ -2,7 +2,6 @@ package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import jakarta.servlet.http.HttpServletResponse;
......@@ -57,7 +56,10 @@ public class UserController {
@GetMapping("/user/onlyName")
@SaCheckPermission(value = "user:listName", orRole = "admin")
public List<UserVO> getNameList(UserDTO dto) {
return converter.convert(userService.list(Wrappers.lambdaQuery(converter.convert(dto, new User())).select(User::getId, User::getUserid, User::getUsername, User::getPreWorkOrder)), UserVO.class);
return converter.convert(userService.lambdaQuery(converter.convert(dto, new User()))
.select(User::getId, User::getUserid, User::getUsername, User::getPreWorkOrder)
.ne(User::getStatus, 5)
.list(), UserVO.class);
}
@GetMapping("/user")
......
......@@ -12,47 +12,81 @@ import java.util.Date;
@Setter
public class TaskDTO extends BaseDTO {
private Long id;
/** 门店id */
/**
* 门店id
*/
private Long storeId;
/** 报修日期 */
/**
* 报修日期
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date repairTime;
/** 故障类型 */
/**
* 故障类型
*/
private Integer faultType;
/** 故障说明 */
/**
* 故障说明
*/
private String faultDescription;
/** 报修人 */
/**
* 报修人
*/
private String repairPeople;
/** 报修人联系方式 */
/**
* 报修人联系方式
*/
private String repairPhone;
/** 状态:0待确认1进行中2已完成3挂起 */
/**
* 状态:0待确认1进行中2已完成3挂起
*/
private Integer status;
/** 解决日期 */
/**
* 解决日期
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date solveDate;
/** 故障原因 */
/**
* 故障原因
*/
private String faultReason;
/** 解决措施:0产品BUG、1使用问题、2需求问题 */
/**
* 解决措施:0产品BUG、1使用问题、2需求问题
*/
private Integer solveType;
/** 解决故障描述 */
/**
* 解决故障描述
*/
private String solveDescription;
/** 创建者 */
/**
* 创建者
*/
private Long createUser;
/** 当前处理人 */
/**
* 当前处理人
*/
private Long activeUser;
/** 截止日期 */
/**
* 截止日期
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date expDate;
/** 备注 */
/**
* 备注
*/
private String remark;
/** 集团id */
/**
* 集团id
*/
private Long accountId;
private String uuid;
/** 预工单id */
/**
* 预工单id
*/
private Long taskTempId;
private MultipartFile[] files;
......@@ -62,6 +96,17 @@ public class TaskDTO extends BaseDTO {
private Date enddate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date curDate;
/** 工时 */
/**
* 工时
*/
private Double manHour;
/**
* 邮箱地址
*/
private String email;
/**
* 工单来源:1:客户提交 2:直接创建
*/
private Integer source;
}
......@@ -44,6 +44,10 @@ public class TaskTempDTO extends BaseDTO {
* 工程师姓名
*/
private String engineerName;
/**
* 邮箱地址
*/
private String email;
private String openid;
private MultipartFile[] files;
......
......@@ -77,4 +77,8 @@ public class Task {
private String uuid;
/** 预工单id */
private Long taskTempId;
/**
* 邮箱地址
*/
private String email;
}
......@@ -63,6 +63,11 @@ public class TaskTemp {
*/
private String engineerName;
/**
* 邮箱地址
*/
private String email;
/** 微信用户id */
private String openid;
}
......
......@@ -6,7 +6,9 @@ import vion.dto.TaskDTO;
import vion.model.Task;
import vion.vo.TaskVO;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface ITaskService extends MPJBaseService<Task> {
......@@ -23,4 +25,10 @@ public interface ITaskService extends MPJBaseService<Task> {
String forwardTask(Long taskId, String forwardUser);
String urgeTask(Long taskId, String remark);
List<Map<String, Object>> peopleAnalysis(Date startDate, Date endDate, Integer source);
List<Map<String, Object>> proAnalysis(Date startDate, Date endDate, Integer source);
Map<String, Map<String, List<Task>>> summaryAnalysis(Date startDate, Date endDate, Integer source);
}
package vion.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.io.file.FileNameUtil;
import org.dromara.hutool.core.io.file.FileUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.crypto.SecureUtil;
import org.dromara.hutool.json.JSONArray;
import org.dromara.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import vion.dto.ContractDTO;
......@@ -123,15 +123,18 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord
contractDTO.setStatus(2);
Contract existContract = contractService.lambdaQuery().eq(Contract::getContractNo, record.getContractNo()).one();
if (ObjUtil.isNull(existContract) || ObjUtil.isNull(existContract.getStatus())) {
log.error("根据发货记录,更新合同状态出错,该合同不存在:{}", record.getContractNo());
log.error("根据发货记录,更新合同状态出错。该合同不存在或合同状态为空:{}", record.getContractNo());
}
if (existContract.getStatus() < 2) {
if (ObjUtil.isNotNull(existContract) && existContract.getStatus() < 2) {
// todo 发货后,更新对应合同的付款的节点时间字段 合同id获取不到
/*contractPaymentService.lambdaUpdate()
.set(ContractPayment::getNodeDate, record.getShipDate())
.eq(ContractPayment::getContractId, )
.update(new ContractPayment());*/
contractService.updateById(null, record.getContractNo(), contractDTO);
List<String> useridList = contractUserService.listObjs(Wrappers.<RContractUser>lambdaQuery().select(RContractUser::getUserId).eq(RContractUser::getContractId, existContract.getId()), Object::toString);
dingMod.workMsg(buildMsg(useridList.stream().distinct().collect(Collectors.joining(",")), record, existContract));
}
// 更新点位信息的发货状态
pointInfoService.lambdaUpdate().set(PointInfo::getShippingStatus, 1)
......@@ -142,9 +145,6 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord
Opt.ofNullable(pointInfoService.lambdaQuery().eq(PointInfo::getContractNo, record.getContractNo()).one())
.ifPresent(p -> pointInfoService.designPush(null, p, "发货"));
List<String> useridList = contractUserService.listObjs(Wrappers.<RContractUser>lambdaQuery().select(RContractUser::getUserId).eq(RContractUser::getContractId, existContract.getId()), Object::toString);
dingMod.workMsg(buildMsg(useridList.stream().distinct().collect(Collectors.joining(",")), record, existContract));
}
JSONObject buildMsg(String userid, DeliveryRecord rec, Contract contract) {
......
......@@ -64,9 +64,9 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
@Override
public Page<TaskVO> getTaskList(TaskDTO data) {
UserVO userVO = (UserVO) StpUtil.getTokenSession().get("curLoginUser");
Set<Long> taskIdSet = getTaskIdSet(userVO);
var taskIdSet = getTaskIdSet(userVO);
MPJLambdaWrapper<Task> wrapper = new MPJLambdaWrapper<>(converter.convert(data, Task.class))
var wrapper = new MPJLambdaWrapper<>(converter.convert(data, Task.class))
.selectAll(Task.class)
.selectAs(Store::getName, TaskVO::getStoreName)
.selectAs(Account::getName, TaskVO::getAccountName)
......@@ -75,10 +75,12 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
.leftJoin(Account.class, Account::getId, Task::getAccountId)
.leftJoin(ServiceOrder.class, ServiceOrder::getTaskId, Task::getId)
.between(ArrayUtil.isAllNotNull(data.getStartdate(), data.getEnddate()), Task::getRepairTime, data.getStartdate(), data.getEnddate())
.isNotNull(ObjUtil.equals(data.getSource(), 1), Task::getTaskTempId)
.isNull(ObjUtil.equals(data.getSource(), 2), Task::getTaskTempId)
.lt(data.getCurDate() != null, Task::getExpDate, data.getCurDate());
if (taskIdSet.size() == 1) {
Long taskId = CollUtil.get(taskIdSet, 0);
var taskId = CollUtil.get(taskIdSet, 0);
// 不是管理员,并且第一次处理工单,但当前处理人是他 || 管理员逻辑
if (taskId.equals(-99L) || taskId.equals(0L)) {
return this.selectJoinListPage(Page.of(data.getPageNum(), data.getPageSize()), TaskVO.class, wrapper);
......@@ -128,7 +130,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
@Override
public TaskVO getTaskById(Long taskId) {
MPJLambdaWrapper<Task> wrapper = new MPJLambdaWrapper<Task>()
var wrapper = new MPJLambdaWrapper<Task>()
.selectAll(Task.class)
.selectAs(Store::getName, TaskVO::getStoreName)
.selectCollection(FileInfo.class, TaskTempVO::getFileList)
......@@ -414,6 +416,100 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
}
}
@Override
public List<Map<String, Object>> peopleAnalysis(Date startDate, Date endDate, Integer source) {
List<Task> taskList = this.lambdaQuery()
.between(ArrayUtil.isAllNotNull(startDate, endDate), Task::getRepairTime, startDate, endDate)
.isNotNull(ObjUtil.equals(source, 1), Task::getTaskTempId)
.isNull(ObjUtil.equals(source, 2), Task::getTaskTempId)
.list();
List<Store> storeList = storeService.list();
Map<Long, String> id2UsernameMap = userService.list().stream().collect(Collectors.toMap(User::getId, User::getUsername));
List<FaultLog> logList = faultLogService.lambdaQuery().isNotNull(FaultLog::getManHour).list();
Map<Long, Double> taskId2HourMap = logList.stream().collect(Collectors.groupingBy(FaultLog::getTaskId, Collectors.summingDouble(FaultLog::getManHour)));
// 人 => 工单
Map<Long, List<Task>> p2TaskMap = taskList.stream().collect(Collectors.groupingBy(Task::getActiveUser));
var resList = new ArrayList<Map<String, Object>>();
p2TaskMap.forEach((p, list) -> {
var hourSum = list.stream().mapToDouble(v -> taskId2HourMap.getOrDefault(v.getId(), 0D)).sum();
var inList = list.stream().filter(v -> v.getStatus().equals(2)).toList();
var expList = inList.stream().filter(v -> v.getExpDate().after(new Date())).toList();
var finishList = list.stream().filter(v -> v.getStatus().equals(3)).toList();
var storeIdSet = list.stream().map(Task::getStoreId).collect(Collectors.toSet());
var storeNameList = storeList.stream().filter(v -> storeIdSet.contains(v.getId())).distinct().map(Store::getName).collect(Collectors.joining(","));
Map<String, Object> cntMap = Map.of("person", id2UsernameMap.get(p),
"total", list,
"finish", finishList,
"in", inList,
"exp", expList,
"hourSum", hourSum,
"storeNameList", storeNameList);
resList.add(cntMap);
});
// resList 按照 total对应的list的size降序排列
resList.sort((o1, o2) -> ((List<Task>) o2.get("total")).size() - ((List<Task>) o1.get("total")).size());
return resList;
}
@Override
public List<Map<String, Object>> proAnalysis(Date startDate, Date endDate, Integer source) {
List<Task> taskList = this.lambdaQuery()
.between(ArrayUtil.isAllNotNull(startDate, endDate), Task::getRepairTime, startDate, endDate)
.isNotNull(ObjUtil.equals(source, 1), Task::getTaskTempId)
.isNull(ObjUtil.equals(source, 2), Task::getTaskTempId)
.list();
List<Store> storeList = storeService.list();
Map<Long, String> id2UsernameMap = userService.list().stream().collect(Collectors.toMap(User::getId, User::getUsername));
List<FaultLog> logList = faultLogService.lambdaQuery().isNotNull(FaultLog::getManHour).list();
Map<Long, Double> taskId2HourMap = logList.stream().collect(Collectors.groupingBy(FaultLog::getTaskId, Collectors.summingDouble(FaultLog::getManHour)));
Map<Long, String> storeId2NameMap = storeList.stream().collect(Collectors.toMap(Store::getId, Store::getName));
// 项目 => 工单
Map<Long, List<Task>> store2TaskMap = taskList.stream().collect(Collectors.groupingBy(Task::getStoreId));
var resList = new ArrayList<Map<String, Object>>();
store2TaskMap.forEach((p, list) -> {
var hourSum = list.stream().mapToDouble(v -> taskId2HourMap.getOrDefault(v.getId(), 0D)).sum();
var inList = list.stream().filter(v -> v.getStatus().equals(2)).toList();
var expList = inList.stream().filter(v -> v.getExpDate().after(new Date())).toList();
var finishList = list.stream().filter(v -> v.getStatus().equals(3)).toList();
var userSet = list.stream().map(Task::getActiveUser).distinct().map(id2UsernameMap::get).collect(Collectors.joining(","));
Map<String, Object> cntMap = Map.of("name", storeId2NameMap.get(p),
"total", list,
"finish", finishList,
"in", inList,
"exp", expList,
"hourSum", hourSum,
"userList", userSet);
resList.add(cntMap);
});
resList.sort((o1, o2) -> ((List<Task>) o2.get("total")).size() - ((List<Task>) o1.get("total")).size());
return resList;
}
@Override
public Map<String, Map<String, List<Task>>> summaryAnalysis(Date startDate, Date endDate, Integer source) {
Map<Long, String> id2UsernameMap = userService.list().stream().collect(Collectors.toMap(User::getId, User::getUsername));
Map<Long, String> id2StoreNameMap = storeService.list().stream().collect(Collectors.toMap(Store::getId, Store::getName));
var taskList = this.lambdaQuery()
.between(ArrayUtil.isAllNotNull(startDate, endDate), Task::getRepairTime, startDate, endDate)
.isNotNull(ObjUtil.equals(source, 1), Task::getTaskTempId)
.isNull(ObjUtil.equals(source, 2), Task::getTaskTempId)
.eq(Task::getStatus, 2).list();
var map = taskList.stream().collect(Collectors.groupingBy(Task::getActiveUser, Collectors.groupingBy(Task::getStoreId)));
var resMap = new HashMap<String, Map<String, List<Task>>>();
map.forEach((k, m) -> {
var username = id2UsernameMap.get(k);
var storeMap = new HashMap<String, List<Task>>();
m.forEach((k1, l) -> storeMap.put(id2StoreNameMap.get(k1), l));
resMap.put(username, storeMap);
});
return resMap;
}
JSONObject buildMsg(String userid, String storeName, Task task) {
Map<String, String> orderStatusMap = redisTemplate.opsForHash().entries(RedisKeyEnum.DICT_PREFIX.getVal() + RedisKeyEnum.ORDER_STATUS.getVal());
......
package vion.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.bean.BeanUtil;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.io.file.FileNameUtil;
import org.dromara.hutool.core.io.file.FileUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.crypto.SecureUtil;
import org.dromara.hutool.json.JSONArray;
import org.dromara.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import vion.dto.TaskTempDTO;
......@@ -34,7 +33,6 @@ import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -52,17 +50,17 @@ public class TaskTempServiceImpl extends MPJBaseServiceImpl<TaskTempMapper, Task
@Override
public Page<TaskTempVO> getTaskTempList(TaskTempDTO data) {
Page<TaskTemp> taskTempPage = this
var taskTempPage = this
.lambdaQuery(converter.convert(data, TaskTemp.class))
.between(ArrayUtil.isAllNotNull(data.getStartdate(), data.getEnddate()), TaskTemp::getRepairTime, data.getStartdate(), data.getEnddate())
.page(Page.of(data.getPageNum(), data.getPageSize()));
List<TaskTempVO> taskTempVOList = converter.convert(taskTempPage.getRecords(), TaskTempVO.class);
var taskTempVOList = converter.convert(taskTempPage.getRecords(), TaskTempVO.class);
return Page.<TaskTempVO>of(taskTempPage.getCurrent(), taskTempPage.getSize(), taskTempPage.getTotal()).setRecords(taskTempVOList);
}
@Override
public TaskTempVO getTaskTempById(Long id) {
MPJLambdaWrapper<TaskTemp> wrapper = new MPJLambdaWrapper<TaskTemp>()
var wrapper = new MPJLambdaWrapper<TaskTemp>()
.selectAll(TaskTemp.class)
.selectCollection(FileInfo.class, TaskTempVO::getFileList)
.leftJoin(FileInfo.class, on -> on
......@@ -80,7 +78,7 @@ public class TaskTempServiceImpl extends MPJBaseServiceImpl<TaskTempMapper, Task
@Override
public Object saveTaskTemp(TaskTempDTO data) {
TaskTemp taskTemp = converter.convert(data, TaskTemp.class);
var taskTemp = converter.convert(data, TaskTemp.class);
this.save(taskTemp);
Opt.ofNullable(data.getFiles())
......@@ -112,30 +110,31 @@ public class TaskTempServiceImpl extends MPJBaseServiceImpl<TaskTempMapper, Task
}));
// todo 异步发送钉钉消息通知
List<User> userList = userService.lambdaQuery().eq(User::getPreWorkOrder, 1).list();
var userList = userService.lambdaQuery().eq(User::getPreWorkOrder, 1).list();
String userids = userList.stream().map(User::getUserid).collect(Collectors.joining(","));
dingMod.workMsg(buildMsg(userids, taskTemp));
return MapUtil.<String, Long>builder()
.put("id", taskTemp.getId())
.build();
return Map.of("id", taskTemp.getId());
}
@Override
public Map<String, Long> getInfoByPhone(String phone) {
MPJLambdaWrapper<TaskTemp> wrapper = new MPJLambdaWrapper<TaskTemp>()
if (StrUtil.isBlank(phone)) {
return Map.of();
}
var wrapper = new MPJLambdaWrapper<TaskTemp>()
.selectAs(TaskTemp::getStoreId, TaskTempVO::getStoreId)
.selectAs(Store::getAccountId, TaskTempVO::getAccountId)
.leftJoin(Store.class, Store::getId, TaskTemp::getStoreId)
.eq(TaskTemp::getRepairPhone, phone)
.orderByDesc(TaskTemp::getCreateTime);
List<TaskTempVO> voList = this.selectJoinList(TaskTempVO.class, wrapper);
List<TaskTempVO> filterList = voList.stream().filter(BeanUtil::isNotEmpty).collect(Collectors.toList());
var voList = this.selectJoinList(TaskTempVO.class, wrapper);
var filterList = voList.stream().filter(BeanUtil::isNotEmpty).collect(Collectors.toList());
if (CollUtil.isNotEmpty(filterList) && filterList.size() > 1) {
return MapUtil.<String, Long>builder().put("accountId", filterList.get(0).getAccountId()).put("storeId", filterList.get(0).getStoreId()).build();
return Map.of("accountId", filterList.get(0).getAccountId(), "storeId", filterList.get(0).getStoreId());
}
return MapUtil.empty();
return Map.of();
}
JSONObject buildMsg(String userid, TaskTemp taskTemp) {
......
......@@ -42,6 +42,7 @@ public class UserServiceImpl extends MPJBaseServiceImpl<UserMapper, User> implem
.selectAll(User.class)
.select(Dept::getDeptName)
.leftJoin(Dept.class, Dept::getDeptId, User::getDeptId)
.ne(User::getStatus, 5)
.orderByAsc(User::getStatus);
var userVOS = this.selectJoinListPage(Page.of(dto.getPageNum(), dto.getPageSize()), UserVO.class, wrapper);
var roleWrapper = new MPJLambdaWrapper<Role>()
......@@ -59,17 +60,17 @@ public class UserServiceImpl extends MPJBaseServiceImpl<UserMapper, User> implem
@Override
public List<MapTree<String>> getOrgTree(String deptId) {
var deptList = deptService.list();
var userList = this.list();
var userList = this.lambdaQuery().ne(User::getStatus, 5).list();
List<TreeNode<String>> nodeList = ListUtil.zero();
deptList.forEach(v -> {
TreeNode<String> node = new TreeNode<>(v.getDeptId().toString(), v.getParentId().toString(), v.getDeptName(), 1);
node.setExtra(Map.of("type", "dept","pkId", v.getId()));
node.setExtra(Map.of("type", "dept", "pkId", v.getId()));
nodeList.add(node);
});
userList.forEach(v -> {
TreeNode<String> node = new TreeNode<>(v.getUserid(), v.getDeptId().toString(), v.getUsername(), 2);
node.setExtra(Map.of("type", "user","pkId", v.getId()));
node.setExtra(Map.of("type", "user", "pkId", v.getId()));
nodeList.add(node);
});
var wholeTree = TreeUtil.build(nodeList, "1");
......
......@@ -62,4 +62,9 @@ public class TaskTempVO {
* 确认后的工单。可能不存在
*/
private Task task;
/**
* 邮箱地址
*/
private String email;
}
......@@ -105,6 +105,11 @@ public class TaskVO {
* uuid
*/
private String uuid;
/**
* 邮箱地址
*/
private String email;
/**
* 集团id
*/
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!