修改小程序接口

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

View File

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