修改增加日志和异步日志线程池和内部调用方法

parent b290d05e
...@@ -51,7 +51,7 @@ public class LogCallHttpAspect { ...@@ -51,7 +51,7 @@ public class LogCallHttpAspect {
} }
return result; return result;
} }
@Async("logExecutor")
public void asyncRecordIt(ProceedingJoinPoint pjp, Object result, String remoteIP){ public void asyncRecordIt(ProceedingJoinPoint pjp, Object result, String remoteIP){
Object[] args = pjp.getArgs(); Object[] args = pjp.getArgs();
String methodName = pjp.getSignature().getName(); String methodName = pjp.getSignature().getName();
......
package cn.quantgroup.xyqb.config.thread;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
/**
* Created by xuran on 2017/11/8.
*/
@Configuration
@EnableAsync
public class AsyncConfig {
/**
* 生成线程池
* @param corePoolSize
* @param maxPoolSize
* @param queueCapacity
* @param waitForCompleteOnShutdown
* @param prefix
* @return
*/
private ThreadPoolTaskExecutor generateThreadPoolTaskExecutor(int corePoolSize, int maxPoolSize, int queueCapacity,
boolean waitForCompleteOnShutdown, int keepAliveSeconds,
boolean allowCoreThreadTimeOut, String prefix) {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(corePoolSize);
executor.setMaxPoolSize(maxPoolSize);
executor.setQueueCapacity(queueCapacity);
executor.setKeepAliveSeconds(keepAliveSeconds);
executor.setAllowCoreThreadTimeOut(allowCoreThreadTimeOut);
executor.setWaitForTasksToCompleteOnShutdown(waitForCompleteOnShutdown);
executor.setThreadNamePrefix(prefix);
executor.initialize();
return executor ;
}
/**
* 日志线程池
* @return
*/
@Bean(name = "logExecutor")
public Executor loanMqExecutor(){
return generateThreadPoolTaskExecutor(100, 2000, 2000, true, 30, true, "loanMqExecutor-");
}
}
...@@ -71,7 +71,6 @@ public class AppController implements IBaseController { ...@@ -71,7 +71,6 @@ public class AppController implements IBaseController {
* 第三方用户登录 * 第三方用户登录
*/ */
@RequestMapping("/login") @RequestMapping("/login")
@LogHttpCaller
public JsonResult login( public JsonResult login(
String phoneNo, String phoneNo,
@RequestParam(required = false, defaultValue = "1") Long registerFrom, @RequestParam(required = false, defaultValue = "1") Long registerFrom,
...@@ -83,7 +82,7 @@ public class AppController implements IBaseController { ...@@ -83,7 +82,7 @@ public class AppController implements IBaseController {
} }
String requestIp = IPUtil.getRemoteIP(request); String requestIp = IPUtil.getRemoteIP(request);
LOGGER.info("第三方用户登录, loginFrom:{}, requestIp:{}", registerFrom, requestIp); LOGGER.info("app/login第三方用户登录, loginFrom:{},channelId:{},btRegisterChannelId:{} requestIp:{},idNo:{},name:{}", registerFrom,channelId,btRegisterChannelId, requestIp,idNo,name);
User user = userService.findByPhoneInDb(phoneNo); User user = userService.findByPhoneInDb(phoneNo);
if (user == null) { if (user == null) {
user = register(registerFrom, phoneNo, idNo, name, channelId,btRegisterChannelId); user = register(registerFrom, phoneNo, idNo, name, channelId,btRegisterChannelId);
...@@ -116,7 +115,6 @@ public class AppController implements IBaseController { ...@@ -116,7 +115,6 @@ public class AppController implements IBaseController {
/** /**
* 给app用 * 给app用
*/ */
@LogHttpCaller
@RequestMapping("/login2") @RequestMapping("/login2")
public JsonResult login2( public JsonResult login2(
String phoneNo, String phoneNo,
...@@ -130,7 +128,7 @@ public class AppController implements IBaseController { ...@@ -130,7 +128,7 @@ public class AppController implements IBaseController {
} }
String requestIp = IPUtil.getRemoteIP(request); String requestIp = IPUtil.getRemoteIP(request);
LOGGER.info("第三方用户登录, loginFrom:{}, requestIp:{}", registerFrom, requestIp); LOGGER.info("第三方用户登录, loginFrom:{},channelId:{}, requestIp:{}", registerFrom,channelId, requestIp);
User user = userService.findByPhoneInDb(phoneNo); User user = userService.findByPhoneInDb(phoneNo);
if (user == null) { if (user == null) {
...@@ -169,7 +167,7 @@ public class AppController implements IBaseController { ...@@ -169,7 +167,7 @@ public class AppController implements IBaseController {
} }
String requestIp = IPUtil.getRemoteIP(request); String requestIp = IPUtil.getRemoteIP(request);
LOGGER.info("第三方用户登录, loginFrom:{}, requestIp:{}", registerFrom, requestIp); LOGGER.info("app/login_super第三方用户登录, loginFrom:{},channelId:{},btRegisterChannelId:{} requestIp:{},idNo:{},name:{}", registerFrom,channelId,btRegisterChannelId, requestIp,idNo,name);
User user = userService.findByPhoneInDb(phoneNo); User user = userService.findByPhoneInDb(phoneNo);
if (user == null) { if (user == null) {
user = register(registerFrom, phoneNo, idNo, name, channelId,btRegisterChannelId); user = register(registerFrom, phoneNo, idNo, name, channelId,btRegisterChannelId);
...@@ -200,7 +198,7 @@ public class AppController implements IBaseController { ...@@ -200,7 +198,7 @@ public class AppController implements IBaseController {
context.setAppChannel(appChannel); context.setAppChannel(appChannel);
loginInfo.setLoginContext(context); loginInfo.setLoginContext(context);
LOGGER.info("第三方用户获取信息登录成功, loginFrom:{}, phoneNo:{},appChannel:{}", registerFrom, phoneNo, appChannel); LOGGER.info("第三方用户获取信息登录成功, loginFrom:{}, phoneNo:{},appChannel:{},channelId:{}", registerFrom, phoneNo, appChannel,channelId);
return JsonResult.buildSuccessResult("", loginInfo); return JsonResult.buildSuccessResult("", loginInfo);
......
package cn.quantgroup.xyqb.controller.external.user; package cn.quantgroup.xyqb.controller.external.user;
import cn.quantgroup.user.enums.Relation;
import cn.quantgroup.xyqb.aspect.logcaller.LogHttpCaller; import cn.quantgroup.xyqb.aspect.logcaller.LogHttpCaller;
import cn.quantgroup.xyqb.controller.IBaseController; import cn.quantgroup.xyqb.controller.IBaseController;
import cn.quantgroup.xyqb.entity.Address; import cn.quantgroup.xyqb.entity.Address;
...@@ -210,6 +211,7 @@ public class InnerController implements IBaseController { ...@@ -210,6 +211,7 @@ public class InnerController implements IBaseController {
public JsonResult saveUser( public JsonResult saveUser(
String phoneNo, Long registeredFrom, Long createdAt, Long updatedAt, String phoneNo, Long registeredFrom, Long createdAt, Long updatedAt,
String password, String uuid) { String password, String uuid) {
LOGGER.info("保存用户,phoneNo:{},registeredFrom;{},uuid:{}",phoneNo,registeredFrom,uuid);
//参数验证 //参数验证
if (StringUtils.isBlank(phoneNo)) { if (StringUtils.isBlank(phoneNo)) {
return JsonResult.buildErrorStateResult("用户手机号不能为空.", null); return JsonResult.buildErrorStateResult("用户手机号不能为空.", null);
...@@ -231,6 +233,7 @@ public class InnerController implements IBaseController { ...@@ -231,6 +233,7 @@ public class InnerController implements IBaseController {
if (user == null) { if (user == null) {
user = new User(); user = new User();
} else if (!user.getEnable()) { } else if (!user.getEnable()) {
LOGGER.info("用户已经注销,phoneNo:{},",phoneNo);
return JsonResult.buildErrorStateResult("用户已经注销", null); return JsonResult.buildErrorStateResult("用户已经注销", null);
} }
if (org.apache.commons.lang.StringUtils.isEmpty(user.getUuid())) { if (org.apache.commons.lang.StringUtils.isEmpty(user.getUuid())) {
...@@ -262,6 +265,7 @@ public class InnerController implements IBaseController { ...@@ -262,6 +265,7 @@ public class InnerController implements IBaseController {
@RequestMapping("/user_detail/save") @RequestMapping("/user_detail/save")
public JsonResult saveUserDetail(Long userId, String phoneNo, String name, String idNo, public JsonResult saveUserDetail(Long userId, String phoneNo, String name, String idNo,
String email, Long id) { String email, Long id) {
LOGGER.info("保存用户详细信息,phoneNo:{},userId;{},name:{},idNo:{},email;{}",phoneNo,userId,name,idNo,email);
//参数验证 //参数验证
if (userId == null || userId == 0L) { if (userId == null || userId == 0L) {
return JsonResult.buildErrorStateResult("用户id为空.", null); return JsonResult.buildErrorStateResult("用户id为空.", null);
...@@ -364,7 +368,7 @@ public class InnerController implements IBaseController { ...@@ -364,7 +368,7 @@ public class InnerController implements IBaseController {
@RequestMapping("/contact/save/contacts") @RequestMapping("/contact/save/contacts")
public JsonResult save2Contact(Long userId, @RequestParam(value = "contacts") String contactsStr) { public JsonResult save2Contact(Long userId, @RequestParam(value = "contacts") String contactsStr) {
LOGGER.info("保存用户联系人:userId:{}, contacts:" + contactsStr); LOGGER.info("保存用户联系人:userId:{}, contacts:{}",userId, contactsStr);
if (StringUtils.isEmpty(contactsStr)) { if (StringUtils.isEmpty(contactsStr)) {
return JsonResult.buildErrorStateResult(null, null); return JsonResult.buildErrorStateResult(null, null);
} }
...@@ -398,6 +402,46 @@ public class InnerController implements IBaseController { ...@@ -398,6 +402,46 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult(null, ContactRet.contacts2ContactRets(result)); return JsonResult.buildSuccessResult(null, ContactRet.contacts2ContactRets(result));
} }
@RequestMapping("/contact/update/contact")
public JsonResult updateContact(@RequestParam Long contactId, @RequestParam(required = false) String name,
@RequestParam(required = false) String phoneNo,
@RequestParam(required = false) Relation relation, String key) {
if (!"@qwsdedad131323213w!".equals(key)) {
return JsonResult.buildErrorStateResult("参数不合法", null);
}
Contact contact = contactService.findById(contactId);
if (null == contact) {
return JsonResult.buildErrorStateResult("修改联系人不存在", null);
}
if (null == name && null == phoneNo) {
return JsonResult.buildErrorStateResult("修改联系人修改条件不能都为空", null);
}
if (!ValidationUtil.validatePhoneNo(contact.getPhoneNo())) {
return JsonResult.buildErrorStateResult("用户手机号错误", null);
}
if (!ValidationUtil.validateChinese(contact.getName())) {
return JsonResult.buildErrorStateResult("用户姓名错误", null);
}
if (null != name) {
contact.setName(name);
}
if (null != phoneNo) {
contact.setPhoneNo(phoneNo);
}
if (null != relation) {
contact.setRelation(relation);
}
Timestamp now = new Timestamp(System.currentTimeMillis());
contact.setUpdateAt(now);
contact = contactService.save(contact);
return JsonResult.buildSuccessResult("修改联系人成功", contact);
}
private void convertContactList(Long userId, List<Contact> contacts, Timestamp now) { private void convertContactList(Long userId, List<Contact> contacts, Timestamp now) {
for (Contact c : contacts) { for (Contact c : contacts) {
c.setId(null); c.setId(null);
...@@ -424,7 +468,7 @@ public class InnerController implements IBaseController { ...@@ -424,7 +468,7 @@ public class InnerController implements IBaseController {
public JsonResult saveAddress( public JsonResult saveAddress(
Long userId, Long provinceCode, Long cityCode, String city, Long userId, Long provinceCode, Long cityCode, String city,
Long districtCode, String district, String address, String province) { Long districtCode, String district, String address, String province) {
LOGGER.info("保存地址详情:city:{},province:{}" + city, province); LOGGER.info("保存地址详情:city:{},province:{},userId:{}" + city, province,userId);
if (userId == null || provinceCode == null || cityCode == null) { if (userId == null || provinceCode == null || cityCode == null) {
return JsonResult.buildErrorStateResult(null, null); return JsonResult.buildErrorStateResult(null, null);
} }
...@@ -448,6 +492,7 @@ public class InnerController implements IBaseController { ...@@ -448,6 +492,7 @@ public class InnerController implements IBaseController {
} }
@RequestMapping("/user_ext_info/update") @RequestMapping("/user_ext_info/update")
@LogHttpCaller
public JsonResult updateMarryStatus( public JsonResult updateMarryStatus(
Long userId, IncomeEnum incomeEnum, IncomeRangeEnum incomeRangeEnum, Long userId, IncomeEnum incomeEnum, IncomeRangeEnum incomeRangeEnum,
OccupationEnum occupationEnum, EducationEnum educationEnum, Boolean hasCar, OccupationEnum occupationEnum, EducationEnum educationEnum, Boolean hasCar,
...@@ -798,6 +843,7 @@ public class InnerController implements IBaseController { ...@@ -798,6 +843,7 @@ public class InnerController implements IBaseController {
* 保存用户信息,地址信息,联系人信息 * 保存用户信息,地址信息,联系人信息
*/ */
@RequestMapping("/user/save_multi") @RequestMapping("/user/save_multi")
@LogHttpCaller
public JsonResult saveMulti( public JsonResult saveMulti(
String registeredFrom, String registeredFrom,
String channelId, String channelId,
......
...@@ -18,6 +18,7 @@ import cn.quantgroup.xyqb.service.sms.ISmsService; ...@@ -18,6 +18,7 @@ import cn.quantgroup.xyqb.service.sms.ISmsService;
import cn.quantgroup.xyqb.service.user.IUserDetailService; import cn.quantgroup.xyqb.service.user.IUserDetailService;
import cn.quantgroup.xyqb.service.user.IUserService; import cn.quantgroup.xyqb.service.user.IUserService;
import cn.quantgroup.xyqb.service.wechat.IWechatService; import cn.quantgroup.xyqb.service.wechat.IWechatService;
import cn.quantgroup.xyqb.util.DateUtils;
import cn.quantgroup.xyqb.util.MqUtils; import cn.quantgroup.xyqb.util.MqUtils;
import cn.quantgroup.xyqb.util.PasswordUtil; import cn.quantgroup.xyqb.util.PasswordUtil;
import cn.quantgroup.xyqb.util.ValidationUtil; import cn.quantgroup.xyqb.util.ValidationUtil;
...@@ -37,6 +38,7 @@ import java.io.UnsupportedEncodingException; ...@@ -37,6 +38,7 @@ import java.io.UnsupportedEncodingException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.concurrent.TimeUnit;
/** /**
* Created by FrankChow on 15/7/5. * Created by FrankChow on 15/7/5.
...@@ -75,12 +77,11 @@ public class UserController implements IBaseController { ...@@ -75,12 +77,11 @@ public class UserController implements IBaseController {
'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
@RequestMapping("/login") @RequestMapping("/login")
@LogHttpCaller
public JsonResult login( public JsonResult login(
@RequestParam(required = false, defaultValue = "1") Long channelId, String appChannel, @RequestParam(required = false, defaultValue = "1") Long channelId, String appChannel,
@RequestParam(required = false, defaultValue = "1") Long createdFrom, @RequestParam(required = false, defaultValue = "1") Long createdFrom,
@RequestParam(required = false, defaultValue = "") String userId, @RequestParam(required = false,defaultValue = "xyqb") String key, HttpServletRequest request, String openId,@RequestParam(required = false) String dimension) { @RequestParam(required = false, defaultValue = "") String userId, @RequestParam(required = false,defaultValue = "xyqb") String key, HttpServletRequest request, String openId,@RequestParam(required = false) String dimension) {
LOGGER.info("user/login,请求参数channelId:{},appChannel:{},createdFrom:{},userId:{},key:{},openId:{},dimension:{},",channelId,appChannel,createdFrom,userId,key,openId,dimension);
Merchant merchant = merchantService.findMerchantByName(key); Merchant merchant = merchantService.findMerchantByName(key);
if (merchant == null) { if (merchant == null) {
return JsonResult.buildErrorStateResult("未知的连接", null); return JsonResult.buildErrorStateResult("未知的连接", null);
...@@ -113,11 +114,12 @@ public class UserController implements IBaseController { ...@@ -113,11 +114,12 @@ public class UserController implements IBaseController {
} }
@RequestMapping("/login/fast") @RequestMapping("/login/fast")
@LogHttpCaller
public JsonResult loginFast( public JsonResult loginFast(
@RequestParam(required = false, defaultValue = "1") Long channelId, String appChannel, @RequestParam(required = false, defaultValue = "1") Long channelId, String appChannel,
@RequestParam(required = false, defaultValue = "1") Long createdFrom, @RequestParam(required = false,defaultValue = "xyqb") String key,@RequestParam(required = false)Long btRegisterChannelId,@RequestParam(required = false) String dimension ,HttpServletRequest request) { @RequestParam(required = false, defaultValue = "1") Long createdFrom, @RequestParam(required = false,defaultValue = "xyqb") String key,@RequestParam(required = false)Long btRegisterChannelId,@RequestParam(required = false) String dimension ,HttpServletRequest request) {
Map<String, JsonResult> validMap = getHeaderParam(request); Map<String, JsonResult> validMap = getHeaderParam(request);
LOGGER.info("user/login/fast,请求参数channelId:{},appChannel:{},createdFrom:{},btRegisterChannelId:{},key:{},dimension:{},",channelId,appChannel,createdFrom,btRegisterChannelId,key,dimension);
if (null != validMap.get("fail")) { if (null != validMap.get("fail")) {
return validMap.get("fail"); return validMap.get("fail");
} }
...@@ -129,6 +131,7 @@ public class UserController implements IBaseController { ...@@ -129,6 +131,7 @@ public class UserController implements IBaseController {
String phoneNo = successResult.getData().toString(); String phoneNo = successResult.getData().toString();
User user = userService.findByPhoneWithCache(phoneNo); User user = userService.findByPhoneWithCache(phoneNo);
if (user != null && !user.getEnable()) { if (user != null && !user.getEnable()) {
LOGGER.error("用户不存在,或者已经注销,phoneNo:{}",phoneNo);
return JsonResult.buildErrorStateResult("登录失败", null); return JsonResult.buildErrorStateResult("登录失败", null);
} }
if (user == null) { if (user == null) {
...@@ -218,12 +221,11 @@ public class UserController implements IBaseController { ...@@ -218,12 +221,11 @@ public class UserController implements IBaseController {
* @return * @return
*/ */
@RequestMapping("/register/fast") @RequestMapping("/register/fast")
@LogHttpCaller
public JsonResult registerFast(@RequestParam String phoneNo, @RequestParam String verificationCode, @RequestParam(required = false) Long channelId, public JsonResult registerFast(@RequestParam String phoneNo, @RequestParam String verificationCode, @RequestParam(required = false) Long channelId,
@RequestParam(required = false) Long registerFrom, @RequestParam(required = false, defaultValue = "") String appChannel, @RequestParam(required = false) Long registerFrom, @RequestParam(required = false, defaultValue = "") String appChannel,
@RequestParam(required = false)Long btRegisterChannelId,@RequestParam(required = false)String dimension) { @RequestParam(required = false)Long btRegisterChannelId,@RequestParam(required = false)String dimension) {
String password = genRandomPwd(); String password = genRandomPwd();
LOGGER.info("用户快速注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{},appChannel:{}", phoneNo, verificationCode, channelId, registerFrom, appChannel); LOGGER.info("用户快速注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{},appChannel:{},btRegisterChannelId:{},dimension:{}", phoneNo, verificationCode, channelId, registerFrom, appChannel,btRegisterChannelId,dimension);
if (!ValidationUtil.validatePhoneNo(phoneNo)) { if (!ValidationUtil.validatePhoneNo(phoneNo)) {
LOGGER.info("用户快速注册失败,手机号错误, registerFrom:{}, phoneNo:{}", registerFrom, phoneNo); LOGGER.info("用户快速注册失败,手机号错误, registerFrom:{}, phoneNo:{}", registerFrom, phoneNo);
return JsonResult.buildErrorStateResult("手机号错误", null); return JsonResult.buildErrorStateResult("手机号错误", null);
...@@ -267,13 +269,12 @@ public class UserController implements IBaseController { ...@@ -267,13 +269,12 @@ public class UserController implements IBaseController {
* @param channelId * @param channelId
* @return * @return
*/ */
@LogHttpCaller
@RequestMapping("/register") @RequestMapping("/register")
public JsonResult register(@RequestParam String phoneNo, @RequestParam String password, public JsonResult register(@RequestParam String phoneNo, @RequestParam String password,
@RequestParam String verificationCode, @RequestParam(required = false) Long channelId, @RequestParam String verificationCode, @RequestParam(required = false) Long channelId,
@RequestParam(required = false) Long registerFrom, @RequestParam(required = false) Long registerFrom,
@RequestParam(required = false)Long btRegisterChannelId,@RequestParam(required = false)String dimension) { @RequestParam(required = false)Long btRegisterChannelId,@RequestParam(required = false)String dimension) {
LOGGER.info("用户注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{},btRegisterChannelId:{}", phoneNo, verificationCode, channelId, registerFrom,btRegisterChannelId); LOGGER.info("用户注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{},btRegisterChannelId:{},dimension:{}", phoneNo, verificationCode, channelId, registerFrom,btRegisterChannelId,dimension);
if (!ValidationUtil.validatePhoneNo(phoneNo)) { if (!ValidationUtil.validatePhoneNo(phoneNo)) {
LOGGER.info("用户注册失败,手机号错误, registerFrom:{}, phoneNo:{}", registerFrom, phoneNo); LOGGER.info("用户注册失败,手机号错误, registerFrom:{}, phoneNo:{}", registerFrom, phoneNo);
return JsonResult.buildErrorStateResult("手机号错误", null); return JsonResult.buildErrorStateResult("手机号错误", null);
...@@ -385,6 +386,8 @@ public class UserController implements IBaseController { ...@@ -385,6 +386,8 @@ public class UserController implements IBaseController {
boolean needRetSend=false; boolean needRetSend=false;
String verificationCountKey = Constants.REDIS_VERIFICATION_COUNT+phoneNo; String verificationCountKey = Constants.REDIS_VERIFICATION_COUNT+phoneNo;
Long getVerificationCount = stringRedisTemplate.opsForHash().increment(verificationCountKey, Constants.REDIS_VERIFICATION_COUNT, 1); Long getVerificationCount = stringRedisTemplate.opsForHash().increment(verificationCountKey, Constants.REDIS_VERIFICATION_COUNT, 1);
//已经存在删除操作增加过期时间防止意外
stringRedisTemplate.expire(verificationCountKey, DateUtils.getSeconds(), TimeUnit.SECONDS);
if(getVerificationCount>5){ if(getVerificationCount>5){
return needRetSend=true; return needRetSend=true;
} }
...@@ -505,6 +508,7 @@ public class UserController implements IBaseController { ...@@ -505,6 +508,7 @@ public class UserController implements IBaseController {
MqUtils.sendLoanVest(statistics); MqUtils.sendLoanVest(statistics);
return new JsonResult(sessionService.createSession(channelId, createdFrom, appChannel, user, merchant)); return new JsonResult(sessionService.createSession(channelId, createdFrom, appChannel, user, merchant));
} else { } else {
LOGGER.error("用户不存在,或者已经注销,userId:{}",userId);
return JsonResult.buildErrorStateResult("登录失败", null); return JsonResult.buildErrorStateResult("登录失败", null);
} }
} }
......
...@@ -65,13 +65,13 @@ public class SessionServiceImpl implements ISessionService { ...@@ -65,13 +65,13 @@ public class SessionServiceImpl implements ISessionService {
authBean.setPhoneNo(user.getPhoneNo()); authBean.setPhoneNo(user.getPhoneNo());
authBean.setToken(sessionStruct.getSid()); authBean.setToken(sessionStruct.getSid());
persistSession(sessionStruct.getSid(), sessionStruct.getValues()); persistSession(sessionStruct.getSid(), sessionStruct.getValues());
log.info("用户登录成功, loginFrom:{}, phoneNo:{},appChannel:{}", createdFrom, user.getPhoneNo(), appChannel); log.info("用户登录成功, loginFrom:{}, phoneNo:{},appChannel:{},channelId:{}", createdFrom, user.getPhoneNo(), appChannel,channelId);
return authBean; return authBean;
} }
SessionStruct sessionStruct = createSessionAndPersist(user, properties); SessionStruct sessionStruct = createSessionAndPersist(user, properties);
authBean.setPhoneNo(user.getPhoneNo()); authBean.setPhoneNo(user.getPhoneNo());
authBean.setToken(sessionStruct.getSid()); authBean.setToken(sessionStruct.getSid());
log.info("用户登录成功, loginFrom:{}, phoneNo:{},appChannel:{}", createdFrom, user.getPhoneNo(), appChannel); log.info("用户登录成功, loginFrom:{}, phoneNo:{},appChannel:{},channelId:{}", createdFrom, user.getPhoneNo(), appChannel,channelId);
return authBean; return authBean;
} }
......
...@@ -10,5 +10,8 @@ import java.util.List; ...@@ -10,5 +10,8 @@ import java.util.List;
public interface IContactService { public interface IContactService {
List<Contact> findByUserId(Long userId); List<Contact> findByUserId(Long userId);
Contact findById(Long id);
List<Contact> save(List<Contact> contacts); List<Contact> save(List<Contact> contacts);
Contact save(Contact contact);
} }
...@@ -25,11 +25,22 @@ public class ContactServiceImpl implements IContactService { ...@@ -25,11 +25,22 @@ public class ContactServiceImpl implements IContactService {
return contactRepository.findByUserId(userId); return contactRepository.findByUserId(userId);
} }
@Override
public Contact findById(Long id) {
return contactRepository.findOne(id);
}
@Override @Override
@CacheEvict(value = "contact", key = "'contact' + #contacts.get(0).userId", cacheManager = "cacheManager") @CacheEvict(value = "contact", key = "'contact' + #contacts.get(0).userId", cacheManager = "cacheManager")
public List<Contact> save(List<Contact> contacts) { public List<Contact> save(List<Contact> contacts) {
return contactRepository.save(contacts); return contactRepository.save(contacts);
} }
@Override
@CacheEvict(value = "contact", key = "'contact' + #contact.userId", cacheManager = "cacheManager")
public Contact save(Contact contact) {
return contactRepository.save(contact);
}
} }
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