dcs 1 jaar geleden
bovenliggende
commit
b958567e4a

+ 22 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/controller/WorkOrderController.java

@@ -2,6 +2,7 @@ package com.bosshand.virgo.api.controller;
 
 
 import com.bosshand.virgo.api.model.WorkOrder;
+import com.bosshand.virgo.api.model.WorkOrderProcess;
 import com.bosshand.virgo.api.service.ProjectItemTargetRoomService;
 import com.bosshand.virgo.api.service.WorkOrderService;
 import com.bosshand.virgo.core.response.Response;
@@ -79,4 +80,25 @@ public class WorkOrderController {
         }
     }
 
+    @ApiOperation("保存过程")
+    @RequestMapping(value = "/process", method = RequestMethod.POST)
+    public Response insertProcess(@RequestBody WorkOrderProcess workOrderProcess) {
+        workOrderService.insertProcess(workOrderProcess);
+        return Response.ok();
+    }
+
+    @ApiOperation("更新过程")
+    @RequestMapping(value = "/process/update", method = RequestMethod.PUT)
+    public Response updateProcess(@RequestBody WorkOrderProcess workOrderProcess) {
+        workOrderService.updateProcess(workOrderProcess);
+        return Response.ok();
+    }
+
+    @ApiOperation("删除过程")
+    @RequestMapping(value = "/process/delete/{id}", method = RequestMethod.DELETE)
+    public Response deleteProcess(@PathVariable long id) {
+        workOrderService.deleteProcess(id);
+        return Response.ok();
+    }
+
 }

+ 19 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/dao/WorkOrderProcessDao.java

@@ -0,0 +1,19 @@
+package com.bosshand.virgo.api.dao;
+
+import com.bosshand.virgo.api.model.WorkOrderProcess;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface WorkOrderProcessDao {
+
+    int insert(WorkOrderProcess workOrderProcess);
+
+    int update(WorkOrderProcess workOrderProcess);
+
+    int delete(long id);
+
+    List<WorkOrderProcess> getWorkOrderId(long workOrderId);
+
+}

+ 13 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/model/Contract.java

@@ -13,6 +13,11 @@ public class Contract {
 
     private long id;
 
+    /**
+     * 名称
+     */
+    private String name;
+
     /**
      * 编码
      */
@@ -202,6 +207,14 @@ public class Contract {
         this.id = id;
     }
 
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
     public String getCode() {
         return code;
     }

+ 26 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/model/ProjectItemTargetRoom.java

@@ -35,6 +35,16 @@ public class ProjectItemTargetRoom {
 
     private String projectItemTargetName;
 
+    /**
+     * 负责人id
+     */
+    private long chargePersonId;
+
+    /**
+     * 负责人名称
+     */
+    private String chargePersonName;
+
     /**
      * 名称
      */
@@ -200,6 +210,22 @@ public class ProjectItemTargetRoom {
         this.projectItemTargetName = projectItemTargetName;
     }
 
+    public long getChargePersonId() {
+        return chargePersonId;
+    }
+
+    public void setChargePersonId(long chargePersonId) {
+        this.chargePersonId = chargePersonId;
+    }
+
+    public String getChargePersonName() {
+        return chargePersonName;
+    }
+
+    public void setChargePersonName(String chargePersonName) {
+        this.chargePersonName = chargePersonName;
+    }
+
     public String getName() {
         return name;
     }

+ 11 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/model/WorkOrder.java

@@ -128,6 +128,8 @@ public class WorkOrder {
      */
     private String data;
 
+    List<WorkOrderProcess> workOrderProcessList;
+
     public long getId() {
         return id;
     }
@@ -327,4 +329,13 @@ public class WorkOrder {
     public void setData(String data) {
         this.data = data;
     }
+
+    public List<WorkOrderProcess> getWorkOrderProcessList() {
+        return workOrderProcessList;
+    }
+
+    public void setWorkOrderProcessList(List<WorkOrderProcess> workOrderProcessList) {
+        this.workOrderProcessList = workOrderProcessList;
+    }
+
 }

+ 101 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/model/WorkOrderProcess.java

@@ -0,0 +1,101 @@
+package com.bosshand.virgo.api.model;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+/**
+ * 工单处理过程
+ */
+public class WorkOrderProcess {
+
+    private long id;
+
+    /**
+     * 工单id
+     */
+    private long workOrderId;
+
+    /**
+     * 时间
+     */
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date date;
+
+    /**
+     * 处理人
+     */
+    private long operatorId;
+
+    /**
+     * 处理人名称
+     */
+    private String operatorName;
+
+    /**
+     * 附件
+     */
+    private String attachment;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public long getWorkOrderId() {
+        return workOrderId;
+    }
+
+    public void setWorkOrderId(long workOrderId) {
+        this.workOrderId = workOrderId;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public long getOperatorId() {
+        return operatorId;
+    }
+
+    public void setOperatorId(long operatorId) {
+        this.operatorId = operatorId;
+    }
+
+    public String getOperatorName() {
+        return operatorName;
+    }
+
+    public void setOperatorName(String operatorName) {
+        this.operatorName = operatorName;
+    }
+
+    public String getAttachment() {
+        return attachment;
+    }
+
+    public void setAttachment(String attachment) {
+        this.attachment = attachment;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+}

+ 21 - 1
virgo.api/src/main/java/com/bosshand/virgo/api/service/WorkOrderService.java

@@ -1,7 +1,9 @@
 package com.bosshand.virgo.api.service;
 
 import com.bosshand.virgo.api.dao.WorkOrderDao;
+import com.bosshand.virgo.api.dao.WorkOrderProcessDao;
 import com.bosshand.virgo.api.model.WorkOrder;
+import com.bosshand.virgo.api.model.WorkOrderProcess;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -13,6 +15,9 @@ public class WorkOrderService {
     @Autowired
     private WorkOrderDao workOrderDao;
 
+    @Autowired
+    private WorkOrderProcessDao workOrderProcessDao;
+
     public int getTotalCount(WorkOrder workOrder) {
         return workOrderDao.getTotalCount(workOrder);
     }
@@ -35,6 +40,21 @@ public class WorkOrderService {
     }
 
     public WorkOrder get(long id) {
-        return workOrderDao.get(id);
+        WorkOrder workOrder = workOrderDao.get(id);
+        workOrder.setWorkOrderProcessList(workOrderProcessDao.getWorkOrderId(id));
+        return workOrder;
     }
+
+    public int insertProcess(WorkOrderProcess workOrderProcess) {
+        return workOrderProcessDao.insert(workOrderProcess);
+    }
+
+    public int updateProcess(WorkOrderProcess workOrderProcess) {
+        return workOrderProcessDao.update(workOrderProcess);
+    }
+
+    public int deleteProcess(long id) {
+        return workOrderProcessDao.delete(id);
+    }
+
 }

+ 8 - 2
virgo.api/src/main/resources/mapper/ContractMapper.xml

@@ -6,6 +6,7 @@
 
     <resultMap type="com.bosshand.virgo.api.model.Contract" id="contractResult">
         <id column="id" property="id"/>
+        <result column="name" property="name"/>
         <result column="code" property="code"/>
         <result column="createDate" property="createDate"/>
         <result column="organizationId" property="organizationId"/>
@@ -43,6 +44,7 @@
 
     <resultMap type="com.bosshand.virgo.api.model.Contract" id="result">
         <id column="id" property="id"/>
+        <result column="name" property="name"/>
         <result column="code" property="code"/>
         <result column="createDate" property="createDate"/>
         <result column="organizationId" property="organizationId"/>
@@ -82,10 +84,10 @@
 
 
     <insert id="insert" parameterType="com.bosshand.virgo.api.model.Contract" useGeneratedKeys="true" keyProperty="id">
-        INSERT INTO contract(`code`, `createDate`, `organizationId`, `organizationName`, `roleId`, `roleName`, `investmentPromotion`, `operator`, `investmentPromotionName`, `operatorName`,`tenantType`, `merchantId`, `merchantName`, `clientId`, `clientName`,
+        INSERT INTO contract(`name`, `code`, `createDate`, `organizationId`, `organizationName`, `roleId`, `roleName`, `investmentPromotion`, `operator`, `investmentPromotionName`, `operatorName`,`tenantType`, `merchantId`, `merchantName`, `clientId`, `clientName`,
                              `tenant`, `industry`, `corporation`, `signatory`, `tenantContactPerson`, `signingDate`, `startDate`, `endDate`,
                              `lateFeesStartingDays`, `lateFeesProportion`, `lateFeesCeiling`, `tagIds`, `projectId`, `projectItemTargetRoomIds`, `attachment`, `document`, `status`, `data`)
-        VALUES (#{code}, now(), #{organizationId}, #{organizationName}, #{roleId}, #{roleName}, #{investmentPromotion}, #{operator}, #{investmentPromotionName}, #{operatorName}, #{tenantType}, #{merchantId}, #{merchantName}, #{clientId}, #{clientName}, #{tenant},
+        VALUES (#{name}, #{code}, now(), #{organizationId}, #{organizationName}, #{roleId}, #{roleName}, #{investmentPromotion}, #{operator}, #{investmentPromotionName}, #{operatorName}, #{tenantType}, #{merchantId}, #{merchantName}, #{clientId}, #{clientName}, #{tenant},
                 #{industry}, #{corporation}, #{signatory}, #{tenantContactPerson}, #{signingDate}, #{startDate}, #{endDate}, #{lateFeesStartingDays},
                 #{lateFeesProportion}, #{lateFeesCeiling}, #{tagIds}, #{projectId}, #{projectItemTargetRoomIds}, #{attachment}, #{document}, #{status}, #{data})
     </insert>
@@ -97,6 +99,7 @@
     <update id="update" parameterType="com.bosshand.virgo.api.model.Contract">
         UPDATE contract
         <trim prefix="set" suffixOverrides=",">
+            <if test="name!=null">name=#{name},</if>
             <if test="organizationId!=0">organizationId=#{organizationId},</if>
             <if test="organizationName!=null">organizationName=#{organizationName},</if>
             <if test="roleId!=0">roleId=#{roleId},</if>
@@ -167,6 +170,7 @@
     <select id="getList" resultMap="contractResult">
         SELECT * FROM contract
         <where>
+            <if test="name!=null">and name=#{name}</if>
             <if test="code!=null">and code=#{code}</if>
             <if test="organizationId!=0">and organizationId=#{organizationId}</if>
             <if test="organizationName!=null">and organizationName=#{organizationName}</if>
@@ -208,6 +212,7 @@
     <select id="getTotalCount" parameterType="com.bosshand.virgo.api.model.Contract" resultType="Integer">
         SELECT count(*) FROM contract
         <where>
+            <if test="name!=null">and name=#{name}</if>
             <if test="code!=null">and code=#{code}</if>
             <if test="organizationId!=0">and organizationId=#{organizationId}</if>
             <if test="organizationName!=null">and organizationName=#{organizationName}</if>
@@ -254,6 +259,7 @@
     <select id="getLimit" resultMap="contractResult">
         SELECT * FROM contract
         <where>
+            <if test="p.name!=null">and name=#{p.name}</if>
             <if test="p.code!=null">and code=#{p.code}</if>
             <if test="p.organizationId!=0">and organizationId=#{p.organizationId}</if>
             <if test="p.organizationName!=null">and organizationName=#{p.organizationName}</if>

+ 55 - 43
virgo.api/src/main/resources/mapper/ProjectItemTargetRoomMapper.xml

@@ -10,6 +10,8 @@
         <result column="projectId" property="projectId"/>
         <result column="projectItemId" property="projectItemId"/>
         <result column="projectItemTargetId" property="projectItemTargetId"/>
+        <result column="chargePersonId" property="chargePersonId"/>
+        <result column="chargePersonName" property="chargePersonName"/>
         <result column="name" property="name"/>
         <result column="roomTypeId" property="roomTypeId"/>
         <result column="roomNumber" property="roomNumber"/>
@@ -32,88 +34,91 @@
     </resultMap>
 
     <sql id="ProjectItemTargetRoomQuery">
-        SELECT * FROM project_item_target_room
+        SELECT a.*, b.name as chargePersonName FROM project_item_target_room a LEFT JOIN mgr_user b ON a.chargePersonId = b.id
     </sql>
 
     <select id="get" resultMap="projectItemTargetRoomResult">
         <include refid="ProjectItemTargetRoomQuery"/>
-        where id=#{id}
+        where a.id=#{id}
     </select>
 
     <select id="getProjectItemTargetId" resultMap="projectItemTargetRoomResult">
         <include refid="ProjectItemTargetRoomQuery"/>
-        where projectItemTargetId=#{projectItemTargetId}
+        where a.projectItemTargetId=#{projectItemTargetId}
     </select>
 
     <select id="getProjectItemTargetRoom" resultMap="projectItemTargetRoomResult">
         <include refid="ProjectItemTargetRoomQuery"/>
         <where>
             <if test="id != 0">
-                and id = #{id}
+                and a.id = #{id}
             </if>
             <if test="code != null">
-                and code = #{code}
+                and a.code = #{code}
             </if>
             <if test="projectId != 0">
-                and projectId = #{projectId}
+                and a.projectId = #{projectId}
             </if>
             <if test="projectItemId != 0">
-                and projectItemId = #{projectItemId}
+                and a.projectItemId = #{projectItemId}
             </if>
             <if test="projectItemTargetId != 0">
-                and projectItemTargetId = #{projectItemTargetId}
+                and a.projectItemTargetId = #{projectItemTargetId}
             </if>
             <if test="name != null">
-                and name = #{name}
+                and a.name = #{name}
+            </if>
+            <if test="chargePersonId != 0">
+                and a.chargePersonId = #{chargePersonId}
             </if>
             <if test="roomTypeId != 0">
-                and roomTypeId = #{roomTypeId}
+                and a.roomTypeId = #{roomTypeId}
             </if>
             <if test="roomNumber != null">
-                and roomNumber = #{roomNumber}
+                and a.roomNumber = #{roomNumber}
             </if>
             <if test="roomState != null">
-                and roomState = #{roomState}
+                and a.roomState = #{roomState}
             </if>
             <if test="investmentState != null">
-                and investmentState = #{investmentState}
+                and a.investmentState = #{investmentState}
             </if>
             <if test="invocationDate != null">
-                and invocationDate = #{invocationDate}
+                and a.invocationDate = #{invocationDate}
             </if>
             <if test="decoration != 0">
-                and decoration = #{decoration}
+                and a.decoration = #{decoration}
             </if>
             <if test="propertyCertificateNumber != null">
-                and propertyCertificateNumber = #{propertyCertificateNumber}
+                and a.propertyCertificateNumber = #{propertyCertificateNumber}
             </if>
             <if test="tagIds != null">and
                 <foreach item="tagId" collection="tagIds.split(',')" open="(" separator=" and " close=")">
-                    FIND_IN_SET (#{tagId}, tagIds)
+                    FIND_IN_SET (#{tagId}, a.tagIds)
                 </foreach>
             </if>
             <if test="openState != null">
-                and openState = #{openState}
+                and a.openState = #{openState}
             </if>
             <if test="price != null">
-                and price = #{price}
+                and a.price = #{price}
             </if>
             <if test="payWay != 0">
-                and payWay = #{payWay}
+                and a.payWay = #{payWay}
             </if>
             <if test="payType != 0">
-                and payType = #{payType}
+                and a.payType = #{payType}
             </if>
             <if test="introduce != null">
-                and introduce = #{introduce}
+                and a.introduce = #{introduce}
             </if>
         </where>
     </select>
 
     <insert id="insert" useGeneratedKeys="true" keyProperty="id">
-        INSERT INTO project_item_target_room(`projectId`, `projectItemId`, `projectItemTargetId`,`name`, `roomTypeId`, `roomNumber`, `area`, `roomState`, `investmentState`,
+        INSERT INTO project_item_target_room(`projectId`, `projectItemId`, `projectItemTargetId`,`name`, `chargePersonId`, `roomTypeId`, `roomNumber`, `area`, `roomState`, `investmentState`,
                                              `invocationDate`, `decoration`, `propertyCertificateNumber`, `showPicture`, `picture`, `video`, `tagIds`, `openState`, `price`, `payWay`, `payType`, `introduce`, `data`)
-        VALUES (#{projectId}, #{projectItemId}, #{projectItemTargetId}, #{name}, #{roomTypeId}, #{roomNumber}, #{area}, #{roomState}, #{investmentState},
+        VALUES (#{projectId}, #{projectItemId}, #{projectItemTargetId}, #{name}, #{chargePersonId}, #{roomTypeId}, #{roomNumber}, #{area}, #{roomState}, #{investmentState},
                 #{invocationDate}, #{decoration}, #{propertyCertificateNumber}, #{showPicture}, #{picture}, #{video}, #{tagIds}, #{openState}, #{price}, #{payWay}, #{payType}, #{introduce}, #{data})
     </insert>
 
@@ -143,6 +148,9 @@
             <if test="name != null">
                 and name = #{name}
             </if>
+            <if test="chargePersonId != 0">
+                and chargePersonId = #{chargePersonId}
+            </if>
             <if test="roomTypeId != 0">
                 and roomTypeId = #{roomTypeId}
             </if>
@@ -188,63 +196,66 @@
     </select>
 
     <select id="getLimit" resultMap="projectItemTargetRoomResult">
-        SELECT * FROM project_item_target_room
+        <include refid="ProjectItemTargetRoomQuery"/>
         <where>
             <if test="p.code != null">
-                and code = #{p.code}
+                and a.code = #{p.code}
             </if>
             <if test="p.projectId != 0">
-                and projectId = #{p.projectId}
+                and a.projectId = #{p.projectId}
             </if>
             <if test="p.projectItemId != 0">
-                and projectItemId = #{p.projectItemId}
+                and a.projectItemId = #{p.projectItemId}
             </if>
             <if test="p.projectItemTargetId != 0">
-                and projectItemTargetId = #{p.projectItemTargetId}
+                and a.projectItemTargetId = #{p.projectItemTargetId}
             </if>
             <if test="p.name != null">
-                and name = #{p.name}
+                and a.name = #{p.name}
+            </if>
+            <if test="p.chargePersonId != 0">
+                and a.chargePersonId = #{p.chargePersonId}
             </if>
             <if test="p.roomTypeId != 0">
-                and roomTypeId = #{p.roomTypeId}
+                and a.roomTypeId = #{p.roomTypeId}
             </if>
             <if test="p.roomNumber != null">
-                and roomNumber = #{p.roomNumber}
+                and a.roomNumber = #{p.roomNumber}
             </if>
             <if test="p.roomState != null">
-                and roomState = #{p.roomState}
+                and a.roomState = #{p.roomState}
             </if>
             <if test="p.investmentState != null">
-                and investmentState = #{p.investmentState}
+                and a.investmentState = #{p.investmentState}
             </if>
             <if test="p.invocationDate != null">
-                and invocationDate = #{p.invocationDate}
+                and a.invocationDate = #{p.invocationDate}
             </if>
             <if test="p.decoration != 0">
-                and decoration = #{p.decoration}
+                and a.decoration = #{p.decoration}
             </if>
             <if test="p.propertyCertificateNumber != null">
-                and propertyCertificateNumber = #{p.propertyCertificateNumber}
+                and a.propertyCertificateNumber = #{p.propertyCertificateNumber}
             </if>
             <if test="p.tagIds != null">and
                 <foreach item="tagId" collection="p.tagIds.split(',')" open="(" separator=" and " close=")">
-                    FIND_IN_SET (#{tagId}, tagIds)
+                    FIND_IN_SET (#{tagId}, a.tagIds)
                 </foreach>
             </if>
             <if test="p.openState != null">
-                and openState = #{p.openState}
+                and a.openState = #{p.openState}
             </if>
             <if test="p.price != null">
-                and price = #{p.price}
+                and a.price = #{p.price}
             </if>
             <if test="p.payWay != 0">
-                and payWay = #{p.payWay}
+                and a.payWay = #{p.payWay}
             </if>
             <if test="p.payType != 0">
-                and payType = #{p.payType}
+                and a.payType = #{p.payType}
             </if>
             <if test="p.introduce != null">
-                and introduce = #{p.introduce}
+                and a.introduce = #{p.introduce}
             </if>
         </where>
         limit #{currIndex} , #{pageSize}
@@ -257,6 +268,7 @@
             <if test="projectItemId!=0">projectItemId=#{projectItemId},</if>
             <if test="projectItemTargetId!=0">projectItemTargetId=#{projectItemTargetId},</if>
             <if test="name!=null">name=#{name},</if>
+            <if test="chargePersonId!=0">chargePersonId=#{chargePersonId},</if>
             <if test="roomTypeId!=0">roomTypeId=#{roomTypeId},</if>
             <if test="roomNumber!=null">roomNumber=#{roomNumber},</if>
             <if test="area!=null">area=#{area},</if>

+ 46 - 0
virgo.api/src/main/resources/mapper/WorkOrderProcessMapper.xml

@@ -0,0 +1,46 @@
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.bosshand.virgo.api.dao.WorkOrderProcessDao">
+
+    <resultMap type="com.bosshand.virgo.api.model.WorkOrderProcess" id="workOrderProcessResult">
+        <id column="id" property="id"/>
+        <result column="workOrderId" property="workOrderId"/>
+        <result column="date" property="date"/>
+        <result column="operatorId" property="operatorId"/>
+        <result column="operatorName" property="operatorName"/>
+        <result column="attachment" property="attachment"/>
+        <result column="remark" property="remark"/>
+    </resultMap>
+
+    <insert id="insert" parameterType="com.bosshand.virgo.api.model.WorkOrderProcess" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO work_order_process(`workOrderId`, `date`, `operatorId`, `attachment`, `remark`) VALUES (#{workOrderId}, now(), #{operatorId}, #{attachment}, #{remark})
+    </insert>
+
+    <delete id="delete">
+        DELETE from work_order_process where id=#{id}
+    </delete>
+
+    <update id="update" parameterType="com.bosshand.virgo.api.model.WorkOrderProcess">
+        UPDATE work_order_process
+        <trim prefix="set" suffixOverrides=",">
+            <if test="workOrderId!=0">workOrderId=#{workOrderId},</if>
+            <if test="date==null">date=now(),</if>
+            <if test="operatorId!=0">operatorId=#{operatorId},</if>
+            <if test="attachment!=null">attachment=#{attachment},</if>
+            <if test="remark!=null">remark=#{remark},</if>
+        </trim>
+        WHERE id=#{id}
+    </update>
+
+    <sql id="query">
+        SELECT a.*, b.name as operatorName FROM work_order_process a LEFT JOIN mgr_user b ON a.operatorId = b.id
+    </sql>
+
+    <select id="getWorkOrderId" resultMap="workOrderProcessResult">
+        <include refid="query"/>
+        where a.workOrderId = #{workOrderId} order by a.date desc
+    </select>
+
+</mapper>