Browse Source

1、设置图片原图字段;2、修改机场平台tenantCode字段;

tags/v1.0.0^2
wanjing 1 year ago
parent
commit
a7cb6dce95
7 changed files with 254 additions and 201 deletions
  1. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/execute/ExecuteInspectionService.java
  2. +1
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFileDistributionListService.java
  3. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/task/AirportTask.java
  4. +10
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/inspection/InspectionFileDistributionListVo.java
  5. +93
    -76
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionFileServiceImpl.java
  6. +137
    -122
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java
  7. +11
    -1
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/vo/WorkOrderHandleVo.java

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/execute/ExecuteInspectionService.java View File

jsonObject.put("taskId", inspection.getInspectionLine()); jsonObject.put("taskId", inspection.getInspectionLine());
jsonObject.put("requestId", inspection.getId()); jsonObject.put("requestId", inspection.getId());
jsonObject.put("code", "gs"); // 与机场平台约定好的 jsonObject.put("code", "gs"); // 与机场平台约定好的
jsonObject.put("tenantName", tenant.getName());
jsonObject.put("tenantCode", tenant.getCode());


log.info("进入调用机场平台方法: url:{}", url); log.info("进入调用机场平台方法: url:{}", url);
log.info("进入调用机场平台方法: jsonObject:{}", jsonObject); log.info("进入调用机场平台方法: jsonObject:{}", jsonObject);

+ 1
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFileDistributionListService.java View File

inspectionFileDistributionListVo.setQuestionName(questionType.getContent()); inspectionFileDistributionListVo.setQuestionName(questionType.getContent());
} }
inspectionFileDistributionListVo.setFileThumbnail(CommonConfig.imageURL + inspectionFileDistributionListVo.getFileThumbnail()); inspectionFileDistributionListVo.setFileThumbnail(CommonConfig.imageURL + inspectionFileDistributionListVo.getFileThumbnail());
inspectionFileDistributionListVo.setFileOriginal(CommonConfig.imageURL + inspectionFileDistributionListVo.getFileOriginal());
} }
return inspectionFileDistributionListVoList; return inspectionFileDistributionListVoList;
} }

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/task/AirportTask.java View File

jsonObject.put("taskId", inspection.getInspectionLine()); jsonObject.put("taskId", inspection.getInspectionLine());
jsonObject.put("requestId", String.valueOf(inspection.getId())); jsonObject.put("requestId", String.valueOf(inspection.getId()));
jsonObject.put("code", "gs"); // 与机场平台约定好的 jsonObject.put("code", "gs"); // 与机场平台约定好的
jsonObject.put("tenantName", tenant.getName());
jsonObject.put("tenantCode", tenant.getCode());


String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST"); String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST");
if (StringUtils.isEmpty(airPortStr)) { if (StringUtils.isEmpty(airPortStr)) {

+ 10
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/inspection/InspectionFileDistributionListVo.java View File

*/ */
private String questionName; private String questionName;


/**
* 文件名称
*/
private String fileName;

/** /**
* 缩略图 * 缩略图
*/ */
private String fileThumbnail; private String fileThumbnail;


/**
* 原图
*/
private String fileOriginal;

/** /**
* 经度 * 经度
*/ */

+ 93
- 76
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionFileServiceImpl.java View File

private QuestionTypeMapper questionTypeMapper; private QuestionTypeMapper questionTypeMapper;


/** /**
*待确认问题 status状态为5
* 待确认问题 status状态为5
*
* @param query * @param query
* @return * @return
*/ */
@Override @Override
public JsonResult unconfirmedQuestion(InspectionFileQuery query) { public JsonResult unconfirmedQuestion(InspectionFileQuery query) {
if(null == query.getLimit() && null == query.getPage()){
if (null == query.getLimit() && null == query.getPage()) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//登录用户信息 //登录用户信息
String tenantId = CurrentUserUtil.getTenantId(); String tenantId = CurrentUserUtil.getTenantId();
query.setTenantId(tenantId);
if(StringUtils.isEmpty(query.getInspectionId())){
query.setTenantId(tenantId);
if (StringUtils.isEmpty(query.getInspectionId())) {
return JsonResult.error("任务id为空"); return JsonResult.error("任务id为空");
} }
//获取当前登录人 //获取当前登录人
Inspection inspection = inspectionMapper.selectOne(Wrappers.<Inspection>lambdaQuery() Inspection inspection = inspectionMapper.selectOne(Wrappers.<Inspection>lambdaQuery()
.eq(Inspection::getId, query.getInspectionId()) .eq(Inspection::getId, query.getInspectionId())
.eq(Inspection::getMark, 1)); .eq(Inspection::getMark, 1));
if(ObjectUtil.isNull(inspection)){
if (ObjectUtil.isNull(inspection)) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//设置分页 //设置分页
IPage<InspectionFile> page = new Page<>(query.getPage(),query.getLimit());
IPage<InspectionFile> page = new Page<>(query.getPage(), query.getLimit());
//获取分页数据 //获取分页数据
IPage<InspectionFile> result = inspectionFileMapper.selectPage(page, Wrappers.<InspectionFile>lambdaQuery() IPage<InspectionFile> result = inspectionFileMapper.selectPage(page, Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getInspectionId, query.getInspectionId()) .eq(InspectionFile::getInspectionId, query.getInspectionId())


/** /**
* 已确认问题 status状态为15 * 已确认问题 status状态为15
*
* @param query * @param query
* @return * @return
*/ */
@Override @Override
public JsonResult confirmedQuestion(InspectionFileQuery query) { public JsonResult confirmedQuestion(InspectionFileQuery query) {
if(null==query.getLimit() && null == query.getPage()){
if (null == query.getLimit() && null == query.getPage()) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//登录用户信息 //登录用户信息
String tenantId = CurrentUserUtil.getTenantId(); String tenantId = CurrentUserUtil.getTenantId();
query.setTenantId(tenantId); query.setTenantId(tenantId);
if(StringUtils.isEmpty(query.getInspectionId())){
if (StringUtils.isEmpty(query.getInspectionId())) {
return JsonResult.error("任务id为空"); return JsonResult.error("任务id为空");
} }
//获取当前登录人 //获取当前登录人
Inspection inspection = inspectionMapper.selectOne(Wrappers.<Inspection>lambdaQuery() Inspection inspection = inspectionMapper.selectOne(Wrappers.<Inspection>lambdaQuery()
.eq(Inspection::getId, query.getInspectionId()) .eq(Inspection::getId, query.getInspectionId())
.eq(Inspection::getMark, 1)); .eq(Inspection::getMark, 1));
if(ObjectUtil.isNull(inspection)){
if (ObjectUtil.isNull(inspection)) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//设置分页 //设置分页
IPage<InspectionFile> page = new Page<>(query.getPage(),query.getLimit());
IPage<InspectionFile> page = new Page<>(query.getPage(), query.getLimit());
//获取分页数据 //获取分页数据
IPage<InspectionFile> result = inspectionFileMapper.selectPage(page, Wrappers.<InspectionFile>lambdaQuery() IPage<InspectionFile> result = inspectionFileMapper.selectPage(page, Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getInspectionId, query.getInspectionId()) .eq(InspectionFile::getInspectionId, query.getInspectionId())


/** /**
* 已忽略问题 status状态为10 * 已忽略问题 status状态为10
*
* @param query * @param query
* @return * @return
*/ */
@Override @Override
public JsonResult ignoredQuestion(InspectionFileQuery query) { public JsonResult ignoredQuestion(InspectionFileQuery query) {
if(null==query.getLimit() && null == query.getPage()){
if (null == query.getLimit() && null == query.getPage()) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//登录用户信息 //登录用户信息
String tenantId = CurrentUserUtil.getTenantId(); String tenantId = CurrentUserUtil.getTenantId();
query.setTenantId(tenantId); query.setTenantId(tenantId);
if(StringUtils.isEmpty(query.getInspectionId())){
if (StringUtils.isEmpty(query.getInspectionId())) {
return JsonResult.error("任务id为空"); return JsonResult.error("任务id为空");
} }
//获取当前登录人 //获取当前登录人
Inspection inspection = inspectionMapper.selectOne(Wrappers.<Inspection>lambdaQuery() Inspection inspection = inspectionMapper.selectOne(Wrappers.<Inspection>lambdaQuery()
.eq(Inspection::getId, query.getInspectionId()) .eq(Inspection::getId, query.getInspectionId())
.eq(Inspection::getMark, 1)); .eq(Inspection::getMark, 1));
if(ObjectUtil.isNull(inspection)){
if (ObjectUtil.isNull(inspection)) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//设置分页 //设置分页
IPage<InspectionFile> page = new Page<>(query.getPage(),query.getLimit());
IPage<InspectionFile> page = new Page<>(query.getPage(), query.getLimit());
//获取分页数据 //获取分页数据
IPage<InspectionFile> result = inspectionFileMapper.selectPage(page, Wrappers.<InspectionFile>lambdaQuery() IPage<InspectionFile> result = inspectionFileMapper.selectPage(page, Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getInspectionId, query.getInspectionId()) .eq(InspectionFile::getInspectionId, query.getInspectionId())


/** /**
* 问题标识 * 问题标识
*
* @param dto * @param dto
* @return * @return
*/ */
@Override @Override
public JsonResult questionIdentification(QuestionIdentificationDto dto) { public JsonResult questionIdentification(QuestionIdentificationDto dto) {
if(StringUtils.isEmpty(dto.getId())) return JsonResult.error("问题id不存在");
if (StringUtils.isEmpty(dto.getId())) return JsonResult.error("问题id不存在");
//查询任务此问题 //查询任务此问题
InspectionFile inspectionFile = inspectionFileMapper.selectOne(Wrappers.<InspectionFile>lambdaQuery() InspectionFile inspectionFile = inspectionFileMapper.selectOne(Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getId, dto.getId()) .eq(InspectionFile::getId, dto.getId())
//修改对应的问题类型 //修改对应的问题类型
inspectionFile.setQuestionId(dto.getQuestionId()); inspectionFile.setQuestionId(dto.getQuestionId());
int count = inspectionFileMapper.updateById(inspectionFile); int count = inspectionFileMapper.updateById(inspectionFile);
if(count<=0){
if (count <= 0) {
return JsonResult.error(); return JsonResult.error();
} }
//设置图片添加域名 //设置图片添加域名
if(StringUtils.isNotEmpty(inspectionFile.getFileThumbnail())){
inspectionFile.setFileThumbnail(CommonConfig.imageURL+inspectionFile.getFileThumbnail());
if (StringUtils.isNotEmpty(inspectionFile.getFileThumbnail())) {
inspectionFile.setFileThumbnail(CommonConfig.imageURL + inspectionFile.getFileThumbnail());
} }
if(StringUtils.isNotEmpty(inspectionFile.getFileOriginal())){
inspectionFile.setFileOriginal(CommonConfig.imageURL+inspectionFile.getFileOriginal());
if (StringUtils.isNotEmpty(inspectionFile.getFileOriginal())) {
inspectionFile.setFileOriginal(CommonConfig.imageURL + inspectionFile.getFileOriginal());
} }
if(StringUtils.isNotEmpty(inspectionFile.getFileImage())){
inspectionFile.setFileImage(CommonConfig.imageURL+inspectionFile.getFileImage());
if (StringUtils.isNotEmpty(inspectionFile.getFileImage())) {
inspectionFile.setFileImage(CommonConfig.imageURL + inspectionFile.getFileImage());
} }






/** /**
* 确认问题 * 确认问题
*
* @param entity * @param entity
* @return * @return
*/ */
@Override @Override
public JsonResult confirm(InspectionFile entity) { public JsonResult confirm(InspectionFile entity) {
if(StringUtils.isEmpty(entity.getId())) {
if (StringUtils.isEmpty(entity.getId())) {
return JsonResult.error("问题id为空"); return JsonResult.error("问题id为空");
} }
//查询当前问题 //查询当前问题
LambdaUpdateWrapper<InspectionFile> qw = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<InspectionFile> qw = new LambdaUpdateWrapper<>();
qw.eq(InspectionFile::getId,entity.getId());
qw.eq(InspectionFile::getMark,1);
qw.set(InspectionFile::getStatus,15);
qw.eq(InspectionFile::getId, entity.getId());
qw.eq(InspectionFile::getMark, 1);
qw.set(InspectionFile::getStatus, 15);
int count = inspectionFileMapper.update(entity, qw); int count = inspectionFileMapper.update(entity, qw);
if(count<=0){
if (count <= 0) {
return JsonResult.error(); return JsonResult.error();
} }
return JsonResult.success("确认问题成功"); return JsonResult.success("确认问题成功");


/** /**
* 忽略问题 * 忽略问题
*
* @param entity * @param entity
* @return * @return
*/ */
@Override @Override
public JsonResult ignore(InspectionFile entity) { public JsonResult ignore(InspectionFile entity) {
if(null == entity.getId()) {
if (null == entity.getId()) {
return JsonResult.error("问题id为空"); return JsonResult.error("问题id为空");
} }
//查询当前问题 //查询当前问题
LambdaUpdateWrapper<InspectionFile> qw = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<InspectionFile> qw = new LambdaUpdateWrapper<>();
qw.eq(InspectionFile::getId,entity.getId());
qw.eq(InspectionFile::getMark,1);
qw.set(InspectionFile::getStatus,10);
qw.eq(InspectionFile::getId, entity.getId());
qw.eq(InspectionFile::getMark, 1);
qw.set(InspectionFile::getStatus, 10);
int count = inspectionFileMapper.update(entity, qw); int count = inspectionFileMapper.update(entity, qw);
if(count<=0){
if (count <= 0) {
return JsonResult.error(); return JsonResult.error();
} }
return JsonResult.success("忽略问题成功"); return JsonResult.success("忽略问题成功");


/** /**
* 查看 * 查看
*
* @param id * @param id
* @return * @return
*/ */
@Override @Override
public JsonResult seeQuestion(String id) { public JsonResult seeQuestion(String id) {
//校验 //校验
if(StringUtils.isEmpty(id)){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
if (StringUtils.isEmpty(id)) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
SeeQuestionVo vo = inspectionFileMapper.selectByInspectionId(id); SeeQuestionVo vo = inspectionFileMapper.selectByInspectionId(id);
if(ObjectUtil.isNull(vo)){
if (ObjectUtil.isNull(vo)) {
return JsonResult.error("未查询出对应的问题及处理结果"); return JsonResult.error("未查询出对应的问题及处理结果");
} }
//对属性处理 //对属性处理
if(StringUtils.isNotEmpty(vo.getFileOriginal())){
vo.setFileOriginal(CommonConfig.imageURL+vo.getFileOriginal());
if (StringUtils.isNotEmpty(vo.getFileOriginal())) {
vo.setFileOriginal(CommonConfig.imageURL + vo.getFileOriginal());
} }
if(StringUtils.isNotEmpty(vo.getFileImage())){
vo.setFileImage(CommonConfig.imageURL+vo.getFileImage());
if (StringUtils.isNotEmpty(vo.getFileImage())) {
vo.setFileImage(CommonConfig.imageURL + vo.getFileImage());
} }
if(StringUtils.isNotEmpty(vo.getFileThumbnail())){
vo.setFileThumbnail(CommonConfig.imageURL+vo.getFileThumbnail());
if (StringUtils.isNotEmpty(vo.getFileThumbnail())) {
vo.setFileThumbnail(CommonConfig.imageURL + vo.getFileThumbnail());
}
if (StringUtils.isNotEmpty(vo.getFileOriginal())) {
vo.setFileOriginal(CommonConfig.imageURL + vo.getFileOriginal());
} }
//对多张处理结果图进行处理用,隔开 //对多张处理结果图进行处理用,隔开
if(StringUtils.isNotEmpty(vo.getHandlerImage())){
if (StringUtils.isNotEmpty(vo.getHandlerImage())) {
String getHandlerImage = getMultipleUrl(vo.getHandlerImage()); String getHandlerImage = getMultipleUrl(vo.getHandlerImage());
vo.setHandlerImage(getHandlerImage); vo.setHandlerImage(getHandlerImage);
} }


/** /**
* 导航 * 导航
*
* @param id * @param id
* @return * @return
*/ */
@Override @Override
public JsonResult navigation(String id) { public JsonResult navigation(String id) {
if(StringUtils.isEmpty(id)){
if (StringUtils.isEmpty(id)) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
InspectionFile inspectionFile = inspectionFileMapper.selectOne(Wrappers.<InspectionFile>lambdaQuery() InspectionFile inspectionFile = inspectionFileMapper.selectOne(Wrappers.<InspectionFile>lambdaQuery()


/** /**
* 问题处理统计 * 问题处理统计
*
* @return * @return
*/ */
@Override @Override
//登录用户信息 //登录用户信息
User userInfo = CurrentUserUtil.getUserInfo(); User userInfo = CurrentUserUtil.getUserInfo();
String username = userInfo.getUsername(); String username = userInfo.getUsername();
if(StringUtils.isEmpty(username)){
return JsonResult.error(InspectionFileEnum.USER_NAME_IS_NULL.getCode(),InspectionFileEnum.USER_NAME_IS_NULL.getMsg());
if (StringUtils.isEmpty(username)) {
return JsonResult.error(InspectionFileEnum.USER_NAME_IS_NULL.getCode(), InspectionFileEnum.USER_NAME_IS_NULL.getMsg());
} }
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() User user = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(User::getMark, 1) .eq(User::getMark, 1)
.eq(User::getUsername, username)); .eq(User::getUsername, username));
if(ObjectUtil.isNull(user)){
return JsonResult.error(InspectionFileEnum.USER_IS_NOT_EXIST.getCode(),InspectionFileEnum.USER_IS_NOT_EXIST.getMsg());
if (ObjectUtil.isNull(user)) {
return JsonResult.error(InspectionFileEnum.USER_IS_NOT_EXIST.getCode(), InspectionFileEnum.USER_IS_NOT_EXIST.getMsg());
} }
if(StringUtils.isEmpty(user.getId())){
return JsonResult.error(InspectionFileEnum.USER_ID_IS_NULL.getCode(),InspectionFileEnum.USER_ID_IS_NULL.getMsg());
if (StringUtils.isEmpty(user.getId())) {
return JsonResult.error(InspectionFileEnum.USER_ID_IS_NULL.getCode(), InspectionFileEnum.USER_ID_IS_NULL.getMsg());
} }
if(null == user.getRoleId()){
if (null == user.getRoleId()) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//今日 //今日
DateTime startTime = DateUtil.offset(DateUtil.beginOfDay(DateUtil.date()), DateField.DAY_OF_WEEK, -4); DateTime startTime = DateUtil.offset(DateUtil.beginOfDay(DateUtil.date()), DateField.DAY_OF_WEEK, -4);
List<InspectionFileCountVo> result = new ArrayList<>(); List<InspectionFileCountVo> result = new ArrayList<>();
//判断角色 1超级管理员 2部门管理员 3普通用户 //判断角色 1超级管理员 2部门管理员 3普通用户
if(RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()){
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) {
try { try {
List<String> list = findDates(startTime, endTime); List<String> list = findDates(startTime, endTime);
for (String s : list) { for (String s : list) {
InspectionFileCountVo vo = new InspectionFileCountVo(); InspectionFileCountVo vo = new InspectionFileCountVo();
vo.setCheckTime(s); vo.setCheckTime(s);
//查询当日登录用户的已处理问题总数,创建时间 //查询当日登录用户的已处理问题总数,创建时间
Integer num = inspectionFileMapper.getInspectionFileHandleCount(s,user.getId());
if(null != num){
Integer num = inspectionFileMapper.getInspectionFileHandleCount(s, user.getId());
if (null != num) {
vo.setInspectionHandleSum(num); vo.setInspectionHandleSum(num);
} }
result.add(vo); result.add(vo);
e.printStackTrace(); e.printStackTrace();
} }
} }
if(RoleEnum.ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()){
if (RoleEnum.ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) {
try { try {
List<String> list = findDates(startTime, endTime); List<String> list = findDates(startTime, endTime);
for (String s : list) { for (String s : list) {
InspectionFileCountVo vo = new InspectionFileCountVo(); InspectionFileCountVo vo = new InspectionFileCountVo();
vo.setCheckTime(s); vo.setCheckTime(s);
//查询当日登录用户的已处理问题总数,创建时间 //查询当日登录用户的已处理问题总数,创建时间
Integer num = inspectionFileMapper.getInspectionFileCount(s,user.getId());
if(null != num){
Integer num = inspectionFileMapper.getInspectionFileCount(s, user.getId());
if (null != num) {
vo.setInspectionHandleSum(num); vo.setInspectionHandleSum(num);
} }
result.add(vo); result.add(vo);


/** /**
* 观看回放 * 观看回放
*
* @param id * @param id
* @return * @return
*/ */
@Override @Override
public JsonResult playback(String id) { public JsonResult playback(String id) {
//校验 //校验
if(StringUtils.isEmpty(id)){
if (StringUtils.isEmpty(id)) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//根据问题id查询对应的任务 //根据问题id查询对应的任务
InspectionFile inspectionFile = inspectionFileMapper.selectById(id); InspectionFile inspectionFile = inspectionFileMapper.selectById(id);
if(ObjectUtil.isNull(inspectionFile)){
return JsonResult.error(InspectionFileEnum.DATA_IS_NULL.getCode(),InspectionFileEnum.DATA_IS_NULL.getMsg());
if (ObjectUtil.isNull(inspectionFile)) {
return JsonResult.error(InspectionFileEnum.DATA_IS_NULL.getCode(), InspectionFileEnum.DATA_IS_NULL.getMsg());
} }
//获取对应的任务id //获取对应的任务id
String inspectionId = inspectionFile.getInspectionId(); String inspectionId = inspectionFile.getInspectionId();
if(StringUtils.isEmpty(inspectionId)){
return JsonResult.error(InspectionFileEnum.INSPECTION_ID_NULL.getCode(),InspectionFileEnum.INSPECTION_ID_NULL.getMsg());
if (StringUtils.isEmpty(inspectionId)) {
return JsonResult.error(InspectionFileEnum.INSPECTION_ID_NULL.getCode(), InspectionFileEnum.INSPECTION_ID_NULL.getMsg());
} }
//根据任务id获取任务 //根据任务id获取任务
Inspection inspection = inspectionMapper.selectOne(Wrappers.<Inspection>lambdaQuery() Inspection inspection = inspectionMapper.selectOne(Wrappers.<Inspection>lambdaQuery()
.eq(Inspection::getMark, 1) .eq(Inspection::getMark, 1)
.eq(Inspection::getId, inspectionId)); .eq(Inspection::getId, inspectionId));
PlayBackInfoVo vo = new PlayBackInfoVo(); PlayBackInfoVo vo = new PlayBackInfoVo();
BeanUtils.copyProperties(inspection,vo);
BeanUtils.copyProperties(inspection, vo);
//对视频地址进行处理 //对视频地址进行处理
if(StringUtils.isNotEmpty(inspection.getAiVideoUrl())){
vo.setAiVideoUrl(CommonConfig.videoURL+inspection.getVideoUrl());
if (StringUtils.isNotEmpty(inspection.getAiVideoUrl())) {
vo.setAiVideoUrl(CommonConfig.videoURL + inspection.getVideoUrl());
} }


return JsonResult.success(vo); return JsonResult.success(vo);
//数据转换 //数据转换
return result.convert(t -> { return result.convert(t -> {
InspectionFileInfoVo vo = Convert.convert(InspectionFileInfoVo.class, t); InspectionFileInfoVo vo = Convert.convert(InspectionFileInfoVo.class, t);
//查询其他属性
//公路代号
// 查询其他属性
// 公路代号
RoadInformation roadInformation = roadInformationMapper.selectOne(Wrappers.<RoadInformation>lambdaQuery() RoadInformation roadInformation = roadInformationMapper.selectOne(Wrappers.<RoadInformation>lambdaQuery()
.eq(RoadInformation::getId, inspection.getRoadId())); .eq(RoadInformation::getId, inspection.getRoadId()));
if(ObjectUtil.isNotNull(roadInformation)){
if (ObjectUtil.isNotNull(roadInformation)) {
vo.setCode(roadInformation.getCode()); vo.setCode(roadInformation.getCode());
} }
//任务名称
// 任务名称
if (StringUtils.isNotEmpty(inspection.getName())) { if (StringUtils.isNotEmpty(inspection.getName())) {
vo.setName(inspection.getName()); vo.setName(inspection.getName());
} }
//任务时间
if (null != inspection.getExecutionStartTime()){
// 任务时间
if (null != inspection.getExecutionStartTime()) {
vo.setExecutionStartTime(inspection.getExecutionStartTime()); vo.setExecutionStartTime(inspection.getExecutionStartTime());
} }
//缩略图
// 缩略图
if (StringUtils.isNotEmpty(t.getFileThumbnail())) { if (StringUtils.isNotEmpty(t.getFileThumbnail())) {
vo.setFileThumbnail(CommonConfig.imageURL + t.getFileThumbnail()); vo.setFileThumbnail(CommonConfig.imageURL + t.getFileThumbnail());
} }
//问题类型
if(StringUtils.isNotEmpty(t.getQuestionId())){
// 原图
if (StringUtils.isNotEmpty(t.getFileOriginal())) {
vo.setFileOriginal(CommonConfig.imageURL + t.getFileOriginal());
}
// 问题类型
if (StringUtils.isNotEmpty(t.getQuestionId())) {
QuestionType questionType = questionTypeMapper.selectOne(Wrappers.<QuestionType>lambdaQuery() QuestionType questionType = questionTypeMapper.selectOne(Wrappers.<QuestionType>lambdaQuery()
.eq(QuestionType::getId, t.getQuestionId()) .eq(QuestionType::getId, t.getQuestionId())
.eq(QuestionType::getMark, 1)); .eq(QuestionType::getMark, 1));
if(null == questionType){
if (null == questionType) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
if(null != questionType.getName()){
if (null != questionType.getName()) {
vo.setQuestionName(questionType.getName()); vo.setQuestionName(questionType.getName());
} }
if(StringUtils.isNotEmpty(questionType.getContent())){
if (StringUtils.isNotEmpty(questionType.getContent())) {
vo.setContent(questionType.getContent()); vo.setContent(questionType.getContent());
} }
} }

+ 137
- 122
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java View File

import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;


import java.text.ParseException; import java.text.ParseException;
import java.util.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;


/** /**
//登录用户信息 //登录用户信息
String tenantId = CurrentUserUtil.getTenantId(); String tenantId = CurrentUserUtil.getTenantId();
dto.setTenantId(tenantId); dto.setTenantId(tenantId);
if(StringUtils.isEmpty(dto.getTenantId())){
return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(),WorkOrderEnum.TENANT_ID_IS_NULL.getMsg());
if (StringUtils.isEmpty(dto.getTenantId())) {
return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(), WorkOrderEnum.TENANT_ID_IS_NULL.getMsg());
} }
if(StringUtils.isEmpty(dto.getInspectionFileId())) {
if (StringUtils.isEmpty(dto.getInspectionFileId())) {
return JsonResult.error(WorkOrderEnum.INSPECTION_FILE_ID_IS_NULL.getCode(), WorkOrderEnum.INSPECTION_FILE_ID_IS_NULL.getMsg()); return JsonResult.error(WorkOrderEnum.INSPECTION_FILE_ID_IS_NULL.getCode(), WorkOrderEnum.INSPECTION_FILE_ID_IS_NULL.getMsg());
} }
// if(StringUtils.isEmpty(dto.getUserId())){ // if(StringUtils.isEmpty(dto.getUserId())){
//登录用户信息 //登录用户信息
User userInfo = CurrentUserUtil.getUserInfo(); User userInfo = CurrentUserUtil.getUserInfo();
String username = userInfo.getUsername(); String username = userInfo.getUsername();
if(StringUtils.isEmpty(username)){
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(),WorkOrderEnum.USER_NAME_IS_NULL.getMsg());
if (StringUtils.isEmpty(username)) {
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(), WorkOrderEnum.USER_NAME_IS_NULL.getMsg());
} }
//根据用户id查询部门id //根据用户id查询部门id
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() User user = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(User::getMark, 1).eq(User::getUsername,username));
if(ObjectUtil.isNull(user)){
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(),WorkOrderEnum.USER_IS_NOT_EXIST.getMsg());
.eq(User::getMark, 1).eq(User::getUsername, username));
if (ObjectUtil.isNull(user)) {
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(), WorkOrderEnum.USER_IS_NOT_EXIST.getMsg());
} }
String deptId = user.getDeptId(); String deptId = user.getDeptId();
if(StringUtils.isEmpty(deptId)){
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(),WorkOrderEnum.DEPT_ID_IS_NULL.getMsg());
if (StringUtils.isEmpty(deptId)) {
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(), WorkOrderEnum.DEPT_ID_IS_NULL.getMsg());
} }
WorkOrder workOrder = new WorkOrder(); WorkOrder workOrder = new WorkOrder();
workOrder.setTenantId(dto.getTenantId()); workOrder.setTenantId(dto.getTenantId());
workOrderFile.setInspectionFileId(dto.getInspectionFileId()); workOrderFile.setInspectionFileId(dto.getInspectionFileId());
workOrderFile.setWorkOrderId(workOrder.getId()); workOrderFile.setWorkOrderId(workOrder.getId());
int num = workOrderFileMapper.insert(workOrderFile); int num = workOrderFileMapper.insert(workOrderFile);
if(num<=0){
if (num <= 0) {
return JsonResult.error(); return JsonResult.error();
} }
//更新问题状态为工单已生成 //更新问题状态为工单已生成
InspectionFile inspectionFile = inspectionFileMapper.selectById(dto.getInspectionFileId()); InspectionFile inspectionFile = inspectionFileMapper.selectById(dto.getInspectionFileId());
inspectionFile.setStatus(InspectionFileStatusEnum.GENERATE_ORDER.getCode()); inspectionFile.setStatus(InspectionFileStatusEnum.GENERATE_ORDER.getCode());
int count = inspectionFileMapper.updateById(inspectionFile); int count = inspectionFileMapper.updateById(inspectionFile);
if(count<=0){
if (count <= 0) {
return JsonResult.error(); return JsonResult.error();
} }




/** /**
* 代办工单 * 代办工单
*
* @param query * @param query
* @return * @return
*/ */
@Override @Override
public JsonResult getTodoList(WorkOrderQuery query) { public JsonResult getTodoList(WorkOrderQuery query) {
if(query.getLimit()==null && query.getPage()==null){
if (query.getLimit() == null && query.getPage() == null) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//登录用户信息 //登录用户信息
User userInfo1 = CurrentUserUtil.getUserInfo(); User userInfo1 = CurrentUserUtil.getUserInfo();
String username = userInfo1.getUsername(); String username = userInfo1.getUsername();
if(null ==username){
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(),WorkOrderEnum.USER_NAME_IS_NULL.getMsg());
if (null == username) {
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(), WorkOrderEnum.USER_NAME_IS_NULL.getMsg());
} }
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() User user = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(User::getMark, 1) .eq(User::getMark, 1)
.eq(User::getUsername, username)); .eq(User::getUsername, username));
if(ObjectUtil.isNull(user)){
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(),WorkOrderEnum.USER_IS_NOT_EXIST.getMsg());
if (ObjectUtil.isNull(user)) {
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(), WorkOrderEnum.USER_IS_NOT_EXIST.getMsg());
} }
String tenantId = userInfo1.getTenantId(); String tenantId = userInfo1.getTenantId();
if(null == tenantId){
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(),WorkOrderEnum.DEPT_ID_IS_NULL.getMsg());
if (null == tenantId) {
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(), WorkOrderEnum.DEPT_ID_IS_NULL.getMsg());
} }
query.setTenantId(tenantId); query.setTenantId(tenantId);
//根据登录用户判断角色 1超级管理员 2部门管理员 3普通用户 //根据登录用户判断角色 1超级管理员 2部门管理员 3普通用户
Integer type = user.getRoleId(); Integer type = user.getRoleId();
if(RoleEnum.SUPER_ADMIN.getCode()==type){
if (RoleEnum.SUPER_ADMIN.getCode() == type) {
return null; return null;
} }
//获取分页数据 //获取分页数据
IPage<WorkOrder> page = new Page<>(query.getPage(),query.getLimit());
IPage<WorkOrderInfoVo> pageData = new Page<>(query.getPage(),query.getLimit());
IPage<WorkOrder> page = new Page<>(query.getPage(), query.getLimit());
IPage<WorkOrderInfoVo> pageData = new Page<>(query.getPage(), query.getLimit());
//时间处理 //时间处理
Date startTime = null; Date startTime = null;
Date endTime = null; Date endTime = null;
if(StringUtils.isNotEmpty(query.getTime())){
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,query.getTime()+" 00:00:00");
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,query.getTime()+" 23:59:59");
if (StringUtils.isNotEmpty(query.getTime())) {
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, query.getTime() + " 00:00:00");
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, query.getTime() + " 23:59:59");
} }
query.setOrderStartTime(startTime); query.setOrderStartTime(startTime);
query.setOrderEndTime(endTime); query.setOrderEndTime(endTime);
//用户角色为2部门管理员 3普通用户 //用户角色为2部门管理员 3普通用户
if (RoleEnum.ADMIN.getCode()==type || RoleEnum.ORDINARY_USER.getCode()==type){
if (RoleEnum.ADMIN.getCode() == type || RoleEnum.ORDINARY_USER.getCode() == type) {
String deptId = user.getDeptId(); String deptId = user.getDeptId();
if(StringUtils.isEmpty(deptId)){
if (StringUtils.isEmpty(deptId)) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//获取当前分配人对应的工单分页数据 //获取当前分配人对应的工单分页数据
IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, Wrappers.<WorkOrder>lambdaQuery() IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, Wrappers.<WorkOrder>lambdaQuery()
.eq(WorkOrder::getAssignDeptId, deptId) .eq(WorkOrder::getAssignDeptId, deptId)
.eq(WorkOrder::getStatus,10)
.like(StringUtils.isNotEmpty(user.getId()),WorkOrder::getAssignUser,user.getId())
.eq(WorkOrder::getStatus, 10)
.like(StringUtils.isNotEmpty(user.getId()), WorkOrder::getAssignUser, user.getId())
.eq(WorkOrder::getTenantId, tenantId) .eq(WorkOrder::getTenantId, tenantId)
.between(null !=query.getOrderStartTime() && null !=query.getOrderEndTime(),WorkOrder::getCreateTime,query.getOrderStartTime(),query.getOrderEndTime())
.between(null != query.getOrderStartTime() && null != query.getOrderEndTime(), WorkOrder::getCreateTime, query.getOrderStartTime(), query.getOrderEndTime())
.eq(WorkOrder::getMark, 1)); .eq(WorkOrder::getMark, 1));
if(null == workPageData.getRecords()){
if (null == workPageData.getRecords()) {
return null; return null;
} }
List<WorkOrderInfoVo> WorkOrderInfoList = new ArrayList<>(); List<WorkOrderInfoVo> WorkOrderInfoList = new ArrayList<>();
long count1 = inspectionFileList.stream().filter(t -> t.getStatus() == 25).count(); long count1 = inspectionFileList.stream().filter(t -> t.getStatus() == 25).count();
vo.setPromProcessed((int) count1); vo.setPromProcessed((int) count1);


return vo;
return vo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
//当待处理问题总数为0时,此工单不出现在代办工单列表并且工单状态修改为15已完成 //当待处理问题总数为0时,此工单不出现在代办工单列表并且工单状态修改为15已完成
List<WorkOrderInfoVo> collect = workOrderList.stream().filter(f -> f.getPromTodo() == 0).collect(Collectors.toList()); List<WorkOrderInfoVo> collect = workOrderList.stream().filter(f -> f.getPromTodo() == 0).collect(Collectors.toList());
if(null != collect){
if (null != collect) {
for (WorkOrderInfoVo workOrderInfoVo : collect) { for (WorkOrderInfoVo workOrderInfoVo : collect) {
//每一个工单对应的状态发生改变,一个工单id对应一个工单 //每一个工单对应的状态发生改变,一个工单id对应一个工单
WorkOrder workOrder = workOrderMapper.selectById(workOrderInfoVo.getId()); WorkOrder workOrder = workOrderMapper.selectById(workOrderInfoVo.getId());
if(ObjectUtil.isNotNull(workOrder)){
if (ObjectUtil.isNotNull(workOrder)) {
workOrder.setStatus(15); workOrder.setStatus(15);
workOrder.setUpdateTime(DateUtils.now()); workOrder.setUpdateTime(DateUtils.now());
workOrder.setUpdateUser(user.getId()); workOrder.setUpdateUser(user.getId());
} }
} }
//工单的待处理问题个数不为0时 重新返回 //工单的待处理问题个数不为0时 重新返回
WorkOrderInfoList = workOrderList.stream().filter(h -> h.getPromTodo() != 0).collect(Collectors.toList());
WorkOrderInfoList = workOrderList.stream().filter(h -> h.getPromTodo() != 0).collect(Collectors.toList());
pageData.setRecords(WorkOrderInfoList); pageData.setRecords(WorkOrderInfoList);


return JsonResult.success(pageData); return JsonResult.success(pageData);
} }
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg());
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg());
} }


/** /**
* 处理工单 * 处理工单
*
* @param query * @param query
* @return * @return
*/ */
@Override @Override
public JsonResult handle(HandleQuery query) { public JsonResult handle(HandleQuery query) {
if(StringUtils.isEmpty(query.getId())){
JsonResult.error(WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getCode(),WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getMsg());
if (StringUtils.isEmpty(query.getId())) {
JsonResult.error(WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getCode(), WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getMsg());
} }
if(null == query.getPage() && null == query.getLimit()){
if (null == query.getPage() && null == query.getLimit()) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//获取分页数据 //获取分页数据
IPage<InspectionFile> page = new Page<>(query.getPage(),query.getLimit());
IPage<WorkOrderHandleVo> pageData = new Page<>(query.getPage(),query.getLimit());
IPage<InspectionFile> page = new Page<>(query.getPage(), query.getLimit());
IPage<WorkOrderHandleVo> pageData = new Page<>(query.getPage(), query.getLimit());
//根据工单id获取对应的问题集合 //根据工单id获取对应的问题集合
List<WorkOrderFile> workOrderFiles = workOrderFileMapper.selectList(Wrappers.<WorkOrderFile>lambdaQuery() List<WorkOrderFile> workOrderFiles = workOrderFileMapper.selectList(Wrappers.<WorkOrderFile>lambdaQuery()
.eq(WorkOrderFile::getWorkOrderId, query.getId())); .eq(WorkOrderFile::getWorkOrderId, query.getId()));
if(null == workOrderFiles){
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg());
if (null == workOrderFiles) {
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg());
} }
//工单子表获取对应的问题集合id //工单子表获取对应的问题集合id
List<String> inspectionFiledIds = workOrderFiles.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList()); List<String> inspectionFiledIds = workOrderFiles.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList());
//工单id //工单id
vo.setWorkOrderId(query.getId()); vo.setWorkOrderId(query.getId());
//缩略图处理 //缩略图处理
if(StringUtils.isNotEmpty(t.getFileThumbnail())){
vo.setFileThumbnail(CommonConfig.imageURL+t.getFileThumbnail());
if (StringUtils.isNotEmpty(t.getFileThumbnail())) {
vo.setFileThumbnail(CommonConfig.imageURL + t.getFileThumbnail());
}
if (StringUtils.isNotEmpty(t.getFileOriginal())) {
vo.setFileOriginal(CommonConfig.imageURL + t.getFileOriginal());
} }
//任务名称 任务执行时间 道路位置编号 //任务名称 任务执行时间 道路位置编号
if (StringUtils.isEmpty(t.getInspectionId())) { if (StringUtils.isEmpty(t.getInspectionId())) {


/** /**
* 已完成工单 * 已完成工单
*
* @param query * @param query
* @return * @return
*/ */
// if(query.getOrderEndTime()==null && query.getOrderStartTime()==null){ // if(query.getOrderEndTime()==null && query.getOrderStartTime()==null){
// throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); // throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
// } // }
if(query.getLimit()==null && query.getPage()==null){
if (query.getLimit() == null && query.getPage() == null) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//获取登录用户信息 //获取登录用户信息
User userInfo1 = CurrentUserUtil.getUserInfo(); User userInfo1 = CurrentUserUtil.getUserInfo();
String username = userInfo1.getUsername(); String username = userInfo1.getUsername();
if(null ==username){
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(),WorkOrderEnum.USER_NAME_IS_NULL.getMsg());
if (null == username) {
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(), WorkOrderEnum.USER_NAME_IS_NULL.getMsg());
} }
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() User user = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(User::getMark, 1) .eq(User::getMark, 1)
.eq(User::getUsername, username)); .eq(User::getUsername, username));
if(ObjectUtil.isNull(user)){
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(),WorkOrderEnum.USER_IS_NOT_EXIST.getMsg());
if (ObjectUtil.isNull(user)) {
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(), WorkOrderEnum.USER_IS_NOT_EXIST.getMsg());
} }
String tenantId = user.getTenantId(); String tenantId = user.getTenantId();
if(null == tenantId){
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(),WorkOrderEnum.DEPT_ID_IS_NULL.getMsg());
if (null == tenantId) {
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(), WorkOrderEnum.DEPT_ID_IS_NULL.getMsg());
} }
query.setTenantId(tenantId); query.setTenantId(tenantId);
//根据登录用户判断角色 1超级管理员 2部门管理员 3普通用户 //根据登录用户判断角色 1超级管理员 2部门管理员 3普通用户
Integer type = user.getRoleId(); Integer type = user.getRoleId();
//获取分页数据 //获取分页数据
IPage<WorkOrder> page = new Page<>(query.getPage(),query.getLimit());
IPage<WorkOrderInfoVo> pageData = new Page<>(query.getPage(),query.getLimit());
IPage<WorkOrder> page = new Page<>(query.getPage(), query.getLimit());
IPage<WorkOrderInfoVo> pageData = new Page<>(query.getPage(), query.getLimit());
//时间处理 //时间处理
Date startTime = null; Date startTime = null;
Date endTime = null; Date endTime = null;
if(StringUtils.isNotEmpty(query.getTime())){
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,query.getTime()+" 00:00:00");
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,query.getTime()+" 23:59:59");
if (StringUtils.isNotEmpty(query.getTime())) {
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, query.getTime() + " 00:00:00");
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, query.getTime() + " 23:59:59");
} }
query.setOrderStartTime(startTime); query.setOrderStartTime(startTime);
query.setOrderEndTime(endTime); query.setOrderEndTime(endTime);
//用户角色为2部门管理员 3普通用户 //用户角色为2部门管理员 3普通用户
if(RoleEnum.SUPER_ADMIN.getCode()==type){
if (RoleEnum.SUPER_ADMIN.getCode() == type) {
//超级管理员可查看系统内所有已处理工单 //超级管理员可查看系统内所有已处理工单
IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, new LambdaQueryWrapper<WorkOrder>() IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, new LambdaQueryWrapper<WorkOrder>()
.eq(WorkOrder::getStatus, 15) .eq(WorkOrder::getStatus, 15)
return JsonResult.success(pageData); return JsonResult.success(pageData);
} }
//用户角色为2部门管理员 3普通用户 //用户角色为2部门管理员 3普通用户
if(RoleEnum.ADMIN.getCode()== user.getRoleId() || RoleEnum.ORDINARY_USER.getCode()== user.getRoleId()){
if (RoleEnum.ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) {
//获取部门 //获取部门
String deptId = user.getDeptId(); String deptId = user.getDeptId();
if(StringUtils.isEmpty(deptId)){
if (StringUtils.isEmpty(deptId)) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//获取当前分配人对应的工单分页数据 //获取当前分配人对应的工单分页数据
return JsonResult.success(pageData); return JsonResult.success(pageData);
} }


return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg());
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg());
} }


/** /**
* 工单详情 * 工单详情
*
* @param query * @param query
* @return * @return
*/ */
@Override @Override
public JsonResult details(HandleQuery query) { public JsonResult details(HandleQuery query) {
if(StringUtils.isEmpty(query.getId())){
JsonResult.error(WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getCode(),WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getMsg());
if (StringUtils.isEmpty(query.getId())) {
JsonResult.error(WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getCode(), WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getMsg());
} }
if(null == query.getPage() && null == query.getLimit()){
if (null == query.getPage() && null == query.getLimit()) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }
//获取分页数据 //获取分页数据
IPage<InspectionFile> page = new Page<>(query.getPage(),query.getLimit());
IPage<WorkOrderHandleVo> pageData = new Page<>(query.getPage(),query.getLimit());
IPage<InspectionFile> page = new Page<>(query.getPage(), query.getLimit());
IPage<WorkOrderHandleVo> pageData = new Page<>(query.getPage(), query.getLimit());
//根据工单id获取对应的问题集合 //根据工单id获取对应的问题集合
List<WorkOrderFile> workOrderFiles = workOrderFileMapper.selectList(Wrappers.<WorkOrderFile>lambdaQuery() List<WorkOrderFile> workOrderFiles = workOrderFileMapper.selectList(Wrappers.<WorkOrderFile>lambdaQuery()
.eq(WorkOrderFile::getWorkOrderId, query.getId())); .eq(WorkOrderFile::getWorkOrderId, query.getId()));
if(null == workOrderFiles){
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg());
if (null == workOrderFiles) {
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg());
} }
//工单子表获取对应的问题集合id //工单子表获取对应的问题集合id
List<String> inspectionFiledIds = workOrderFiles.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList()); List<String> inspectionFiledIds = workOrderFiles.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList());
WorkOrderHandleVo covert = Convert.convert(WorkOrderHandleVo.class, p); WorkOrderHandleVo covert = Convert.convert(WorkOrderHandleVo.class, p);
//缩略图处理 //缩略图处理
if (StringUtils.isNotEmpty(p.getFileThumbnail())) { if (StringUtils.isNotEmpty(p.getFileThumbnail())) {
covert.setFileThumbnail(p.getFileThumbnail());
covert.setFileThumbnail(CommonConfig.imageURL + p.getFileThumbnail());
}
if (StringUtils.isNotEmpty(p.getFileOriginal())) {
covert.setFileOriginal(CommonConfig.imageURL + p.getFileThumbnail());
} }
//任务名称 任务执行时间 道路位置编号 //任务名称 任务执行时间 道路位置编号
if (StringUtils.isEmpty(p.getInspectionId())) { if (StringUtils.isEmpty(p.getInspectionId())) {


/** /**
* 统计近七天工单数量 * 统计近七天工单数量
*
* @return * @return
*/ */
@Override @Override
//获取登录用户信息 //获取登录用户信息
User userInfo = CurrentUserUtil.getUserInfo(); User userInfo = CurrentUserUtil.getUserInfo();
String username = userInfo.getUsername(); String username = userInfo.getUsername();
if(StringUtils.isEmpty(username)){
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(),WorkOrderEnum.USER_NAME_IS_NULL.getMsg());
if (StringUtils.isEmpty(username)) {
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(), WorkOrderEnum.USER_NAME_IS_NULL.getMsg());
} }
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() User user = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(User::getMark, 1) .eq(User::getMark, 1)
.eq(User::getUsername, username)); .eq(User::getUsername, username));
if(ObjectUtil.isNull(user)){
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(),WorkOrderEnum.USER_IS_NOT_EXIST.getMsg());
if (ObjectUtil.isNull(user)) {
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(), WorkOrderEnum.USER_IS_NOT_EXIST.getMsg());
} }
String tenantId = user.getTenantId(); String tenantId = user.getTenantId();
if(StringUtils.isEmpty(tenantId)){
return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(),WorkOrderEnum.TENANT_ID_IS_NULL.getMsg());
if (StringUtils.isEmpty(tenantId)) {
return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(), WorkOrderEnum.TENANT_ID_IS_NULL.getMsg());
} }
//用户角色 //用户角色
Integer type = user.getRoleId(); Integer type = user.getRoleId();
if(null == type){
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg());
if (null == type) {
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg());
} }
WorkOrderNumVo vo = new WorkOrderNumVo(); WorkOrderNumVo vo = new WorkOrderNumVo();
//今日 //今日
DateTime endTime = DateUtil.endOfDay(DateUtil.date()); DateTime endTime = DateUtil.endOfDay(DateUtil.date());
//一周前的时间 //一周前的时间
DateTime startTime = DateUtil.offset(DateUtil.beginOfDay(DateUtil.date()), DateField.WEEK_OF_MONTH, -1); DateTime startTime = DateUtil.offset(DateUtil.beginOfDay(DateUtil.date()), DateField.WEEK_OF_MONTH, -1);
if(null == endTime || null == startTime){
if (null == endTime || null == startTime) {
return null; return null;
} }
//根据用户角色判断 1超级管理员 2部门管理员 3普通用户 //根据用户角色判断 1超级管理员 2部门管理员 3普通用户
if(RoleEnum.SUPER_ADMIN.getCode() == type){
if (RoleEnum.SUPER_ADMIN.getCode() == type) {
//获取当前登录用户(超级管理员)已完成工单列表 //获取当前登录用户(超级管理员)已完成工单列表
List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery() List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery()
.eq(WorkOrder::getMark, 1) .eq(WorkOrder::getMark, 1)
.eq(WorkOrder::getTenantId,tenantId)
.eq(WorkOrder::getStatus,15)
.between(WorkOrder::getUpdateTime,startTime,endTime));
if(StringUtils.isNotEmpty(workOrders)){
.eq(WorkOrder::getTenantId, tenantId)
.eq(WorkOrder::getStatus, 15)
.between(WorkOrder::getUpdateTime, startTime, endTime));
if (StringUtils.isNotEmpty(workOrders)) {
vo.setWeekWorkOrderFinishedSum(workOrders.size()); vo.setWeekWorkOrderFinishedSum(workOrders.size());
} }
} }
//部门管理员 普通用户 //部门管理员 普通用户
if(RoleEnum.ADMIN.getCode() ==type || RoleEnum.ORDINARY_USER.getCode() == type){
if (RoleEnum.ADMIN.getCode() == type || RoleEnum.ORDINARY_USER.getCode() == type) {
//获取部门id //获取部门id
if(StringUtils.isEmpty(user.getDeptId())){
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(),WorkOrderEnum.DEPT_ID_IS_NULL.getMsg());
if (StringUtils.isEmpty(user.getDeptId())) {
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(), WorkOrderEnum.DEPT_ID_IS_NULL.getMsg());
} }
//获取当前登录用户(被分配人员)的待处理工单列表 //获取当前登录用户(被分配人员)的待处理工单列表
List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery() List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery()
.eq(WorkOrder::getMark, 1) .eq(WorkOrder::getMark, 1)
.like(WorkOrder::getAssignUser, user.getId()) .like(WorkOrder::getAssignUser, user.getId())
.eq(WorkOrder::getStatus,10)
.eq(WorkOrder::getTenantId,tenantId)
.eq(WorkOrder::getDeptId,user.getDeptId())
.between(WorkOrder::getAssignTime,startTime,endTime));
if(StringUtils.isNotEmpty(workOrders)){
.eq(WorkOrder::getStatus, 10)
.eq(WorkOrder::getTenantId, tenantId)
.eq(WorkOrder::getDeptId, user.getDeptId())
.between(WorkOrder::getAssignTime, startTime, endTime));
if (StringUtils.isNotEmpty(workOrders)) {
vo.setWeekWorkOrderTodoSum(workOrders.size()); vo.setWeekWorkOrderTodoSum(workOrders.size());
} }
//获取当前登录用户(被分配人员)的已完成工单列表 //获取当前登录用户(被分配人员)的已完成工单列表
.eq(WorkOrder::getTenantId, tenantId) .eq(WorkOrder::getTenantId, tenantId)
.eq(WorkOrder::getDeptId, user.getDeptId()) .eq(WorkOrder::getDeptId, user.getDeptId())
.between(WorkOrder::getUpdateTime, startTime, endTime)); .between(WorkOrder::getUpdateTime, startTime, endTime));
if(StringUtils.isNotEmpty(result)){
if (StringUtils.isNotEmpty(result)) {
vo.setWeekWorkOrderFinishedSum(result.size()); vo.setWeekWorkOrderFinishedSum(result.size());
} }
} }


/** /**
* 统计上个月的工单数量 * 统计上个月的工单数量
*
* @return * @return
*/ */
@Override @Override
//获取登录用户信息 //获取登录用户信息
User userInfo = CurrentUserUtil.getUserInfo(); User userInfo = CurrentUserUtil.getUserInfo();
String username = userInfo.getUsername(); String username = userInfo.getUsername();
if(StringUtils.isEmpty(username)){
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(),WorkOrderEnum.USER_NAME_IS_NULL.getMsg());
if (StringUtils.isEmpty(username)) {
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(), WorkOrderEnum.USER_NAME_IS_NULL.getMsg());
} }
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() User user = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(User::getMark, 1) .eq(User::getMark, 1)
.eq(User::getUsername, username)); .eq(User::getUsername, username));
if(ObjectUtil.isNull(user)){
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(),WorkOrderEnum.USER_IS_NOT_EXIST.getMsg());
if (ObjectUtil.isNull(user)) {
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(), WorkOrderEnum.USER_IS_NOT_EXIST.getMsg());
} }
String tenantId = user.getTenantId(); String tenantId = user.getTenantId();
if(StringUtils.isEmpty(tenantId)){
return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(),WorkOrderEnum.TENANT_ID_IS_NULL.getMsg());
if (StringUtils.isEmpty(tenantId)) {
return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(), WorkOrderEnum.TENANT_ID_IS_NULL.getMsg());
} }
//用户角色 //用户角色
Integer type = user.getRoleId(); Integer type = user.getRoleId();
if(null == type){
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg());
if (null == type) {
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg());
} }
WorkOrderCountVo vo = new WorkOrderCountVo(); WorkOrderCountVo vo = new WorkOrderCountVo();
// 上月起始 // 上月起始
Calendar.DAY_OF_MONTH, lastMonthEndDateCal.getActualMaximum(Calendar.DAY_OF_MONTH)); Calendar.DAY_OF_MONTH, lastMonthEndDateCal.getActualMaximum(Calendar.DAY_OF_MONTH));
DateTime beginTime = DateUtil.beginOfDay(lastMonthFirstDateCal.getTime()); DateTime beginTime = DateUtil.beginOfDay(lastMonthFirstDateCal.getTime());
DateTime endTime = DateUtil.endOfDay(lastMonthEndDateCal.getTime()); DateTime endTime = DateUtil.endOfDay(lastMonthEndDateCal.getTime());
if(null == endTime || null == beginTime){
if (null == endTime || null == beginTime) {
return null; return null;
} }
//根据用户角色判断 1超级管理员 2部门管理员 3普通用户
if(RoleEnum.SUPER_ADMIN.getCode() == type){
//获取当前登录用户(超级管理员)已完成工单列表
List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery()
.eq(WorkOrder::getMark, 1)
.eq(WorkOrder::getTenantId,tenantId)
.eq(WorkOrder::getStatus,15)
.between(WorkOrder::getUpdateTime,beginTime,endTime));
if(StringUtils.isNotEmpty(workOrders)){
vo.setMonthWorkOrderFinishedSum(workOrders.size());
}
//根据用户角色判断 1超级管理员 2部门管理员 3普通用户
if (RoleEnum.SUPER_ADMIN.getCode() == type) {
//获取当前登录用户(超级管理员)已完成工单列表
List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery()
.eq(WorkOrder::getMark, 1)
.eq(WorkOrder::getTenantId, tenantId)
.eq(WorkOrder::getStatus, 15)
.between(WorkOrder::getUpdateTime, beginTime, endTime));
if (StringUtils.isNotEmpty(workOrders)) {
vo.setMonthWorkOrderFinishedSum(workOrders.size());
} }
}
//部门管理员 普通用户 //部门管理员 普通用户
if(RoleEnum.ADMIN.getCode() ==type || RoleEnum.ORDINARY_USER.getCode() == type){
if (RoleEnum.ADMIN.getCode() == type || RoleEnum.ORDINARY_USER.getCode() == type) {
//获取部门id //获取部门id
if(StringUtils.isEmpty(user.getDeptId())){
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(),WorkOrderEnum.DEPT_ID_IS_NULL.getMsg());
if (StringUtils.isEmpty(user.getDeptId())) {
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(), WorkOrderEnum.DEPT_ID_IS_NULL.getMsg());
} }
//获取当前登录用户(被分配人员)的待处理工单列表 //获取当前登录用户(被分配人员)的待处理工单列表
List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery() List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery()
.eq(WorkOrder::getMark, 1) .eq(WorkOrder::getMark, 1)
.like(WorkOrder::getAssignUser, user.getId()) .like(WorkOrder::getAssignUser, user.getId())
.eq(WorkOrder::getStatus,10)
.eq(WorkOrder::getTenantId,tenantId)
.eq(WorkOrder::getDeptId,user.getDeptId())
.between(WorkOrder::getAssignTime,beginTime,endTime));
if(StringUtils.isNotEmpty(workOrders)){
.eq(WorkOrder::getStatus, 10)
.eq(WorkOrder::getTenantId, tenantId)
.eq(WorkOrder::getDeptId, user.getDeptId())
.between(WorkOrder::getAssignTime, beginTime, endTime));
if (StringUtils.isNotEmpty(workOrders)) {
vo.setMonthWorkOrderTodoSum(workOrders.size()); vo.setMonthWorkOrderTodoSum(workOrders.size());
} }
//获取当前登录用户(被分配人员)的已完成工单列表 //获取当前登录用户(被分配人员)的已完成工单列表
.eq(WorkOrder::getTenantId, tenantId) .eq(WorkOrder::getTenantId, tenantId)
.eq(WorkOrder::getDeptId, user.getDeptId()) .eq(WorkOrder::getDeptId, user.getDeptId())
.between(WorkOrder::getUpdateTime, beginTime, endTime)); .between(WorkOrder::getUpdateTime, beginTime, endTime));
if(StringUtils.isNotEmpty(result)){
if (StringUtils.isNotEmpty(result)) {
vo.setMonthWorkOrderFinishedSum(result.size()); vo.setMonthWorkOrderFinishedSum(result.size());
} }
} }

+ 11
- 1
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/vo/WorkOrderHandleVo.java View File

private String content; private String content;


/** /**
* 问题图片 缩略图
* 文件名称
*/
private String fileName;

/**
* 缩略图
*/ */
private String fileThumbnail; private String fileThumbnail;


/**
* 原图
*/
private String fileOriginal;

/** /**
* 位置 * 位置
*/ */

Loading…
Cancel
Save