474 changed files with 13064 additions and 2241 deletions
@ -1,95 +0,0 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.log; |
|||
|
|||
import com.epmet.commons.tools.exception.ExceptionUtils; |
|||
import com.epmet.commons.tools.log.BaseLog; |
|||
import com.epmet.commons.tools.log.enums.LogTypeEnum; |
|||
import com.epmet.commons.tools.redis.RedisKeys; |
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.entity.SysLogErrorEntity; |
|||
import com.epmet.entity.SysLogLoginEntity; |
|||
import com.epmet.entity.SysLogOperationEntity; |
|||
import com.epmet.service.SysLogErrorService; |
|||
import com.epmet.service.SysLogLoginService; |
|||
import com.epmet.service.SysLogOperationService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.concurrent.BasicThreadFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.CommandLineRunner; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.concurrent.ScheduledExecutorService; |
|||
import java.util.concurrent.ScheduledThreadPoolExecutor; |
|||
import java.util.concurrent.TimeUnit; |
|||
|
|||
/** |
|||
* 从Redis队列中获取Log,保存到DB |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
public class LogConsumer implements CommandLineRunner { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
@Autowired |
|||
private SysLogErrorService sysLogErrorService; |
|||
@Autowired |
|||
private SysLogLoginService sysLogLoginService; |
|||
@Autowired |
|||
private SysLogOperationService sysLogOperationService; |
|||
private ScheduledExecutorService scheduledService = new ScheduledThreadPoolExecutor(1, |
|||
new BasicThreadFactory.Builder().namingPattern("log-consumer-schedule-pool-%d").daemon(true).build()); |
|||
|
|||
@Override |
|||
public void run(String... args) { |
|||
//上次任务结束后,等待10秒钟,再执行下次任务
|
|||
scheduledService.scheduleWithFixedDelay(() -> { |
|||
try { |
|||
receiveQueue(); |
|||
}catch (Exception e){ |
|||
log.error("LogConsumer Error:"+ ExceptionUtils.getErrorStackTrace(e)); |
|||
} |
|||
}, 1, 10, TimeUnit.SECONDS); |
|||
} |
|||
|
|||
private void receiveQueue() { |
|||
String key = RedisKeys.getSysLogKey(); |
|||
//每次插入100条
|
|||
int count = 100; |
|||
for(int i = 0; i < count; i++){ |
|||
BaseLog log = (BaseLog) redisUtils.rightPop(key); |
|||
if(log == null){ |
|||
return; |
|||
} |
|||
|
|||
//登录日志
|
|||
if(log.getType() == LogTypeEnum.LOGIN.value()){ |
|||
SysLogLoginEntity entity = ConvertUtils.sourceToTarget(log, SysLogLoginEntity.class); |
|||
sysLogLoginService.save(entity); |
|||
} |
|||
|
|||
//操作日志
|
|||
if(log.getType() == LogTypeEnum.OPERATION.value()){ |
|||
SysLogOperationEntity entity = ConvertUtils.sourceToTarget(log, SysLogOperationEntity.class); |
|||
sysLogOperationService.save(entity); |
|||
} |
|||
|
|||
//异常日志
|
|||
if(log.getType() == LogTypeEnum.ERROR.value()){ |
|||
SysLogErrorEntity entity = ConvertUtils.sourceToTarget(log, SysLogErrorEntity.class); |
|||
sysLogErrorService.save(entity); |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/1/18 下午4:43 |
|||
*/ |
|||
@Data |
|||
public class SsoLoginOperFormDTO extends LoginCommonFormDTO { |
|||
|
|||
private static final long serialVersionUID = -4215746830030486659L; |
|||
|
|||
public interface ThirdPlatformLoginForm { |
|||
} |
|||
|
|||
/** |
|||
* 上游系统token |
|||
*/ |
|||
@NotBlank(message = "token不能为空", groups = {ThirdPlatformLoginForm.class}) |
|||
private String thirdToken; |
|||
|
|||
/** |
|||
* 上游系统标识 |
|||
* |
|||
* @see com.epmet.enums.ThirdPlatformEnum |
|||
*/ |
|||
@NotBlank(message = "平台标识不能为空", groups = {ThirdPlatformLoginForm.class}) |
|||
private String platform; |
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/1/18 下午4:43 |
|||
*/ |
|||
@Data |
|||
public class SsoWorkLoginFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -6543952487970013031L; |
|||
|
|||
public interface SsoLoginForm{} |
|||
|
|||
/** |
|||
* sso票据,有效期为300秒 |
|||
*/ |
|||
@NotBlank(message = "ssotoken不能为空",groups = SsoLoginForm.class) |
|||
private String token; |
|||
|
|||
/** |
|||
* 三方平台应用AppId |
|||
*/ |
|||
@NotBlank(message = "三方平台应用AppId不能为空",groups = SsoLoginForm.class) |
|||
private String appId; |
|||
|
|||
/** |
|||
* app类型 resi;居民段,gov:工作端 |
|||
*/ |
|||
@NotBlank(message = "app不能为空",groups = SsoLoginForm.class) |
|||
private String app; |
|||
|
|||
/** |
|||
* app;居民段,app:工作端 |
|||
*/ |
|||
@NotBlank(message = "client不能为空",groups = SsoLoginForm.class) |
|||
private String client; |
|||
} |
@ -0,0 +1,57 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/1/18 下午4:43 |
|||
*/ |
|||
@Data |
|||
public class ThirdPlatFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -6543952487970013031L; |
|||
|
|||
public interface SsoLoginForm { |
|||
} |
|||
|
|||
public interface ThirdPlatformLoginForm { |
|||
} |
|||
|
|||
/** |
|||
* sso票据,有效期为300秒 |
|||
*/ |
|||
@NotBlank(message = "sso票据不能为空", groups = {SsoLoginForm.class, ThirdPlatformLoginForm.class}) |
|||
private String ticket; |
|||
|
|||
/** |
|||
* 三方平台应用AppId |
|||
*/ |
|||
@NotBlank(message = "三方平台应用AppId不能为空", groups = SsoLoginForm.class) |
|||
private String appId; |
|||
|
|||
/** |
|||
* app类型 resi;居民段,work:工作端 |
|||
*/ |
|||
@NotBlank(message = "app不能为空", groups = SsoLoginForm.class) |
|||
private String app; |
|||
|
|||
@NotBlank(message = "client不能为空", groups = SsoLoginForm.class) |
|||
private String client; |
|||
|
|||
/** |
|||
* 上游系统token |
|||
*/ |
|||
@NotBlank(message = "token不能为空", groups = {ThirdPlatformLoginForm.class}) |
|||
private String thirdToken; |
|||
|
|||
/** |
|||
* 上游系统token |
|||
* |
|||
* @see com.epmet.enums.ThirdPlatformEnum |
|||
*/ |
|||
@NotBlank(message = "token不能为空", groups = {ThirdPlatformLoginForm.class}) |
|||
private String platform; |
|||
} |
@ -0,0 +1,50 @@ |
|||
package com.epmet.enums; |
|||
|
|||
/** |
|||
* 系统环境变量枚举类 |
|||
* dev|test|prod |
|||
* |
|||
* @author jianjun liu |
|||
* @date 2020-07-03 11:14 |
|||
**/ |
|||
public enum ThirdPlatformEnum { |
|||
/** |
|||
* 平阴联动指挥平台 |
|||
*/ |
|||
PINGYIN_LIANDONG("pyld", "平阴联动指挥平台", "pyldApiService"), |
|||
; |
|||
|
|||
private String code; |
|||
private String name; |
|||
private String apiService; |
|||
|
|||
|
|||
ThirdPlatformEnum(String code, String name, String apiService) { |
|||
this.code = code; |
|||
this.name = name; |
|||
this.apiService = apiService; |
|||
} |
|||
|
|||
public static ThirdPlatformEnum getEnum(String code) { |
|||
ThirdPlatformEnum[] values = ThirdPlatformEnum.values(); |
|||
for (ThirdPlatformEnum value : values) { |
|||
if (value.getCode().equals(code)) { |
|||
return value; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public String getApiService() { |
|||
return apiService; |
|||
} |
|||
} |
@ -0,0 +1,128 @@ |
|||
package com.epmet.commons.thirdplat.apiservice.pyld; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.epmet.commons.thirdplat.apiservice.AbstractApiService; |
|||
import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo; |
|||
import com.epmet.commons.thirdplat.constants.PyldConstants; |
|||
import com.epmet.commons.thirdplat.dto.result.jcet.PyldUserInfoResultDTO; |
|||
import com.epmet.commons.thirdplat.properties.PyldThirdplatProps; |
|||
import com.epmet.commons.thirdplat.properties.ThirdplatProps; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.utils.HttpClientManager; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import org.apache.commons.codec.digest.DigestUtils; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.nio.charset.StandardCharsets; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* desc: 平阴联动指挥平台sso登陆服务类 接入文档:http://note.youdao.com/noteshare?id=167ad65365f9eccf7925e8c2629d2021&sub=555AE50510344CB5AACD5C06B9AA3B3B
|
|||
* |
|||
* @author LiuJanJun |
|||
* @date 2021/2/25 1:43 下午 |
|||
*/ |
|||
@Service |
|||
public class PyldApiService extends AbstractApiService { |
|||
|
|||
Logger logger = LoggerFactory.getLogger(getClass()); |
|||
|
|||
private PyldThirdplatProps pyldThirdplatProps; |
|||
|
|||
public PyldApiService(ThirdplatProps props) { |
|||
this.thirdplatProps = props; |
|||
pyldThirdplatProps = props.getPyld(); |
|||
} |
|||
|
|||
@Override |
|||
public ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws Exception { |
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* @return |
|||
* @Description 通过第三方平台ticket获取用户信息 |
|||
* @author wxz |
|||
* @date 2021.01.19 10:26 |
|||
*/ |
|||
@Override |
|||
public ThirdPlatUserInfo getGUserInfoBySSOToken(String platformToken) { |
|||
|
|||
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>"); |
|||
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口入参 platformToken:{}", platformToken); |
|||
|
|||
|
|||
JSONObject jsonParam = new JSONObject(); |
|||
jsonParam.put(PyldConstants.PLAT_PARAM_TOKEN, platformToken); |
|||
jsonParam.put(PyldConstants.PLAT_PARAM_MANAGEMENTKEY, PyldConstants.PLAT_PARAM_MANAGEMENTKEY_VALUE); |
|||
|
|||
String domain = pyldThirdplatProps.getDomain(); |
|||
Result<String> result = HttpClientManager.getInstance().sendPost( |
|||
domain.concat(PyldConstants.METHOD_CHECK_LOGIN), |
|||
domain.startsWith("https://"), |
|||
jsonParam.toJSONString(), |
|||
buildHeaders()); |
|||
|
|||
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口返回:{}", result.getData()); |
|||
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<"); |
|||
PyldUserInfoResultDTO resultDTO = this.parseResult(result); |
|||
|
|||
ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo(); |
|||
userInfo.setMobile(resultDTO.getMobile()); |
|||
userInfo.setCustomerId(resultDTO.getReserved()); |
|||
return userInfo; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 构建请求头信息 |
|||
* |
|||
* @return |
|||
*/ |
|||
private Map<String, Object> buildHeaders() { |
|||
Map<String, Object> headers = new HashMap(); |
|||
long timestamp = System.currentTimeMillis(); |
|||
headers.put(PyldConstants.PLAT_HEADER_TIMESTAMP, timestamp); |
|||
headers.put(PyldConstants.PLAT_HEADER_APP_KEY, pyldThirdplatProps.getAppkey()); |
|||
String encryptContent = pyldThirdplatProps.getAppId() + pyldThirdplatProps.getAppkey() + pyldThirdplatProps.getAppSecret() + timestamp; |
|||
headers.put(PyldConstants.PLAT_HEADER_ACCESS_TOKEN, DigestUtils.md5Hex(encryptContent.getBytes(StandardCharsets.UTF_8))); |
|||
return headers; |
|||
} |
|||
|
|||
/** |
|||
* desc: 解析结果 |
|||
* |
|||
* @param thResult |
|||
* @return com.epmet.commons.thirdplat.dto.result.jcet.JcetUserInfoResultDTO |
|||
* @author LiuJanJun |
|||
* @date 2021/2/24 10:11 上午 |
|||
*/ |
|||
private PyldUserInfoResultDTO parseResult(Result<String> thResult) { |
|||
if (!thResult.success()) { |
|||
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), |
|||
EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getMsg().concat(":").concat(thResult.getInternalMsg())); |
|||
} |
|||
JSONObject jcetResult = JSON.parseObject(thResult.getData()); |
|||
Integer code = jcetResult.getInteger("code"); |
|||
String msg = jcetResult.getString("msg"); |
|||
if (code == null || code != 0) { |
|||
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), msg.concat(",错误码:") + code); |
|||
} |
|||
JSONObject data = jcetResult.getJSONObject("data"); |
|||
if (data == null) { |
|||
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), |
|||
EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getMsg().concat(":").concat(PyldConstants.REPONSE_USER_NOT_LOGIN)); |
|||
} |
|||
PyldUserInfoResultDTO userInfo = data.getObject("userInfo", PyldUserInfoResultDTO.class); |
|||
if (userInfo == null || StringUtils.isBlank(userInfo.getMobile()) || StringUtils.isBlank(userInfo.getReserved())) { |
|||
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), PyldConstants.REPONSE_USER_NOT_LOGIN); |
|||
} |
|||
return userInfo; |
|||
} |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.commons.thirdplat.constants; |
|||
|
|||
public interface PyldConstants { |
|||
|
|||
String METHOD_CHECK_LOGIN = "/unifiedAuth/loginCheck"; |
|||
|
|||
|
|||
String PLAT_HEADER_TIMESTAMP = "timestamp"; |
|||
String PLAT_HEADER_APP_KEY = "appkey"; |
|||
String PLAT_HEADER_ACCESS_TOKEN = "accessToken"; |
|||
|
|||
|
|||
String PLAT_PARAM_TOKEN = "platformToken"; |
|||
String PLAT_PARAM_MANAGEMENTKEY = "managementKey"; |
|||
String PLAT_PARAM_MANAGEMENTKEY_VALUE = "epmet_work"; |
|||
|
|||
String REPONSE_USER_NOT_LOGIN = "token失效,请重新登陆"; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.commons.thirdplat.dto.result.jcet; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class JcetGUserInfoResultDTO { |
|||
private String uid; |
|||
/** |
|||
* 手机号码 |
|||
*/ |
|||
private String mobile; |
|||
/** |
|||
* 姓名 |
|||
*/ |
|||
private String name; |
|||
/** |
|||
* 账号 |
|||
*/ |
|||
private String account; |
|||
|
|||
/** |
|||
* 用户编码 |
|||
*/ |
|||
private String code; |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.commons.thirdplat.dto.result.jcet; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
public class PyldUserInfoResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 6176427074670949388L; |
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String mobile; |
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
private String reserved; |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.epmet.commons.thirdplat.properties; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 酒城e通三方平台配置 |
|||
*/ |
|||
@Data |
|||
public class PyldThirdplatProps { |
|||
private String domain; |
|||
private String appId; |
|||
private String appkey; |
|||
private String appSecret; |
|||
} |
@ -1,24 +0,0 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.commons.tools.annotation; |
|||
|
|||
import java.lang.annotation.*; |
|||
|
|||
/** |
|||
* 操作日志注解 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Target(ElementType.METHOD) |
|||
@Retention(RetentionPolicy.RUNTIME) |
|||
@Documented |
|||
public @interface LogOperation { |
|||
String value() default ""; |
|||
} |
@ -0,0 +1,84 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.commons.tools.aspect; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.dingtalk.api.DefaultDingTalkClient; |
|||
import com.dingtalk.api.DingTalkClient; |
|||
import com.dingtalk.api.request.OapiRobotSendRequest; |
|||
import com.dingtalk.api.response.OapiRobotSendResponse; |
|||
import com.epmet.commons.tools.enums.EnvEnum; |
|||
import com.epmet.commons.tools.utils.SpringContextUtils; |
|||
import com.taobao.api.ApiException; |
|||
import org.apache.logging.log4j.LogManager; |
|||
import org.apache.logging.log4j.Logger; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.boot.context.event.ApplicationFailedEvent; |
|||
import org.springframework.cloud.commons.util.InetUtils; |
|||
import org.springframework.context.ApplicationListener; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 应用 启动健康检查 通知类 |
|||
* CustomerApplicationRunner |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Component |
|||
public class ApplicationFailedEventListener implements ApplicationListener<ApplicationFailedEvent> { |
|||
private static Logger logger = LogManager.getLogger(ApplicationFailedEventListener.class); |
|||
@Value("${spring.application.name}") |
|||
private String appName; |
|||
@Value("${server.version}") |
|||
private String version; |
|||
|
|||
@Override |
|||
public void onApplicationEvent(ApplicationFailedEvent applicationFailedEvent) { |
|||
Throwable exception = applicationFailedEvent.getException(); |
|||
EnvEnum currentEnv = EnvEnum.getCurrentEnv(); |
|||
logger.info(currentEnv); |
|||
if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode()) && !EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())) { |
|||
sendDingMarkDownMsg(exception); |
|||
} |
|||
} |
|||
|
|||
|
|||
private String getServerIp() { |
|||
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class); |
|||
return inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); |
|||
} |
|||
|
|||
private void sendDingMarkDownMsg(Throwable exception) { |
|||
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5"); |
|||
OapiRobotSendRequest request = new OapiRobotSendRequest(); |
|||
request.setMsgtype("markdown"); |
|||
OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); |
|||
markdown.setTitle("部署失败通知"); |
|||
|
|||
markdown.setText("部署失败通知 \n" + |
|||
"> 服务:" + appName + "\n\n" + |
|||
"> 版本:" + version + "\n\n" + |
|||
"> 环境:" + EnvEnum.getCurrentEnv().getName() + "\n\n" + |
|||
"> IP: " + getServerIp() + "\n\n" + |
|||
"> 异常:" + exception.getMessage() + "\n\n" |
|||
); |
|||
request.setMarkdown(markdown); |
|||
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At(); |
|||
at.setIsAtAll(true); |
|||
request.setAt(at); |
|||
try { |
|||
OapiRobotSendResponse execute = client.execute(request); |
|||
logger.info("=====通知结果===>" + JSON.toJSONString(execute)); |
|||
} catch (ApiException e) { |
|||
logger.error("sendDingMarkDownMsg exception", e); |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,109 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.commons.tools.aspect; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.dingtalk.api.DefaultDingTalkClient; |
|||
import com.dingtalk.api.DingTalkClient; |
|||
import com.dingtalk.api.request.OapiRobotSendRequest; |
|||
import com.dingtalk.api.response.OapiRobotSendResponse; |
|||
import com.epmet.commons.tools.dto.form.DingTalkTextMsg; |
|||
import com.epmet.commons.tools.enums.EnvEnum; |
|||
import com.epmet.commons.tools.utils.HttpClientManager; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.utils.SpringContextUtils; |
|||
import com.taobao.api.ApiException; |
|||
import org.apache.logging.log4j.LogManager; |
|||
import org.apache.logging.log4j.Logger; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.boot.context.event.ApplicationReadyEvent; |
|||
import org.springframework.cloud.commons.util.InetUtils; |
|||
import org.springframework.context.ApplicationListener; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 应用 启动健康检查 通知类 |
|||
* CustomerApplicationRunner |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Component |
|||
public class ApplicationReadyEventListener implements ApplicationListener<ApplicationReadyEvent> { |
|||
private static Logger logger = LogManager.getLogger(ApplicationReadyEventListener.class); |
|||
@Value("${spring.application.name}") |
|||
private String appName; |
|||
@Value("${server.version}") |
|||
private String version; |
|||
|
|||
@Override |
|||
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) { |
|||
EnvEnum currentEnv = EnvEnum.getCurrentEnv(); |
|||
logger.info(currentEnv); |
|||
if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode()) && !EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())) { |
|||
//sendDingTextMsg();
|
|||
sendDingMarkDownMsg(); |
|||
} |
|||
} |
|||
|
|||
private void sendDingTextMsg() { |
|||
//发送启动成功消息
|
|||
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class); |
|||
String serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); |
|||
|
|||
//开发小组 群机器人地址
|
|||
String url = "https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5"; |
|||
StringBuilder stringBuilder = new StringBuilder(); |
|||
stringBuilder.append(EnvEnum.getCurrentEnv().getName()) |
|||
.append("【") |
|||
.append(appName) |
|||
.append("】") |
|||
.append("ip地址: ") |
|||
.append(serverIp) |
|||
.append("部署完毕!"); |
|||
DingTalkTextMsg msg = new DingTalkTextMsg(); |
|||
msg.setWebHook(url); |
|||
msg.setAtAll(true); |
|||
msg.setContent(stringBuilder.toString()); |
|||
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSON(url, msg.getMsgContent()); |
|||
logger.info(stringResult); |
|||
} |
|||
|
|||
private String getServerIp() { |
|||
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class); |
|||
return inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); |
|||
} |
|||
|
|||
private void sendDingMarkDownMsg() { |
|||
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5"); |
|||
OapiRobotSendRequest request = new OapiRobotSendRequest(); |
|||
request.setMsgtype("markdown"); |
|||
OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); |
|||
markdown.setTitle("部署成功通知"); |
|||
|
|||
markdown.setText("部署成功通知 \n" + |
|||
"> 服务:" + appName + "\n\n" + |
|||
"> 版本:" + version + "\n\n" + |
|||
"> 环境:" + EnvEnum.getCurrentEnv().getName() + "\n\n" + |
|||
"> IP: " + getServerIp() + "\n\n" |
|||
); |
|||
request.setMarkdown(markdown); |
|||
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At(); |
|||
at.setIsAtAll(true); |
|||
request.setAt(at); |
|||
try { |
|||
OapiRobotSendResponse execute = client.execute(request); |
|||
logger.info("=====通知结果===>" + JSON.toJSONString(execute)); |
|||
} catch (ApiException e) { |
|||
logger.error("sendDingMarkDownMsg exception", e); |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
@ -1,67 +0,0 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.commons.tools.aspect; |
|||
|
|||
import com.epmet.commons.tools.dto.form.DingTalkTextMsg; |
|||
import com.epmet.commons.tools.enums.EnvEnum; |
|||
import com.epmet.commons.tools.utils.HttpClientManager; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.utils.SpringContextUtils; |
|||
import org.apache.logging.log4j.LogManager; |
|||
import org.apache.logging.log4j.Logger; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.boot.ApplicationArguments; |
|||
import org.springframework.boot.ApplicationRunner; |
|||
import org.springframework.cloud.commons.util.InetUtils; |
|||
import org.springframework.core.annotation.Order; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 应用 启动健康检查 通知类 |
|||
* CustomerApplicationRunner |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Component |
|||
@Order(value = 99) |
|||
public class CustomerApplicationRunner implements ApplicationRunner { |
|||
private static Logger logger = LogManager.getLogger(CustomerApplicationRunner.class); |
|||
@Value("${spring.application.name}") |
|||
private String appName; |
|||
|
|||
@Override |
|||
public void run(ApplicationArguments args) { |
|||
//发送启动成功消息
|
|||
EnvEnum currentEnv = EnvEnum.getCurrentEnv(); |
|||
logger.info(currentEnv); |
|||
if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode()) && !EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())) { |
|||
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class); |
|||
String serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); |
|||
|
|||
//开发小组 群机器人地址
|
|||
String url = "https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5"; |
|||
StringBuilder stringBuilder = new StringBuilder(); |
|||
stringBuilder.append(EnvEnum.getCurrentEnv().getName()) |
|||
.append("【") |
|||
.append(appName) |
|||
.append("】") |
|||
.append("ip地址: ") |
|||
.append(serverIp) |
|||
.append("部署完毕!"); |
|||
DingTalkTextMsg msg = new DingTalkTextMsg(); |
|||
msg.setWebHook(url); |
|||
msg.setAtAll(true); |
|||
msg.setContent(stringBuilder.toString()); |
|||
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSON(url, msg.getMsgContent()); |
|||
logger.info(stringResult); |
|||
} |
|||
} |
|||
|
|||
} |
@ -1,121 +0,0 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.commons.tools.aspect; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.tools.annotation.LogOperation; |
|||
import com.epmet.commons.tools.config.ModuleConfig; |
|||
import com.epmet.commons.tools.security.user.SecurityUser; |
|||
import com.epmet.commons.tools.log.SysLogOperation; |
|||
import com.epmet.commons.tools.log.enums.LogTypeEnum; |
|||
import com.epmet.commons.tools.log.enums.OperationStatusEnum; |
|||
import com.epmet.commons.tools.log.producer.LogProducer; |
|||
import com.epmet.commons.tools.security.user.UserDetail; |
|||
import com.epmet.commons.tools.utils.HttpContextUtils; |
|||
import com.epmet.commons.tools.utils.IpUtils; |
|||
import org.aspectj.lang.ProceedingJoinPoint; |
|||
import org.aspectj.lang.annotation.Around; |
|||
import org.aspectj.lang.annotation.Aspect; |
|||
import org.aspectj.lang.annotation.Pointcut; |
|||
import org.aspectj.lang.reflect.MethodSignature; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpHeaders; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.lang.reflect.Method; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 操作日志,切面处理类 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Aspect |
|||
@Component |
|||
public class LogOperationAspect { |
|||
@Autowired |
|||
private ModuleConfig moduleConfig; |
|||
@Autowired |
|||
private LogProducer logProducer; |
|||
|
|||
@Pointcut("@annotation(com.epmet.commons.tools.annotation.LogOperation)") |
|||
public void logPointCut() { |
|||
|
|||
} |
|||
|
|||
@Around("logPointCut()") |
|||
public Object around(ProceedingJoinPoint point) throws Throwable { |
|||
long beginTime = System.currentTimeMillis(); |
|||
try { |
|||
//执行方法
|
|||
Object result = point.proceed(); |
|||
|
|||
//执行时长(毫秒)
|
|||
long time = System.currentTimeMillis() - beginTime; |
|||
//保存日志
|
|||
saveLog(point, time, OperationStatusEnum.SUCCESS.value()); |
|||
|
|||
return result; |
|||
}catch(Exception e) { |
|||
//执行时长(毫秒)
|
|||
long time = System.currentTimeMillis() - beginTime; |
|||
//保存日志
|
|||
saveLog(point, time, OperationStatusEnum.FAIL.value()); |
|||
|
|||
throw e; |
|||
} |
|||
} |
|||
|
|||
|
|||
private void saveLog(ProceedingJoinPoint joinPoint, long time, Integer status) { |
|||
MethodSignature signature = (MethodSignature) joinPoint.getSignature(); |
|||
Method method = signature.getMethod(); |
|||
|
|||
SysLogOperation log = new SysLogOperation(); |
|||
LogOperation annotation = method.getAnnotation(LogOperation.class); |
|||
if(annotation != null){ |
|||
//注解上的描述
|
|||
log.setOperation(annotation.value()); |
|||
} |
|||
|
|||
//登录用户信息
|
|||
UserDetail user = SecurityUser.getUser(); |
|||
if(user != null){ |
|||
log.setCreator(user.getId()); |
|||
log.setCreatorName(user.getUsername()); |
|||
} |
|||
|
|||
log.setType(LogTypeEnum.OPERATION.value()); |
|||
log.setModule(moduleConfig.getName()); |
|||
log.setStatus(status); |
|||
log.setRequestTime((int)time); |
|||
log.setCreateDate(new Date()); |
|||
|
|||
//请求相关信息
|
|||
HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); |
|||
log.setIp(IpUtils.getIpAddr(request)); |
|||
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT)); |
|||
log.setRequestUri(request.getRequestURI()); |
|||
log.setRequestMethod(request.getMethod()); |
|||
|
|||
//请求参数
|
|||
Object[] args = joinPoint.getArgs(); |
|||
try{ |
|||
String params = JSON.toJSONString(args[0]); |
|||
log.setRequestParams(params); |
|||
}catch (Exception e){ |
|||
|
|||
} |
|||
|
|||
//保存到Redis队列里
|
|||
logProducer.saveLog(log); |
|||
} |
|||
} |
@ -1,153 +0,0 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.commons.tools.exception; |
|||
|
|||
import cn.hutool.core.map.MapUtil; |
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.tools.config.ModuleConfig; |
|||
import com.epmet.commons.tools.log.SysLogError; |
|||
import com.epmet.commons.tools.log.enums.LogTypeEnum; |
|||
import com.epmet.commons.tools.log.producer.LogProducer; |
|||
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|||
import com.epmet.commons.tools.utils.HttpContextUtils; |
|||
import com.epmet.commons.tools.utils.IpUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.dao.DuplicateKeyException; |
|||
import org.springframework.http.HttpHeaders; |
|||
import org.springframework.web.bind.annotation.ExceptionHandler; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.util.Date; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 异常处理器 |
|||
* 暂停使用,改用BaseRequestLogAspect |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
//@RestControllerAdvice
|
|||
public class RenExceptionHandler { |
|||
private static final Logger logger = LoggerFactory.getLogger(RenExceptionHandler.class); |
|||
@Autowired |
|||
private ModuleConfig moduleConfig; |
|||
@Autowired |
|||
private LogProducer logProducer; |
|||
@Autowired |
|||
private LoginUserUtil loginUserUtil; |
|||
|
|||
/** |
|||
* 处理自定义异常 |
|||
* "code": 8000, |
|||
* "msg": "服务器开小差了...", |
|||
*/ |
|||
@ExceptionHandler(RenException.class) |
|||
public Result handleRRException(RenException ex){ |
|||
if (ex.getCode() > 8000) { |
|||
Result result=new Result().error(ex.getCode()); |
|||
result.setData(ex.getInternalMsg()); |
|||
return result; |
|||
} |
|||
logger.error(ExceptionUtils.getErrorStackTrace(ex)); |
|||
Result result=new Result().error(); |
|||
result.setData(ex.getInternalMsg()); |
|||
return result; |
|||
// return new Result().error();
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 处理自定义异常 |
|||
* "code": 8000, |
|||
* "msg": "服务器开小差了...", |
|||
*/ |
|||
@ExceptionHandler(ValidateException.class) |
|||
public Result handleVException(ValidateException ex){ |
|||
logger.error(ExceptionUtils.getErrorStackTrace(ex)); |
|||
Result result=new Result(); |
|||
result.setCode(ex.getCode()); |
|||
result.setMsg(ex.getMsg()); |
|||
return result; |
|||
// return new Result().error();
|
|||
} |
|||
|
|||
/** |
|||
* 运行时异常拦截 |
|||
* "code": 8000, |
|||
* "msg": "服务器开小差了...", |
|||
*/ |
|||
@ExceptionHandler(RuntimeException.class) |
|||
public Result handleRuntimeException(RuntimeException ex){ |
|||
logger.error(ExceptionUtils.getErrorStackTrace(ex)); |
|||
Result result=new Result().error(); |
|||
result.setData(ex.getMessage()); |
|||
return result; |
|||
// return new Result().error();
|
|||
} |
|||
|
|||
/** |
|||
* 处理自定义异常 |
|||
* "code": 10002, |
|||
* "msg": "数据库中已存在该记录", |
|||
*/ |
|||
@ExceptionHandler(DuplicateKeyException.class) |
|||
public Result handleDuplicateKeyException(DuplicateKeyException ex){ |
|||
logger.error(ExceptionUtils.getErrorStackTrace(ex)); |
|||
return new Result().error(ErrorCode.DB_RECORD_EXISTS); |
|||
} |
|||
|
|||
/** |
|||
* 异常 |
|||
* "code": 8000, |
|||
* "msg": "服务器开小差了...", |
|||
*/ |
|||
@ExceptionHandler(Exception.class) |
|||
public Result handleException(Exception ex){ |
|||
logger.error(ExceptionUtils.getErrorStackTrace(ex)); |
|||
// saveLog(ex);
|
|||
Result result=new Result().error(); |
|||
result.setData(ex.getMessage()); |
|||
return result; |
|||
// return new Result().error();
|
|||
} |
|||
|
|||
/** |
|||
* 保存异常日志 |
|||
*/ |
|||
private void saveLog(Exception ex){ |
|||
SysLogError log = new SysLogError(); |
|||
log.setType(LogTypeEnum.ERROR.value()); |
|||
log.setModule(moduleConfig.getName()); |
|||
|
|||
//请求相关信息
|
|||
HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); |
|||
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT)); |
|||
log.setRequestUri(request.getRequestURI()); |
|||
log.setRequestMethod(request.getMethod()); |
|||
log.setIp(IpUtils.getIpAddr(request)); |
|||
Map<String, String> params = HttpContextUtils.getParameterMap(request); |
|||
if(MapUtil.isNotEmpty(params)){ |
|||
log.setRequestParams(JSON.toJSONString(params)); |
|||
} |
|||
|
|||
//登录用户ID
|
|||
|
|||
log.setCreator(loginUserUtil.getLoginUserId()); |
|||
//异常信息
|
|||
log.setErrorInfo(ExceptionUtils.getErrorStackTrace(ex)); |
|||
|
|||
//保存到Redis队列里
|
|||
log.setCreateDate(new Date()); |
|||
logProducer.saveLog(log); |
|||
} |
|||
} |
@ -1,43 +0,0 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* |
|||
* https://www.renren.io
|
|||
* |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.commons.tools.log.producer; |
|||
|
|||
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|||
import com.epmet.commons.tools.log.BaseLog; |
|||
import com.epmet.commons.tools.redis.RedisKeys; |
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.concurrent.*; |
|||
|
|||
/** |
|||
* 日志通过redis队列,异步保存到数据库 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Component |
|||
public class LogProducer { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("log-producer-pool-%d").build(); |
|||
ExecutorService pool = new ThreadPoolExecutor(5, 200, 0L,TimeUnit.MILLISECONDS, |
|||
new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); |
|||
|
|||
/** |
|||
* 保存Log到Redis消息队列 |
|||
*/ |
|||
public void saveLog(BaseLog log){ |
|||
String key = RedisKeys.getSysLogKey(); |
|||
|
|||
//异步保存到队列
|
|||
pool.execute(() -> redisUtils.leftPush(key, log, RedisUtils.NOT_EXPIRE)); |
|||
} |
|||
} |
@ -0,0 +1,251 @@ |
|||
package com.epmet.commons.tools.utils; |
|||
|
|||
import javax.crypto.Cipher; |
|||
import java.security.*; |
|||
import java.security.spec.PKCS8EncodedKeySpec; |
|||
import java.security.spec.X509EncodedKeySpec; |
|||
import java.util.Base64; |
|||
|
|||
/** |
|||
* @author jianjun liu |
|||
* @date 2020-06-05 16:48 |
|||
**/ |
|||
|
|||
public class RSASignature { |
|||
|
|||
|
|||
//非对称密钥算法
|
|||
private static final String KEY_ALGORITHM = "RSA"; |
|||
//密钥长度,在512到65536位之间,建议不要太长,否则速度很慢,生成的加密数据很长
|
|||
private static final int KEY_SIZE = 512; |
|||
//字符编码
|
|||
private static final String CHARSET = "UTF-8"; |
|||
|
|||
/** |
|||
* 生成密钥对 |
|||
* |
|||
* @return KeyPair 密钥对 |
|||
*/ |
|||
public static KeyPair getKeyPair() throws Exception { |
|||
return getKeyPair(null); |
|||
} |
|||
|
|||
/** |
|||
* 生成密钥对 |
|||
* |
|||
* @param password 生成密钥对的密码 |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
public static KeyPair getKeyPair(String password) throws Exception { |
|||
//实例化密钥生成器
|
|||
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(KEY_ALGORITHM); |
|||
//初始化密钥生成器
|
|||
if (password == null) { |
|||
keyPairGenerator.initialize(KEY_SIZE); |
|||
} else { |
|||
SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); |
|||
secureRandom.setSeed(password.getBytes(CHARSET)); |
|||
keyPairGenerator.initialize(KEY_SIZE, secureRandom); |
|||
} |
|||
//生成密钥对
|
|||
return keyPairGenerator.generateKeyPair(); |
|||
} |
|||
|
|||
/** |
|||
* 取得私钥 |
|||
* |
|||
* @param keyPair 密钥对 |
|||
* @return byte[] 私钥 |
|||
*/ |
|||
public static byte[] getPrivateKeyBytes(KeyPair keyPair) { |
|||
return keyPair.getPrivate().getEncoded(); |
|||
} |
|||
|
|||
/** |
|||
* 取得Base64编码的私钥 |
|||
* |
|||
* @param keyPair 密钥对 |
|||
* @return String Base64编码的私钥 |
|||
*/ |
|||
public static String getPrivateKey(KeyPair keyPair) { |
|||
return Base64.getEncoder().encodeToString(getPrivateKeyBytes(keyPair)); |
|||
} |
|||
|
|||
/** |
|||
* 取得公钥 |
|||
* |
|||
* @param keyPair 密钥对 |
|||
* @return byte[] 公钥 |
|||
*/ |
|||
public static byte[] getPublicKeyBytes(KeyPair keyPair) { |
|||
return keyPair.getPublic().getEncoded(); |
|||
} |
|||
|
|||
/** |
|||
* 取得Base64编码的公钥 |
|||
* |
|||
* @param keyPair 密钥对 |
|||
* @return String Base64编码的公钥 |
|||
*/ |
|||
public static String getPublicKey(KeyPair keyPair) { |
|||
return Base64.getEncoder().encodeToString(getPublicKeyBytes(keyPair)); |
|||
} |
|||
|
|||
/** |
|||
* 私钥加密 |
|||
* |
|||
* @param data 待加密数据 |
|||
* @param privateKey 私钥字节数组 |
|||
* @return byte[] 加密数据 |
|||
*/ |
|||
public static byte[] encryptByPrivateKey(byte[] data, byte[] privateKey) throws Exception { |
|||
//实例化密钥工厂
|
|||
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); |
|||
//生成私钥
|
|||
PrivateKey key = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(privateKey)); |
|||
//数据加密
|
|||
Cipher cipher = Cipher.getInstance(KEY_ALGORITHM); |
|||
cipher.init(Cipher.ENCRYPT_MODE, key); |
|||
return cipher.doFinal(data); |
|||
} |
|||
|
|||
/** |
|||
* 私钥加密 |
|||
* |
|||
* @param data 待加密数据 |
|||
* @param privateKey Base64编码的私钥 |
|||
* @return String Base64编码的加密数据 |
|||
*/ |
|||
public static String encryptByPrivateKey(String data, String privateKey) throws Exception { |
|||
byte[] key = Base64.getDecoder().decode(privateKey); |
|||
return Base64.getEncoder().encodeToString(encryptByPrivateKey(data.getBytes(CHARSET), key)); |
|||
} |
|||
|
|||
/** |
|||
* 公钥加密 |
|||
* |
|||
* @param data 待加密数据 |
|||
* @param publicKey 公钥字节数组 |
|||
* @return byte[] 加密数据 |
|||
*/ |
|||
public static byte[] encryptByPublicKey(byte[] data, byte[] publicKey) throws Exception { |
|||
//实例化密钥工厂
|
|||
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); |
|||
//生成公钥
|
|||
PublicKey key = keyFactory.generatePublic(new X509EncodedKeySpec(publicKey)); |
|||
//数据加密
|
|||
Cipher cipher = Cipher.getInstance(KEY_ALGORITHM); |
|||
cipher.init(Cipher.ENCRYPT_MODE, key); |
|||
return cipher.doFinal(data); |
|||
} |
|||
|
|||
/** |
|||
* 公钥加密 |
|||
* |
|||
* @param data 待加密数据 |
|||
* @param publicKey Base64编码的公钥 |
|||
* @return String Base64编码的加密数据 |
|||
*/ |
|||
public static String encryptByPublicKey(String data, String publicKey) throws Exception { |
|||
byte[] key = Base64.getDecoder().decode(publicKey); |
|||
return Base64.getEncoder().encodeToString(encryptByPublicKey(data.getBytes(CHARSET), key)); |
|||
} |
|||
|
|||
/** |
|||
* 私钥解密 |
|||
* |
|||
* @param data 待解密数据 |
|||
* @param privateKey 私钥字节数组 |
|||
* @return byte[] 解密数据 |
|||
*/ |
|||
public static byte[] decryptByPrivateKey(byte[] data, byte[] privateKey) throws Exception { |
|||
//实例化密钥工厂
|
|||
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); |
|||
//生成私钥
|
|||
PrivateKey key = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(privateKey)); |
|||
//数据解密
|
|||
Cipher cipher = Cipher.getInstance(KEY_ALGORITHM); |
|||
cipher.init(Cipher.DECRYPT_MODE, key); |
|||
return cipher.doFinal(data); |
|||
} |
|||
|
|||
/** |
|||
* 私钥解密 |
|||
* |
|||
* @param data Base64编码的待解密数据 |
|||
* @param privateKey Base64编码的私钥 |
|||
* @return String 解密数据 |
|||
*/ |
|||
public static String decryptByPrivateKey(String data, String privateKey) throws Exception { |
|||
byte[] key = Base64.getDecoder().decode(privateKey); |
|||
return new String(decryptByPrivateKey(Base64.getDecoder().decode(data), key), CHARSET); |
|||
} |
|||
|
|||
/** |
|||
* 公钥解密 |
|||
* |
|||
* @param data 待解密数据 |
|||
* @param publicKey 公钥字节数组 |
|||
* @return byte[] 解密数据 |
|||
*/ |
|||
public static byte[] decryptByPublicKey(byte[] data, byte[] publicKey) throws Exception { |
|||
//实例化密钥工厂
|
|||
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); |
|||
//产生公钥
|
|||
PublicKey key = keyFactory.generatePublic(new X509EncodedKeySpec(publicKey)); |
|||
//数据解密
|
|||
Cipher cipher = Cipher.getInstance(KEY_ALGORITHM); |
|||
cipher.init(Cipher.DECRYPT_MODE, key); |
|||
return cipher.doFinal(data); |
|||
} |
|||
|
|||
/** |
|||
* 公钥解密 |
|||
* |
|||
* @param data Base64编码的待解密数据 |
|||
* @param publicKey Base64编码的公钥 |
|||
* @return String 解密数据 |
|||
*/ |
|||
public static String decryptByPublicKey(String data, String publicKey) throws Exception { |
|||
byte[] key = Base64.getDecoder().decode(publicKey); |
|||
return new String(decryptByPublicKey(Base64.getDecoder().decode(data), key), CHARSET); |
|||
} |
|||
|
|||
/** |
|||
* 测试加解密方法 |
|||
* |
|||
* @param args |
|||
* @throws Exception |
|||
*/ |
|||
public static void main(String[] args) throws Exception { |
|||
//生成密钥对,一般生成之后可以放到配置文件中
|
|||
KeyPair keyPair = RSASignature.getKeyPair(); |
|||
//公钥
|
|||
String publicKey = RSASignature.getPublicKey(keyPair); |
|||
//私钥
|
|||
String privateKey = RSASignature.getPrivateKey(keyPair); |
|||
|
|||
System.out.println("公钥:\n" + publicKey); |
|||
System.out.println("私钥:\n" + privateKey); |
|||
|
|||
String data = "RSA 加解密测试!"; |
|||
{ |
|||
System.out.println("\n===========私钥加密,公钥解密=============="); |
|||
String s1 = RSASignature.encryptByPrivateKey(data, privateKey); |
|||
System.out.println("加密后的数据:" + s1); |
|||
String s2 = RSASignature.decryptByPublicKey(s1, publicKey); |
|||
System.out.println("解密后的数据:" + s2 + "\n\n"); |
|||
} |
|||
//=====
|
|||
{ |
|||
System.out.println("\n===========公钥加密,私钥解密=============="); |
|||
String s1 = RSASignature.encryptByPublicKey(data, publicKey); |
|||
System.out.println("加密后的数据:" + s1); |
|||
String s2 = RSASignature.decryptByPrivateKey(s1, privateKey); |
|||
System.out.println("解密后的数据:" + s2 + "\n\n"); |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 描述一下 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/27 17:52 |
|||
*/ |
|||
@Data |
|||
public class AgencyInfoDTO implements Serializable { |
|||
private String agencyId; |
|||
private String areaCode; |
|||
private List<String> subAgencyIds; |
|||
private List<String> subGridIds; |
|||
} |
@ -0,0 +1,142 @@ |
|||
/** |
|||
* 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 java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 项目(事件)分类按网格_按天统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-02-23 |
|||
*/ |
|||
@Data |
|||
public class ScreenProjectCategoryGridDailyDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 日期yyyyMMdd |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 网格所属的组织id |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 网格所有的父级id,以英文:或者英文,隔开 |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* e世通中的项目类别编码 |
|||
*/ |
|||
private String epmetCategoryCode; |
|||
|
|||
/** |
|||
* 该分类下所有项目总数 |
|||
*/ |
|||
private Integer projectTotal; |
|||
|
|||
/** |
|||
* 该分类下,正在处理中的项目总数 |
|||
*/ |
|||
private Integer pendingTotal; |
|||
|
|||
/** |
|||
* 该分类下已结案的项目总数 |
|||
*/ |
|||
private Integer closedTotal; |
|||
|
|||
/** |
|||
* 该分类下已结案无需解决的项目总数 |
|||
*/ |
|||
private Integer unResolvedTotal; |
|||
|
|||
/** |
|||
* 该分类下已结案已解决的项目总数 |
|||
*/ |
|||
private Integer resolvedTotal; |
|||
|
|||
/** |
|||
* 该分类下项目结案率 |
|||
*/ |
|||
private BigDecimal closedRatio; |
|||
|
|||
/** |
|||
* 该分类下已结案项目解决率 |
|||
*/ |
|||
private BigDecimal resolvedRatio; |
|||
|
|||
/** |
|||
* 该分类下已结案项目未解决率 |
|||
*/ |
|||
private BigDecimal unResolvedRatio; |
|||
|
|||
/** |
|||
* 删除标识 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,147 @@ |
|||
/** |
|||
* 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 java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 项目(事件)分类按组织_按天统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-02-23 |
|||
*/ |
|||
@Data |
|||
public class ScreenProjectCategoryOrgDailyDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 日期yyyyMMdd |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 组织id |
|||
*/ |
|||
private String orgId; |
|||
|
|||
/** |
|||
* 社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province |
|||
*/ |
|||
private String orgType; |
|||
|
|||
/** |
|||
* 当前orgId所属的上级id |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* orgId所有的父级id,以英文:或者英文,隔开 |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* e世通中的项目类别编码 |
|||
*/ |
|||
private String epmetCategoryCode; |
|||
|
|||
/** |
|||
* 该分类下所有项目总数 |
|||
*/ |
|||
private Integer projectTotal; |
|||
|
|||
/** |
|||
* 该分类下,正在处理中的项目总数 |
|||
*/ |
|||
private Integer pendingTotal; |
|||
|
|||
/** |
|||
* 该分类下已结案的项目总数 |
|||
*/ |
|||
private Integer closedTotal; |
|||
|
|||
/** |
|||
* 该分类下已结案无需解决的项目总数 |
|||
*/ |
|||
private Integer unResolvedTotal; |
|||
|
|||
/** |
|||
* 该分类下已结案已解决的项目总数 |
|||
*/ |
|||
private Integer resolvedTotal; |
|||
|
|||
/** |
|||
* 该分类下项目结案率 |
|||
*/ |
|||
private BigDecimal closedRatio; |
|||
|
|||
/** |
|||
* 该分类下已结案项目解决率 |
|||
*/ |
|||
private BigDecimal resolvedRatio; |
|||
|
|||
/** |
|||
* 该分类下已结案项目未解决率 |
|||
*/ |
|||
private BigDecimal unResolvedRatio; |
|||
|
|||
/** |
|||
* 删除标识 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.epmet.dto.form.screen; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2021/2/23 15:26 |
|||
*/ |
|||
@Data |
|||
public class CategoryAnalysisFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -3088762710988337423L; |
|||
|
|||
public interface CategoryAnalysis{} |
|||
|
|||
@NotBlank(message = "组织ID不能为空",groups = {CategoryAnalysis.class}) |
|||
private String agencyId; |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.epmet.dto.result.screen; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2021/2/23 15:28 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class CategoryAnalysisResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 4500337306142206855L; |
|||
/** |
|||
* 类别名称 |
|||
*/ |
|||
private String categoryName; |
|||
/** |
|||
* 项目总数 |
|||
*/ |
|||
private Integer projectTotal; |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.evaluationindex.screen.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: liushaowen |
|||
* @date: 2021/2/24 16:12 |
|||
*/ |
|||
@Data |
|||
public class ScreenProjectDetailFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@NotBlank(message = "projectId不能为空") |
|||
private String projectId; |
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.epmet.evaluationindex.screen.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: liushaowen |
|||
* @date: 2021/2/24 15:22 |
|||
*/ |
|||
@Data |
|||
public class ScreenProjectDistributionFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 目前只有平阴在传,默认赋值:370124 |
|||
*/ |
|||
private String areaCode; |
|||
|
|||
/** |
|||
* 如果为空返回全部;可选值:1:红色事件;2:黄色事件;3:绿色事件 |
|||
*/ |
|||
private String level; |
|||
|
|||
/** |
|||
* 当前组织id |
|||
*/ |
|||
@NotBlank(message = "agencyId不能为空") |
|||
private String agencyId; |
|||
|
|||
|
|||
/** |
|||
* 不必填;默认查询的是处理中;可选值:all: 全部,pending:处理中 已结案:closed_case ;已关闭:closed |
|||
* 默认查询pending |
|||
*/ |
|||
private String status; |
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.epmet.evaluationindex.screen.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* 描述一下 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/28 14:29 |
|||
*/ |
|||
@Data |
|||
public class SubAgencyIndexRankPyFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 8930332375421099186L; |
|||
/** |
|||
* 当前组织,平阴大屏,默认传跟组织 |
|||
* */ |
|||
@NotBlank(message = "agencyId不能为空") |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 目前只有平阴在传,默认赋值:370124 |
|||
* */ |
|||
@NotBlank(message = "areaCode不能为空;平阴默认传:370124") |
|||
private String areaCode; |
|||
|
|||
/** |
|||
* 默认查询前10条 |
|||
* */ |
|||
@NotNull(message = "topNum不能为空") |
|||
private Integer topNum; |
|||
|
|||
@NotBlank(message = "type不能为空,街道:street;网格:grid") |
|||
private String type; |
|||
|
|||
@NotBlank(message = "customerId不能为空") |
|||
private String customerId; |
|||
} |
@ -0,0 +1,124 @@ |
|||
package com.epmet.evaluationindex.screen.dto.result; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonInclude; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: liushaowen |
|||
* @date: 2021/2/24 16:15 |
|||
*/ |
|||
@Data |
|||
public class ScreenProjectDetailResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
/** |
|||
* 项目id |
|||
*/ |
|||
private String projectId; |
|||
/** |
|||
* 议题内容,其实就是项目内容 |
|||
*/ |
|||
private String projectContent; |
|||
/** |
|||
* 上报时间,对应的是立项时间;格式:yyyy-MM-dd HH:mm |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
|||
private String reportTime; |
|||
/** |
|||
* 所属类别名称 |
|||
*/ |
|||
private String categoryName; |
|||
/** |
|||
* 上报人名 |
|||
*/ |
|||
private String reportUserName; |
|||
/** |
|||
* 上报人电话 |
|||
*/ |
|||
private String mobile; |
|||
/** |
|||
* 上报位置 |
|||
*/ |
|||
private String reportAddress; |
|||
/** |
|||
* 图片列表 |
|||
*/ |
|||
private List<String> imgList; |
|||
/** |
|||
* 处理进展列表(返回的是按时间升序的集合) |
|||
*/ |
|||
private List<processDTO> processList; |
|||
|
|||
@Data |
|||
public static class processDTO{ |
|||
@JsonIgnore |
|||
private String processId; |
|||
/** |
|||
* 处理部门名称 |
|||
*/ |
|||
private String handleDeptName; |
|||
/** |
|||
* 公开处理意见 |
|||
*/ |
|||
private String suggestion; |
|||
/** |
|||
* 处理时间:yyyy-MM-dd HH:mm:ss |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date reponseTime; |
|||
/** |
|||
* 关闭:close; 回应 response,结案closed_case,退回return,部门流转transfer,创建项目created |
|||
*/ |
|||
private String operation; |
|||
/** |
|||
* 被吹哨部门;如果是多个以逗号隔开返给前端。 |
|||
*/ |
|||
private String whistleDeptName; |
|||
|
|||
private List<AttachmentDTO> attachments; |
|||
|
|||
@Data |
|||
public static class AttachmentDTO{ |
|||
@JsonInclude(JsonInclude.Include.NON_NULL) |
|||
/** |
|||
* 文件名 |
|||
*/ |
|||
private String fileName; |
|||
@JsonInclude(JsonInclude.Include.NON_NULL) |
|||
/** |
|||
* 附件名(uuid随机生成) |
|||
*/ |
|||
private String attachmentName; |
|||
@JsonInclude(JsonInclude.Include.NON_NULL) |
|||
/** |
|||
* 附件大小 字节为单位 |
|||
*/ |
|||
private String attachmentSize; |
|||
@JsonInclude(JsonInclude.Include.NON_NULL) |
|||
/** |
|||
* 文件格式(JPG、PNG、JPEG、BMP、GIF、PDF、PPT、PPTX、DOC、DOCX、XLS、XLSX、MP3、WMA、M4A、MP4、AVI、MOV、RMVB、RM、WMV) |
|||
*/ |
|||
private String attachmentFormat; |
|||
@JsonInclude(JsonInclude.Include.NON_NULL) |
|||
/** |
|||
* 文件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) |
|||
*/ |
|||
private String attachmentType; |
|||
/** |
|||
* url地址 |
|||
*/ |
|||
private String attachmentUrl; |
|||
@JsonInclude(JsonInclude.Include.NON_NULL) |
|||
/** |
|||
* 语音或视频时长,秒 |
|||
*/ |
|||
private String duration; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.epmet.evaluationindex.screen.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: liushaowen |
|||
* @date: 2021/2/24 15:26 |
|||
*/ |
|||
@Data |
|||
public class ScreenProjectDistributionResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
/** |
|||
* 主键id |
|||
*/ |
|||
private String id; |
|||
/** |
|||
* 项目标题 |
|||
*/ |
|||
private String projectTitle; |
|||
/** |
|||
* 项目等级 1:红色事件;2:黄色事件;3:绿色事件 |
|||
*/ |
|||
private String level; |
|||
/** |
|||
* 经纬度 |
|||
*/ |
|||
private String longitude; |
|||
private String latitude; |
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.epmet.plugins.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 7、【工作日志】党员志愿者服务近12月趋势图 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/27 19:53 |
|||
*/ |
|||
@Data |
|||
public class VoluntaryServiceTrendFormDTO { |
|||
/** |
|||
* 当前组织id |
|||
*/ |
|||
@NotBlank(message = "agencyId不能为空") |
|||
private String agencyId; |
|||
|
|||
@NotBlank(message = "目前只有平阴在传,默认赋值:370124") |
|||
private String areaCode; |
|||
|
|||
@NotBlank(message = "customerId不能为空") |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 截止到某月格式:yyyyMM;目前没有让大屏前端赋值,代码默认为为上个月 |
|||
*/ |
|||
private String endMonthId; |
|||
} |
@ -0,0 +1,46 @@ |
|||
package com.epmet.plugins.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 6、【工作日志】近12月趋势图 |
|||
* |
|||
* @author sun |
|||
*/ |
|||
@Data |
|||
public class WorkRecordTrendFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -2934835714413031036L; |
|||
/** |
|||
* party:支部建设; union:联建共建;党员志愿服务:voluntaryservice |
|||
*/ |
|||
@NotBlank(message = "dataType不能为空;可选值:party:支部建设; union:联建共建") |
|||
private String dataType; |
|||
|
|||
/** |
|||
* 当前组织id |
|||
*/ |
|||
@NotBlank(message = "agencyId不能为空") |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 组织次数:organize;参与人数:joinuser;平均参与人数:avguser |
|||
*/ |
|||
@NotBlank(message = "type不能为空") |
|||
private String type; |
|||
|
|||
@NotBlank(message = "customerId不能为空") |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 查询数据起始月份Id |
|||
*/ |
|||
private String startMonth; |
|||
|
|||
/** |
|||
* 查询数据结束月份Id |
|||
*/ |
|||
private String endMonth; |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.epmet.plugins.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 7、【工作日志】党员志愿者服务近12月趋势图 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/28 13:41 |
|||
*/ |
|||
@Data |
|||
public class VoluntaryServiceTrendDTO implements Serializable { |
|||
private String monthId; |
|||
/** |
|||
* 组织次数 |
|||
*/ |
|||
private Integer organizeTotal; |
|||
|
|||
/** |
|||
* 参与人数 |
|||
*/ |
|||
private Integer participateUserTotal; |
|||
|
|||
/** |
|||
* 平均参与人数 |
|||
*/ |
|||
private Integer avgParticipateUserTotal; |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.plugins.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 7、【工作日志】党员志愿者服务近12月趋势图 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/27 19:55 |
|||
*/ |
|||
@Data |
|||
public class VoluntaryServiceTrendResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -560895826884970305L; |
|||
private List<String> xAxis=new ArrayList<>(); |
|||
//组织次数:organize;参与人数:joinuser;平均参与人数:avguser
|
|||
private List<Integer> organizeList=new ArrayList<>(); |
|||
private List<Integer> joinUserList=new ArrayList<>(); |
|||
private List<Integer> avgUserList=new ArrayList<>(); |
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue