springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/SystemUserController.java
@@ -1,5 +1,6 @@ package com.panzhihua.sangeshenbian.api; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.panzhihua.common.controller.BaseController; @@ -8,6 +9,8 @@ import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; import com.panzhihua.common.service.auth.TokenService; import com.panzhihua.common.utlis.HttpClientUtil; import com.panzhihua.common.utlis.ServletUtils; import com.panzhihua.sangeshenbian.model.entity.SystemMenu; import com.panzhihua.sangeshenbian.model.entity.SystemRoleMenu; import com.panzhihua.sangeshenbian.model.entity.SystemUser; @@ -26,10 +29,15 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.text.MessageFormat; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.util.*; import java.util.concurrent.TimeUnit; @@ -340,4 +348,39 @@ List<RegionVO> list = systemUserService.getRegionTree(loginUserInfo); return R.ok(list); } public static void main(String[] args) { } // private String ACCESS_TOKEN_URL = "GET https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential"; // // public String getAppAccessToken(String appId, String appSecret) throws Exception { // String accessToken = "0"; // try { // log.info("获取微信token参数:appid=" + appId + ",appSecret=" + appSecret); // String accessTokenUrl = ACCESS_TOKEN_URL + "&appid=" + appId + "&secret=" + appSecret; // String result = HttpClientUtil.httpGet(accessTokenUrl, null, null); // Map<String, Object> resultMap = JSON.parseObject(result, Map.class); // StringRedisTemplate redisTemplate = wxXCXTempSend.stringRedisTemplate; // if (resultMap.containsKey("access_token")) { // accessToken = resultMap.get("access_token").toString(); // redisTemplate.opsForValue().set("access_token:access_token:" + appId, accessToken); // } // HttpServletRequest request = ServletUtils.getRequest(); // String requestURI = request.getRequestURI(); // //加上时间戳 // String datetime = new SimpleDateFormat("yyyyMMdd").format(new Date()); // //这里是 Redis key的前缀,如: sys:tabieId:表名 如果不需要去掉表名也可以 // String key = MessageFormat.format("{0}:{1}:{2}", "access_token_request_incr",datetime,requestURI); // //查询 key 是否存在, 不存在返回 1 ,存在的话则自增加1 // redisTemplate.opsForValue().increment(key, 1); // // } catch (IOException ioe) { // log.error("小程序http请求异常"); // ioe.printStackTrace(); // } // return accessToken; // } } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/PartyMemberController.java
@@ -1,10 +1,16 @@ package com.panzhihua.sangeshenbian.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.model.vos.R; import com.panzhihua.sangeshenbian.model.entity.BcRegion; import com.panzhihua.sangeshenbian.model.entity.ComStreet; import com.panzhihua.sangeshenbian.model.entity.PartyMember; import com.panzhihua.sangeshenbian.service.IBcRegionService; import com.panzhihua.sangeshenbian.service.IComActService; import com.panzhihua.sangeshenbian.service.IComStreetService; import com.panzhihua.sangeshenbian.service.IPartyMemberService; import com.panzhihua.sangeshenbian.warpper.PartyMemberApplicationRequest; import com.panzhihua.sangeshenbian.warpper.PartyMemberAuditRequest; @@ -20,6 +26,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; import java.util.List; import java.util.Objects; @Api(tags = {"小程序-党员管理"}) @@ -28,6 +35,9 @@ @RequiredArgsConstructor(onConstructor_ = {@Lazy}) public class PartyMemberController extends BaseController { private final IPartyMemberService partyMemberService; private final IBcRegionService bcRegionService; private final IComStreetService comStreetService; private final IComActService comActService; /** * 党员申请 @@ -93,4 +103,5 @@ } } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/PartyMemberServiceImpl.java
@@ -1,55 +1,35 @@ package com.panzhihua.sangeshenbian.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import cn.idev.excel.EasyExcel; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import cn.idev.excel.FastExcel; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.exceptions.ServiceException; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.exceptions.ServiceException; import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; import com.panzhihua.common.redis.RedisUtils; import com.panzhihua.sangeshenbian.dao.PartyMemberMapper; import com.panzhihua.sangeshenbian.enums.AuditStatusEnum; import com.panzhihua.sangeshenbian.enums.ReportTypeEnum; import com.panzhihua.sangeshenbian.enums.AuditStatusEnum; import com.panzhihua.sangeshenbian.model.entity.BcRegion; import com.panzhihua.sangeshenbian.model.entity.ComAct; import com.panzhihua.sangeshenbian.model.entity.ComStreet; import com.panzhihua.sangeshenbian.model.entity.PartyMember; import com.panzhihua.sangeshenbian.model.entity.SystemUser; import com.panzhihua.sangeshenbian.model.entity.*; import com.panzhihua.sangeshenbian.model.excel.PartyMemberExcel; import com.panzhihua.sangeshenbian.warpper.PartyMemberImportFailedVO; import com.panzhihua.sangeshenbian.model.excel.PartyMemberTemplate; import com.panzhihua.sangeshenbian.service.IBcRegionService; import com.panzhihua.sangeshenbian.service.IComActService; import com.panzhihua.sangeshenbian.service.IComStreetService; import com.panzhihua.sangeshenbian.service.IPartyMemberService; import com.panzhihua.sangeshenbian.service.ISystemUserService; import com.panzhihua.sangeshenbian.warpper.PartyMemberApplicationRequest; import com.panzhihua.sangeshenbian.warpper.PartyMemberDTO; import com.panzhihua.sangeshenbian.warpper.PartyMemberQuery; import com.panzhihua.sangeshenbian.warpper.PendingPartyMemberApplicationVO; import com.panzhihua.sangeshenbian.service.*; import com.panzhihua.sangeshenbian.warpper.*; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLEncoder; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.*; /** * <p> @@ -67,6 +47,7 @@ private final IBcRegionService bcRegionService; private final IComStreetService comStreetService; private final IComActService comActService; private final RedisUtils redisUtils; /** * 党员分页查询列表 * @@ -329,10 +310,22 @@ .ne(SystemUser::getStatus, 3) .last("LIMIT 1")); // 获取党员信息 PartyMember partyMember = getOne(new LambdaQueryWrapper<PartyMember>() .eq(PartyMember::getPhone, loginUserInfo.getPhone()) .eq(PartyMember::getDelFlag, 0)); if (adminUser == null){ throw new ServiceException("无权审核"); } Integer identity = (Integer) redisUtils.get("identity:" + loginUserInfo.getPhone()); if(identity == null || identity == 2){ throw new ServiceException("请切换至管理员身份"); } int accountLevel = adminUser.getAccountLevel(); Long communityId = null; String streetId = null;