Преглед изворни кода

Merge remote-tracking branch 'origin/master'

hym пре 4 година
родитељ
комит
625ad79f8c

+ 62 - 0
operation_manager/src/main/java/com/huaxu/order/controller/WorkOrderManageController.java

@@ -0,0 +1,62 @@
+package com.huaxu.order.controller;
+
+
+import com.huaxu.model.AjaxMessage;
+import com.huaxu.model.LoginUser;
+import com.huaxu.model.ResultStatus;
+import com.huaxu.order.dto.WorkOrderManageDto;
+import com.huaxu.order.entity.WorkFlowDetail;
+import com.huaxu.order.entity.WorkOrderManage;
+import com.huaxu.order.service.WorkFlowDetailService;
+import com.huaxu.order.service.WorkOrderManageService;
+import com.huaxu.util.DatesUtil;
+import com.huaxu.util.UserUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
+import java.util.List;
+
+@RestController
+@RequestMapping("/order/workOrderManage")
+@Api(tags = "工单管理")
+public class WorkOrderManageController {
+
+    @Autowired
+    WorkOrderManageService workOrderManageService;
+
+    @Autowired
+    WorkFlowDetailService workFlowDetailService;
+
+    /**
+     * 新增一条数据
+     *
+     * @param workOrderManageDto 实体类
+     * @return Response对象
+     */
+    @RequestMapping(value = "insert", method = RequestMethod.POST)
+    @ApiOperation(value = "插入工单")
+    public AjaxMessage<Integer> insertSelective(@ApiParam(value = "工单信息", required = true) @RequestBody WorkOrderManageDto workOrderManageDto) {
+        LoginUser currentUser = UserUtil.getCurrentUser();
+        workOrderManageDto.setCreateBy(currentUser.getUsername());
+        workOrderManageDto.setDateCreate(new Date());
+        workOrderManageDto.setOrderStatus(0);
+        workOrderManageDto.setTaskNo(DatesUtil.formatDate(new Date(),"yyyyMMddHHmmss")+String.valueOf((int) (Math.random()*(9999-1000)+1000)));
+        workOrderManageService.insertSelective(workOrderManageDto);
+        int result =workOrderManageDto.getId();//返回新增数据的id
+        if(workOrderManageDto.getEventType().equals(1)) {
+            //运维上报插入工单详情
+            WorkFlowDetail workFlowDetail=new WorkFlowDetail();
+            workFlowDetail.setFlowId(result);
+            workFlowDetail.setFlowType(2);
+            workFlowDetail.setFlowDetail(workOrderManageDto.getFlowDetail());
+            workFlowDetail.setCreateBy(currentUser.getUsername());
+            workFlowDetail.setDateCreate(new Date());
+            workFlowDetailService.insertSelective(workFlowDetail);
+        }
+        return new AjaxMessage<>(ResultStatus.OK, result);
+    }
+}

+ 2 - 0
operation_manager/src/main/java/com/huaxu/order/dao/WorkFlowDetailMapper.java

@@ -1,7 +1,9 @@
 package com.huaxu.order.dao;
 
 import com.huaxu.order.entity.WorkFlowDetail;
+import org.apache.ibatis.annotations.Mapper;
 
+@Mapper
 public interface WorkFlowDetailMapper {
     int deleteByPrimaryKey(Integer id);
 

+ 2 - 0
operation_manager/src/main/java/com/huaxu/order/dao/WorkOrderManageMapper.java

@@ -1,7 +1,9 @@
 package com.huaxu.order.dao;
 
 import com.huaxu.order.entity.WorkOrderManage;
+import org.apache.ibatis.annotations.Mapper;
 
+@Mapper
 public interface WorkOrderManageMapper {
     int deleteByPrimaryKey(Integer id);
 

+ 19 - 0
operation_manager/src/main/java/com/huaxu/order/dto/WorkOrderManageDto.java

@@ -0,0 +1,19 @@
+package com.huaxu.order.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.huaxu.order.entity.WorkOrderManage;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@ApiModel(value = "工单管理表")
+@Data
+public class WorkOrderManageDto extends WorkOrderManage {
+
+    @ApiModelProperty(value = "json格式存储对应任务详情")
+    private String flowDetail;
+}

+ 22 - 68
operation_manager/src/main/java/com/huaxu/order/entity/WorkFlowDetail.java

@@ -1,88 +1,42 @@
 package com.huaxu.order.entity;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
 import java.io.Serializable;
 import java.util.Date;
 
+@ApiModel(value = "流程任务处理详情")
+@Data
 public class WorkFlowDetail implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "主键")
     private Integer id;
 
+    @ApiModelProperty(value = "任务、工单id")
     private Integer flowId;
 
+    @ApiModelProperty(value = "1任务、2工单")
     private Integer flowType;
 
+    @ApiModelProperty(value = "json格式存储对应任务详情")
+    private String flowDetail;
+
+    @ApiModelProperty(value = "创建人")
     private String createBy;
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
     private Date dateCreate;
 
+    @ApiModelProperty(value = "修改人")
     private String updateBy;
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @ApiModelProperty(value = "修改时间")
     private Date dateUpdate;
-
-    private String flowDetail;
-
-    private static final long serialVersionUID = 1L;
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public Integer getFlowId() {
-        return flowId;
-    }
-
-    public void setFlowId(Integer flowId) {
-        this.flowId = flowId;
-    }
-
-    public Integer getFlowType() {
-        return flowType;
-    }
-
-    public void setFlowType(Integer flowType) {
-        this.flowType = flowType;
-    }
-
-    public String getCreateBy() {
-        return createBy;
-    }
-
-    public void setCreateBy(String createBy) {
-        this.createBy = createBy == null ? null : createBy.trim();
-    }
-
-    public Date getDateCreate() {
-        return dateCreate;
-    }
-
-    public void setDateCreate(Date dateCreate) {
-        this.dateCreate = dateCreate;
-    }
-
-    public String getUpdateBy() {
-        return updateBy;
-    }
-
-    public void setUpdateBy(String updateBy) {
-        this.updateBy = updateBy == null ? null : updateBy.trim();
-    }
-
-    public Date getDateUpdate() {
-        return dateUpdate;
-    }
-
-    public void setDateUpdate(Date dateUpdate) {
-        this.dateUpdate = dateUpdate;
-    }
-
-    public String getFlowDetail() {
-        return flowDetail;
-    }
-
-    public void setFlowDetail(String flowDetail) {
-        this.flowDetail = flowDetail == null ? null : flowDetail.trim();
-    }
 }

+ 51 - 262
operation_manager/src/main/java/com/huaxu/order/entity/WorkOrderManage.java

@@ -1,328 +1,117 @@
 package com.huaxu.order.entity;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
 import java.io.Serializable;
 import java.util.Date;
 
+@ApiModel(value = "工单管理表")
+@Data
 public class WorkOrderManage implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "主键")
     private Integer id;
 
+    @ApiModelProperty(value = "工单编号")
     private String taskNo;
 
+    @ApiModelProperty(value = "工单描述")
     private String taskDesc;
 
+    @ApiModelProperty(value = "接单人编号")
     private String orderUserId;
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @ApiModelProperty(value = "派单时间")
     private Date sendTime;
 
+    @ApiModelProperty(value = "派单人")
     private String sendBy;
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @ApiModelProperty(value = "预计完成时间")
     private Date planFinishDate;
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @ApiModelProperty(value = "完成时间")
     private Date finishDate;
 
+    @ApiModelProperty(value = "时限")
     private String dateLimit;
 
+    @ApiModelProperty(value = "紧急程度")
     private String urgency;
 
+    @ApiModelProperty(value = "地址")
     private String address;
 
+    @ApiModelProperty(value = "联系人")
     private String contactUser;
 
+    @ApiModelProperty(value = "联系电话")
     private String contactPhone;
 
+    @ApiModelProperty(value = "报警时间")
     private String orderTime;
 
+    @ApiModelProperty(value = "公司机构id")
     private String companyOrgId;
 
+    @ApiModelProperty(value = "部门机构id")
     private String departmentOrgId;
 
+    @ApiModelProperty(value = "0未接单、1进行中、2完成、3拒单")
     private Integer orderStatus;
 
+    @ApiModelProperty(value = "1运维上报、2用户上报、3设备告警")
     private Integer eventType;
 
+    @ApiModelProperty(value = "工单类型编号")
     private Integer orderTypeId;
 
+    @ApiModelProperty(value = "父单编号")
     private String orderPid;
 
+    @ApiModelProperty(value = "租户id")
     private String tenantId;
 
+    @ApiModelProperty(value = "流程实例id")
     private String processInstanceId;
 
+    @ApiModelProperty(value = "流程定义id")
     private String processDefId;
 
+    @ApiModelProperty(value = "任务id")
     private String currentTaskId;
 
+    @ApiModelProperty(value = "当前处理人")
     private String currentUsers;
 
+    @ApiModelProperty(value = "当前名称")
     private String currentTaskName;
 
-    private String createBy;
-
-    private Date dateCreate;
-
-    private String updateBy;
-
-    private Date dateUpdate;
-
+    @ApiModelProperty(value = "拒绝理由")
     private String rejectReason;
 
+    @ApiModelProperty(value = "经纬度")
     private String geo;
 
-    private static final long serialVersionUID = 1L;
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public String getTaskNo() {
-        return taskNo;
-    }
-
-    public void setTaskNo(String taskNo) {
-        this.taskNo = taskNo == null ? null : taskNo.trim();
-    }
-
-    public String getTaskDesc() {
-        return taskDesc;
-    }
-
-    public void setTaskDesc(String taskDesc) {
-        this.taskDesc = taskDesc == null ? null : taskDesc.trim();
-    }
-
-    public String getOrderUserId() {
-        return orderUserId;
-    }
-
-    public void setOrderUserId(String orderUserId) {
-        this.orderUserId = orderUserId == null ? null : orderUserId.trim();
-    }
-
-    public Date getSendTime() {
-        return sendTime;
-    }
-
-    public void setSendTime(Date sendTime) {
-        this.sendTime = sendTime;
-    }
-
-    public String getSendBy() {
-        return sendBy;
-    }
-
-    public void setSendBy(String sendBy) {
-        this.sendBy = sendBy == null ? null : sendBy.trim();
-    }
-
-    public Date getPlanFinishDate() {
-        return planFinishDate;
-    }
-
-    public void setPlanFinishDate(Date planFinishDate) {
-        this.planFinishDate = planFinishDate;
-    }
-
-    public Date getFinishDate() {
-        return finishDate;
-    }
-
-    public void setFinishDate(Date finishDate) {
-        this.finishDate = finishDate;
-    }
-
-    public String getDateLimit() {
-        return dateLimit;
-    }
-
-    public void setDateLimit(String dateLimit) {
-        this.dateLimit = dateLimit == null ? null : dateLimit.trim();
-    }
-
-    public String getUrgency() {
-        return urgency;
-    }
-
-    public void setUrgency(String urgency) {
-        this.urgency = urgency == null ? null : urgency.trim();
-    }
-
-    public String getAddress() {
-        return address;
-    }
-
-    public void setAddress(String address) {
-        this.address = address == null ? null : address.trim();
-    }
-
-    public String getContactUser() {
-        return contactUser;
-    }
-
-    public void setContactUser(String contactUser) {
-        this.contactUser = contactUser == null ? null : contactUser.trim();
-    }
-
-    public String getContactPhone() {
-        return contactPhone;
-    }
-
-    public void setContactPhone(String contactPhone) {
-        this.contactPhone = contactPhone == null ? null : contactPhone.trim();
-    }
-
-    public String getOrderTime() {
-        return orderTime;
-    }
-
-    public void setOrderTime(String orderTime) {
-        this.orderTime = orderTime == null ? null : orderTime.trim();
-    }
-
-    public String getCompanyOrgId() {
-        return companyOrgId;
-    }
-
-    public void setCompanyOrgId(String companyOrgId) {
-        this.companyOrgId = companyOrgId == null ? null : companyOrgId.trim();
-    }
-
-    public String getDepartmentOrgId() {
-        return departmentOrgId;
-    }
-
-    public void setDepartmentOrgId(String departmentOrgId) {
-        this.departmentOrgId = departmentOrgId == null ? null : departmentOrgId.trim();
-    }
-
-    public Integer getOrderStatus() {
-        return orderStatus;
-    }
-
-    public void setOrderStatus(Integer orderStatus) {
-        this.orderStatus = orderStatus;
-    }
-
-    public Integer getEventType() {
-        return eventType;
-    }
-
-    public void setEventType(Integer eventType) {
-        this.eventType = eventType;
-    }
-
-    public Integer getOrderTypeId() {
-        return orderTypeId;
-    }
-
-    public void setOrderTypeId(Integer orderTypeId) {
-        this.orderTypeId = orderTypeId;
-    }
-
-    public String getOrderPid() {
-        return orderPid;
-    }
-
-    public void setOrderPid(String orderPid) {
-        this.orderPid = orderPid == null ? null : orderPid.trim();
-    }
-
-    public String getTenantId() {
-        return tenantId;
-    }
-
-    public void setTenantId(String tenantId) {
-        this.tenantId = tenantId == null ? null : tenantId.trim();
-    }
-
-    public String getProcessInstanceId() {
-        return processInstanceId;
-    }
-
-    public void setProcessInstanceId(String processInstanceId) {
-        this.processInstanceId = processInstanceId == null ? null : processInstanceId.trim();
-    }
-
-    public String getProcessDefId() {
-        return processDefId;
-    }
-
-    public void setProcessDefId(String processDefId) {
-        this.processDefId = processDefId == null ? null : processDefId.trim();
-    }
-
-    public String getCurrentTaskId() {
-        return currentTaskId;
-    }
-
-    public void setCurrentTaskId(String currentTaskId) {
-        this.currentTaskId = currentTaskId == null ? null : currentTaskId.trim();
-    }
-
-    public String getCurrentUsers() {
-        return currentUsers;
-    }
-
-    public void setCurrentUsers(String currentUsers) {
-        this.currentUsers = currentUsers == null ? null : currentUsers.trim();
-    }
-
-    public String getCurrentTaskName() {
-        return currentTaskName;
-    }
-
-    public void setCurrentTaskName(String currentTaskName) {
-        this.currentTaskName = currentTaskName == null ? null : currentTaskName.trim();
-    }
-
-    public String getCreateBy() {
-        return createBy;
-    }
-
-    public void setCreateBy(String createBy) {
-        this.createBy = createBy == null ? null : createBy.trim();
-    }
-
-    public Date getDateCreate() {
-        return dateCreate;
-    }
-
-    public void setDateCreate(Date dateCreate) {
-        this.dateCreate = dateCreate;
-    }
-
-    public String getUpdateBy() {
-        return updateBy;
-    }
-
-    public void setUpdateBy(String updateBy) {
-        this.updateBy = updateBy == null ? null : updateBy.trim();
-    }
-
-    public Date getDateUpdate() {
-        return dateUpdate;
-    }
-
-    public void setDateUpdate(Date dateUpdate) {
-        this.dateUpdate = dateUpdate;
-    }
-
-    public String getRejectReason() {
-        return rejectReason;
-    }
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
 
-    public void setRejectReason(String rejectReason) {
-        this.rejectReason = rejectReason == null ? null : rejectReason.trim();
-    }
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
+    private Date dateCreate;
 
-    public String getGeo() {
-        return geo;
-    }
+    @ApiModelProperty(value = "修改人")
+    private String updateBy;
 
-    public void setGeo(String geo) {
-        this.geo = geo == null ? null : geo.trim();
-    }
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @ApiModelProperty(value = "修改时间")
+    private Date dateUpdate;
 }

+ 15 - 0
operation_manager/src/main/java/com/huaxu/order/service/WorkFlowDetailService.java

@@ -0,0 +1,15 @@
+package com.huaxu.order.service;
+
+
+import com.huaxu.order.entity.WorkFlowDetail;
+
+
+public interface WorkFlowDetailService {
+    /**
+     * 新增数据
+     *
+     * @param workFlowDetail 实例对象
+     * @return 影响行数
+     */
+    int insertSelective(WorkFlowDetail workFlowDetail);
+}

+ 18 - 0
operation_manager/src/main/java/com/huaxu/order/service/WorkOrderManageService.java

@@ -0,0 +1,18 @@
+package com.huaxu.order.service;
+
+
+import com.huaxu.order.entity.WorkOrderManage;
+
+import java.util.List;
+import java.util.Set;
+
+
+public interface WorkOrderManageService {
+    /**
+     * 新增数据
+     *
+     * @param workOrderManage 实例对象
+     * @return 影响行数
+     */
+    int insertSelective(WorkOrderManage workOrderManage);
+}

+ 33 - 0
operation_manager/src/main/java/com/huaxu/order/service/impl/WorkFlowDetailServiceImpl.java

@@ -0,0 +1,33 @@
+package com.huaxu.order.service.impl;
+
+import com.huaxu.order.dao.WorkFlowDetailMapper;
+import com.huaxu.order.entity.WorkFlowDetail;
+import com.huaxu.order.service.WorkFlowDetailService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+/**
+ *
+ *
+ * @author yjy
+ * @Description
+ * @date 2021-1-11
+ */
+
+@Service
+public class WorkFlowDetailServiceImpl implements WorkFlowDetailService {
+
+    @Autowired
+    WorkFlowDetailMapper workFlowDetailMapper;
+    /**
+     * 新增数据
+     *
+     * @param workFlowDetail 实例对象
+     * @return 实例对象
+     */
+    @Override
+    public int insertSelective(WorkFlowDetail workFlowDetail) {
+        return workFlowDetailMapper.insertSelective(workFlowDetail);
+    }
+}

+ 33 - 0
operation_manager/src/main/java/com/huaxu/order/service/impl/WorkOrderManageServiceImpl.java

@@ -0,0 +1,33 @@
+package com.huaxu.order.service.impl;
+
+import com.huaxu.order.dao.WorkOrderManageMapper;
+import com.huaxu.order.entity.WorkOrderManage;
+import com.huaxu.order.service.WorkOrderManageService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+/**
+ *
+ *
+ * @author yjy
+ * @Description
+ * @date 2021-1-11
+ */
+
+@Service
+public class WorkOrderManageServiceImpl implements WorkOrderManageService {
+
+    @Autowired
+    WorkOrderManageMapper workOrderManageMapper;
+    /**
+     * 新增数据
+     *
+     * @param workOrderManage 实例对象
+     * @return 实例对象
+     */
+    @Override
+    public int insertSelective(WorkOrderManage workOrderManage) {
+        return workOrderManageMapper.insertSelective(workOrderManage);
+    }
+}

+ 1 - 1
operation_manager/src/main/resources/mapper/order/WorkOrderManageMapper.xml

@@ -76,7 +76,7 @@
       #{dateCreate,jdbcType=DATE}, #{updateBy,jdbcType=VARCHAR}, #{dateUpdate,jdbcType=DATE}, 
       #{rejectReason,jdbcType=VARCHAR}, #{geo,jdbcType=VARCHAR})
   </insert>
-  <insert id="insertSelective" parameterType="com.huaxu.order.entity.WorkOrderManage" >
+  <insert id="insertSelective" parameterType="com.huaxu.order.entity.WorkOrderManage" keyProperty="id" useGeneratedKeys="true">
     insert into sc_work_order_manage
     <trim prefix="(" suffix=")" suffixOverrides="," >
       <if test="id != null" >