dev-discount
zdx 3 years ago
commit f30f0f92bf
  1. 31
      hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java
  2. 4
      hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java
  3. 2
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java
  4. 12
      hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java
  5. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  6. 76
      hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java
  7. 4
      hai-bweb/src/main/resources/dev/application.yml
  8. 2
      hai-bweb/src/main/resources/pre/application.yml
  9. 3
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  10. 2
      hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java
  11. 114
      hai-cweb/src/main/java/com/cweb/controller/HighCouponAgentController.java
  12. 3
      hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java
  13. 25
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  14. 22
      hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java
  15. 8
      hai-cweb/src/main/java/com/cweb/controller/OutRechargePriceController.java
  16. 2
      hai-cweb/src/main/resources/pre/application.yml
  17. 4
      hai-cweb/src/test/common/test.java
  18. 25
      hai-service/src/main/java/com/hai/common/GenerateCode.java
  19. 25
      hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java
  20. 65
      hai-service/src/main/java/com/hai/dao/CmsContentMapperExt.java
  21. 34
      hai-service/src/main/java/com/hai/dao/HighCouponAgentCodeMapper.java
  22. 56
      hai-service/src/main/java/com/hai/dao/HighCouponAgentCodeSqlProvider.java
  23. 33
      hai-service/src/main/java/com/hai/dao/HighCouponAgentRelMapper.java
  24. 40
      hai-service/src/main/java/com/hai/dao/HighCouponAgentRelMapperExt.java
  25. 14
      hai-service/src/main/java/com/hai/dao/HighCouponAgentRelSqlProvider.java
  26. 2
      hai-service/src/main/java/com/hai/entity/HighChildOrder.java
  27. 62
      hai-service/src/main/java/com/hai/entity/HighCouponAgentCode.java
  28. 226
      hai-service/src/main/java/com/hai/entity/HighCouponAgentCodeExample.java
  29. 16
      hai-service/src/main/java/com/hai/entity/HighCouponAgentRel.java
  30. 60
      hai-service/src/main/java/com/hai/entity/HighCouponAgentRelExample.java
  31. 46
      hai-service/src/main/java/com/hai/model/HighCouponAgentRelModel.java
  32. 13
      hai-service/src/main/java/com/hai/service/CmsContentService.java
  33. 27
      hai-service/src/main/java/com/hai/service/HighCouponAgentService.java
  34. 10
      hai-service/src/main/java/com/hai/service/HighDiscountPackageService.java
  35. 1
      hai-service/src/main/java/com/hai/service/HighDiscountService.java
  36. 33
      hai-service/src/main/java/com/hai/service/HighTestService.java
  37. 5
      hai-service/src/main/java/com/hai/service/impl/CmsContentServiceImpl.java
  38. 207
      hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java
  39. 97
      hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java
  40. 2
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  41. 136
      hai-service/src/main/java/com/hai/service/impl/HighTestServiceImpl.java
  42. 3
      hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java
  43. 2
      hai-service/src/main/java/com/hai/service/impl/HltUnionCardVipServiceImpl.java
  44. 3
      hai-service/src/main/java/com/hai/service/impl/OutRechargePriceServiceImpl.java
  45. 49
      hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java

@ -61,7 +61,8 @@ public class HighCouponAgentController {
@RequestMapping(value = "/getAgentCount", method = RequestMethod.GET) @RequestMapping(value = "/getAgentCount", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "代理商统计") @ApiOperation(value = "代理商统计")
public ResponseData getAgentCount(HttpServletRequest request) { public ResponseData getAgentCount(HttpServletRequest request,
@RequestParam(name = "type", required = true) Integer type) {
try { try {
SessionObject sessionObject = userCenter.getSessionObject(request); SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
@ -71,7 +72,28 @@ public class HighCouponAgentController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, "");
} }
return ResponseMsgUtil.success(highCouponAgentService.getSalesCountByAgent(userInfoModel.getHighAgent().getId())); return ResponseMsgUtil.success(highCouponAgentService.getSalesCountByAgent(userInfoModel.getHighAgent().getId(), type));
} catch (Exception e) {
log.error("HighCouponAgentController --> getCodeById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getAgentConvertCodeCount", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "代理商兑换码统计")
public ResponseData getAgentConvertCodeCount(HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getHighAgent() == null) {
log.error("HighCouponAgentController -> assignCouponAgent() error!","该主角色没有权限");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, "");
}
return ResponseMsgUtil.success(highCouponAgentService.getConvertCodeCountByAgent(userInfoModel.getHighAgent().getId()));
} catch (Exception e) { } catch (Exception e) {
log.error("HighCouponAgentController --> getCodeById() error!", e); log.error("HighCouponAgentController --> getCodeById() error!", e);
@ -187,6 +209,7 @@ public class HighCouponAgentController {
if(highCouponAgentRel.getCouponId() == null if(highCouponAgentRel.getCouponId() == null
|| highCouponAgentRel.getAgentId() == null || highCouponAgentRel.getAgentId() == null
|| highCouponAgentRel.getType() == null
|| highCouponAgentRel.getStockCount() == null) { || highCouponAgentRel.getStockCount() == null) {
log.error("HighCouponAgentController -> assignCouponAgent() error!","参数错误"); log.error("HighCouponAgentController -> assignCouponAgent() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
@ -207,7 +230,7 @@ public class HighCouponAgentController {
} }
// 校验是否分配过 // 校验是否分配过
HighCouponAgentRel couponAgent = highCouponAgentService.getRelByCouponAgent(highCouponAgentRel.getCouponId(), highCouponAgentRel.getAgentId()); HighCouponAgentRel couponAgent = highCouponAgentService.getRelByCouponAgent(highCouponAgentRel.getCouponId(), highCouponAgentRel.getAgentId(), highCouponAgentRel.getType());
if (couponAgent != null) { if (couponAgent != null) {
couponAgent.setStockCount(couponAgent.getStockCount() + highCouponAgentRel.getStockCount()); couponAgent.setStockCount(couponAgent.getStockCount() + highCouponAgentRel.getStockCount());
couponAgent.setOperatorId(userInfoModel.getSecUser().getId()); couponAgent.setOperatorId(userInfoModel.getSecUser().getId());
@ -290,6 +313,7 @@ public class HighCouponAgentController {
@ResponseBody @ResponseBody
@ApiOperation(value = "根据代理商和卡券 查询分配的销售码") @ApiOperation(value = "根据代理商和卡券 查询分配的销售码")
public ResponseData getCodeListByAgentCoupon(@RequestParam(name = "couponId", required = true) Long couponId, public ResponseData getCodeListByAgentCoupon(@RequestParam(name = "couponId", required = true) Long couponId,
@RequestParam(name = "type", required = true) Integer type,
@RequestParam(name = "status", required = false) String status, @RequestParam(name = "status", required = false) String status,
@RequestParam(name = "createTimeS", required = false) Long createTimeS, @RequestParam(name = "createTimeS", required = false) Long createTimeS,
@RequestParam(name = "createTimeE", required = false) Long createTimeE, @RequestParam(name = "createTimeE", required = false) Long createTimeE,
@ -307,6 +331,7 @@ public class HighCouponAgentController {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("agentId", userInfoModel.getHighAgent().getId()); map.put("agentId", userInfoModel.getHighAgent().getId());
map.put("type", type);
map.put("couponId", couponId); map.put("couponId", couponId);
map.put("status", status); map.put("status", status);
map.put("createTimeS", createTimeS); map.put("createTimeS", createTimeS);

@ -12,7 +12,7 @@ import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.common.generateCode; import com.hai.common.GenerateCode;
import com.hai.common.security.SessionObject; import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter; import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil; import com.hai.common.utils.DateUtil;
@ -620,7 +620,7 @@ public class HighCouponController {
highCouponCode = new HighCouponCode(); highCouponCode = new HighCouponCode();
highCouponCode.setCouponId(couponId); highCouponCode.setCouponId(couponId);
highCouponCode.setMerchantId(coupon.getMerchantId()); highCouponCode.setMerchantId(coupon.getMerchantId());
highCouponCode.setSalesCode(generateCode.couponSalesCode(coupon.getMerchantId(), couponId)); highCouponCode.setSalesCode(GenerateCode.couponSalesCode(coupon.getMerchantId(), couponId));
highCouponCode.setSalesEndTime(salesEndTimeC.getTime()); highCouponCode.setSalesEndTime(salesEndTimeC.getTime());
highCouponCode.setUseEndTime(useEndTimeC.getTime()); highCouponCode.setUseEndTime(useEndTimeC.getTime());
highCouponCode.setStatus(1); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 highCouponCode.setStatus(1); // 状态:1.待销售 2.未使用 3.已使用 99.预支付

@ -252,7 +252,7 @@ public class HighDiscountPackageController {
highDiscountPackage.setCompanyId(highDiscountPackages.getCompanyId()); highDiscountPackage.setCompanyId(highDiscountPackages.getCompanyId());
highDiscountPackage.setCreatedUserId(highDiscountPackages.getCreatedUserId()); highDiscountPackage.setCreatedUserId(highDiscountPackages.getCreatedUserId());
highDiscountPackage.setCreatedTime(highDiscountPackages.getCreatedTime()); highDiscountPackage.setCreatedTime(highDiscountPackages.getCreatedTime());
highDiscountPackage.setTotalStock(highDiscountPackage.getTotalStock()); highDiscountPackage.setTotalStock(highDiscountPackages.getTotalStock());
highDiscountPackageService.updateDiscountPackage(highDiscountPackage); highDiscountPackageService.updateDiscountPackage(highDiscountPackage);

@ -36,10 +36,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.File; import java.io.File;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @Auther: 袁野 * @Auther: 袁野
@ -607,9 +604,14 @@ public class HighOrderController {
JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo()); JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo());
if (jsonObject == null) {
log.error("orderToPay error!", "请求超时");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求超时,请重新点击");
}
JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data"));
if (dataObject.getBoolean("success")) { if (dataObject.getBoolean("success") || Objects.equals(dataObject.getString("message"), "原交易已撤销,不可再次操作")) {
order.setOrderStatus(4); order.setOrderStatus(4);
order.setRefundTime(new Date()); order.setRefundTime(new Date());
order.setRefundContent(dataObject.getString("orderId")); order.setRefundContent(dataObject.getString("orderId"));

File diff suppressed because one or more lines are too long

@ -16,6 +16,7 @@ import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.common.utils.WxUtils; import com.hai.common.utils.WxUtils;
import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.config.UnionPayConfig;
import com.hai.entity.HighRefundAudit; import com.hai.entity.HighRefundAudit;
import com.hai.entity.OutRechargeOrder; import com.hai.entity.OutRechargeOrder;
import com.hai.model.*; import com.hai.model.*;
@ -260,33 +261,8 @@ public class OutRechargeOrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态");
} }
if (order.getPayType() == 2) { // 微信退款
JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo()); if (order.getPayType() == 1) {
if (jsonObject == null) {
log.error("orderToPay error!", "请求超时");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求超时,请重新点击");
}
JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data"));
if (dataObject.getBoolean("success") || Objects.equals(dataObject.getString("message"), "原交易已撤销,不可再次操作")) {
order.setStatus(5);
order.setRefundTime(new Date());
order.setOutRefundNo("HFR"+new Date().getTime() );
order.setRefundFee(order.getPayRealPrice());
order.setRefundId(dataObject.getString("orderId"));
highRefundAudit.setStatus(1);
highRefundAuditService.updateRefundAudit(highRefundAudit);
outRechargeOrderService.updateOrder(order);
return ResponseMsgUtil.success("退款成功");
} else {
log.error("orderToPay error!", dataObject.getString("message"));
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message"));
}
} else {
Map<String,String> param = new HashMap<>(); Map<String,String> param = new HashMap<>();
param.put("appid", "wx637bd6f7314daa46"); param.put("appid", "wx637bd6f7314daa46");
param.put("mch_id", "1289663601"); param.put("mch_id", "1289663601");
@ -312,13 +288,57 @@ public class OutRechargeOrderController {
outRechargeOrderService.updateOrder(order); outRechargeOrderService.updateOrder(order);
highRefundAudit.setStatus(1); highRefundAudit.setStatus(1);
highRefundAuditService.updateRefundAudit(highRefundAudit); highRefundAuditService.updateRefundAudit(highRefundAudit);
return ResponseMsgUtil.success("退款成功");
} else { } else {
log.error("orderToPay error!", "退款失败"); log.error("orderToPay error!", "退款失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!错误代码:"+orderRefundModel.getErr_code()+",错误描述"+orderRefundModel.getErr_code_des()); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!错误代码:"+orderRefundModel.getErr_code()+",错误描述"+orderRefundModel.getErr_code_des());
} }
} }
// 工会卡退款
if (order.getPayType() == 2) {
JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo());
if (jsonObject == null) {
log.error("orderToPay error!", "请求超时");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求超时,请重新点击");
}
JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data"));
if (dataObject.getBoolean("success") || Objects.equals(dataObject.getString("message"), "原交易已撤销,不可再次操作")) {
order.setStatus(5);
order.setRefundTime(new Date());
order.setOutRefundNo("HFR"+new Date().getTime() );
order.setRefundFee(order.getPayRealPrice());
order.setRefundId(dataObject.getString("orderId"));
highRefundAudit.setStatus(1);
highRefundAuditService.updateRefundAudit(highRefundAudit);
outRechargeOrderService.updateOrder(order);
} else {
log.error("orderToPay error!", dataObject.getString("message"));
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message"));
}
}
// 银联退款
if (order.getPayType() == 4) {
// 订单退款
JSONObject refund = UnionPayConfig.zwrefund(order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue());
if (!refund.getString("resultcode").equals("W6")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg"));
}
order.setStatus(5);
order.setRefundTime(new Date());
order.setOutRefundNo(refund.getString("oriwtorderid"));
order.setRefundFee(order.getPayRealPrice());
highRefundAudit.setStatus(1);
highRefundAuditService.updateRefundAudit(highRefundAudit);
outRechargeOrderService.updateOrder(order);
}
return ResponseMsgUtil.success("退款成功");
} catch (Exception e) { } catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e); log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);

@ -28,11 +28,11 @@ spring:
poolPreparedStatements: true poolPreparedStatements: true
maxOpenPreparedStatements: 20 maxOpenPreparedStatements: 20
redis: redis:
database: 0 database: 5
host: 139.159.177.244 host: 139.159.177.244
port: 36379 port: 36379
password: HF123456.Redis password: HF123456.Redis
timeout: 1000 timeout: 36000000
jedis: jedis:
pool: pool:
max-active: 20 max-active: 20

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

@ -93,6 +93,8 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/order/*") .excludePathPatterns("/order/*")
.excludePathPatterns("/coupon/getCouponList") .excludePathPatterns("/coupon/getCouponList")
.excludePathPatterns("/wechatpay/*") .excludePathPatterns("/wechatpay/*")
.excludePathPatterns("/couponAgent/useConvertCode")
.excludePathPatterns("/couponAgent/convertCodeDetail")
.excludePathPatterns("/coupon/getCouponById") .excludePathPatterns("/coupon/getCouponById")
.excludePathPatterns("/discount/getDiscountByQrCode") .excludePathPatterns("/discount/getDiscountByQrCode")
.excludePathPatterns("/discount/getDiscountById") .excludePathPatterns("/discount/getDiscountById")
@ -129,7 +131,6 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/highBrand/*") .excludePathPatterns("/highBrand/*")
.excludePathPatterns("/highGoodsType/*") .excludePathPatterns("/highGoodsType/*")
.excludePathPatterns("/sendSms/*") .excludePathPatterns("/sendSms/*")
.excludePathPatterns("/test/*")
.excludePathPatterns("/sms/*") .excludePathPatterns("/sms/*")
; ;
} }

@ -55,7 +55,7 @@ public class CmsContentController {
map.put("companyId", bsCompany.getId().toString()); map.put("companyId", bsCompany.getId().toString());
map.put("status", "2"); map.put("status", "2");
map.put("categoryCode", categoryCode); map.put("categoryCode", categoryCode);
return ResponseMsgUtil.success(cmsContentService.getListContent(map)); return ResponseMsgUtil.success(cmsContentService.getListContentByCrest(map));
} }
} }
return ResponseMsgUtil.success(new ArrayList<>()); return ResponseMsgUtil.success(new ArrayList<>());

@ -0,0 +1,114 @@
package com.cweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.*;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DeadlockLoserDataAccessException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*;
/**
* @Auther: 胡锐
* @Description:
* @Date: 2021/4/20 23:47
*/
@Controller
@RequestMapping(value = "/couponAgent")
@Api(value = "代理商接口")
public class HighCouponAgentController {
private static Logger log = LoggerFactory.getLogger(HighCouponAgentController.class);
@Resource
private HighCouponAgentService highCouponAgentService;
@Resource
private HighCouponService highCouponService;
@Resource
private HighCouponCodeService highCouponCodeService;
@RequestMapping(value = "/useConvertCode", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "兑换码使用")
public ResponseData useConvertCode(@RequestBody JSONObject body) {
try {
if (body == null || StringUtils.isBlank(body.getString("code"))) {
log.error("HighCouponAgentController -> queryConvertCode() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询兑换码
HighCouponAgentCode convertCode = highCouponAgentService.getConvertCode(body.getString("code"));
if (convertCode == null) {
log.error("HighCouponAgentController -> queryConvertCode() error!","无效的兑换码");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无效的兑换码");
}
if (convertCode.getStatus() == 3) {
log.error("HighCouponAgentController -> queryConvertCode() error!","兑换码已被使用");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "兑换码已被使用");
}
if (convertCode.getCouponCodeId() != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "兑换码已被使用");
}
return ResponseMsgUtil.success(highCouponAgentService.useConvertCode(body.getString("code")));
} catch (DeadlockLoserDataAccessException deadlockLoserDataAccessException) {
log.error("HighActivityController -> userLottery() error!", "服务器繁忙");
return ResponseMsgUtil.builderResponse(ErrorCode.SERVER_BUSY_ERROR.getCode(),ErrorCode.SERVER_BUSY_ERROR.getMsg(),null);
} catch (Exception e) {
log.error("HighCouponAgentController --> useConvertCode() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/convertCodeDetail", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "兑换码详情")
public ResponseData convertCodeDetail(@RequestParam(name = "code", required = true) String code) {
try {
// 查询兑换码
HighCouponAgentCode couponAgentCode = highCouponAgentService.getConvertCode(code);
if (couponAgentCode == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到销售码");
}
Map<String, Object> map = new HashMap<>();
map.put("couponInfo", highCouponService.getCouponById(couponAgentCode.getCouponId()));
map.put("couponCode", highCouponCodeService.getCouponCodeById(couponAgentCode.getCouponCodeId()));
map.put("couponAgentCode", couponAgentCode);
return ResponseMsgUtil.success(map);
} catch (Exception e) {
log.error("HighCouponAgentController --> getConvertCodeDetail() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -53,9 +53,6 @@ public class HighCouponController {
@Resource @Resource
private HighCouponCodeService highCouponCodeService; private HighCouponCodeService highCouponCodeService;
@Resource
private HighOrderService highOrderService;
@Resource @Resource
private HighUserCouponService highUserCouponService; private HighUserCouponService highUserCouponService;

@ -272,6 +272,29 @@ public class HighOrderController {
childOrder.setGoodsSpecName("默认"); childOrder.setGoodsSpecName("默认");
} }
// 汇联通充值
if (childOrder.getGoodsType() == 8) {
if (childOrder.getGoodsPrice() == null) {
log.error("HighOrderController --> addOrder() error!", "请设置充值金额");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请设置充值金额");
}
if (highOrder.getMemCardNo() == null) {
log.error("HighOrderController --> addOrder() error!", "请设置充值卡号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请设置充值卡号");
}
// 查询用户信息
HighUser user = highUserService.findByUserId(childOrder.getGoodsId());
if (user == null) {
log.error("HighOrderController --> addOrder() error!", "未找到用户");
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "");
}
highOrder.setPayType(2); // 第三方平台
childOrder.setGoodsActualPrice(childOrder.getGoodsPrice());
childOrder.setGoodsName(user.getName());
childOrder.setGoodsImg(user.getHeaderImg());
childOrder.setGoodsSpecName("默认");
}
childOrder.setMemId(userInfoModel.getHighUser().getId()); childOrder.setMemId(userInfoModel.getHighUser().getId());
childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString())));
childOrder.setGiveawayType(false); // 是否是赠品 0:否 1:是 childOrder.setGiveawayType(false); // 是否是赠品 0:否 1:是
@ -346,7 +369,7 @@ public class HighOrderController {
// 卡卷类型 1:满减 2:抵扣 3:折扣 // 卡卷类型 1:满减 2:抵扣 3:折扣
if (highDiscountUserRel.getHighDiscount().getDiscountType() == 3) { if (highDiscountUserRel.getHighDiscount().getDiscountType() == 3) {
// 折扣除100 // 折扣除100
BigDecimal discountPrice = highDiscountUserRel.getHighDiscount().getDiscountPrice().divide(new BigDecimal("10")); BigDecimal discountPrice = highDiscountUserRel.getHighDiscount().getDiscountPrice();
// 订单总额 * 折扣 // 订单总额 * 折扣
BigDecimal payPrice = highOrder.getTotalPrice().multiply(discountPrice); BigDecimal payPrice = highOrder.getTotalPrice().multiply(discountPrice);
highOrder.setDeductionPrice(highOrder.getTotalPrice().subtract(payPrice)); highOrder.setDeductionPrice(highOrder.getTotalPrice().subtract(payPrice));

@ -122,15 +122,16 @@ public class OutRechargeOrderController {
// 支付类型 1.微信支付 // 支付类型 1.微信支付
outRechargeOrder.setPayType(1); outRechargeOrder.setPayType(1);
// 判断充值模式:1 电信 2. 移动 3. 联通 // 判断充值模式:1 电信 2. 移动 3. 联通
JSONObject telObject = telApiService.outApiTel(outRechargeOrder.getRechargeContent()); // 拼接内容
if (telObject.get("status").equals(0)) { remarks = outRechargeOrder.getRechargeContent() + "充值" + outRechargeOrder.getOrderPrice() + "元";
JSONObject o = telObject.getObject("result",JSONObject.class); // JSONObject telObject = telApiService.outApiTel(outRechargeOrder.getRechargeContent());
// 拼接内容 // if (telObject.get("status").equals(0)) {
remarks = o.get("province").toString() + o.get("company").toString() + "充值" + outRechargeOrder.getOrderPrice() + "元"; // JSONObject o = telObject.getObject("result",JSONObject.class);
} else { //
log.error("orderToPay error!"); // } else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_IS_ERROR); // log.error("orderToPay error!");
} // throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_IS_ERROR);
// }
HighDiscountUserRel highDiscountUserRel = null; HighDiscountUserRel highDiscountUserRel = null;
if (outRechargeOrder.getMemDiscountId() != null) { if (outRechargeOrder.getMemDiscountId() != null) {
@ -186,8 +187,7 @@ public class OutRechargeOrderController {
// 卡卷类型 1:满减 2:抵扣 3:折扣 // 卡卷类型 1:满减 2:抵扣 3:折扣
if (highDiscountUserRel.getHighDiscount().getDiscountType() == 3) { if (highDiscountUserRel.getHighDiscount().getDiscountType() == 3) {
// 折扣除100 BigDecimal discountPrice = highDiscountUserRel.getHighDiscount().getDiscountPrice();
BigDecimal discountPrice = highDiscountUserRel.getHighDiscount().getDiscountPrice().divide(new BigDecimal("10"));
// 订单总额 * 折扣 // 订单总额 * 折扣
BigDecimal payPrice = outRechargeOrder.getOrderPrice().multiply(discountPrice); BigDecimal payPrice = outRechargeOrder.getOrderPrice().multiply(discountPrice);
outRechargeOrder.setDeductionPrice(outRechargeOrder.getOrderPrice().subtract(payPrice)); outRechargeOrder.setDeductionPrice(outRechargeOrder.getOrderPrice().subtract(payPrice));

@ -59,7 +59,8 @@ public class OutRechargePriceController {
@ApiOperation(value = "查询充值金额列表") @ApiOperation(value = "查询充值金额列表")
public ResponseData getListOutRechargePrice( public ResponseData getListOutRechargePrice(
@RequestParam(value = "type", required = false) Integer type, @RequestParam(value = "type", required = false) Integer type,
@RequestParam(name = "regionId", required = true) String regionId @RequestParam(name = "regionId", required = true) String regionId,
@RequestParam(name = "showType", required = true) Integer showType
) { ) {
try { try {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
@ -71,8 +72,11 @@ public class OutRechargePriceController {
} }
if (type != null ) { if (type != null ) {
map.put("type", String.valueOf(type)); map.put("showType", String.valueOf(showType));
}
if (type != null ) {
map.put("type", String.valueOf(type));
} }
return ResponseMsgUtil.success( outRechargePriceService.getListRechargePriceC(map)); return ResponseMsgUtil.success( outRechargePriceService.getListRechargePriceC(map));

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

@ -46,7 +46,7 @@ public class test {
@Test @Test
public void test(){ public void test(){
/* List<HighDiscountAgentCode> codeList = highDiscountAgentCodeService.getDiscountCodeByDiscountAgentId(55L); List<HighDiscountAgentCode> codeList = highDiscountAgentCodeService.getDiscountCodeByDiscountAgentId(55L);
List<HighUser> userList = highUserService.getUserList(); List<HighUser> userList = highUserService.getUserList();
@ -55,7 +55,7 @@ public class test {
// 领取优惠券 // 领取优惠券
highDiscountUserRelService.receiveDiscount(user.getId(), codeList.get(num).getId()); highDiscountUserRelService.receiveDiscount(user.getId(), codeList.get(num).getId());
num++; num++;
}*/ }
} }

@ -1,5 +1,6 @@
package com.hai.common; package com.hai.common;
import java.security.SecureRandom;
import java.util.Calendar; import java.util.Calendar;
import java.util.Random; import java.util.Random;
@ -8,8 +9,11 @@ import java.util.Random;
* @Description: * @Description:
* @Date: 2021/3/18 21:07 * @Date: 2021/3/18 21:07
*/ */
public class generateCode { public class GenerateCode {
private static final Random RANDOM = new SecureRandom();
private static final String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
/** /**
* @Author 胡锐 * @Author 胡锐
@ -33,4 +37,23 @@ public class generateCode {
} }
return val; return val;
} }
/**
* 生成兑换码
* @param couponAgentRelId
* @return
*/
public static String convertCode(Long couponAgentRelId) {
// 兑换码总长度
int countLength = 20;
// 需要生成的长度
int generateLength = countLength - couponAgentRelId.toString().length();
char[] nonceChars = new char[generateLength];
for (int index = 0; index < nonceChars.length; ++index) {
nonceChars[index] = SYMBOLS.charAt(RANDOM.nextInt(SYMBOLS.length()));
}
return new String(nonceChars) + couponAgentRelId;
}
} }

@ -121,6 +121,31 @@ public class HuiLianTongUnionCardConfig {
} }
} }
/**
* 充值
* @param orderNo 订单号
* @param cardNo 卡号
* @param tranAmount 支付金额
* @param businessType 业务类型 1.卖中石化加油券的固定填sinopec_oil_code 2.其他商品或服务的固定填hisen_consume
* @param tranVoucher 银行卡充值可填银行卡号支付宝微信充值可填相应的扣款单号接入方也可自定义填入交易流水跟踪号但长度不能超过50
* @param tranDesc 交易描述
* @return
* @throws Exception
*/
public static JSONObject deposit(String orderNo, String cardNo, BigDecimal tranAmount, String businessType, String tranVoucher , String tranDesc) throws Exception {
Map<String,Object> dataMap = new HashMap<>();
dataMap.put("orderNo", orderNo);
dataMap.put("cardType", "ghk");
dataMap.put("cardNo", cardNo);
dataMap.put("tranAmount", tranAmount);
dataMap.put("tranChannel", "HiSen");
dataMap.put("businessType", businessType);
dataMap.put("tranVoucher", tranVoucher);
dataMap.put("tranDesc", tranDesc);
System.out.println("工会卡支付请求参数" + JSON.toJSONString(dataMap));
return request("qtk/deposit", dataMap);
}
/** /**
* 支付 * 支付
* @param orderNo 订单号 * @param orderNo 订单号

@ -44,7 +44,7 @@ public interface CmsContentMapperExt {
" AND cc.status = #{status}", " AND cc.status = #{status}",
" </when>", " </when>",
"</choose>", "</choose>",
"ORDER BY cc.category_code", "ORDER BY cc.category_code and cc.sort_id",
"</script>" "</script>"
}) })
@Results({ @Results({
@ -76,4 +76,67 @@ public interface CmsContentMapperExt {
}) })
List<CmsContentModel> getListContent(Map<String, String> paramsMap) throws Exception; List<CmsContentModel> getListContent(Map<String, String> paramsMap) throws Exception;
@Select(value = {
"<script>",
"SELECT",
"cc.*",
", cca.name AS category_name",
"FROM cms_content AS cc",
", cms_category AS cca",
"WHERE cc.category_id = cca.id",
"<if test=\"title != null\">",
" AND cc.title REGEXP #{title}",
"</if>",
"<if test=\"category != null\">",
" AND cc.category_id = #{category}",
"</if>",
"<if test=\"categoryCode != null\">",
" AND cc.category_code = #{categoryCode}",
"</if>",
"<if test=\"companyId != null\">",
" AND cc.company_id = #{companyId}",
"</if>",
"<if test=\"tag != null\">",
" AND cc.tag = #{tag}",
"</if>",
"<choose>",
" <when test=\"status == null\">",
" AND cc.status != 0",
" </when>",
" <when test=\"status != null\">",
" AND cc.status = #{status}",
" </when>",
"</choose>",
"ORDER BY cc.sort_id",
"</script>"
})
@Results({
@Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true),
@Result(column="title", property="title", jdbcType= JdbcType.VARCHAR),
@Result(column="category_id", property="categoryId", jdbcType= JdbcType.BIGINT),
@Result(column="category_code", property="categoryCode", jdbcType= JdbcType.VARCHAR),
@Result(column="description", property="description", jdbcType= JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType= JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType= JdbcType.INTEGER),
@Result(column="has_patch", property="hasPatch", jdbcType= JdbcType.TINYINT),
@Result(column="visit_count", property="visitCount", jdbcType= JdbcType.INTEGER),
@Result(column="tag", property="tag", jdbcType= JdbcType.VARCHAR),
@Result(column="img_source", property="imgSource", jdbcType= JdbcType.TINYINT),
@Result(column="img_data", property="imgData", jdbcType= JdbcType.VARCHAR),
@Result(column="jump_type", property="jumpType", jdbcType= JdbcType.INTEGER),
@Result(column="jump_name", property="jumpName", jdbcType= JdbcType.VARCHAR),
@Result(column="jump_url", property="jumpUrl", jdbcType= JdbcType.VARCHAR),
@Result(column="sort_id", property="sortId", jdbcType= JdbcType.INTEGER),
@Result(column="update_time", property="updateTime", jdbcType= JdbcType.TIMESTAMP),
@Result(column="recommend", property="recommend", jdbcType= JdbcType.BIT),
@Result(column="company_id", property="companyId", jdbcType= JdbcType.BIGINT),
@Result(column="op_id", property="opId", jdbcType= JdbcType.BIGINT),
@Result(column="ext_1", property="ext1", jdbcType= JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType= JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType= JdbcType.VARCHAR),
@Result(column="content", property="content", jdbcType= JdbcType.LONGVARCHAR),
@Result(column="category_name", property="categoryName", jdbcType= JdbcType.VARCHAR),
})
List<CmsContentModel> getListContentByCrest(Map<String, String> paramsMap) throws Exception;
} }

@ -39,16 +39,18 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt
int deleteByPrimaryKey(Long id); int deleteByPrimaryKey(Long id);
@Insert({ @Insert({
"insert into high_coupon_agent_code (coupon_agent_id, coupon_id, ", "insert into high_coupon_agent_code (`type`, coupon_agent_id, ",
"agent_id, coupon_code_id, ", "coupon_id, agent_id, ",
"coupon_agent_record_id, coupon_code, ", "coupon_agent_record_id, convert_code, ",
"coupon_code_id, coupon_code, ",
"qr_code, `status`, ", "qr_code, `status`, ",
"remark, create_time, ", "remark, create_time, ",
"operator_id, operator_name, ", "operator_id, operator_name, ",
"ext_1, ext_2, ext_3)", "ext_1, ext_2, ext_3)",
"values (#{couponAgentId,jdbcType=BIGINT}, #{couponId,jdbcType=BIGINT}, ", "values (#{type,jdbcType=INTEGER}, #{couponAgentId,jdbcType=BIGINT}, ",
"#{agentId,jdbcType=BIGINT}, #{couponCodeId,jdbcType=BIGINT}, ", "#{couponId,jdbcType=BIGINT}, #{agentId,jdbcType=BIGINT}, ",
"#{couponAgentRecordId,jdbcType=BIGINT}, #{couponCode,jdbcType=VARCHAR}, ", "#{couponAgentRecordId,jdbcType=BIGINT}, #{convertCode,jdbcType=VARCHAR}, ",
"#{couponCodeId,jdbcType=BIGINT}, #{couponCode,jdbcType=VARCHAR}, ",
"#{qrCode,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", "#{qrCode,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ", "#{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ", "#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ",
@ -64,11 +66,13 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt
@SelectProvider(type=HighCouponAgentCodeSqlProvider.class, method="selectByExample") @SelectProvider(type=HighCouponAgentCodeSqlProvider.class, method="selectByExample")
@Results({ @Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="coupon_agent_id", property="couponAgentId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_agent_id", property="couponAgentId", jdbcType=JdbcType.BIGINT),
@Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT),
@Result(column="coupon_agent_record_id", property="couponAgentRecordId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_agent_record_id", property="couponAgentRecordId", jdbcType=JdbcType.BIGINT),
@Result(column="convert_code", property="convertCode", jdbcType=JdbcType.VARCHAR),
@Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT),
@Result(column="coupon_code", property="couponCode", jdbcType=JdbcType.VARCHAR), @Result(column="coupon_code", property="couponCode", jdbcType=JdbcType.VARCHAR),
@Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR), @Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@ -84,19 +88,21 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt
@Select({ @Select({
"select", "select",
"id, coupon_agent_id, coupon_id, agent_id, coupon_code_id, coupon_agent_record_id, ", "id, `type`, coupon_agent_id, coupon_id, agent_id, coupon_agent_record_id, convert_code, ",
"coupon_code, qr_code, `status`, remark, create_time, operator_id, operator_name, ", "coupon_code_id, coupon_code, qr_code, `status`, remark, create_time, operator_id, ",
"ext_1, ext_2, ext_3", "operator_name, ext_1, ext_2, ext_3",
"from high_coupon_agent_code", "from high_coupon_agent_code",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
@Results({ @Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="coupon_agent_id", property="couponAgentId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_agent_id", property="couponAgentId", jdbcType=JdbcType.BIGINT),
@Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT),
@Result(column="coupon_agent_record_id", property="couponAgentRecordId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_agent_record_id", property="couponAgentRecordId", jdbcType=JdbcType.BIGINT),
@Result(column="convert_code", property="convertCode", jdbcType=JdbcType.VARCHAR),
@Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT),
@Result(column="coupon_code", property="couponCode", jdbcType=JdbcType.VARCHAR), @Result(column="coupon_code", property="couponCode", jdbcType=JdbcType.VARCHAR),
@Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR), @Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@ -121,11 +127,13 @@ public interface HighCouponAgentCodeMapper extends HighCouponAgentCodeMapperExt
@Update({ @Update({
"update high_coupon_agent_code", "update high_coupon_agent_code",
"set coupon_agent_id = #{couponAgentId,jdbcType=BIGINT},", "set `type` = #{type,jdbcType=INTEGER},",
"coupon_agent_id = #{couponAgentId,jdbcType=BIGINT},",
"coupon_id = #{couponId,jdbcType=BIGINT},", "coupon_id = #{couponId,jdbcType=BIGINT},",
"agent_id = #{agentId,jdbcType=BIGINT},", "agent_id = #{agentId,jdbcType=BIGINT},",
"coupon_code_id = #{couponCodeId,jdbcType=BIGINT},",
"coupon_agent_record_id = #{couponAgentRecordId,jdbcType=BIGINT},", "coupon_agent_record_id = #{couponAgentRecordId,jdbcType=BIGINT},",
"convert_code = #{convertCode,jdbcType=VARCHAR},",
"coupon_code_id = #{couponCodeId,jdbcType=BIGINT},",
"coupon_code = #{couponCode,jdbcType=VARCHAR},", "coupon_code = #{couponCode,jdbcType=VARCHAR},",
"qr_code = #{qrCode,jdbcType=VARCHAR},", "qr_code = #{qrCode,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},", "`status` = #{status,jdbcType=INTEGER},",

@ -28,6 +28,10 @@ public class HighCouponAgentCodeSqlProvider {
SQL sql = new SQL(); SQL sql = new SQL();
sql.INSERT_INTO("high_coupon_agent_code"); sql.INSERT_INTO("high_coupon_agent_code");
if (record.getType() != null) {
sql.VALUES("`type`", "#{type,jdbcType=INTEGER}");
}
if (record.getCouponAgentId() != null) { if (record.getCouponAgentId() != null) {
sql.VALUES("coupon_agent_id", "#{couponAgentId,jdbcType=BIGINT}"); sql.VALUES("coupon_agent_id", "#{couponAgentId,jdbcType=BIGINT}");
} }
@ -40,14 +44,18 @@ public class HighCouponAgentCodeSqlProvider {
sql.VALUES("agent_id", "#{agentId,jdbcType=BIGINT}"); sql.VALUES("agent_id", "#{agentId,jdbcType=BIGINT}");
} }
if (record.getCouponCodeId() != null) {
sql.VALUES("coupon_code_id", "#{couponCodeId,jdbcType=BIGINT}");
}
if (record.getCouponAgentRecordId() != null) { if (record.getCouponAgentRecordId() != null) {
sql.VALUES("coupon_agent_record_id", "#{couponAgentRecordId,jdbcType=BIGINT}"); sql.VALUES("coupon_agent_record_id", "#{couponAgentRecordId,jdbcType=BIGINT}");
} }
if (record.getConvertCode() != null) {
sql.VALUES("convert_code", "#{convertCode,jdbcType=VARCHAR}");
}
if (record.getCouponCodeId() != null) {
sql.VALUES("coupon_code_id", "#{couponCodeId,jdbcType=BIGINT}");
}
if (record.getCouponCode() != null) { if (record.getCouponCode() != null) {
sql.VALUES("coupon_code", "#{couponCode,jdbcType=VARCHAR}"); sql.VALUES("coupon_code", "#{couponCode,jdbcType=VARCHAR}");
} }
@ -98,11 +106,13 @@ public class HighCouponAgentCodeSqlProvider {
} else { } else {
sql.SELECT("id"); sql.SELECT("id");
} }
sql.SELECT("`type`");
sql.SELECT("coupon_agent_id"); sql.SELECT("coupon_agent_id");
sql.SELECT("coupon_id"); sql.SELECT("coupon_id");
sql.SELECT("agent_id"); sql.SELECT("agent_id");
sql.SELECT("coupon_code_id");
sql.SELECT("coupon_agent_record_id"); sql.SELECT("coupon_agent_record_id");
sql.SELECT("convert_code");
sql.SELECT("coupon_code_id");
sql.SELECT("coupon_code"); sql.SELECT("coupon_code");
sql.SELECT("qr_code"); sql.SELECT("qr_code");
sql.SELECT("`status`"); sql.SELECT("`status`");
@ -134,6 +144,10 @@ public class HighCouponAgentCodeSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("id = #{record.id,jdbcType=BIGINT}");
} }
if (record.getType() != null) {
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
}
if (record.getCouponAgentId() != null) { if (record.getCouponAgentId() != null) {
sql.SET("coupon_agent_id = #{record.couponAgentId,jdbcType=BIGINT}"); sql.SET("coupon_agent_id = #{record.couponAgentId,jdbcType=BIGINT}");
} }
@ -146,14 +160,18 @@ public class HighCouponAgentCodeSqlProvider {
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}"); sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
} }
if (record.getCouponCodeId() != null) {
sql.SET("coupon_code_id = #{record.couponCodeId,jdbcType=BIGINT}");
}
if (record.getCouponAgentRecordId() != null) { if (record.getCouponAgentRecordId() != null) {
sql.SET("coupon_agent_record_id = #{record.couponAgentRecordId,jdbcType=BIGINT}"); sql.SET("coupon_agent_record_id = #{record.couponAgentRecordId,jdbcType=BIGINT}");
} }
if (record.getConvertCode() != null) {
sql.SET("convert_code = #{record.convertCode,jdbcType=VARCHAR}");
}
if (record.getCouponCodeId() != null) {
sql.SET("coupon_code_id = #{record.couponCodeId,jdbcType=BIGINT}");
}
if (record.getCouponCode() != null) { if (record.getCouponCode() != null) {
sql.SET("coupon_code = #{record.couponCode,jdbcType=VARCHAR}"); sql.SET("coupon_code = #{record.couponCode,jdbcType=VARCHAR}");
} }
@ -203,11 +221,13 @@ public class HighCouponAgentCodeSqlProvider {
sql.UPDATE("high_coupon_agent_code"); sql.UPDATE("high_coupon_agent_code");
sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
sql.SET("coupon_agent_id = #{record.couponAgentId,jdbcType=BIGINT}"); sql.SET("coupon_agent_id = #{record.couponAgentId,jdbcType=BIGINT}");
sql.SET("coupon_id = #{record.couponId,jdbcType=BIGINT}"); sql.SET("coupon_id = #{record.couponId,jdbcType=BIGINT}");
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}"); sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
sql.SET("coupon_code_id = #{record.couponCodeId,jdbcType=BIGINT}");
sql.SET("coupon_agent_record_id = #{record.couponAgentRecordId,jdbcType=BIGINT}"); sql.SET("coupon_agent_record_id = #{record.couponAgentRecordId,jdbcType=BIGINT}");
sql.SET("convert_code = #{record.convertCode,jdbcType=VARCHAR}");
sql.SET("coupon_code_id = #{record.couponCodeId,jdbcType=BIGINT}");
sql.SET("coupon_code = #{record.couponCode,jdbcType=VARCHAR}"); sql.SET("coupon_code = #{record.couponCode,jdbcType=VARCHAR}");
sql.SET("qr_code = #{record.qrCode,jdbcType=VARCHAR}"); sql.SET("qr_code = #{record.qrCode,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
@ -228,6 +248,10 @@ public class HighCouponAgentCodeSqlProvider {
SQL sql = new SQL(); SQL sql = new SQL();
sql.UPDATE("high_coupon_agent_code"); sql.UPDATE("high_coupon_agent_code");
if (record.getType() != null) {
sql.SET("`type` = #{type,jdbcType=INTEGER}");
}
if (record.getCouponAgentId() != null) { if (record.getCouponAgentId() != null) {
sql.SET("coupon_agent_id = #{couponAgentId,jdbcType=BIGINT}"); sql.SET("coupon_agent_id = #{couponAgentId,jdbcType=BIGINT}");
} }
@ -240,14 +264,18 @@ public class HighCouponAgentCodeSqlProvider {
sql.SET("agent_id = #{agentId,jdbcType=BIGINT}"); sql.SET("agent_id = #{agentId,jdbcType=BIGINT}");
} }
if (record.getCouponCodeId() != null) {
sql.SET("coupon_code_id = #{couponCodeId,jdbcType=BIGINT}");
}
if (record.getCouponAgentRecordId() != null) { if (record.getCouponAgentRecordId() != null) {
sql.SET("coupon_agent_record_id = #{couponAgentRecordId,jdbcType=BIGINT}"); sql.SET("coupon_agent_record_id = #{couponAgentRecordId,jdbcType=BIGINT}");
} }
if (record.getConvertCode() != null) {
sql.SET("convert_code = #{convertCode,jdbcType=VARCHAR}");
}
if (record.getCouponCodeId() != null) {
sql.SET("coupon_code_id = #{couponCodeId,jdbcType=BIGINT}");
}
if (record.getCouponCode() != null) { if (record.getCouponCode() != null) {
sql.SET("coupon_code = #{couponCode,jdbcType=VARCHAR}"); sql.SET("coupon_code = #{couponCode,jdbcType=VARCHAR}");
} }

@ -39,18 +39,20 @@ public interface HighCouponAgentRelMapper extends HighCouponAgentRelMapperExt {
int deleteByPrimaryKey(Long id); int deleteByPrimaryKey(Long id);
@Insert({ @Insert({
"insert into high_coupon_agent_rel (coupon_name, sales_price, ", "insert into high_coupon_agent_rel (`type`, coupon_name, ",
"coupon_id, agent_id, ", "sales_price, coupon_id, ",
"stock_count, sales_count, ", "agent_id, stock_count, ",
"create_time, `status`, ", "sales_count, create_time, ",
"operator_id, operator_name, ", "`status`, operator_id, ",
"ext_1, ext_2, ext_3)", "operator_name, ext_1, ",
"values (#{couponName,jdbcType=VARCHAR}, #{salesPrice,jdbcType=DECIMAL}, ", "ext_2, ext_3)",
"#{couponId,jdbcType=BIGINT}, #{agentId,jdbcType=BIGINT}, ", "values (#{type,jdbcType=INTEGER}, #{couponName,jdbcType=VARCHAR}, ",
"#{stockCount,jdbcType=INTEGER}, #{salesCount,jdbcType=INTEGER}, ", "#{salesPrice,jdbcType=DECIMAL}, #{couponId,jdbcType=BIGINT}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ", "#{agentId,jdbcType=BIGINT}, #{stockCount,jdbcType=INTEGER}, ",
"#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ", "#{salesCount,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" "#{status,jdbcType=INTEGER}, #{operatorId,jdbcType=BIGINT}, ",
"#{operatorName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighCouponAgentRel record); int insert(HighCouponAgentRel record);
@ -62,6 +64,7 @@ public interface HighCouponAgentRelMapper extends HighCouponAgentRelMapperExt {
@SelectProvider(type=HighCouponAgentRelSqlProvider.class, method="selectByExample") @SelectProvider(type=HighCouponAgentRelSqlProvider.class, method="selectByExample")
@Results({ @Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="coupon_name", property="couponName", jdbcType=JdbcType.VARCHAR), @Result(column="coupon_name", property="couponName", jdbcType=JdbcType.VARCHAR),
@Result(column="sales_price", property="salesPrice", jdbcType=JdbcType.DECIMAL), @Result(column="sales_price", property="salesPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
@ -80,13 +83,14 @@ public interface HighCouponAgentRelMapper extends HighCouponAgentRelMapperExt {
@Select({ @Select({
"select", "select",
"id, coupon_name, sales_price, coupon_id, agent_id, stock_count, sales_count, ", "id, `type`, coupon_name, sales_price, coupon_id, agent_id, stock_count, sales_count, ",
"create_time, `status`, operator_id, operator_name, ext_1, ext_2, ext_3", "create_time, `status`, operator_id, operator_name, ext_1, ext_2, ext_3",
"from high_coupon_agent_rel", "from high_coupon_agent_rel",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
@Results({ @Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="coupon_name", property="couponName", jdbcType=JdbcType.VARCHAR), @Result(column="coupon_name", property="couponName", jdbcType=JdbcType.VARCHAR),
@Result(column="sales_price", property="salesPrice", jdbcType=JdbcType.DECIMAL), @Result(column="sales_price", property="salesPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
@ -114,7 +118,8 @@ public interface HighCouponAgentRelMapper extends HighCouponAgentRelMapperExt {
@Update({ @Update({
"update high_coupon_agent_rel", "update high_coupon_agent_rel",
"set coupon_name = #{couponName,jdbcType=VARCHAR},", "set `type` = #{type,jdbcType=INTEGER},",
"coupon_name = #{couponName,jdbcType=VARCHAR},",
"sales_price = #{salesPrice,jdbcType=DECIMAL},", "sales_price = #{salesPrice,jdbcType=DECIMAL},",
"coupon_id = #{couponId,jdbcType=BIGINT},", "coupon_id = #{couponId,jdbcType=BIGINT},",
"agent_id = #{agentId,jdbcType=BIGINT},", "agent_id = #{agentId,jdbcType=BIGINT},",

@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType; import org.apache.ibatis.type.JdbcType;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
@ -21,11 +22,11 @@ public interface HighCouponAgentRelMapperExt {
" case when sum(c.sales_price) is not null then sum(c.sales_price) else 0 end salesCountPrice " + " case when sum(c.sales_price) is not null then sum(c.sales_price) else 0 end salesCountPrice " +
" from high_coupon_agent_code a,high_coupon_code b,high_coupon_agent_rel c" + " from high_coupon_agent_code a,high_coupon_code b,high_coupon_agent_rel c" +
" where c.id = a.coupon_agent_id and c.agent_id = #{agentId}" + " where c.id = a.coupon_agent_id and c.agent_id = #{agentId}" +
" and a.status = 3 and a.coupon_code_id = b.id and b.consume_time >= #{consumeTimeS} and b.consume_time <= #{consumeTimeE}") " and b.status = 3 and a.coupon_code_id = b.id and b.consume_time >= #{consumeTimeS} and b.consume_time <= #{consumeTimeE}")
AgentSalesModel getAgentSales(@Param("agentId") Long agentId, @Param("consumeTimeS")String consumeTimeS, @Param("consumeTimeE")String consumeTimeE); AgentSalesModel getAgentSales(@Param("agentId") Long agentId, @Param("consumeTimeS")String consumeTimeS, @Param("consumeTimeE")String consumeTimeE);
@Select(" select a.* from high_coupon_agent_code a,high_coupon_code b,high_coupon_agent_rel c " + @Select(" select a.* from high_coupon_agent_code a,high_coupon_code b,high_coupon_agent_rel c " +
" where c.id = a.coupon_agent_id and c.agent_id = #{agentId} and a.status = 3 and a.coupon_code_id = b.id " + " where c.id = a.coupon_agent_id and c.agent_id = #{agentId} and b.`status` = 3 and a.coupon_code_id = b.id " +
" and b.consume_time >= #{consumeTimeS} and b.consume_time <= #{consumeTimeE} ORDER BY b.consume_time desc") " and b.consume_time >= #{consumeTimeS} and b.consume_time <= #{consumeTimeE} ORDER BY b.consume_time desc")
@Results({ @Results({
@Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true),
@ -47,6 +48,37 @@ public interface HighCouponAgentRelMapperExt {
}) })
List<HighCouponAgentCode> getAgentSalesCodeList(@Param("agentId") Long agentId, @Param("consumeTimeS")String consumeTimeS, @Param("consumeTimeE")String consumeTimeE); List<HighCouponAgentCode> getAgentSalesCodeList(@Param("agentId") Long agentId, @Param("consumeTimeS")String consumeTimeS, @Param("consumeTimeE")String consumeTimeE);
@Select(" select count(1) from high_coupon_agent_code a where a.agent_id = #{agentId} and a.`status` in (#{status}) ") @Select(" select count(1) from high_coupon_agent_code a where a.agent_id = #{agentId} and a.`status` in (${status}) and a.type = #{type} ")
Integer getAgentCodeCount(@Param("agentId") Long agentId,@Param("status") String status); Integer getAgentCodeCount(@Param("agentId") Long agentId,@Param("status") String status,@Param("type") Integer type);
@Select(" select " +
" case WHEN sum(b.sales_price) is null then 0 else sum(b.sales_price) end" +
" from high_coupon_agent_code a " +
" LEFT JOIN high_coupon_agent_rel b on b.id = a.coupon_agent_id " +
" where a.agent_id = #{agentId} and a.`status` in (${status}) and a.type = #{type} ")
Integer getAgentCodePrice(@Param("agentId") Long agentId,@Param("status") String status,@Param("type") Integer type);
@Select(" select " +
" a.id," +
" a.noUsedNum, " +
" (a.noUsedNum * a.price) noUsedPrice," +
" b.usedNum," +
" (b.usedNum * b.price) usedPrice" +
" from (" +
" select " +
" b.id," +
" count(1) noUsedNum," +
" b.sales_price price" +
" from high_coupon_agent_code a " +
" LEFT JOIN high_coupon_agent_rel b on b.id = a.coupon_agent_id" +
" where b.id = #{couponAgentRelId} and a.`status` = 2) a," +
" (select " +
" b.id," +
" count(1) usedNum," +
" b.sales_price price" +
" from high_coupon_agent_code a" +
" LEFT JOIN high_coupon_agent_rel b on b.id = a.coupon_agent_id" +
" where b.id = #{couponAgentRelId} and a.`status` = 3) b" +
" where a.id = b.id ")
Map<String, Object> getUseNum(@Param("couponAgentRelId") Long couponAgentRelId);
} }

@ -28,6 +28,10 @@ public class HighCouponAgentRelSqlProvider {
SQL sql = new SQL(); SQL sql = new SQL();
sql.INSERT_INTO("high_coupon_agent_rel"); sql.INSERT_INTO("high_coupon_agent_rel");
if (record.getType() != null) {
sql.VALUES("`type`", "#{type,jdbcType=INTEGER}");
}
if (record.getCouponName() != null) { if (record.getCouponName() != null) {
sql.VALUES("coupon_name", "#{couponName,jdbcType=VARCHAR}"); sql.VALUES("coupon_name", "#{couponName,jdbcType=VARCHAR}");
} }
@ -90,6 +94,7 @@ public class HighCouponAgentRelSqlProvider {
} else { } else {
sql.SELECT("id"); sql.SELECT("id");
} }
sql.SELECT("`type`");
sql.SELECT("coupon_name"); sql.SELECT("coupon_name");
sql.SELECT("sales_price"); sql.SELECT("sales_price");
sql.SELECT("coupon_id"); sql.SELECT("coupon_id");
@ -124,6 +129,10 @@ public class HighCouponAgentRelSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("id = #{record.id,jdbcType=BIGINT}");
} }
if (record.getType() != null) {
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
}
if (record.getCouponName() != null) { if (record.getCouponName() != null) {
sql.SET("coupon_name = #{record.couponName,jdbcType=VARCHAR}"); sql.SET("coupon_name = #{record.couponName,jdbcType=VARCHAR}");
} }
@ -185,6 +194,7 @@ public class HighCouponAgentRelSqlProvider {
sql.UPDATE("high_coupon_agent_rel"); sql.UPDATE("high_coupon_agent_rel");
sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
sql.SET("coupon_name = #{record.couponName,jdbcType=VARCHAR}"); sql.SET("coupon_name = #{record.couponName,jdbcType=VARCHAR}");
sql.SET("sales_price = #{record.salesPrice,jdbcType=DECIMAL}"); sql.SET("sales_price = #{record.salesPrice,jdbcType=DECIMAL}");
sql.SET("coupon_id = #{record.couponId,jdbcType=BIGINT}"); sql.SET("coupon_id = #{record.couponId,jdbcType=BIGINT}");
@ -208,6 +218,10 @@ public class HighCouponAgentRelSqlProvider {
SQL sql = new SQL(); SQL sql = new SQL();
sql.UPDATE("high_coupon_agent_rel"); sql.UPDATE("high_coupon_agent_rel");
if (record.getType() != null) {
sql.SET("`type` = #{type,jdbcType=INTEGER}");
}
if (record.getCouponName() != null) { if (record.getCouponName() != null) {
sql.SET("coupon_name = #{couponName,jdbcType=VARCHAR}"); sql.SET("coupon_name = #{couponName,jdbcType=VARCHAR}");
} }

@ -44,7 +44,7 @@ public class HighChildOrder implements Serializable {
private String storeAddress; private String storeAddress;
/** /**
* 商品类型 1:卡卷 2:金币充值 3:团油加油站 4: KFC 5电影票 * 商品类型 1:卡卷 2:金币充值 3:团油加油站 4: KFC 5电影票 8: 汇联通充值
*/ */
private Integer goodsType; private Integer goodsType;

@ -20,6 +20,11 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser
*/ */
private Long id; private Long id;
/**
* 类型 1销售码 2兑换码
*/
private Integer type;
/** /**
* 卡券和代理商的id * 卡券和代理商的id
*/ */
@ -36,14 +41,19 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser
private Long agentId; private Long agentId;
/** /**
* 销售码id * 卡券分配给代理商库存记录id
*/ */
private Long couponCodeId; private Long couponAgentRecordId;
/** /**
* 卡券分配给代理商库存记录id * 兑换码
*/ */
private Long couponAgentRecordId; private String convertCode;
/**
* 销售码id
*/
private Long couponCodeId;
/** /**
* 销售码 * 销售码
@ -96,6 +106,14 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser
this.id = id; this.id = id;
} }
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Long getCouponAgentId() { public Long getCouponAgentId() {
return couponAgentId; return couponAgentId;
} }
@ -120,14 +138,6 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser
this.agentId = agentId; this.agentId = agentId;
} }
public Long getCouponCodeId() {
return couponCodeId;
}
public void setCouponCodeId(Long couponCodeId) {
this.couponCodeId = couponCodeId;
}
public Long getCouponAgentRecordId() { public Long getCouponAgentRecordId() {
return couponAgentRecordId; return couponAgentRecordId;
} }
@ -136,6 +146,22 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser
this.couponAgentRecordId = couponAgentRecordId; this.couponAgentRecordId = couponAgentRecordId;
} }
public String getConvertCode() {
return convertCode;
}
public void setConvertCode(String convertCode) {
this.convertCode = convertCode;
}
public Long getCouponCodeId() {
return couponCodeId;
}
public void setCouponCodeId(Long couponCodeId) {
this.couponCodeId = couponCodeId;
}
public String getCouponCode() { public String getCouponCode() {
return couponCode; return couponCode;
} }
@ -229,11 +255,13 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser
} }
HighCouponAgentCode other = (HighCouponAgentCode) that; HighCouponAgentCode other = (HighCouponAgentCode) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getCouponAgentId() == null ? other.getCouponAgentId() == null : this.getCouponAgentId().equals(other.getCouponAgentId())) && (this.getCouponAgentId() == null ? other.getCouponAgentId() == null : this.getCouponAgentId().equals(other.getCouponAgentId()))
&& (this.getCouponId() == null ? other.getCouponId() == null : this.getCouponId().equals(other.getCouponId())) && (this.getCouponId() == null ? other.getCouponId() == null : this.getCouponId().equals(other.getCouponId()))
&& (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId())) && (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId()))
&& (this.getCouponCodeId() == null ? other.getCouponCodeId() == null : this.getCouponCodeId().equals(other.getCouponCodeId()))
&& (this.getCouponAgentRecordId() == null ? other.getCouponAgentRecordId() == null : this.getCouponAgentRecordId().equals(other.getCouponAgentRecordId())) && (this.getCouponAgentRecordId() == null ? other.getCouponAgentRecordId() == null : this.getCouponAgentRecordId().equals(other.getCouponAgentRecordId()))
&& (this.getConvertCode() == null ? other.getConvertCode() == null : this.getConvertCode().equals(other.getConvertCode()))
&& (this.getCouponCodeId() == null ? other.getCouponCodeId() == null : this.getCouponCodeId().equals(other.getCouponCodeId()))
&& (this.getCouponCode() == null ? other.getCouponCode() == null : this.getCouponCode().equals(other.getCouponCode())) && (this.getCouponCode() == null ? other.getCouponCode() == null : this.getCouponCode().equals(other.getCouponCode()))
&& (this.getQrCode() == null ? other.getQrCode() == null : this.getQrCode().equals(other.getQrCode())) && (this.getQrCode() == null ? other.getQrCode() == null : this.getQrCode().equals(other.getQrCode()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
@ -251,11 +279,13 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getCouponAgentId() == null) ? 0 : getCouponAgentId().hashCode()); result = prime * result + ((getCouponAgentId() == null) ? 0 : getCouponAgentId().hashCode());
result = prime * result + ((getCouponId() == null) ? 0 : getCouponId().hashCode()); result = prime * result + ((getCouponId() == null) ? 0 : getCouponId().hashCode());
result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode()); result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode());
result = prime * result + ((getCouponCodeId() == null) ? 0 : getCouponCodeId().hashCode());
result = prime * result + ((getCouponAgentRecordId() == null) ? 0 : getCouponAgentRecordId().hashCode()); result = prime * result + ((getCouponAgentRecordId() == null) ? 0 : getCouponAgentRecordId().hashCode());
result = prime * result + ((getConvertCode() == null) ? 0 : getConvertCode().hashCode());
result = prime * result + ((getCouponCodeId() == null) ? 0 : getCouponCodeId().hashCode());
result = prime * result + ((getCouponCode() == null) ? 0 : getCouponCode().hashCode()); result = prime * result + ((getCouponCode() == null) ? 0 : getCouponCode().hashCode());
result = prime * result + ((getQrCode() == null) ? 0 : getQrCode().hashCode()); result = prime * result + ((getQrCode() == null) ? 0 : getQrCode().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
@ -276,11 +306,13 @@ public class HighCouponAgentCode extends HighCouponAgentCodeModel implements Ser
sb.append(" ["); sb.append(" [");
sb.append("Hash = ").append(hashCode()); sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", type=").append(type);
sb.append(", couponAgentId=").append(couponAgentId); sb.append(", couponAgentId=").append(couponAgentId);
sb.append(", couponId=").append(couponId); sb.append(", couponId=").append(couponId);
sb.append(", agentId=").append(agentId); sb.append(", agentId=").append(agentId);
sb.append(", couponCodeId=").append(couponCodeId);
sb.append(", couponAgentRecordId=").append(couponAgentRecordId); sb.append(", couponAgentRecordId=").append(couponAgentRecordId);
sb.append(", convertCode=").append(convertCode);
sb.append(", couponCodeId=").append(couponCodeId);
sb.append(", couponCode=").append(couponCode); sb.append(", couponCode=").append(couponCode);
sb.append(", qrCode=").append(qrCode); sb.append(", qrCode=").append(qrCode);
sb.append(", status=").append(status); sb.append(", status=").append(status);

@ -185,6 +185,66 @@ public class HighCouponAgentCodeExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andCouponAgentIdIsNull() { public Criteria andCouponAgentIdIsNull() {
addCriterion("coupon_agent_id is null"); addCriterion("coupon_agent_id is null");
return (Criteria) this; return (Criteria) this;
@ -365,123 +425,193 @@ public class HighCouponAgentCodeExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponCodeIdIsNull() { public Criteria andCouponAgentRecordIdIsNull() {
addCriterion("coupon_code_id is null"); addCriterion("coupon_agent_record_id is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponCodeIdIsNotNull() { public Criteria andCouponAgentRecordIdIsNotNull() {
addCriterion("coupon_code_id is not null"); addCriterion("coupon_agent_record_id is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponCodeIdEqualTo(Long value) { public Criteria andCouponAgentRecordIdEqualTo(Long value) {
addCriterion("coupon_code_id =", value, "couponCodeId"); addCriterion("coupon_agent_record_id =", value, "couponAgentRecordId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponCodeIdNotEqualTo(Long value) { public Criteria andCouponAgentRecordIdNotEqualTo(Long value) {
addCriterion("coupon_code_id <>", value, "couponCodeId"); addCriterion("coupon_agent_record_id <>", value, "couponAgentRecordId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponCodeIdGreaterThan(Long value) { public Criteria andCouponAgentRecordIdGreaterThan(Long value) {
addCriterion("coupon_code_id >", value, "couponCodeId"); addCriterion("coupon_agent_record_id >", value, "couponAgentRecordId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponCodeIdGreaterThanOrEqualTo(Long value) { public Criteria andCouponAgentRecordIdGreaterThanOrEqualTo(Long value) {
addCriterion("coupon_code_id >=", value, "couponCodeId"); addCriterion("coupon_agent_record_id >=", value, "couponAgentRecordId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponCodeIdLessThan(Long value) { public Criteria andCouponAgentRecordIdLessThan(Long value) {
addCriterion("coupon_code_id <", value, "couponCodeId"); addCriterion("coupon_agent_record_id <", value, "couponAgentRecordId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponCodeIdLessThanOrEqualTo(Long value) { public Criteria andCouponAgentRecordIdLessThanOrEqualTo(Long value) {
addCriterion("coupon_code_id <=", value, "couponCodeId"); addCriterion("coupon_agent_record_id <=", value, "couponAgentRecordId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponCodeIdIn(List<Long> values) { public Criteria andCouponAgentRecordIdIn(List<Long> values) {
addCriterion("coupon_code_id in", values, "couponCodeId"); addCriterion("coupon_agent_record_id in", values, "couponAgentRecordId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponCodeIdNotIn(List<Long> values) { public Criteria andCouponAgentRecordIdNotIn(List<Long> values) {
addCriterion("coupon_code_id not in", values, "couponCodeId"); addCriterion("coupon_agent_record_id not in", values, "couponAgentRecordId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponCodeIdBetween(Long value1, Long value2) { public Criteria andCouponAgentRecordIdBetween(Long value1, Long value2) {
addCriterion("coupon_code_id between", value1, value2, "couponCodeId"); addCriterion("coupon_agent_record_id between", value1, value2, "couponAgentRecordId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponCodeIdNotBetween(Long value1, Long value2) { public Criteria andCouponAgentRecordIdNotBetween(Long value1, Long value2) {
addCriterion("coupon_code_id not between", value1, value2, "couponCodeId"); addCriterion("coupon_agent_record_id not between", value1, value2, "couponAgentRecordId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponAgentRecordIdIsNull() { public Criteria andConvertCodeIsNull() {
addCriterion("coupon_agent_record_id is null"); addCriterion("convert_code is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponAgentRecordIdIsNotNull() { public Criteria andConvertCodeIsNotNull() {
addCriterion("coupon_agent_record_id is not null"); addCriterion("convert_code is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponAgentRecordIdEqualTo(Long value) { public Criteria andConvertCodeEqualTo(String value) {
addCriterion("coupon_agent_record_id =", value, "couponAgentRecordId"); addCriterion("convert_code =", value, "convertCode");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponAgentRecordIdNotEqualTo(Long value) { public Criteria andConvertCodeNotEqualTo(String value) {
addCriterion("coupon_agent_record_id <>", value, "couponAgentRecordId"); addCriterion("convert_code <>", value, "convertCode");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponAgentRecordIdGreaterThan(Long value) { public Criteria andConvertCodeGreaterThan(String value) {
addCriterion("coupon_agent_record_id >", value, "couponAgentRecordId"); addCriterion("convert_code >", value, "convertCode");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponAgentRecordIdGreaterThanOrEqualTo(Long value) { public Criteria andConvertCodeGreaterThanOrEqualTo(String value) {
addCriterion("coupon_agent_record_id >=", value, "couponAgentRecordId"); addCriterion("convert_code >=", value, "convertCode");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponAgentRecordIdLessThan(Long value) { public Criteria andConvertCodeLessThan(String value) {
addCriterion("coupon_agent_record_id <", value, "couponAgentRecordId"); addCriterion("convert_code <", value, "convertCode");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponAgentRecordIdLessThanOrEqualTo(Long value) { public Criteria andConvertCodeLessThanOrEqualTo(String value) {
addCriterion("coupon_agent_record_id <=", value, "couponAgentRecordId"); addCriterion("convert_code <=", value, "convertCode");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponAgentRecordIdIn(List<Long> values) { public Criteria andConvertCodeLike(String value) {
addCriterion("coupon_agent_record_id in", values, "couponAgentRecordId"); addCriterion("convert_code like", value, "convertCode");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponAgentRecordIdNotIn(List<Long> values) { public Criteria andConvertCodeNotLike(String value) {
addCriterion("coupon_agent_record_id not in", values, "couponAgentRecordId"); addCriterion("convert_code not like", value, "convertCode");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponAgentRecordIdBetween(Long value1, Long value2) { public Criteria andConvertCodeIn(List<String> values) {
addCriterion("coupon_agent_record_id between", value1, value2, "couponAgentRecordId"); addCriterion("convert_code in", values, "convertCode");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCouponAgentRecordIdNotBetween(Long value1, Long value2) { public Criteria andConvertCodeNotIn(List<String> values) {
addCriterion("coupon_agent_record_id not between", value1, value2, "couponAgentRecordId"); addCriterion("convert_code not in", values, "convertCode");
return (Criteria) this;
}
public Criteria andConvertCodeBetween(String value1, String value2) {
addCriterion("convert_code between", value1, value2, "convertCode");
return (Criteria) this;
}
public Criteria andConvertCodeNotBetween(String value1, String value2) {
addCriterion("convert_code not between", value1, value2, "convertCode");
return (Criteria) this;
}
public Criteria andCouponCodeIdIsNull() {
addCriterion("coupon_code_id is null");
return (Criteria) this;
}
public Criteria andCouponCodeIdIsNotNull() {
addCriterion("coupon_code_id is not null");
return (Criteria) this;
}
public Criteria andCouponCodeIdEqualTo(Long value) {
addCriterion("coupon_code_id =", value, "couponCodeId");
return (Criteria) this;
}
public Criteria andCouponCodeIdNotEqualTo(Long value) {
addCriterion("coupon_code_id <>", value, "couponCodeId");
return (Criteria) this;
}
public Criteria andCouponCodeIdGreaterThan(Long value) {
addCriterion("coupon_code_id >", value, "couponCodeId");
return (Criteria) this;
}
public Criteria andCouponCodeIdGreaterThanOrEqualTo(Long value) {
addCriterion("coupon_code_id >=", value, "couponCodeId");
return (Criteria) this;
}
public Criteria andCouponCodeIdLessThan(Long value) {
addCriterion("coupon_code_id <", value, "couponCodeId");
return (Criteria) this;
}
public Criteria andCouponCodeIdLessThanOrEqualTo(Long value) {
addCriterion("coupon_code_id <=", value, "couponCodeId");
return (Criteria) this;
}
public Criteria andCouponCodeIdIn(List<Long> values) {
addCriterion("coupon_code_id in", values, "couponCodeId");
return (Criteria) this;
}
public Criteria andCouponCodeIdNotIn(List<Long> values) {
addCriterion("coupon_code_id not in", values, "couponCodeId");
return (Criteria) this;
}
public Criteria andCouponCodeIdBetween(Long value1, Long value2) {
addCriterion("coupon_code_id between", value1, value2, "couponCodeId");
return (Criteria) this;
}
public Criteria andCouponCodeIdNotBetween(Long value1, Long value2) {
addCriterion("coupon_code_id not between", value1, value2, "couponCodeId");
return (Criteria) this; return (Criteria) this;
} }

@ -21,6 +21,11 @@ public class HighCouponAgentRel extends HighCouponAgentRelModel implements Seria
*/ */
private Long id; private Long id;
/**
* 类型 1销售码 2兑换码
*/
private Integer type;
/** /**
* 卡券名称 * 卡券名称
*/ */
@ -87,6 +92,14 @@ public class HighCouponAgentRel extends HighCouponAgentRelModel implements Seria
this.id = id; this.id = id;
} }
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getCouponName() { public String getCouponName() {
return couponName; return couponName;
} }
@ -204,6 +217,7 @@ public class HighCouponAgentRel extends HighCouponAgentRelModel implements Seria
} }
HighCouponAgentRel other = (HighCouponAgentRel) that; HighCouponAgentRel other = (HighCouponAgentRel) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getCouponName() == null ? other.getCouponName() == null : this.getCouponName().equals(other.getCouponName())) && (this.getCouponName() == null ? other.getCouponName() == null : this.getCouponName().equals(other.getCouponName()))
&& (this.getSalesPrice() == null ? other.getSalesPrice() == null : this.getSalesPrice().equals(other.getSalesPrice())) && (this.getSalesPrice() == null ? other.getSalesPrice() == null : this.getSalesPrice().equals(other.getSalesPrice()))
&& (this.getCouponId() == null ? other.getCouponId() == null : this.getCouponId().equals(other.getCouponId())) && (this.getCouponId() == null ? other.getCouponId() == null : this.getCouponId().equals(other.getCouponId()))
@ -224,6 +238,7 @@ public class HighCouponAgentRel extends HighCouponAgentRelModel implements Seria
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getCouponName() == null) ? 0 : getCouponName().hashCode()); result = prime * result + ((getCouponName() == null) ? 0 : getCouponName().hashCode());
result = prime * result + ((getSalesPrice() == null) ? 0 : getSalesPrice().hashCode()); result = prime * result + ((getSalesPrice() == null) ? 0 : getSalesPrice().hashCode());
result = prime * result + ((getCouponId() == null) ? 0 : getCouponId().hashCode()); result = prime * result + ((getCouponId() == null) ? 0 : getCouponId().hashCode());
@ -247,6 +262,7 @@ public class HighCouponAgentRel extends HighCouponAgentRelModel implements Seria
sb.append(" ["); sb.append(" [");
sb.append("Hash = ").append(hashCode()); sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", type=").append(type);
sb.append(", couponName=").append(couponName); sb.append(", couponName=").append(couponName);
sb.append(", salesPrice=").append(salesPrice); sb.append(", salesPrice=").append(salesPrice);
sb.append(", couponId=").append(couponId); sb.append(", couponId=").append(couponId);

@ -186,6 +186,66 @@ public class HighCouponAgentRelExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andCouponNameIsNull() { public Criteria andCouponNameIsNull() {
addCriterion("coupon_name is null"); addCriterion("coupon_name is null");
return (Criteria) this; return (Criteria) this;

@ -3,6 +3,8 @@ package com.hai.model;
import com.hai.entity.HighAgent; import com.hai.entity.HighAgent;
import com.hai.entity.HighCoupon; import com.hai.entity.HighCoupon;
import java.math.BigDecimal;
/** /**
* @Auther: 胡锐 * @Auther: 胡锐
* @Description: * @Description:
@ -18,6 +20,18 @@ public class HighCouponAgentRelModel {
//代理商信息 //代理商信息
private HighAgent highAgent; private HighAgent highAgent;
// 未使用数量
private Integer noUsedNum;
// 未使用金额
private BigDecimal noUsedPrice;
// 使用数量
private Integer usedNum;
// 使用金额
private BigDecimal usedPrice;
public String getMerchantLogo() { public String getMerchantLogo() {
return merchantLogo; return merchantLogo;
} }
@ -41,4 +55,36 @@ public class HighCouponAgentRelModel {
public void setHighAgent(HighAgent highAgent) { public void setHighAgent(HighAgent highAgent) {
this.highAgent = highAgent; this.highAgent = highAgent;
} }
public Integer getNoUsedNum() {
return noUsedNum;
}
public void setNoUsedNum(Integer noUsedNum) {
this.noUsedNum = noUsedNum;
}
public BigDecimal getNoUsedPrice() {
return noUsedPrice;
}
public void setNoUsedPrice(BigDecimal noUsedPrice) {
this.noUsedPrice = noUsedPrice;
}
public Integer getUsedNum() {
return usedNum;
}
public void setUsedNum(Integer usedNum) {
this.usedNum = usedNum;
}
public BigDecimal getUsedPrice() {
return usedPrice;
}
public void setUsedPrice(BigDecimal usedPrice) {
this.usedPrice = usedPrice;
}
} }

@ -85,6 +85,19 @@ public interface CmsContentService {
*/ */
List<CmsContentModel> getListContent(Map<String, String> paramsMap) throws Exception; List<CmsContentModel> getListContent(Map<String, String> paramsMap) throws Exception;
/**
*
* @Title: getListContent
* @Description: 查询内容列表
* @author: gongjia
* @param: [paramsMap]
* @return: java.util.List<com.ncsmesc.entity.CmsContent>
* @throws
*/
List<CmsContentModel> getListContentByCrest(Map<String, String> paramsMap) throws Exception;
/** /**
* *
* @Title: getCorporateAdvertising * @Title: getCorporateAdvertising

@ -35,7 +35,7 @@ public interface HighCouponAgentService {
* @Description 根据卡券id和代理商id 查询 * @Description 根据卡券id和代理商id 查询
* @Date 2021/4/20 23:52 * @Date 2021/4/20 23:52
**/ **/
HighCouponAgentRel getRelByCouponAgent(Long couponId,Long agentId); HighCouponAgentRel getRelByCouponAgent(Long couponId,Long agentId, Integer type);
/** /**
* @Author 胡锐 * @Author 胡锐
@ -78,7 +78,9 @@ public interface HighCouponAgentService {
* @Description 根据代理商 查询销售统计 * @Description 根据代理商 查询销售统计
* @Date 2021/4/22 22:26 * @Date 2021/4/22 22:26
**/ **/
Map<String, Object> getSalesCountByAgent(Long agentId) throws Exception; Map<String, Object> getSalesCountByAgent(Long agentId, Integer type) throws Exception;
Map<String, Object> getConvertCodeCountByAgent(Long agentId);
/** /**
* *
@ -104,4 +106,25 @@ public interface HighCouponAgentService {
*/ */
List<HighCouponAgentCode> getAgentSalesCodeList(Long agentId,String consumeTimeS,String consumeTimeE); List<HighCouponAgentCode> getAgentSalesCodeList(Long agentId,String consumeTimeS,String consumeTimeE);
/**
* 生成兑换码
* @param couponAgentRelId
* @return
*/
String generateConvertCode(Long couponAgentRelId);
/**
* 查询兑换码
* @param convertCode
* @return
*/
HighCouponAgentCode getConvertCode(String convertCode);
/**
* 使用兑换码
* @param code
* @return
*/
Map<String, Object> useConvertCode(String code);
} }

@ -89,4 +89,14 @@ public interface HighDiscountPackageService {
*/ */
void addDiscountPackageStock(HighDiscountPackage highDiscountPackage, UserInfoModel userInfoModel , Integer num); void addDiscountPackageStock(HighDiscountPackage highDiscountPackage, UserInfoModel userInfoModel , Integer num);
/**
* @Author Sum1Dream
* @name freeUserDiscountPackage.java
* @Description // 赠送用户优惠券包内容
* @Date 3:09 下午 2021/12/24
* @Param [java.lang.Long]
* @return void
*/
void freeUserDiscountPackage(Map<String , Object> map) throws Exception;
} }

@ -40,4 +40,5 @@ public interface HighDiscountService {
**/ **/
List<HighDiscount> getDiscount(Map<String,Object> map); List<HighDiscount> getDiscount(Map<String,Object> map);
} }

@ -0,0 +1,33 @@
package com.hai.service;
/**
* @serviceName HltMerchantService.java
* @author Sum1Dream
* @version 1.0.0
* @Description // 测试接口
* @createTime 11:46 上午 2021/12/15
**/
public interface HighTestService {
/**
* @Author Sum1Dream
* @name getReadFile.java
* @Description //读取文件
* @Date 5:31 下午 2021/12/16
* @Param []
* @return void
*/
void getReadFile() throws Exception;
/**
* @Author Sum1Dream
* @name getUserDiscount.java
* @Description // 赠送用户卡券
* @Date 7:14 下午 2021/12/24
* @Param []
* @return void
*/
void getUserDiscount(Long id) throws Exception;
}

@ -178,6 +178,11 @@ public class CmsContentServiceImpl implements CmsContentService {
return cmsContentMapper.getListContent(paramsMap); return cmsContentMapper.getListContent(paramsMap);
} }
@Override
public List<CmsContentModel> getListContentByCrest(Map<String, String> paramsMap) throws Exception {
return cmsContentMapper.getListContentByCrest(paramsMap);
}
@Override @Override
public List<CmsContent> getCorporateAdvertising() { public List<CmsContent> getCorporateAdvertising() {
CmsContentExample example = new CmsContentExample(); CmsContentExample example = new CmsContentExample();

@ -1,6 +1,7 @@
package com.hai.service.impl; package com.hai.service.impl;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.hai.common.GenerateCode;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
@ -15,6 +16,7 @@ import com.hai.service.*;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
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.Isolation;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -54,13 +56,9 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
private HighAgentService highAgentService; private HighAgentService highAgentService;
@Override @Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void assignCouponAgent(HighCouponAgentRel highCouponAgentRel,Integer stockCount) { public void assignCouponAgent(HighCouponAgentRel highCouponAgentRel,Integer stockCount) {
// 查询未销售的卡券
List<HighCouponCode> codeList = highCouponCodeService.getNoSaleCode(highCouponAgentRel.getCouponId());
if (stockCount > codeList.size()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法分配,分配数量超过库存数量");
}
if (highCouponAgentRel.getId() != null) { if (highCouponAgentRel.getId() != null) {
highCouponAgentRelMapper.updateByPrimaryKey(highCouponAgentRel); highCouponAgentRelMapper.updateByPrimaryKey(highCouponAgentRel);
} else { } else {
@ -87,26 +85,52 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
record.setCreateTime(new Date()); record.setCreateTime(new Date());
highCouponAgentRecordMapper.insert(record); highCouponAgentRecordMapper.insert(record);
List<HighCouponCode> assignCouponCodeList = codeList.stream().limit(stockCount).collect(Collectors.toList()); if (highCouponAgentRel.getType() == 1) {
HighCouponAgentCode highCouponAgentCode; // 查询未销售的卡券
for (HighCouponCode code : assignCouponCodeList) { List<HighCouponCode> codeList = highCouponCodeService.getNoSaleCode(highCouponAgentRel.getCouponId());
code.setAgentId(highCouponAgentRel.getAgentId()); if (stockCount > codeList.size()) {
code.setIsAssignAgent(true); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法分配,分配数量超过库存数量");
highCouponCodeService.updateCouponCode(code); }
List<HighCouponCode> assignCouponCodeList = codeList.stream().limit(stockCount).collect(Collectors.toList());
highCouponAgentCode = new HighCouponAgentCode(); HighCouponAgentCode highCouponAgentCode;
highCouponAgentCode.setCouponAgentId(highCouponAgentRel.getId()); for (HighCouponCode code : assignCouponCodeList) {
highCouponAgentCode.setCouponAgentRecordId(record.getId()); code.setAgentId(highCouponAgentRel.getAgentId());
highCouponAgentCode.setCouponId(code.getCouponId()); code.setIsAssignAgent(true);
highCouponAgentCode.setAgentId(highCouponAgentRel.getAgentId()); highCouponCodeService.updateCouponCode(code);
highCouponAgentCode.setCouponCodeId(code.getId());
highCouponAgentCode.setCouponCode(code.getSalesCode()); highCouponAgentCode = new HighCouponAgentCode();
highCouponAgentCode.setQrCode(code.getExt1()); highCouponAgentCode.setType(highCouponAgentRel.getType());
highCouponAgentCode.setStatus(1); highCouponAgentCode.setCouponAgentId(highCouponAgentRel.getId());
highCouponAgentCode.setCreateTime(new Date()); highCouponAgentCode.setCouponAgentRecordId(record.getId());
highCouponAgentCode.setOperatorId(highCouponAgentRel.getOperatorId()); highCouponAgentCode.setCouponId(code.getCouponId());
highCouponAgentCode.setOperatorName(highCouponAgentRel.getOperatorName()); highCouponAgentCode.setAgentId(highCouponAgentRel.getAgentId());
highCouponAgentCodeMapper.insert(highCouponAgentCode); highCouponAgentCode.setCouponCodeId(code.getId());
highCouponAgentCode.setCouponCode(code.getSalesCode());
highCouponAgentCode.setQrCode(code.getExt1());
highCouponAgentCode.setStatus(1);
highCouponAgentCode.setCreateTime(new Date());
highCouponAgentCode.setOperatorId(highCouponAgentRel.getOperatorId());
highCouponAgentCode.setOperatorName(highCouponAgentRel.getOperatorName());
highCouponAgentCodeMapper.insert(highCouponAgentCode);
}
}
if (highCouponAgentRel.getType() == 2) {
HighCouponAgentCode highCouponAgentCode;
for (int i = 0; i < stockCount; i++) {
highCouponAgentCode = new HighCouponAgentCode();
highCouponAgentCode.setType(highCouponAgentRel.getType());
highCouponAgentCode.setCouponAgentId(highCouponAgentRel.getId());
highCouponAgentCode.setCouponAgentRecordId(record.getId());
highCouponAgentCode.setCouponId(highCoupon.getId());
highCouponAgentCode.setAgentId(highCouponAgentRel.getAgentId());
highCouponAgentCode.setConvertCode(generateConvertCode(highCouponAgentRel.getId()));
highCouponAgentCode.setStatus(1);
highCouponAgentCode.setCreateTime(new Date());
highCouponAgentCode.setOperatorId(highCouponAgentRel.getOperatorId());
highCouponAgentCode.setOperatorName(highCouponAgentRel.getOperatorName());
highCouponAgentCodeMapper.insert(highCouponAgentCode);
}
} }
} }
@ -116,9 +140,9 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
} }
@Override @Override
public HighCouponAgentRel getRelByCouponAgent(Long couponId, Long agentId) { public HighCouponAgentRel getRelByCouponAgent(Long couponId, Long agentId,Integer type) {
HighCouponAgentRelExample example = new HighCouponAgentRelExample(); HighCouponAgentRelExample example = new HighCouponAgentRelExample();
example.createCriteria().andCouponIdEqualTo(couponId).andAgentIdEqualTo(agentId); example.createCriteria().andCouponIdEqualTo(couponId).andAgentIdEqualTo(agentId).andTypeEqualTo(type);
List<HighCouponAgentRel> list = highCouponAgentRelMapper.selectByExample(example); List<HighCouponAgentRel> list = highCouponAgentRelMapper.selectByExample(example);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
return list.get(0); return list.get(0);
@ -131,6 +155,10 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
HighCouponAgentRelExample example = new HighCouponAgentRelExample(); HighCouponAgentRelExample example = new HighCouponAgentRelExample();
HighCouponAgentRelExample.Criteria criteria = example.createCriteria(); HighCouponAgentRelExample.Criteria criteria = example.createCriteria();
if (MapUtils.getInteger(map, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type"));
}
if (MapUtils.getLong(map, "couponId") != null) { if (MapUtils.getLong(map, "couponId") != null) {
criteria.andCouponIdEqualTo(MapUtils.getLong(map, "couponId")); criteria.andCouponIdEqualTo(MapUtils.getLong(map, "couponId"));
} }
@ -153,6 +181,10 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
criteria.andCouponAgentIdEqualTo(MapUtils.getLong(map, "couponAgentId")); criteria.andCouponAgentIdEqualTo(MapUtils.getLong(map, "couponAgentId"));
} }
if (MapUtils.getInteger(map, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type"));
}
if (MapUtils.getLong(map, "couponId") != null) { if (MapUtils.getLong(map, "couponId") != null) {
criteria.andCouponIdEqualTo(MapUtils.getLong(map, "couponId")); criteria.andCouponIdEqualTo(MapUtils.getLong(map, "couponId"));
} }
@ -213,15 +245,19 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
couponAgentCode.setRemark(remark); couponAgentCode.setRemark(remark);
highCouponAgentCodeMapper.updateByPrimaryKey(couponAgentCode); highCouponAgentCodeMapper.updateByPrimaryKey(couponAgentCode);
HighCouponAgentRel couponAgent = getRelByCouponAgent(couponAgentCode.getCouponId(), couponAgentCode.getAgentId()); HighCouponAgentRel couponAgent = getRelByCouponAgent(couponAgentCode.getCouponId(), couponAgentCode.getAgentId(), couponAgentCode.getType());
couponAgent.setStockCount(couponAgent.getStockCount() - 1); couponAgent.setStockCount(couponAgent.getStockCount() - 1);
couponAgent.setSalesCount(couponAgent.getSalesCount() + 1); couponAgent.setSalesCount(couponAgent.getSalesCount() + 1);
highCouponAgentRelMapper.updateByPrimaryKey(couponAgent); highCouponAgentRelMapper.updateByPrimaryKey(couponAgent);
HighCouponCode couponCode = highCouponCodeService.getCouponCodeById(couponAgentCode.getCouponCodeId());
couponCode.setStatus(2); HighCouponCode couponCode = null;
couponCode.setReceiveTime(new Date()); if (couponAgentCode.getType() == 1) {
highCouponCodeService.updateCouponCode(couponCode); couponCode = highCouponCodeService.getCouponCodeById(couponAgentCode.getCouponCodeId());
couponCode.setStatus(2);
couponCode.setReceiveTime(new Date());
highCouponCodeService.updateCouponCode(couponCode);
}
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("couponInfo", highCouponService.getCouponById(couponAgentCode.getCouponId())); map.put("couponInfo", highCouponService.getCouponById(couponAgentCode.getCouponId()));
@ -231,12 +267,13 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
} }
@Override @Override
public Map<String, Object> getSalesCountByAgent(Long agentId) throws Exception { public Map<String, Object> getSalesCountByAgent(Long agentId, Integer type) throws Exception {
BigDecimal surplusCountPrice = new BigDecimal("0"); BigDecimal surplusCountPrice = new BigDecimal("0");
BigDecimal salesCountPrice = new BigDecimal("0"); BigDecimal salesCountPrice = new BigDecimal("0");
Map<String,Object> listMap = new HashMap<>(); Map<String,Object> listMap = new HashMap<>();
listMap.put("agentId", agentId); listMap.put("agentId", agentId);
listMap.put("type", type);
List<HighCouponAgentRel> list = getCouponAgentList(listMap).stream().sorted(Comparator.comparing(HighCouponAgentRel::getSalesPrice)).collect(Collectors.toList()); List<HighCouponAgentRel> list = getCouponAgentList(listMap).stream().sorted(Comparator.comparing(HighCouponAgentRel::getSalesPrice)).collect(Collectors.toList());
for (HighCouponAgentRel highCouponAgentRel : list) { for (HighCouponAgentRel highCouponAgentRel : list) {
BigDecimal surplusPrice = new BigDecimal(highCouponAgentRel.getStockCount()).multiply((highCouponAgentRel.getSalesPrice())); BigDecimal surplusPrice = new BigDecimal(highCouponAgentRel.getStockCount()).multiply((highCouponAgentRel.getSalesPrice()));
@ -246,7 +283,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
salesCountPrice = salesCountPrice.add(salesPrice); salesCountPrice = salesCountPrice.add(salesPrice);
} }
// 计算使用有效期 // 当前日时间
Calendar consumeTimeS = Calendar.getInstance(); Calendar consumeTimeS = Calendar.getInstance();
consumeTimeS.setTime(new Date()); consumeTimeS.setTime(new Date());
consumeTimeS.set(Calendar.HOUR_OF_DAY, 00); consumeTimeS.set(Calendar.HOUR_OF_DAY, 00);
@ -265,8 +302,8 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
returnMap.put("orderCount", agentSales.getCount()); returnMap.put("orderCount", agentSales.getCount());
returnMap.put("turnoverPrice", agentSales.getSalesCountPrice()); returnMap.put("turnoverPrice", agentSales.getSalesCountPrice());
returnMap.put("laveStockCount", highCouponAgentRelMapper.getAgentCodeCount(agentId, "1")); // 库存数量 returnMap.put("laveStockCount", highCouponAgentRelMapper.getAgentCodeCount(agentId, "1", type)); // 库存数量
returnMap.put("soldCount", highCouponAgentRelMapper.getAgentCodeCount(agentId, "2,3")); // 销售数量 returnMap.put("soldCount", highCouponAgentRelMapper.getAgentCodeCount(agentId, "2,3", type)); // 销售数量
returnMap.put("surplusCountPrice", surplusCountPrice); // 剩余总额 returnMap.put("surplusCountPrice", surplusCountPrice); // 剩余总额
returnMap.put("salesCountPrice", salesCountPrice); // 销售总额 returnMap.put("salesCountPrice", salesCountPrice); // 销售总额
@ -274,6 +311,43 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
return returnMap; return returnMap;
} }
@Override
public Map<String, Object> getConvertCodeCountByAgent(Long agentId) {
Map<String,Object> listMap = new HashMap<>();
listMap.put("agentId", agentId);
listMap.put("type", 2);
List<HighCouponAgentRel> list = getCouponAgentList(listMap).stream().sorted(Comparator.comparing(HighCouponAgentRel::getSalesPrice)).collect(Collectors.toList());
for (HighCouponAgentRel couponAgentRel : list) {
Map<String, Object> map = highCouponAgentRelMapper.getUseNum(couponAgentRel.getId());
couponAgentRel.setUsedNum(MapUtils.getInteger(map, "usedNum"));
couponAgentRel.setUsedPrice(new BigDecimal(MapUtils.getString(map, "usedPrice")));
couponAgentRel.setNoUsedNum(MapUtils.getInteger(map, "noUsedNum"));
couponAgentRel.setNoUsedPrice(new BigDecimal(MapUtils.getString(map, "noUsedPrice")));
}
Map<String, Object> returnMap = new HashMap<>();
returnMap.put("list", list);
// 待销售
returnMap.put("noSalesNum", highCouponAgentRelMapper.getAgentCodeCount(agentId, "1", 2));
returnMap.put("noSalesPrice", highCouponAgentRelMapper.getAgentCodePrice(agentId, "1", 2));
// 已销售
returnMap.put("salesNum", highCouponAgentRelMapper.getAgentCodeCount(agentId, "2", 2));
returnMap.put("salesPrice", highCouponAgentRelMapper.getAgentCodePrice(agentId, "2", 2));
// 待使用
returnMap.put("noUsedNum", highCouponAgentRelMapper.getAgentCodeCount(agentId, "2", 2));
returnMap.put("noUsedPrice", highCouponAgentRelMapper.getAgentCodePrice(agentId, "2", 2));
// 已使用
returnMap.put("usedNum", highCouponAgentRelMapper.getAgentCodeCount(agentId, "3", 2));
returnMap.put("usedPrice", highCouponAgentRelMapper.getAgentCodePrice(agentId, "3", 2));
return returnMap;
}
@Override @Override
public List<HighCouponAgentRecord> getRecordList(Map<String, Object> map) { public List<HighCouponAgentRecord> getRecordList(Map<String, Object> map) {
HighCouponAgentRecordExample example = new HighCouponAgentRecordExample(); HighCouponAgentRecordExample example = new HighCouponAgentRecordExample();
@ -312,4 +386,65 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
} }
return new ArrayList<>(); return new ArrayList<>();
} }
@Override
public String generateConvertCode(Long couponAgentRelId) {
// 生成兑换码
String code = GenerateCode.convertCode(couponAgentRelId);
if (getConvertCode(code) != null){
return generateConvertCode(couponAgentRelId);
}
return code;
}
@Override
public HighCouponAgentCode getConvertCode(String convertCode) {
HighCouponAgentCodeExample example = new HighCouponAgentCodeExample();
example.createCriteria().andConvertCodeEqualTo(convertCode);
List<HighCouponAgentCode> list = highCouponAgentCodeMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW,isolation= Isolation.SERIALIZABLE)
public Map<String, Object> useConvertCode(String code) {
// 查询兑换码
HighCouponAgentCode convertCode = getConvertCode(code);
if (convertCode == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无效的兑换码");
}
if (convertCode.getStatus() == 3) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "兑换码已被使用");
}
if (convertCode.getCouponCodeId() != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "兑换码已被使用");
}
// 查询未销售的卡券
List<HighCouponCode> codeList = highCouponCodeService.getNoSaleCode(convertCode.getCouponId());
if (codeList.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法使用兑换码");
}
HighCouponCode couponCode = codeList.get(0);
couponCode.setIsAssignAgent(true);
couponCode.setAgentId(couponCode.getAgentId());
couponCode.setReceiveTime(new Date());
couponCode.setStatus(2);
highCouponCodeService.updateCouponCode(couponCode);
convertCode.setCouponCodeId(couponCode.getId());
convertCode.setCouponCode(couponCode.getSalesCode());
convertCode.setQrCode(couponCode.getExt1());
convertCode.setStatus(3);
highCouponAgentCodeMapper.updateByPrimaryKey(convertCode);
// 查询卡券销售码
Map<String, Object> map = new HashMap<>();
map.put("couponInfo", highCouponService.getCouponById(convertCode.getCouponId()));
map.put("couponCode", highCouponCodeService.getCouponCodeById(convertCode.getCouponCodeId()));
map.put("couponAgentCode", convertCode);
return map;
}
} }

@ -3,12 +3,16 @@ package com.hai.service.impl;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.RedisUtil;
import com.hai.dao.*; import com.hai.dao.*;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.model.UserInfoModel; import com.hai.model.UserInfoModel;
import com.hai.service.*; import com.hai.service.*;
import com.hai.service.HighDiscountPackageService; import com.hai.service.HighDiscountPackageService;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
@ -52,6 +56,28 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
@Resource @Resource
private HighDiscountInventoryRecordMapper discountInventoryRecordMapper; private HighDiscountInventoryRecordMapper discountInventoryRecordMapper;
@Resource
private HighUserService highUserService;
@Resource
private HighDiscountPackageService highDiscountPackageService;
@Resource
private HighDiscountUserRelMapper highDiscountUserRelMapper;
@Resource
private HighDiscountService highDiscountService;
@Resource
private HighDiscountPackageActualService discountPackageActualService;
@Resource
private HighDiscountPackageDiscountActualService discountPackageDiscountActualService;
@Autowired
private RedisUtil redisUtil;
@Override @Override
public List<HighDiscountPackage> getDiscountPackageList(Map<String, Object> map) { public List<HighDiscountPackage> getDiscountPackageList(Map<String, Object> map) {
@ -223,4 +249,75 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
highDiscountPackageMapper.updateByPrimaryKey(highDiscountPackage); highDiscountPackageMapper.updateByPrimaryKey(highDiscountPackage);
} }
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void freeUserDiscountPackage(Map<String , Object> map) throws Exception {
HighDiscountPackage highDiscountPackage = highDiscountPackageService.findDiscountPackageById(MapUtils.getInteger(map , "discountPackageId"));
// 查询优惠券包实际库存
HighDiscountPackageActual discountPackageActual = discountPackageActualService.getHighDiscountPackageActualList(highDiscountPackage.getId()).get(0);
// 修改优惠券包实际库存为已使用
discountPackageActual.setStatus(0);
discountPackageActual.setUserId(MapUtils.getInteger(map , "userId"));
discountPackageActual.setAllocationTime(new Date());
discountPackageActualService.updateHighDiscountPackageActual(discountPackageActual);
// 查询优惠券包实际库存中实际优惠券数量
List<HighDiscountPackageDiscountActual> discountPackageDiscountActual = discountPackageDiscountActualService.getHighDiscountPackageDiscountActualList(discountPackageActual.getId());
// 循环赠送优惠券
for (HighDiscountPackageDiscountActual actualList: discountPackageDiscountActual) {
HighDiscountUserRel highDiscountUserRel = new HighDiscountUserRel();
highDiscountUserRel.setDiscountId(actualList.getDiscountId());
highDiscountUserRel.setUserId(MapUtils.getLong(map , "userId"));
highDiscountUserRel.setAgentId(actualList.getAgentId());
highDiscountUserRel.setDiscountAgentCodeId(actualList.getAgentDiscountCodeId());
highDiscountUserRel.setStatus(1);
highDiscountUserRel.setCreateTime(new Date());
HighDiscount highDiscount = highDiscountService.getDiscountById(actualList.getDiscountId());
// 计算使用有效期
Calendar userEndTime = Calendar.getInstance();
userEndTime.setTime(new Date());
userEndTime.set(Calendar.HOUR_OF_DAY, 23);
userEndTime.set(Calendar.MINUTE, 59);
userEndTime.set(Calendar.SECOND, 59);
userEndTime.add(Calendar.DATE, highDiscount.getEffectiveDay());
highDiscountUserRel.setUseEndTime(userEndTime.getTime());
HighDiscountAgentCode discountAgentCode = highDiscountAgentCodeService.getCodeById(actualList.getAgentDiscountCodeId());
// 修改优惠券二维码状态
discountAgentCode.setStatus(2);
highDiscountAgentCodeService.updateCode(discountAgentCode);
// 新增优惠券与用户的绑定关系
highDiscountUserRelMapper.insert(highDiscountUserRel);
// 修改优惠券包实际库存实际优惠券状态
actualList.setStatus(0);
discountPackageDiscountActualService.updateHighDiscountPackageDiscountActual(actualList);
}
// 增加赠送记录
HighDiscountPackageRecord discountPackageRecord = new HighDiscountPackageRecord();
discountPackageRecord.setDiscountPackageId(highDiscountPackage.getId());
discountPackageRecord.setDiscountPackageTitle(highDiscountPackage.getTitle());
discountPackageRecord.setCompanyId(highDiscountPackage.getCompanyId());
discountPackageRecord.setStatus(1);
discountPackageRecord.setUsingAttribution(1);
discountPackageRecord.setRecordNo("DP" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5) );
discountPackageRecord.setSalesType(2);
discountPackageRecord.setUserId(MapUtils.getInteger(map , "userId"));
discountPackageRecord.setExt1(MapUtils.getString(map , "userPhone"));
discountPackageRecord.setCreatedTime(new Date());
highDiscountPackageRecordMapper.insert(discountPackageRecord);
}
} }

@ -210,7 +210,7 @@ public class HighOrderServiceImpl implements HighOrderService {
HighUser highUser = highUserService.findByUserId(highOrder.getMemId()); HighUser highUser = highUserService.findByUserId(highOrder.getMemId());
// 金币 1:100 // 金币 1:100
Integer goldNum = new BigDecimal(highOrder.getTotalPrice().toString()).multiply(new BigDecimal("100")).intValue(); Integer goldNum = new BigDecimal(highOrder.getPayPrice().toString()).multiply(new BigDecimal("100")).intValue();
highUserService.goldHandle(userId, goldNum, 2, 2, highOrder.getId()); highUserService.goldHandle(userId, goldNum, 2, 2, highOrder.getId());
highOrder.setPayTime(new Date()); // 支付时间 highOrder.setPayTime(new Date()); // 支付时间

@ -0,0 +1,136 @@
package com.hai.service.impl;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.RedisUtil;
import com.hai.dao.HighUserEtcMapper;
import com.hai.entity.HighDiscountAgentCode;
import com.hai.entity.HighUser;
import com.hai.entity.HighUserEtc;
import com.hai.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("highTestService")
public class HighTestServiceImpl implements HighTestService {
private static Logger log = LoggerFactory.getLogger(HighTestService.class);
@Resource
private HighUserService highUserService;
@Resource
private HighUserEtcMapper highUserEtcMapper;
@Resource
private HighDiscountAgentCodeService highDiscountAgentCodeService;
@Resource
private HighDiscountUserRelService highDiscountUserRelService;
@Autowired
private RedisUtil redisUtil;
@Override
@Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW)
public void getReadFile() throws Exception {
// BufferedReader bufferedReader = null;
//
// Map<String , String> mapUser = new HashMap<>();
//
// //cookie过期时间为7天
// int EXPIRE = 3600*24*7;
//
// List<HighUser> highUsers = highUserService.getListUser(mapUser);
//
// for (HighUser user: highUsers) {
// redisUtil.set(user.getPhone(), user.getPhone(), EXPIRE);
// }
//
// FileReader fileReader = new FileReader("/home/project/hsg/readFile/etccq.txt");
// if (fileReader == null) {
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "读取空数据");
// }
//
// bufferedReader = new BufferedReader(fileReader);
// String temp = bufferedReader.readLine();
// int i = 0;
// while (temp != null) {
// i++;
// String[] arr = temp.split(";");
//
// String phone = (String) redisUtil.get(arr[3]);
//
// if (phone == null || highUsers.size() == 0) {
// HighUser user = new HighUser();
//
// user.setStatus(1);
// user.setInfoCompleteStatus(1);
// user.setGold(0);
// user.setRegTime(new Date());
// user.setName(arr[2]);
// user.setPhone(arr[3]);
// user.setExt4("1");
//
// highUserService.insertUser(user);
//
// HighUserEtc userEtc = new HighUserEtc();
//
// userEtc.setCreateTime(new Date());
// userEtc.setStatus(1);
// userEtc.setUserId(user.getId());
// userEtc.setCustomerName(arr[2]);
// userEtc.setCustomerTel(arr[3]);
// userEtc.setVehicleId(arr[0]);
// userEtc.setVehiclePlate(arr[1]);
//
// highUserEtcMapper.insert(userEtc);
//
//// Map<String , Object> map = new HashMap<>();
//// map.put("userId" , user.getId());
//// map.put("userPhone" , user.getPhone());
//// map.put("discountPackageId" , 48);
//
//// highDiscountPackageService.freeUserDiscountPackage(map);
// }
//
// temp = bufferedReader.readLine();
// }
}
@Override
@Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW)
public void getUserDiscount(Long id) throws Exception{
List<HighDiscountAgentCode> codeList = highDiscountAgentCodeService.getDiscountCodeByStatus(id , 1);
Map<String , String> map = new HashMap<>();
map.put("ext4" , "1");
List<HighUser> userList = highUserService.getListUser(map);
int num = 0;
for (HighUser user : userList) {
// 领取优惠券
highDiscountUserRelService.receiveDiscount(user.getId(), codeList.get(num).getId());
num++;
}
}
}

@ -65,6 +65,9 @@ public class HighUserServiceImpl implements HighUserService {
if (StringUtils.isNotBlank(map.get("status"))) { if (StringUtils.isNotBlank(map.get("status"))) {
criteria.andStatusEqualTo(Integer.valueOf(map.get("status"))); criteria.andStatusEqualTo(Integer.valueOf(map.get("status")));
} }
if (StringUtils.isNotBlank(map.get("ext4"))) {
criteria.andExt4EqualTo(String.valueOf(map.get("ext4")));
}
if (StringUtils.isNotBlank(map.get("regTimeStart")) && StringUtils.isNotBlank(map.get("regTimeEnd"))) { if (StringUtils.isNotBlank(map.get("regTimeStart")) && StringUtils.isNotBlank(map.get("regTimeEnd"))) {
criteria.andRegTimeBetween( criteria.andRegTimeBetween(
DateUtil.format(map.get("regTimeStart") , "yyyy-MM-dd HH:mm:ss") , DateUtil.format(map.get("regTimeStart") , "yyyy-MM-dd HH:mm:ss") ,

@ -116,8 +116,6 @@ public class HltUnionCardVipServiceImpl implements HltUnionCardVipService {
HighDiscountPackage highDiscountPackage = highDiscountPackages.get(0); HighDiscountPackage highDiscountPackage = highDiscountPackages.get(0);
highDiscountPackageService.updateDiscountPackage(highDiscountPackage);
// 查询优惠券包实际库存 // 查询优惠券包实际库存
HighDiscountPackageActual discountPackageActual = discountPackageActualService.getHighDiscountPackageActualList(highDiscountPackage.getId()).get(0); HighDiscountPackageActual discountPackageActual = discountPackageActualService.getHighDiscountPackageActualList(highDiscountPackage.getId()).get(0);

@ -46,6 +46,9 @@ public class OutRechargePriceServiceImpl implements OutRechargePriceService {
if (StringUtils.isNotBlank(map.get("type"))) { if (StringUtils.isNotBlank(map.get("type"))) {
criteria.andTypeEqualTo(Integer.valueOf(map.get("type"))); criteria.andTypeEqualTo(Integer.valueOf(map.get("type")));
} }
if (StringUtils.isNotBlank(map.get("showType"))) {
criteria.andShowTypeEqualTo(Integer.valueOf(map.get("showType")));
}
if (StringUtils.isNotBlank(map.get("companyId"))) { if (StringUtils.isNotBlank(map.get("companyId"))) {
criteria.andCompanyIdEqualTo(Long.valueOf(map.get("companyId"))); criteria.andCompanyIdEqualTo(Long.valueOf(map.get("companyId")));
} }

@ -1,5 +1,6 @@
package com.hai.service.pay.impl; package com.hai.service.pay.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
@ -10,6 +11,7 @@ import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.utils.WxUtils; import com.hai.common.utils.WxUtils;
import com.hai.config.CommonSysConst; import com.hai.config.CommonSysConst;
import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongConfig;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.config.TuanYouConfig; import com.hai.config.TuanYouConfig;
import com.hai.dao.HighCouponCodeOtherMapper; import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighDiscountPackageRecordMapper; import com.hai.dao.HighDiscountPackageRecordMapper;
@ -259,6 +261,8 @@ public class GoodsOrderServiceImpl implements PayService {
if (highChildOrder.getGoodsType() == 2) { if (highChildOrder.getGoodsType() == 2) {
highChildOrder.setChildOrdeStatus(3); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 highChildOrder.setChildOrdeStatus(3); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
order.setFinishTime(new Date());
order.setOrderStatus(3); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
// 金币 1:100 // 金币 1:100
Integer goldNum = new BigDecimal(highChildOrder.getTotalPrice().toString()).multiply(new BigDecimal("100")).intValue(); Integer goldNum = new BigDecimal(highChildOrder.getTotalPrice().toString()).multiply(new BigDecimal("100")).intValue();
highUserService.goldHandle(highChildOrder.getGoodsId(), goldNum, 1, 1, highChildOrder.getId()); highUserService.goldHandle(highChildOrder.getGoodsId(), goldNum, 1, 1, highChildOrder.getId());
@ -327,6 +331,51 @@ public class GoodsOrderServiceImpl implements PayService {
discountPackageActualService.updateHighDiscountPackageActual(actual); discountPackageActualService.updateHighDiscountPackageActual(actual);
} }
} }
if (highChildOrder.getGoodsType() == 8) {
// 汇联通充值
String goodsDesc = "汇联通充值"+order.getPayPrice()+"元";
String tranDesc = "";
String businessType = "ghk_deposit";
// 汇联通卡充值
JSONObject deposit = HuiLianTongUnionCardConfig.deposit(order.getOrderNo(), order.getMemCardNo(), order.getPayPrice(), businessType, map.get("transaction_id"), tranDesc);
System.out.println("工会卡支付响应参数" + deposit.toJSONString());
JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data"));
Map<String,Object> dataMap = new HashMap<>();
dataMap.put("orderNo", order.getOrderNo());
dataMap.put("cardType", "ghk");
dataMap.put("cardNo", order.getMemCardNo());
dataMap.put("checkPassword", "N");
dataMap.put("tranAmount", order.getPayPrice());
dataMap.put("tranChannel", "HiSen");
dataMap.put("businessType", businessType);
dataMap.put("goodsDesc", goodsDesc);
dataMap.put("tranDesc", tranDesc);
HighGasOrderPush payPush = new HighGasOrderPush();
payPush.setType(OrderPushType.type5.getType());
payPush.setOrderNo(order.getOrderNo());
payPush.setCreateTime(new Date());
payPush.setCode(deposit.getString("respCode"));
payPush.setRequestContent(JSON.toJSONString(dataMap));
payPush.setReturnContent(deposit.toJSONString());
highGasOrderPushMapper.insert(payPush);
if (!Objects.equals(deposit.getString("respCode"), "0000")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , deposit.getString("respMessage"));
}
// 记录回调信息
if (!dataObject.getBoolean("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message"));
}
// 修改订单状态
highChildOrder.setChildOrdeStatus(3); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
order.setFinishTime(new Date());
order.setOrderStatus(3); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
}
} }
highOrderService.updateOrder(order); highOrderService.updateOrder(order);

Loading…
Cancel
Save