dev-discount
袁野 3 years ago
commit 5696119dab
  1. 12
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  2. 25
      hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java
  3. 18
      hai-cweb/src/main/java/com/cweb/controller/HighUserController.java
  4. 21
      hai-cweb/src/main/java/com/cweb/controller/WechatController.java
  5. 2
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  6. 2
      hai-cweb/src/main/resources/pre/application.yml
  7. 1
      hai-service/src/main/java/com/hai/common/exception/ErrorCode.java
  8. 27
      hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java
  9. 40
      hai-service/src/main/java/com/hai/model/UserModel.java
  10. 16
      hai-service/src/main/java/com/hai/service/HighUserCardService.java
  11. 9
      hai-service/src/main/java/com/hai/service/HighUserService.java
  12. 15
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  13. 22
      hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java
  14. 30
      hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java

@ -2,6 +2,7 @@ package com.cweb.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cweb.config.SysConst;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
@ -223,7 +224,16 @@ public class HighTestController {
public ResponseData test3() {
try {
// return ResponseMsgUtil.success(HuiLianTongUnionCardConfig.resolveResponse("T3xbPEKEXV9+CbBw8D1B+N2jk8xwa55s0Bde48c49YDMmj1rv5nOrkawWt8fskSihNw0wugKUT1x\\nWjHhIN8af7NylRVfhJvbeja2Zjjxnwk3FEKgyvIvJnk3QgiY4aghqQcGKxDOlAxT/kjrkDd2ESu1\\nIWkpi+0HGnG3rKSL6+a1Nu7aW+rPHwXUOmHSgWFZFb9HhlfKI/jml3GhMZBWsZFirayyMMi8UKrd\\nYN7ANPEB/6uV9iVtpLF5Kz8M2+GpI0EqRhPFAH2u3Q/RSgW8ei2ZbOY9NnbkdwuOjU93wgJxdY1Y\\n93hvLYNe1i9QkSM1"));
return ResponseMsgUtil.success(HuiLianTongUnionCardConfig.queryCardInfo("HF2021061600273071609").getString("data"));
// 获取token
JSONObject tokenObject = HuiLianTongConfig.getToken();
if (!tokenObject.getString("result").equals("success")) {
log.error("HighCouponController -> insertCoupon() error!","获取token失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取token失败");
}
// 推送给高速
JSONObject returnParam = HuiLianTongConfig.couJointDist(tokenObject.getString("data"), "20JY000251", 4, "15932678659", "HF"+new Date().getTime());
return ResponseMsgUtil.success(returnParam);
} catch (Exception e) {
log.error("HighOrderController --> getOrderById() error!", e);
return ResponseMsgUtil.exception(e);

@ -10,11 +10,14 @@ import com.hai.common.security.UserCenter;
import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.entity.HighUser;
import com.hai.entity.HighUserCard;
import com.hai.enum_type.UserCardType;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.service.HighUserCardService;
import com.hai.service.HighUserPayPasswordService;
import com.hai.service.HighUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -45,6 +48,11 @@ public class HighUserCardController {
@Resource
private RedisUtil redisUtil;
@Resource
private HighUserService highUserService;
@Resource
private HighUserPayPasswordService highUserPayPasswordService;
@RequestMapping(value = "/getUserCardList", method = RequestMethod.GET)
@ResponseBody
@ -125,7 +133,11 @@ public class HighUserCardController {
SessionObject sessionObject = userCenter.getSessionObject(request);
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, "已绑定此卡,请勿重复绑定");
}
@ -142,7 +154,16 @@ public class HighUserCardController {
highUserCardService.editCard(userCard);
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, "验证码错误");

@ -12,10 +12,7 @@ import com.hai.entity.HighUserCoupon;
import com.hai.entity.HighUserPayPassword;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.service.HighOrderService;
import com.hai.service.HighUserCouponService;
import com.hai.service.HighUserPayPasswordService;
import com.hai.service.HighUserService;
import com.hai.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -51,6 +48,9 @@ public class HighUserController {
@Resource
private HighUserCouponService highUserCouponService;
@Resource
private HighUserCardService highUserCardService;
@Resource
private HighOrderService highOrderService;
@ -66,14 +66,7 @@ public class HighUserController {
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
HighUser highUser = highUserService.findByUserId(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()));
}
return ResponseMsgUtil.success(highUser);
return ResponseMsgUtil.success(highUserService.getDetailDataByUser(userInfoModel.getHighUser().getId()));
} catch (Exception e) {
log.error("HighUserController --> findByUserId() error!", e);
@ -162,6 +155,7 @@ public class HighUserController {
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);

@ -99,10 +99,12 @@ public class WechatController {
}
// 定义个人所有数据
HighUserModel loginDataModel = new HighUserModel();
highUser.setPassword(null);
loginDataModel.setHighUser(highUser);
SessionObject so = new SessionObject(highUser.getUnionId(), 1 , loginDataModel);
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(highUser.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(highUser.getUnionId(), 1 , highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
@ -143,8 +145,9 @@ public class WechatController {
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
user.setPassword(null);
highUserModel.setHighUser(user);
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel);
userCenter.save(request, response, so);
@ -207,9 +210,9 @@ public class WechatController {
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
user.setPassword(null);
user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(user.getId()));
highUserModel.setHighUser(user);
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel);
userCenter.save(request, response, 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) {
log.error("OrderController --> orderToPay() ERROR", "未绑定卡号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未绑定卡号");

@ -9,7 +9,7 @@ debug: false
#datasource数据源设置
spring:
datasource:
url: jdbc:mysql://122.9.135.148:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://139.159.177.244:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: HF123456.
type: com.alibaba.druid.pool.DruidDataSource

@ -121,6 +121,7 @@ public enum ErrorCode {
DELETE_DATA_ERROR("3003","删除数据失败"),
COMPETENCE_INSUFFICIENT("3004","权限不足"),
REQUEST_ERROR("3005","请求错误"),
REQUEST_TIMED_OUT("3006","请求超时,请稍后重试"),
MSG_EVENT_NULL("2999","消息类型为空"),
USE_VISIT_ILLEGAL("4001","用户身份错误"),

@ -72,18 +72,23 @@ public class HuiLianTongUnionCardConfig {
* @throws Exception
*/
public static JSONObject queryConsumptionRecordByBusiness(String businessType,String cardNo,Long sdate,Long edate,Integer page,Integer pageSize) throws Exception {
Map<String,Object> dataMap = new HashMap<>();
dataMap.put("businessType", businessType);
dataMap.put("cardNo", cardNo);
dataMap.put("page", page);
dataMap.put("pageSize", pageSize);
if (sdate != null) {
dataMap.put("sdate", DateUtil.date2String(new Date(sdate), "yyyy-MM-dd"));
try {
Map<String,Object> dataMap = new HashMap<>();
dataMap.put("businessType", businessType);
dataMap.put("cardNo", cardNo);
dataMap.put("page", page);
dataMap.put("pageSize", pageSize);
if (sdate != null) {
dataMap.put("sdate", DateUtil.date2String(new Date(sdate), "yyyy-MM-dd"));
}
if (edate != null) {
dataMap.put("edate", DateUtil.date2String(new Date(edate), "yyyy-MM-dd"));
}
return request("qtk/queryConsumptionRecordByBusiness", dataMap);
} catch (Exception e) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_TIMED_OUT, "");
}
if (edate != null) {
dataMap.put("edate", DateUtil.date2String(new Date(edate), "yyyy-MM-dd"));
}
return request("qtk/queryConsumptionRecordByBusiness", dataMap);
}
/**

@ -1,5 +1,7 @@
package com.hai.model;
import com.hai.entity.HighUserCard;
/**
* @Auther: 胡锐
* @Description:
@ -19,6 +21,28 @@ public class UserModel {
// 是否设置支付密码
private Boolean isSetPayPwd;
// 是否绑定汇联通工会卡
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() {
return unusedCouponNum;
}
@ -50,4 +74,20 @@ public class UserModel {
public void setIsSetPayPwd(Boolean 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,20 @@ public interface HighUserCardService {
*/
HighUserCard getDetailByUserCardNo(Long userId,String codeNo);
/**
* 是否绑定汇联通工会卡
* @param userId
* @return
*/
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);
/**
* @Author hurui
* @Description 查询用户详情数据
* @Date 15:34 2021/9/7
* @Param [userId]
* @return com.hai.entity.HighUser
**/
HighUser getDetailDataByUser(Long userId);
/**
* @Author 胡锐
* @Description 根据微信openId 查询用户

@ -305,6 +305,10 @@ public class HighOrderServiceImpl implements HighOrderService {
goodsDesc = "积分充值"+order.getPayPrice()+"元";
tranDesc = "嗨森逛积分充值"+order.getPayPrice()+"元";
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 3) {
goodsDesc = "加油站加"+order.getPayPrice()+"元油";
tranDesc = "【"+order.getHighChildOrderList().get(0).getGoodsName()+"】加油"+order.getPayPrice()+"元";
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法支付,请使用其他支付方式");
}
@ -333,14 +337,11 @@ public class HighOrderServiceImpl implements HighOrderService {
order.setPayType(4); // 支付方式: 1:支付宝 2:微信 3:金币 4:汇联通支工会卡
order.setOrderStatus(2); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
for (HighChildOrder highChildOrder : order.getHighChildOrderList()) {
// 商品类型 商品类型 1:卡卷 2:金币充值
if (highChildOrder.getGoodsType() == 1) {
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());
// 贵州中石化
@ -350,7 +351,6 @@ public class HighOrderServiceImpl implements HighOrderService {
if (!tokenObject.getString("result").equals("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取token失败");
}
Map<String, Object> push = new HashMap<>();
push.put("token", "data");
push.put("couTypeCode", coupon.getCouponKey());
@ -399,6 +399,11 @@ public class HighOrderServiceImpl implements HighOrderService {
highGasOrderPushMapper.insert(highGasOrderPush);
} 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.setMerchantId(code.getMerchantId());

@ -55,4 +55,26 @@ public class HighUserCardServiceImpl implements HighUserCardService {
}
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;
}
@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.HighUserExample;
import com.hai.model.HighUserModel;
import com.hai.service.HighGoldRecService;
import com.hai.service.HighUserService;
import com.hai.service.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
@ -36,6 +35,18 @@ public class HighUserServiceImpl implements HighUserService {
@Resource
private HighGoldRecService highGoldRecService;
@Resource
private HighUserCouponService highUserCouponService;
@Resource
private HighUserCardService highUserCardService;
@Resource
private HighOrderService highOrderService;
@Resource
private HighUserPayPasswordService highUserPayPasswordService;
@Resource
private UserCenter userCenter;
@ -69,6 +80,21 @@ public class HighUserServiceImpl implements HighUserService {
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
public HighUser findByOpenId(String openId) {
HighUserExample example = new HighUserExample();

Loading…
Cancel
Save