修改小程序接口

This commit is contained in:
liuwu 2023-09-06 15:27:59 +08:00
parent 7f28a16082
commit a832eadd66
2 changed files with 20 additions and 17 deletions

View File

@ -23,6 +23,7 @@ import com.cyx.web.base.service.ITAmentReviewedHisService;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -52,18 +53,18 @@ public class WechatController extends BaseController {
/** /**
* 微信小程序获取openId * 微信小程序获取openId
* @param code * @param user
* @return * @return
*/ */
@GetMapping(value = "/getUserInfo") @GetMapping(value = "/getUserInfo")
public AjaxResult getUserInfo(String code){ @ResponseBody
SysUser user = userService.selectUserById(1L); public AjaxResult getUserInfo(SysUser user){
UsernamePasswordToken token = new UsernamePasswordToken(user.getUserName(), user.getPassword(), true); UsernamePasswordToken token = new UsernamePasswordToken(user.getLoginName(), user.getPassword(), true);
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
try try
{ {
subject.login(token); subject.login(token);
return success(); return AjaxResult.success(token);
} }
catch (AuthenticationException e) catch (AuthenticationException e)
{ {
@ -72,7 +73,7 @@ public class WechatController extends BaseController {
{ {
msg = e.getMessage(); msg = e.getMessage();
} }
return error(msg); return AjaxResult.error(msg);
} }
} }
@ -81,7 +82,7 @@ public class WechatController extends BaseController {
* @param dept * @param dept
* @return * @return
*/ */
// @RequiresPermissions("base:dept:list") @RequiresPermissions("base:dept:list")
@PostMapping("/deptList") @PostMapping("/deptList")
@ResponseBody @ResponseBody
public AjaxResult deptList(@RequestBody SysDept dept) public AjaxResult deptList(@RequestBody SysDept dept)
@ -94,7 +95,7 @@ public class WechatController extends BaseController {
* @param personnel * @param personnel
* @return * @return
*/ */
// @RequiresPermissions("base:personnel:list") @RequiresPermissions("base:personnel:list")
@PostMapping("/personList") @PostMapping("/personList")
@ResponseBody @ResponseBody
public AjaxResult personList(@RequestBody TAmentPersonnel personnel) public AjaxResult personList(@RequestBody TAmentPersonnel personnel)
@ -102,13 +103,13 @@ public class WechatController extends BaseController {
return AjaxResult.success(personnelService.selectTAmentPersonnelList(personnel)); return AjaxResult.success(personnelService.selectTAmentPersonnelList(personnel));
} }
// @RequiresPermissions("base:affairs:list") @RequiresPermissions("base:affairs:list")
@PostMapping("/queryTree") @PostMapping("/queryTree")
@ResponseBody @ResponseBody
public AjaxResult queryTree(@RequestBody TAmentPartyAffairs affairs) public AjaxResult queryTree(@RequestBody TAmentPartyAffairs affairs)
{ {
List<TAmentPartyAffairs> list = partyAffairsService.selectTAmentPartyAffairsList(affairs); List<TAmentPartyAffairs> list = partyAffairsService.selectTAmentPartyAffairsList(affairs);
Map<String, List<TAmentPartyAffairs>> targetMap = list.stream().collect(Collectors.groupingBy(TAmentPartyAffairs::getTarget)); Map<String, List<TAmentPartyAffairs>> targetMap = list.stream().collect(Collectors.groupingBy(TAmentPartyAffairs::getShotName));
JSONArray array = new JSONArray(); JSONArray array = new JSONArray();
// 循环target // 循环target
@ -121,8 +122,9 @@ public class WechatController extends BaseController {
JSONArray array1 = new JSONArray(); JSONArray array1 = new JSONArray();
list1.forEach(l->{ list1.forEach(l->{
JSONObject object1 = new JSONObject(); JSONObject object1 = new JSONObject();
object1.put("text",l.getDemand()); object1.put("text",l.getDetailed().substring(0,18)+"...");
object1.put("id",l.getId()); object1.put("id",l.getId());
object1.put("shotName",l.getShotName());
array1.add(object1); array1.add(object1);
}); });
object.put("children",array1); object.put("children",array1);
@ -142,7 +144,7 @@ public class WechatController extends BaseController {
/** /**
* 任务预警 * 任务预警
*/ */
// @RequiresPermissions("base:affairs:list") @RequiresPermissions("base:affairs:list")
@PostMapping("/queryList") @PostMapping("/queryList")
@ResponseBody @ResponseBody
public TableDataInfo queryList(@RequestBody TAmentPartyAffairs tAmentPartyAffairs) public TableDataInfo queryList(@RequestBody TAmentPartyAffairs tAmentPartyAffairs)
@ -155,7 +157,7 @@ public class WechatController extends BaseController {
/** /**
* 提交附件 * 提交附件
*/ */
// @RequiresPermissions("base:affairs:edit") @RequiresPermissions("base:affairs:edit")
@Log(title = "党务", businessType = BusinessType.UPDATE) @Log(title = "党务", businessType = BusinessType.UPDATE)
@PostMapping("/commit") @PostMapping("/commit")
@ResponseBody @ResponseBody
@ -177,7 +179,7 @@ public class WechatController extends BaseController {
/** /**
* 审核 * 审核
*/ */
// @RequiresPermissions("base:affairs:edit") @RequiresPermissions("base:affairs:edit")
@Log(title = "党务", businessType = BusinessType.UPDATE) @Log(title = "党务", businessType = BusinessType.UPDATE)
@PostMapping("/reviewedSave") @PostMapping("/reviewedSave")
@ResponseBody @ResponseBody
@ -217,7 +219,7 @@ public class WechatController extends BaseController {
/** /**
* 任务预警 * 任务预警
*/ */
// @RequiresPermissions("base:affairs:list") @RequiresPermissions("base:affairs:list")
@PostMapping("/warnList") @PostMapping("/warnList")
@ResponseBody @ResponseBody
public TableDataInfo warnList(@RequestBody TAmentPartyAffairs tAmentPartyAffairs) public TableDataInfo warnList(@RequestBody TAmentPartyAffairs tAmentPartyAffairs)
@ -231,7 +233,7 @@ public class WechatController extends BaseController {
/** /**
* 审批预警 * 审批预警
*/ */
// @RequiresPermissions("base:affairs:list") @RequiresPermissions("base:affairs:list")
@PostMapping("/approveList") @PostMapping("/approveList")
@ResponseBody @ResponseBody
public TableDataInfo approveList(@RequestBody TAmentPartyAffairs tAmentPartyAffairs) public TableDataInfo approveList(@RequestBody TAmentPartyAffairs tAmentPartyAffairs)

View File

@ -288,10 +288,11 @@ public class ShiroConfig
filterChainDefinitionMap.put("/ajax/**", "anon"); filterChainDefinitionMap.put("/ajax/**", "anon");
filterChainDefinitionMap.put("/js/**", "anon"); filterChainDefinitionMap.put("/js/**", "anon");
filterChainDefinitionMap.put("/ruoyi/**", "anon"); filterChainDefinitionMap.put("/ruoyi/**", "anon");
filterChainDefinitionMap.put("/wx/**", "anon"); filterChainDefinitionMap.put("/wx/index/getUserInfo", "anon");
filterChainDefinitionMap.put("/profile/**", "anon"); filterChainDefinitionMap.put("/profile/**", "anon");
filterChainDefinitionMap.put("/common/**", "anon"); filterChainDefinitionMap.put("/common/**", "anon");
filterChainDefinitionMap.put("/captcha/captchaImage**", "anon"); filterChainDefinitionMap.put("/captcha/captchaImage**", "anon");
filterChainDefinitionMap.put("/auth/**", "anon");
// 退出 logout地址shiro去清除session // 退出 logout地址shiro去清除session
filterChainDefinitionMap.put("/logout", "logout"); filterChainDefinitionMap.put("/logout", "logout");
// 不需要拦截的访问 // 不需要拦截的访问