|
|
@@ -64,6 +64,10 @@ import com.zhichen.modules.grade.bo.ClassGradeUserQueryBo;
|
|
|
import com.zhichen.modules.grade.service.IClassGradeUserService;
|
|
|
import com.zhichen.modules.grade.service.impl.ClassGradeServiceImpl;
|
|
|
import com.zhichen.modules.grade.vo.ClassGradeUserGoodsVo;
|
|
|
+import com.zhichen.modules.order.domain.Order;
|
|
|
+import com.zhichen.modules.order.domain.OrderGoods;
|
|
|
+import com.zhichen.modules.order.service.IOrderGoodsService;
|
|
|
+import com.zhichen.modules.order.service.IOrderService;
|
|
|
import com.zhichen.modules.order.vo.OrderListVo;
|
|
|
import com.zhichen.modules.system.domain.SysTask;
|
|
|
import com.zhichen.modules.system.domain.SysTenant;
|
|
|
@@ -184,6 +188,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
private ICourseService iCourseService;
|
|
|
@Autowired
|
|
|
private ICourseSectionService iCourseSectionService;
|
|
|
+ @Autowired
|
|
|
+ private IOrderService iOrderService;
|
|
|
+ @Autowired
|
|
|
+ private IOrderGoodsService iOrderGoodsService;
|
|
|
@Value("${liveGotoURL}")
|
|
|
private String liveGotoURL;
|
|
|
@Value("${oldSys.goods}")
|
|
|
@@ -2336,6 +2344,99 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public User queryByOpenId(String openId) {
|
|
|
+ return baseMapper.queryByOpenId(openId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> liveAccount_login(UserAppAccountLoginBo bo) {
|
|
|
+ if(Validator.isEmpty(bo.getAccount())){
|
|
|
+ throw new CustomException("账号不能为空");
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<User> queryWrapper =new LambdaQueryWrapper<User>();
|
|
|
+ queryWrapper.and(wq -> wq
|
|
|
+ .eq(User::getTelphone,EncryptHandler.encrypt(bo.getAccount()))
|
|
|
+ .or()
|
|
|
+ .eq(User::getIdCard,EncryptHandler.encrypt(bo.getAccount())));
|
|
|
+ User user = getOne(queryWrapper);
|
|
|
+ if(Validator.isEmpty(user)){
|
|
|
+ iUserLoginErrorService.saveErrorLog(bo.getAccount());
|
|
|
+ throw new CustomException("登录信息错误");
|
|
|
+ } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
|
|
|
+ throw new CustomException("对不起,您的账号:已停用");
|
|
|
+ }
|
|
|
+
|
|
|
+ String password = null;
|
|
|
+ if(bo.getPwd().length()>20){
|
|
|
+ String rsaPrivate = null;
|
|
|
+ try {
|
|
|
+ InputStream certStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("config/pri.key");
|
|
|
+ rsaPrivate = AES.getStringByInputStream_1(certStream);
|
|
|
+ certStream.close();
|
|
|
+ password = AES.decrypt(bo.getPwd(),rsaPrivate);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ password = bo.getPwd();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!SecurityUtils.matchesPassword(password,user.getPassword())) {
|
|
|
+ iUserLoginErrorService.saveErrorLog(bo.getAccount());
|
|
|
+ throw new CustomException("登录信息错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ //是否领取直播课程
|
|
|
+ String goodsId = configService.selectConfigByKey("score.gzh.goodsid");
|
|
|
+ if (StringUtils.isNotBlank(goodsId)){
|
|
|
+ Long number = iOrderService.countByGoodsId(user.getUserId(),Long.valueOf(goodsId));
|
|
|
+ if (number <= 0){
|
|
|
+ //没有领取,创建订单
|
|
|
+ Goods goods = iGoodsService.getById(goodsId);
|
|
|
+ //生成订单号
|
|
|
+ String out_trade_no = DateUtils.getDateOrderSn();
|
|
|
+ Order order = new Order();
|
|
|
+ order.setOrderSn(out_trade_no);
|
|
|
+ order.setUserId(user.getUserId());
|
|
|
+ order.setOrderPrice(goods.getStandPrice());
|
|
|
+ order.setOrderStatus(1);
|
|
|
+ order.setCreateTime(DateUtils.getNowTime());
|
|
|
+ order.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ order.setPayType(1);
|
|
|
+ order.setStatus(1);
|
|
|
+ order.setOrderType(2);
|
|
|
+ order.setPayPrice(goods.getStandPrice());
|
|
|
+ order.setOrderFrom(3);
|
|
|
+ order.setPayStatus(3);
|
|
|
+ order.setCheckStatus(1);
|
|
|
+ order.setOrderRefundStatus(1);
|
|
|
+ order.setFinishStatus(1);
|
|
|
+
|
|
|
+ //订单商品
|
|
|
+ OrderGoods orderGoods = new OrderGoods();
|
|
|
+ orderGoods.setOrderSn(out_trade_no);
|
|
|
+ orderGoods.setGoodsYear("2026");
|
|
|
+ orderGoods.setStatus(1);
|
|
|
+ orderGoods.setPayStatus(4);
|
|
|
+ orderGoods.setCreateTime(DateUtils.getNowTime());
|
|
|
+ orderGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ orderGoods.setGoodsId(Long.valueOf(goodsId));
|
|
|
+
|
|
|
+ iOrderGoodsService.save(orderGoods);
|
|
|
+ iOrderService.save(order);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ClientLoginUser loginUser = new ClientLoginUser();
|
|
|
+ loginUser.setUser(user);
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ map.put(Constants.TOKEN,wxTokenService.createToken(loginUser));
|
|
|
+ map.put("user_account",user.getUserAccount());
|
|
|
+ map.put("full_info",Validator.isEmpty(user.getIdCard())?false:true); //是否完善身份信息
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
private String getTelPhone(){
|
|
|
String mobile = TelPhoneUtils.createMobile();
|
|
|
int count = count(new LambdaQueryWrapper<User>().eq(User::getIdCard, EncryptHandler.encrypt(mobile)));
|