Explorar el Código

加入查询 我的问卷查询

java110 hace 5 años
padre
commit
c9bca8634e

+ 2 - 0
java110-bean/src/main/java/com/java110/dto/questionAnswer/QuestionAnswerDto.java

@@ -18,6 +18,8 @@ public class QuestionAnswerDto extends PageDto implements Serializable {
     public static final String QA_TYPE_COMMUNITY = "3306";//小区
     public static final String QA_TYPE_STORE = "3307";//商户ID
 
+
+
     private String qaName;
     private String qaType;
     private String qaTypeName;

+ 92 - 23
java110-bean/src/main/java/com/java110/dto/userQuestionAnswer/UserQuestionAnswerDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.userQuestionAnswer;
 
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -15,14 +16,19 @@ import java.util.Date;
 public class UserQuestionAnswerDto extends PageDto implements Serializable {
 
     private String score;
-private String evaluationScore;
-private String objId;
-private String userQaId;
-private String personId;
-private String state;
-private String objType;
-private String qaId;
-
+    private String evaluationScore;
+    private String objId;
+    private String userQaId;
+    private String personId;
+    private String state;
+    private String objType;
+    private String qaId;
+    private String qaType;
+    private String[] qaTypes;
+    private String startTime;
+    private String qaName;
+    private String endTime;
+    private String qaTypeName;
 
     private Date createTime;
 
@@ -32,49 +38,64 @@ private String qaId;
     public String getScore() {
         return score;
     }
-public void setScore(String score) {
+
+    public void setScore(String score) {
         this.score = score;
     }
-public String getEvaluationScore() {
+
+    public String getEvaluationScore() {
         return evaluationScore;
     }
-public void setEvaluationScore(String evaluationScore) {
+
+    public void setEvaluationScore(String evaluationScore) {
         this.evaluationScore = evaluationScore;
     }
-public String getObjId() {
+
+    public String getObjId() {
         return objId;
     }
-public void setObjId(String objId) {
+
+    public void setObjId(String objId) {
         this.objId = objId;
     }
-public String getUserQaId() {
+
+    public String getUserQaId() {
         return userQaId;
     }
-public void setUserQaId(String userQaId) {
+
+    public void setUserQaId(String userQaId) {
         this.userQaId = userQaId;
     }
-public String getPersonId() {
+
+    public String getPersonId() {
         return personId;
     }
-public void setPersonId(String personId) {
+
+    public void setPersonId(String personId) {
         this.personId = personId;
     }
-public String getState() {
+
+    public String getState() {
         return state;
     }
-public void setState(String state) {
+
+    public void setState(String state) {
         this.state = state;
     }
-public String getObjType() {
+
+    public String getObjType() {
         return objType;
     }
-public void setObjType(String objType) {
+
+    public void setObjType(String objType) {
         this.objType = objType;
     }
-public String getQaId() {
+
+    public String getQaId() {
         return qaId;
     }
-public void setQaId(String qaId) {
+
+    public void setQaId(String qaId) {
         this.qaId = qaId;
     }
 
@@ -94,4 +115,52 @@ public void setQaId(String qaId) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
+
+    public String getQaType() {
+        return qaType;
+    }
+
+    public void setQaType(String qaType) {
+        this.qaType = qaType;
+    }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getQaName() {
+        return qaName;
+    }
+
+    public void setQaName(String qaName) {
+        this.qaName = qaName;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public String getQaTypeName() {
+        return qaTypeName;
+    }
+
+    public void setQaTypeName(String qaTypeName) {
+        this.qaTypeName = qaTypeName;
+    }
+
+    public String[] getQaTypes() {
+        return qaTypes;
+    }
+
+    public void setQaTypes(String[] qaTypes) {
+        this.qaTypes = qaTypes;
+    }
 }

+ 4 - 4
java110-db/src/main/resources/mapper/user/QuestionAnswerServiceDaoImplMapper.xml

@@ -18,8 +18,8 @@
     <!-- 查询答卷信息 add by wuxw 2018-07-03 -->
     <select id="getQuestionAnswerInfo" parameterType="Map" resultType="Map">
         select t.qa_name,t.qa_name qaName,t.qa_type,t.qa_type qaType,t.status_cd,t.status_cd
-        statusCd,t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,t.remark,t.remark
-        storeId,t.obj_type,t.obj_type objType,t.obj_id,t.obj_id objId,t.qa_id,t.qa_id qaId,td.`name` qaTypeName
+        statusCd,t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,t.remark,
+        t.obj_type,t.obj_type objType,t.obj_id,t.obj_id objId,t.qa_id,t.qa_id qaId,td.`name` qaTypeName
         from question_answer t
         LEFT JOIN t_dict td on td.status_cd = t.qa_type and td.table_name = 'question_answer' and td.table_columns = 'qa_type'
         where 1 =1
@@ -38,8 +38,8 @@
         <if test="endTime !=null and endTime != ''">
             and t.end_time= #{endTime}
         </if>
-        <if test="storeId !=null and storeId != ''">
-            and t.remark= #{storeId}
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
         </if>
         <if test="objType !=null and objType != ''">
             and t.obj_type= #{objType}

+ 131 - 104
java110-db/src/main/resources/mapper/user/UserQuestionAnswerServiceDaoImplMapper.xml

@@ -5,129 +5,156 @@
 <mapper namespace="userQuestionAnswerServiceDaoImpl">
 
 
-
-
-
     <!-- 保存答卷信息 add by wuxw 2018-07-03 -->
     <insert id="saveUserQuestionAnswerInfo" parameterType="Map">
         insert into user_question_answer(
-score,evaluation_score,obj_id,user_qa_id,person_id,state,obj_type,qa_id
-) values (
-#{score},#{evaluationScore},#{objId},#{userQaId},#{personId},#{state},#{objType},#{qaId}
-)
+        score,evaluation_score,obj_id,user_qa_id,person_id,state,obj_type,qa_id
+        ) values (
+        #{score},#{evaluationScore},#{objId},#{userQaId},#{personId},#{state},#{objType},#{qaId}
+        )
     </insert>
 
 
-
     <!-- 查询答卷信息 add by wuxw 2018-07-03 -->
     <select id="getUserQuestionAnswerInfo" parameterType="Map" resultType="Map">
-        select  t.score,t.evaluation_score,t.evaluation_score evaluationScore,t.obj_id,t.obj_id objId,t.user_qa_id,t.user_qa_id userQaId,t.person_id,t.person_id personId,t.status_cd,t.status_cd statusCd,t.state,t.obj_type,t.obj_type objType,t.qa_id,t.qa_id qaId 
-from user_question_answer t 
-where 1 =1 
-<if test="score !=null and score != ''">
-   and t.score= #{score}
-</if> 
-<if test="evaluationScore !=null and evaluationScore != ''">
-   and t.evaluation_score= #{evaluationScore}
-</if> 
-<if test="objId !=null and objId != ''">
-   and t.obj_id= #{objId}
-</if> 
-<if test="userQaId !=null and userQaId != ''">
-   and t.user_qa_id= #{userQaId}
-</if> 
-<if test="personId !=null and personId != ''">
-   and t.person_id= #{personId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="state !=null and state != ''">
-   and t.state= #{state}
-</if> 
-<if test="objType !=null and objType != ''">
-   and t.obj_type= #{objType}
-</if> 
-<if test="qaId !=null and qaId != ''">
-   and t.qa_id= #{qaId}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        SELECT
+            t.qa_name qaName,
+            t.qa_type qaType,
+            t.start_time startTime,
+            t.end_time endTime,
+            t.remark,
+            t.obj_type objType,
+            t.obj_id objId,
+            t.qa_id qaId,
+            td.`name` qaTypeName,
+            uqa.score,
+            uqa.evaluation_score evaluationScore,
+            uqa.user_qa_id userQaId,
+            uqa.person_id personId,
+            uqa.state
+        FROM
+            question_answer t
+            LEFT JOIN user_question_answer uqa ON t.qa_id = uqa.qa_id AND t.obj_type = uqa.obj_type AND t.obj_id = uqa.obj_id AND uqa.status_cd = '0'
+            LEFT JOIN t_dict td ON td.status_cd = t.qa_type AND td.table_name = 'question_answer' AND td.table_columns = 'qa_type'
+        WHERE
+        <if test="personId !=null and personId != ''">
+            (
+            uqa.person_id IS NULL
+            OR uqa.person_id = #{personId}
+            )
+        </if>
+        <if test="userQaId !=null and userQaId != ''">
+            and uqa.user_qa_id= #{userQaId}
+        </if>
+        <if test="state !=null and state != ''">
+            and uqa.state= #{state}
+        </if>
+        <if test="qaId !=null and qaId != ''">
+            and t.qa_id= #{qaId}
+        </if>
+        <if test="qaName !=null and qaName != ''">
+            and t.qa_name= #{qaName}
+        </if>
+        <if test="objType !=null and objType != ''">
+            and t.obj_type= #{objType}
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="qaTypes !=null ">
+            and t.qa_type in
+            <foreach collection="qaTypes" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
     </select>
 
 
-
-
     <!-- 修改答卷信息 add by wuxw 2018-07-03 -->
     <update id="updateUserQuestionAnswerInfo" parameterType="Map">
-        update  user_question_answer t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="score !=null and score != ''">
-, t.score= #{score}
-</if> 
-<if test="evaluationScore !=null and evaluationScore != ''">
-, t.evaluation_score= #{evaluationScore}
-</if> 
-<if test="objId !=null and objId != ''">
-, t.obj_id= #{objId}
-</if> 
-<if test="personId !=null and personId != ''">
-, t.person_id= #{personId}
-</if> 
-<if test="state !=null and state != ''">
-, t.state= #{state}
-</if> 
-<if test="objType !=null and objType != ''">
-, t.obj_type= #{objType}
-</if> 
-<if test="qaId !=null and qaId != ''">
-, t.qa_id= #{qaId}
-</if> 
- where 1=1 <if test="userQaId !=null and userQaId != ''">
-and t.user_qa_id= #{userQaId}
-</if> 
+        update user_question_answer t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="score !=null and score != ''">
+            , t.score= #{score}
+        </if>
+        <if test="evaluationScore !=null and evaluationScore != ''">
+            , t.evaluation_score= #{evaluationScore}
+        </if>
+        <if test="objId !=null and objId != ''">
+            , t.obj_id= #{objId}
+        </if>
+        <if test="personId !=null and personId != ''">
+            , t.person_id= #{personId}
+        </if>
+        <if test="state !=null and state != ''">
+            , t.state= #{state}
+        </if>
+        <if test="objType !=null and objType != ''">
+            , t.obj_type= #{objType}
+        </if>
+        <if test="qaId !=null and qaId != ''">
+            , t.qa_id= #{qaId}
+        </if>
+        where 1=1
+        <if test="userQaId !=null and userQaId != ''">
+            and t.user_qa_id= #{userQaId}
+        </if>
 
     </update>
 
     <!-- 查询答卷数量 add by wuxw 2018-07-03 -->
-     <select id="queryUserQuestionAnswersCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from user_question_answer t 
-where 1 =1 
-<if test="score !=null and score != ''">
-   and t.score= #{score}
-</if> 
-<if test="evaluationScore !=null and evaluationScore != ''">
-   and t.evaluation_score= #{evaluationScore}
-</if> 
-<if test="objId !=null and objId != ''">
-   and t.obj_id= #{objId}
-</if> 
-<if test="userQaId !=null and userQaId != ''">
-   and t.user_qa_id= #{userQaId}
-</if> 
-<if test="personId !=null and personId != ''">
-   and t.person_id= #{personId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="state !=null and state != ''">
-   and t.state= #{state}
-</if> 
-<if test="objType !=null and objType != ''">
-   and t.obj_type= #{objType}
-</if> 
-<if test="qaId !=null and qaId != ''">
-   and t.qa_id= #{qaId}
-</if> 
+    <select id="queryUserQuestionAnswersCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        FROM
+        question_answer t
+        LEFT JOIN user_question_answer uqa ON t.qa_id = uqa.qa_id AND t.obj_type = uqa.obj_type AND t.obj_id = uqa.obj_id AND uqa.status_cd = '0'
+        LEFT JOIN t_dict td ON td.status_cd = t.qa_type AND td.table_name = 'question_answer' AND td.table_columns = 'qa_type'
+        WHERE
+        <if test="personId !=null and personId != ''">
+            (
+            uqa.person_id IS NULL
+            OR uqa.person_id = #{personId}
+            )
+        </if>
+        <if test="userQaId !=null and userQaId != ''">
+            and uqa.user_qa_id= #{userQaId}
+        </if>
+        <if test="state !=null and state != ''">
+            and uqa.state= #{state}
+        </if>
+        <if test="qaId !=null and qaId != ''">
+            and t.qa_id= #{qaId}
+        </if>
+        <if test="qaName !=null and qaName != ''">
+            and t.qa_name= #{qaName}
+        </if>
+        <if test="objType !=null and objType != ''">
+            and t.obj_type= #{objType}
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="qaTypes !=null ">
+            and t.qa_type in
+            <foreach collection="qaTypes" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

+ 33 - 4
service-user/src/main/java/com/java110/user/api/UserQuestionAnswerApi.java

@@ -1,6 +1,7 @@
 package com.java110.user.api;
 
 import com.alibaba.fastjson.JSONObject;
+import com.java110.dto.questionAnswer.QuestionAnswerDto;
 import com.java110.dto.userQuestionAnswer.UserQuestionAnswerDto;
 import com.java110.dto.userQuestionAnswerValue.UserQuestionAnswerValueDto;
 import com.java110.po.userQuestionAnswer.UserQuestionAnswerPo;
@@ -99,6 +100,29 @@ public class UserQuestionAnswerApi {
         return deleteUserQuestionAnswerBMOImpl.delete(userQuestionAnswerPo);
     }
 
+    /**
+     * 微信删除消息模板
+     *
+     * @param storeId 小区ID
+     * @return
+     * @serviceCode /userQuestionAnswer/queryUserQuestionAnswer
+     * @path /app/userQuestionAnswer/queryUserQuestionAnswer
+     */
+    @RequestMapping(value = "/queryStaffQuestionAnswer", method = RequestMethod.GET)
+    public ResponseEntity<String> queryStaffQuestionAnswer(@RequestHeader(value = "store-id") String storeId,
+                                                           @RequestHeader(value = "user-id") String userId,
+                                                           @RequestParam(value = "page") int page,
+                                                           @RequestParam(value = "row") int row) {
+        UserQuestionAnswerDto userQuestionAnswerDto = new UserQuestionAnswerDto();
+        userQuestionAnswerDto.setPage(page);
+        userQuestionAnswerDto.setRow(row);
+        userQuestionAnswerDto.setObjType(QuestionAnswerDto.QA_TYPE_STORE);
+        userQuestionAnswerDto.setObjId(storeId);
+        userQuestionAnswerDto.setPersonId(userId);
+        userQuestionAnswerDto.setQaTypes(new String[]{"2002","4004"});
+        return getUserQuestionAnswerBMOImpl.get(userQuestionAnswerDto);
+    }
+
     /**
      * 微信删除消息模板
      *
@@ -107,14 +131,19 @@ public class UserQuestionAnswerApi {
      * @serviceCode /userQuestionAnswer/queryUserQuestionAnswer
      * @path /app/userQuestionAnswer/queryUserQuestionAnswer
      */
-    @RequestMapping(value = "/queryUserQuestionAnswer", method = RequestMethod.GET)
-    public ResponseEntity<String> queryUserQuestionAnswer(@RequestParam(value = "communityId") String communityId,
-                                                          @RequestParam(value = "page") int page,
-                                                          @RequestParam(value = "row") int row) {
+    @RequestMapping(value = "/queryOwnerQuestionAnswer", method = RequestMethod.GET)
+    public ResponseEntity<String> queryOwnerQuestionAnswer(
+            @RequestHeader(value = "user-id") String userId,
+            @RequestParam(value = "communityId") String communityId,
+            @RequestParam(value = "page") int page,
+            @RequestParam(value = "row") int row) {
         UserQuestionAnswerDto userQuestionAnswerDto = new UserQuestionAnswerDto();
         userQuestionAnswerDto.setPage(page);
         userQuestionAnswerDto.setRow(row);
+        userQuestionAnswerDto.setObjType(QuestionAnswerDto.QA_TYPE_COMMUNITY);
         userQuestionAnswerDto.setObjId(communityId);
+        userQuestionAnswerDto.setPersonId(userId);
+        userQuestionAnswerDto.setQaTypes(new String[]{"1001","3003"});
         return getUserQuestionAnswerBMOImpl.get(userQuestionAnswerDto);
     }