zwq 2 жил өмнө
parent
commit
fe5fee863a

+ 67 - 41
nngkxxdp/src/main/java/com/example/nngkxxdp/controller/RectificationController.java

@@ -31,30 +31,7 @@ public class RectificationController {
         if (Blank.isEmpty(id)) {
             return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS);
         }
-        return rectificationService.info(id);
-    }
-
-    @PostMapping("/front/submit")
-    public Map<String, Object> submit(RectificationDO rectificationDO, MultipartFile[] files, HttpSession session) throws IOException {
-        String[] o = {"captcha", "errorUrl", "equipment", "mail", "phone", "submitter", "questionDescription", "questionType", "uniqueCode"};
-        if (!Blank.checkObjectParamNotNull(rectificationDO, o)) {
-            return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS);
-        }
-        if (!Blank.isNotEmpty(files)) {
-            return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS);
-        }
-        if (!rectificationDO.getUniqueCode().equals(ConstStr.UNIQUE_CODE)) {
-            return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS);
-        }
-        String captcha = (String) session.getAttribute("captcha");
-        if (Blank.isNotEmpty(captcha)) {
-            if (!captcha.equalsIgnoreCase(rectificationDO.getCaptcha())) {
-                return SendUtil.send(false, "验证码错误");
-            }
-        } else {
-            return SendUtil.send(false, "验证码为空");
-        }
-        return rectificationService.add(rectificationDO, files);
+        return rectificationService.info(id, null, null);
     }
 
     @GetMapping("/list")
@@ -109,6 +86,32 @@ public class RectificationController {
     }
 
     /**
+     * description: 受理问题
+     *
+     * @param id 主键
+     * @return java.util.Map<java.lang.String, java.lang.Object>
+     * @author zwq
+     * @date 2023/1/30 16:19
+     */
+    @PostMapping("/work")
+    public Map<String, Object> work(@RequestBody String id) {
+        return rectificationService.work(id);
+    }
+
+    /**
+     * description: 办结问题
+     *
+     * @param id 主键
+     * @return java.util.Map<java.lang.String, java.lang.Object>
+     * @author zwq
+     * @date 2023/1/30 16:19
+     */
+    @PostMapping("/finish")
+    public Map<String, Object> finish(@RequestBody String id) {
+        return rectificationService.finish(id);
+    }
+
+    /**
      * description: 前台分页
      *
      * @param page    分页参数
@@ -128,28 +131,51 @@ public class RectificationController {
     }
 
     /**
-     * description: 受理问题
-     *
-     * @param id 主键
-     * @return java.util.Map<java.lang.String, java.lang.Object>
+     * description: 查询单条数据
      * @author zwq
-     * @date 2023/1/30 16:19
+     * @date 2023/1/31 14:29
+     * @param code 编号
+     * @param phone 电话
+     * @return java.util.Map<java.lang.String,java.lang.Object>
      */
-    @PostMapping("/work")
-    public Map<String, Object> work(@RequestBody String id) {
-        return rectificationService.work(id);
+    @GetMapping("/front/search")
+    public Map<String, Object> search(String code, String phone) {
+        if (Blank.isEmpty(code, phone)) {
+            return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS);
+        }
+        return rectificationService.info(null, code, phone);
     }
 
     /**
-     * description: 办结问题
-     *
-     * @param id 主键
-     * @return java.util.Map<java.lang.String, java.lang.Object>
-     * @author zwq
-     * @date 2023/1/30 16:19
+     * description: 前台提交问题
+     * @author wrh
+     * @date 2023/1/31 14:31
+     * @param rectificationDO 数据
+     * @param files 截图文件
+     * @param session session
+     * @return java.util.Map<java.lang.String,java.lang.Object>
      */
-    @PostMapping("/finish")
-    public Map<String, Object> finish(@RequestBody String id) {
-        return rectificationService.finish(id);
+    @PostMapping("/front/submit")
+    public Map<String, Object> submit(RectificationDO rectificationDO, MultipartFile[] files, HttpSession session) throws IOException {
+        String[] o = {"captcha", "errorUrl", "equipment", "mail", "phone", "submitter", "questionDescription", "questionType", "uniqueCode"};
+        if (!Blank.checkObjectParamNotNull(rectificationDO, o)) {
+            return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS);
+        }
+        if (!Blank.isNotEmpty(files)) {
+            return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS);
+        }
+        if (!rectificationDO.getUniqueCode().equals(ConstStr.UNIQUE_CODE)) {
+            return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS);
+        }
+        String captcha = (String) session.getAttribute("captcha");
+        if (Blank.isNotEmpty(captcha)) {
+            if (!captcha.equalsIgnoreCase(rectificationDO.getCaptcha())) {
+                return SendUtil.send(false, "验证码错误");
+            }
+        } else {
+            return SendUtil.send(false, "验证码为空");
+        }
+        return rectificationService.add(rectificationDO, files);
     }
+
 }

+ 1 - 1
nngkxxdp/src/main/java/com/example/nngkxxdp/dao/RectificationDao.java

@@ -19,7 +19,7 @@ public interface RectificationDao {
 
     RectificationDO queryById(@Param("id") String id);
 
-    RectificationVO info(@Param("id") String id);
+    RectificationVO info(@Param("id") String id, @Param("code") String code, @Param("phone") String phone);
 
     /**
      * description: 分页计数

+ 6 - 5
nngkxxdp/src/main/java/com/example/nngkxxdp/service/RectificationService.java

@@ -15,14 +15,15 @@ import java.util.Map;
 public interface RectificationService {
 
     /**
-     * description: 详情
-     *
+     * description: 查询单个数据
      * @author zwq
-     * @date 2023/01/30 10:44
+     * @date 2023/1/31 14:27
      * @param id 主键
-     * return java.util.Map<java.lang.String,java.lang.Object> 数据
+     * @param code 编号
+     * @param phone 电话
+     * @return java.util.Map<java.lang.String,java.lang.Object>
      */
-    Map<String, Object> info(String id);
+    Map<String, Object> info(String id, String code, String phone);
     
     /**
      * description: 列表

+ 8 - 7
nngkxxdp/src/main/java/com/example/nngkxxdp/service/impl/RectificationServiceImpl.java

@@ -38,16 +38,17 @@ public class RectificationServiceImpl implements RectificationService {
     private String location;
 
     /**
-     * description: 详情
-     *
-     * @param id 主键
-     *           return java.util.Map<java.lang.String,java.lang.Object> 数据
+     * description: 查询单个数据
      * @author zwq
-     * @date 2023/01/30 10:44
+     * @date 2023/1/31 14:27
+     * @param id 主键
+     * @param code 编号
+     * @param phone 电话
+     * @return java.util.Map<java.lang.String,java.lang.Object>
      */
     @Override
-    public Map<String, Object> info(String id) {
-        RectificationVO rectificationVO = rectificationDao.info(id);
+    public Map<String, Object> info(String id, String code, String phone) {
+        RectificationVO rectificationVO = rectificationDao.info(id, code, phone);
         return SendUtil.send(true, ConstStr.RESULT_SUCCESS, rectificationVO);
     }
 

+ 12 - 1
nngkxxdp/src/main/resources/mapper/RectificationDao.xml

@@ -53,7 +53,18 @@
         SELECT
           id, code, question_type, error_url, picture, question_description, status, submitter, mail, phone, equipment, create_time, update_time, finish_time, isdel
         FROM rectification
-        WHERE id = #{id}
+        <where>
+            rectification.isdel = 0
+            <if test="id != null and id != ''">
+                AND id = #{id}
+            </if>
+            <if test="code != null and code != ''">
+                AND code = #{code}
+            </if>
+            <if test="phone != null and phone != ''">
+                AND phone = #{phone}
+            </if>
+        </where>
     </select>
 
     <!--分页计数-->