|
|
|
@@ -7,6 +7,7 @@ import com.iformall.domain.dto.WxCUserBasicInfoDto; |
|
|
|
import com.iformall.domain.po.WxCUser; |
|
|
|
import com.iformall.mapper.WxCUserMapper; |
|
|
|
import com.iformall.service.WxCUserService; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@@ -41,7 +42,17 @@ public class WxCUserServiceImpl implements WxCUserService { |
|
|
|
int ret = 0; |
|
|
|
Date curr = new Date(); |
|
|
|
if (user.getId() == null) { |
|
|
|
//record.setId(UUID.randomUUID().toString().replaceAll("-", "")); |
|
|
|
// 检查用户是否已有同一微信开放平台账号 |
|
|
|
if(StringUtils.isNotBlank(user.getUnionId()) && StringUtils.isNotBlank(user.getOpenAppId())) { |
|
|
|
WxCUser oldUser = wxCUserMapper.findByUnionId(user); |
|
|
|
if(oldUser != null) { |
|
|
|
// 已有,更新 |
|
|
|
user.setId(oldUser.getId()); |
|
|
|
// TODO 是否其他信息需要更新 |
|
|
|
ret = wxCUserMapper.updateByPrimaryKeySelective(user); |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
user.setId(idWorker.nextId()); |
|
|
|
user.setLoginCount(1); |
|
|
|
|