Browse Source

Merge branch 'dev_heart' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_heart

dev
zhangyongzhangyong 5 years ago
parent
commit
03e89e55e5
  1. 45
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java
  2. 9
      epmet-module/epmet-heart/epmet-heart-server/pom.xml
  3. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/logback-spring.xml
  4. 11
      epmet-module/epmet-point/epmet-point-server/pom.xml
  5. 63
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java
  6. 8
      epmet-module/epmet-point/epmet-point-server/src/main/resources/logback-spring.xml

45
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java

@ -0,0 +1,45 @@
package com.epmet.commons.tools.dto.form.mq.eventmsg;
import lombok.Data;
import java.io.Serializable;
/**
* desc积分相关事件消息体
*
* @author lyn
* @date 2020/7/23 16:34
*/
@Data
public class BasePointEventMsg implements Serializable {
private static final long serialVersionUID = 4037225404113743943L;
/**
* 操作人机关id
*/
private String opAgencyId;
/**
* 客户Id
*/
private String customerId;
/**
* 被操作用户id
*/
private String userId;
/**
* 加减分标识 plus/minus
*/
private String actionFlag;
/**
* 积分值
*/
private Integer point;
/**
* 是否是通用事件通用事件不走规则
*/
private Boolean isCommon;
}

9
epmet-module/epmet-heart/epmet-heart-server/pom.xml

@ -138,6 +138,9 @@
<elink.mq.sendMsgPath>producerService/producer/sendMsg</elink.mq.sendMsgPath> <elink.mq.sendMsgPath>producerService/producer/sendMsg</elink.mq.sendMsgPath>
<elink.mq.appId>202007161443499985fa2d397436d10356542134c8f008c48</elink.mq.appId> <elink.mq.appId>202007161443499985fa2d397436d10356542134c8f008c48</elink.mq.appId>
<elink.mq.token>52d9d9b0e7d0eb5b8b81c205b579e07c</elink.mq.token> <elink.mq.token>52d9d9b0e7d0eb5b8b81c205b579e07c</elink.mq.token>
<!--测试钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19</dingTalk.robot.secret>
</properties> </properties>
</profile> </profile>
<profile> <profile>
@ -176,6 +179,9 @@
<elink.mq.sendMsgPath>producerService/producer/sendMsg</elink.mq.sendMsgPath> <elink.mq.sendMsgPath>producerService/producer/sendMsg</elink.mq.sendMsgPath>
<elink.mq.appId>202007161443499985fa2d397436d10356542134c8f008c48</elink.mq.appId> <elink.mq.appId>202007161443499985fa2d397436d10356542134c8f008c48</elink.mq.appId>
<elink.mq.token>52d9d9b0e7d0eb5b8b81c205b579e07c</elink.mq.token> <elink.mq.token>52d9d9b0e7d0eb5b8b81c205b579e07c</elink.mq.token>
<!--测试钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19</dingTalk.robot.secret>
</properties> </properties>
</profile> </profile>
<profile> <profile>
@ -214,6 +220,9 @@
<elink.mq.sendMsgPath>producerService/producer/sendMsg</elink.mq.sendMsgPath> <elink.mq.sendMsgPath>producerService/producer/sendMsg</elink.mq.sendMsgPath>
<elink.mq.appId>202007161443499985fa2d397436d10356542134c8f008c48</elink.mq.appId> <elink.mq.appId>202007161443499985fa2d397436d10356542134c8f008c48</elink.mq.appId>
<elink.mq.token>52d9d9b0e7d0eb5b8b81c205b579e07c</elink.mq.token> <elink.mq.token>52d9d9b0e7d0eb5b8b81c205b579e07c</elink.mq.token>
<!--生产钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1</dingTalk.robot.secret>
</properties> </properties>
</profile> </profile>
</profiles> </profiles>

8
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/logback-spring.xml

@ -5,6 +5,8 @@
<property name="log.path" value="logs/heart"/> <property name="log.path" value="logs/heart"/>
<springProperty scope="context" name="appname" source="spring.application.name"/> <springProperty scope="context" name="appname" source="spring.application.name"/>
<springProperty scope="context" name="webHook" source="dingTalk.robot.webHook"/>
<springProperty scope="context" name="secret" source="dingTalk.robot.secret"/>
<!-- 日志上下文名称 --> <!-- 日志上下文名称 -->
<contextName>${appname}</contextName> <contextName>${appname}</contextName>
@ -125,11 +127,13 @@
<!--日志文档保留天数--> <!--日志文档保留天数-->
<maxHistory>15</maxHistory> <maxHistory>15</maxHistory>
</rollingPolicy> </rollingPolicy>
<!-- 此日志文档只记录ERROR级别的 --> <filter class="com.epmet.commons.tools.filter.LogMsgSendFilter">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level> <level>ERROR</level>
<onMatch>ACCEPT</onMatch> <onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch> <onMismatch>DENY</onMismatch>
<webHook>${webHook}</webHook>
<secret>${secret}</secret>
<appName>${appname}</appName>
</filter> </filter>
</appender> </appender>

11
epmet-module/epmet-point/epmet-point-server/pom.xml

@ -137,6 +137,9 @@
<nacos.ip/> <nacos.ip/>
<spring.flyway.enabled>false</spring.flyway.enabled> <spring.flyway.enabled>false</spring.flyway.enabled>
<!--钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19</dingTalk.robot.secret>
</properties> </properties>
</profile> </profile>
<profile> <profile>
@ -169,6 +172,9 @@
<nacos.ip/> <nacos.ip/>
<spring.flyway.enabled>true</spring.flyway.enabled> <spring.flyway.enabled>true</spring.flyway.enabled>
<!--钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19</dingTalk.robot.secret>
</properties> </properties>
</profile> </profile>
<profile> <profile>
@ -201,8 +207,11 @@
<nacos.ip/> <nacos.ip/>
<spring.flyway.enabled>true</spring.flyway.enabled> <spring.flyway.enabled>true</spring.flyway.enabled>
<!--生产钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1</dingTalk.robot.secret>
</properties> </properties>
</profile> </profile>
</profiles> </profiles>
</project> </project>

63
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java

@ -2,12 +2,17 @@ package com.epmet.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.dto.form.mq.ReceiveMqMsg; import com.epmet.commons.tools.dto.form.mq.ReceiveMqMsg;
import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.service.UserPointActionLogService;
import dto.form.SendPointFormDTO; import dto.form.SendPointFormDTO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -16,7 +21,6 @@ import org.springframework.web.bind.annotation.RestController;
* *
* @date: 2020/7/21 9:04 * @date: 2020/7/21 9:04
* @author: jianjun liu * @author: jianjun liu
* email:liujianjun@git.elinkit.com.cn
*/ */
@Slf4j @Slf4j
@RestController @RestController
@ -24,6 +28,9 @@ import org.springframework.web.bind.annotation.RestController;
public class MqPointCallbackController { public class MqPointCallbackController {
private Logger logger = LogManager.getLogger(MqPointCallbackController.class); private Logger logger = LogManager.getLogger(MqPointCallbackController.class);
@Autowired
private UserPointActionLogService userPointActionLogService;
/** /**
* desc爱心活动积分发放 * desc爱心活动积分发放
* *
@ -38,8 +45,62 @@ public class MqPointCallbackController {
return "success"; return "success";
} }
SendPointFormDTO formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), SendPointFormDTO.class); SendPointFormDTO formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), SendPointFormDTO.class);
try {
//TODO 调用调整积分方法去给用户加减积分 userPointActionLogService.
} catch (Exception e) {
logger.error("activeSendPoint consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg()));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg());
}
log.info("activeSendPoint consumer success,formDTO:{}", JSON.toJSONString(formDTO)); log.info("activeSendPoint consumer success,formDTO:{}", JSON.toJSONString(formDTO));
return "success"; return "success";
} }
/**
* desc爱心互助-志愿者注册消息
*
* @param mqMsg
* @return
*/
@RequestMapping("registervolunteer")
public String registerVolunteer(ReceiveMqMsg mqMsg) {
log.debug("registerVolunteer receive mqMsg:{}", JSON.toJSONString(mqMsg));
if (mqMsg == null || StringUtils.isBlank(mqMsg.getMsg())) {
log.warn("registerVolunteer mqMsg is empty");
return "success";
}
BasePointEventMsg formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), BasePointEventMsg.class);
try {
//TODO 调用调整积分方法去给用户加减积分 userPointActionLogService.
} catch (Exception e) {
logger.error("registerVolunteer consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg()));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg());
}
log.info("registerVolunteer consumer success,formDTO:{}", JSON.toJSONString(formDTO));
return "success";
}
/**
* desc爱心互助-发布实况消息
*
* @param mqMsg
* @return
*/
@RequestMapping("pubactivelive")
public String pubActiveLive(ReceiveMqMsg mqMsg) {
log.debug("pubActiveLive receive mqMsg:{}", JSON.toJSONString(mqMsg));
if (mqMsg == null || StringUtils.isBlank(mqMsg.getMsg())) {
log.warn("pubActiveLive mqMsg is empty");
return "success";
}
BasePointEventMsg formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), BasePointEventMsg.class);
try {
//TODO 调用调整积分方法去给用户加减积分 userPointActionLogService.
} catch (Exception e) {
logger.error("pubActiveLive consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg()));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg());
}
log.info("pubActiveLive consumer success,formDTO:{}", JSON.toJSONString(formDTO));
return "success";
}
} }

8
epmet-module/epmet-point/epmet-point-server/src/main/resources/logback-spring.xml

@ -5,6 +5,8 @@
<property name="log.path" value="logs/point"/> <property name="log.path" value="logs/point"/>
<springProperty scope="context" name="appname" source="spring.application.name"/> <springProperty scope="context" name="appname" source="spring.application.name"/>
<springProperty scope="context" name="webHook" source="dingTalk.robot.webHook"/>
<springProperty scope="context" name="secret" source="dingTalk.robot.secret"/>
<!-- 日志上下文名称 --> <!-- 日志上下文名称 -->
<contextName>${appname}</contextName> <contextName>${appname}</contextName>
@ -125,11 +127,13 @@
<!--日志文档保留天数--> <!--日志文档保留天数-->
<maxHistory>15</maxHistory> <maxHistory>15</maxHistory>
</rollingPolicy> </rollingPolicy>
<!-- 此日志文档只记录ERROR级别的 --> <filter class="com.epmet.commons.tools.filter.LogMsgSendFilter">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level> <level>ERROR</level>
<onMatch>ACCEPT</onMatch> <onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch> <onMismatch>DENY</onMismatch>
<webHook>${webHook}</webHook>
<secret>${secret}</secret>
<appName>${appname}</appName>
</filter> </filter>
</appender> </appender>

Loading…
Cancel
Save