Commit b251d18d authored by caotao's avatar caotao

平台修改密码同步给业务

parent 05e5e9ef
package com.yeejoin.amos.boot.module.jxiop.biz.listener;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonAccount;
import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonAccountFed;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonAccountFedMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonAccountMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.activemq.command.ActiveMQTextMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import javax.jms.Message;
@Component
@Slf4j
public class PlatformModifyPasswordistener {
@Autowired
PersonAccountMapper personAccountMapper;
@Autowired
PersonAccountFedMapper personAccountFedMapper;
@Value("${amos.secret.key}")
private String secretKey;
@JmsListener(destination = "${modifypasswordqueue}")
public void reciveMesssage(Message message) {
try {
String dadainfo = ((ActiveMQTextMessage) message).getText();
JSONObject jsonObject = JSONObject.parseObject(dadainfo);
jsonObject = (JSONObject) jsonObject.get("body");
jsonObject = (JSONObject) jsonObject.get("authData");
PersonAccount personAccount = personAccountMapper.selectOne(new QueryWrapper<PersonAccount>().eq("puser_id", jsonObject.get("userId")));
if (!ObjectUtils.isEmpty(personAccount)) {
personAccount.setPassword((String) jsonObject.get("password"));
personAccount.setSecondaryPassword((String) jsonObject.get("rePassword"));
personAccountMapper.updateById(personAccount);
}
PersonAccountFed personAccountFed = personAccountFedMapper.selectOne(new QueryWrapper<PersonAccountFed>().eq("puser_id", jsonObject.get("userId")));
if (!ObjectUtils.isEmpty(personAccount)) {
personAccountFed.setPassword((String) jsonObject.get("password"));
personAccountFed.setSecondaryPassword((String) jsonObject.get("rePassword"));
personAccountFedMapper.updateById(personAccountFed);
}
message.acknowledge();
log.info("--------------------消息消费成功 {}", jsonObject);
} catch (Exception e) {
e.printStackTrace();
} finally {
}
}
}
......@@ -80,8 +80,9 @@ amos.secret.key=qaz
#eureka.instance.ip-address=172.16.3.122
spring.activemq.broker-url=tcp://139.9.173.44:61616
spring.activemq.broker-url=tcp://172.16.10.253:61616
spring.activemq.user=admin
spring.activemq.password=admin
spring.jms.pub-sub-domain=false
myqueue=amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness
modifypasswordqueue= amos.privilege.v1.JXIOP.AMOS_ADMIN.modifyPassword
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment