|
@@ -13,19 +13,29 @@ import com.caimei365.user.model.dto.ScanBindDto;
|
|
|
import com.caimei365.user.model.dto.SuperVipDto;
|
|
|
import com.caimei365.user.model.po.OperationPo;
|
|
|
import com.caimei365.user.model.po.SuperVipPo;
|
|
|
-import com.caimei365.user.model.vo.LoginFailRecordVo;
|
|
|
-import com.caimei365.user.model.vo.UserLoginVo;
|
|
|
+import com.caimei365.user.model.vo.*;
|
|
|
import com.caimei365.user.service.LoginService;
|
|
|
+import com.caimei365.user.service.RemoteCallService;
|
|
|
import com.caimei365.user.utils.JwtUtil;
|
|
|
+import com.caimei365.user.utils.MathUtil;
|
|
|
import com.caimei365.user.utils.Md5Util;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.Executors;
|
|
|
+import java.util.concurrent.ScheduledExecutorService;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
|
* Description
|
|
@@ -55,6 +65,12 @@ public class LoginServiceImpl implements LoginService {
|
|
|
private AsyncService asyncService;
|
|
|
@Resource
|
|
|
private SellerMapper sellerMapper;
|
|
|
+ @Resource
|
|
|
+ private MessageCenterMapper messageCenterMapper;
|
|
|
+ @Resource
|
|
|
+ private RemoteCallService remoteCallService;
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 小程序邀请码过期天数
|
|
|
*/
|
|
@@ -72,7 +88,7 @@ public class LoginServiceImpl implements LoginService {
|
|
|
* @return BaseUser
|
|
|
*/
|
|
|
@Override
|
|
|
- public ResponseJson<UserLoginVo> passwordLogin(LoginPasswordDto loginPasswordDto) {
|
|
|
+ public ResponseJson<UserLoginVo> passwordLogin(LoginPasswordDto loginPasswordDto) throws ParseException {
|
|
|
String mobileOrEmail = loginPasswordDto.getMobileOrEmail();
|
|
|
String password = loginPasswordDto.getPassword();
|
|
|
String unionId = loginPasswordDto.getUnionId();
|
|
@@ -84,19 +100,26 @@ public class LoginServiceImpl implements LoginService {
|
|
|
}
|
|
|
//处理比对密码
|
|
|
UserLoginVo baseUser = loginMapper.getLoginUserByMobileOrEmail(mobileOrEmail);
|
|
|
-
|
|
|
- if (baseUser != null) {
|
|
|
+ if (null != baseUser) {
|
|
|
+ String key = "login-" + baseUser.getUserId();
|
|
|
+ boolean exists = redisService.exists(key);
|
|
|
//如果30分钟内输入错误记录>=5,return该账号暂时被冻结,请(30-最前一次时间)分钟后重试或直接修改密码
|
|
|
- Calendar c = Calendar.getInstance();
|
|
|
- c.setTime(new Date());
|
|
|
- c.add(Calendar.MINUTE, -30);
|
|
|
- List<LoginFailRecordVo> fail = loginMapper.findLoginFailRecord(baseUser.getUserId(), c.getTime());
|
|
|
- if (null != fail && fail.size() >= 5) {
|
|
|
- Integer minutes = loginMapper.findTimes(fail.get(0).getId(),new Date());
|
|
|
- return ResponseJson.error("该账号暂时被冻结,请" + (30 - minutes) + "分钟后重试或直接修改密码", null);
|
|
|
+ if (exists) {
|
|
|
+ String val = (String) redisService.get(key);
|
|
|
+ String[] split = val.split(",");
|
|
|
+ int count = Integer.parseInt(split[0]);
|
|
|
+ if (count >= 5) {
|
|
|
+ long s = Long.parseLong(split[1]);
|
|
|
+ int l = (int) Math.floor((System.currentTimeMillis() - s) / 1000 / 60);
|
|
|
+ return ResponseJson.error("该账号暂时被冻结,请" + (30 - l) + "分钟后重试或直接修改密码", null);
|
|
|
+ }
|
|
|
}
|
|
|
// 如果前端传入unionId,则存入返回前端
|
|
|
baseUser.setUnionId(unionId);
|
|
|
+
|
|
|
+ Integer clubId = messageCenterMapper.clubIdCule(baseUser.getUserId());
|
|
|
+ Integer savedCount = null;
|
|
|
+
|
|
|
// 比对密码
|
|
|
String md5Password = Md5Util.md5(password);
|
|
|
String dbPassword = baseUser.getPassword();
|
|
@@ -110,9 +133,21 @@ public class LoginServiceImpl implements LoginService {
|
|
|
}
|
|
|
} else {
|
|
|
// 增加一次错误输入密码记录,30分钟内连续五次冻结
|
|
|
- loginMapper.insertLoginFailRecord(new Date(),baseUser.getUserId());
|
|
|
- if (null != fail && 4 ==fail.size() ) {
|
|
|
- return ResponseJson.error("您已连续输错5次密码,账号被暂时冻结,请于30分钟后重试或直接修改密码",null);
|
|
|
+ if (exists) {
|
|
|
+ String val = (String) redisService.get(key);
|
|
|
+ String[] split = val.split(",");
|
|
|
+ int count = Integer.parseInt(split[0]);
|
|
|
+ if (count < 5) {
|
|
|
+ count++;
|
|
|
+ String va = count + "," + System.currentTimeMillis();
|
|
|
+ redisService.set(key, va);
|
|
|
+ }
|
|
|
+ if (count >= 5) {
|
|
|
+ redisService.set(key, 5 + "," + System.currentTimeMillis(), 1800L);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ String val = 1 + "," + System.currentTimeMillis();
|
|
|
+ redisService.set(key, val);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -128,7 +163,7 @@ public class LoginServiceImpl implements LoginService {
|
|
|
* @param headers HttpHeaders
|
|
|
*/
|
|
|
@Override
|
|
|
- public ResponseJson<UserLoginVo> appletsAuthorization(String code, String encryptedData, String iv, HttpHeaders headers) {
|
|
|
+ public ResponseJson<UserLoginVo> appletsAuthorization(String code, String encryptedData, String iv, HttpHeaders headers) throws ParseException {
|
|
|
if (StringUtils.isBlank(code)) {
|
|
|
return ResponseJson.error("没有获取到微信授权code", null);
|
|
|
}
|
|
@@ -160,6 +195,15 @@ public class LoginServiceImpl implements LoginService {
|
|
|
log.info("小程序授权登录,返回unionId给前端,用户数据存入Redis,key:wxInfo:applets:" + unionId);
|
|
|
// 协销授权登录
|
|
|
UserLoginVo seller = loginMapper.getServiceProviderUserByOpenId(openId);
|
|
|
+ Integer userID = messageCenterMapper.userId(openId);
|
|
|
+ Integer clubId = messageCenterMapper.clubIdCule(userID);
|
|
|
+ Integer savedCount = null;
|
|
|
+ if (userID != null) {
|
|
|
+ Integer shopID = messageCenterMapper.shopID(userID);
|
|
|
+ log.info(">>>>>" + shopID);
|
|
|
+ Integer newReceiptType = messageCenterMapper.newReceiptType(shopID);
|
|
|
+ log.info(">>>>>" + newReceiptType);
|
|
|
+ }
|
|
|
if (null != seller) {
|
|
|
loginMapper.updateServiceProviderUnionId(seller.getUserId(), unionId);
|
|
|
String token = JwtUtil.createToken(seller.getUserId());
|
|
@@ -179,6 +223,206 @@ public class LoginServiceImpl implements LoginService {
|
|
|
return operationAuthLogin(openId, unionId, "mini");
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ResponseJson<Map<String, Object>> ClubMessageCount(Integer messageType, Integer commonId) {
|
|
|
+
|
|
|
+ Integer count = messageCenterMapper.Count(1, commonId);
|
|
|
+ Integer tradeCount = messageCenterMapper.MessageCount(1, 1, commonId);
|
|
|
+ Integer accountCount = messageCenterMapper.MessageCount(1, 2, commonId);
|
|
|
+ Integer notificationCount = messageCenterMapper.MessageCount(1, 3, commonId);
|
|
|
+ Integer promotionCount = messageCenterMapper.MessageCount(1, 4, commonId);
|
|
|
+ Map<String, Object> map = new HashMap(10);
|
|
|
+ map.put("count", count);
|
|
|
+ map.put("tradeCount", tradeCount);
|
|
|
+ map.put("account", accountCount);
|
|
|
+ map.put("notificationCount", notificationCount);
|
|
|
+ map.put("promotionCount", promotionCount);
|
|
|
+ return ResponseJson.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResponseJson<Map<String, Object>> shopMessageCount(Integer messageType, Integer commonId) {
|
|
|
+ Integer count = messageCenterMapper.Count(2, commonId);
|
|
|
+ Integer tradeCount = messageCenterMapper.MessageCount(2, 1, commonId);
|
|
|
+ Integer accountCount = messageCenterMapper.MessageCount(2, 2, commonId);
|
|
|
+ Integer notificationCount = messageCenterMapper.MessageCount(2, 3, commonId);
|
|
|
+ Integer promotionCount = messageCenterMapper.MessageCount(2, 4, commonId);
|
|
|
+ Map<String, Object> map = new HashMap(10);
|
|
|
+ map.put("count", count);
|
|
|
+ map.put("tradeCount", tradeCount);
|
|
|
+ map.put("accountCount", accountCount);
|
|
|
+ map.put("notificationCount", notificationCount);
|
|
|
+ map.put("promotionCount", promotionCount);
|
|
|
+ return ResponseJson.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResponseJson<Map<String, Object>> ShopCount(Integer messageType, Integer commonId) {
|
|
|
+ Integer count = messageCenterMapper.Count(2, commonId);
|
|
|
+ Map<String, Object> map = new HashMap(10);
|
|
|
+ map.put("count", count);
|
|
|
+ return ResponseJson.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResponseJson<Map<String, Object>> ClubCount(Integer messageType, Integer commonId) {
|
|
|
+ Integer count = messageCenterMapper.Count(1, commonId);
|
|
|
+ Map<String, Object> map = new HashMap(10);
|
|
|
+ map.put("count", count);
|
|
|
+ return ResponseJson.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Integer updateMessageAsRead(Integer messageType, Integer commonId) {
|
|
|
+ return messageCenterMapper.updateMessageAsRead(1, messageType, commonId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Integer updateShopMessageAsRead(Integer messageType, Integer commonId) {
|
|
|
+ return messageCenterMapper.updateMessageAsRead(2, messageType, commonId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Integer deleteMessage(String id) {
|
|
|
+ Integer num = 0;
|
|
|
+ String[] IdArr = id.split(",");
|
|
|
+ for (int i = 0; i < IdArr.length; i++) {
|
|
|
+ num = messageCenterMapper.deleteMessage(IdArr[i]);
|
|
|
+ }
|
|
|
+ return num;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Integer updateRead(Integer userType, String Id) {
|
|
|
+ Integer num = 0;
|
|
|
+ String[] IdArr = Id.split(",");
|
|
|
+ for (int i = 0; i < IdArr.length; i++) {
|
|
|
+ num = messageCenterMapper.updateRead(userType, IdArr[i]);
|
|
|
+ }
|
|
|
+ return num;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResponseJson<PageInfo<MessageCenter>> ClubMessageList(Integer commonId, Integer messageType, Integer source, int pageNum, int pageSize) {
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ List<MessageCenter> list = messageCenterMapper.MessageList(1, messageType, commonId);
|
|
|
+ list.forEach(mess -> {
|
|
|
+ if (null != mess.getClubId()) {
|
|
|
+ MessageCenter messageCenter = messageCenterMapper.MainImage(1, commonId, mess.getOrderId());
|
|
|
+ Integer productCount=messageCenterMapper.productCount(mess.getOrderId());
|
|
|
+ if (null != messageCenter) {
|
|
|
+ mess.setMainImage(messageCenter.getMainImage());
|
|
|
+ mess.setOnlinePayFlag(messageCenter.getOnlinePayFlag());
|
|
|
+ if (messageCenter.getProductName().length() > 10) {
|
|
|
+ mess.setProductName(StringUtils.strip(messageCenter.getProductName().substring(0, 11)));
|
|
|
+ } else {
|
|
|
+ mess.setProductName(messageCenter.getProductName());
|
|
|
+ }
|
|
|
+ mess.setProductCount(productCount);
|
|
|
+ mess.setRefundType(messageCenter.getRefundType());
|
|
|
+ mess.setStatus(messageCenter.getStatus());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (source == 2) {
|
|
|
+ messageCenterMapper.updateMessageAsRead(1, messageType, commonId);
|
|
|
+ }
|
|
|
+ PageInfo<MessageCenter> pageData = new PageInfo<>(list);
|
|
|
+ return ResponseJson.success(pageData);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResponseJson<PageInfo<MessageCenter>> shopMessageList(Integer commonId, Integer messageType, Integer source, int pageNum, int pageSize) {
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ List<MessageCenter> list = messageCenterMapper.MessageList(2, messageType, commonId);
|
|
|
+ list.forEach(mess -> {
|
|
|
+ String shopName=messageCenterMapper.shopName(commonId);
|
|
|
+ MessageCenter messageCenter = messageCenterMapper.productImage(mess.getProductId(),commonId);
|
|
|
+ if (messageCenter != null) {
|
|
|
+ mess.setMainImage(messageCenter.getMainImage());
|
|
|
+ mess.setOnlinePayFlag(messageCenter.getOnlinePayFlag());
|
|
|
+ if (messageCenter.getProductName().length() > 10) {
|
|
|
+ mess.setProductName(StringUtils.strip(messageCenter.getProductName().substring(0, 11)));
|
|
|
+ } else {
|
|
|
+ mess.setProductName(messageCenter.getProductName());
|
|
|
+ }
|
|
|
+ mess.setProductCount(messageCenter.getProductCount());
|
|
|
+ mess.setRefundType(messageCenter.getRefundType());
|
|
|
+ }
|
|
|
+ mess.setShopName(shopName);
|
|
|
+ });
|
|
|
+ if (source == 2) {
|
|
|
+ messageCenterMapper.updateMessageAsRead(2, messageType, commonId);
|
|
|
+ }
|
|
|
+ PageInfo<MessageCenter> pageData = new PageInfo<>(list);
|
|
|
+ return ResponseJson.success(pageData);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 当天天下午3点推送超级会员过期条件
|
|
|
+// */
|
|
|
+//// @Scheduled(cron = "0 0 15 * * ?")
|
|
|
+// @Scheduled(cron = "0 0/2 * * * ?")
|
|
|
+// private Void Timerw() throws ParseException {
|
|
|
+//
|
|
|
+// List<SuperVipPo> superV = vipMapper.findVip();
|
|
|
+// superV.forEach(superVip -> {
|
|
|
+// Integer clubId = messageCenterMapper.clubIdCule(superVip.getUserId());
|
|
|
+// if (clubId != null) {
|
|
|
+// if (superVip != null) {
|
|
|
+// Date d = new Date();
|
|
|
+// //1.日期格式
|
|
|
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
|
+// String endTime = sdf.format(superVip.getEndTime());
|
|
|
+// //2.某天的日期
|
|
|
+// Date da1 = null;
|
|
|
+// try {
|
|
|
+// da1 = sdf.parse(endTime);
|
|
|
+// } catch (ParseException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// Long s = (d.getTime() - da1.getTime()) / 24 / 60 / 60 / 1000;
|
|
|
+// //3.输出间隔天数 getTime获取的是毫秒
|
|
|
+// log.info("输出间隔天数----------->", s);
|
|
|
+// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+// String current = dateFormat.format(new Date());
|
|
|
+// MessageCenter messageCenter = new MessageCenter();
|
|
|
+// //推送信息中心-账户通知
|
|
|
+// if (s == 7) {
|
|
|
+// messageCenter.setShopId(null);
|
|
|
+// messageCenter.setClubId(clubId);
|
|
|
+// messageCenter.setUserType(1);
|
|
|
+// messageCenter.setMessageType(2);
|
|
|
+// messageCenter.setAccountType(3);
|
|
|
+// messageCenter.setContent(s + "日后");
|
|
|
+// messageCenter.setTime(current);
|
|
|
+// messageCenterMapper.addMessageCenter(messageCenter);
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// if (s == 1) {
|
|
|
+// messageCenter.setShopId(null);
|
|
|
+// messageCenter.setClubId(clubId);
|
|
|
+// messageCenter.setUserType(1);
|
|
|
+// messageCenter.setMessageType(2);
|
|
|
+// messageCenter.setAccountType(3);
|
|
|
+// messageCenter.setContent("今日后");
|
|
|
+// messageCenter.setTime(current);
|
|
|
+// messageCenterMapper.addMessageCenter(messageCenter);
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
+// return null;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 微信公众号授权链接(www)
|
|
|
*
|
|
@@ -320,6 +564,22 @@ public class LoginServiceImpl implements LoginService {
|
|
|
// loginUser.setUserIdentity(2);
|
|
|
// loginUser.setUserPermission(2);
|
|
|
// }
|
|
|
+
|
|
|
+ if (loginUser.getUserId() != null) {
|
|
|
+ Integer shopID = messageCenterMapper.shopID(loginUser.getUserId());
|
|
|
+ Integer newReceiptType = messageCenterMapper.newReceiptType(shopID);
|
|
|
+ Integer listingFeeCount= messageCenterMapper.listingFee(shopID);
|
|
|
+ Integer listingfeeExpireCount= messageCenterMapper.listingfeeExpire(shopID);
|
|
|
+ Integer receStatctCount=messageCenterMapper.receStatct(shopID);
|
|
|
+ Integer listingFee=0;
|
|
|
+ if(listingFeeCount>0 || listingfeeExpireCount>0){
|
|
|
+ if(receStatctCount<=0){
|
|
|
+ listingFee=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ loginUser.setListingFee(listingFee);
|
|
|
+ }
|
|
|
+
|
|
|
// 登录异步赠送10采美豆
|
|
|
asyncService.loginUpdateBeans(loginUser.getUserId(), loginUser.getUserIdentity());
|
|
|
loginUser.setManager(sellerMapper.findManagerByUser(loginUser.getUserId()));
|
|
@@ -386,7 +646,7 @@ public class LoginServiceImpl implements LoginService {
|
|
|
* @return UserLoginVo
|
|
|
*/
|
|
|
@Override
|
|
|
- public ResponseJson<UserLoginVo> qrCodeAuthScanResult(String state) {
|
|
|
+ public ResponseJson<UserLoginVo> qrCodeAuthScanResult(String state) throws ParseException {
|
|
|
if (StringUtils.isBlank(state)) {
|
|
|
return ResponseJson.error("参数异常:state不能为空!", null);
|
|
|
}
|
|
@@ -403,6 +663,32 @@ public class LoginServiceImpl implements LoginService {
|
|
|
String unionId = (String) infoData.get(WeChatService.Keys.UNION_ID);
|
|
|
String openId = (String) infoData.get(WeChatService.Keys.OPEN_ID);
|
|
|
log.info(">>>>>>pc商城unionId:" + unionId + " ,openId:" + openId);
|
|
|
+
|
|
|
+ Integer userId = messageCenterMapper.userId(openId);
|
|
|
+ Integer clubId = messageCenterMapper.clubIdCule(userId);
|
|
|
+ Integer savedCount = null;
|
|
|
+ if (userId != null) {
|
|
|
+ Integer shopID = messageCenterMapper.shopID(userId);
|
|
|
+ Integer newReceiptType = messageCenterMapper.newReceiptType(shopID);
|
|
|
+ if (shopID == null) {
|
|
|
+ savedCount = messageCenterMapper.Count(1, clubId);
|
|
|
+ System.out.println(savedCount);
|
|
|
+ } else {
|
|
|
+ savedCount = messageCenterMapper.Count(2, shopID);
|
|
|
+ Integer listingFeeCount= messageCenterMapper.listingFee(shopID);
|
|
|
+ Integer listingfeeExpireCount= messageCenterMapper.listingfeeExpire(shopID);
|
|
|
+ Integer receStatctCount=messageCenterMapper.receStatct(shopID);
|
|
|
+ Integer listingFee=0;
|
|
|
+ if(listingFeeCount>0 || listingfeeExpireCount>0){
|
|
|
+ if(receStatctCount<=0){
|
|
|
+ listingFee=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// 用户数据存入Redis,key前缀:wxInfo:website:
|
|
|
String infoDataStr = JSON.toJSONString(infoData);
|
|
|
Map<String, Object> infoDataMap = JSON.parseObject(infoDataStr);
|
|
@@ -564,16 +850,86 @@ public class LoginServiceImpl implements LoginService {
|
|
|
operationPo.setAvatarUrl(avatarUrl);
|
|
|
// 绑定状态,1未绑定,2已绑定
|
|
|
operationPo.setStatus(2);
|
|
|
+
|
|
|
if (1 == userIdentity) {
|
|
|
// 机构Id
|
|
|
operationPo.setClubId(operation.getClubId());
|
|
|
// 用户类型
|
|
|
operationPo.setUserType(1);
|
|
|
+
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String current = dateFormat.format(new Date());
|
|
|
+ MessageCenter messageCenter = new MessageCenter();
|
|
|
+ messageCenter.setShopId(null);
|
|
|
+ messageCenter.setClubId(operation.getClubId());
|
|
|
+ messageCenter.setUserType(1);
|
|
|
+ messageCenter.setMessageType(2);
|
|
|
+ messageCenter.setAccountType(7);
|
|
|
+ messageCenter.setContent(nickName);
|
|
|
+ messageCenter.setTime(current);
|
|
|
+ messageCenterMapper.addMessageCenter(messageCenter);
|
|
|
+ //发短信
|
|
|
+ String message = "【采美365】恭喜您成功成为运营人员,您可通过微信直接登录采美商城进行采购。";
|
|
|
+ String mobile = messageCenterMapper.contractMobile(operation.getClubId());
|
|
|
+ if (mobile != null && mobile != "") {
|
|
|
+ remoteCallService.remoteSendSms(2, 3, mobile, message);
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ log.info("***********机构通过邀请码登入微信公众号推送************");
|
|
|
+ String accessToken = weChatService.getAccessToken();
|
|
|
+ String openid = messageCenterMapper.getOpenidListByPermission(unionId);
|
|
|
+ String time = current;
|
|
|
+ String remarkText = "绑定成功后,您可通过微信直接访问采美商城进行采购。";
|
|
|
+ // 跳转到【小程序付款-选择支付方式页面】
|
|
|
+ String pagePath = "https://www.caimei365.com/";
|
|
|
+ // sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接
|
|
|
+ log.error("获取openid>>>>>" + openid);
|
|
|
+ weChatService.sendTemplateMessg(accessToken, openid, nickName, time, remarkText, pagePath);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("【机构通过邀请码登入通知】获取微信公众号access_token异常!", e);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
} else {
|
|
|
// 供应商Id
|
|
|
operationPo.setShopId(operation.getShopId());
|
|
|
// 用户类型
|
|
|
operationPo.setUserType(2);
|
|
|
+
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String current = dateFormat.format(new Date());
|
|
|
+ MessageCenter messageCenter = new MessageCenter();
|
|
|
+ messageCenter.setShopId(operation.getShopId());
|
|
|
+ messageCenter.setClubId(null);
|
|
|
+ messageCenter.setUserType(2);
|
|
|
+ messageCenter.setMessageType(2);
|
|
|
+ messageCenter.setShopMessType(2);
|
|
|
+ messageCenter.setContent(nickName);
|
|
|
+ messageCenter.setTime(current);
|
|
|
+ messageCenterMapper.addMessageCenter(messageCenter);
|
|
|
+
|
|
|
+ //发短信
|
|
|
+ String message = "【采美365】恭喜您成功成为运营人员,您可通过微信直接登录采美商城进行采购。";
|
|
|
+ String mobile = messageCenterMapper.contractMobiles(operation.getShopId());
|
|
|
+ if (mobile != null && mobile != "") {
|
|
|
+ remoteCallService.remoteSendSms(2, 3, mobile, message);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ log.info("***********供应商通过邀请码登入微信公众号推送************");
|
|
|
+ String accessToken = weChatService.getAccessToken();
|
|
|
+ String openid = messageCenterMapper.getOpenidListByPermission(unionId);
|
|
|
+ String time = current;
|
|
|
+ String remarkText = "绑定成功后,您可通过微信直接访问采美商城进行采购。";
|
|
|
+ // 跳转到【小程序付款-选择支付方式页面】
|
|
|
+ String pagePath = "https://www.caimei365.com/";
|
|
|
+ // sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接
|
|
|
+ log.error("获取openid>>>>>" + openid);
|
|
|
+ weChatService.sendTemplateMessg(accessToken, openid, nickName, time, remarkText, pagePath);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("【供应商通过邀请码登入通知】获取微信公众号access_token异常!", e);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
// 更新运营人员信息
|
|
|
operationMapper.updateOperationByInvitation(operationPo);
|
|
@@ -654,10 +1010,37 @@ public class LoginServiceImpl implements LoginService {
|
|
|
if (user != null && 3 == user.getUserIdentity()) {
|
|
|
operation.setShopId(user.getShopId());
|
|
|
operation.setUserType(2);
|
|
|
+
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String current = dateFormat.format(new Date());
|
|
|
+ MessageCenter messageCenter = new MessageCenter();
|
|
|
+ messageCenter.setShopId(operation.getShopId());
|
|
|
+ messageCenter.setClubId(null);
|
|
|
+ messageCenter.setUserType(2);
|
|
|
+ messageCenter.setMessageType(2);
|
|
|
+ messageCenter.setShopMessType(2);
|
|
|
+ messageCenter.setContent(nickName);
|
|
|
+ messageCenter.setShopMessType(null);
|
|
|
+ messageCenter.setTime(current);
|
|
|
+ messageCenterMapper.addMessageCenter(messageCenter);
|
|
|
+
|
|
|
} else if (user != null) {
|
|
|
operation.setClubId(user.getClubId());
|
|
|
operation.setUserType(1);
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String current = dateFormat.format(new Date());
|
|
|
+ MessageCenter messageCenter = new MessageCenter();
|
|
|
+ messageCenter.setShopId(null);
|
|
|
+ messageCenter.setClubId(user.getClubId());
|
|
|
+ messageCenter.setUserType(1);
|
|
|
+ messageCenter.setMessageType(2);
|
|
|
+ messageCenter.setAccountType(7);
|
|
|
+ messageCenter.setContent(nickName);
|
|
|
+ messageCenter.setTime(current);
|
|
|
+ messageCenterMapper.addMessageCenter(messageCenter);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
// 绑定状态
|
|
|
operation.setStatus(2);
|
|
|
// 删除标识
|