'提交代码'

dev-discount
= 3 years ago
parent 9a4128c17f
commit dc444e2ba2
  1. 25
      hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java
  2. 10
      hai-cweb/src/main/java/com/cweb/controller/HighUserController.java
  3. 2
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  4. 19
      hai-service/src/main/java/com/hai/model/UserModel.java
  5. 7
      hai-service/src/main/java/com/hai/service/HighUserCardService.java
  6. 10
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  7. 11
      hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java

@ -10,11 +10,14 @@ import com.hai.common.security.UserCenter;
import com.hai.common.utils.RedisUtil; import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.entity.HighUser;
import com.hai.entity.HighUserCard; import com.hai.entity.HighUserCard;
import com.hai.enum_type.UserCardType; import com.hai.enum_type.UserCardType;
import com.hai.model.HighUserModel; import com.hai.model.HighUserModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.service.HighUserCardService; import com.hai.service.HighUserCardService;
import com.hai.service.HighUserPayPasswordService;
import com.hai.service.HighUserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -45,6 +48,11 @@ public class HighUserCardController {
@Resource @Resource
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Resource
private HighUserService highUserService;
@Resource
private HighUserPayPasswordService highUserPayPasswordService;
@RequestMapping(value = "/getUserCardList", method = RequestMethod.GET) @RequestMapping(value = "/getUserCardList", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ -125,7 +133,11 @@ public class HighUserCardController {
SessionObject sessionObject = userCenter.getSessionObject(request); SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), body.getString("cardNo")) == null) { if (highUserCardService.isBindHtlCard(userInfoModel.getHighUser().getId()) == true) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "绑定失败!只能绑定一张工会卡");
}
if (highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), body.getString("cardNo")) != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已绑定此卡,请勿重复绑定"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已绑定此卡,请勿重复绑定");
} }
@ -142,7 +154,16 @@ public class HighUserCardController {
highUserCardService.editCard(userCard); highUserCardService.editCard(userCard);
redisUtil.del(body.getString("phone")); redisUtil.del(body.getString("phone"));
return ResponseMsgUtil.success("操作成功");
// 定义个人所有数据
HighUser user = highUserService.findByUserId(userInfoModel.getHighUser().getId());
HighUserModel highUserModel = new HighUserModel();
user.setPassword(null);
user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(user.getId()));
user.setIsSetHltCard(highUserCardService.isBindHtlCard(user.getId()));
highUserModel.setHighUser(user);
SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel);
return ResponseMsgUtil.success(so);
} }
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "验证码错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "验证码错误");

@ -12,10 +12,7 @@ import com.hai.entity.HighUserCoupon;
import com.hai.entity.HighUserPayPassword; import com.hai.entity.HighUserPayPassword;
import com.hai.model.HighUserModel; import com.hai.model.HighUserModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.service.HighOrderService; import com.hai.service.*;
import com.hai.service.HighUserCouponService;
import com.hai.service.HighUserPayPasswordService;
import com.hai.service.HighUserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -51,6 +48,9 @@ public class HighUserController {
@Resource @Resource
private HighUserCouponService highUserCouponService; private HighUserCouponService highUserCouponService;
@Resource
private HighUserCardService highUserCardService;
@Resource @Resource
private HighOrderService highOrderService; private HighOrderService highOrderService;
@ -72,6 +72,7 @@ public class HighUserController {
highUser.setUnpaid(highOrderService.countOrderByUserId(highUser.getId() , 1)); highUser.setUnpaid(highOrderService.countOrderByUserId(highUser.getId() , 1));
highUser.setUnusedDiscount(highOrderService.countUnusedDiscountByUserId(highUser.getId() , 1)); highUser.setUnusedDiscount(highOrderService.countUnusedDiscountByUserId(highUser.getId() , 1));
highUser.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(userInfoModel.getHighUser().getId())); highUser.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(userInfoModel.getHighUser().getId()));
highUser.setIsSetHltCard(highUserCardService.isBindHtlCard(highUser.getId()));
} }
return ResponseMsgUtil.success(highUser); return ResponseMsgUtil.success(highUser);
@ -162,6 +163,7 @@ public class HighUserController {
HighUserModel highUserModel = new HighUserModel(); HighUserModel highUserModel = new HighUserModel();
user.setPassword(null); user.setPassword(null);
user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(user.getId())); user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(user.getId()));
user.setIsSetHltCard(highUserCardService.isBindHtlCard(user.getId()));
highUserModel.setHighUser(user); highUserModel.setHighUser(user);
SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel); SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel);
return ResponseMsgUtil.success(so); return ResponseMsgUtil.success(so);

@ -313,7 +313,7 @@ public class OrderController {
} }
// 查询用户与卡号的关系 // 查询用户与卡号的关系
HighUserCard userCard = highUserCardService.getDetailByUserCardNo(1L, cardNo); HighUserCard userCard = highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), cardNo);
if (userCard == null) { if (userCard == null) {
log.error("OrderController --> orderToPay() ERROR", "未绑定卡号"); log.error("OrderController --> orderToPay() ERROR", "未绑定卡号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未绑定卡号"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未绑定卡号");

@ -19,6 +19,9 @@ public class UserModel {
// 是否设置支付密码 // 是否设置支付密码
private Boolean isSetPayPwd; private Boolean isSetPayPwd;
// 是否绑定汇联通工会卡
private Boolean isSetHltCard;
public Integer getUnusedCouponNum() { public Integer getUnusedCouponNum() {
return unusedCouponNum; return unusedCouponNum;
} }
@ -50,4 +53,20 @@ public class UserModel {
public void setIsSetPayPwd(Boolean setPayPwd) { public void setIsSetPayPwd(Boolean setPayPwd) {
isSetPayPwd = setPayPwd; isSetPayPwd = setPayPwd;
} }
public Boolean getSetPayPwd() {
return isSetPayPwd;
}
public void setSetPayPwd(Boolean setPayPwd) {
isSetPayPwd = setPayPwd;
}
public Boolean getIsSetHltCard() {
return isSetHltCard;
}
public void setIsSetHltCard(Boolean setHltCard) {
isSetHltCard = setHltCard;
}
} }

@ -36,4 +36,11 @@ public interface HighUserCardService {
*/ */
HighUserCard getDetailByUserCardNo(Long userId,String codeNo); HighUserCard getDetailByUserCardNo(Long userId,String codeNo);
/**
* 是否绑定汇联通工会卡
* @param userId
* @return
*/
Boolean isBindHtlCard(Long userId);
} }

@ -337,10 +337,6 @@ public class HighOrderServiceImpl implements HighOrderService {
// 商品类型 商品类型 1:卡卷 2:金币充值 // 商品类型 商品类型 1:卡卷 2:金币充值
if (highChildOrder.getGoodsType() == 1) { if (highChildOrder.getGoodsType() == 1) {
highChildOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 highChildOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId());
code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付
code.setReceiveTime(new Date());
highCouponCodeService.updateCouponCode(code);
HighCoupon coupon = highCouponService.getCouponById(highChildOrder.getGoodsId()); HighCoupon coupon = highCouponService.getCouponById(highChildOrder.getGoodsId());
// 贵州中石化 // 贵州中石化
@ -350,7 +346,6 @@ public class HighOrderServiceImpl implements HighOrderService {
if (!tokenObject.getString("result").equals("success")) { if (!tokenObject.getString("result").equals("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取token失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取token失败");
} }
Map<String, Object> push = new HashMap<>(); Map<String, Object> push = new HashMap<>();
push.put("token", "data"); push.put("token", "data");
push.put("couTypeCode", coupon.getCouponKey()); push.put("couTypeCode", coupon.getCouponKey());
@ -399,6 +394,11 @@ public class HighOrderServiceImpl implements HighOrderService {
highGasOrderPushMapper.insert(highGasOrderPush); highGasOrderPushMapper.insert(highGasOrderPush);
} else { } else {
HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId());
code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付
code.setReceiveTime(new Date());
highCouponCodeService.updateCouponCode(code);
// 卡卷关联用户 // 卡卷关联用户
HighUserCoupon highUserCoupon = new HighUserCoupon(); HighUserCoupon highUserCoupon = new HighUserCoupon();
highUserCoupon.setMerchantId(code.getMerchantId()); highUserCoupon.setMerchantId(code.getMerchantId());

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

Loading…
Cancel
Save