319 changed files with 15016 additions and 116 deletions
@ -0,0 +1,39 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.GovWebLoginFormDTO; |
|||
import com.epmet.dto.result.UserTokenResultDTO; |
|||
import com.epmet.service.GovWebService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
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.RestController; |
|||
|
|||
/** |
|||
* @Description PC工作端-登陆服务 |
|||
* @author sun |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("govweb") |
|||
public class GovWebController { |
|||
|
|||
@Autowired |
|||
private GovWebService govWebService; |
|||
|
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return |
|||
* @Author sun |
|||
* @Description PC工作端-工作人员登录 |
|||
**/ |
|||
@PostMapping("login") |
|||
public Result<UserTokenResultDTO> workLogin(@RequestBody GovWebLoginFormDTO formDTO) { |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
return new Result<UserTokenResultDTO>().ok(govWebService.login(formDTO)); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,46 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description PC工作端 手机号+密码登陆-接口入参 |
|||
* @Author sun |
|||
*/ |
|||
@Data |
|||
public class GovWebLoginFormDTO extends LoginCommonFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 7950477424010655108L; |
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
@NotBlank(message = "客户Id不能为空",groups = {AddUserShowGroup.class}) |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
@NotBlank(message = "手机号不能为空",groups = {AddUserShowGroup.class}) |
|||
private String phone; |
|||
|
|||
/** |
|||
* 密码 |
|||
*/ |
|||
@NotBlank(message = "密码不能为空",groups = {AddUserShowGroup.class}) |
|||
private String password; |
|||
|
|||
/** |
|||
* 验证码 |
|||
*/ |
|||
@NotBlank(message="验证码不能为空",groups = {AddUserShowGroup.class}) |
|||
private String captcha; |
|||
|
|||
/** |
|||
* 唯一标识 |
|||
*/ |
|||
@NotBlank(message="唯一标识不能为空",groups = {AddUserInternalGroup.class}) |
|||
private String uuid; |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.dto.form.GovWebLoginFormDTO; |
|||
import com.epmet.dto.result.UserTokenResultDTO; |
|||
|
|||
/** |
|||
* @Description 第三方-居民端、政府端登陆服务 |
|||
* @author sun |
|||
*/ |
|||
public interface GovWebService { |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return |
|||
* @Author sun |
|||
* @Description PC工作端-工作人员登录 |
|||
**/ |
|||
UserTokenResultDTO login(GovWebLoginFormDTO formDTO); |
|||
} |
@ -0,0 +1,124 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.common.token.constant.LoginConstant; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.security.password.PasswordUtils; |
|||
import com.epmet.commons.tools.utils.CpUserDetailRedis; |
|||
import com.epmet.commons.tools.utils.DateUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.form.GovWebLoginFormDTO; |
|||
import com.epmet.dto.form.GovWebOperLoginFormDTO; |
|||
import com.epmet.dto.form.LoginByPassWordFormDTO; |
|||
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO; |
|||
import com.epmet.dto.result.GovWebOperLoginResultDTO; |
|||
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO; |
|||
import com.epmet.dto.result.UserTokenResultDTO; |
|||
import com.epmet.feign.EpmetUserFeignClient; |
|||
import com.epmet.jwt.JwtTokenProperties; |
|||
import com.epmet.jwt.JwtTokenUtils; |
|||
import com.epmet.service.CaptchaService; |
|||
import com.epmet.service.GovWebService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author sun |
|||
* @Description 第三方-居民端、政府端登陆服务 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
public class GovWebServiceImpl implements GovWebService { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(GovWebServiceImpl.class); |
|||
@Autowired |
|||
private CaptchaService captchaService; |
|||
@Autowired |
|||
private JwtTokenUtils jwtTokenUtils; |
|||
@Autowired |
|||
private JwtTokenProperties jwtTokenProperties; |
|||
@Autowired |
|||
private CpUserDetailRedis cpUserDetailRedis; |
|||
@Autowired |
|||
private EpmetUserFeignClient epmetUserFeignClient; |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return |
|||
* @Author sun |
|||
* @Description PC工作端-工作人员登录 |
|||
**/ |
|||
@Override |
|||
public UserTokenResultDTO login(GovWebLoginFormDTO formDTO) { |
|||
//1.参数校验
|
|||
if (!(LoginConstant.APP_GOV.equals(formDTO.getApp()) && LoginConstant.CLIENT_WEB.equals(formDTO.getClient()))) { |
|||
logger.error("当前接口只适用于PC工作端运营管理后台"); |
|||
throw new RenException("当前接口只适用于PC工作端运营管理后台"); |
|||
} |
|||
//2.验证码校验
|
|||
boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha()); |
|||
if (!flag) { |
|||
logger.error(String.format("用户%s登录,验证码输入错误,暂时放行", formDTO.getPhone())); |
|||
//暂时关闭验证码校验 TODO
|
|||
//throw new RenException(EpmetErrorCode.ERR10019.getCode());
|
|||
} |
|||
//3.校验登陆账号是否存在
|
|||
//根据客户Id和手机号查询登陆用户信息(此处不需要判断登陆人是否是有效客户以及是否是客户的根管理员,前一接口获取登陆手机号对应客户列表已经判断了)
|
|||
GovWebOperLoginFormDTO form = new GovWebOperLoginFormDTO(); |
|||
form.setCustomerId(formDTO.getCustomerId()); |
|||
form.setMobile(formDTO.getPhone()); |
|||
Result<GovWebOperLoginResultDTO> result = epmetUserFeignClient.getStaffIdAndPwd(form); |
|||
if (!result.success() || null == result.getData() || null == result.getData().getUserId()) { |
|||
logger.error("根据手机号查询PC工作端登陆人员信息失败,返回10003账号不存在"); |
|||
throw new RenException(EpmetErrorCode.ERR10003.getCode()); |
|||
} |
|||
GovWebOperLoginResultDTO resultDTO = result.getData(); |
|||
|
|||
//4.密码是否正确
|
|||
//密码错误
|
|||
if (!PasswordUtils.matches(formDTO.getPassword(), resultDTO.getPassWord())) { |
|||
logger.error("登陆密码错误"); |
|||
throw new RenException(EpmetErrorCode.ERR10004.getCode()); |
|||
} |
|||
|
|||
//5.生成token存到redis并返回
|
|||
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); |
|||
userTokenResultDTO.setToken(this.packagingUserToken(formDTO, resultDTO.getUserId())); |
|||
return userTokenResultDTO; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 生成PC工作端token |
|||
* @author sun |
|||
*/ |
|||
private String packagingUserToken(GovWebLoginFormDTO formDTO, String userId) { |
|||
// 生成token
|
|||
Map<String, Object> map = new HashMap<>(); |
|||
map.put("app", formDTO.getApp()); |
|||
map.put("client", formDTO.getClient()); |
|||
map.put("userId", userId); |
|||
String token = jwtTokenUtils.createToken(map); |
|||
logger.info("app:" + formDTO.getApp() + ";client:" + formDTO.getClient() + ";userId:" + userId + ";生成token[" + token + "]"); |
|||
int expire = jwtTokenProperties.getExpire(); |
|||
TokenDto tokenDto = new TokenDto(); |
|||
tokenDto.setApp(formDTO.getApp()); |
|||
tokenDto.setClient(formDTO.getClient()); |
|||
tokenDto.setUserId(userId); |
|||
tokenDto.setToken(token); |
|||
tokenDto.setUpdateTime(System.currentTimeMillis()); |
|||
tokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); |
|||
cpUserDetailRedis.set(tokenDto, expire); |
|||
logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); |
|||
return token; |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,41 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<parent> |
|||
<artifactId>epmet-ext</artifactId> |
|||
<groupId>com.epmet</groupId> |
|||
<version>2.0.0</version> |
|||
</parent> |
|||
|
|||
|
|||
<artifactId>epmet-ext-client</artifactId> |
|||
<packaging>jar</packaging> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-commons-tools</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.github.binarywang</groupId> |
|||
<artifactId>weixin-java-mp</artifactId> |
|||
<version>3.6.0</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-user-client</artifactId> |
|||
<version>2.0.0</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
<build> |
|||
<finalName>${project.artifactId}</finalName> |
|||
</build> |
|||
|
|||
</project> |
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:33 上午 |
|||
*/ |
|||
@Data |
|||
public class StaffSinAgencyFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1827402498483127629L; |
|||
|
|||
//后端自己看
|
|||
public interface StaffSinAgency{} |
|||
|
|||
/** |
|||
* 机关Id |
|||
*/ |
|||
@NotBlank(message = "机关Id不能为空",groups = {StaffSinAgency.class}) |
|||
private String agencyId; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:33 上午 |
|||
*/ |
|||
@Data |
|||
public class StaffSinDeptFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1827404498483127629L; |
|||
|
|||
//后端自己看
|
|||
public interface StaffSinDept{} |
|||
|
|||
/** |
|||
* 部门Id |
|||
*/ |
|||
@NotBlank(message = "部门Id不能为空",groups = {StaffSinDept.class}) |
|||
private String departmentId; |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:33 上午 |
|||
*/ |
|||
@Data |
|||
public class StaffSinGridFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1827404498483127629L; |
|||
|
|||
//后端自己看
|
|||
public interface StaffSinGrid{} |
|||
|
|||
/** |
|||
* 网格Id |
|||
*/ |
|||
@NotBlank(message = "网格Id不能为空",groups = {StaffSinGrid.class}) |
|||
private String gridId; |
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:30 上午 |
|||
*/ |
|||
@Data |
|||
public class RoleResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -4321366067217459L; |
|||
|
|||
/** |
|||
* 角色key |
|||
*/ |
|||
private String roleKey; |
|||
|
|||
/** |
|||
* 角色名称 |
|||
*/ |
|||
private String roleName; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
@JsonIgnore |
|||
private String userId; |
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:25 上午 |
|||
*/ |
|||
@Data |
|||
public class StaffSinDeptResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -3440415466710443002L; |
|||
|
|||
/** |
|||
* 工作人员Id |
|||
*/ |
|||
private String staffId; |
|||
|
|||
/** |
|||
* 工作人员名称 |
|||
*/ |
|||
private String staffName; |
|||
|
|||
/** |
|||
* 头像 |
|||
*/ |
|||
private String headPhoto; |
|||
|
|||
/** |
|||
* 性别,1男2女0未知 |
|||
*/ |
|||
private Integer gender; |
|||
|
|||
/** |
|||
* 角色列表 |
|||
*/ |
|||
private List<RoleResultDTO> roleList; |
|||
|
|||
} |
@ -0,0 +1,11 @@ |
|||
FROM java:8 |
|||
|
|||
RUN export LANG="zh_CN.UTF-8" |
|||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime |
|||
RUN echo 'Asia/Shanghai' > /etc/timezone |
|||
|
|||
COPY ./target/*.jar ./app.jar |
|||
|
|||
EXPOSE 8113 |
|||
|
|||
ENTRYPOINT ["sh", "-c", "$RUN_INSTRUCT"] |
@ -0,0 +1,17 @@ |
|||
version: "3.7" |
|||
services: |
|||
epmet-ext-server: |
|||
container_name: epmet-ext-server-dev |
|||
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-ext-server:0.0.6 |
|||
ports: |
|||
- "8113:8113" |
|||
network_mode: host # 使用现有网络 |
|||
volumes: |
|||
- "/opt/epmet-cloud-logs/dev:/logs" |
|||
environment: |
|||
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
|||
deploy: |
|||
resources: |
|||
limits: |
|||
cpus: '0.1' |
|||
memory: 250M |
@ -0,0 +1,17 @@ |
|||
version: "3.7" |
|||
services: |
|||
epmet-ext-server: |
|||
container_name: epmet-ext-server-prod |
|||
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-ext-server:0.0.1 |
|||
ports: |
|||
- "8113:8113" |
|||
network_mode: host # 使用现有网络 |
|||
volumes: |
|||
- "/opt/epmet-cloud-logs/prod:/logs" |
|||
environment: |
|||
RUN_INSTRUCT: "java -Xms256m -Xmx512m -jar ./app.jar" |
|||
deploy: |
|||
resources: |
|||
limits: |
|||
cpus: '0.1' |
|||
memory: 600M |
@ -0,0 +1,17 @@ |
|||
version: "3.7" |
|||
services: |
|||
epmet-ext-server: |
|||
container_name: epmet-ext-server-test |
|||
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-ext-server:0.0.1 |
|||
ports: |
|||
- "8113:8113" |
|||
network_mode: host # 使用现有网络 |
|||
volumes: |
|||
- "/opt/epmet-cloud-logs/test:/logs" |
|||
environment: |
|||
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
|||
deploy: |
|||
resources: |
|||
limits: |
|||
cpus: '0.1' |
|||
memory: 250M |
@ -0,0 +1,272 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<version>0.0.6</version> |
|||
|
|||
<parent> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-ext</artifactId> |
|||
<version>2.0.0</version> |
|||
</parent> |
|||
|
|||
<artifactId>epmet-ext-server</artifactId> |
|||
<packaging>jar</packaging> |
|||
|
|||
<properties> |
|||
<aliyun.core.version>3.2.2</aliyun.core.version> |
|||
<aliyun.dysmsapi.version>1.1.0</aliyun.dysmsapi.version> |
|||
<qcloud.qcloudsms.version>1.0.5</qcloud.qcloudsms.version> |
|||
<freemarker.version>2.3.28</freemarker.version> |
|||
</properties> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-ext-client</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-commons-extapp-auth</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-commons-tools</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-user-client</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>gov-org-client</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-commons-mybatis</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-web</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework</groupId> |
|||
<artifactId>spring-context-support</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-actuator</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.alibaba.cloud</groupId> |
|||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.alibaba.cloud</groupId> |
|||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.aliyun</groupId> |
|||
<artifactId>aliyun-java-sdk-core</artifactId> |
|||
<version>${aliyun.core.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.aliyun</groupId> |
|||
<artifactId>aliyun-java-sdk-dysmsapi</artifactId> |
|||
<version>${aliyun.dysmsapi.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.github.qcloudsms</groupId> |
|||
<artifactId>qcloudsms</artifactId> |
|||
<version>${qcloud.qcloudsms.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.sun.mail</groupId> |
|||
<artifactId>javax.mail</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.freemarker</groupId> |
|||
<artifactId>freemarker</artifactId> |
|||
<version>${freemarker.version}</version> |
|||
</dependency> |
|||
<!-- 替换Feign原生httpclient --> |
|||
<dependency> |
|||
<groupId>io.github.openfeign</groupId> |
|||
<artifactId>feign-httpclient</artifactId> |
|||
<version>10.3.0</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.flywaydb</groupId> |
|||
<artifactId>flyway-core</artifactId> |
|||
<!--<version>5.1.1</version>--> |
|||
</dependency> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp --> |
|||
<dependency> |
|||
<groupId>com.squareup.okhttp3</groupId> |
|||
<artifactId>okhttp</artifactId> |
|||
<version>4.0.0</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-test</artifactId> |
|||
<scope>test</scope> |
|||
<exclusions> |
|||
<exclusion> |
|||
<groupId>org.junit.vintage</groupId> |
|||
<artifactId>junit-vintage-engine</artifactId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.dom4j</groupId> |
|||
<artifactId>dom4j</artifactId> |
|||
<version>2.1.3</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.github.binarywang</groupId> |
|||
<artifactId>weixin-java-common</artifactId> |
|||
<version>3.6.0</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework</groupId> |
|||
<artifactId>spring-test</artifactId> |
|||
<version>5.1.12.RELEASE</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
<build> |
|||
<finalName>${project.artifactId}</finalName> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-maven-plugin</artifactId> |
|||
</plugin> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-surefire-plugin</artifactId> |
|||
<configuration> |
|||
<skipTests>true</skipTests> |
|||
</configuration> |
|||
</plugin> |
|||
</plugins> |
|||
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory> |
|||
<resources> |
|||
<resource> |
|||
<filtering>true</filtering> |
|||
<directory>${basedir}/src/main/resources</directory> |
|||
</resource> |
|||
</resources> |
|||
</build> |
|||
<profiles> |
|||
<profile> |
|||
<id>dev</id> |
|||
<activation> |
|||
<activeByDefault>true</activeByDefault> |
|||
</activation> |
|||
<properties> |
|||
<server.port>8113</server.port> |
|||
<spring.profiles.active>dev</spring.profiles.active> |
|||
|
|||
<!-- 数据库配置--> |
|||
<spring.datasource.druid.url> |
|||
<![CDATA[jdbc:mysql://192.168.1.130:3306/epmet_third?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
|||
</spring.datasource.druid.url> |
|||
<spring.datasource.druid.username>epmet_third_user</spring.datasource.druid.username> |
|||
<spring.datasource.druid.password>EpmEt-db-UsEr</spring.datasource.druid.password> |
|||
<!-- redis配置 --> |
|||
<spring.redis.index>0</spring.redis.index> |
|||
<spring.redis.host>192.168.1.130</spring.redis.host> |
|||
<spring.redis.port>6379</spring.redis.port> |
|||
<spring.redis.password>123456</spring.redis.password> |
|||
<!-- nacos --> |
|||
<nacos.register-enabled>true</nacos.register-enabled> |
|||
<nacos.server-addr>122.152.200.70:8848</nacos.server-addr> |
|||
<nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace> |
|||
<nacos.config.namespace></nacos.config.namespace> |
|||
<nacos.config.group></nacos.config.group> |
|||
<nacos.config-enabled>false</nacos.config-enabled> |
|||
<nacos.ip/> |
|||
|
|||
<spring.flyway.enabled>false</spring.flyway.enabled> |
|||
</properties> |
|||
</profile> |
|||
<profile> |
|||
<id>test</id> |
|||
<!--<activation> |
|||
<activeByDefault>true</activeByDefault> |
|||
</activation>--> |
|||
<properties> |
|||
<server.port>8113</server.port> |
|||
<spring.profiles.active>test</spring.profiles.active> |
|||
|
|||
<!-- 数据库配置--> |
|||
<spring.datasource.druid.url> |
|||
<![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_third?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
|||
</spring.datasource.druid.url> |
|||
<spring.datasource.druid.username>epmet</spring.datasource.druid.username> |
|||
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password> |
|||
<!-- redis配置 --> |
|||
<spring.redis.index>0</spring.redis.index> |
|||
<spring.redis.host>r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com</spring.redis.host> |
|||
<spring.redis.port>6379</spring.redis.port> |
|||
<spring.redis.password>EpmEtrEdIs!q@w</spring.redis.password> |
|||
<!-- nacos --> |
|||
<nacos.register-enabled>true</nacos.register-enabled> |
|||
<nacos.server-addr>192.168.10.150:8848</nacos.server-addr> |
|||
<nacos.discovery.namespace>67e3c350-533e-4d7c-9f8f-faf1b4aa82ae</nacos.discovery.namespace> |
|||
<nacos.config.namespace></nacos.config.namespace> |
|||
<nacos.config.group></nacos.config.group> |
|||
<nacos.config-enabled>false</nacos.config-enabled> |
|||
<nacos.ip/> |
|||
|
|||
<spring.flyway.enabled>true</spring.flyway.enabled> |
|||
</properties> |
|||
</profile> |
|||
|
|||
<profile> |
|||
<id>prod</id> |
|||
<!--<activation> |
|||
<activeByDefault>true</activeByDefault> |
|||
</activation>--> |
|||
<properties> |
|||
<server.port>8113</server.port> |
|||
<spring.profiles.active>prod</spring.profiles.active> |
|||
|
|||
<!-- 数据库配置--> |
|||
<spring.datasource.druid.url> |
|||
<![CDATA[jdbc:mysql://rm-m5e3vzs2637224wj9.mysql.rds.aliyuncs.com:3306/epmet_third?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
|||
</spring.datasource.druid.url> |
|||
<spring.datasource.druid.username>epmet_third_user</spring.datasource.druid.username> |
|||
<spring.datasource.druid.password>EpmEt-db-UsEr</spring.datasource.druid.password> |
|||
<!-- redis配置 --> |
|||
<spring.redis.index>0</spring.redis.index> |
|||
<spring.redis.host>r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com</spring.redis.host> |
|||
<spring.redis.port>6379</spring.redis.port> |
|||
<spring.redis.password>EpmEtclOUdrEdIs!Q2w</spring.redis.password> |
|||
<!-- nacos --> |
|||
<nacos.register-enabled>true</nacos.register-enabled> |
|||
<nacos.server-addr>192.168.11.180:8848</nacos.server-addr> |
|||
<nacos.discovery.namespace>bd205d23-e696-47be-b995-916313f86e99</nacos.discovery.namespace> |
|||
<nacos.config.namespace></nacos.config.namespace> |
|||
<nacos.config.group></nacos.config.group> |
|||
<nacos.config-enabled>false</nacos.config-enabled> |
|||
<nacos.ip/> |
|||
|
|||
<spring.flyway.enabled>true</spring.flyway.enabled> |
|||
</properties> |
|||
</profile> |
|||
</profiles> |
|||
|
|||
</project> |
@ -0,0 +1,17 @@ |
|||
package com.epmet; |
|||
|
|||
import org.springframework.boot.SpringApplication; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
|||
import org.springframework.cloud.openfeign.EnableFeignClients; |
|||
|
|||
@SpringBootApplication |
|||
@EnableDiscoveryClient |
|||
@EnableFeignClients |
|||
public class EpmetExtApplication { |
|||
|
|||
public static void main(String[] args) { |
|||
SpringApplication.run(EpmetExtApplication.class, args); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.epmet.aspect; |
|||
|
|||
import com.epmet.commons.tools.aspect.BaseRequestLogAspect; |
|||
import org.aspectj.lang.ProceedingJoinPoint; |
|||
import org.aspectj.lang.annotation.Around; |
|||
import org.aspectj.lang.annotation.Aspect; |
|||
import org.springframework.core.annotation.Order; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.web.context.request.RequestAttributes; |
|||
import org.springframework.web.context.request.RequestContextHolder; |
|||
import org.springframework.web.context.request.ServletRequestAttributes; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 |
|||
*/ |
|||
@Aspect |
|||
@Component |
|||
@Order(0) |
|||
public class RequestLogAspect extends BaseRequestLogAspect { |
|||
|
|||
@Override |
|||
@Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") |
|||
public Object proceed(ProceedingJoinPoint point) throws Throwable { |
|||
return super.proceed(point, getRequest()); |
|||
} |
|||
|
|||
/** |
|||
* 获取Request对象 |
|||
* |
|||
* @return |
|||
*/ |
|||
private HttpServletRequest getRequest() { |
|||
RequestAttributes ra = RequestContextHolder.getRequestAttributes(); |
|||
ServletRequestAttributes sra = (ServletRequestAttributes) ra; |
|||
return sra.getRequest(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.config; |
|||
|
|||
import com.epmet.commons.tools.config.ModuleConfig; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* 模块配置信息 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Service |
|||
public class ModuleConfigImpl implements ModuleConfig { |
|||
@Override |
|||
public String getName() { |
|||
return "epmetext"; |
|||
} |
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.epmet.constant; |
|||
|
|||
/** |
|||
* @Description |
|||
* @author zxc |
|||
*/ |
|||
public interface ModuleConstant { |
|||
|
|||
String ERROR_GOV_ORG_GRID = "调用gov_org服务查询【网格】下的所有工作人员失败"; |
|||
|
|||
String ERROR_GOV_ORG_DEPARTMENT = "调用gov_org服务查询【部门】下的所有工作人员失败"; |
|||
|
|||
String ERROR_GOV_ORG_AGENCY = "调用gov_org服务查询【机关】下的所有工作人员失败"; |
|||
|
|||
String ERROR_EPMET_USER = "调用epmet_user服务查询网格下的所有工作人员失败"; |
|||
|
|||
} |
@ -0,0 +1,105 @@ |
|||
package com.epmet.controller; |
|||
|
|||
|
|||
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; |
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.*; |
|||
import com.epmet.dto.result.*; |
|||
import com.epmet.feign.EpmetUserOpenFeignClient; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.service.OpenUpService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:16 上午 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("staff") |
|||
public class OpenUpController { |
|||
|
|||
@Autowired |
|||
private OpenUpService openUpService; |
|||
@Autowired |
|||
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|||
@Autowired |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
|
|||
/** |
|||
* @Description 网格工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/13 9:42 上午 |
|||
*/ |
|||
@ExternalAppRequestAuth |
|||
@PostMapping("staffsingrid") |
|||
public Result<List<StaffSinGridResultDTO>> staffSinGrid(@RequestBody StaffSinGridFormDTO formDTO){ |
|||
ValidatorUtils.validateEntity(formDTO, StaffSinGridFormDTO.StaffSinGrid.class); |
|||
return new Result<List<StaffSinGridResultDTO>>().ok(openUpService.staffSinGrid(formDTO)); |
|||
} |
|||
|
|||
/** |
|||
* @Description 部门工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/13 9:51 上午 |
|||
*/ |
|||
@ExternalAppRequestAuth |
|||
@PostMapping("staffsindept") |
|||
public Result<List<StaffSinDeptResultDTO>> staffSinDept(@RequestBody StaffSinDeptFormDTO formDTO){ |
|||
ValidatorUtils.validateEntity(formDTO, StaffSinDeptFormDTO.StaffSinDept.class); |
|||
return new Result<List<StaffSinDeptResultDTO>>().ok(openUpService.staffSinDept(formDTO)); |
|||
} |
|||
|
|||
/** |
|||
* @Description 机关工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/17 9:59 上午 |
|||
*/ |
|||
@ExternalAppRequestAuth |
|||
@PostMapping("staffsinagency") |
|||
public Result<List<StaffSinAgencyResultDTO>> staffSinAgency(@RequestBody StaffSinAgencyFormDTO formDTO){ |
|||
ValidatorUtils.validateEntity(formDTO, StaffSinAgencyFormDTO.StaffSinAgency.class); |
|||
return new Result<List<StaffSinAgencyResultDTO>>().ok(openUpService.staffSinAgency(formDTO)); |
|||
} |
|||
|
|||
/** |
|||
* @Description 查找工作人员的信息 |
|||
* @param |
|||
* @return |
|||
* @author wangc |
|||
* @date 2020.08.17 10:30 |
|||
**/ |
|||
@ExternalAppRequestAuth |
|||
@PostMapping("staffinfo") |
|||
public Result<ExtStaffInfoResultDTO> staffInfo(@LoginUser TokenDto token){ |
|||
CommonStaffIdFormDTO commonStaffIdFormDTO = new CommonStaffIdFormDTO(); |
|||
commonStaffIdFormDTO.setStaffId(token.getUserId()); |
|||
ValidatorUtils.validateEntity(commonStaffIdFormDTO, CommonStaffIdFormDTO.StaffIdGroup.class); |
|||
return epmetUserOpenFeignClient.extStaffInfo(commonStaffIdFormDTO); |
|||
} |
|||
|
|||
/** |
|||
* @Description 根据staffId,查询当前这个用户的数据权限 |
|||
* @param |
|||
* @return |
|||
* @author wangc |
|||
* @date 2020.08.17 17:30 |
|||
**/ |
|||
@ExternalAppRequestAuth |
|||
@PostMapping("permission") |
|||
Result<ExtStaffPermissionResultDTO> staffPermissionExt(@RequestBody CommonStaffIdFormDTO commonStaffIdFormDTO){ |
|||
ValidatorUtils.validateEntity(commonStaffIdFormDTO, CommonStaffIdFormDTO.StaffIdGroup.class); |
|||
return govOrgOpenFeignClient.staffPermissionExt(commonStaffIdFormDTO.getStaffId()); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,44 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; |
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.CommonUserIdFormDTO; |
|||
import com.epmet.dto.result.ExtUserInfoResultDTO; |
|||
import com.epmet.feign.EpmetUserOpenFeignClient; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName OpenUpUserController |
|||
* @Auth wangc |
|||
* @Date 2020-08-21 17:56 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("user") |
|||
public class OpenUpUserController { |
|||
|
|||
@Autowired |
|||
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|||
|
|||
/** |
|||
* @Description 查找当前用户的信息 |
|||
* @param |
|||
* @return |
|||
* @author wangc |
|||
* @date 2020.08.17 10:30 |
|||
**/ |
|||
@ExternalAppRequestAuth |
|||
@PostMapping("userinfo") |
|||
Result<ExtUserInfoResultDTO> userInfo(@LoginUser TokenDto token){ |
|||
CommonUserIdFormDTO userParam = new CommonUserIdFormDTO(); |
|||
userParam.setUserId(token.getUserId()); |
|||
ValidatorUtils.validateEntity(userParam, CommonUserIdFormDTO.CommonUserIdGroup.class); |
|||
return epmetUserOpenFeignClient.extUserInfo(userParam); |
|||
} |
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.dto.form.StaffSinAgencyFormDTO; |
|||
import com.epmet.dto.form.StaffSinDeptFormDTO; |
|||
import com.epmet.dto.form.StaffSinGridFormDTO; |
|||
import com.epmet.dto.result.StaffSinAgencyResultDTO; |
|||
import com.epmet.dto.result.StaffSinDeptResultDTO; |
|||
import com.epmet.dto.result.StaffSinGridResultDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:17 上午 |
|||
*/ |
|||
public interface OpenUpService { |
|||
|
|||
/** |
|||
* @Description 网格工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/13 9:42 上午 |
|||
*/ |
|||
List<StaffSinGridResultDTO> staffSinGrid(StaffSinGridFormDTO formDTO); |
|||
|
|||
/** |
|||
* @Description 部门工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/13 9:51 上午 |
|||
*/ |
|||
List<StaffSinDeptResultDTO> staffSinDept(StaffSinDeptFormDTO formDTO); |
|||
|
|||
/** |
|||
* @Description 机关工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/17 9:59 上午 |
|||
*/ |
|||
List<StaffSinAgencyResultDTO> staffSinAgency(StaffSinAgencyFormDTO formDTO); |
|||
} |
@ -0,0 +1,126 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.constant.StrConstant; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.constant.ModuleConstant; |
|||
import com.epmet.dto.form.*; |
|||
import com.epmet.dto.result.StaffSinAgencyResultDTO; |
|||
import com.epmet.dto.result.StaffSinDeptResultDTO; |
|||
import com.epmet.dto.result.StaffSinGridResultDTO; |
|||
import com.epmet.feign.EpmetUserOpenFeignClient; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.service.OpenUpService; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:18 上午 |
|||
*/ |
|||
@Service |
|||
public class OpenUpServiceImpl implements OpenUpService { |
|||
|
|||
@Autowired |
|||
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|||
@Autowired |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
|
|||
/** |
|||
* @Description 网格工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/13 9:42 上午 |
|||
*/ |
|||
@Override |
|||
public List<StaffSinGridResultDTO> staffSinGrid(StaffSinGridFormDTO formDTO) { |
|||
CommonGridIdFormDTO commonGridId = new CommonGridIdFormDTO(); |
|||
commonGridId.setGridId(formDTO.getGridId()); |
|||
commonGridId.setUserId(UUID.randomUUID().toString().replace(StrConstant.HYPHEN, "")); |
|||
Result<List<String>> gridStaffs = govOrgOpenFeignClient.getGridStaffs(commonGridId); |
|||
if (!gridStaffs.success()){ |
|||
throw new RenException(ModuleConstant.ERROR_GOV_ORG_GRID); |
|||
} |
|||
if (gridStaffs.getData().size() == NumConstant.ZERO){ |
|||
return new ArrayList<>(); |
|||
} |
|||
return this.getStaffList(gridStaffs.getData()); |
|||
} |
|||
|
|||
/** |
|||
* @Description 部门工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/13 9:51 上午 |
|||
*/ |
|||
@Override |
|||
public List<StaffSinDeptResultDTO> staffSinDept(StaffSinDeptFormDTO formDTO) { |
|||
DepartmentIdFormDTO departmentId = new DepartmentIdFormDTO(); |
|||
departmentId.setDepartmentId(formDTO.getDepartmentId()); |
|||
Result<List<String>> departmentStaffs = govOrgOpenFeignClient.getDepartmentStaffs(departmentId); |
|||
if (!departmentStaffs.success()){ |
|||
throw new RenException(ModuleConstant.ERROR_GOV_ORG_DEPARTMENT); |
|||
} |
|||
if (departmentStaffs.getData().size() == NumConstant.ZERO){ |
|||
return new ArrayList<>(); |
|||
} |
|||
List<StaffSinGridResultDTO> data = this.getStaffList(departmentStaffs.getData()); |
|||
List<StaffSinDeptResultDTO> result = new ArrayList<>(); |
|||
data.forEach(staff -> { |
|||
StaffSinDeptResultDTO dept = new StaffSinDeptResultDTO(); |
|||
BeanUtils.copyProperties(staff,dept); |
|||
result.add(dept); |
|||
}); |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* @Description 机关工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/17 9:59 上午 |
|||
*/ |
|||
@Override |
|||
public List<StaffSinAgencyResultDTO> staffSinAgency(StaffSinAgencyFormDTO formDTO) { |
|||
AgencyIdFormDTO agencyId = new AgencyIdFormDTO(); |
|||
agencyId.setAgencyId(formDTO.getAgencyId()); |
|||
Result<List<String>> agencyStaffs = govOrgOpenFeignClient.getAgencyStaffs(agencyId); |
|||
if (!agencyStaffs.success()){ |
|||
throw new RenException(ModuleConstant.ERROR_GOV_ORG_AGENCY); |
|||
} |
|||
if (agencyStaffs.getData().size() == NumConstant.ZERO){ |
|||
return new ArrayList<>(); |
|||
} |
|||
List<StaffSinGridResultDTO> staffList = this.getStaffList(agencyStaffs.getData()); |
|||
List<StaffSinAgencyResultDTO> result = new ArrayList<>(); |
|||
staffList.forEach(staff -> { |
|||
StaffSinAgencyResultDTO agency = new StaffSinAgencyResultDTO(); |
|||
BeanUtils.copyProperties(staff,agency); |
|||
result.add(agency); |
|||
}); |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* @Description 获取工作人员信息 |
|||
* @param userIds |
|||
* @author zxc |
|||
* @date 2020/8/17 1:30 下午 |
|||
*/ |
|||
public List<StaffSinGridResultDTO> getStaffList(List<String> userIds){ |
|||
UserIdsFormDTO userIdsForm = new UserIdsFormDTO(); |
|||
userIdsForm.setUserIds(userIds); |
|||
Result<List<StaffSinGridResultDTO>> staffInfoList = epmetUserOpenFeignClient.getStaffInfoList(userIdsForm); |
|||
if (!staffInfoList.success()){ |
|||
throw new RenException(ModuleConstant.ERROR_EPMET_USER); |
|||
} |
|||
return staffInfoList.getData(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,100 @@ |
|||
server: |
|||
port: @server.port@ |
|||
servlet: |
|||
context-path: /epmet/ext |
|||
|
|||
spring: |
|||
main: |
|||
allow-bean-definition-overriding: true |
|||
application: |
|||
name: epmet-ext-server |
|||
# dev|test|prod |
|||
profiles: |
|||
active: dev |
|||
jackson: |
|||
time-zone: GMT+8 |
|||
date-format: yyyy-MM-dd HH:mm:ss |
|||
redis: |
|||
database: @spring.redis.index@ |
|||
host: @spring.redis.host@ |
|||
port: @spring.redis.port@ |
|||
password: @spring.redis.password@ |
|||
timeout: 30s |
|||
datasource: |
|||
druid: |
|||
#MySQL |
|||
driver-class-name: com.mysql.cj.jdbc.Driver |
|||
url: @spring.datasource.druid.url@ |
|||
username: @spring.datasource.druid.username@ |
|||
password: @spring.datasource.druid.password@ |
|||
cloud: |
|||
nacos: |
|||
discovery: |
|||
server-addr: @nacos.server-addr@ |
|||
namespace: @nacos.discovery.namespace@ |
|||
register-enabled: @nacos.register-enabled@ |
|||
ip: @nacos.ip@ |
|||
config: |
|||
enabled: @nacos.config-enabled@ |
|||
server-addr: @nacos.server-addr@ |
|||
namespace: @nacos.config.namespace@ |
|||
group: @nacos.config.group@ |
|||
file-extension: yaml |
|||
flyway: |
|||
enabled: @spring.flyway.enabled@ |
|||
locations: classpath:db/migration |
|||
url: @spring.datasource.druid.url@ |
|||
user: @spring.datasource.druid.username@ |
|||
password: @spring.datasource.druid.password@ |
|||
baseline-on-migrate: true |
|||
baseline-version: 0 |
|||
management: |
|||
endpoints: |
|||
web: |
|||
exposure: |
|||
include: "*" |
|||
endpoint: |
|||
health: |
|||
show-details: ALWAYS |
|||
|
|||
mybatis-plus: |
|||
mapper-locations: classpath:/mapper/**/*.xml |
|||
typeAliasesPackage: com.epmet.entity |
|||
global-config: |
|||
db-config: |
|||
id-type: ID_WORKER |
|||
field-strategy: NOT_NULL |
|||
column-underline: true |
|||
banner: false |
|||
|
|||
configuration: |
|||
map-underscore-to-camel-case: true |
|||
cache-enabled: false |
|||
call-setters-on-nulls: true |
|||
jdbc-type-for-null: 'null' |
|||
|
|||
feign: |
|||
hystrix: |
|||
enabled: true |
|||
client: |
|||
config: |
|||
default: |
|||
loggerLevel: BASIC |
|||
httpclient: |
|||
enabled: true |
|||
|
|||
hystrix: |
|||
command: |
|||
default: |
|||
execution: |
|||
isolation: |
|||
thread: |
|||
timeoutInMilliseconds: 60000 |
|||
|
|||
ribbon: |
|||
ReadTimeout: 300000 |
|||
ConnectTimeout: 300000 |
|||
|
|||
pagehelper: |
|||
helper-dialect: mysql |
|||
reasonable: false |
@ -0,0 +1 @@ |
|||
select 0; |
@ -0,0 +1,164 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<configuration> |
|||
<include resource="org/springframework/boot/logging/logback/base.xml"/> |
|||
|
|||
<property name="log.path" value="logs/ext"/> |
|||
|
|||
<springProperty scope="context" name="appname" source="spring.application.name"/> |
|||
|
|||
<!-- 日志上下文名称 --> |
|||
<contextName>${appname}</contextName> |
|||
|
|||
<!-- 彩色日志格式 --> |
|||
<property name="CONSOLE_LOG_PATTERN" |
|||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
|||
|
|||
<!--1. 输出到控制台--> |
|||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
|||
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> |
|||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
|||
<level>debug</level> |
|||
</filter> |
|||
<encoder> |
|||
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern> |
|||
<!-- 设置字符集 --> |
|||
<charset>UTF-8</charset> |
|||
</encoder> |
|||
</appender> |
|||
|
|||
<!--2. 输出到文档--> |
|||
<!-- 2.1 level为 DEBUG 日志,时间滚动输出 --> |
|||
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<!-- 正在记录的日志文档的路径及文档名 --> |
|||
<file>${log.path}/debug.log</file> |
|||
<!--日志文档输出格式--> |
|||
<encoder> |
|||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern> |
|||
<charset>UTF-8</charset> <!-- 设置字符集 --> |
|||
</encoder> |
|||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<!-- 日志归档 --> |
|||
<fileNamePattern>${log.path}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
|||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
|||
<maxFileSize>100MB</maxFileSize> |
|||
</timeBasedFileNamingAndTriggeringPolicy> |
|||
<!--日志文档保留天数--> |
|||
<maxHistory>15</maxHistory> |
|||
</rollingPolicy> |
|||
<!-- 此日志文档只记录debug级别的 --> |
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
|||
<level>debug</level> |
|||
<onMatch>ACCEPT</onMatch> |
|||
<onMismatch>DENY</onMismatch> |
|||
</filter> |
|||
</appender> |
|||
|
|||
<!-- 2.2 level为 INFO 日志,时间滚动输出 --> |
|||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<!-- 正在记录的日志文档的路径及文档名 --> |
|||
<file>${log.path}/info.log</file> |
|||
<!--日志文档输出格式--> |
|||
<encoder> |
|||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern> |
|||
<charset>UTF-8</charset> |
|||
</encoder> |
|||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<!-- 每天日志归档路径以及格式 --> |
|||
<fileNamePattern>${log.path}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
|||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
|||
<maxFileSize>100MB</maxFileSize> |
|||
</timeBasedFileNamingAndTriggeringPolicy> |
|||
<!--日志文档保留天数--> |
|||
<maxHistory>15</maxHistory> |
|||
</rollingPolicy> |
|||
<!-- 此日志文档只记录info级别的 --> |
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
|||
<level>info</level> |
|||
<onMatch>ACCEPT</onMatch> |
|||
<onMismatch>DENY</onMismatch> |
|||
</filter> |
|||
</appender> |
|||
|
|||
<!-- 2.3 level为 WARN 日志,时间滚动输出 --> |
|||
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<!-- 正在记录的日志文档的路径及文档名 --> |
|||
<file>${log.path}/warn.log</file> |
|||
<!--日志文档输出格式--> |
|||
<encoder> |
|||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern> |
|||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
|||
</encoder> |
|||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<fileNamePattern>${log.path}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
|||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
|||
<maxFileSize>100MB</maxFileSize> |
|||
</timeBasedFileNamingAndTriggeringPolicy> |
|||
<!--日志文档保留天数--> |
|||
<maxHistory>15</maxHistory> |
|||
</rollingPolicy> |
|||
<!-- 此日志文档只记录warn级别的 --> |
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
|||
<level>warn</level> |
|||
<onMatch>ACCEPT</onMatch> |
|||
<onMismatch>DENY</onMismatch> |
|||
</filter> |
|||
</appender> |
|||
|
|||
<!-- 2.4 level为 ERROR 日志,时间滚动输出 --> |
|||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<!-- 正在记录的日志文档的路径及文档名 --> |
|||
<file>${log.path}/error.log</file> |
|||
<!--日志文档输出格式--> |
|||
<encoder> |
|||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern> |
|||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
|||
</encoder> |
|||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<fileNamePattern>${log.path}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
|||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
|||
<maxFileSize>100MB</maxFileSize> |
|||
</timeBasedFileNamingAndTriggeringPolicy> |
|||
<!--日志文档保留天数--> |
|||
<maxHistory>15</maxHistory> |
|||
</rollingPolicy> |
|||
<!-- 此日志文档只记录ERROR级别的 --> |
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
|||
<level>ERROR</level> |
|||
<onMatch>ACCEPT</onMatch> |
|||
<onMismatch>DENY</onMismatch> |
|||
</filter> |
|||
</appender> |
|||
|
|||
<!-- 开发、测试环境 --> |
|||
<springProfile name="dev,test"> |
|||
<logger name="org.springframework.web" level="INFO"/> |
|||
<logger name="org.springboot.sample" level="INFO"/> |
|||
<logger name="com.epmet.dao" level="INFO"/> |
|||
<logger name="com.epmet.dao" level="DEBUG"/> |
|||
<root level="INFO"> |
|||
<appender-ref ref="DEBUG_FILE"/> |
|||
<appender-ref ref="INFO_FILE"/> |
|||
<appender-ref ref="WARN_FILE"/> |
|||
<appender-ref ref="ERROR_FILE"/> |
|||
</root> |
|||
</springProfile> |
|||
|
|||
<!-- 生产环境 --> |
|||
<springProfile name="prod"> |
|||
<logger name="org.springframework.web" level="INFO"/> |
|||
<logger name="org.springboot.sample" level="INFO"/> |
|||
<logger name="com.epmet.dao" level="INFO"/> |
|||
<root level="INFO"> |
|||
<appender-ref ref="CONSOLE"/> |
|||
<appender-ref ref="DEBUG_FILE"/> |
|||
<appender-ref ref="INFO_FILE"/> |
|||
<appender-ref ref="WARN_FILE"/> |
|||
<appender-ref ref="ERROR_FILE"/> |
|||
</root> |
|||
</springProfile> |
|||
|
|||
</configuration> |
@ -0,0 +1,21 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<parent> |
|||
<artifactId>epmet-module</artifactId> |
|||
<groupId>com.epmet</groupId> |
|||
<version>2.0.0</version> |
|||
</parent> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<artifactId>epmet-ext</artifactId> |
|||
<packaging>pom</packaging> |
|||
|
|||
<modules> |
|||
<module>epmet-ext-client</module> |
|||
<module>epmet-ext-server</module> |
|||
</modules> |
|||
|
|||
|
|||
</project> |
@ -0,0 +1,29 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/24 10:03 上午 |
|||
*/ |
|||
@Data |
|||
public class CustomerAccessTokenInfoFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 6514918025012507710L; |
|||
|
|||
public interface CustomerAccessTokenInfo{} |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
@NotBlank(message = "客户ID不能为空",groups = {CustomerAccessTokenInfo.class}) |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 客户端类型 |
|||
*/ |
|||
private String clientType; |
|||
} |
@ -0,0 +1,45 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.google.gson.annotations.SerializedName; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/8/20 13:44 |
|||
*/ |
|||
@Data |
|||
public class ModifyDomainFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -1995778975498383130L; |
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
/** |
|||
* 客户端类型 |
|||
*/ |
|||
private String clientType; |
|||
/** |
|||
* 操作类型:add 添加,delete 删除,set 覆盖 |
|||
*/ |
|||
private String action; |
|||
/** |
|||
* request 合法域名 |
|||
*/ |
|||
private List<String> requestDomain; |
|||
/** |
|||
* socket 合法域名 |
|||
*/ |
|||
private List<String> wsRequestDomain; |
|||
/** |
|||
* uploadFile 合法域名 |
|||
*/ |
|||
private List<String> uploadDomain; |
|||
/** |
|||
* downloadFile 合法域名 |
|||
*/ |
|||
private List<String> downloadDomain; |
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/8/19 17:46 |
|||
*/ |
|||
@Data |
|||
public class WebviewDomainFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 8022056850984848597L; |
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
/** |
|||
* 客户端类型 |
|||
*/ |
|||
private String clientType; |
|||
/** |
|||
* 操作类型:add 添加,delete 删除,set 覆盖 |
|||
*/ |
|||
private String action; |
|||
/** |
|||
* 业务域名 |
|||
*/ |
|||
private List<String> webViewDomain; |
|||
} |
@ -0,0 +1,56 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/24 10:08 上午 |
|||
*/ |
|||
@Data |
|||
public class CustomerAccessTokenInfoResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 7008455455787166150L; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
*/ |
|||
private String customerName; |
|||
|
|||
/** |
|||
* 环境类型 |
|||
*/ |
|||
private String source; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 授权方AppId |
|||
*/ |
|||
private String authAppId; |
|||
|
|||
/** |
|||
* 授权方的 accessToken |
|||
*/ |
|||
private String authorizerAccessToken; |
|||
|
|||
/** |
|||
* 授权方的 refreshToken |
|||
*/ |
|||
private String authorizerRefreshToken; |
|||
|
|||
/** |
|||
* accessToken过期事件 |
|||
*/ |
|||
private String expiresInTime; |
|||
|
|||
/** |
|||
* 客户端类型 |
|||
*/ |
|||
private String clientType; |
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.form.ModifyDomainFormDTO; |
|||
import com.epmet.dto.form.WebviewDomainFormDTO; |
|||
import com.epmet.service.SettingService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
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.RestController; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/8/20 13:50 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("setting") |
|||
public class SettingController { |
|||
@Autowired |
|||
private SettingService settingService; |
|||
|
|||
/** |
|||
* 设置服务器域名 |
|||
* |
|||
* @param formDTO |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @author zhaoqifeng |
|||
* @date 2020/8/20 13:51 |
|||
*/ |
|||
@PostMapping("modifydomain") |
|||
public Result modifyDomain(@RequestBody ModifyDomainFormDTO formDTO) { |
|||
settingService.modifyDomain(formDTO); |
|||
return new Result<>(); |
|||
} |
|||
|
|||
/** |
|||
* 设置业务域名 |
|||
* |
|||
* @param formDTO |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @author zhaoqifeng |
|||
* @date 2020/8/20 13:51 |
|||
*/ |
|||
@PostMapping("setwebviewdomain") |
|||
public Result setWebviewDomain(@RequestBody WebviewDomainFormDTO formDTO) { |
|||
settingService.setWebviewDomain(formDTO); |
|||
return new Result<>(); |
|||
} |
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.dto.form.ModifyDomainFormDTO; |
|||
import com.epmet.dto.form.WebviewDomainFormDTO; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/8/20 11:11 |
|||
*/ |
|||
public interface SettingService { |
|||
/** |
|||
* 设置服务器域名 |
|||
* |
|||
* @param formDTO |
|||
* @return void |
|||
* @author zhaoqifeng |
|||
* @date 2020/8/20 13:46 |
|||
*/ |
|||
void modifyDomain(ModifyDomainFormDTO formDTO); |
|||
|
|||
/** |
|||
* 设置业务域名 |
|||
* |
|||
* @param formDTO |
|||
* @return void |
|||
* @author zhaoqifeng |
|||
* @date 2020/8/19 17:49 |
|||
*/ |
|||
void setWebviewDomain(WebviewDomainFormDTO formDTO); |
|||
} |
@ -0,0 +1,64 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.dao.AuthorizationInfoDao; |
|||
import com.epmet.dto.AuthorizationInfoDTO; |
|||
import com.epmet.dto.form.ModifyDomainFormDTO; |
|||
import com.epmet.dto.form.WebviewDomainFormDTO; |
|||
import com.epmet.service.SettingService; |
|||
import com.epmet.wxapi.param.WxMaModifyDomainReq; |
|||
import com.epmet.wxapi.param.WxMaSetWebviewDomainReq; |
|||
import com.epmet.wxapi.result.WxResult; |
|||
import com.epmet.wxapi.service.WxMaSettingService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/8/20 11:11 |
|||
*/ |
|||
@Service |
|||
public class SettingServiceImpl implements SettingService { |
|||
@Autowired |
|||
private AuthorizationInfoDao authorizationInfoDao; |
|||
@Autowired |
|||
private WxMaSettingService wxMaSettingService; |
|||
|
|||
@Override |
|||
public void modifyDomain(ModifyDomainFormDTO formDTO) { |
|||
//获取小程序调用令牌
|
|||
AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); |
|||
if (null == authInfo) { |
|||
throw new RenException("未授权"); |
|||
} |
|||
WxMaModifyDomainReq request = new WxMaModifyDomainReq(); |
|||
request.setAction(formDTO.getAction()); |
|||
request.setDownloadDomain(formDTO.getDownloadDomain()); |
|||
request.setRequestDomain(formDTO.getRequestDomain()); |
|||
request.setWsRequestDomain(formDTO.getWsRequestDomain()); |
|||
request.setUploadDomain(formDTO.getUploadDomain()); |
|||
//设置业务域名
|
|||
WxResult setDomain = wxMaSettingService.modifyDomain(authInfo.getAuthorizerAccessToken(), request); |
|||
if (!setDomain.success()) { |
|||
throw new RenException(setDomain.getErrorCode(), setDomain.getErrorMsg()); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void setWebviewDomain(WebviewDomainFormDTO formDTO) { |
|||
//获取小程序调用令牌
|
|||
AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); |
|||
if (null == authInfo) { |
|||
throw new RenException("未授权"); |
|||
} |
|||
WxMaSetWebviewDomainReq request = new WxMaSetWebviewDomainReq(); |
|||
request.setAction(formDTO.getAction()); |
|||
request.setWebViewDomain(formDTO.getWebViewDomain()); |
|||
//设置业务域名
|
|||
WxResult setWebviewDomain = wxMaSettingService.setWebviewDomain(authInfo.getAuthorizerAccessToken(), request); |
|||
if (!setWebviewDomain.success()) { |
|||
throw new RenException(setWebviewDomain.getErrorCode(), setWebviewDomain.getErrorMsg()); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,63 @@ |
|||
package com.epmet.wxapi.constant; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/8/18 13:59 |
|||
*/ |
|||
public interface WxMaSettingConstant { |
|||
/** |
|||
* 设置服务器域名 |
|||
*/ |
|||
String MODIFY_DOMAIN_URL = "https://api.weixin.qq.com/wxa/modify_domain"; |
|||
|
|||
/** |
|||
* 设置业务域名 |
|||
*/ |
|||
String SET_WEBVIEW_DOMAIN_URL = "https://api.weixin.qq.com/wxa/setwebviewdomain"; |
|||
|
|||
/** |
|||
* 设置名称 |
|||
*/ |
|||
String SET_NICK_NAME_URL = "https://api.weixin.qq.com/wxa/setnickname"; |
|||
|
|||
/** |
|||
* 获取可以设置的所有类目 |
|||
*/ |
|||
String GET_ALL_CATEGORIES_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/getallcategories"; |
|||
|
|||
/** |
|||
* 获取已设置的所有类目 |
|||
*/ |
|||
String GET_CATEGORY_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/getcategory"; |
|||
|
|||
/** |
|||
* 添加类目 |
|||
*/ |
|||
String ADD_CATEGORY_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/addcategory"; |
|||
|
|||
/** |
|||
* 删除类目 |
|||
*/ |
|||
String DELETE_CATEGORY_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/deletecategory"; |
|||
|
|||
/** |
|||
* 修改类目资质信息 |
|||
*/ |
|||
String MODIFY_CATEGORY_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/modifycategory"; |
|||
|
|||
/** |
|||
* 绑定微信用户为体验者 |
|||
*/ |
|||
String BIND_TESTER_URL = "https://api.weixin.qq.com/wxa/bind_tester"; |
|||
|
|||
/** |
|||
* 解除绑定体验者 |
|||
*/ |
|||
String UNBIND_TESTER_URL = "https://api.weixin.qq.com/wxa/unbind_tester"; |
|||
|
|||
/** |
|||
* 获取体验者列表 |
|||
*/ |
|||
String MEMBER_AUTH_URL = "https://api.weixin.qq.com/wxa/memberauth"; |
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.epmet.wxapi.param; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/8/18 15:14 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class WxAddCategoryReq implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -3659216114599054052L; |
|||
|
|||
private List<CategoriesBean> categories; |
|||
|
|||
@NoArgsConstructor |
|||
@Data |
|||
public static class CategoriesBean { |
|||
/** |
|||
* |
|||
*/ |
|||
private int first; |
|||
private int second; |
|||
private List<CerticatesBean> certicates; |
|||
|
|||
@NoArgsConstructor |
|||
@Data |
|||
public static class CerticatesBean { |
|||
/** |
|||
* |
|||
*/ |
|||
private String key; |
|||
private String value; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.wxapi.param; |
|||
|
|||
import com.google.gson.annotations.SerializedName; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/8/18 15:43 |
|||
*/ |
|||
@Data |
|||
public class WxBindTesterReq implements Serializable { |
|||
private static final long serialVersionUID = -6509988898376682232L; |
|||
@SerializedName("wechatid") |
|||
private String weChatId; |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.wxapi.param; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/8/18 15:22 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class WxDelCategoryReq implements Serializable { |
|||
private static final long serialVersionUID = 7179297618235954140L; |
|||
private Integer first; |
|||
private Integer second; |
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.epmet.wxapi.param; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/8/18 15:26 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class WxModifyCategoryReq implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -428387175986769380L; |
|||
/** |
|||
* 一级类目 ID |
|||
*/ |
|||
private int first; |
|||
/** |
|||
* 二级类目 ID |
|||
*/ |
|||
private int second; |
|||
/** |
|||
* [资质信息]列表 |
|||
*/ |
|||
private List<CerticatesBean> certicates; |
|||
|
|||
@NoArgsConstructor |
|||
@Data |
|||
public static class CerticatesBean { |
|||
/** |
|||
* 资质图片 |
|||
*/ |
|||
private String key; |
|||
private String value; |
|||
} |
|||
} |
@ -0,0 +1,61 @@ |
|||
package com.epmet.wxapi.result; |
|||
|
|||
import com.google.gson.annotations.SerializedName; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/8/18 14:53 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class WxGetAllCategoriesResult implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 4419968653961864521L; |
|||
/** |
|||
* errcode : 0 |
|||
*/ |
|||
@SerializedName("errcode") |
|||
private Integer errCode; |
|||
@SerializedName("errmsg") |
|||
private String errMsg; |
|||
@SerializedName("categories_list") |
|||
private CategoriesListBean categoriesList; |
|||
@NoArgsConstructor |
|||
@Data |
|||
public static class CategoriesListBean { |
|||
private List<CategoriesBean> categories; |
|||
|
|||
@NoArgsConstructor |
|||
@Data |
|||
public static class CategoriesBean { |
|||
/** |
|||
* id : 0 |
|||
*/ |
|||
private int id; |
|||
private QualifyBean qualify; |
|||
private String name; |
|||
private int level; |
|||
private int father; |
|||
@SerializedName("sensitive_type") |
|||
private int sensitiveType; |
|||
private List<Integer> children; |
|||
|
|||
@NoArgsConstructor |
|||
@Data |
|||
public static class QualifyBean { |
|||
/** |
|||
* exter_list : [] |
|||
*/ |
|||
private String remark; |
|||
@SerializedName("exter_list") |
|||
private List<?> exterList; |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,134 @@ |
|||
package com.epmet.wxapi.service; |
|||
|
|||
import com.epmet.wxapi.param.*; |
|||
import com.epmet.wxapi.result.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 小程序修改服务器地址、类目管理、成员管理 API(大部分只能是第三方平台调用) |
|||
* |
|||
* @author zhaoqifeng |
|||
* @date 2020/8/18 13:50 |
|||
*/ |
|||
public interface WxMaSettingService { |
|||
/** |
|||
* 设置服务器域名 |
|||
* |
|||
* @param accessToken |
|||
* @param action |
|||
* @return com.epmet.wxapi.result.WxResult |
|||
* @author zhaoqifeng |
|||
* @date 2020/7/16 17:21 |
|||
*/ |
|||
WxResult<WxMaModifyDomainResult> modifyDomain(String accessToken, String action); |
|||
|
|||
/** |
|||
* 设置服务器域名 |
|||
* |
|||
* @param accessToken |
|||
* @param request |
|||
* @return com.epmet.wxapi.result.WxResult |
|||
* @author zhaoqifeng |
|||
* @date 2020/7/16 17:21 |
|||
*/ |
|||
WxResult modifyDomain(String accessToken, WxMaModifyDomainReq request); |
|||
|
|||
/** |
|||
* 设置业务域名 |
|||
* |
|||
* @param accessToken |
|||
* @param action |
|||
* @return com.epmet.wxapi.result.WxResult |
|||
* @author zhaoqifeng |
|||
* @date 2020/7/16 17:22 |
|||
*/ |
|||
WxResult<WxMaSetWebviewDomainResult> setWebviewDomain(String accessToken, String action); |
|||
|
|||
/** |
|||
* 设置业务域名 |
|||
* |
|||
* @param accessToken |
|||
* @param request |
|||
* @return com.epmet.wxapi.result.WxResult |
|||
* @author zhaoqifeng |
|||
* @date 2020/8/19 17:52 |
|||
*/ |
|||
WxResult setWebviewDomain(String accessToken, WxMaSetWebviewDomainReq request); |
|||
|
|||
/** |
|||
* 获取可以设置的所有类目 |
|||
* |
|||
* @param accessToken |
|||
* @return com.epmet.wxapi.result.WxResult<com.epmet.wxapi.result.WxGetAllCategoriesResult> |
|||
* @author zhaoqifeng |
|||
* @date 2020/8/18 15:06 |
|||
*/ |
|||
WxResult<WxGetAllCategoriesResult> getAllCategories(String accessToken); |
|||
|
|||
/** |
|||
* 获取已设置的所有类目 |
|||
* |
|||
* @param accessToken |
|||
* @return com.epmet.wxapi.result.WxResult<com.epmet.wxapi.result.WxOpenGetCategoryResult> |
|||
* @author zhaoqifeng |
|||
* @date 2020/8/6 10:47 |
|||
*/ |
|||
WxResult<WxOpenGetCategoryResult> getCategory(String accessToken); |
|||
|
|||
/** |
|||
* 添加类目 |
|||
* |
|||
* @param accessToken |
|||
* @param request |
|||
* @return com.epmet.wxapi.result.WxResult |
|||
* @author zhaoqifeng |
|||
* @date 2020/8/18 15:20 |
|||
*/ |
|||
WxResult addCategory(String accessToken, WxAddCategoryReq request); |
|||
|
|||
/** |
|||
* 删除类目 |
|||
* |
|||
* @param accessToken |
|||
* @param request |
|||
* @return com.epmet.wxapi.result.WxResult |
|||
* @author zhaoqifeng |
|||
* @date 2020/8/18 15:20 |
|||
*/ |
|||
WxResult delCategory(String accessToken, WxDelCategoryReq request); |
|||
|
|||
/** |
|||
* 修改类目资质信息 |
|||
* |
|||
* @param accessToken |
|||
* @param request |
|||
* @return com.epmet.wxapi.result.WxResult |
|||
* @author zhaoqifeng |
|||
* @date 2020/8/18 15:20 |
|||
*/ |
|||
WxResult modifyCategory(String accessToken, WxModifyCategoryReq request); |
|||
|
|||
/** |
|||
* 绑定微信用户为体验者 |
|||
* |
|||
* @param accessToken |
|||
* @param request |
|||
* @return com.epmet.wxapi.result.WxResult<java.lang.String> |
|||
* @author zhaoqifeng |
|||
* @date 2020/8/18 15:45 |
|||
*/ |
|||
WxResult<String> bindTester(String accessToken, WxBindTesterReq request); |
|||
|
|||
/** |
|||
* 解除绑定体验者 |
|||
* |
|||
* @param accessToken |
|||
* @param request |
|||
* @return com.epmet.wxapi.result.WxResult<java.lang.String> |
|||
* @author zhaoqifeng |
|||
* @date 2020/8/18 15:45 |
|||
*/ |
|||
WxResult unBindTester(String accessToken, WxBindTesterReq request); |
|||
|
|||
} |
@ -0,0 +1,244 @@ |
|||
package com.epmet.wxapi.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.utils.HttpClientManager; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.wxapi.constant.WxMaCodeConstant; |
|||
import com.epmet.wxapi.constant.WxMaSettingConstant; |
|||
import com.epmet.wxapi.enums.WxMaErrorMsgEnum; |
|||
import com.epmet.wxapi.param.*; |
|||
import com.epmet.wxapi.result.*; |
|||
import com.epmet.wxapi.service.WxMaSettingService; |
|||
import com.google.gson.Gson; |
|||
import com.google.gson.GsonBuilder; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/8/18 13:57 |
|||
*/ |
|||
@Service |
|||
public class WxMaSettingServiceImpl implements WxMaSettingService { |
|||
private static final String ERR_CODE = "errcode"; |
|||
private static final String ERR_MSG = "errmsg"; |
|||
|
|||
@Autowired |
|||
private WxMaDomainDTO wxMaDomainDTO; |
|||
|
|||
@Override |
|||
public WxResult<WxMaModifyDomainResult> modifyDomain(String accessToken, String action) { |
|||
WxResult<WxMaModifyDomainResult> result = new WxResult<>(); |
|||
String url = WxMaSettingConstant.MODIFY_DOMAIN_URL + "?" + "access_token=" + accessToken; |
|||
WxMaModifyDomainReq request = new WxMaModifyDomainReq(); |
|||
request.setAction(action); |
|||
request.setRequestDomain(wxMaDomainDTO.getRequestDomain()); |
|||
request.setUploadDomain(wxMaDomainDTO.getUploadDomain()); |
|||
request.setWsRequestDomain(wxMaDomainDTO.getWsRequestDomain()); |
|||
request.setDownloadDomain(wxMaDomainDTO.getDownloadDomain()); |
|||
Result<String> modifyResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); |
|||
if (!modifyResult.success()) { |
|||
result.setErrorCode(modifyResult.getCode()); |
|||
result.setErrorMsg(modifyResult.getMsg()); |
|||
return result; |
|||
} |
|||
Gson gson = new Gson(); |
|||
WxMaModifyDomainResult domainResult = gson.fromJson(modifyResult.getData(), WxMaModifyDomainResult.class); |
|||
result.setErrorCode(domainResult.getErrcode()); |
|||
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(domainResult.getErrcode())); |
|||
result.setData(domainResult); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public WxResult modifyDomain(String accessToken, WxMaModifyDomainReq request) { |
|||
WxResult result = new WxResult<>(); |
|||
String url = WxMaCodeConstant.MODIFY_DOMAIN_URL + "?" + "access_token=" + accessToken; |
|||
Result<String> modifyResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); |
|||
if (!modifyResult.success()) { |
|||
result.setErrorCode(modifyResult.getCode()); |
|||
result.setErrorMsg(modifyResult.getMsg()); |
|||
return result; |
|||
} |
|||
Gson gson = new Gson(); |
|||
WxMaModifyDomainResult domainResult = gson.fromJson(modifyResult.getData(), WxMaModifyDomainResult.class); |
|||
result.setErrorCode(domainResult.getErrcode()); |
|||
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(domainResult.getErrcode())); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public WxResult<WxMaSetWebviewDomainResult> setWebviewDomain(String accessToken, String action) { |
|||
WxResult<WxMaSetWebviewDomainResult> result = new WxResult<>(); |
|||
String url = WxMaSettingConstant.SET_WEBVIEW_DOMAIN_URL + "?" + "access_token=" + accessToken; |
|||
WxMaSetWebviewDomainReq request = new WxMaSetWebviewDomainReq(); |
|||
request.setAction(action); |
|||
request.setWebViewDomain(wxMaDomainDTO.getWebviewDomain()); |
|||
Result<String> modifyResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); |
|||
if (!modifyResult.success()) { |
|||
result.setErrorCode(modifyResult.getCode()); |
|||
result.setErrorMsg(modifyResult.getMsg()); |
|||
return result; |
|||
} |
|||
Gson gson = new Gson(); |
|||
WxMaSetWebviewDomainResult domainResult = gson.fromJson(modifyResult.getData(), WxMaSetWebviewDomainResult.class); |
|||
result.setErrorCode(domainResult.getErrcode()); |
|||
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(domainResult.getErrcode())); |
|||
result.setData(domainResult); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public WxResult setWebviewDomain(String accessToken, WxMaSetWebviewDomainReq request) { |
|||
WxResult result = new WxResult<>(); |
|||
String url = WxMaCodeConstant.SET_WEBVIEW_DOMAIN_URL + "?" + "access_token=" + accessToken; |
|||
Result<String> modifyResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); |
|||
if (!modifyResult.success()) { |
|||
result.setErrorCode(modifyResult.getCode()); |
|||
result.setErrorMsg(modifyResult.getMsg()); |
|||
return result; |
|||
} |
|||
Gson gson = new Gson(); |
|||
WxMaSetWebviewDomainResult domainResult = gson.fromJson(modifyResult.getData(), WxMaSetWebviewDomainResult.class); |
|||
result.setErrorCode(domainResult.getErrcode()); |
|||
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(domainResult.getErrcode())); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public WxResult<WxGetAllCategoriesResult> getAllCategories(String accessToken) { |
|||
WxResult<WxGetAllCategoriesResult> result = new WxResult<>(); |
|||
String url = WxMaSettingConstant.GET_ALL_CATEGORIES_URL + "?" + "access_token=" + accessToken; |
|||
Result<String> modifyResult = HttpClientManager.getInstance().sendGet(url, null); |
|||
if (!modifyResult.success()) { |
|||
result.setErrorCode(modifyResult.getCode()); |
|||
result.setErrorMsg(modifyResult.getMsg()); |
|||
return result; |
|||
} |
|||
Gson gson = new Gson(); |
|||
WxGetAllCategoriesResult categoryResult = gson.fromJson(modifyResult.getData(), WxGetAllCategoriesResult.class); |
|||
if (categoryResult.getErrCode() != NumConstant.ZERO) { |
|||
result.setErrorCode(categoryResult.getErrCode()); |
|||
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(categoryResult.getErrCode())); |
|||
return result; |
|||
} |
|||
result.setErrorCode(categoryResult.getErrCode()); |
|||
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(categoryResult.getErrCode())); |
|||
result.setData(categoryResult); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public WxResult<WxOpenGetCategoryResult> getCategory(String accessToken) { |
|||
WxResult<WxOpenGetCategoryResult> result = new WxResult<>(); |
|||
String url = WxMaSettingConstant.GET_CATEGORY_URL + "?" + "access_token=" + accessToken; |
|||
Result<String> statusResult = HttpClientManager.getInstance().sendGet(url, null); |
|||
if (!statusResult.success()) { |
|||
result.setErrorCode(statusResult.getCode()); |
|||
result.setErrorMsg(statusResult.getMsg()); |
|||
return result; |
|||
} |
|||
Gson gson = new Gson(); |
|||
WxOpenGetCategoryResult categoryResult = gson.fromJson(statusResult.getData(), WxOpenGetCategoryResult.class); |
|||
if (categoryResult.getErrcode() != NumConstant.ZERO) { |
|||
result.setErrorCode(categoryResult.getErrcode()); |
|||
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(categoryResult.getErrcode())); |
|||
return result; |
|||
} |
|||
result.ok(categoryResult); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public WxResult addCategory(String accessToken, WxAddCategoryReq request) { |
|||
WxResult result = new WxResult(); |
|||
String url = WxMaSettingConstant.ADD_CATEGORY_URL + "?" + "access_token=" + accessToken; |
|||
Result<String> categoryResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); |
|||
if (!categoryResult.success()) { |
|||
result.setErrorCode(categoryResult.getCode()); |
|||
result.setErrorMsg(categoryResult.getMsg()); |
|||
return result; |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(categoryResult.getData()); |
|||
result.setErrorCode(jsonObject.getInteger(ERR_CODE)); |
|||
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(jsonObject.getInteger(ERR_CODE))); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public WxResult delCategory(String accessToken, WxDelCategoryReq request) { |
|||
WxResult result = new WxResult(); |
|||
String url = WxMaSettingConstant.DELETE_CATEGORY_URL + "?" + "access_token=" + accessToken; |
|||
Result<String> categoryResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); |
|||
if (!categoryResult.success()) { |
|||
result.setErrorCode(categoryResult.getCode()); |
|||
result.setErrorMsg(categoryResult.getMsg()); |
|||
return result; |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(categoryResult.getData()); |
|||
result.setErrorCode(jsonObject.getInteger(ERR_CODE)); |
|||
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(jsonObject.getInteger(ERR_CODE))); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public WxResult modifyCategory(String accessToken, WxModifyCategoryReq request) { |
|||
WxResult result = new WxResult(); |
|||
String url = WxMaSettingConstant.MODIFY_CATEGORY_URL + "?" + "access_token=" + accessToken; |
|||
Result<String> categoryResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); |
|||
if (!categoryResult.success()) { |
|||
result.setErrorCode(categoryResult.getCode()); |
|||
result.setErrorMsg(categoryResult.getMsg()); |
|||
return result; |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(categoryResult.getData()); |
|||
result.setErrorCode(jsonObject.getInteger(ERR_CODE)); |
|||
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(jsonObject.getInteger(ERR_CODE))); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public WxResult<String> bindTester(String accessToken, WxBindTesterReq request) { |
|||
WxResult<String> result = new WxResult<>(); |
|||
String url = WxMaSettingConstant.BIND_TESTER_URL + "?" + "access_token=" + accessToken; |
|||
Result<String> testerResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); |
|||
if (!testerResult.success()) { |
|||
result.setErrorCode(testerResult.getCode()); |
|||
result.setErrorMsg(testerResult.getMsg()); |
|||
return result; |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(testerResult.getData()); |
|||
result.setErrorCode(jsonObject.getInteger(ERR_CODE)); |
|||
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(jsonObject.getInteger(ERR_CODE))); |
|||
result.setData(jsonObject.getString("userstr")); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public WxResult unBindTester(String accessToken, WxBindTesterReq request) { |
|||
WxResult result = new WxResult(); |
|||
String url = WxMaSettingConstant.UNBIND_TESTER_URL + "?" + "access_token=" + accessToken; |
|||
Result<String> testerResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); |
|||
if (!testerResult.success()) { |
|||
result.setErrorCode(testerResult.getCode()); |
|||
result.setErrorMsg(testerResult.getMsg()); |
|||
return result; |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(testerResult.getData()); |
|||
result.setErrorCode(jsonObject.getInteger(ERR_CODE)); |
|||
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(jsonObject.getInteger(ERR_CODE))); |
|||
return result; |
|||
} |
|||
|
|||
private String toJson(Object object) { |
|||
GsonBuilder gsonBuilder = new GsonBuilder(); |
|||
gsonBuilder.setPrettyPrinting(); |
|||
Gson gson = gsonBuilder.create(); |
|||
return gson.toJson(object); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,61 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* 国际化 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-18 |
|||
*/ |
|||
@Data |
|||
public class GovLanguageDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 表名 |
|||
*/ |
|||
private String tableName; |
|||
|
|||
/** |
|||
* 表主键 |
|||
*/ |
|||
private String tableId; |
|||
|
|||
/** |
|||
* 字段名 |
|||
*/ |
|||
private String fieldName; |
|||
|
|||
/** |
|||
* 字段值 |
|||
*/ |
|||
private String fieldValue; |
|||
|
|||
/** |
|||
* 语言 |
|||
*/ |
|||
private String language; |
|||
|
|||
} |
@ -0,0 +1,124 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto; |
|||
|
|||
import com.epmet.commons.tools.utils.TreeStringNode; |
|||
import com.epmet.dto.result.MenuResourceDTO; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 菜单管理 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-18 |
|||
*/ |
|||
@Data |
|||
public class GovMenuDTO extends TreeStringNode<GovMenuDTO> implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 上级ID,一级菜单为0 |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 菜单名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 菜单URL |
|||
*/ |
|||
private String url; |
|||
|
|||
/** |
|||
* 类型 0:菜单 1:按钮 |
|||
*/ |
|||
private Integer type; |
|||
|
|||
/** |
|||
* 菜单图标 |
|||
*/ |
|||
private String icon; |
|||
|
|||
/** |
|||
* 权限标识,如:sys:menu:save |
|||
*/ |
|||
private String permissions; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 删除标识:0.未删除 1.已删除 |
|||
*/ |
|||
private Integer delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
/** |
|||
* 菜单资源 |
|||
*/ |
|||
private List<MenuResourceDTO> resourceList; |
|||
|
|||
/** |
|||
* 上级菜单名称 |
|||
*/ |
|||
private String parentName; |
|||
|
|||
/** |
|||
* 是否显示,1:显示 0不显示 |
|||
*/ |
|||
private Integer showFlag; |
|||
} |
@ -0,0 +1,102 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 资源管理 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-18 |
|||
*/ |
|||
@Data |
|||
public class GovResourceDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 资源编码,如菜单ID |
|||
*/ |
|||
private String resourceCode; |
|||
|
|||
/** |
|||
* 资源名称 |
|||
*/ |
|||
private String resourceName; |
|||
|
|||
/** |
|||
* 资源URL |
|||
*/ |
|||
private String resourceUrl; |
|||
|
|||
/** |
|||
* 请求方式(如:GET、POST、PUT、DELETE) |
|||
*/ |
|||
private String resourceMethod; |
|||
|
|||
/** |
|||
* 菜单标识 0:非菜单资源 1:菜单资源 |
|||
*/ |
|||
private Integer menuFlag; |
|||
|
|||
/** |
|||
* 认证等级 0:权限认证 1:登录认证 2:无需认证 |
|||
*/ |
|||
private Integer authLevel; |
|||
|
|||
/** |
|||
* 删除标识:0.未删除 1.已删除 |
|||
*/ |
|||
private Integer delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,93 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 角色管理 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-18 |
|||
*/ |
|||
@Data |
|||
public class GovRoleDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 角色名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 部门ID |
|||
*/ |
|||
private Long deptId; |
|||
|
|||
/** |
|||
* 删除标识:0.未删除 1.已删除 |
|||
*/ |
|||
private Integer delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
/** |
|||
* 菜单ID列表 |
|||
*/ |
|||
private List<String> menuIdList; |
|||
|
|||
} |
@ -0,0 +1,82 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 角色菜单关系 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-18 |
|||
*/ |
|||
@Data |
|||
public class GovRoleMenuDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 角色ID |
|||
*/ |
|||
private String roleId; |
|||
|
|||
/** |
|||
* 菜单ID |
|||
*/ |
|||
private String menuId; |
|||
|
|||
/** |
|||
* 删除标识:0.未删除 1.已删除 |
|||
*/ |
|||
private Integer delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,82 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 角色用户关系 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-18 |
|||
*/ |
|||
@Data |
|||
public class GovRoleUserDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 角色ID |
|||
*/ |
|||
private String roleId; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 删除标识:0.未删除 1.已删除 |
|||
*/ |
|||
private Integer delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.dto.result; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 菜单资源 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "菜单资源") |
|||
public class MenuResourceDTO { |
|||
@ApiModelProperty(value = "资源URL") |
|||
private String resourceUrl; |
|||
@ApiModelProperty(value = "请求方式(如:GET、POST、PUT、DELETE)") |
|||
private String resourceMethod; |
|||
|
|||
} |
@ -0,0 +1,36 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.enums; |
|||
|
|||
/** |
|||
* 菜单资源标识 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
public enum MenuFlagEnum { |
|||
/** |
|||
* 菜单资源 |
|||
*/ |
|||
YES(1), |
|||
/** |
|||
* 非菜单资源 |
|||
*/ |
|||
NO(0); |
|||
|
|||
private int value; |
|||
|
|||
MenuFlagEnum(int value) { |
|||
this.value = value; |
|||
} |
|||
|
|||
public int value() { |
|||
return this.value; |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.enums; |
|||
|
|||
/** |
|||
* 菜单类型枚举 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
public enum MenuTypeEnum { |
|||
/** |
|||
* 菜单 |
|||
*/ |
|||
MENU(0), |
|||
/** |
|||
* 按钮 |
|||
*/ |
|||
BUTTON(1); |
|||
|
|||
private int value; |
|||
|
|||
MenuTypeEnum(int value) { |
|||
this.value = value; |
|||
} |
|||
|
|||
public int value() { |
|||
return this.value; |
|||
} |
|||
} |
@ -0,0 +1,29 @@ |
|||
/** |
|||
* Copyright (c) 2019 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.enums; |
|||
|
|||
/** |
|||
* 叶子节点枚举 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
*/ |
|||
public enum RegionLeafEnum { |
|||
YES(1), |
|||
NO(0); |
|||
|
|||
private int value; |
|||
|
|||
RegionLeafEnum(int value) { |
|||
this.value = value; |
|||
} |
|||
|
|||
public int value() { |
|||
return this.value; |
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
/** |
|||
* Copyright (c) 2019 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.enums; |
|||
|
|||
/** |
|||
* 行政区域 级别枚举 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
*/ |
|||
public enum RegionLevelEnum { |
|||
ONE(1), |
|||
TWO(2), |
|||
THREE(3); |
|||
|
|||
private int value; |
|||
|
|||
RegionLevelEnum(int value) { |
|||
this.value = value; |
|||
} |
|||
|
|||
public int value() { |
|||
return this.value; |
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.enums; |
|||
|
|||
/** |
|||
* 用户状态 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
public enum UserStatusEnum { |
|||
DISABLE(0), |
|||
ENABLED(1); |
|||
|
|||
private int value; |
|||
|
|||
UserStatusEnum(int value) { |
|||
this.value = value; |
|||
} |
|||
|
|||
public int value() { |
|||
return this.value; |
|||
} |
|||
} |
@ -0,0 +1,85 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.dto.GovLanguageDTO; |
|||
import com.epmet.service.GovLanguageService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 国际化 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-18 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("operlanguage") |
|||
public class GovLanguageController { |
|||
|
|||
@Autowired |
|||
private GovLanguageService govLanguageService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<GovLanguageDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<GovLanguageDTO> page = govLanguageService.page(params); |
|||
return new Result<PageData<GovLanguageDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<GovLanguageDTO> get(@PathVariable("id") String id){ |
|||
GovLanguageDTO data = govLanguageService.get(id); |
|||
return new Result<GovLanguageDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody GovLanguageDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
govLanguageService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody GovLanguageDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
govLanguageService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
govLanguageService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,156 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.exception.ErrorCode; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.dto.GovMenuDTO; |
|||
import com.epmet.dto.result.MenuResourceDTO; |
|||
import com.epmet.service.GovMenuService; |
|||
import com.epmet.service.GovResourceService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* |
|||
* 菜单管理 |
|||
* |
|||
* @author zhaoqifeng |
|||
* @date 2020/3/17 16:35 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("menu") |
|||
public class GovMenuController { |
|||
|
|||
@Autowired |
|||
private GovMenuService govMenuService; |
|||
|
|||
@Autowired |
|||
private GovResourceService govResourceService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<GovMenuDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<GovMenuDTO> page = govMenuService.page(params); |
|||
return new Result<PageData<GovMenuDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<GovMenuDTO> get(@PathVariable("id") String id){ |
|||
GovMenuDTO data = govMenuService.get(id); |
|||
|
|||
//菜单资源列表
|
|||
List<MenuResourceDTO> resourceList = govResourceService.getMenuResourceList(id); |
|||
|
|||
return new Result<GovMenuDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody GovMenuDTO dto, @LoginUser TokenDto tokenDto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
govMenuService.save(dto,tokenDto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody GovMenuDTO dto, @LoginUser TokenDto tokenDto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
govMenuService.update(dto,tokenDto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
govMenuService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping("{id}") |
|||
public Result delete(@PathVariable("id") String id, @LoginUser TokenDto tokenDto){ |
|||
//效验数据
|
|||
AssertUtils.isNull(id, "id"); |
|||
|
|||
//判断是否有子菜单或按钮
|
|||
List<GovMenuDTO> list = govMenuService.getListPid(id); |
|||
if(list.size() > 0){ |
|||
return new Result().error(ErrorCode.SUB_MENU_EXIST); |
|||
} |
|||
|
|||
govMenuService.delete(id, tokenDto); |
|||
|
|||
return new Result(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取菜单列表 |
|||
* @param type 类型 |
|||
* @return Result<List<GovMenuDTO>> |
|||
*/ |
|||
@GetMapping("list") |
|||
public Result<List<GovMenuDTO>> list(Integer type){ |
|||
List<GovMenuDTO> list = govMenuService.getMenuList(type); |
|||
|
|||
return new Result<List<GovMenuDTO>>().ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 导航 |
|||
* @param tokenDto token |
|||
* @return List<GovMenuDTO> |
|||
*/ |
|||
@GetMapping("nav") |
|||
public Result<List<GovMenuDTO>> nav(@LoginUser TokenDto tokenDto){ |
|||
List<GovMenuDTO> list = govMenuService.getUserMenuNavList(tokenDto); |
|||
return new Result<List<GovMenuDTO>>().ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 权限标识 |
|||
* @param tokenDto token |
|||
* @return Set<String> |
|||
*/ |
|||
@GetMapping("permissions") |
|||
public Result<Set<String>> permissions(@LoginUser TokenDto tokenDto){ |
|||
Set<String> set = govMenuService.getUserPermissions(tokenDto); |
|||
return new Result<Set<String>>().ok(set); |
|||
} |
|||
|
|||
/** |
|||
* 角色菜单权限 |
|||
* @param tokenDto token |
|||
* @return |
|||
*/ |
|||
@GetMapping("select") |
|||
public Result<List<GovMenuDTO>> select(@LoginUser TokenDto tokenDto){ |
|||
List<GovMenuDTO> list = govMenuService.getUserMenuList(tokenDto, null); |
|||
|
|||
return new Result<List<GovMenuDTO>>().ok(list); |
|||
} |
|||
|
|||
/** |
|||
* @param tokenDto |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @Author yinzuomei |
|||
* @Description 运营端用户退出系统,清空菜单和操作权限 |
|||
* @Date 2020/5/21 18:07 |
|||
**/ |
|||
@GetMapping("cleargovuseraccess") |
|||
public Result clearGovUserAccess(@LoginUser TokenDto tokenDto) { |
|||
govMenuService.clearOperUserAccess(tokenDto.getApp(), tokenDto.getClient(), tokenDto.getUserId()); |
|||
return new Result(); |
|||
} |
|||
} |
@ -0,0 +1,84 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.dto.GovResourceDTO; |
|||
import com.epmet.service.GovResourceService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 资源管理 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-18 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("govresource") |
|||
public class GovResourceController { |
|||
|
|||
@Autowired |
|||
private GovResourceService govResourceService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<GovResourceDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<GovResourceDTO> page = govResourceService.page(params); |
|||
return new Result<PageData<GovResourceDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<GovResourceDTO> get(@PathVariable("id") String id){ |
|||
GovResourceDTO data = govResourceService.get(id); |
|||
return new Result<GovResourceDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody GovResourceDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
govResourceService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody GovResourceDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
govResourceService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
govResourceService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,104 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.dto.GovRoleDTO; |
|||
import com.epmet.service.GovRoleMenuService; |
|||
import com.epmet.service.GovRoleService; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 角色管理 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-18 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("govrole") |
|||
public class GovRoleController { |
|||
|
|||
@Autowired |
|||
private GovRoleService govRoleService; |
|||
@Autowired |
|||
private GovRoleMenuService govRoleMenuService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<GovRoleDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<GovRoleDTO> page = govRoleService.page(params); |
|||
return new Result<PageData<GovRoleDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<GovRoleDTO> get(@PathVariable("id") String id){ |
|||
GovRoleDTO data = govRoleService.get(id); |
|||
|
|||
//查询角色对应的菜单
|
|||
List<String> menuIdList = govRoleMenuService.getMenuIdList(id); |
|||
data.setMenuIdList(menuIdList); |
|||
|
|||
return new Result<GovRoleDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody GovRoleDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
govRoleService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody GovRoleDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
govRoleService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
govRoleService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
|
|||
@GetMapping("list") |
|||
@ApiOperation("列表") |
|||
public Result<List<GovRoleDTO>> list(){ |
|||
List<GovRoleDTO> data = govRoleService.list(new HashMap<>(1)); |
|||
|
|||
return new Result<List<GovRoleDTO>>().ok(data); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,85 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.dto.GovRoleMenuDTO; |
|||
import com.epmet.service.GovRoleMenuService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 角色菜单关系 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-18 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("govrolemenu") |
|||
public class GovRoleMenuController { |
|||
|
|||
@Autowired |
|||
private GovRoleMenuService govRoleMenuService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<GovRoleMenuDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<GovRoleMenuDTO> page = govRoleMenuService.page(params); |
|||
return new Result<PageData<GovRoleMenuDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<GovRoleMenuDTO> get(@PathVariable("id") String id){ |
|||
GovRoleMenuDTO data = govRoleMenuService.get(id); |
|||
return new Result<GovRoleMenuDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody GovRoleMenuDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
govRoleMenuService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody GovRoleMenuDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
govRoleMenuService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
govRoleMenuService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,132 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.dto.GovRoleUserDTO; |
|||
import com.epmet.service.GovRoleUserService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 角色用户关系 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-18 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("govroleuser") |
|||
public class GovRoleUserController { |
|||
|
|||
@Autowired |
|||
private GovRoleUserService govRoleUserService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<GovRoleUserDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<GovRoleUserDTO> page = govRoleUserService.page(params); |
|||
return new Result<PageData<GovRoleUserDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<GovRoleUserDTO> get(@PathVariable("id") String id){ |
|||
GovRoleUserDTO data = govRoleUserService.get(id); |
|||
return new Result<GovRoleUserDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody GovRoleUserDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
govRoleUserService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody GovRoleUserDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
govRoleUserService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
govRoleUserService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取权限id列表 |
|||
* @param id 用户id |
|||
* @return List<String> |
|||
* @author zhaoqifeng |
|||
*/ |
|||
@GetMapping("getRoleIdList/{id}") |
|||
public Result<List<String>>getRoleIdList(@PathVariable("id") String id) { |
|||
List<String> list = govRoleUserService.getRoleIdList(id); |
|||
return new Result<List<String>>().ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 保存更新权限 |
|||
* @param userId 用户id |
|||
* @param roleIdList 权限列表 |
|||
* @author zhaoqifeng |
|||
*/ |
|||
@PostMapping("saveOrUpdateRole") |
|||
public Result saveOrUpdate(@RequestParam("userId") String userId, @RequestBody List<String> roleIdList) { |
|||
govRoleUserService.saveOrUpdate(userId, roleIdList); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* 根据用户id,删除角色用户关系 |
|||
* @param id 用户id |
|||
* @return Result |
|||
*/ |
|||
@PostMapping("deleteByUserId") |
|||
public Result deleteByUserId(String id) { |
|||
govRoleUserService.deleteByUserId(id); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* 根据用户ids,删除角色用户关系 |
|||
* @param ids 用户ids |
|||
* @return Result |
|||
*/ |
|||
@PostMapping("deleteByUserIds") |
|||
public Result deleteByUserIds(@RequestBody String[] ids) { |
|||
govRoleUserService.deleteByUserIds(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,28 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.GovLanguageEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 国际化 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
*/ |
|||
@Mapper |
|||
public interface GovLanguageDao extends BaseDao<GovLanguageEntity> { |
|||
|
|||
GovLanguageEntity getLanguage(GovLanguageEntity entity); |
|||
|
|||
void updateLanguage(GovLanguageEntity entity); |
|||
|
|||
void insertOperLanguageEntity(GovLanguageEntity entity); |
|||
} |
@ -0,0 +1,52 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.GovMenuEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 菜单管理 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Mapper |
|||
public interface GovMenuDao extends BaseDao<GovMenuEntity> { |
|||
|
|||
GovMenuEntity getById(@Param("id") String id, @Param("language") String language); |
|||
|
|||
/** |
|||
* 查询所有菜单列表 |
|||
* |
|||
* @param type 菜单类型 |
|||
* @param language 语言 |
|||
*/ |
|||
List<GovMenuEntity> getMenuList(@Param("type") Integer type, @Param("language") String language); |
|||
|
|||
/** |
|||
* 查询用户菜单列表 |
|||
* |
|||
* @param userId 用户ID |
|||
* @param type 菜单类型 |
|||
* @param language 语言 |
|||
*/ |
|||
List<GovMenuEntity> getUserMenuList(@Param("userId") String userId, @Param("type") Integer type, @Param("language") String language); |
|||
|
|||
|
|||
/** |
|||
* 根据父菜单,查询子菜单 |
|||
* @param pid 父菜单ID |
|||
*/ |
|||
List<GovMenuEntity> getListPid(String pid); |
|||
} |
@ -0,0 +1,48 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.GovResourceEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 资源管理 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Mapper |
|||
public interface GovResourceDao extends BaseDao<GovResourceEntity> { |
|||
/** |
|||
* 根据资源编码,删除对应的资源 |
|||
* @param code 资源编码 |
|||
*/ |
|||
void deleteByCode(String code); |
|||
|
|||
/** |
|||
* 获取资源列表 |
|||
* @param menuId 菜单ID |
|||
*/ |
|||
List<GovResourceEntity> getMenuResourceList(String menuId); |
|||
|
|||
/** |
|||
* 获取所有资源列表 |
|||
*/ |
|||
List<GovResourceEntity> getResourceList(); |
|||
|
|||
/** |
|||
* 获取用户资源列表 |
|||
* @param userId 用户ID |
|||
*/ |
|||
List<GovResourceEntity> getUserResourceList(@Param("userId") String userId); |
|||
} |
@ -0,0 +1,24 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.GovRoleEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 角色管理 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Mapper |
|||
public interface GovRoleDao extends BaseDao<GovRoleEntity> { |
|||
|
|||
} |
@ -0,0 +1,49 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.GovRoleMenuEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 角色菜单关系 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Mapper |
|||
public interface GovRoleMenuDao extends BaseDao<GovRoleMenuEntity> { |
|||
|
|||
/** |
|||
* 根据角色ID,获取菜单ID列表 |
|||
*/ |
|||
List<String> getMenuIdList(String roleId); |
|||
|
|||
/** |
|||
* 根据角色id,删除角色菜单关系 |
|||
* @param roleId 角色id |
|||
*/ |
|||
void deleteByRoleId(String roleId); |
|||
|
|||
/** |
|||
* 根据菜单id,删除角色菜单关系 |
|||
* @param menuId 菜单id |
|||
*/ |
|||
void deleteByMenuId(String menuId); |
|||
|
|||
|
|||
/** |
|||
* 根据角色ids,删除角色菜单关系 |
|||
* @param roleIds 角色ids |
|||
*/ |
|||
void deleteByRoleIds(String[] roleIds); |
|||
} |
@ -0,0 +1,57 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.GovRoleUserEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 角色用户关系 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Mapper |
|||
public interface GovRoleUserDao extends BaseDao<GovRoleUserEntity> { |
|||
|
|||
/** |
|||
* 根据角色ids,删除角色用户关系 |
|||
* @param roleIds 角色ids |
|||
*/ |
|||
void deleteByRoleIds(String[] roleIds); |
|||
|
|||
/** |
|||
* 根据用户ids,删除角色用户关系 |
|||
* @param userIds 用户ids |
|||
*/ |
|||
void deleteByUserIds(String[] userIds); |
|||
|
|||
/** |
|||
* 根据角色id,删除角色用户关系 |
|||
* @param roleId 角色id |
|||
*/ |
|||
void deleteByRoleId(String roleId); |
|||
|
|||
/** |
|||
* 根据用户id,删除角色用户关系 |
|||
* @param userId 用户id |
|||
*/ |
|||
void deleteByUserId(String userId); |
|||
|
|||
/** |
|||
* 角色ID列表 |
|||
* @param userId 用户ID |
|||
* |
|||
* @return |
|||
*/ |
|||
List<String> getRoleIdList(String userId); |
|||
} |
@ -0,0 +1,49 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 国际化 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("gov_language") |
|||
public class GovLanguageEntity implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 表名 |
|||
*/ |
|||
private String tableName; |
|||
/** |
|||
* 表主键 |
|||
*/ |
|||
private String tableId; |
|||
/** |
|||
* 字段名 |
|||
*/ |
|||
private String fieldName; |
|||
/** |
|||
* 字段值 |
|||
*/ |
|||
private String fieldValue; |
|||
/** |
|||
* 语言 |
|||
*/ |
|||
private String language; |
|||
|
|||
} |
@ -0,0 +1,69 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 菜单管理 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("gov_menu") |
|||
public class GovMenuEntity extends BaseEpmetEntity { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 上级ID,一级菜单为0 |
|||
*/ |
|||
private String pid; |
|||
/** |
|||
* 菜单名称 |
|||
*/ |
|||
@TableField(exist = false) |
|||
private String name; |
|||
/** |
|||
* 菜单URL |
|||
*/ |
|||
private String url; |
|||
/** |
|||
* 类型 0:菜单 1:按钮 |
|||
*/ |
|||
private Integer type; |
|||
/** |
|||
* 菜单图标 |
|||
*/ |
|||
private String icon; |
|||
/** |
|||
* 权限标识,如:sys:menu:save |
|||
*/ |
|||
private String permissions; |
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
/** |
|||
* 上级菜单名称 |
|||
*/ |
|||
@TableField(exist = false) |
|||
private String parentName; |
|||
|
|||
/** |
|||
* 是否显示,1:显示 0不显示 |
|||
*/ |
|||
private Integer showFlag; |
|||
|
|||
} |
@ -0,0 +1,53 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 资源管理 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("gov_resource") |
|||
public class GovResourceEntity extends BaseEpmetEntity { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 资源编码,如菜单ID |
|||
*/ |
|||
private String resourceCode; |
|||
/** |
|||
* 资源名称 |
|||
*/ |
|||
private String resourceName; |
|||
/** |
|||
* 资源URL |
|||
*/ |
|||
private String resourceUrl; |
|||
/** |
|||
* 请求方式(如:GET、POST、PUT、DELETE) |
|||
*/ |
|||
private String resourceMethod; |
|||
/** |
|||
* 菜单标识 0:非菜单资源 1:菜单资源 |
|||
*/ |
|||
private Integer menuFlag; |
|||
/** |
|||
* 认证等级 0:权限认证 1:登录认证 2:无需认证 |
|||
*/ |
|||
private Integer authLevel; |
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.FieldFill; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 角色管理 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("gov_role") |
|||
public class GovRoleEntity extends BaseEpmetEntity { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 角色名称 |
|||
*/ |
|||
private String name; |
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
/** |
|||
* 部门ID |
|||
*/ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private Long deptId; |
|||
|
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue