修改页面样式,删除多余字段,增加微信接口

This commit is contained in:
liuwu 2023-08-30 14:18:01 +08:00
parent 6f6600c5a9
commit c3bb25220d
1 changed files with 90 additions and 17 deletions

View File

@ -1,31 +1,38 @@
package com.cyx.wechat; package com.cyx.wechat;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cyx.common.annotation.Log; import com.cyx.common.annotation.Log;
import com.cyx.common.core.controller.BaseController; import com.cyx.common.core.controller.BaseController;
import com.cyx.common.core.domain.AjaxResult; import com.cyx.common.core.domain.AjaxResult;
import com.cyx.common.core.domain.entity.SysDept;
import com.cyx.common.core.domain.entity.SysUser; import com.cyx.common.core.domain.entity.SysUser;
import com.cyx.common.core.page.TableDataInfo; import com.cyx.common.core.page.TableDataInfo;
import com.cyx.common.enums.BusinessType; import com.cyx.common.enums.BusinessType;
import com.cyx.common.utils.StringUtils; import com.cyx.common.utils.StringUtils;
import com.cyx.system.service.ISysDeptService;
import com.cyx.system.service.ISysUserService; import com.cyx.system.service.ISysUserService;
import com.cyx.web.base.domain.*; import com.cyx.web.base.domain.TAmentCommitHis;
import com.cyx.web.base.service.*; import com.cyx.web.base.domain.TAmentPartyAffairs;
import com.cyx.web.base.domain.TAmentPersonnel;
import com.cyx.web.base.domain.TAmentReviewedHis;
import com.cyx.web.base.service.ITAmentCommitHisService;
import com.cyx.web.base.service.ITAmentPartyAffairsService;
import com.cyx.web.base.service.ITAmentPersonnelService;
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;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
@Controller @Controller
@RequestMapping("/wx/index") @RequestMapping("/wx/index")
@ -38,6 +45,10 @@ public class WechatController extends BaseController {
private ITAmentReviewedHisService reviewedHisService; private ITAmentReviewedHisService reviewedHisService;
@Autowired @Autowired
private ISysUserService userService; private ISysUserService userService;
@Autowired
private ISysDeptService deptService;
@Autowired
private ITAmentPersonnelService personnelService;
/** /**
* 微信小程序获取openId * 微信小程序获取openId
@ -65,13 +76,75 @@ public class WechatController extends BaseController {
} }
} }
/**
* 部门列表
* @param dept
* @return
*/
// @RequiresPermissions("base:dept:list")
@PostMapping("/deptList")
@ResponseBody
public List<SysDept> deptList(@RequestBody SysDept dept)
{
return deptService.selectDeptList(dept);
}
/**
* 人员列表
* @param personnel
* @return
*/
// @RequiresPermissions("base:personnel:list")
@PostMapping("/personList")
@ResponseBody
public List<TAmentPersonnel> personList(@RequestBody TAmentPersonnel personnel)
{
return personnelService.selectTAmentPersonnelList(personnel);
}
// @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));
JSONArray array = new JSONArray();
// 循环target
for (Map.Entry<String, List<TAmentPartyAffairs>> entry : targetMap.entrySet())
{
JSONObject object = new JSONObject();
object.put("name",entry.getKey());
// 同一target
List<TAmentPartyAffairs> list1 = entry.getValue();
JSONArray array1 = new JSONArray();
list1.forEach(l->{
JSONObject object1 = new JSONObject();
object1.put("name",l.getDemand());
array1.add(object1);
});
object.put("children",array1);
array.add(object);
// // 循环demand
// Map<String, List<TAmentPartyAffairs>> detailMap = list1.stream().collect(Collectors.groupingBy(TAmentPartyAffairs::getDemand));
// for (Map.Entry<String, List<TAmentPartyAffairs>> entry1 : detailMap.entrySet()){
// JSONObject object1 = new JSONObject();
// object.put("name",entry1.getKey());
// List<TAmentPartyAffairs> de = entry.getValue();
// }
// object.put("name",entry.getKey());
}
return AjaxResult.success(array);
}
/** /**
* 任务预警 * 任务预警
*/ */
@RequiresPermissions("base:affairs:list") // @RequiresPermissions("base:affairs:list")
@PostMapping("/queryList") @PostMapping("/queryList")
@ResponseBody @ResponseBody
public TableDataInfo queryList(TAmentPartyAffairs tAmentPartyAffairs) public TableDataInfo queryList(@RequestBody TAmentPartyAffairs tAmentPartyAffairs)
{ {
startPage(tAmentPartyAffairs.getPageNum(),tAmentPartyAffairs.getPageSize()); startPage(tAmentPartyAffairs.getPageNum(),tAmentPartyAffairs.getPageSize());
List<TAmentPartyAffairs> list = partyAffairsService.selectTAmentPartyAffairsList(tAmentPartyAffairs); List<TAmentPartyAffairs> list = partyAffairsService.selectTAmentPartyAffairsList(tAmentPartyAffairs);
@ -81,11 +154,11 @@ 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
public AjaxResult commit(TAmentPartyAffairs tAmentPartyAffairs) public AjaxResult commit(@RequestBody TAmentPartyAffairs tAmentPartyAffairs)
{ {
TAmentCommitHis his = new TAmentCommitHis(); TAmentCommitHis his = new TAmentCommitHis();
his.setPer(tAmentPartyAffairs.getHeader()); his.setPer(tAmentPartyAffairs.getHeader());
@ -104,11 +177,11 @@ 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
public AjaxResult reviewedSave(TAmentPartyAffairs tAmentPartyAffairs) public AjaxResult reviewedSave(@RequestBody TAmentPartyAffairs tAmentPartyAffairs)
{ {
TAmentPartyAffairs one = partyAffairsService.selectTAmentPartyAffairsById(tAmentPartyAffairs.getId()); TAmentPartyAffairs one = partyAffairsService.selectTAmentPartyAffairsById(tAmentPartyAffairs.getId());
TAmentReviewedHis his = new TAmentReviewedHis(); TAmentReviewedHis his = new TAmentReviewedHis();
@ -144,10 +217,10 @@ public class WechatController extends BaseController {
/** /**
* 任务预警 * 任务预警
*/ */
@RequiresPermissions("base:affairs:list") // @RequiresPermissions("base:affairs:list")
@PostMapping("/warnList") @PostMapping("/warnList")
@ResponseBody @ResponseBody
public TableDataInfo warnList(TAmentPartyAffairs tAmentPartyAffairs) public TableDataInfo warnList(@RequestBody TAmentPartyAffairs tAmentPartyAffairs)
{ {
startPage(tAmentPartyAffairs.getPageNum(),tAmentPartyAffairs.getPageSize()); startPage(tAmentPartyAffairs.getPageNum(),tAmentPartyAffairs.getPageSize());
tAmentPartyAffairs.setStatus("1"); tAmentPartyAffairs.setStatus("1");
@ -158,10 +231,10 @@ public class WechatController extends BaseController {
/** /**
* 审批预警 * 审批预警
*/ */
@RequiresPermissions("base:affairs:list") // @RequiresPermissions("base:affairs:list")
@PostMapping("/approveList") @PostMapping("/approveList")
@ResponseBody @ResponseBody
public TableDataInfo approveList(TAmentPartyAffairs tAmentPartyAffairs) public TableDataInfo approveList(@RequestBody TAmentPartyAffairs tAmentPartyAffairs)
{ {
startPage(tAmentPartyAffairs.getPageNum(),tAmentPartyAffairs.getPageSize()); startPage(tAmentPartyAffairs.getPageNum(),tAmentPartyAffairs.getPageSize());
tAmentPartyAffairs.setStatus("2"); tAmentPartyAffairs.setStatus("2");