2020-09-27

This commit is contained in:
peihaoyu 2020-09-27 15:40:41 +08:00
parent 5e44ebf4c6
commit 641fbe6b98
11 changed files with 675 additions and 30 deletions

View File

@ -1,4 +1,110 @@
package com.qinxx.hslink.controller;
import com.qinxx.hslink.service.AdminHSService;
import com.qinxx.hslink.service.HSService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
/**
* @author PHY
*/
@Controller
@RequestMapping("/admin")
public class AdminHSController {
/**
* 日志
*/
private static Logger logger = LogManager.getLogger(HSController.class);
@Resource
AdminHSService AdminhsService;
/**
* 获取待审核文章列表
* @param param
* @return
*/
@PostMapping("/getVerifyList")
@ResponseBody
public Map<String, Object> getVerifyList(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>();
result = AdminhsService.getVerifyList(param);
return result;
}
/**
* 审核文章通过/驳回
* @param param
* @return
*/
@PostMapping("/verifyArticle")
@ResponseBody
public Map<String, Object> verifyArticle(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>();
result = AdminhsService.verifyArticle(param);
return result;
}
/**
* 获取人员管理列表
* @param param
* @return
*/
@PostMapping("/getPersonnelManagement")
@ResponseBody
public Map<String, Object> getPersonnelManagement(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>();
result = AdminhsService.getPersonnelManagement(param);
return result;
}
/**
* 人员管理冻结/解冻
* @param param
* @return
*/
@PostMapping("/peopleManagement")
@ResponseBody
public Map<String, Object> peopleManagement(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>();
result = AdminhsService.peopleManagement(param);
return result;
}
/**
* 获取帮助答复列表
* @param param
* @return
*/
@PostMapping("/getHelpAnswerList")
@ResponseBody
public Map<String, Object> getHelpAnswerList(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>();
result = AdminhsService.getHelpAnswerList(param);
return result;
}
/**
* 解答帮助
* @param param
* @return
*/
@PostMapping("/answerHelp")
@ResponseBody
public Map<String, Object> answerHelp(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>();
result = AdminhsService.answerHelp(param);
return result;
}
}

View File

@ -326,6 +326,19 @@ public class HSController {
return result;
}
/**
* 获取粉丝人员列表
* @param param
* @return
*/
@PostMapping("/getFansPeopleList")
@ResponseBody
public Map<String, Object> getFansPeopleList(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>();
result = hsService.getFansPeopleList(param);
return result;
}
/**修改手机号*/
@RequestMapping(value = "/updatePhone", method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody
@ -382,6 +395,54 @@ public class HSController {
return result;
}
/**
* 收藏
* @param param
* @return
*/
@RequestMapping(value = "/addCollection", method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody
public Map<String,Object> addCollection(@RequestBody Map<String,Object> param) {
Map<String,Object> result = hsService.addCollection(param);
return result;
}
/**
* 取消收藏
* @param param
* @return
*/
@RequestMapping(value = "/cancelCollection", method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody
public Map<String,Object> cancelCollection(@RequestBody Map<String,Object> param) {
Map<String,Object> result = hsService.cancelCollection(param);
return result;
}
/**
* 获取收藏文章列表
* @param param
* @return
*/
@RequestMapping(value = "/getCollectionList", method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody
public Map<String,Object> getCollectionList(@RequestBody Map<String,Object> param) {
Map<String,Object> result = hsService.getCollectionList(param);
return result;
}
/**
* 浏览量+1
* @param param
* @return
*/
@RequestMapping(value = "/updateReadNumber", method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody
public Map<String,Object> updateReadNumber(@RequestBody Map<String,Object> param) {
Map<String,Object> result = hsService.updateReadNumber(param);
return result;
}
/**
* 测试接口
*/

View File

@ -1,4 +1,55 @@
package com.qinxx.hslink.dao;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* @author PHY
*/
@Mapper
public interface AdminHSMapper {
/**
* 获取待审核文章数据
* @param param
* @return
*/
List<Map<String, Object>> getVerifyList(Map<String, Object> param);
/**
* 获取人员管理列表
* @param param
* @return
*/
List<Map<String, Object>> getPersonnelManagement(Map<String, Object> param);
/**
* 审核文章通过/驳回
* @param param
* @return
*/
int verifyArticle(Map<String, Object> param);
/**
* 人员管理冻结/解冻
* @param param
* @return
*/
int peopleManagement(Map<String, Object> param);
/**
* 获取帮助答复列表
* @param param
* @return
*/
List<Map<String, Object>> getHelpAnswerList(Map<String, Object> param);
/**
* 解答帮助
* @param param
* @return
*/
int answerHelp(Map<String, Object> param);
}

View File

@ -219,6 +219,13 @@ public interface HSLinkMapper {
*/
List<Map<String, Object>> getFollowPeopleList(Map<String, Object> param);
/**
* 获取关注人员列表
* @param param
* @return
*/
List<Map<String, Object>> getFansPeopleList(Map<String, Object> param);
/**
* 修改手机号
* @param param
@ -259,4 +266,32 @@ public interface HSLinkMapper {
* @return
*/
int updateIntegral();
/**
* 收藏
* @param param
* @return
*/
int addCollection(Map<String, Object> param);
/**
* 取消收藏
* @param param
* @return
*/
int cancelCollection(Map<String, Object> param);
/**
* 获取收藏文章列表
* @param param
* @return
*/
List<Map<String, Object>> getCollectionList(Map<String, Object> param);
/**
* 浏览量+1
* @param param
* @return
*/
int updateReadNumber(Map<String, Object> param);
}

View File

@ -1,6 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qinxx.hslink.dao.AdminHSLinkMapper">
<mapper namespace="com.qinxx.hslink.dao.AdminHSMapper">
<!--审核文章(通过/驳回)-->
<update id="verifyArticle" parameterType="map">
UPDATE hs_notice set is_pass = #{operating} where id = #{articleId}
</update>
<!--人员管理(冻结/解冻)-->
<update id="peopleManagement" parameterType="map">
UPDATE hs_user set frozen_state = #{operating} where user_id = #{userId}
</update>
<!--解答帮助-->
<update id="answerHelp" parameterType="map">
UPDATE hs_help
SET answer_id = #{answerId},
answer = #{answer},
answer_time = now( )
WHERE
id = #{id}
</update>
<!--获取待审核文章数据-->
<select id="getVerifyList" parameterType="map" resultType="map">
SELECT
n.id articleId,
n.title title,
n.label label,
n.release_id releaseId,
n.type,
u.real_name releaseName,
n.release_time releaseTime
FROM
hs_notice n
LEFT JOIN hs_user u ON n.release_id = u.user_id
WHERE
STATUS = '1'
<if test="content != '' and content != null">
and title like CONCAT('%',#{content},'%')
</if>
AND is_pass = '0'
and type != "班级通知"
ORDER BY release_time desc
</select>
<!--获取人员管理列表-->
<select id="getPersonnelManagement" resultType="map" parameterType="map">
SELECT *,
(SELECT count(*) from hs_follow f where f.user_id = u.user_id) followNumber,
(SELECT count(*) from hs_follow f where f.follow_id = u.user_id) fansNumber
FROM hs_user u where
<if test="content != '' and content != null">
and u.real_name like CONCAT('%',#{name},'%')
</if>
u.user_type != "管理员" order by u.user_type
</select>
<!--获取帮助答复列表-->
<select id="getHelpAnswerList" resultType="map" parameterType="map">
SELECT
h.*,
u.real_name answerName,
(SELECT real_name from hs_user where user_id = h.create_id) questionName
FROM
hs_help h
LEFT JOIN hs_user u ON h.answer_id = u.user_id
ORDER BY create_time desc
</select>
</mapper>

View File

@ -10,7 +10,7 @@
<!--注册-->
<insert id="register" parameterType="map">
INSERT INTO hs_user ( user_id, pass_word,real_name, mobile, user_type, create_time, frozen_state, error_times)
INSERT INTO hs_user ( user_id, pass_word,real_name, mobile, user_type, create_time)
VALUES
(
uuid(),
@ -18,9 +18,7 @@
#{realname},
#{mobile},
#{type},
now(),
'00',
'0'
now()
)
</insert>
@ -37,7 +35,7 @@
FROM
hs_notice s left join hs_user u on s.release_id = u.user_id
where type = '校园通知'
and status = "1"
and status = "1" and is_pass = "1"
<if test="id != null and id != ''">
and s.id = #{id}
</if>
@ -60,7 +58,7 @@
FROM
hs_notice p left join hs_user u on p.release_id = u.user_id
where type = '家长建议'
and status = "1"
and status = "1" and is_pass = "1"
<if test="id != null and id != ''">
and p.id = #{id}
</if>
@ -83,7 +81,7 @@
FROM
hs_notice s left join hs_user u on s.release_id = u.user_id
where type = '学生想法'
and status = "1"
and status = "1" and is_pass = "1"
<if test="id != null and id != ''">
and s.id = #{id}
</if>
@ -104,7 +102,11 @@
title,
content,
integral,
'' header_photo
'' header_photo,
read_number,
case when (select count(*) from hs_collection where user_id = #{userId} and article_id = #{id}) > 0
then 1 else 0 end isCollection,
is_pass
from hs_notice n left join hs_user u on n.release_id = u.user_id
where id = #{id}
</select>
@ -133,10 +135,15 @@
u.integral,
'' header_photo,
signature,
type
status,
type,
is_pass
FROM
hs_notice s left join hs_user u on s.release_id = u.user_id
where status = "1"
<if test="isPass == null and isPass == ''">
and is_pass = "1"
</if>
<if test="releaseId != null and releaseId != ''">
and release_id = #{releaseId}
</if>
@ -196,6 +203,7 @@
select * from hs_notice left join hs_user on release_id = user_id
where hs_notice.class_name = (select class_name from hs_user
where user_id = #{id})
and status = "1" and is_pass = "1"
<if test="text != null and text != ''">
and (label like CONCAT('%',#{text},'%')
or title like CONCAT('%',#{text},'%')
@ -229,8 +237,8 @@
<!--修改一条数据具体内容-->
<update id="updateOneContent" parameterType="map">
update hs_notice set label = #{label},title = #{title},content = #{content}, release_time = now() where id =
#{id}
update hs_notice set label = #{label},title = #{title},content = #{content}, release_time = now(), is_pass = "0"
where id = #{id}
</update>
<!--删除一条数据-->
@ -253,8 +261,9 @@
FROM
hs_private_letter
WHERE
receive_id = '201610060129' and already_read = "0" and receive_status = "1") letter_number,
(SELECT count(*) from hs_follow where user_id = #{userId} and follow_id = #{releaseId}) isFollow,
receive_id = #{releaseId} and already_read = "0" and receive_status = "1") letter_number,
(case when (SELECT count(*) from hs_follow where user_id = #{userId} and follow_id = #{releaseId}) > 0
then 1 else 0 end ) isFollow,
(SELECT count(*) from hs_follow where user_id = #{releaseId}) followNumber,
(SELECT count(*) from hs_follow where follow_id = #{releaseId}) fansNumber
FROM
@ -324,7 +333,7 @@
<update id="updateIntegral">
UPDATE hs_user u
SET integral = (
( ( SELECT count( * ) FROM hs_notice WHERE release_id = u.user_id ) * 100 ) +
( ( SELECT count( * ) FROM hs_notice WHERE release_id = u.user_id and status = "1" and is_pass = "1") * 100 ) +
( ( SELECT count( * ) FROM hs_leave_message WHERE messager_id = u.user_id ) * 10 )
)
</update>
@ -338,13 +347,18 @@
<update id="updateOneIntegral" parameterType="map">
UPDATE hs_user
SET integral = (
( ( SELECT count( * ) FROM hs_notice WHERE release_id = #{userId} ) * 100 ) +
( ( SELECT count( * ) FROM hs_notice WHERE release_id = #{userId} and status = "1" and is_pass = "1") * 100 ) +
( ( SELECT count( * ) FROM hs_leave_message WHERE messager_id = #{userId} ) * 10 )
)
WHERE
user_id = #{userId}
</update>
<!--浏览量+1-->
<update id="updateReadNumber" parameterType="map">
update hs_notice set read_number = #{number} where id = #{noticeId}
</update>
<!--取消关注-->
<delete id="cancelFollow" parameterType="map">
DELETE
@ -355,6 +369,10 @@
AND follow_id = #{followId}
</delete>
<delete id="cancelCollection" parameterType="map">
delete from hs_collection where user_id = #{userId} and article_id = #{noticeId}
</delete>
<!--获取已发送私信-->
<select id="getSentPrivateLetter" resultType="map" parameterType="map">
select * from hs_private_letter left join hs_user on send_id = user_id where send_id = #{userId} and send_status = "1"
@ -385,6 +403,11 @@
VALUES (uuid(),#{userId},now(),#{question})
</insert>
<!--收藏-->
<insert id="addCollection" parameterType="map">
insert into hs_collection (id, user_id, article_id, create_time) value (uuid(), #{userId}, #{noticeId}, now())
</insert>
<!--获取文件信息-->
<select id="getFileList" resultType="java.util.Map">
select
@ -418,7 +441,7 @@
<!--获取私信其他人信息-->
<select id="getLetterOtherInfo" resultType="map" parameterType="map">
select * from hs_user where user_id in (SELECT
select * from hs_user where user_id in (SELECT
DISTINCT
receive_id id
FROM
@ -450,10 +473,10 @@
letter_create_time
</select>
<!--获取关注列表-->
<!--获取关注列表文章-->
<select id="getFollowList" resultType="map" parameterType="map">
SELECT
p.id,
n.id,
label,
title,
type,
@ -462,11 +485,11 @@
real_name,
release_time
FROM
hs_notice p
LEFT JOIN hs_user u ON p.release_id = u.user_id
hs_notice n
LEFT JOIN hs_user u ON n.release_id = u.user_id
WHERE
release_id IN ( SELECT follow_id FROM hs_follow WHERE user_id = #{userId} )
AND STATUS = "1"
AND STATUS = "1" and is_pass = "1"
ORDER BY
release_time DESC
</select>
@ -474,11 +497,25 @@
<!--获取关注列表-->
<select id="getFollowPeopleList" resultType="map" parameterType="map">
SELECT
*
*,
(SELECT count(*) from hs_follow f where f.user_id = u.user_id) followNumber,
(SELECT count(*) from hs_follow f where f.follow_id = u.user_id) fansNumber
FROM
hs_user
hs_user u
WHERE
user_id IN ( SELECT follow_id FROM hs_follow WHERE user_id = #{userId} )
u.user_id IN ( SELECT follow_id FROM hs_follow f WHERE f.user_id = #{userId} )
</select>
<!--获取粉丝列表-->
<select id="getFansPeopleList" resultType="map" parameterType="map">
SELECT
*,
(SELECT count(*) from hs_follow f where f.user_id = u.user_id) followNumber,
(SELECT count(*) from hs_follow f where f.follow_id = u.user_id) fansNumber
FROM
hs_user u
WHERE
u.user_id IN ( SELECT user_id FROM hs_follow f WHERE f.follow_id = #{userId} )
</select>
<!--获取字典项数据-->
@ -488,7 +525,30 @@
<!--获取帮助历史提问-->
<select id="getHistoryHelpList" resultType="map" parameterType="map">
SELECT h.*,u.real_name from hs_help h left join hs_user u on h.answer_id = u.user_id where create_id = #{userId}
SELECT h.*,u.real_name from hs_help h left join hs_user u on h.answer_id = u.user_id
where create_id = #{userId}
</select>
<!--获取收藏文章列表-->
<select id="getCollectionList" resultType="map" parameterType="map">
SELECT
p.id,
label,
title,
type,
content,
u.user_id,
real_name,
release_time
FROM
hs_notice p
LEFT JOIN hs_user u ON p.release_id = u.user_id
left join hs_collection c on p.id = c.article_id
WHERE
c.user_id = #{userId}
AND STATUS = "1" and is_pass ="1"
ORDER BY
release_time DESC
</select>
</mapper>

View File

@ -1,4 +1,51 @@
package com.qinxx.hslink.service;
import java.util.Map;
/**
* @author PHY
*/
public interface AdminHSService {
/**
* 获取待审核列表
* @param param
* @return
*/
Map<String, Object> getVerifyList(Map<String, Object> param);
/**
* 获取人员管理列表
* @param param
* @return
*/
Map<String, Object> getPersonnelManagement(Map<String, Object> param);
/**
* 审核文章通过/驳回
* @param param
* @return
*/
Map<String, Object> verifyArticle(Map<String, Object> param);
/**
* 人员管理冻结/解冻
* @param param
* @return
*/
Map<String, Object> peopleManagement(Map<String, Object> param);
/**
* 获取帮助答复列表
* @param param
* @return
*/
Map<String, Object> getHelpAnswerList(Map<String, Object> param);
/**
* 解答帮助
* @param param
* @return
*/
Map<String, Object> answerHelp(Map<String, Object> param);
}

View File

@ -184,6 +184,13 @@ public interface HSService {
*/
Map<String, Object> getFollowPeopleList(Map<String, Object> param);
/**
* 获取粉丝人员列表
* @param param
* @return
*/
Map<String, Object> getFansPeopleList(Map<String, Object> param);
/**
* 修改手机号
* @param param
@ -223,4 +230,32 @@ public interface HSService {
* 定时任务更新积分
*/
Map<String,Object> updateIntegral();
/**
* 收藏
* @param param
* @return
*/
Map<String, Object> addCollection(Map<String, Object> param);
/**
* 取消收藏
* @param param
* @return
*/
Map<String, Object> cancelCollection(Map<String, Object> param);
/**
* 获取收藏列表
* @param param
* @return
*/
Map<String, Object> getCollectionList(Map<String, Object> param);
/**
* 浏览量+1
* @param param
* @return
*/
Map<String, Object> updateReadNumber(Map<String, Object> param);
}

View File

@ -1,9 +1,129 @@
package com.qinxx.hslink.service.impl;
import com.qinxx.hslink.dao.AdminHSMapper;
import com.qinxx.hslink.dao.HSLinkMapper;
import com.qinxx.hslink.service.AdminHSService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author PHY
*/
@Service
public class AdminHSServiceImpl implements AdminHSService {
/**
* 日志
*/
private static Logger logger = LogManager.getLogger(HSServiceImpl.class);
@Resource
AdminHSMapper adminHSMapper;
/**
* 获取待审核文章数据
* @param param
* @return
*/
@Override
public Map<String, Object> getVerifyList(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>();
List<Map<String, Object>> res = adminHSMapper.getVerifyList(param);
result.put("data",res);
result.put("success",true);
return result;
}
/**
* 获取人员管理列表
* @param param
* @return
*/
@Override
public Map<String, Object> getPersonnelManagement(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>();
List<Map<String, Object>> res = adminHSMapper.getPersonnelManagement(param);
result.put("data",res);
result.put("success",true);
return result;
}
/**
* 审核文章通过/驳回
* @param param
* @return
*/
@Override
public Map<String, Object> verifyArticle(Map<String, Object> param) {
int res = 0;
Map<String, Object> result = new HashMap<>();
try {
res = adminHSMapper.verifyArticle(param);
} catch (Exception e) {
e.printStackTrace();
res = 0;
}
result.put("data",res);
result.put("success",true);
return result;
}
/**
* 人员管理冻结/解冻
* @param param
* @return
*/
@Override
public Map<String, Object> peopleManagement(Map<String, Object> param) {
int res = 0;
Map<String, Object> result = new HashMap<>();
try {
res = adminHSMapper.peopleManagement(param);
} catch (Exception e) {
e.printStackTrace();
res = 0;
}
result.put("data",res);
result.put("success",true);
return result;
}
/**
* 获取帮助答复列表
* @param param
* @return
*/
@Override
public Map<String, Object> getHelpAnswerList(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>();
List<Map<String, Object>> res = adminHSMapper.getHelpAnswerList(param);
result.put("data",res);
result.put("success",true);
return result;
}
/**
* 解答帮助
* @param param
* @return
*/
@Override
public Map<String, Object> answerHelp(Map<String, Object> param) {
int res = 0;
Map<String, Object> result = new HashMap<>();
try {
res = adminHSMapper.answerHelp(param);
} catch (Exception e) {
e.printStackTrace();
res = 0;
}
result.put("data",res);
result.put("success",true);
return result;
}
}

View File

@ -562,6 +562,15 @@ public class HSServiceImpl implements HSService {
return result;
}
@Override
public Map<String, Object> getFansPeopleList(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>();
List<Map<String, Object>> res = hsLinkMapper.getFansPeopleList(param);
result.put("data",res);
result.put("success",true);
return result;
}
@Override
public Map<String, Object> updatePhone(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>();
@ -637,6 +646,60 @@ public class HSServiceImpl implements HSService {
return result;
}
@Override
public Map<String, Object> addCollection(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>();
int res = 0;
try {
res = hsLinkMapper.addCollection(param);
} catch (Exception e) {
e.printStackTrace();
res = 0;
}
result.put("data",res);
result.put("success",true);
return result;
}
@Override
public Map<String, Object> cancelCollection(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>();
int res = 0;
try {
res = hsLinkMapper.cancelCollection(param);
} catch (Exception e) {
e.printStackTrace();
res = 0;
}
result.put("data",res);
result.put("success",true);
return result;
}
@Override
public Map<String, Object> getCollectionList(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>();
List<Map<String, Object>> res = hsLinkMapper.getCollectionList(param);
result.put("data",res);
result.put("success",true);
return result;
}
@Override
public Map<String, Object> updateReadNumber(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>();
int res = 0;
try {
res = hsLinkMapper.updateReadNumber(param);
} catch (Exception e) {
e.printStackTrace();
res = 0;
}
result.put("data",res);
result.put("success",true);
return result;
}
/**
* 返回参数
* @param flag

View File

@ -2,6 +2,8 @@ package com.qinxx.hslink.util;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @author 帅气的布里茨
@ -12,9 +14,8 @@ public class TestClass {
* 主线程
*/
public static void main(String[] args) {
final int num = 10;
for (int i = 0; i < num; i++) {
System.out.println(i);
}
Map<String,Object> map = new HashMap<>();
map.put("name","张氏");
System.out.println(map.get("sex"));
}
}