瀏覽代碼

Merge branch 'master' of http://116.63.33.55/git/nazw

elis 2 年之前
父節點
當前提交
b68126529d

+ 5 - 3
nngkxxdp/src/main/java/com/example/nngkxxdp/controller/ArticleController.java

@@ -161,14 +161,16 @@ public class ArticleController {
      * @param chnlid      栏目id
      * @param docTitle    栏目标题
      * @param docrelTime  发布时间
-     * @param channelName
+     * @param channelName 栏目名称
+     * @param docpubUrl   文章链接
+     * @param deptid      部门id
      * @return
      */
     @GetMapping("/getHlwAllDataPage")
-    public Map<String, Object> getHlwAllData(int page, int limit, String chnlid, String docTitle, String docrelTime, String channelName, String docpubUrl) {
+    public Map<String, Object> getHlwAllData(int page, int limit, String chnlid, String docTitle, String docrelTime, String channelName, String docpubUrl, Integer deptid) {
         try {
             if (Blank.isNotEmpty(page) && Blank.isNotEmpty(limit) && page > 0 && limit > 0) {
-                return articleService.getHlwAllDataPage(page, limit, chnlid, docTitle, docrelTime, channelName, docpubUrl);
+                return articleService.getHlwAllDataPage(page, limit, chnlid, docTitle, docrelTime, channelName, docpubUrl, deptid);
             }
             return SendUtil.send(true, null, "page和limit不能为空,且要大于0");
         } catch (Exception e) {

+ 17 - 12
nngkxxdp/src/main/java/com/example/nngkxxdp/controller/CanteenController.java

@@ -1,5 +1,6 @@
 package com.example.nngkxxdp.controller;
 
+import cn.hutool.core.lang.Validator;
 import com.example.nngkxxdp.entity.CanteenDO;
 import com.example.nngkxxdp.service.CanteenService;
 import com.example.nngkxxdp.util.Blank;
@@ -46,25 +47,29 @@ public class CanteenController {
      * description: 新增
      * @author zwq
      * @date 2022/9/2 15:51
-     * @param canteenName 食堂名称
-     * @param founder 创建人
-     * @param supplyTimeId 时间节点
+     * @param canteen 食堂
      * @param files 文件
      * @return java.util.Map<java.lang.String,java.lang.Object>
      */
     @PostMapping("/add")
-    public Map<String,Object> add(String canteenName, Integer founder, String supplyTimeId, MultipartFile[] files) throws IOException {
-        if (Blank.isEmpty(canteenName, founder)) {
+    public Map<String,Object> add(CanteenDO canteen, MultipartFile[] files) throws IOException {
+        if (Blank.isEmpty(canteen.getCanteenName(), canteen.getFounder(), canteen.getComplaintPhone(),
+                canteen.getPrincipal())) {
             return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS);
         }
-        if (canteenName.length() > 64) {
-            return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS, "名称最长为64字符");
+        if (canteen.getCanteenName().length() > 64) {
+            return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS, "食堂名称最长为64字符");
         }
-        CanteenDO canteenDO = new CanteenDO();
-        canteenDO.setCanteenName(canteenName);
-        canteenDO.setFounder(founder);
-        canteenDO.setSupplyTimeId(supplyTimeId);
-        return canteenService.add(canteenDO, files);
+        if (canteen.getPrincipal().length() > 32) {
+            return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS, "负责人名称最长为32字符");
+        }
+        if (!Validator.isMobile(canteen.getComplaintPhone())) {
+            return SendUtil.send(false, ConstStr.ADD_FAILED, "投诉电话格式不正确,请填入移动电话号码");
+        }
+        if (canteen.getTakeoutPhone() != null && !Validator.isMobile(canteen.getTakeoutPhone())) {
+            return SendUtil.send(false, ConstStr.ADD_FAILED, "外卖电话格式不正确,请填入移动电话号码");
+        }
+        return canteenService.add(canteen, files);
     }
 
     /**

+ 3 - 3
nngkxxdp/src/main/java/com/example/nngkxxdp/dao/HlwInterfaceDao.java

@@ -109,7 +109,7 @@ public interface HlwInterfaceDao {
     /**
      * 根据chnlid集合查询每个栏目的最新一篇文章的URL
      *
-     * @param asList
+     * @param list
      * @return
      */
     List<String> getLastArticleUrlByChnlids(@Param("list") List<String> list);
@@ -135,9 +135,9 @@ public interface HlwInterfaceDao {
      */
     List<Map<String, Object>> getDeptList(@Param("newChnlids") List<String> newChnlids, @Param("firstDay1") Date firstDay1, @Param("lastDay") Date lastDay);
 
-    int getHlwAllDataCount(String chnlid, String docTitle, String docrelTime, String channelName, String docpubUrl);
+    int getHlwAllDataCount(String chnlid, String docTitle, String docrelTime, String channelName, String docpubUrl, @Param("chnilds") List<Integer> chnilds);
 
-    List<Map<String, Object>> getHlwAllDataPage(int startRows, int rows, String chnlid, String docTitle, String docrelTime, String channelName, String docpubUrl);
+    List<Map<String, Object>> getHlwAllDataPage(int startRows, int rows, String chnlid, String docTitle, String docrelTime, String channelName, String docpubUrl, @Param("chnilds") List<Integer> chnilds);
 
     /**
      * 根据id获取对应规则的最大分数

+ 15 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/entity/CanteenDO.java

@@ -40,6 +40,21 @@ public class CanteenDO implements Serializable {
     * 创建人id
     */
     private Integer founder;
+
+    /**
+     * 负责人
+     */
+    private String principal;
+
+    /**
+     * 投诉电话
+     */
+    private String complaintPhone;
+
+    /**
+     * 外卖电话
+     */
+    private String takeoutPhone;
     
     /**
     * 创建时间

+ 4 - 2
nngkxxdp/src/main/java/com/example/nngkxxdp/service/ArticleService.java

@@ -186,10 +186,12 @@ public interface ArticleService {
      * @param chnlid      栏目id
      * @param docTitle    栏目标题
      * @param docrelTime  发布时间
-     * @param channelName
+     * @param channelName 栏目名称
+     * @param docpubUrl   文章链接
+     * @param deptid      部门id
      * @return
      */
-    Map<String, Object> getHlwAllDataPage(int page, int limit, String chnlid, String docTitle, String docrelTime, String channelName, String docpubUrl);
+    Map<String, Object> getHlwAllDataPage(int page, int limit, String chnlid, String docTitle, String docrelTime, String channelName, String docpubUrl, Integer deptid);
 
     /**
      * 获取区县公众号信息

+ 4 - 3
nngkxxdp/src/main/java/com/example/nngkxxdp/service/impl/ArticleServiceImpl.java

@@ -764,11 +764,12 @@ public class ArticleServiceImpl implements ArticleService {
     }
 
     @Override
-    public Map<String, Object> getHlwAllDataPage(int page, int limit, String chnlid, String docTitle, String docrelTime, String channelName, String docpubUrl) {
+    public Map<String, Object> getHlwAllDataPage(int page, int limit, String chnlid, String docTitle, String docrelTime, String channelName, String docpubUrl, Integer deptid) {
         int startRows = (page - 1) * limit;
-        int count = hlwInterfaceDao.getHlwAllDataCount(chnlid, docTitle, docrelTime, channelName, docpubUrl);
+        List<Integer> chnlidList = hlwInterfaceDao.getChnlidsByDeptid(deptid);
+        int count = hlwInterfaceDao.getHlwAllDataCount(chnlid, docTitle, docrelTime, channelName, docpubUrl, chnlidList);
         if (count > 0) {
-            return SendUtil.layuiTable(count, hlwInterfaceDao.getHlwAllDataPage(startRows, limit, chnlid, docTitle, docrelTime, channelName, docpubUrl));
+            return SendUtil.layuiTable(count, hlwInterfaceDao.getHlwAllDataPage(startRows, limit, chnlid, docTitle, docrelTime, channelName, docpubUrl, chnlidList));
         }
         return SendUtil.layuiTable(0, null);
     }

+ 23 - 6
nngkxxdp/src/main/resources/mapper/CanteenDao.xml

@@ -2,21 +2,25 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.example.nngkxxdp.dao.CanteenDao">
 
-    <resultMap type="com.example.nngkxxdp.entity.CanteenDO" id="SCanteenMap">
+    <resultMap type="com.example.nngkxxdp.entity.CanteenDO" id="CanteenMap">
         <result property="id" column="id" jdbcType="VARCHAR"/>
         <result property="canteenName" column="canteen_name" jdbcType="VARCHAR"/>
         <result property="canteenPhotoPath" column="canteen_photo_path" jdbcType="VARCHAR"/>
         <result property="supplyTimeId" column="supply_time_id" jdbcType="VARCHAR"/>
         <result property="founder" column="founder" jdbcType="INTEGER"/>
+        <result property="principal" column="principal" jdbcType="VARCHAR"/>
+        <result property="complaintPhone" column="complaint_phone" jdbcType="VARCHAR"/>
+        <result property="takeoutPhone" column="takeout_phone" jdbcType="VARCHAR"/>
         <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
         <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
         <result property="isdel" column="isdel" jdbcType="INTEGER"/>
     </resultMap>
 
     <!--查询单个-->
-    <select id="queryById" resultMap="SCanteenMap">
+    <select id="queryById" resultMap="CanteenMap">
         SELECT
-          id, canteen_name, canteen_photo_path, supply_time_id, founder, create_time, update_time, isdel
+          id, canteen_name, canteen_photo_path, supply_time_id, founder, principal, complaint_phone, takeout_phone,
+          create_time, update_time, isdel
         FROM s_canteen
         WHERE id = #{id}
     </select>
@@ -36,7 +40,9 @@
     <!--分页列表-->
     <select id="pageList" resultType="java.util.Map">
         SELECT
-          s_canteen.id, canteen_name, canteen_photo_path, supply_time_id, u.user_name founder, s_canteen.create_time, s_canteen.update_time, s_canteen.isdel
+          s_canteen.id, canteen_name, canteen_photo_path, supply_time_id, u.user_name founder, s_canteen.principal,
+          complaint_phone complaintPhone, takeout_phone takeoutPhone, s_canteen.create_time, s_canteen.update_time,
+          s_canteen.isdel
         FROM s_canteen
         LEFT JOIN p_user u
         ON u.id = s_canteen.founder
@@ -52,8 +58,10 @@
 
     <!--新增所有列-->
     <insert id="addSCanteen">
-        INSERT INTO s_canteen(id, canteen_name, canteen_photo_path, supply_time_id, founder, create_time, update_time, isdel)
-        VALUES (#{id}, #{canteenName}, #{canteenPhotoPath}, #{supplyTimeId}, #{founder}, #{createTime}, #{updateTime}, #{isdel})
+        INSERT INTO s_canteen(id, canteen_name, canteen_photo_path, supply_time_id, founder, principal,
+        complaint_phone, takeout_phone, create_time, update_time, isdel)
+        VALUES (#{id}, #{canteenName}, #{canteenPhotoPath}, #{supplyTimeId}, #{founder}, #{principal}, #{createTime},
+        #{complaintPhone}, #{takeoutPhone}, #{updateTime}, #{isdel})
     </insert>
 
     <!--通过主键修改数据-->
@@ -68,6 +76,15 @@
             <if test="founder != null">
                 founder = #{founder},
             </if>
+            <if test="principal != null">
+                principal = #{principal},
+            </if>
+            <if test="complaintPhone != null">
+                complaint_phone = #{complaintPhone},
+            </if>
+            <if test="takeoutPhone != null">
+                takeout_phone = #{takeoutPhone},
+            </if>
             <if test="createTime != null">
                 create_time = #{createTime},
             </if>

+ 12 - 0
nngkxxdp/src/main/resources/mapper/HlwInterfaceDao.xml

@@ -374,6 +374,12 @@
             <if test="docpubUrl != null">
                 AND DOCPUBURL LIKE CONCAT('%', #{docpubUrl}, '%')
             </if>
+            <if test="chnilds != null">
+                and CHNLID in
+                <foreach collection="chnilds" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
         </where>
     </select>
 
@@ -397,6 +403,12 @@
             <if test="docpubUrl != null">
                 AND DOCPUBURL LIKE CONCAT('%', #{docpubUrl}, '%')
             </if>
+            <if test="chnilds != null">
+                and CHNLID in
+                <foreach collection="chnilds" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
         </where>
         order by
         DOCRELTIME DESC