diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java index 220551ad..7da0f4ff 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.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); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java index 02745192..79847183 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java @@ -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 = "查询列表") diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java index 81e5744c..c7efd61b 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java @@ -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!","参数错误"); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java b/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java index 056bd7be..d2eeb5d8 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java @@ -111,41 +111,80 @@ public class HighGasController { Map param = new HashMap<>();; param.put("gasName", userInfoModel.getMerchantStore().getStoreName()); - Map history = new HashMap<>(); - // 历史加油总金额 - Map historyTotal = highOrderService.getGasHistoryOrderCount(userInfoModel.getMerchantStore().getId(), "2,3,4,6,7"); - history.put("totalPrice", historyTotal.get("price")); - history.put("totalCount", historyTotal.get("count")); - - // 历史加油金额 - Map historyIncomet = highOrderService.getGasHistoryOrderCount(userInfoModel.getMerchantStore().getId(), "2,3,6,7"); - history.put("incomePrice", historyIncomet.get("price")); - history.put("incomeCount", historyIncomet.get("count")); - - // 历史退款 - Map historyRefund = highOrderService.getGasHistoryOrderCount(userInfoModel.getMerchantStore().getId(), "4"); - history.put("refundPrice", historyRefund.get("price")); - history.put("refundCount", historyRefund.get("count")); - param.put("history", history); - - - Map today = new HashMap<>(); - // 今日加油总金额 - Map todayTotal = highOrderService.getGasTheDayOrderCount(userInfoModel.getMerchantStore().getId(), "2,3,4,6,7"); - today.put("totalPrice", todayTotal.get("price")); - today.put("totalCount", todayTotal.get("count")); - - // 今日加油金额 - Map todayIncomet = highOrderService.getGasTheDayOrderCount(userInfoModel.getMerchantStore().getId(), "2,3,6,7"); - today.put("incomePrice", todayIncomet.get("price")); - today.put("incomeCount", todayIncomet.get("count")); - - // 今日退款 - Map todayRefund = highOrderService.getGasTheDayOrderCount(userInfoModel.getMerchantStore().getId(), "4"); - today.put("refundPrice", todayRefund.get("price")); - today.put("refundCount", todayRefund.get("count")); - param.put("today", today); + if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type8.getType()) + && userInfoModel.getGasStaff().getPositionType().equals(GasPositionType.status2.getStatus())) { + + Map history = new HashMap<>(); + // 历史加油总金额 + Map historyTotal = highOrderService.getGasStaffHistoryOrderCount(userInfoModel.getGasStaff().getId(), "2,3,4,6,7"); + history.put("totalPrice", historyTotal.get("price")); + history.put("totalCount", historyTotal.get("count")); + + // 历史加油金额 + Map historyIncomet = highOrderService.getGasStaffHistoryOrderCount(userInfoModel.getGasStaff().getId(), "2,3,6,7"); + history.put("incomePrice", historyIncomet.get("price")); + history.put("incomeCount", historyIncomet.get("count")); + + // 历史退款 + Map historyRefund = highOrderService.getGasStaffHistoryOrderCount(userInfoModel.getGasStaff().getId(), "4"); + history.put("refundPrice", historyRefund.get("price")); + history.put("refundCount", historyRefund.get("count")); + param.put("history", history); + + + Map today = new HashMap<>(); + // 今日加油总金额 + Map todayTotal = highOrderService.getGasStaffTheDayOrderCount(userInfoModel.getGasStaff().getId(), "2,3,4,6,7"); + today.put("totalPrice", todayTotal.get("price")); + today.put("totalCount", todayTotal.get("count")); + + // 今日加油金额 + Map todayIncomet = highOrderService.getGasStaffTheDayOrderCount(userInfoModel.getGasStaff().getId(), "2,3,6,7"); + today.put("incomePrice", todayIncomet.get("price")); + today.put("incomeCount", todayIncomet.get("count")); + + // 今日退款 + Map 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 history = new HashMap<>(); + // 历史加油总金额 + Map historyTotal = highOrderService.getGasHistoryOrderCount(userInfoModel.getMerchantStore().getId(), "2,3,4,6,7"); + history.put("totalPrice", historyTotal.get("price")); + history.put("totalCount", historyTotal.get("count")); + + // 历史加油金额 + Map historyIncomet = highOrderService.getGasHistoryOrderCount(userInfoModel.getMerchantStore().getId(), "2,3,6,7"); + history.put("incomePrice", historyIncomet.get("price")); + history.put("incomeCount", historyIncomet.get("count")); + + // 历史退款 + Map historyRefund = highOrderService.getGasHistoryOrderCount(userInfoModel.getMerchantStore().getId(), "4"); + history.put("refundPrice", historyRefund.get("price")); + history.put("refundCount", historyRefund.get("count")); + param.put("history", history); + + + Map today = new HashMap<>(); + // 今日加油总金额 + Map todayTotal = highOrderService.getGasTheDayOrderCount(userInfoModel.getMerchantStore().getId(), "2,3,4,6,7"); + today.put("totalPrice", todayTotal.get("price")); + today.put("totalCount", todayTotal.get("count")); + + // 今日加油金额 + Map todayIncomet = highOrderService.getGasTheDayOrderCount(userInfoModel.getMerchantStore().getId(), "2,3,6,7"); + today.put("incomePrice", todayIncomet.get("price")); + today.put("incomeCount", todayIncomet.get("count")); + + // 今日退款 + Map todayRefund = highOrderService.getGasTheDayOrderCount(userInfoModel.getMerchantStore().getId(), "4"); + 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 param = new HashMap<>();; + Map 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)) { - param.put("storeId", userInfoModel.getMerchantStore().getId()); - + 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)) { - param.put("storeId", userInfoModel.getMerchantStore().getId()); - + 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 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); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighGasStaffController.java b/hai-bweb/src/main/java/com/bweb/controller/HighGasStaffController.java index c1f58211..1f2778d1 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighGasStaffController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighGasStaffController.java @@ -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 = "禁用员工") diff --git a/hai-bweb/src/main/resources/dev/config.properties b/hai-bweb/src/main/resources/dev/config.properties index 25674f3d..da0992f7 100644 --- a/hai-bweb/src/main/resources/dev/config.properties +++ b/hai-bweb/src/main/resources/dev/config.properties @@ -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= diff --git a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java index 8f932e5a..ff756154 100644 --- a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java +++ b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java @@ -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") diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java b/hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java index 3882861b..17211dd8 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java @@ -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 diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java index 6809c109..b05d8989 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -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) { diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java index 3e36638f..20a01b23 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java @@ -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 = "获取用户的优惠券列表") diff --git a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java index 861a9056..8ca10f21 100644 --- a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java +++ b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java @@ -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",""), diff --git a/hai-service/src/main/java/com/hai/common/security/AESEncodeUtil.java b/hai-service/src/main/java/com/hai/common/security/AESEncodeUtil.java index 81c35c16..b967be6c 100644 --- a/hai-service/src/main/java/com/hai/common/security/AESEncodeUtil.java +++ b/hai-service/src/main/java/com/hai/common/security/AESEncodeUtil.java @@ -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); diff --git a/hai-service/src/main/java/com/hai/dao/HighChildOrderMapper.java b/hai-service/src/main/java/com/hai/dao/HighChildOrderMapper.java index 01b0ad14..e252526a 100644 --- a/hai-service/src/main/java/com/hai/dao/HighChildOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighChildOrderMapper.java @@ -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},", diff --git a/hai-service/src/main/java/com/hai/dao/HighChildOrderSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighChildOrderSqlProvider.java index bde7e53c..80f9f769 100644 --- a/hai-service/src/main/java/com/hai/dao/HighChildOrderSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighChildOrderSqlProvider.java @@ -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}"); } diff --git a/hai-service/src/main/java/com/hai/dao/HighDiscountMapper.java b/hai-service/src/main/java/com/hai/dao/HighDiscountMapper.java index ed572474..065d24f5 100644 --- a/hai-service/src/main/java/com/hai/dao/HighDiscountMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighDiscountMapper.java @@ -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},", diff --git a/hai-service/src/main/java/com/hai/dao/HighDiscountSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighDiscountSqlProvider.java index 2fb12c2b..523d6f76 100644 --- a/hai-service/src/main/java/com/hai/dao/HighDiscountSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighDiscountSqlProvider.java @@ -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}"); } diff --git a/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapperExt.java index bb221edb..ae6b984c 100644 --- a/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapperExt.java @@ -39,4 +39,8 @@ public interface HighDiscountUserRelMapperExt { " ORDER BY hdur.create_time desc" + ""}) List getUserCouponsList(@Param("map") Map map); + + + @Select({""}) + Integer receiveDiscountCount(@Param("userId") Long userId, @Param("discountId") Long discountId); } diff --git a/hai-service/src/main/java/com/hai/dao/HighGasStaffMapper.java b/hai-service/src/main/java/com/hai/dao/HighGasStaffMapper.java index ef3c8780..eda69347 100644 --- a/hai-service/src/main/java/com/hai/dao/HighGasStaffMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighGasStaffMapper.java @@ -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},", diff --git a/hai-service/src/main/java/com/hai/dao/HighGasStaffSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighGasStaffSqlProvider.java index 620cccd1..d0f2fec5 100644 --- a/hai-service/src/main/java/com/hai/dao/HighGasStaffSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighGasStaffSqlProvider.java @@ -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}"); } diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java index 189a86f2..1f78bc3a 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -1081,6 +1081,14 @@ public interface HighOrderMapperExt { " and to_days(pay_time) = to_days(now())"}) Map 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 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 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 selectGasStaffHistoryOrderCount(@Param("gasStaffId") Long gasStaffId, @Param("status") String status); + @Select({ "