Merge branch 'pre' into shift

dev-discount
胡锐 2 years ago
commit c0e5e35f03
  1. 5
      hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java
  2. 20
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java
  3. 2
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java
  4. 68
      hai-bweb/src/main/java/com/bweb/controller/HighGasController.java
  5. 68
      hai-bweb/src/main/java/com/bweb/controller/HighGasStaffController.java
  6. 4
      hai-bweb/src/main/resources/dev/config.properties
  7. 1
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  8. 32
      hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java
  9. 30
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  10. 66
      hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java
  11. 1
      hai-service/src/main/java/com/hai/common/exception/ErrorCode.java
  12. 3
      hai-service/src/main/java/com/hai/common/security/AESEncodeUtil.java
  13. 17
      hai-service/src/main/java/com/hai/dao/HighChildOrderMapper.java
  14. 28
      hai-service/src/main/java/com/hai/dao/HighChildOrderSqlProvider.java
  15. 29
      hai-service/src/main/java/com/hai/dao/HighDiscountMapper.java
  16. 14
      hai-service/src/main/java/com/hai/dao/HighDiscountSqlProvider.java
  17. 4
      hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapperExt.java
  18. 17
      hai-service/src/main/java/com/hai/dao/HighGasStaffMapper.java
  19. 14
      hai-service/src/main/java/com/hai/dao/HighGasStaffSqlProvider.java
  20. 17
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  21. 32
      hai-service/src/main/java/com/hai/entity/HighChildOrder.java
  22. 130
      hai-service/src/main/java/com/hai/entity/HighChildOrderExample.java
  23. 16
      hai-service/src/main/java/com/hai/entity/HighDiscount.java
  24. 60
      hai-service/src/main/java/com/hai/entity/HighDiscountExample.java
  25. 16
      hai-service/src/main/java/com/hai/entity/HighGasStaff.java
  26. 70
      hai-service/src/main/java/com/hai/entity/HighGasStaffExample.java
  27. 10
      hai-service/src/main/java/com/hai/entity/HighOrder.java
  28. 1
      hai-service/src/main/java/com/hai/enum_type/GasPositionType.java
  29. 1
      hai-service/src/main/java/com/hai/enum_type/UserObjectTypeEnum.java
  30. 9
      hai-service/src/main/java/com/hai/model/GasOrderModel.java
  31. 7
      hai-service/src/main/java/com/hai/service/HighDiscountService.java
  32. 16
      hai-service/src/main/java/com/hai/service/HighDiscountUserRelService.java
  33. 16
      hai-service/src/main/java/com/hai/service/HighOrderService.java
  34. 1
      hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java
  35. 11
      hai-service/src/main/java/com/hai/service/impl/HighDiscountServiceImpl.java
  36. 73
      hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java
  37. 2
      hai-service/src/main/java/com/hai/service/impl/HighGasStaffServiceImpl.java
  38. 10
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java

@ -21,6 +21,7 @@ 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.*;
@ -553,6 +554,10 @@ public class HighCouponAgentController {
return ResponseMsgUtil.success("操作成功");
} catch (DeadlockLoserDataAccessException deadlockLoserDataAccessException) {
log.error("HighActivityController -> userLottery() error!", "请求过于频繁");
return ResponseMsgUtil.builderResponse(ErrorCode.FREQUENT_REQUESTS.getCode(),ErrorCode.FREQUENT_REQUESTS.getMsg(),null);
} catch (Exception e) {
log.error("HighCouponAgentController --> pushGzSinopec() error!", e);
return ResponseMsgUtil.exception(e);

@ -16,6 +16,7 @@ import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonSysConst;
import com.hai.entity.*;
import com.hai.enum_type.QrCodeType;
import com.hai.model.ResponseData;
@ -31,6 +32,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.net.URLEncoder;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -139,6 +141,24 @@ public class HighDiscountAgentRelController {
}
}
@RequestMapping(value="/getReceiveLink",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取领取链接")
public ResponseData getReceiveLink(@RequestParam(name = "id", required = true) Long id) {
try {
String param = URLEncoder.encode(AESEncodeUtil.aesEncrypt(id.toString()), "UTF-8");
String url = CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5?accountId=000001&key=&code=" + param;
return ResponseMsgUtil.success(url);
} catch (Exception e) {
log.error("HighDiscountController -> getReceiveLink() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getDiscountAgentList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询列表")

@ -63,6 +63,7 @@ public class HighDiscountController {
|| highDiscount.getDiscountType() == null
|| highDiscount.getDiscountPrice() == null
|| highDiscount.getEffectiveDay() == null
|| highDiscount.getReceiveNumber() == null
|| highDiscount.getUseScope() == null
|| highDiscount.getSalesEndTime() == null) {
log.error("HighDiscountController -> insertDiscount() error!","参数错误");
@ -113,6 +114,7 @@ public class HighDiscountController {
if (highDiscount.getId() == null
|| StringUtils.isBlank(highDiscount.getDiscountName())
|| StringUtils.isBlank(highDiscount.getDiscountImg())
|| highDiscount.getReceiveNumber() == null
|| highDiscount.getEffectiveDay() == null
|| highDiscount.getSalesEndTime() == null) {
log.error("HighDiscountController -> updateDiscount() error!","参数错误");

@ -111,6 +111,45 @@ public class HighGasController {
Map<String, Object> param = new HashMap<>();;
param.put("gasName", userInfoModel.getMerchantStore().getStoreName());
if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type8.getType())
&& userInfoModel.getGasStaff().getPositionType().equals(GasPositionType.status2.getStatus())) {
Map<String, Object> history = new HashMap<>();
// 历史加油总金额
Map<String, Object> historyTotal = highOrderService.getGasStaffHistoryOrderCount(userInfoModel.getGasStaff().getId(), "2,3,4,6,7");
history.put("totalPrice", historyTotal.get("price"));
history.put("totalCount", historyTotal.get("count"));
// 历史加油金额
Map<String, Object> historyIncomet = highOrderService.getGasStaffHistoryOrderCount(userInfoModel.getGasStaff().getId(), "2,3,6,7");
history.put("incomePrice", historyIncomet.get("price"));
history.put("incomeCount", historyIncomet.get("count"));
// 历史退款
Map<String, Object> historyRefund = highOrderService.getGasStaffHistoryOrderCount(userInfoModel.getGasStaff().getId(), "4");
history.put("refundPrice", historyRefund.get("price"));
history.put("refundCount", historyRefund.get("count"));
param.put("history", history);
Map<String, Object> today = new HashMap<>();
// 今日加油总金额
Map<String, Object> todayTotal = highOrderService.getGasStaffTheDayOrderCount(userInfoModel.getGasStaff().getId(), "2,3,4,6,7");
today.put("totalPrice", todayTotal.get("price"));
today.put("totalCount", todayTotal.get("count"));
// 今日加油金额
Map<String, Object> todayIncomet = highOrderService.getGasStaffTheDayOrderCount(userInfoModel.getGasStaff().getId(), "2,3,6,7");
today.put("incomePrice", todayIncomet.get("price"));
today.put("incomeCount", todayIncomet.get("count"));
// 今日退款
Map<String, Object> todayRefund = highOrderService.getGasStaffTheDayOrderCount(userInfoModel.getGasStaff().getId(), "4");
today.put("refundPrice", todayRefund.get("price"));
today.put("refundCount", todayRefund.get("count"));
param.put("today", today);
} else {
Map<String, Object> history = new HashMap<>();
// 历史加油总金额
Map<String, Object> historyTotal = highOrderService.getGasHistoryOrderCount(userInfoModel.getMerchantStore().getId(), "2,3,4,6,7");
@ -145,7 +184,7 @@ public class HighGasController {
today.put("refundPrice", todayRefund.get("price"));
today.put("refundCount", todayRefund.get("count"));
param.put("today", today);
}
return ResponseMsgUtil.success(param);
} catch (Exception e) {
@ -159,6 +198,7 @@ public class HighGasController {
@ApiOperation(value = "查询油站订单列表")
public ResponseData getGasOrderList(@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "storeId", required = false) Long storeId,
@RequestParam(name = "staffId", required = false) Long staffId,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "createTimeS", required = false) Long createTimeS,
@RequestParam(name = "createTimeE", required = false) Long createTimeE,
@ -170,7 +210,7 @@ public class HighGasController {
log.error("HighGasController -> disabledOil() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
Map<String, Object> param = new HashMap<>();;
Map<String, Object> param = new HashMap<>();
// 用户来源 0:超级管理员 1:公司 2:商户 3:门店 4. 代理商 5.充值后台工商 6.团油代理商 7.团油业务员 8. 加油站员工
if (userInfoModel.getSecUser().getObjectType().equals(2)) {
if (storeId != null) {
@ -191,15 +231,20 @@ public class HighGasController {
} else {
param.put("storeId", 0);
}
}
param.put("gasStaffId", staffId);
} else if (userInfoModel.getSecUser().getObjectType().equals(3)) {
param.put("storeId", userInfoModel.getMerchantStore().getId());
param.put("gasStaffId", staffId);
} else if (userInfoModel.getSecUser().getObjectType().equals(8)) {
if (userInfoModel.getGasStaff().getPositionType().equals(GasPositionType.status1.getStatus())) {
param.put("storeId", userInfoModel.getMerchantStore().getId());
}
if (userInfoModel.getGasStaff().getPositionType().equals(GasPositionType.status2.getStatus())) {
param.put("gasStaffId", userInfoModel.getGasStaff().getId());
}
} else {
log.error("HighGasController -> disabledOil() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
@ -260,6 +305,7 @@ public class HighGasController {
@ApiOperation(value = "导出油站订单")
public ResponseData exportGasOrder(@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "storeId", required = false) Long storeId,
@RequestParam(name = "staffId", required = false) Long staffId,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "createTimeS", required = false) Long createTimeS,
@RequestParam(name = "createTimeE", required = false) Long createTimeE) {
@ -290,20 +336,24 @@ public class HighGasController {
} else {
param.put("storeId", 0);
}
}
param.put("gasStaffId", staffId);
} else if (userInfoModel.getSecUser().getObjectType().equals(3)) {
param.put("storeId", userInfoModel.getMerchantStore().getId());
param.put("gasStaffId", staffId);
} else if (userInfoModel.getSecUser().getObjectType().equals(8)) {
if (userInfoModel.getGasStaff().getPositionType().equals(GasPositionType.status1.getStatus())) {
param.put("storeId", userInfoModel.getMerchantStore().getId());
}
if (userInfoModel.getGasStaff().getPositionType().equals(GasPositionType.status2.getStatus())) {
param.put("gasStaffId", userInfoModel.getGasStaff().getId());
}
} else {
log.error("HighGasController -> disabledOil() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
param.put("orderNo", orderNo);
param.put("createTimeS", createTimeS);
param.put("createTimeE", createTimeE);
@ -317,6 +367,7 @@ public class HighGasController {
List<String> headList = new ArrayList<>();
headList.add("订单号");
headList.add("油站名称");
headList.add("加油员");
headList.add("油品类型");
headList.add("油品油号");
headList.add("油枪号");
@ -337,6 +388,7 @@ public class HighGasController {
data = new ArrayList<>();
data.add(orderModel.getOrderNo());
data.add(orderModel.getGasName());
data.add(StringUtils.isNotBlank(orderModel.getGasStaffName())?orderModel.getGasStaffName():"未知");
data.add(orderModel.getGasOilType().equals("1") ? "汽油": "柴油");
data.add(orderModel.getGasOilNo() + "#");
data.add(orderModel.getGasGunNo() + "号");
@ -357,7 +409,7 @@ public class HighGasController {
if (!file.exists()) {
file.mkdirs();
}
EasyExcel.write(fileUrl+pathName).head(generationHead(headList)).sheet("油卡").doWrite(dataList);
EasyExcel.write(fileUrl+pathName).head(generationHead(headList)).sheet("加油订单").doWrite(dataList);
return ResponseMsgUtil.success(pathName);

@ -1,28 +1,45 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bweb.config.SysConst;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.Base64Util;
import com.hai.common.QRCodeGenerator;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.AESEncodeUtil;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonSysConst;
import com.hai.entity.HighGasStaff;
import com.hai.entity.HighMerchantStore;
import com.hai.enum_type.GasStaffStatus;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.CommonService;
import com.hai.service.HighGasStaffService;
import com.hai.service.HighMerchantStoreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.utils.URLEncodedUtils;
import org.bouncycastle.util.encoders.UrlBase64Encoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Base64;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -36,6 +53,9 @@ public class HighGasStaffController {
@Resource
private HighGasStaffService gasStaffService;
@Resource
private HighMerchantStoreService merchantStoreService;
@Resource
private CommonService commonService;
@ -112,6 +132,54 @@ public class HighGasStaffController {
}
}
@RequestMapping(value="/queryQrCode",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询二维码")
public ResponseData queryQrCode(@RequestBody JSONObject body) {
try {
if (body.getLong("gasStaffId") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询员工信息
HighGasStaff gasStaff = gasStaffService.getStaffDetailById(body.getLong("gasStaffId"));
if (gasStaff == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到员工信息");
}
if (StringUtils.isBlank(gasStaff.getQrCodeImgUrl())) {
// 查询加油站
HighMerchantStore merchantStore = merchantStoreService.getDetailById(gasStaff.getMerchantStoreId());
if (merchantStore == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到加油站信息");
}
// 查询秘钥
String key = commonService.getDictionaryCodeName("QR_CODE_SIGN_KEY", "1");
if (StringUtils.isBlank(key)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询失败");
}
// 员工ID签名
String signId = AESEncodeUtil.base64Encode(AESEncodeUtil.aesEncryptToBytes(gasStaff.getId().toString(), key));
// 生成二维码
String param = CommonSysConst.getSysConfig().getHsgDomainName()+"/hsgH5?accountId=000000&gasKey=" + merchantStore.getStoreKey() + "&staffCode=" + URLEncoder.encode(signId, "UTF-8");
String qrCodeImgUrl = DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(1) +".jpg";
QRCodeGenerator.generateQRCodeImage(param, 350, 350, SysConst.getSysConfig().getFileUrl()+"/gasStaff/"+qrCodeImgUrl);
gasStaff.setQrCodeImgUrl(qrCodeImgUrl);
gasStaffService.updateStaff(gasStaff);
}
return ResponseMsgUtil.success(gasStaff.getQrCodeImgUrl());
} catch (Exception e) {
log.error("HighGasStaffController -> queryQrCode() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/disabled",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "禁用员工")

@ -1,5 +1,5 @@
#fileUrl=/home/project/hsg/filesystem
fileUrl=/Volumes/work/code/filesystem/
fileUrl=/home/project/hsg/filesystem
#fileUrl=/Volumes/work/code/filesystem/
cmsPath=/home/project/hsg/filesystem/cmsPath
agentQrCode=/home/project/hsg/filesystem/agentQrCode
agentQrCodeWxUrl=https://hsgcs.dctpay.com/wx/?action=ic&id=

@ -97,6 +97,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/couponAgent/convertCodeDetail")
.excludePathPatterns("/coupon/getCouponById")
.excludePathPatterns("/discount/getDiscountByQrCode")
.excludePathPatterns("/discount/getDiscountByCode")
.excludePathPatterns("/discount/getDiscountById")
.excludePathPatterns("/discount/getCouponByDiscount")
.excludePathPatterns("/discountPackage/getDiscountPackageList")

@ -17,12 +17,14 @@ import com.hai.service.HighDiscountCouponRelService;
import com.hai.service.HighDiscountService;
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.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Map;
@ -83,6 +85,36 @@ public class HighDiscountController {
}
}
@RequestMapping(value="/getDiscountByCode",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据Code查询优惠券")
public ResponseData getDiscountByCode(@RequestParam(name = "code", required = true) String code) {
try {
System.out.println(code);
String discountAgentId;
try {
discountAgentId = AESEncodeUtil.aesDecrypt(URLDecoder.decode(code, "UTF-8"));
} catch (Exception e) {
log.error("HighDiscountController -> getDiscountByQrCode() error!","code解码错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "code解码错误");
}
if (StringUtils.isBlank(discountAgentId)) {
log.error("HighDiscountController -> getDiscountByQrCode() error!","code解码错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "code解码错误");
}
// 查询优惠券与代理商关系id
HighDiscountAgentRel discountAgentRel = highDiscountAgentRelService.getRelById(Long.parseLong(discountAgentId));
if (discountAgentRel == null) {
log.error("HighDiscountController -> getDiscountByQrCode() error!","code解码错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "code解码错误");
}
return ResponseMsgUtil.success(discountAgentRel);
} catch (Exception e) {
log.error("HighDiscountController -> getDiscountByQrCode() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getDiscountByDiscountAgentId",method = RequestMethod.GET)
@ResponseBody

@ -8,6 +8,7 @@ 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.AESEncodeUtil;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
@ -38,6 +39,7 @@ import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.net.URLDecoder;
import java.util.*;
import java.util.stream.Collectors;
@ -94,6 +96,9 @@ public class HighOrderController {
@Resource
private HighGasDiscountOilPriceService gasDiscountOilPriceService;
@Resource
private HighGasStaffService gasStaffService;
@RequestMapping(value="/addOrder",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "增加订单")
@ -241,6 +246,31 @@ public class HighOrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限");
}
if (StringUtils.isNotBlank(highOrder.getGasStaffCode())) {
String qrCodeSignKey = commonService.getDictionaryCodeName("QR_CODE_SIGN_KEY", "1");
if (StringUtils.isBlank(qrCodeSignKey)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知秘钥");
}
String staffId;
try {
staffId = AESEncodeUtil.aesDecryptByBytes(AESEncodeUtil.base64Decode(URLDecoder.decode(highOrder.getGasStaffCode(),"UTF-8")), qrCodeSignKey);
} catch (Exception e) {
log.error("HighOrderController --> addOrder() error!", "收银员code解析失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "收银员code解析失败");
}
// 查询员工
HighGasStaff gasStaff = gasStaffService.getStaffDetailById(Long.parseLong(staffId));
if (gasStaff == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知收银员");
}
if (gasStaff.getMerchantStoreId().equals(childOrder.getGoodsId())) {
childOrder.setGasStaffId(gasStaff.getId());
childOrder.setGasStaffName(gasStaff.getName());
}
}
// 查询门店
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(childOrder.getGoodsId());
if (store == null) {

@ -6,18 +6,17 @@ 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.AESEncodeUtil;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.*;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.service.HighDiscountAgentCodeService;
import com.hai.service.HighDiscountCouponRelService;
import com.hai.service.HighDiscountUserRelService;
import com.hai.service.HighOpenApiService;
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;
@ -27,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.net.URLDecoder;
import java.util.*;
import java.util.stream.Collectors;
@ -45,6 +45,12 @@ public class HighUserDiscountController {
@Autowired
private UserCenter userCenter;
@Resource
private HighDiscountService discountService;
@Resource
private HighDiscountAgentRelService discountAgentRelService;
@Resource
private HighDiscountUserRelService highDiscountUserRelService;
@ -56,7 +62,7 @@ public class HighUserDiscountController {
@RequestMapping(value="/receiveDiscount",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "用户领取优惠券")
@ApiOperation(value = "用户领取优惠券码【领取优惠码值】")
public ResponseData receiveDiscount(@RequestBody String reqBody, HttpServletRequest request) {
try {
@ -70,6 +76,7 @@ public class HighUserDiscountController {
log.error("HighDiscountController -> receiveDiscount() error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 领取
highDiscountUserRelService.receiveDiscount(userInfoModel.getHighUser().getId(), codeId);
return ResponseMsgUtil.success("领取成功");
@ -84,6 +91,55 @@ public class HighUserDiscountController {
}
}
@RequestMapping(value="/receive",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "用户领取优惠券【领取优惠】")
public ResponseData receive(@RequestBody String reqBody, HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
JSONObject jsonObject = JSONObject.parseObject(reqBody);
String discountAgentCode = jsonObject.getString("code");
if (StringUtils.isBlank(discountAgentCode)) {
log.error("HighDiscountController -> receiveDiscount() error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 解密
String discountAgentId = AESEncodeUtil.aesDecrypt(URLDecoder.decode(discountAgentCode, "UTF-8"));
HighDiscountAgentRel discountAgentRel = discountAgentRelService.getRelById(Long.parseLong(discountAgentId));
if (discountAgentRel == null) {
log.error("HighDiscountController -> receiveDiscount() error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知优惠券");
}
// 查询优惠券信息
HighDiscount discount = discountService.getDiscountById(discountAgentRel.getDiscountId());
if (discount == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的优惠券");
}
if (!discount.getStatus().equals(2)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法领取,优惠券活动已过期");
}
// 领取
highDiscountUserRelService.receive(userInfoModel.getHighUser().getId(), discountAgentRel.getId());
return ResponseMsgUtil.success("领取成功");
} 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("HighDiscountController -> receiveDiscount() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getUserDiscountList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取用户的优惠券列表")

@ -26,6 +26,7 @@ public enum ErrorCode {
WECHAT_LOGIN_ERROR("3002","微信登录失败"),
WECHAT_LOGIN_TEACHER_ERROR("3003","当前微信用户不是老师,请联系管理员"),
SERVER_BUSY_ERROR("3004","服务器繁忙,请稍后重试"),
FREQUENT_REQUESTS("3005","服务器繁忙,请稍后重试"),
//////////////////业务异常/////////////
COMMON_ERROR("2000",""),

@ -7,6 +7,7 @@ import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.spec.SecretKeySpec;
import java.math.BigInteger;
import java.net.URLDecoder;
import java.security.SecureRandom;
import java.util.Base64;
@ -63,7 +64,7 @@ public class AESEncodeUtil {
public static void main(String[] args) throws Exception{
long currentTimeMillis = System.currentTimeMillis();
System.out.println(AESEncodeUtil.aesDecrypt(Base64Util.decode("ZStZUjRIcFl5SVo4MEhzSU96MldDUEFZa3lmbUhpNTdKMGhCVytIY3NJaz0")));
System.out.println(AESEncodeUtil.aesDecrypt(URLDecoder.decode("mL4laIILGps4E58w8sbseQ%3D%3D", "UTF-8")));
/* String content = "{\"create_time\":1573544092110,\"order_serial_no\":\"40280e816db49c0b016db4a2c31f0004\",\"product_code\":\"8a9e80045cf85e54015cf8809fcd\",\"product_name\":\"平安发票贷\",\"uscc\":\"91370781687233838E\"}";
System.out.println("加密前" + content);

@ -54,7 +54,8 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt {
"gas_price_vip, gas_price_official, ",
"gas_oil_liters, gas_discount, ",
"gas_oil_subsidy, gas_liters_preferences, ",
"gas_price_preferences, gas_salesman_id, ",
"gas_price_preferences, gas_staff_id, ",
"gas_staff_name, gas_salesman_id, ",
"gas_salesman_name, gas_agent_id, ",
"gas_agent_name, gas_org_id, ",
"gas_org_name, ext_1, ",
@ -75,7 +76,8 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt {
"#{gasPriceVip,jdbcType=DECIMAL}, #{gasPriceOfficial,jdbcType=DECIMAL}, ",
"#{gasOilLiters,jdbcType=DECIMAL}, #{gasDiscount,jdbcType=DECIMAL}, ",
"#{gasOilSubsidy,jdbcType=DECIMAL}, #{gasLitersPreferences,jdbcType=DECIMAL}, ",
"#{gasPricePreferences,jdbcType=DECIMAL}, #{gasSalesmanId,jdbcType=BIGINT}, ",
"#{gasPricePreferences,jdbcType=DECIMAL}, #{gasStaffId,jdbcType=BIGINT}, ",
"#{gasStaffName,jdbcType=VARCHAR}, #{gasSalesmanId,jdbcType=BIGINT}, ",
"#{gasSalesmanName,jdbcType=VARCHAR}, #{gasAgentId,jdbcType=BIGINT}, ",
"#{gasAgentName,jdbcType=VARCHAR}, #{gasOrgId,jdbcType=BIGINT}, ",
"#{gasOrgName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
@ -123,6 +125,8 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt {
@Result(column="gas_oil_subsidy", property="gasOilSubsidy", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_liters_preferences", property="gasLitersPreferences", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_price_preferences", property="gasPricePreferences", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_staff_id", property="gasStaffId", jdbcType=JdbcType.BIGINT),
@Result(column="gas_staff_name", property="gasStaffName", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_salesman_id", property="gasSalesmanId", jdbcType=JdbcType.BIGINT),
@Result(column="gas_salesman_name", property="gasSalesmanName", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_agent_id", property="gasAgentId", jdbcType=JdbcType.BIGINT),
@ -145,8 +149,9 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt {
"sale_count, total_price, giveaway_type, child_orde_status, praise_status, gas_oil_no, ",
"gas_gun_no, gas_oil_type, gas_order_no, gas_price_platform, gas_price_gun, gas_price_vip, ",
"gas_price_official, gas_oil_liters, gas_discount, gas_oil_subsidy, gas_liters_preferences, ",
"gas_price_preferences, gas_salesman_id, gas_salesman_name, gas_agent_id, gas_agent_name, ",
"gas_org_id, gas_org_name, ext_1, ext_2, ext_3, ext_4, ext_5, ext_6",
"gas_price_preferences, gas_staff_id, gas_staff_name, gas_salesman_id, gas_salesman_name, ",
"gas_agent_id, gas_agent_name, gas_org_id, gas_org_name, ext_1, ext_2, ext_3, ",
"ext_4, ext_5, ext_6",
"from high_child_order",
"where id = #{id,jdbcType=BIGINT}"
})
@ -183,6 +188,8 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt {
@Result(column="gas_oil_subsidy", property="gasOilSubsidy", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_liters_preferences", property="gasLitersPreferences", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_price_preferences", property="gasPricePreferences", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_staff_id", property="gasStaffId", jdbcType=JdbcType.BIGINT),
@Result(column="gas_staff_name", property="gasStaffName", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_salesman_id", property="gasSalesmanId", jdbcType=JdbcType.BIGINT),
@Result(column="gas_salesman_name", property="gasSalesmanName", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_agent_id", property="gasAgentId", jdbcType=JdbcType.BIGINT),
@ -240,6 +247,8 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt {
"gas_oil_subsidy = #{gasOilSubsidy,jdbcType=DECIMAL},",
"gas_liters_preferences = #{gasLitersPreferences,jdbcType=DECIMAL},",
"gas_price_preferences = #{gasPricePreferences,jdbcType=DECIMAL},",
"gas_staff_id = #{gasStaffId,jdbcType=BIGINT},",
"gas_staff_name = #{gasStaffName,jdbcType=VARCHAR},",
"gas_salesman_id = #{gasSalesmanId,jdbcType=BIGINT},",
"gas_salesman_name = #{gasSalesmanName,jdbcType=VARCHAR},",
"gas_agent_id = #{gasAgentId,jdbcType=BIGINT},",

@ -152,6 +152,14 @@ public class HighChildOrderSqlProvider {
sql.VALUES("gas_price_preferences", "#{gasPricePreferences,jdbcType=DECIMAL}");
}
if (record.getGasStaffId() != null) {
sql.VALUES("gas_staff_id", "#{gasStaffId,jdbcType=BIGINT}");
}
if (record.getGasStaffName() != null) {
sql.VALUES("gas_staff_name", "#{gasStaffName,jdbcType=VARCHAR}");
}
if (record.getGasSalesmanId() != null) {
sql.VALUES("gas_salesman_id", "#{gasSalesmanId,jdbcType=BIGINT}");
}
@ -241,6 +249,8 @@ public class HighChildOrderSqlProvider {
sql.SELECT("gas_oil_subsidy");
sql.SELECT("gas_liters_preferences");
sql.SELECT("gas_price_preferences");
sql.SELECT("gas_staff_id");
sql.SELECT("gas_staff_name");
sql.SELECT("gas_salesman_id");
sql.SELECT("gas_salesman_name");
sql.SELECT("gas_agent_id");
@ -398,6 +408,14 @@ public class HighChildOrderSqlProvider {
sql.SET("gas_price_preferences = #{record.gasPricePreferences,jdbcType=DECIMAL}");
}
if (record.getGasStaffId() != null) {
sql.SET("gas_staff_id = #{record.gasStaffId,jdbcType=BIGINT}");
}
if (record.getGasStaffName() != null) {
sql.SET("gas_staff_name = #{record.gasStaffName,jdbcType=VARCHAR}");
}
if (record.getGasSalesmanId() != null) {
sql.SET("gas_salesman_id = #{record.gasSalesmanId,jdbcType=BIGINT}");
}
@ -486,6 +504,8 @@ public class HighChildOrderSqlProvider {
sql.SET("gas_oil_subsidy = #{record.gasOilSubsidy,jdbcType=DECIMAL}");
sql.SET("gas_liters_preferences = #{record.gasLitersPreferences,jdbcType=DECIMAL}");
sql.SET("gas_price_preferences = #{record.gasPricePreferences,jdbcType=DECIMAL}");
sql.SET("gas_staff_id = #{record.gasStaffId,jdbcType=BIGINT}");
sql.SET("gas_staff_name = #{record.gasStaffName,jdbcType=VARCHAR}");
sql.SET("gas_salesman_id = #{record.gasSalesmanId,jdbcType=BIGINT}");
sql.SET("gas_salesman_name = #{record.gasSalesmanName,jdbcType=VARCHAR}");
sql.SET("gas_agent_id = #{record.gasAgentId,jdbcType=BIGINT}");
@ -632,6 +652,14 @@ public class HighChildOrderSqlProvider {
sql.SET("gas_price_preferences = #{gasPricePreferences,jdbcType=DECIMAL}");
}
if (record.getGasStaffId() != null) {
sql.SET("gas_staff_id = #{gasStaffId,jdbcType=BIGINT}");
}
if (record.getGasStaffName() != null) {
sql.SET("gas_staff_name = #{gasStaffName,jdbcType=VARCHAR}");
}
if (record.getGasSalesmanId() != null) {
sql.SET("gas_salesman_id = #{gasSalesmanId,jdbcType=BIGINT}");
}

@ -44,21 +44,21 @@ public interface HighDiscountMapper extends HighDiscountMapperExt {
"discount_name, discount_img, ",
"discount_carousel_img, discount_type, ",
"discount_condition, discount_price, ",
"effective_day, sales_end_time, ",
"create_time, update_time, ",
"operator_id, operator_name, ",
"`status`, ext_1, ext_2, ",
"ext_3)",
"receive_number, effective_day, ",
"sales_end_time, create_time, ",
"update_time, operator_id, ",
"operator_name, `status`, ",
"ext_1, ext_2, ext_3)",
"values (#{companyId,jdbcType=BIGINT}, #{discountKey,jdbcType=VARCHAR}, ",
"#{usingRange,jdbcType=INTEGER}, #{useScope,jdbcType=INTEGER}, ",
"#{discountName,jdbcType=VARCHAR}, #{discountImg,jdbcType=VARCHAR}, ",
"#{discountCarouselImg,jdbcType=VARCHAR}, #{discountType,jdbcType=INTEGER}, ",
"#{discountCondition,jdbcType=DECIMAL}, #{discountPrice,jdbcType=DECIMAL}, ",
"#{effectiveDay,jdbcType=INTEGER}, #{salesEndTime,jdbcType=TIMESTAMP}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ",
"#{ext3,jdbcType=VARCHAR})"
"#{receiveNumber,jdbcType=INTEGER}, #{effectiveDay,jdbcType=INTEGER}, ",
"#{salesEndTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{operatorId,jdbcType=BIGINT}, ",
"#{operatorName,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighDiscount record);
@ -80,6 +80,7 @@ public interface HighDiscountMapper extends HighDiscountMapperExt {
@Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER),
@Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL),
@Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="receive_number", property="receiveNumber", jdbcType=JdbcType.INTEGER),
@Result(column="effective_day", property="effectiveDay", jdbcType=JdbcType.INTEGER),
@Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@ -96,9 +97,9 @@ public interface HighDiscountMapper extends HighDiscountMapperExt {
@Select({
"select",
"id, company_id, discount_key, using_range, use_scope, discount_name, discount_img, ",
"discount_carousel_img, discount_type, discount_condition, discount_price, effective_day, ",
"sales_end_time, create_time, update_time, operator_id, operator_name, `status`, ",
"ext_1, ext_2, ext_3",
"discount_carousel_img, discount_type, discount_condition, discount_price, receive_number, ",
"effective_day, sales_end_time, create_time, update_time, operator_id, operator_name, ",
"`status`, ext_1, ext_2, ext_3",
"from high_discount",
"where id = #{id,jdbcType=BIGINT}"
})
@ -114,6 +115,7 @@ public interface HighDiscountMapper extends HighDiscountMapperExt {
@Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER),
@Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL),
@Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="receive_number", property="receiveNumber", jdbcType=JdbcType.INTEGER),
@Result(column="effective_day", property="effectiveDay", jdbcType=JdbcType.INTEGER),
@Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@ -148,6 +150,7 @@ public interface HighDiscountMapper extends HighDiscountMapperExt {
"discount_type = #{discountType,jdbcType=INTEGER},",
"discount_condition = #{discountCondition,jdbcType=DECIMAL},",
"discount_price = #{discountPrice,jdbcType=DECIMAL},",
"receive_number = #{receiveNumber,jdbcType=INTEGER},",
"effective_day = #{effectiveDay,jdbcType=INTEGER},",
"sales_end_time = #{salesEndTime,jdbcType=TIMESTAMP},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",

@ -68,6 +68,10 @@ public class HighDiscountSqlProvider {
sql.VALUES("discount_price", "#{discountPrice,jdbcType=DECIMAL}");
}
if (record.getReceiveNumber() != null) {
sql.VALUES("receive_number", "#{receiveNumber,jdbcType=INTEGER}");
}
if (record.getEffectiveDay() != null) {
sql.VALUES("effective_day", "#{effectiveDay,jdbcType=INTEGER}");
}
@ -128,6 +132,7 @@ public class HighDiscountSqlProvider {
sql.SELECT("discount_type");
sql.SELECT("discount_condition");
sql.SELECT("discount_price");
sql.SELECT("receive_number");
sql.SELECT("effective_day");
sql.SELECT("sales_end_time");
sql.SELECT("create_time");
@ -199,6 +204,10 @@ public class HighDiscountSqlProvider {
sql.SET("discount_price = #{record.discountPrice,jdbcType=DECIMAL}");
}
if (record.getReceiveNumber() != null) {
sql.SET("receive_number = #{record.receiveNumber,jdbcType=INTEGER}");
}
if (record.getEffectiveDay() != null) {
sql.SET("effective_day = #{record.effectiveDay,jdbcType=INTEGER}");
}
@ -258,6 +267,7 @@ public class HighDiscountSqlProvider {
sql.SET("discount_type = #{record.discountType,jdbcType=INTEGER}");
sql.SET("discount_condition = #{record.discountCondition,jdbcType=DECIMAL}");
sql.SET("discount_price = #{record.discountPrice,jdbcType=DECIMAL}");
sql.SET("receive_number = #{record.receiveNumber,jdbcType=INTEGER}");
sql.SET("effective_day = #{record.effectiveDay,jdbcType=INTEGER}");
sql.SET("sales_end_time = #{record.salesEndTime,jdbcType=TIMESTAMP}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
@ -318,6 +328,10 @@ public class HighDiscountSqlProvider {
sql.SET("discount_price = #{discountPrice,jdbcType=DECIMAL}");
}
if (record.getReceiveNumber() != null) {
sql.SET("receive_number = #{receiveNumber,jdbcType=INTEGER}");
}
if (record.getEffectiveDay() != null) {
sql.SET("effective_day = #{effectiveDay,jdbcType=INTEGER}");
}

@ -39,4 +39,8 @@ public interface HighDiscountUserRelMapperExt {
" ORDER BY hdur.create_time desc" +
"</script>"})
List<HighUserDiscountUnicomModel> getUserCouponsList(@Param("map") Map<String,Object> map);
@Select({"<script> select count(1) count from high_discount_user_rel where user_id = #{userId} and discount_id = #{discountId} and `status` <![CDATA[ <> 100 ]]> </script>"})
Integer receiveDiscountCount(@Param("userId") Long userId, @Param("discountId") Long discountId);
}

@ -42,15 +42,15 @@ public interface HighGasStaffMapper extends HighGasStaffMapperExt {
"insert into high_gas_staff (merchant_store_id, avatar, ",
"`name`, telephone, ",
"position_type, position_name, ",
"`status`, create_time, ",
"update_time, ext_1, ",
"ext_2, ext_3)",
"qr_code_img_url, `status`, ",
"create_time, update_time, ",
"ext_1, ext_2, ext_3)",
"values (#{merchantStoreId,jdbcType=BIGINT}, #{avatar,jdbcType=VARCHAR}, ",
"#{name,jdbcType=VARCHAR}, #{telephone,jdbcType=VARCHAR}, ",
"#{positionType,jdbcType=INTEGER}, #{positionName,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
"#{qrCodeImgUrl,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighGasStaff record);
@ -68,6 +68,7 @@ public interface HighGasStaffMapper extends HighGasStaffMapperExt {
@Result(column="telephone", property="telephone", jdbcType=JdbcType.VARCHAR),
@Result(column="position_type", property="positionType", jdbcType=JdbcType.INTEGER),
@Result(column="position_name", property="positionName", jdbcType=JdbcType.VARCHAR),
@Result(column="qr_code_img_url", property="qrCodeImgUrl", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@ -80,7 +81,7 @@ public interface HighGasStaffMapper extends HighGasStaffMapperExt {
@Select({
"select",
"id, merchant_store_id, avatar, `name`, telephone, position_type, position_name, ",
"`status`, create_time, update_time, ext_1, ext_2, ext_3",
"qr_code_img_url, `status`, create_time, update_time, ext_1, ext_2, ext_3",
"from high_gas_staff",
"where id = #{id,jdbcType=BIGINT}"
})
@ -92,6 +93,7 @@ public interface HighGasStaffMapper extends HighGasStaffMapperExt {
@Result(column="telephone", property="telephone", jdbcType=JdbcType.VARCHAR),
@Result(column="position_type", property="positionType", jdbcType=JdbcType.INTEGER),
@Result(column="position_name", property="positionName", jdbcType=JdbcType.VARCHAR),
@Result(column="qr_code_img_url", property="qrCodeImgUrl", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@ -118,6 +120,7 @@ public interface HighGasStaffMapper extends HighGasStaffMapperExt {
"telephone = #{telephone,jdbcType=VARCHAR},",
"position_type = #{positionType,jdbcType=INTEGER},",
"position_name = #{positionName,jdbcType=VARCHAR},",
"qr_code_img_url = #{qrCodeImgUrl,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",

@ -52,6 +52,10 @@ public class HighGasStaffSqlProvider {
sql.VALUES("position_name", "#{positionName,jdbcType=VARCHAR}");
}
if (record.getQrCodeImgUrl() != null) {
sql.VALUES("qr_code_img_url", "#{qrCodeImgUrl,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
@ -92,6 +96,7 @@ public class HighGasStaffSqlProvider {
sql.SELECT("telephone");
sql.SELECT("position_type");
sql.SELECT("position_name");
sql.SELECT("qr_code_img_url");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("update_time");
@ -143,6 +148,10 @@ public class HighGasStaffSqlProvider {
sql.SET("position_name = #{record.positionName,jdbcType=VARCHAR}");
}
if (record.getQrCodeImgUrl() != null) {
sql.SET("qr_code_img_url = #{record.qrCodeImgUrl,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
@ -182,6 +191,7 @@ public class HighGasStaffSqlProvider {
sql.SET("telephone = #{record.telephone,jdbcType=VARCHAR}");
sql.SET("position_type = #{record.positionType,jdbcType=INTEGER}");
sql.SET("position_name = #{record.positionName,jdbcType=VARCHAR}");
sql.SET("qr_code_img_url = #{record.qrCodeImgUrl,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
@ -222,6 +232,10 @@ public class HighGasStaffSqlProvider {
sql.SET("position_name = #{positionName,jdbcType=VARCHAR}");
}
if (record.getQrCodeImgUrl() != null) {
sql.SET("qr_code_img_url = #{qrCodeImgUrl,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}

@ -1081,6 +1081,14 @@ public interface HighOrderMapperExt {
" and to_days(pay_time) = to_days(now())"})
Map<String, Object> selectGasTheDayOrderCount(@Param("storeId") Long storeId, @Param("status") String status);
@Select({" select" +
" case when SUM(b.total_price) is null then 0 else SUM(b.total_price) end price," +
" count(1) count" +
" from high_child_order a,high_order b " +
" where a.order_id = b.id and goods_type = 3 and gas_staff_id = #{gasStaffId} and b.order_status in (${status}) " +
" and to_days(pay_time) = to_days(now())"})
Map<String, Object> selectGasStaffTheDayOrderCount(@Param("gasStaffId") Long gasStaffId, @Param("status") String status);
@Select({" select" +
" case when SUM(b.total_price) is null then 0 else SUM(b.total_price) end price," +
" count(1) count" +
@ -1088,6 +1096,13 @@ public interface HighOrderMapperExt {
" where a.order_id = b.id and goods_type = 3 and goods_id = #{storeId} and b.order_status in (${status}) "})
Map<String, Object> selectGasHistoryOrderCount(@Param("storeId") Long storeId, @Param("status") String status);
@Select({" select" +
" case when SUM(b.total_price) is null then 0 else SUM(b.total_price) end price," +
" count(1) count" +
" from high_child_order a,high_order b " +
" where a.order_id = b.id and goods_type = 3 and gas_staff_id = #{gasStaffId} and b.order_status in (${status}) "})
Map<String, Object> selectGasStaffHistoryOrderCount(@Param("gasStaffId") Long gasStaffId, @Param("status") String status);
@Select({
"<script> " +
" select " +
@ -1106,6 +1121,7 @@ public interface HighOrderMapperExt {
" a.gas_oil_type gasOilType," +
" a.gas_oil_no gasOilNo," +
" a.gas_gun_no gasGunNo," +
" a.gas_staff_name gasStaffName," +
" a.gas_price_gun gasPriceGun," +
" a.gas_oil_liters gasOilLiters," +
" a.gas_discount gasDiscount," +
@ -1123,6 +1139,7 @@ public interface HighOrderMapperExt {
" where a.order_id = b.id " +
" and goods_type = 3 " +
"<if test='param.storeId != null'> and goods_id in (${param.storeId}) </if>" +
"<if test='param.gasStaffId != null'> and a.gas_staff_id = #{param.gasStaffId}</if>" +
"<if test='param.status != null'> and b.order_status in (${param.status})</if>" +
"<if test='param.createTimeS != null'> <![CDATA[ and b.create_time >= #{param.createTimeS} ]]> </if>",
"<if test='param.createTimeE != null'> <![CDATA[ and b.create_time <= #{param.createTimeE} ]]> </if>",

@ -173,6 +173,16 @@ public class HighChildOrder implements Serializable {
*/
private BigDecimal gasPricePreferences;
/**
* 加油站加油员id
*/
private Long gasStaffId;
/**
* 加油站加油员名称
*/
private String gasStaffName;
/**
* 加油站业务员id
*/
@ -473,6 +483,22 @@ public class HighChildOrder implements Serializable {
this.gasPricePreferences = gasPricePreferences;
}
public Long getGasStaffId() {
return gasStaffId;
}
public void setGasStaffId(Long gasStaffId) {
this.gasStaffId = gasStaffId;
}
public String getGasStaffName() {
return gasStaffName;
}
public void setGasStaffName(String gasStaffName) {
this.gasStaffName = gasStaffName;
}
public Long getGasSalesmanId() {
return gasSalesmanId;
}
@ -613,6 +639,8 @@ public class HighChildOrder implements Serializable {
&& (this.getGasOilSubsidy() == null ? other.getGasOilSubsidy() == null : this.getGasOilSubsidy().equals(other.getGasOilSubsidy()))
&& (this.getGasLitersPreferences() == null ? other.getGasLitersPreferences() == null : this.getGasLitersPreferences().equals(other.getGasLitersPreferences()))
&& (this.getGasPricePreferences() == null ? other.getGasPricePreferences() == null : this.getGasPricePreferences().equals(other.getGasPricePreferences()))
&& (this.getGasStaffId() == null ? other.getGasStaffId() == null : this.getGasStaffId().equals(other.getGasStaffId()))
&& (this.getGasStaffName() == null ? other.getGasStaffName() == null : this.getGasStaffName().equals(other.getGasStaffName()))
&& (this.getGasSalesmanId() == null ? other.getGasSalesmanId() == null : this.getGasSalesmanId().equals(other.getGasSalesmanId()))
&& (this.getGasSalesmanName() == null ? other.getGasSalesmanName() == null : this.getGasSalesmanName().equals(other.getGasSalesmanName()))
&& (this.getGasAgentId() == null ? other.getGasAgentId() == null : this.getGasAgentId().equals(other.getGasAgentId()))
@ -663,6 +691,8 @@ public class HighChildOrder implements Serializable {
result = prime * result + ((getGasOilSubsidy() == null) ? 0 : getGasOilSubsidy().hashCode());
result = prime * result + ((getGasLitersPreferences() == null) ? 0 : getGasLitersPreferences().hashCode());
result = prime * result + ((getGasPricePreferences() == null) ? 0 : getGasPricePreferences().hashCode());
result = prime * result + ((getGasStaffId() == null) ? 0 : getGasStaffId().hashCode());
result = prime * result + ((getGasStaffName() == null) ? 0 : getGasStaffName().hashCode());
result = prime * result + ((getGasSalesmanId() == null) ? 0 : getGasSalesmanId().hashCode());
result = prime * result + ((getGasSalesmanName() == null) ? 0 : getGasSalesmanName().hashCode());
result = prime * result + ((getGasAgentId() == null) ? 0 : getGasAgentId().hashCode());
@ -716,6 +746,8 @@ public class HighChildOrder implements Serializable {
sb.append(", gasOilSubsidy=").append(gasOilSubsidy);
sb.append(", gasLitersPreferences=").append(gasLitersPreferences);
sb.append(", gasPricePreferences=").append(gasPricePreferences);
sb.append(", gasStaffId=").append(gasStaffId);
sb.append(", gasStaffName=").append(gasStaffName);
sb.append(", gasSalesmanId=").append(gasSalesmanId);
sb.append(", gasSalesmanName=").append(gasSalesmanName);
sb.append(", gasAgentId=").append(gasAgentId);

@ -2135,6 +2135,136 @@ public class HighChildOrderExample {
return (Criteria) this;
}
public Criteria andGasStaffIdIsNull() {
addCriterion("gas_staff_id is null");
return (Criteria) this;
}
public Criteria andGasStaffIdIsNotNull() {
addCriterion("gas_staff_id is not null");
return (Criteria) this;
}
public Criteria andGasStaffIdEqualTo(Long value) {
addCriterion("gas_staff_id =", value, "gasStaffId");
return (Criteria) this;
}
public Criteria andGasStaffIdNotEqualTo(Long value) {
addCriterion("gas_staff_id <>", value, "gasStaffId");
return (Criteria) this;
}
public Criteria andGasStaffIdGreaterThan(Long value) {
addCriterion("gas_staff_id >", value, "gasStaffId");
return (Criteria) this;
}
public Criteria andGasStaffIdGreaterThanOrEqualTo(Long value) {
addCriterion("gas_staff_id >=", value, "gasStaffId");
return (Criteria) this;
}
public Criteria andGasStaffIdLessThan(Long value) {
addCriterion("gas_staff_id <", value, "gasStaffId");
return (Criteria) this;
}
public Criteria andGasStaffIdLessThanOrEqualTo(Long value) {
addCriterion("gas_staff_id <=", value, "gasStaffId");
return (Criteria) this;
}
public Criteria andGasStaffIdIn(List<Long> values) {
addCriterion("gas_staff_id in", values, "gasStaffId");
return (Criteria) this;
}
public Criteria andGasStaffIdNotIn(List<Long> values) {
addCriterion("gas_staff_id not in", values, "gasStaffId");
return (Criteria) this;
}
public Criteria andGasStaffIdBetween(Long value1, Long value2) {
addCriterion("gas_staff_id between", value1, value2, "gasStaffId");
return (Criteria) this;
}
public Criteria andGasStaffIdNotBetween(Long value1, Long value2) {
addCriterion("gas_staff_id not between", value1, value2, "gasStaffId");
return (Criteria) this;
}
public Criteria andGasStaffNameIsNull() {
addCriterion("gas_staff_name is null");
return (Criteria) this;
}
public Criteria andGasStaffNameIsNotNull() {
addCriterion("gas_staff_name is not null");
return (Criteria) this;
}
public Criteria andGasStaffNameEqualTo(String value) {
addCriterion("gas_staff_name =", value, "gasStaffName");
return (Criteria) this;
}
public Criteria andGasStaffNameNotEqualTo(String value) {
addCriterion("gas_staff_name <>", value, "gasStaffName");
return (Criteria) this;
}
public Criteria andGasStaffNameGreaterThan(String value) {
addCriterion("gas_staff_name >", value, "gasStaffName");
return (Criteria) this;
}
public Criteria andGasStaffNameGreaterThanOrEqualTo(String value) {
addCriterion("gas_staff_name >=", value, "gasStaffName");
return (Criteria) this;
}
public Criteria andGasStaffNameLessThan(String value) {
addCriterion("gas_staff_name <", value, "gasStaffName");
return (Criteria) this;
}
public Criteria andGasStaffNameLessThanOrEqualTo(String value) {
addCriterion("gas_staff_name <=", value, "gasStaffName");
return (Criteria) this;
}
public Criteria andGasStaffNameLike(String value) {
addCriterion("gas_staff_name like", value, "gasStaffName");
return (Criteria) this;
}
public Criteria andGasStaffNameNotLike(String value) {
addCriterion("gas_staff_name not like", value, "gasStaffName");
return (Criteria) this;
}
public Criteria andGasStaffNameIn(List<String> values) {
addCriterion("gas_staff_name in", values, "gasStaffName");
return (Criteria) this;
}
public Criteria andGasStaffNameNotIn(List<String> values) {
addCriterion("gas_staff_name not in", values, "gasStaffName");
return (Criteria) this;
}
public Criteria andGasStaffNameBetween(String value1, String value2) {
addCriterion("gas_staff_name between", value1, value2, "gasStaffName");
return (Criteria) this;
}
public Criteria andGasStaffNameNotBetween(String value1, String value2) {
addCriterion("gas_staff_name not between", value1, value2, "gasStaffName");
return (Criteria) this;
}
public Criteria andGasSalesmanIdIsNull() {
addCriterion("gas_salesman_id is null");
return (Criteria) this;

@ -69,6 +69,11 @@ public class HighDiscount implements Serializable {
*/
private BigDecimal discountPrice;
/**
* 领取次数
*/
private Integer receiveNumber;
/**
* 领取有效天数
*/
@ -200,6 +205,14 @@ public class HighDiscount implements Serializable {
this.discountPrice = discountPrice;
}
public Integer getReceiveNumber() {
return receiveNumber;
}
public void setReceiveNumber(Integer receiveNumber) {
this.receiveNumber = receiveNumber;
}
public Integer getEffectiveDay() {
return effectiveDay;
}
@ -303,6 +316,7 @@ public class HighDiscount implements Serializable {
&& (this.getDiscountType() == null ? other.getDiscountType() == null : this.getDiscountType().equals(other.getDiscountType()))
&& (this.getDiscountCondition() == null ? other.getDiscountCondition() == null : this.getDiscountCondition().equals(other.getDiscountCondition()))
&& (this.getDiscountPrice() == null ? other.getDiscountPrice() == null : this.getDiscountPrice().equals(other.getDiscountPrice()))
&& (this.getReceiveNumber() == null ? other.getReceiveNumber() == null : this.getReceiveNumber().equals(other.getReceiveNumber()))
&& (this.getEffectiveDay() == null ? other.getEffectiveDay() == null : this.getEffectiveDay().equals(other.getEffectiveDay()))
&& (this.getSalesEndTime() == null ? other.getSalesEndTime() == null : this.getSalesEndTime().equals(other.getSalesEndTime()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
@ -330,6 +344,7 @@ public class HighDiscount implements Serializable {
result = prime * result + ((getDiscountType() == null) ? 0 : getDiscountType().hashCode());
result = prime * result + ((getDiscountCondition() == null) ? 0 : getDiscountCondition().hashCode());
result = prime * result + ((getDiscountPrice() == null) ? 0 : getDiscountPrice().hashCode());
result = prime * result + ((getReceiveNumber() == null) ? 0 : getReceiveNumber().hashCode());
result = prime * result + ((getEffectiveDay() == null) ? 0 : getEffectiveDay().hashCode());
result = prime * result + ((getSalesEndTime() == null) ? 0 : getSalesEndTime().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
@ -360,6 +375,7 @@ public class HighDiscount implements Serializable {
sb.append(", discountType=").append(discountType);
sb.append(", discountCondition=").append(discountCondition);
sb.append(", discountPrice=").append(discountPrice);
sb.append(", receiveNumber=").append(receiveNumber);
sb.append(", effectiveDay=").append(effectiveDay);
sb.append(", salesEndTime=").append(salesEndTime);
sb.append(", createTime=").append(createTime);

@ -826,6 +826,66 @@ public class HighDiscountExample {
return (Criteria) this;
}
public Criteria andReceiveNumberIsNull() {
addCriterion("receive_number is null");
return (Criteria) this;
}
public Criteria andReceiveNumberIsNotNull() {
addCriterion("receive_number is not null");
return (Criteria) this;
}
public Criteria andReceiveNumberEqualTo(Integer value) {
addCriterion("receive_number =", value, "receiveNumber");
return (Criteria) this;
}
public Criteria andReceiveNumberNotEqualTo(Integer value) {
addCriterion("receive_number <>", value, "receiveNumber");
return (Criteria) this;
}
public Criteria andReceiveNumberGreaterThan(Integer value) {
addCriterion("receive_number >", value, "receiveNumber");
return (Criteria) this;
}
public Criteria andReceiveNumberGreaterThanOrEqualTo(Integer value) {
addCriterion("receive_number >=", value, "receiveNumber");
return (Criteria) this;
}
public Criteria andReceiveNumberLessThan(Integer value) {
addCriterion("receive_number <", value, "receiveNumber");
return (Criteria) this;
}
public Criteria andReceiveNumberLessThanOrEqualTo(Integer value) {
addCriterion("receive_number <=", value, "receiveNumber");
return (Criteria) this;
}
public Criteria andReceiveNumberIn(List<Integer> values) {
addCriterion("receive_number in", values, "receiveNumber");
return (Criteria) this;
}
public Criteria andReceiveNumberNotIn(List<Integer> values) {
addCriterion("receive_number not in", values, "receiveNumber");
return (Criteria) this;
}
public Criteria andReceiveNumberBetween(Integer value1, Integer value2) {
addCriterion("receive_number between", value1, value2, "receiveNumber");
return (Criteria) this;
}
public Criteria andReceiveNumberNotBetween(Integer value1, Integer value2) {
addCriterion("receive_number not between", value1, value2, "receiveNumber");
return (Criteria) this;
}
public Criteria andEffectiveDayIsNull() {
addCriterion("effective_day is null");
return (Criteria) this;

@ -48,6 +48,11 @@ public class HighGasStaff implements Serializable {
*/
private String positionName;
/**
* 二维码图片地址
*/
private String qrCodeImgUrl;
/**
* 状态 0删除 1正常 2禁用
*/
@ -127,6 +132,14 @@ public class HighGasStaff implements Serializable {
this.positionName = positionName;
}
public String getQrCodeImgUrl() {
return qrCodeImgUrl;
}
public void setQrCodeImgUrl(String qrCodeImgUrl) {
this.qrCodeImgUrl = qrCodeImgUrl;
}
public Integer getStatus() {
return status;
}
@ -194,6 +207,7 @@ public class HighGasStaff implements Serializable {
&& (this.getTelephone() == null ? other.getTelephone() == null : this.getTelephone().equals(other.getTelephone()))
&& (this.getPositionType() == null ? other.getPositionType() == null : this.getPositionType().equals(other.getPositionType()))
&& (this.getPositionName() == null ? other.getPositionName() == null : this.getPositionName().equals(other.getPositionName()))
&& (this.getQrCodeImgUrl() == null ? other.getQrCodeImgUrl() == null : this.getQrCodeImgUrl().equals(other.getQrCodeImgUrl()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
@ -213,6 +227,7 @@ public class HighGasStaff implements Serializable {
result = prime * result + ((getTelephone() == null) ? 0 : getTelephone().hashCode());
result = prime * result + ((getPositionType() == null) ? 0 : getPositionType().hashCode());
result = prime * result + ((getPositionName() == null) ? 0 : getPositionName().hashCode());
result = prime * result + ((getQrCodeImgUrl() == null) ? 0 : getQrCodeImgUrl().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
@ -235,6 +250,7 @@ public class HighGasStaff implements Serializable {
sb.append(", telephone=").append(telephone);
sb.append(", positionType=").append(positionType);
sb.append(", positionName=").append(positionName);
sb.append(", qrCodeImgUrl=").append(qrCodeImgUrl);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);

@ -585,6 +585,76 @@ public class HighGasStaffExample {
return (Criteria) this;
}
public Criteria andQrCodeImgUrlIsNull() {
addCriterion("qr_code_img_url is null");
return (Criteria) this;
}
public Criteria andQrCodeImgUrlIsNotNull() {
addCriterion("qr_code_img_url is not null");
return (Criteria) this;
}
public Criteria andQrCodeImgUrlEqualTo(String value) {
addCriterion("qr_code_img_url =", value, "qrCodeImgUrl");
return (Criteria) this;
}
public Criteria andQrCodeImgUrlNotEqualTo(String value) {
addCriterion("qr_code_img_url <>", value, "qrCodeImgUrl");
return (Criteria) this;
}
public Criteria andQrCodeImgUrlGreaterThan(String value) {
addCriterion("qr_code_img_url >", value, "qrCodeImgUrl");
return (Criteria) this;
}
public Criteria andQrCodeImgUrlGreaterThanOrEqualTo(String value) {
addCriterion("qr_code_img_url >=", value, "qrCodeImgUrl");
return (Criteria) this;
}
public Criteria andQrCodeImgUrlLessThan(String value) {
addCriterion("qr_code_img_url <", value, "qrCodeImgUrl");
return (Criteria) this;
}
public Criteria andQrCodeImgUrlLessThanOrEqualTo(String value) {
addCriterion("qr_code_img_url <=", value, "qrCodeImgUrl");
return (Criteria) this;
}
public Criteria andQrCodeImgUrlLike(String value) {
addCriterion("qr_code_img_url like", value, "qrCodeImgUrl");
return (Criteria) this;
}
public Criteria andQrCodeImgUrlNotLike(String value) {
addCriterion("qr_code_img_url not like", value, "qrCodeImgUrl");
return (Criteria) this;
}
public Criteria andQrCodeImgUrlIn(List<String> values) {
addCriterion("qr_code_img_url in", values, "qrCodeImgUrl");
return (Criteria) this;
}
public Criteria andQrCodeImgUrlNotIn(List<String> values) {
addCriterion("qr_code_img_url not in", values, "qrCodeImgUrl");
return (Criteria) this;
}
public Criteria andQrCodeImgUrlBetween(String value1, String value2) {
addCriterion("qr_code_img_url between", value1, value2, "qrCodeImgUrl");
return (Criteria) this;
}
public Criteria andQrCodeImgUrlNotBetween(String value1, String value2) {
addCriterion("qr_code_img_url not between", value1, value2, "qrCodeImgUrl");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;

@ -202,6 +202,16 @@ public class HighOrder implements Serializable {
private Boolean isTyAgent;
private String gasStaffCode;
public String getGasStaffCode() {
return gasStaffCode;
}
public void setGasStaffCode(String gasStaffCode) {
this.gasStaffCode = gasStaffCode;
}
public List<HighChildOrder> getHighChildOrderList() {
return highChildOrderList;
}

@ -6,6 +6,7 @@ package com.hai.enum_type;
*/
public enum GasPositionType {
status1(1 , "收银员"),
status2(2 , "加油员"),
;
private Integer status;

@ -12,6 +12,7 @@ public enum UserObjectTypeEnum {
type5(5, "充值后台工商"),
type6(6, "团油代理商"),
type7(7, "团油业务员"),
type8(8, "加油站员工"),
;
private Integer type;

@ -21,6 +21,7 @@ public class GasOrderModel {
private String gasLogo;
private String gasName;
private String gasAddress;
private String gasStaffName;
private String gasOilType;
private String gasOilNo;
private String gasGunNo;
@ -38,6 +39,14 @@ public class GasOrderModel {
private Boolean printStatus;
private Integer printNum;
public String getGasStaffName() {
return gasStaffName;
}
public void setGasStaffName(String gasStaffName) {
this.gasStaffName = gasStaffName;
}
public String getMerPhone() {
return merPhone;
}

@ -33,6 +33,13 @@ public interface HighDiscountService {
**/
HighDiscount getDiscountById(Long id);
/**
* 根据优惠券key查询
* @param discountKey
* @return
*/
HighDiscount getDiscountByKey(String discountKey);
/**
* @Author 胡锐
* @Description 查询优惠券列表

@ -15,11 +15,18 @@ public interface HighDiscountUserRelService {
/**
* @Author 胡锐
* @Description 领取优惠券
* @Description 领取优惠券code
* @Date 2021/4/4 15:12
**/
void receiveDiscount(Long userId,Long codeId);
/**
* @Author 胡锐
* @Description 领取优惠券
* @Date 2021/4/4 15:12
**/
void receive(Long userId, Long discountAgentId);
/**
* @Author 胡锐
* @Description 修改
@ -62,5 +69,12 @@ public interface HighDiscountUserRelService {
**/
List<HighDiscountUserRel> getExpiredDiscount();
/**
* 领取优惠券统计
* @param userId
* @param discountId
* @return
*/
Integer receiveDiscountCount(Long userId,Long discountId);
}

@ -406,6 +406,14 @@ public interface HighOrderService {
*/
Map<String, Object> getGasTheDayOrderCount(Long storeId, String status);
/**
* 查询加油站工作人员当天统计
* @param gasStaffId
* @param status
* @return
*/
Map<String, Object> getGasStaffTheDayOrderCount(Long gasStaffId, String status);
/**
* 查询加油站历史统计
* @param storeId
@ -414,6 +422,14 @@ public interface HighOrderService {
*/
Map<String, Object> getGasHistoryOrderCount(Long storeId, String status);
/**
* 查询加油站加油员历史统计
* @param gasStaffId
* @param status
* @return
*/
Map<String, Object> getGasStaffHistoryOrderCount(Long gasStaffId, String status);
/**
* 查询加油站订单列表
* @param param

@ -574,6 +574,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
}
@Override
@Transactional(rollbackFor=Exception.class,isolation = Isolation.SERIALIZABLE,propagation= Propagation.REQUIRES_NEW)
public Map<String, Object> pushGzSinopec(Long couponAgentRelId, String phone, String remark) throws Exception {
// 查询兑换码
HighCouponAgentCode convertCode = getCodeById(couponAgentRelId);

@ -39,6 +39,17 @@ public class HighDiscountServiceImpl implements HighDiscountService {
return highDiscountMapper.selectByPrimaryKey(id);
}
@Override
public HighDiscount getDiscountByKey(String discountKey) {
HighDiscountExample example = new HighDiscountExample();
example.createCriteria().andDiscountKeyEqualTo(discountKey).andStatusNotEqualTo(0);
List<HighDiscount> list = highDiscountMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public List<HighDiscount> getDiscount(Map<String, Object> map) {
HighDiscountExample example = new HighDiscountExample();

@ -51,7 +51,6 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic
if(code == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "二维码不存在");
}
// 状态 0:删除 1:待领取 2:待使用 3:已使用 4:已过期 5: 已分配
if(code.getStatus() != 1 && code.getStatus() != 5) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "二维码不存在或已被领取");
@ -67,6 +66,18 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic
rel.setStockCount(rel.getStockCount() - 1);
highDiscountAgentRelService.updateDiscountAgentRel(rel);
// 查询优惠券信息
HighDiscount discount = highDiscountService.getDiscountById(rel.getDiscountId());
if (discount == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的优惠券信息");
}
if (!discount.getStatus().equals(2)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法领取,优惠券活动已过期");
}
if (discount.getReceiveNumber() > 0 && this.receiveDiscountCount(userId, discount.getId()).intValue() >= discount.getReceiveNumber().intValue()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券已达到上线");
}
// 校验卡卷状态
if (rel.getHighDiscount().getStatus() != 2) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法领取,优惠券已过期");
@ -106,6 +117,61 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW,isolation= Isolation.SERIALIZABLE)
public void receive(Long userId, Long discountAgentId) {
// 查询优惠券与代理商关系
HighDiscountAgentRel discountAgentRel = highDiscountAgentRelService.getRelById(discountAgentId);
if (discountAgentRel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知优惠券");
}
// 查询优惠券信息
HighDiscount discount = discountAgentRel.getHighDiscount();
if (discount == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知优惠券");
}
if (!discount.getStatus().equals(2)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法领取,优惠券活动已过期");
}
if (discount.getReceiveNumber() > 0 && this.receiveDiscountCount(userId, discount.getId()) >= discount.getReceiveNumber()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "领取数量已达到上线");
}
// 查询可分配的优惠券code
List<HighDiscountAgentCode> discountAgentCodeList = highDiscountAgentCodeService.getDiscountCodeByStatus(discountAgentRel.getId(), 1);
if (discountAgentCodeList.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券已无库存");
}
HighDiscountAgentCode code = discountAgentCodeList.get(0);
code.setStatus(2);
highDiscountAgentCodeService.updateCode(code);
// 查询优惠券信息
discountAgentRel.setStockCount(discountAgentRel.getStockCount() - 1);
highDiscountAgentRelService.updateDiscountAgentRel(discountAgentRel);
HighDiscountUserRel userRel = new HighDiscountUserRel();
userRel.setDiscountId(discountAgentRel.getDiscountId());
userRel.setAgentId(discountAgentRel.getAgentId());
userRel.setUserId(userId);
userRel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
userRel.setCreateTime(new Date());
userRel.setDiscountAgentCodeId(code.getId());
// 计算使用有效期
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, discountAgentRel.getHighDiscount().getEffectiveDay());
if (userEndTime.getTime().compareTo(discountAgentRel.getHighDiscount().getSalesEndTime()) == 1) {
userRel.setUseEndTime(discountAgentRel.getHighDiscount().getSalesEndTime());
} else {
userRel.setUseEndTime(userEndTime.getTime());
}
highDiscountUserRelMapper.insert(userRel);
}
@Override
public void updateDiscountUserRel(HighDiscountUserRel highDiscountUserRel) {
highDiscountUserRelMapper.updateByPrimaryKey(highDiscountUserRel);
@ -171,4 +237,9 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic
example.createCriteria().andStatusEqualTo(1).andUseEndTimeLessThanOrEqualTo(new Date());
return highDiscountUserRelMapper.selectByExample(example);
}
@Override
public Integer receiveDiscountCount(Long userId, Long discountId) {
return highDiscountUserRelMapper.receiveDiscountCount(userId, discountId);
}
}

@ -57,6 +57,8 @@ public class HighGasStaffServiceImpl implements HighGasStaffService {
Long roleId;
if (gasStaff.getPositionType().equals(GasPositionType.status1.getStatus())) {
roleId = 100L;
} else if (gasStaff.getPositionType().equals(GasPositionType.status2.getStatus())) {
roleId = 101L;
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知角色");
}

@ -1630,11 +1630,21 @@ public class HighOrderServiceImpl implements HighOrderService {
return highOrderMapperExt.selectGasTheDayOrderCount(storeId,status);
}
@Override
public Map<String, Object> getGasStaffTheDayOrderCount(Long gasStaffId, String status) {
return highOrderMapperExt.selectGasStaffTheDayOrderCount(gasStaffId,status);
}
@Override
public Map<String, Object> getGasHistoryOrderCount(Long storeId, String status) {
return highOrderMapperExt.selectGasHistoryOrderCount(storeId,status);
}
@Override
public Map<String, Object> getGasStaffHistoryOrderCount(Long gasStaffId, String status) {
return highOrderMapperExt.selectGasStaffHistoryOrderCount(gasStaffId,status);
}
@Override
public List<GasOrderModel> getGasOrderList(Map<String, Object> param) throws Exception {
if (MapUtils.getLong(param, "createTimeS") != null) {

Loading…
Cancel
Save