diff --git a/HSLink-back/src/main/java/com/qinxx/hslink/controller/AdminHSController.java b/HSLink-back/src/main/java/com/qinxx/hslink/controller/AdminHSController.java index 91177ad..8f96a85 100644 --- a/HSLink-back/src/main/java/com/qinxx/hslink/controller/AdminHSController.java +++ b/HSLink-back/src/main/java/com/qinxx/hslink/controller/AdminHSController.java @@ -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 getVerifyList(@RequestBody Map param){ + Map result = new HashMap<>(); + result = AdminhsService.getVerifyList(param); + return result; + } + + /** + * 审核文章(通过/驳回) + * @param param + * @return + */ + @PostMapping("/verifyArticle") + @ResponseBody + public Map verifyArticle(@RequestBody Map param){ + Map result = new HashMap<>(); + result = AdminhsService.verifyArticle(param); + return result; + } + + /** + * 获取人员管理列表 + * @param param + * @return + */ + @PostMapping("/getPersonnelManagement") + @ResponseBody + public Map getPersonnelManagement(@RequestBody Map param){ + Map result = new HashMap<>(); + result = AdminhsService.getPersonnelManagement(param); + return result; + } + + /** + * 人员管理(冻结/解冻) + * @param param + * @return + */ + @PostMapping("/peopleManagement") + @ResponseBody + public Map peopleManagement(@RequestBody Map param){ + Map result = new HashMap<>(); + result = AdminhsService.peopleManagement(param); + return result; + } + + /** + * 获取帮助答复列表 + * @param param + * @return + */ + @PostMapping("/getHelpAnswerList") + @ResponseBody + public Map getHelpAnswerList(@RequestBody Map param){ + Map result = new HashMap<>(); + result = AdminhsService.getHelpAnswerList(param); + return result; + } + + /** + * 解答帮助 + * @param param + * @return + */ + @PostMapping("/answerHelp") + @ResponseBody + public Map answerHelp(@RequestBody Map param){ + Map result = new HashMap<>(); + result = AdminhsService.answerHelp(param); + return result; + } + } diff --git a/HSLink-back/src/main/java/com/qinxx/hslink/controller/HSController.java b/HSLink-back/src/main/java/com/qinxx/hslink/controller/HSController.java index eb4ca03..959fd79 100644 --- a/HSLink-back/src/main/java/com/qinxx/hslink/controller/HSController.java +++ b/HSLink-back/src/main/java/com/qinxx/hslink/controller/HSController.java @@ -326,6 +326,19 @@ public class HSController { return result; } + /** + * 获取粉丝人员列表 + * @param param + * @return + */ + @PostMapping("/getFansPeopleList") + @ResponseBody + public Map getFansPeopleList(@RequestBody Map param){ + Map 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 addCollection(@RequestBody Map param) { + Map result = hsService.addCollection(param); + return result; + } + + /** + * 取消收藏 + * @param param + * @return + */ + @RequestMapping(value = "/cancelCollection", method = {RequestMethod.POST,RequestMethod.GET}) + @ResponseBody + public Map cancelCollection(@RequestBody Map param) { + Map result = hsService.cancelCollection(param); + return result; + } + + /** + * 获取收藏文章列表 + * @param param + * @return + */ + @RequestMapping(value = "/getCollectionList", method = {RequestMethod.POST,RequestMethod.GET}) + @ResponseBody + public Map getCollectionList(@RequestBody Map param) { + Map result = hsService.getCollectionList(param); + return result; + } + + /** + * 浏览量+1 + * @param param + * @return + */ + @RequestMapping(value = "/updateReadNumber", method = {RequestMethod.POST,RequestMethod.GET}) + @ResponseBody + public Map updateReadNumber(@RequestBody Map param) { + Map result = hsService.updateReadNumber(param); + return result; + } + /** * 测试接口 */ diff --git a/HSLink-back/src/main/java/com/qinxx/hslink/dao/AdminHSMapper.java b/HSLink-back/src/main/java/com/qinxx/hslink/dao/AdminHSMapper.java index 6dd8de7..6eac304 100644 --- a/HSLink-back/src/main/java/com/qinxx/hslink/dao/AdminHSMapper.java +++ b/HSLink-back/src/main/java/com/qinxx/hslink/dao/AdminHSMapper.java @@ -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> getVerifyList(Map param); + + /** + * 获取人员管理列表 + * @param param + * @return + */ + List> getPersonnelManagement(Map param); + + /** + * 审核文章(通过/驳回) + * @param param + * @return + */ + int verifyArticle(Map param); + + /** + * 人员管理(冻结/解冻) + * @param param + * @return + */ + int peopleManagement(Map param); + + /** + * 获取帮助答复列表 + * @param param + * @return + */ + List> getHelpAnswerList(Map param); + + /** + * 解答帮助 + * @param param + * @return + */ + int answerHelp(Map param); } diff --git a/HSLink-back/src/main/java/com/qinxx/hslink/dao/HSLinkMapper.java b/HSLink-back/src/main/java/com/qinxx/hslink/dao/HSLinkMapper.java index 47086e2..b64a3d5 100644 --- a/HSLink-back/src/main/java/com/qinxx/hslink/dao/HSLinkMapper.java +++ b/HSLink-back/src/main/java/com/qinxx/hslink/dao/HSLinkMapper.java @@ -219,6 +219,13 @@ public interface HSLinkMapper { */ List> getFollowPeopleList(Map param); + /** + * 获取关注人员列表 + * @param param + * @return + */ + List> getFansPeopleList(Map param); + /** * 修改手机号 * @param param @@ -259,4 +266,32 @@ public interface HSLinkMapper { * @return */ int updateIntegral(); + + /** + * 收藏 + * @param param + * @return + */ + int addCollection(Map param); + + /** + * 取消收藏 + * @param param + * @return + */ + int cancelCollection(Map param); + + /** + * 获取收藏文章列表 + * @param param + * @return + */ + List> getCollectionList(Map param); + + /** + * 浏览量+1 + * @param param + * @return + */ + int updateReadNumber(Map param); } diff --git a/HSLink-back/src/main/java/com/qinxx/hslink/dao/mapping/AdminHSMapper.xml b/HSLink-back/src/main/java/com/qinxx/hslink/dao/mapping/AdminHSMapper.xml index 7c3c3f4..b933572 100644 --- a/HSLink-back/src/main/java/com/qinxx/hslink/dao/mapping/AdminHSMapper.xml +++ b/HSLink-back/src/main/java/com/qinxx/hslink/dao/mapping/AdminHSMapper.xml @@ -1,6 +1,72 @@ - + + + + UPDATE hs_notice set is_pass = #{operating} where id = #{articleId} + + + + + UPDATE hs_user set frozen_state = #{operating} where user_id = #{userId} + + + + + UPDATE hs_help + SET answer_id = #{answerId}, + answer = #{answer}, + answer_time = now( ) + WHERE + id = #{id} + + + + + + + + + + \ No newline at end of file diff --git a/HSLink-back/src/main/java/com/qinxx/hslink/dao/mapping/HSLinkMapper.xml b/HSLink-back/src/main/java/com/qinxx/hslink/dao/mapping/HSLinkMapper.xml index 3abea19..1f96b90 100644 --- a/HSLink-back/src/main/java/com/qinxx/hslink/dao/mapping/HSLinkMapper.xml +++ b/HSLink-back/src/main/java/com/qinxx/hslink/dao/mapping/HSLinkMapper.xml @@ -10,7 +10,7 @@ - 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() ) @@ -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" and s.id = #{id} @@ -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" and p.id = #{id} @@ -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" and s.id = #{id} @@ -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} @@ -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" + + and is_pass = "1" + and release_id = #{releaseId} @@ -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" and (label like CONCAT('%',#{text},'%') or title like CONCAT('%',#{text},'%') @@ -229,8 +237,8 @@ - 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} @@ -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 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 ) ) @@ -338,13 +347,18 @@ 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 hs_notice set read_number = #{number} where id = #{noticeId} + + DELETE @@ -355,6 +369,10 @@ AND follow_id = #{followId} + + delete from hs_collection where user_id = #{userId} and article_id = #{noticeId} + + select @@ -418,7 +441,7 @@ - + @@ -474,11 +497,25 @@ + + + @@ -488,7 +525,30 @@ + + + \ No newline at end of file diff --git a/HSLink-back/src/main/java/com/qinxx/hslink/service/AdminHSService.java b/HSLink-back/src/main/java/com/qinxx/hslink/service/AdminHSService.java index af640d2..2b676bb 100644 --- a/HSLink-back/src/main/java/com/qinxx/hslink/service/AdminHSService.java +++ b/HSLink-back/src/main/java/com/qinxx/hslink/service/AdminHSService.java @@ -1,4 +1,51 @@ package com.qinxx.hslink.service; +import java.util.Map; + +/** + * @author PHY + */ public interface AdminHSService { + + /** + * 获取待审核列表 + * @param param + * @return + */ + Map getVerifyList(Map param); + + /** + * 获取人员管理列表 + * @param param + * @return + */ + Map getPersonnelManagement(Map param); + + /** + * 审核文章(通过/驳回) + * @param param + * @return + */ + Map verifyArticle(Map param); + + /** + * 人员管理(冻结/解冻) + * @param param + * @return + */ + Map peopleManagement(Map param); + + /** + * 获取帮助答复列表 + * @param param + * @return + */ + Map getHelpAnswerList(Map param); + + /** + * 解答帮助 + * @param param + * @return + */ + Map answerHelp(Map param); } diff --git a/HSLink-back/src/main/java/com/qinxx/hslink/service/HSService.java b/HSLink-back/src/main/java/com/qinxx/hslink/service/HSService.java index 3a86d0f..c2267be 100644 --- a/HSLink-back/src/main/java/com/qinxx/hslink/service/HSService.java +++ b/HSLink-back/src/main/java/com/qinxx/hslink/service/HSService.java @@ -184,6 +184,13 @@ public interface HSService { */ Map getFollowPeopleList(Map param); + /** + * 获取粉丝人员列表 + * @param param + * @return + */ + Map getFansPeopleList(Map param); + /** * 修改手机号 * @param param @@ -223,4 +230,32 @@ public interface HSService { * 定时任务更新积分 */ Map updateIntegral(); + + /** + * 收藏 + * @param param + * @return + */ + Map addCollection(Map param); + + /** + * 取消收藏 + * @param param + * @return + */ + Map cancelCollection(Map param); + + /** + * 获取收藏列表 + * @param param + * @return + */ + Map getCollectionList(Map param); + + /** + * 浏览量+1 + * @param param + * @return + */ + Map updateReadNumber(Map param); } \ No newline at end of file diff --git a/HSLink-back/src/main/java/com/qinxx/hslink/service/impl/AdminHSServiceImpl.java b/HSLink-back/src/main/java/com/qinxx/hslink/service/impl/AdminHSServiceImpl.java index e18bae2..7c5e7a8 100644 --- a/HSLink-back/src/main/java/com/qinxx/hslink/service/impl/AdminHSServiceImpl.java +++ b/HSLink-back/src/main/java/com/qinxx/hslink/service/impl/AdminHSServiceImpl.java @@ -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 getVerifyList(Map param) { + Map result = new HashMap<>(); + List> res = adminHSMapper.getVerifyList(param); + result.put("data",res); + result.put("success",true); + return result; + } + + /** + * 获取人员管理列表 + * @param param + * @return + */ + @Override + public Map getPersonnelManagement(Map param) { + Map result = new HashMap<>(); + List> res = adminHSMapper.getPersonnelManagement(param); + result.put("data",res); + result.put("success",true); + return result; + } + + /** + * 审核文章(通过/驳回) + * @param param + * @return + */ + @Override + public Map verifyArticle(Map param) { + int res = 0; + Map 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 peopleManagement(Map param) { + int res = 0; + Map 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 getHelpAnswerList(Map param) { + Map result = new HashMap<>(); + List> res = adminHSMapper.getHelpAnswerList(param); + result.put("data",res); + result.put("success",true); + return result; + } + + /** + * 解答帮助 + * @param param + * @return + */ + @Override + public Map answerHelp(Map param) { + int res = 0; + Map 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; + } } diff --git a/HSLink-back/src/main/java/com/qinxx/hslink/service/impl/HSServiceImpl.java b/HSLink-back/src/main/java/com/qinxx/hslink/service/impl/HSServiceImpl.java index 86447c3..f2d932b 100644 --- a/HSLink-back/src/main/java/com/qinxx/hslink/service/impl/HSServiceImpl.java +++ b/HSLink-back/src/main/java/com/qinxx/hslink/service/impl/HSServiceImpl.java @@ -562,6 +562,15 @@ public class HSServiceImpl implements HSService { return result; } + @Override + public Map getFansPeopleList(Map param) { + Map result = new HashMap<>(); + List> res = hsLinkMapper.getFansPeopleList(param); + result.put("data",res); + result.put("success",true); + return result; + } + @Override public Map updatePhone(Map param) { Map result = new HashMap<>(); @@ -637,6 +646,60 @@ public class HSServiceImpl implements HSService { return result; } + @Override + public Map addCollection(Map param) { + Map 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 cancelCollection(Map param) { + Map 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 getCollectionList(Map param) { + Map result = new HashMap<>(); + List> res = hsLinkMapper.getCollectionList(param); + result.put("data",res); + result.put("success",true); + return result; + } + + @Override + public Map updateReadNumber(Map param) { + Map 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 diff --git a/HSLink-back/src/main/java/com/qinxx/hslink/util/TestClass.java b/HSLink-back/src/main/java/com/qinxx/hslink/util/TestClass.java index 0d1a649..b62f91a 100644 --- a/HSLink-back/src/main/java/com/qinxx/hslink/util/TestClass.java +++ b/HSLink-back/src/main/java/com/qinxx/hslink/util/TestClass.java @@ -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 map = new HashMap<>(); + map.put("name","张氏"); + System.out.println(map.get("sex")); } }