Browse Source

小程序新增工单和问题导航

tags/v1.0.0^2
chengwang 1 year ago
parent
commit
e01ffb6fbc
20 changed files with 495 additions and 5 deletions
  1. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/questiontype/QuestionTypeEnum.java
  2. +1
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/InspectionFileServiceImpl.java
  3. +10
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/InspectionFileController.java
  4. +38
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/WorkOrderController.java
  5. +22
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/WorkOrderFileController.java
  6. +11
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/dao/WorkOrderFileMapper.java
  7. +12
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/dao/WorkOrderMapper.java
  8. +76
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/WorkOrder.java
  9. +34
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/WorkOrderFile.java
  10. +27
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/dto/WorkOrderDto.java
  11. +49
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/WorkOrderEnum.java
  12. +44
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/WorkOrderStatusEnum.java
  13. +2
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IInspectionFileService.java
  14. +8
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IWorkOrderFileService.java
  15. +17
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IWorkOrderService.java
  16. +12
    -1
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionFileServiceImpl.java
  17. +14
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderFileServiceImpl.java
  18. +103
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java
  19. +7
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/mapper/WorkOrderFileMapper.xml
  20. +7
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/mapper/WorkOrderMapper.xml

tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/questionType/QuestionTypeEnum.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/questiontype/QuestionTypeEnum.java View File

@@ -1,4 +1,4 @@
package com.tuoheng.admin.enums.code.questionType;
package com.tuoheng.admin.enums.code.questiontype;

/**
* @Author ChengWang

+ 1
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/InspectionFileServiceImpl.java View File

@@ -10,7 +10,7 @@ import com.tuoheng.admin.entity.QuestionType;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.UserTypeEnum;
import com.tuoheng.admin.enums.code.inspectionfile.ListByDeptUserTypeEnum;
import com.tuoheng.admin.enums.code.questionType.QuestionTypeEnum;
import com.tuoheng.admin.enums.code.questiontype.QuestionTypeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.query.InspectionFileQuery;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
@@ -29,8 +29,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;


import java.util.ArrayList;

+ 10
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/InspectionFileController.java View File

@@ -94,4 +94,14 @@ public class InspectionFileController {
return iInspectionFileService.seeQuestion(id);
}

/**
* 导航
* @param id
* @return
*/
@GetMapping("/Navigation/{id}")
public JsonResult navigation(@PathVariable("id") String id){
return iInspectionFileService.navigation(id);
}

}

+ 38
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/WorkOrderController.java View File

@@ -0,0 +1,38 @@
package com.tuoheng.miniprogram.controller;

import com.tuoheng.common.core.common.BaseController;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.miniprogram.entity.WorkOrder;
import com.tuoheng.miniprogram.entity.dto.WorkOrderDto;
import com.tuoheng.miniprogram.service.IWorkOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
* @Author ChengWang
* @Date 2022/12/6
*/
@RestController
@RequestMapping("/workOrder")
public class WorkOrderController extends BaseController {

@Autowired
private IWorkOrderService workOrderService;



/**
* 新增
* @param dto
* @return
*/
@PostMapping("/add")
public JsonResult add(@RequestBody WorkOrderDto dto){
return workOrderService.addInfo(dto);
}





}

+ 22
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/WorkOrderFileController.java View File

@@ -0,0 +1,22 @@
package com.tuoheng.miniprogram.controller;

import com.tuoheng.miniprogram.service.IWorkOrderFileService;
import com.tuoheng.miniprogram.service.IWorkOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @Author ChengWang
* @Date 2022/12/6
*/
@RestController
@RequestMapping("/workOrderFile")
public class WorkOrderFileController {

@Autowired
private IWorkOrderFileService workOrderFileService;



}

+ 11
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/dao/WorkOrderFileMapper.java View File

@@ -0,0 +1,11 @@
package com.tuoheng.miniprogram.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.miniprogram.entity.WorkOrderFile;

/**
* @Author ChengWang
* @Date 2022/12/6
*/
public interface WorkOrderFileMapper extends BaseMapper<WorkOrderFile> {
}

+ 12
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/dao/WorkOrderMapper.java View File

@@ -0,0 +1,12 @@
package com.tuoheng.miniprogram.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.miniprogram.entity.WorkOrder;

/**
* @Author ChengWang
* @Date 2022/12/6
*/
public interface WorkOrderMapper extends BaseMapper<WorkOrder> {

}

+ 76
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/WorkOrder.java View File

@@ -0,0 +1,76 @@
package com.tuoheng.miniprogram.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
* @Author ChengWang
* @Date 2022/12/6
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_work_order")
public class WorkOrder extends BaseEntity {
private static final long serialVersionUID = 1L;

/**
* 租户id
*/
private String tenantId;

/**
* 部门id
*/
private String deptId;

/**
* 分配人员id
*/
private String distributionId;

/**
* 问题工单号
*/
private String code;

/**
* 工单状态 5待分配 10处理中(已分配) 15已完成
*/
private Integer status;

/**
* 指派部门ID
*/
private String assignDeptId;

/**
* 指派负责人
*/
private String assignUser;

/**
* 指派负责人联系方式
*/
private String assignContact;

/**
* 指派备注
*/
private String assignNote;

/**
* 指派时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date assignTime;

}

+ 34
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/WorkOrderFile.java View File

@@ -0,0 +1,34 @@
package com.tuoheng.miniprogram.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
* @Author ChengWang
* @Date 2022/12/6
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("th_work_order_file")
public class WorkOrderFile {
private static final long serialVersionUID = 1L;

/**
* 租户id
*/
private String tenantId;

/**
* 巡检问题工单ID
*/
private String workOrderId;

/**
* 巡检问题文件id
*/
private String inspectionFileId;

}

+ 27
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/dto/WorkOrderDto.java View File

@@ -0,0 +1,27 @@
package com.tuoheng.miniprogram.entity.dto;

import lombok.Data;

/**
* @Author ChengWang
* @Date 2022/12/6
*/
@Data
public class WorkOrderDto {

/**
* 问题id
*/
private String inspectionFileId;

/**
*租户id
*/
private String tenantId;

/**
* 登录用户id
*/
//private String UserId;

}

+ 49
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/WorkOrderEnum.java View File

@@ -0,0 +1,49 @@
package com.tuoheng.miniprogram.enums;

/**
* @Author ChengWang
* @Date 2022/12/6
*/
public enum WorkOrderEnum {

INSPECTION_FILE_ID_IS_NULL(1210100, "问题id为空"),
TENANT_ID_IS_NULL(1210101, "租户id为空"),
USER_ID_IS_NULL(1210102, "用户id为空"),
USER_NAME_IS_NULL(1210103, "登录用户名为空"),
USER__IS_NOT_EXIST(1210104, "用户为空"),
DEPT__ID_IS_NULL(1210105, "部门id为空");

/**
* 错误码
*/
private int code;

/**
* 错误信息
*/
private String msg;

WorkOrderEnum(int code, String msg){
this.code = code;
this.msg = msg;
}

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}

public String getMsg() {
return msg;
}

public void setMsg(String msg) {
this.msg = msg;
}



}

+ 44
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/WorkOrderStatusEnum.java View File

@@ -0,0 +1,44 @@
package com.tuoheng.miniprogram.enums;

/**
* @Author ChengWang
* @Date 2022/12/6
*/
public enum WorkOrderStatusEnum {

STATUS_ALLOCATED(5, "工单待分配"),
STATUS_ASSIGNED(10, "工单处理中已分配"),
STATUS_COMPLETED(15, "工单已完成");

/**
* 编码
*/
private int code;

/**
* 状态信息
*/
private String msg;

WorkOrderStatusEnum(int code, String msg){
this.code = code;
this.msg = msg;
}

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}

public String getMsg() {
return msg;
}

public void setMsg(String msg) {
this.msg = msg;
}

}

+ 2
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IInspectionFileService.java View File

@@ -23,4 +23,6 @@ public interface IInspectionFileService {
JsonResult ignore(InspectionFile entity);

JsonResult seeQuestion(String id);

JsonResult navigation(String id);
}

+ 8
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IWorkOrderFileService.java View File

@@ -0,0 +1,8 @@
package com.tuoheng.miniprogram.service;

/**
* @Author ChengWang
* @Date 2022/12/6
*/
public interface IWorkOrderFileService {
}

+ 17
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IWorkOrderService.java View File

@@ -0,0 +1,17 @@
package com.tuoheng.miniprogram.service;

import com.tuoheng.common.core.common.IBaseService;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.miniprogram.entity.WorkOrder;
import com.tuoheng.miniprogram.entity.dto.WorkOrderDto;

/**
* @Author ChengWang
* @Date 2022/12/6
*/
public interface IWorkOrderService extends IBaseService<WorkOrder> {


JsonResult addInfo(WorkOrderDto dto);

}

+ 12
- 1
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionFileServiceImpl.java View File

@@ -59,7 +59,7 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
*/
@Override
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);
}
if(StringUtils.isEmpty(query.getInspectionId())){
@@ -278,6 +278,17 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
return JsonResult.success(vo);
}

/**
* 导航
* @param id
* @return
*/
@Override
public JsonResult navigation(String id) {

return null;
}

/**
* 多个url进行转换,用,号隔开
*

+ 14
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderFileServiceImpl.java View File

@@ -0,0 +1,14 @@
package com.tuoheng.miniprogram.service.impl;

import com.tuoheng.miniprogram.service.IWorkOrderFileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
* @Author ChengWang
* @Date 2022/12/6
*/
@Service
@Slf4j
public class WorkOrderFileServiceImpl implements IWorkOrderFileService {
}

+ 103
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java View File

@@ -0,0 +1,103 @@
package com.tuoheng.miniprogram.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.common.core.common.BaseServiceImpl;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.SecurityUserUtils;
import com.tuoheng.common.core.utils.StringUtils;
import com.tuoheng.miniprogram.dao.DeptMapper;
import com.tuoheng.miniprogram.dao.UserMapper;
import com.tuoheng.miniprogram.dao.WorkOrderFileMapper;
import com.tuoheng.miniprogram.dao.WorkOrderMapper;
import com.tuoheng.miniprogram.entity.User;
import com.tuoheng.miniprogram.entity.WorkOrder;
import com.tuoheng.miniprogram.entity.WorkOrderFile;
import com.tuoheng.miniprogram.entity.dto.WorkOrderDto;
import com.tuoheng.miniprogram.enums.WorkOrderEnum;
import com.tuoheng.miniprogram.enums.WorkOrderStatusEnum;
import com.tuoheng.miniprogram.service.IWorkOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
* @Author ChengWang
* @Date 2022/12/6
*/
@Service
@Slf4j
public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkOrder> implements IWorkOrderService {

@Autowired
private UserMapper userMapper;

@Autowired
private WorkOrderMapper workOrderMapper;

@Autowired
private WorkOrderFileMapper workOrderFileMapper;

@Autowired
private DeptMapper deptMapper;

@Override
public JsonResult addInfo(WorkOrderDto dto) {
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())) {
return JsonResult.error(WorkOrderEnum.INSPECTION_FILE_ID_IS_NULL.getCode(), WorkOrderEnum.INSPECTION_FILE_ID_IS_NULL.getMsg());
}
// if(StringUtils.isEmpty(dto.getUserId())){
// return JsonResult.error(WorkOrderEnum.USER_ID_IS_NULL.getCode(),WorkOrderEnum.USER_ID_IS_NULL.getMsg());
// }
//String username = SecurityUserUtils.username();
String username ="admin";
if(StringUtils.isEmpty(username)){
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(),WorkOrderEnum.USER_NAME_IS_NULL.getMsg());
}
//根据用户id查询部门id
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());
}
String deptId = user.getDeptId();
if(StringUtils.isEmpty(deptId)){
return JsonResult.error(WorkOrderEnum.DEPT__ID_IS_NULL.getCode(),WorkOrderEnum.DEPT__ID_IS_NULL.getMsg());
}
WorkOrder workOrder = new WorkOrder();
workOrder.setTenantId(dto.getTenantId());
workOrder.setDeptId(deptId);
//分配人员是当前登录用户
workOrder.setDistributionId(user.getId());
//工单编号 XJGD+日期+随机
Date now = DateUtils.now();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
String str = sdf.format(now);
String code = "XJGD"+str+(int)(Math.random()*10000);
workOrder.setCode(code);
workOrder.setStatus(WorkOrderStatusEnum.STATUS_ASSIGNED.getCode());
workOrder.setAssignDeptId(deptId);
workOrder.setAssignUser(username);
workOrder.setAssignContact(user.getMobile());
workOrder.setAssignTime(DateUtils.now());
workOrder.setCreateUser(user.getId());
workOrder.setCreateTime(DateUtils.now());
workOrder.setMark(1);
super.add(workOrder);
//工单子表数据入库
WorkOrderFile workOrderFile = new WorkOrderFile();
workOrderFile.setTenantId(dto.getTenantId());
workOrderFile.setInspectionFileId(dto.getInspectionFileId());
workOrderFile.setWorkOrderId(workOrder.getId());
workOrderFileMapper.insert(workOrderFile);

return JsonResult.success();
}
}

+ 7
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/mapper/WorkOrderFileMapper.xml View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tuoheng.miniprogram.dao.WorkOrderFileMapper">

</mapper>

+ 7
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/mapper/WorkOrderMapper.xml View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tuoheng.miniprogram.dao.WorkOrderMapper">

</mapper>

Loading…
Cancel
Save