'提交代码'

dev-discount
胡锐 3 years ago
parent 3b214e211b
commit 60ce38a3e7
  1. 10
      hai-cweb/src/main/java/com/cweb/controller/HighUserController.java
  2. 21
      hai-cweb/src/main/java/com/cweb/controller/WechatController.java
  3. 21
      hai-service/src/main/java/com/hai/model/UserModel.java
  4. 9
      hai-service/src/main/java/com/hai/service/HighUserCardService.java
  5. 9
      hai-service/src/main/java/com/hai/service/HighUserService.java
  6. 11
      hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java
  7. 30
      hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java

@ -66,15 +66,7 @@ public class HighUserController {
SessionObject sessionObject = userCenter.getSessionObject(request); SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
HighUser highUser = highUserService.findByUserId(userInfoModel.getHighUser().getId()); return ResponseMsgUtil.success(highUserService.getDetailDataByUser(userInfoModel.getHighUser().getId()));
if (highUser != null) {
highUser.setUnusedCouponNum( highUserCouponService.getCouponList(highUser.getId(), 1).size()); //未使用卡卷数量
highUser.setUnpaid(highOrderService.countOrderByUserId(highUser.getId() , 1));
highUser.setUnusedDiscount(highOrderService.countUnusedDiscountByUserId(highUser.getId() , 1));
highUser.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(userInfoModel.getHighUser().getId()));
highUser.setIsSetHltCard(highUserCardService.isBindHtlCard(highUser.getId()));
}
return ResponseMsgUtil.success(highUser);
} catch (Exception e) { } catch (Exception e) {
log.error("HighUserController --> findByUserId() error!", e); log.error("HighUserController --> findByUserId() error!", e);

@ -99,10 +99,12 @@ public class WechatController {
} }
// 定义个人所有数据 // 定义个人所有数据
HighUserModel loginDataModel = new HighUserModel(); HighUserModel highUserModel = new HighUserModel();
highUser.setPassword(null); HighUser detailData = highUserService.getDetailDataByUser(highUser.getId());
loginDataModel.setHighUser(highUser); detailData.setPassword(null);
SessionObject so = new SessionObject(highUser.getUnionId(), 1 , loginDataModel); highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(highUser.getUnionId(), 1 , highUserModel);
userCenter.save(request, response, so); userCenter.save(request, response, so);
return ResponseMsgUtil.success(so); return ResponseMsgUtil.success(so);
@ -143,8 +145,9 @@ public class WechatController {
// 定义个人所有数据 // 定义个人所有数据
HighUserModel highUserModel = new HighUserModel(); HighUserModel highUserModel = new HighUserModel();
user.setPassword(null); HighUser detailData = highUserService.getDetailDataByUser(user.getId());
highUserModel.setHighUser(user); detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel); SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel);
userCenter.save(request, response, so); userCenter.save(request, response, so);
@ -207,9 +210,9 @@ public class WechatController {
// 定义个人所有数据 // 定义个人所有数据
HighUserModel highUserModel = new HighUserModel(); HighUserModel highUserModel = new HighUserModel();
user.setPassword(null); HighUser detailData = highUserService.getDetailDataByUser(user.getId());
user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(user.getId())); detailData.setPassword(null);
highUserModel.setHighUser(user); highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel); SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel);
userCenter.save(request, response, so); userCenter.save(request, response, so);

@ -1,5 +1,7 @@
package com.hai.model; package com.hai.model;
import com.hai.entity.HighUserCard;
/** /**
* @Auther: 胡锐 * @Auther: 胡锐
* @Description: * @Description:
@ -22,6 +24,25 @@ public class UserModel {
// 是否绑定汇联通工会卡 // 是否绑定汇联通工会卡
private Boolean isSetHltCard; private Boolean isSetHltCard;
// 汇联通卡号
private HighUserCard hltCardNo;
public Boolean getSetHltCard() {
return isSetHltCard;
}
public void setSetHltCard(Boolean setHltCard) {
isSetHltCard = setHltCard;
}
public HighUserCard getHltCardNo() {
return hltCardNo;
}
public void setHltCardNo(HighUserCard hltCardNo) {
this.hltCardNo = hltCardNo;
}
public Integer getUnusedCouponNum() { public Integer getUnusedCouponNum() {
return unusedCouponNum; return unusedCouponNum;
} }

@ -43,4 +43,13 @@ public interface HighUserCardService {
*/ */
Boolean isBindHtlCard(Long userId); Boolean isBindHtlCard(Long userId);
/**
* @Author hurui
* @Description 获取一张汇联通工会卡
* @Date 15:42 2021/9/7
* @Param [userId]
* @return com.hai.entity.HighUserCard
**/
HighUserCard getUserHtlCardNo(Long userId);
} }

@ -40,6 +40,15 @@ public interface HighUserService {
*/ */
HighUser findByUserId(Long userId); HighUser findByUserId(Long userId);
/**
* @Author hurui
* @Description 查询用户详情数据
* @Date 15:34 2021/9/7
* @Param [userId]
* @return com.hai.entity.HighUser
**/
HighUser getDetailDataByUser(Long userId);
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 根据微信openId 查询用户 * @Description 根据微信openId 查询用户

@ -66,4 +66,15 @@ public class HighUserCardServiceImpl implements HighUserCardService {
} }
return false; return false;
} }
@Override
public HighUserCard getUserHtlCardNo(Long userId) {
HighUserCardExample example = new HighUserCardExample();
example.createCriteria().andUserIdEqualTo(userId).andStatusNotEqualTo(0);
List<HighUserCard> list = highUserCardMapper.selectByExample(example);
if(list.size() > 0) {
return list.get(0);
}
return null;
}
} }

@ -11,8 +11,7 @@ import com.hai.entity.HighGoldRec;
import com.hai.entity.HighUser; import com.hai.entity.HighUser;
import com.hai.entity.HighUserExample; import com.hai.entity.HighUserExample;
import com.hai.model.HighUserModel; import com.hai.model.HighUserModel;
import com.hai.service.HighGoldRecService; import com.hai.service.*;
import com.hai.service.HighUserService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
@ -36,6 +35,18 @@ public class HighUserServiceImpl implements HighUserService {
@Resource @Resource
private HighGoldRecService highGoldRecService; private HighGoldRecService highGoldRecService;
@Resource
private HighUserCouponService highUserCouponService;
@Resource
private HighUserCardService highUserCardService;
@Resource
private HighOrderService highOrderService;
@Resource
private HighUserPayPasswordService highUserPayPasswordService;
@Resource @Resource
private UserCenter userCenter; private UserCenter userCenter;
@ -69,6 +80,21 @@ public class HighUserServiceImpl implements HighUserService {
return highUserMapper.selectByPrimaryKey(userId); return highUserMapper.selectByPrimaryKey(userId);
} }
@Override
public HighUser getDetailDataByUser(Long userId) {
HighUser user = highUserMapper.selectByPrimaryKey(userId);
if (user == null) {
return null;
}
user.setUnusedCouponNum(highUserCouponService.getCouponList(userId, 1).size()); //未使用卡卷数量
user.setUnpaid(highOrderService.countOrderByUserId(userId , 1));
user.setUnusedDiscount(highOrderService.countUnusedDiscountByUserId(userId , 1));
user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(userId));
user.setIsSetHltCard(highUserCardService.isBindHtlCard(userId));
user.setHltCardNo(highUserCardService.getUserHtlCardNo(userId));
return user;
}
@Override @Override
public HighUser findByOpenId(String openId) { public HighUser findByOpenId(String openId) {
HighUserExample example = new HighUserExample(); HighUserExample example = new HighUserExample();

Loading…
Cancel
Save