diff --git a/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java b/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java index 1afd1921..cd59ca2f 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java @@ -141,12 +141,14 @@ public class BsDistributionUserRelController { @ResponseBody @ApiOperation(value = "B端查询代理商订单") public ResponseData orderListByAgentId(@RequestParam(name = "agentId", required = false) Long agentId, + @RequestParam(name = "code", required = false) Long code, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize) { try { Map map = new HashMap<>(); map.put("agentId" , agentId); + map.put("code" , code); PageHelper.startPage(pageNum,pageSize); return ResponseMsgUtil.success(new PageInfo<>(highOrderService.orderListByAgentId(map))); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java b/hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java index d9eb314b..6ef83480 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java @@ -8,6 +8,7 @@ import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; +import com.hai.common.utils.DateUtil; import com.hai.common.utils.ResponseMsgUtil; import com.hai.entity.HighApprove; import com.hai.enum_type.ApproveType; @@ -145,4 +146,37 @@ public class HighApproveController { return ResponseMsgUtil.exception(e); } } + + @RequestMapping(value="/addApprove",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "添加审批") + public ResponseData addApprove(@RequestBody JSONObject object ,HttpServletRequest request) { + try { + + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + HighApprove approve = new HighApprove(); + + approve.setObjectId(99L); + approve.setObjectName("卡券分发审批"); + approve.setApproveSerialNo(DateUtil.date2String(new Date(), "yyyyMMddHHmmss")); + approve.setStatus(1); + approve.setCreateTime(new Date()); + approve.setUpdateTime(new Date()); + approve.setSubmitOperatorId(userInfoModel.getSecUser().getId()); + approve.setSubmitOperatorName(userInfoModel.getSecUser().getUserName()); + approve.setObjectType(object.getInteger("objectType")); + approve.setApproveObject(object.getJSONObject("approveObject").toJSONString()); + + highApproveService.insertApprove(approve); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error("HighCouponController -> approveProcessed() error!",e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java index efd350f2..5b41ccf7 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java @@ -773,4 +773,27 @@ public class HighCouponController { } } + @RequestMapping(value="/getCouponListByAll",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询所有卡卷列表") + public ResponseData getCouponListByAll(HttpServletRequest request) { + try { + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + if (userInfoModel.getBsCompany() == null) { + log.error("HighCouponController -> getCouponList() error!","权限不足"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + + Map map = new HashMap<>(3); + map.put("companyId", userInfoModel.getBsCompany().getId()); + map.put("status", 2); + + return ResponseMsgUtil.success(highCouponService.getCouponListByAll(map)); + } catch (Exception e) { + log.error("HighCouponController -> getCouponList() error!",e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java index ded4edef..2fbd7056 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java @@ -164,9 +164,9 @@ public class HighDiscountPackageController { if (StringUtils.isBlank(highDiscountPackage.getTitle()) || highDiscountPackage.getSalesType() == null -// || StringUtils.isBlank(highDiscountPackage.getBannerImg()) -// || StringUtils.isBlank(highDiscountPackage.getListImg()) -// || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) + || StringUtils.isBlank(highDiscountPackage.getBannerImg()) + || StringUtils.isBlank(highDiscountPackage.getListImg()) + || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) ) { log.error("HighAgentController -> insertCouponPackageInfo() error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); @@ -225,9 +225,9 @@ public class HighDiscountPackageController { if (StringUtils.isBlank(highDiscountPackage.getTitle()) || highDiscountPackage.getSalesType() == null || highDiscountPackage.getId() == null -// || StringUtils.isBlank(highDiscountPackage.getBannerImg()) -// || StringUtils.isBlank(highDiscountPackage.getListImg()) -// || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) + || StringUtils.isBlank(highDiscountPackage.getBannerImg()) + || StringUtils.isBlank(highDiscountPackage.getListImg()) + || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) ) { log.error("HighAgentController -> updateCouponPackageInfo() error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); diff --git a/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java index 344955be..1d771bb4 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java @@ -144,6 +144,7 @@ public class OutRechargeOrderController { @RequestParam(name = "payType", required = false) Integer payType, @RequestParam(name = "payTimeS", required = false) Long payTimeS, @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "whetherTimeOut", required = false) Boolean whetherTimeOut, @RequestParam(name = "createTimeS", required = false) Long createTimeS, @RequestParam(name = "createTimeE", required = false) Long createTimeE, @RequestParam(name = "pageNum", required = true) Integer pageNum, @@ -169,6 +170,7 @@ public class OutRechargeOrderController { map.put("rechargeStatus", rechargeStatus); map.put("payStatus", payStatus); map.put("orderNo", orderNo); + map.put("whetherTimeOut", whetherTimeOut); map.put("operatorType", operatorType); map.put("laborUnionCard", laborUnionCard); map.put("rechargeContent", rechargeContent); diff --git a/hai-cweb/src/main/java/com/cweb/controller/CommonController.java b/hai-cweb/src/main/java/com/cweb/controller/CommonController.java index e671ded5..9f7fa937 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/CommonController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/CommonController.java @@ -8,13 +8,9 @@ import com.hai.common.exception.SysCode; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; -import com.hai.entity.BsCompany; -import com.hai.entity.SecConfig; -import com.hai.entity.SecRegion; +import com.hai.entity.*; import com.hai.model.ResponseData; -import com.hai.service.BsCompanyService; -import com.hai.service.CommonService; -import com.hai.service.SecConfigService; +import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import me.chanjar.weixin.common.util.crypto.SHA1; @@ -24,6 +20,7 @@ import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -46,6 +43,11 @@ public class CommonController { @Resource private BsCompanyService bsCompanyService; + @Resource + private HighOrderService highOrderService; + + @Resource + private BsIntegralRebateService bsIntegralRebateService; @RequestMapping(value="/getDredgeProvince",method= RequestMethod.GET) @ResponseBody @@ -230,7 +232,7 @@ public class CommonController { } } - @RequestMapping(value = "/getScanCodePageHtmlSign", method = RequestMethod.POST) + @RequestMapping(value = "/ getScanCodePageHtmlSign", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "获取扫码页面签名") public ResponseData getScanCodePageHtmlSign(@RequestBody JSONObject body) { @@ -285,7 +287,115 @@ public class CommonController { ) { try { - return ResponseMsgUtil.success(commonService.findByLatAndLng(lng , lat)); + + JSONObject jsonObjectR = commonService.findByLatAndLng(lng , lat); + + if (!jsonObjectR.getString("status").equals("0")) { + log.error("findByLatAndLng error!", "定位错误,请重新定位" ); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "定位错误,请重新定位"); + } + + JSONObject object = commonService.findByLatAndLng(lng , lat).getJSONObject("result").getJSONObject("addressComponent"); + + + ApiCity apiCity = commonService.findCityByName(object.getString("city")); + + if (apiCity == null) { + log.error("findByLatAndLng error!", "当前城市暂未开通任何服务" ); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市"); + } + + BsCompany company = bsCompanyService.selectCompanyByRegion(apiCity.getProvinceCode()); + + if (company == null) { + log.error("findByLatAndLng error!", "当前城市暂未开通任何服务" ); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市"); + } + + JSONObject jsonObject = new JSONObject(); + + jsonObject.put("cityName" , apiCity.getCityName()); + jsonObject.put("provinceName" , apiCity.getProvinceName()); + jsonObject.put("regionId" , company.getRegionId()); + jsonObject.put("companyName" , company.getName()); + jsonObject.put("companyId" , company.getId()); + + return ResponseMsgUtil.success(jsonObject); + + } catch (Exception e) { + log.error("HighOrderController --> unionStagingPay() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/findCompanyByCityName", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "获取定位信息") + public ResponseData findCompanyByCityName( + @RequestParam(name = "cityName", required = true) String cityName + ) { + try { + + ApiCity apiCity = commonService.findCityByName(cityName); + + if (apiCity == null) { + log.error("findByLatAndLng error!", "当前城市暂未开通任何服务" ); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市"); + } + + BsCompany company = bsCompanyService.selectCompanyByRegion(apiCity.getProvinceCode()); + + if (company == null) { + log.error("findByLatAndLng error!", "当前城市暂未开通任何服务" ); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市"); + } + + JSONObject jsonObject = new JSONObject(); + + jsonObject.put("cityName" , apiCity.getCityName()); + jsonObject.put("provinceName" , apiCity.getProvinceName()); + jsonObject.put("regionId" , company.getRegionId()); + jsonObject.put("companyName" , company.getName()); + jsonObject.put("companyId" , company.getId()); + + return ResponseMsgUtil.success(jsonObject); + + } catch (Exception e) { + log.error("HighOrderController --> unionStagingPay() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getRebateIntegral", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "查询可获取返利积分") + public ResponseData getRebateIntegral(@RequestBody JSONObject object) { + try { + + if (object.getInteger("type") == null || + object.getLong("companyId") == null || + object.getLong("productId") == null || + object.getBigDecimal("price") == null + ) { + log.error("CommonController -> getRebateIntegral() error!","请求参数校验失败"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); + } + + // 查询订单来源 + Map map = new HashMap<>(); + map.put("type" , object.getInteger("type")); + map.put("productId" , object.getLong("productId")); + map.put("companyId" , object.getLong("companyId")); + + BsIntegralRebate bsIntegralRebate = bsIntegralRebateService.findIntegralRebateByMap(map); + + if (bsIntegralRebate == null) { + throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无积分返利活动"); + } + + BigDecimal integralNum = object.getBigDecimal("price").multiply(bsIntegralRebate.getPercentage()).setScale( 0, BigDecimal.ROUND_HALF_UP ); + + return ResponseMsgUtil.success(integralNum); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java index 35e62039..3aa4155b 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java @@ -126,8 +126,9 @@ public class HighGasController { for (Map map : mapPageInfo.getList()) { if (StringUtils.isNotBlank(MapUtils.getString(map, "oil_no"))) { - - if (MapUtils.getInteger(map, "source_type").equals(1)) { + if (MapUtils.getInteger(map, "source_type").equals(1) + || MapUtils.getInteger(map, "source_type").equals(3) + || MapUtils.getInteger(map, "source_type").equals(4)) { // 查询是否配置了【油站的】优惠比例 HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no")); if (tyAgentPrice != null) { diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java index 1f7a0e8b..ded7f07c 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java @@ -35,6 +35,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.math.RoundingMode; +import java.sql.Array; import java.util.*; import java.util.stream.Collectors; @@ -118,19 +119,44 @@ public class HighThirdPartyController { BigDecimal salesTallPrice = apiStarbucksProducts.getSalesTallPrice().add(apiStarbucksProducts.getMarketTallPrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP); BigDecimal salesGrandePrice = apiStarbucksProducts.getSalesGrandePrice().add(apiStarbucksProducts.getMarketGrandePrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP); - if (salesVentiPrice.compareTo(apiStarbucksProducts.getMarketVentiPrice()) > 0) { - salesVentiPrice = apiStarbucksProducts.getMarketVentiPrice(); - } + + + // 判断当前价格是否大雨原价 如果大于显示原价 if (salesTallPrice.compareTo(apiStarbucksProducts.getMarketTallPrice()) > 0) { salesTallPrice = apiStarbucksProducts.getMarketTallPrice(); } if (salesGrandePrice.compareTo(apiStarbucksProducts.getMarketGrandePrice()) > 0) { salesGrandePrice = apiStarbucksProducts.getMarketGrandePrice(); } + if (salesVentiPrice.compareTo(apiStarbucksProducts.getMarketVentiPrice()) > 0) { + salesVentiPrice = apiStarbucksProducts.getMarketVentiPrice(); + } + + String[] strings = apiStarbucksProducts.getCupSize().split(","); + + for (String string : strings) { + if ("中杯".equals(string)) { + apiStarbucksProducts.setShowPrice(salesTallPrice); + break; + } + if ("大杯".equals(string)) { + apiStarbucksProducts.setShowPrice(salesGrandePrice); + break; + } + if ("超大杯".equals(string)) { + apiStarbucksProducts.setShowPrice(salesVentiPrice); + break; + } + } + apiStarbucksProducts.setSalesVentiPrice(salesVentiPrice); apiStarbucksProducts.setSalesTallPrice(salesTallPrice); + apiStarbucksProducts.setCount(0); apiStarbucksProducts.setSalesGrandePrice(salesGrandePrice); - starbucksProductsList.add(apiStarbucksProducts); + if (apiStarbucksProducts.getShowPrice() != null) { + starbucksProductsList.add(apiStarbucksProducts); + } + } starbucksProducts.setName(s); starbucksProducts.setExt2(SysConst.getSysConfig().getImgUrl() + ProductImgEnum.getNameByImgUrl(s)); @@ -241,6 +267,7 @@ public class HighThirdPartyController { salePriceF = productsObject.getBigDecimal("originalPrice"); } productsObject.put("salePrice", salePriceF); + productsObject.put("count" , 0); if (productsObject.getJSONArray("specGroups") != null) { for (Object specGroups : productsObject.getJSONArray("specGroups")) { @@ -306,8 +333,6 @@ public class HighThirdPartyController { SessionObject sessionObject = userCenter.getSessionObject(request); HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); - System.out.println("======================================================" + object); - if (StringUtils.isBlank(object.getString("customerMobile")) || StringUtils.isBlank(object.getString("regionId")) || object.getInteger("productType") == null || diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java index 5c9fffb6..e9ee316e 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java @@ -55,6 +55,7 @@ public class HighUserCommonController { @ApiOperation(value = "登录接口【用户不存在会自动注册】") public ResponseData login(@RequestParam(value = "phone", required = true) String phone, @RequestParam(value = "code", required = true) String code, + @RequestParam(value = "openId", required = false) String openId, @RequestParam(value = "popularizeUserId", required = false) Long popularizeUserId, @RequestParam(value = "regionId", required = false) String regionId, HttpServletRequest request, HttpServletResponse response) { @@ -70,12 +71,16 @@ public class HighUserCommonController { redisUtil.del("SMS_"+phone); HighUser user = highUserService.findByPhone(phone); + + + if(user == null) { user = new HighUser(); user.setName("用户" + IDGenerator.nextId(5)); user.setPhone(phone); user.setRegTime(new Date()); user.setGold(0); + user.setOpenIdH5(openId); user.setStatus(1); // 用户信息完整状态 // 0:完整 @@ -84,6 +89,9 @@ public class HighUserCommonController { user.setInfoCompleteStatus(1); highUserService.insertUser(user , popularizeUserId , regionId); + } else { + user.setOpenIdH5(openId); + highUserService.updateUser(user); } HighUserModel highUserModel = new HighUserModel(); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java index 6a0fa5ae..7691bfef 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java @@ -148,7 +148,7 @@ public class HighUserController { if (StringUtils.isBlank(body.getString("password")) || body.getString("password").length() != 6){ log.error("HighUserController --> setUserPayPwd() error!", "请设置6位支付密码"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请设置6支付密码"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请设置6位支付密码"); } // 查询用户密码 diff --git a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java index 5de9c0b8..55c72c1b 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java @@ -332,4 +332,43 @@ public class WechatController { } } + @RequestMapping(value = "/getH5AccessByOpenId", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "【H5】通过openId查询") + public ResponseData getH5AccessByOpenId(@RequestParam(value = "openId", required = true) String openId, + HttpServletRequest request, HttpServletResponse response) { + try { + + HighUser user = highUserService.findByOpenIdH5(openId); + + if (user == null) { + user = new HighUser(); + user.setName("临时游客"); + user.setRegTime(new Date()); + user.setGold(0); + user.setOpenId(openId); + user.setStatus(1); + // 用户信息完整状态 + // 0:完整 + // 1:需要填写用户信息 + // 2:需要填写手机号 + user.setInfoCompleteStatus(1); + return ResponseMsgUtil.success(user); + } else { + // 定义个人所有数据 + HighUserModel highUserModel = new HighUserModel(); + HighUser detailData = highUserService.getDetailDataByUser(user.getId()); + detailData.setPassword(null); + highUserModel.setHighUser(detailData); + SessionObject so = new SessionObject(user.getPhone(), 1, highUserModel); + userCenter.save(request, response, so); + return ResponseMsgUtil.success(so); + } + + + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } } diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java index 9102b614..d6838225 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java @@ -122,29 +122,6 @@ public class CzOrderController { // 判断是否充值成功 if (dataObject.getInteger("status") == 3) { new Thread(() -> { - - JSONObject object = new JSONObject(); - - object.put("type" , 3); - object.put("productId" , rechargeOrder.getOperatorType()); - object.put("companyId" , rechargeOrder.getCompanyId()); - object.put("price" , rechargeOrder.getPayRealPrice()); - object.put("userId" , rechargeOrder.getUserId()); - object.put("orderId" , rechargeOrder.getId()); - object.put("remark" , "话费订单" + rechargeOrder.getOrderNo() + "积分返利:"); - - Map map = new HashMap<>(); - map.put("goldType", 1); - map.put("resType", 4); - map.put("userId", rechargeOrder.getUserId()); - map.put("resId", rechargeOrder.getId()); - - List goldRecs = highGoldRecService.getGoldRec(map); - - if (goldRecs.size() == 0) { - bsIntegralRebateService.integralRebate(object); - } - HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId()); WxMsgConfig.rechargedSuccess( rechargeOrder.getRechargeContent() + "充值成功", @@ -212,29 +189,6 @@ public class CzOrderController { // 判断是否充值成功 if (state == 1) { new Thread(() -> { - - JSONObject object = new JSONObject(); - - object.put("type" , 3); - object.put("productId" , rechargeOrder.getOperatorType()); - object.put("companyId" , rechargeOrder.getCompanyId()); - object.put("price" , rechargeOrder.getPayRealPrice()); - object.put("userId" , rechargeOrder.getUserId()); - object.put("orderId" , rechargeOrder.getId()); - object.put("remark" , "话费订单" + rechargeOrder.getOrderNo() + "积分返利:"); - - Map map = new HashMap<>(); - map.put("goldType", 1); - map.put("resType", 4); - map.put("userId", rechargeOrder.getUserId()); - map.put("resId", rechargeOrder.getId()); - - List goldRecs = highGoldRecService.getGoldRec(map); - - if (goldRecs.size() == 0) { - bsIntegralRebateService.integralRebate(object); - } - HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId()); WxMsgConfig.rechargedSuccess( rechargeOrder.getRechargeContent() + "充值成功", @@ -247,6 +201,7 @@ public class CzOrderController { childOrder.setStatus(101); rechargeOrder.setRechargeStatus(202); rechargeOrder.setPayStatus(100); + rechargeOrder.setFinishTime(new Date()); outRechargeOrderService.updateOrder(rechargeOrder); outRechargeChildOrderService.updateOrder(childOrder); diff --git a/hai-cweb/src/main/resources/dev/logback.xml b/hai-cweb/src/main/resources/dev/logback.xml index a7602e3d..dcda78c9 100644 --- a/hai-cweb/src/main/resources/dev/logback.xml +++ b/hai-cweb/src/main/resources/dev/logback.xml @@ -60,7 +60,7 @@ - + diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java index a2d71a6b..d7cb08b9 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java @@ -84,41 +84,42 @@ public class HighCouponSchedule { if (jsonObject.getString("respCode").equals("0000")) { JSONObject data = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); - - if (data.getString("respCode").equals("0000") && data.getJSONObject("data").getInteger("state") != 20) { - couponCodeOther.setStatus(data.getJSONObject("data").getInteger("state")); - highCouponCodeOtherMapper.updateByPrimaryKey(couponCodeOther); - - if (couponCodeOther.getCouponAgentCodeId() != null) { - HighCouponAgentCode agentCode = highCouponAgentCodeMapper.selectByPrimaryKey(couponCodeOther.getCouponAgentCodeId()); - if (agentCode == null) { - agentCode.setStatus(3); - highCouponAgentCodeMapper.updateByPrimaryKey(agentCode); + if (data.getString("respCode").equals("0000")) { + JSONObject responseObject = JSONObject.parseObject(data.getString("data")); + if (responseObject.getInteger("state") != 20) { + couponCodeOther.setStatus(responseObject.getInteger("state")); + highCouponCodeOtherMapper.updateByPrimaryKey(couponCodeOther); + + if (couponCodeOther.getCouponAgentCodeId() != null) { + HighCouponAgentCode agentCode = highCouponAgentCodeMapper.selectByPrimaryKey(couponCodeOther.getCouponAgentCodeId()); + if (agentCode == null) { + agentCode.setStatus(3); + highCouponAgentCodeMapper.updateByPrimaryKey(agentCode); + } } - } - if (couponCodeOther.getChildOrderId() != null) { - HighUserCouponExample userCouponExample = new HighUserCouponExample(); - userCouponExample.createCriteria().andQrCodeImgEqualTo(couponCodeOther.getCouNo()).andStatusEqualTo(1); - List list = highUserCouponMapper.selectByExample(userCouponExample); - if (list.size() > 0) { - HighUserCoupon userCoupon = list.get(0); - if (data.getJSONObject("data").getInteger("state") == 40) { - userCoupon.setStatus(2); - userCoupon.setConsumeTime(new Date()); - } else { - userCoupon.setStatus(0); + if (couponCodeOther.getChildOrderId() != null) { + HighUserCouponExample userCouponExample = new HighUserCouponExample(); + userCouponExample.createCriteria().andQrCodeImgEqualTo(couponCodeOther.getCouNo()).andStatusEqualTo(1); + List list = highUserCouponMapper.selectByExample(userCouponExample); + if (list.size() > 0) { + HighUserCoupon userCoupon = list.get(0); + if (responseObject.getInteger("state") == 40) { + userCoupon.setStatus(2); + userCoupon.setConsumeTime(new Date()); + } else { + userCoupon.setStatus(0); + } + highUserCouponMapper.updateByPrimaryKey(userCoupon); + } + // 查询订单中的汇联通卡券全部已处理 + HighCouponCodeOtherExample otherExample = new HighCouponCodeOtherExample(); + otherExample.createCriteria().andChildOrderIdEqualTo(couponCodeOther.getChildOrderId()).andStatusEqualTo(20).andTypeEqualTo(1); + if (highCouponCodeOtherMapper.selectByExample(otherExample).size() == 0) { + highOrderService.childOrderComplete(couponCodeOther.getChildOrderId()); } - highUserCouponMapper.updateByPrimaryKey(userCoupon); - } - // 查询订单中的汇联通卡券全部已处理 - HighCouponCodeOtherExample otherExample = new HighCouponCodeOtherExample(); - otherExample.createCriteria().andChildOrderIdEqualTo(couponCodeOther.getChildOrderId()).andStatusEqualTo(20).andTypeEqualTo(1); - if (highCouponCodeOtherMapper.selectByExample(otherExample).size() == 0) { - highOrderService.childOrderComplete(couponCodeOther.getChildOrderId()); } } - } } } diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java index 57fafa64..6c4b9ffd 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java @@ -439,7 +439,7 @@ public class HighOrderSchedule { * @Param [] * @return void */ - @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 + @Scheduled(cron="0 0/5 * * * ?") //每1分钟执行一次 public void integralRebateOrder() { List order = highOrderService.integralRebateOrder(); for (HighOrder highOrder : order) { @@ -455,7 +455,7 @@ public class HighOrderSchedule { List childOrderList = highOrderService.getChildOrderByOrder(highOrder.getId()); // 查询订单来源 - JSONObject object = highOrderService.orderSource(childOrderList.get(0).getGoodsType() , childOrderList.get(0).getGoodsId(),highOrder.getOrderNo() , highOrder.getCompanyId()); + JSONObject object = highOrderService.orderSource(childOrderList.get(0).getGoodsType() , childOrderList.get(0).getGoodsId(),highOrder.getOrderNo() , highOrder.getCompanyId() , 0); object.put("price" , highOrder.getPayRealPrice()); object.put("userId" , highOrder.getMemId()); @@ -469,5 +469,40 @@ public class HighOrderSchedule { } } + /** + * @Author Sum1Dream + * @name integralRebateOrder.java + * @Description // 执行返利操作 + * @Date 15:13 2022/8/22 + * @Param [] + * @return void + */ + @Scheduled(cron="0 0/5 * * * ?") //每1分钟执行一次 + public void integralRebateRechargeOrder() { + List order = outRechargeOrderService.integralRebateRechargeOrder(); + for (OutRechargeOrder outRechargeOrder : order) { + Map map = new HashMap<>(); + map.put("goldType", 1); + map.put("resType", 4); + map.put("userId", outRechargeOrder.getUserId()); + map.put("resId", outRechargeOrder.getId()); + + List goldRecs = highGoldRecService.getGoldRec(map); + + if (goldRecs.size() == 0) { + // 查询订单来源 + JSONObject object = highOrderService.orderSource(20 , outRechargeOrder.getGoodsId(),outRechargeOrder.getOrderNo() , outRechargeOrder.getCompanyId() , outRechargeOrder.getOperatorType()); + + object.put("price" , outRechargeOrder.getPayRealPrice()); + object.put("userId" , outRechargeOrder.getUserId()); + object.put("orderId" , outRechargeOrder.getId()); + object.put("companyId" , outRechargeOrder.getCompanyId()); + object.put("createTime" , outRechargeOrder.getCreateTimed()); + + bsIntegralRebateService.integralRechargeRebate(object); + + } + } + } } diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighTestController.java b/hai-schedule/src/main/java/com/hai/schedule/HighTestController.java index ca98a608..8cb6e933 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighTestController.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighTestController.java @@ -1 +1 @@ -package com.hai.schedule; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.model.HighMerchantModel; import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; import com.hai.model.ResultProfitSharing; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import java.io.FileInputStream; import java.math.BigDecimal; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private HighOrderService highOrderService; @Resource private HighProfitSharingRecordService highProfitSharingRecordService; @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @Resource private HuiLianTongConfig huiLianTongConfig; @Resource private UnionPayConfig unionPayConfig; @RequestMapping(value = "/getToken", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取贵州中石化token") public ResponseData getToken() { try { return ResponseMsgUtil.success(huiLianTongConfig.getToken()); } catch (Exception e) { log.error("HighOrderController --> getToken() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file +package com.hai.schedule; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.DateUtil; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.model.HighMerchantModel; import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; import com.hai.model.ResultProfitSharing; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import javax.servlet.http.HttpServletRequest; import java.io.FileInputStream; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.security.KeyStore; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private HighOrderService highOrderService; @Resource private HighProfitSharingRecordService highProfitSharingRecordService; @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @Resource private HuiLianTongConfig huiLianTongConfig; @Resource private UnionPayConfig unionPayConfig; @Resource private SecSinopecConfigService secSinopecConfigService; @Resource private HighCouponCodeService highCouponCodeService; @RequestMapping(value = "/synchronizeCNPC", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "同步重庆中石化") public ResponseData synchronizeCNPC(HttpServletRequest request) { List sinopecConfigList = secSinopecConfigService.getListSinopecConfig(new HashMap<>()); for (SecSinopecConfig config : sinopecConfigList) { try { String token = getCnpcToken(config.getAppId(), config.getAppSecret()); if (token != null) { Calendar instance = Calendar.getInstance(); instance.set(Calendar.YEAR, 2021); instance.set(Calendar.MONTH, 9); instance.set(Calendar.DATE, 1); instance.set(Calendar.MINUTE, 00); instance.set(Calendar.SECOND, 00); instance.set(Calendar.MILLISECOND, 00); Map bodyMap = new HashMap<>(); bodyMap.put("appId", config.getAppId()); bodyMap.put("pageNo", 1); bodyMap.put("pageSize", 1000); bodyMap.put("startTime", instance.getTime()); bodyMap.put("endTime", new Date()); bodyMap.put("customerCode", config.getCode()); Long date = new Date().getTime(); String sha256 = encodeBySHA256(config.getSignkey() + JSON.toJSONString(bodyMap) + date); JSONObject object = HttpsUtils.doPost("https://app.zshcqsy.com/api-provider/sapapi/open/coupon/customerRedeemcodeList", JSON.toJSONString(bodyMap), token, sha256, date); if(Objects.equals(object.get("success"), true)) { Object dataJson = JSONObject.parse(JSONObject.toJSONString(object.get("data"))); JSONObject dataObject = JSON.parseObject(JSONObject.toJSONString(dataJson)); // 总页数 int rowPageCount = new BigDecimal(dataObject.getString("rowCount")).divide(new BigDecimal("100"), 0, BigDecimal.ROUND_UP).intValue(); for (int i = 1; i < rowPageCount;i++) { token = getCnpcToken(config.getAppId(), config.getAppSecret()); bodyMap.clear(); bodyMap.put("appId", config.getAppId()); bodyMap.put("pageNo", i); bodyMap.put("pageSize", 1000); bodyMap.put("startTime", instance.getTime()); bodyMap.put("endTime", new Date()); bodyMap.put("customerCode", config.getCode()); Long date2 = new Date().getTime(); sha256 = encodeBySHA256(config.getSignkey() + JSON.toJSONString(bodyMap) + date); object = HttpsUtils.doPost("https://app.zshcqsy.com/api-provider/sapapi/open/coupon/customerRedeemcodeList", JSON.toJSONString(bodyMap), token, sha256, date); if (Objects.equals(object.get("success"), true)) { dataJson = JSONObject.parse(JSONObject.toJSONString(object.get("data"))); dataObject = JSON.parseObject(JSONObject.toJSONString(dataJson)); JSONArray list = dataObject.getJSONArray("list"); for (Object dataJsonObject : list) { try { JSONObject parseObject = JSON.parseObject(JSON.toJSONString(dataJsonObject)); String codeId = parseObject.getString("codeId"); String nodeName = parseObject.getString("nodeName"); Date useTime = DateUtil.format(parseObject.getString("useTime"), "yyyy-MM-dd HH:mm:ss"); highCouponCodeService.cnpcCallbackCouponCode(codeId, useTime, nodeName); } catch (Exception e) { log.error("HighCouponSchedule --> expiredCoupon() error!", e); } } } } } } } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } return ResponseMsgUtil.success(null); } private String getCnpcToken(String appId,String appSecret) { Map tokenMap = new HashMap<>(); tokenMap.put("appId", appId); tokenMap.put("appSecret", appSecret); JSONObject jsonObject = HttpsUtils.doPost("https://app.zshcqsy.com/api-provider/api/open/merchant/token", JSON.toJSONString(tokenMap)); log.error(jsonObject.toJSONString()); if (jsonObject != null && jsonObject.getBoolean("success") == true) { JSONObject data = jsonObject.getJSONObject("data"); String token = data.getString("token"); return token; } return null; } public String encodeBySHA256(String str) { try{ MessageDigest messageDigest = MessageDigest.getInstance("SHA-256"); messageDigest.reset(); messageDigest.update(str.getBytes("UTF-8")); return getFormattedText(messageDigest.digest()); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (Exception e) { throw new RuntimeException(e); } return ""; } private static final String[] HEX_DIGITS = {"0" ,"1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"}; private String getFormattedText(byte[] bytes) { int len = bytes.length; StringBuilder buf = new StringBuilder(len * 2); // 把密文转换成十六进制的字符串形式 for (int j=0;j> 4) & 0x0f]); buf.append(HEX_DIGITS[bytes[j] & 0x0f]); } return buf.toString(); } } \ No newline at end of file diff --git a/hai-schedule/src/main/resources/prod/logback.xml b/hai-schedule/src/main/resources/prod/logback.xml index 516350df..f33cbad8 100644 --- a/hai-schedule/src/main/resources/prod/logback.xml +++ b/hai-schedule/src/main/resources/prod/logback.xml @@ -60,7 +60,7 @@ - + diff --git a/hai-service/src/main/java/com/hai/common/utils/CommonUtil.java b/hai-service/src/main/java/com/hai/common/utils/CommonUtil.java new file mode 100644 index 00000000..96c0c6c3 --- /dev/null +++ b/hai-service/src/main/java/com/hai/common/utils/CommonUtil.java @@ -0,0 +1,10 @@ +package com.hai.common.utils; + +/** + * @author sum1dream + */ +public class CommonUtil { + + + +} diff --git a/hai-service/src/main/java/com/hai/common/utils/WxUtils.java b/hai-service/src/main/java/com/hai/common/utils/WxUtils.java index 7652c17d..874dcae7 100644 --- a/hai-service/src/main/java/com/hai/common/utils/WxUtils.java +++ b/hai-service/src/main/java/com/hai/common/utils/WxUtils.java @@ -7,25 +7,21 @@ import com.hai.common.pay.util.sdk.WXPayXmlUtil; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.naming.NoNameCoder; import com.thoughtworks.xstream.io.xml.XppDriver; + import net.sf.cglib.beans.BeanMap; import org.apache.commons.lang3.StringUtils; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.conn.ssl.SSLContexts; + import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocket; -import javax.net.ssl.SSLSocketFactory; + import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import java.io.File; -import java.io.FileInputStream; + import java.io.StringWriter; -import java.security.KeyStore; import java.security.MessageDigest; import java.security.SecureRandom; import java.util.*; @@ -488,7 +484,9 @@ public class WxUtils { continue; } if (data.get(k) != null) // 参数值为空,则不参与签名 + { sb.append(k).append("=").append(data.get(k)).append("&"); + } } sb.append("apiKey=").append(key); if (WXPayConstants.SignType.MD5.equals(signType)) { @@ -502,4 +500,44 @@ public class WxUtils { } } + /** + * 用SHA1算法生成安全签名 + * @param token 票据 + * @param timestamp 时间戳 + * @param nonce 随机字符串 + * @return 安全签名 + * @throws Exception + */ + public static String getSHA1(String token, String timestamp, String nonce) throws Exception + { + try { + String[] array = new String[] { token, timestamp, nonce}; + StringBuffer sb = new StringBuffer(); + // 字符串排序 + Arrays.sort(array); + for (int i = 0; i < 3; i++) { + sb.append(array[i]); + } + String str = sb.toString(); + // SHA1签名生成 + MessageDigest md = MessageDigest.getInstance("SHA-1"); + md.update(str.getBytes()); + byte[] digest = md.digest(); + + StringBuffer hexstr = new StringBuffer(); + String shaHex = ""; + for (int i = 0; i < digest.length; i++) { + shaHex = Integer.toHexString(digest[i] & 0xFF); + if (shaHex.length() < 2) { + hexstr.append(0); + } + hexstr.append(shaHex); + } + return hexstr.toString(); + } catch (Exception e) { + e.printStackTrace(); + throw new Exception(String.format("Invalid sign_type: %s")); + } + } + } diff --git a/hai-service/src/main/java/com/hai/config/UnionUserConfig.java b/hai-service/src/main/java/com/hai/config/UnionUserConfig.java index 8a17cd52..07d651b2 100644 --- a/hai-service/src/main/java/com/hai/config/UnionUserConfig.java +++ b/hai-service/src/main/java/com/hai/config/UnionUserConfig.java @@ -50,6 +50,7 @@ public class UnionUserConfig { paramMap.remove("secret"); JSONObject jsonObject = JSONObject.parseObject(UnionUtils.sendPostGson(requestUrl+"backendToken", paramMap)); String backendToken = jsonObject.getJSONObject("params").getString("backendToken"); + System.out.println(jsonObject + "================================================="); redisUtil.set("UNION_BACKEND_TOKEN", backendToken,jsonObject.getJSONObject("params").getLong("expiresIn")); return backendToken; } diff --git a/hai-service/src/main/java/com/hai/dao/HighApproveMapper.java b/hai-service/src/main/java/com/hai/dao/HighApproveMapper.java index 1af2b2d2..660382e9 100644 --- a/hai-service/src/main/java/com/hai/dao/HighApproveMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighApproveMapper.java @@ -45,14 +45,16 @@ public interface HighApproveMapper extends HighApproveMapperExt { "create_time, update_time, ", "submit_operator_id, submit_operator_name, ", "approve_operator_id, approve_operator_name, ", - "ext_1, ext_2, ext_3)", + "ext_1, ext_2, ext_3, ", + "approve_object)", "values (#{objectType,jdbcType=INTEGER}, #{objectId,jdbcType=BIGINT}, ", "#{objectName,jdbcType=VARCHAR}, #{approveSerialNo,jdbcType=VARCHAR}, ", "#{remarks,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", - "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=DATE}, ", "#{submitOperatorId,jdbcType=BIGINT}, #{submitOperatorName,jdbcType=VARCHAR}, ", "#{approveOperatorId,jdbcType=BIGINT}, #{approveOperatorName,jdbcType=VARCHAR}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ", + "#{approveObject,jdbcType=LONGVARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighApprove record); @@ -61,6 +63,28 @@ public interface HighApproveMapper extends HighApproveMapperExt { @Options(useGeneratedKeys=true,keyProperty="id") int insertSelective(HighApprove record); + @SelectProvider(type=HighApproveSqlProvider.class, method="selectByExampleWithBLOBs") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="object_type", property="objectType", jdbcType=JdbcType.INTEGER), + @Result(column="object_id", property="objectId", jdbcType=JdbcType.BIGINT), + @Result(column="object_name", property="objectName", jdbcType=JdbcType.VARCHAR), + @Result(column="approve_serial_no", property="approveSerialNo", jdbcType=JdbcType.VARCHAR), + @Result(column="remarks", property="remarks", 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.DATE), + @Result(column="submit_operator_id", property="submitOperatorId", jdbcType=JdbcType.BIGINT), + @Result(column="submit_operator_name", property="submitOperatorName", jdbcType=JdbcType.VARCHAR), + @Result(column="approve_operator_id", property="approveOperatorId", jdbcType=JdbcType.BIGINT), + @Result(column="approve_operator_name", property="approveOperatorName", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), + @Result(column="approve_object", property="approveObject", jdbcType=JdbcType.LONGVARCHAR) + }) + List selectByExampleWithBLOBs(HighApproveExample example); + @SelectProvider(type=HighApproveSqlProvider.class, method="selectByExample") @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @@ -71,7 +95,7 @@ public interface HighApproveMapper extends HighApproveMapperExt { @Result(column="remarks", property="remarks", 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), + @Result(column="update_time", property="updateTime", jdbcType=JdbcType.DATE), @Result(column="submit_operator_id", property="submitOperatorId", jdbcType=JdbcType.BIGINT), @Result(column="submit_operator_name", property="submitOperatorName", jdbcType=JdbcType.VARCHAR), @Result(column="approve_operator_id", property="approveOperatorId", jdbcType=JdbcType.BIGINT), @@ -86,7 +110,7 @@ public interface HighApproveMapper extends HighApproveMapperExt { "select", "id, object_type, object_id, object_name, approve_serial_no, remarks, `status`, ", "create_time, update_time, submit_operator_id, submit_operator_name, approve_operator_id, ", - "approve_operator_name, ext_1, ext_2, ext_3", + "approve_operator_name, ext_1, ext_2, ext_3, approve_object", "from high_approve", "where id = #{id,jdbcType=BIGINT}" }) @@ -99,20 +123,24 @@ public interface HighApproveMapper extends HighApproveMapperExt { @Result(column="remarks", property="remarks", 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), + @Result(column="update_time", property="updateTime", jdbcType=JdbcType.DATE), @Result(column="submit_operator_id", property="submitOperatorId", jdbcType=JdbcType.BIGINT), @Result(column="submit_operator_name", property="submitOperatorName", jdbcType=JdbcType.VARCHAR), @Result(column="approve_operator_id", property="approveOperatorId", jdbcType=JdbcType.BIGINT), @Result(column="approve_operator_name", property="approveOperatorName", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), - @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), + @Result(column="approve_object", property="approveObject", jdbcType=JdbcType.LONGVARCHAR) }) HighApprove selectByPrimaryKey(Long id); @UpdateProvider(type=HighApproveSqlProvider.class, method="updateByExampleSelective") int updateByExampleSelective(@Param("record") HighApprove record, @Param("example") HighApproveExample example); + @UpdateProvider(type=HighApproveSqlProvider.class, method="updateByExampleWithBLOBs") + int updateByExampleWithBLOBs(@Param("record") HighApprove record, @Param("example") HighApproveExample example); + @UpdateProvider(type=HighApproveSqlProvider.class, method="updateByExample") int updateByExample(@Param("record") HighApprove record, @Param("example") HighApproveExample example); @@ -128,7 +156,29 @@ public interface HighApproveMapper extends HighApproveMapperExt { "remarks = #{remarks,jdbcType=VARCHAR},", "`status` = #{status,jdbcType=INTEGER},", "create_time = #{createTime,jdbcType=TIMESTAMP},", - "update_time = #{updateTime,jdbcType=TIMESTAMP},", + "update_time = #{updateTime,jdbcType=DATE},", + "submit_operator_id = #{submitOperatorId,jdbcType=BIGINT},", + "submit_operator_name = #{submitOperatorName,jdbcType=VARCHAR},", + "approve_operator_id = #{approveOperatorId,jdbcType=BIGINT},", + "approve_operator_name = #{approveOperatorName,jdbcType=VARCHAR},", + "ext_1 = #{ext1,jdbcType=VARCHAR},", + "ext_2 = #{ext2,jdbcType=VARCHAR},", + "ext_3 = #{ext3,jdbcType=VARCHAR},", + "approve_object = #{approveObject,jdbcType=LONGVARCHAR}", + "where id = #{id,jdbcType=BIGINT}" + }) + int updateByPrimaryKeyWithBLOBs(HighApprove record); + + @Update({ + "update high_approve", + "set object_type = #{objectType,jdbcType=INTEGER},", + "object_id = #{objectId,jdbcType=BIGINT},", + "object_name = #{objectName,jdbcType=VARCHAR},", + "approve_serial_no = #{approveSerialNo,jdbcType=VARCHAR},", + "remarks = #{remarks,jdbcType=VARCHAR},", + "`status` = #{status,jdbcType=INTEGER},", + "create_time = #{createTime,jdbcType=TIMESTAMP},", + "update_time = #{updateTime,jdbcType=DATE},", "submit_operator_id = #{submitOperatorId,jdbcType=BIGINT},", "submit_operator_name = #{submitOperatorName,jdbcType=VARCHAR},", "approve_operator_id = #{approveOperatorId,jdbcType=BIGINT},", diff --git a/hai-service/src/main/java/com/hai/dao/HighApproveSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighApproveSqlProvider.java index 1ad8c3ea..9ff5161d 100644 --- a/hai-service/src/main/java/com/hai/dao/HighApproveSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighApproveSqlProvider.java @@ -57,7 +57,7 @@ public class HighApproveSqlProvider { } if (record.getUpdateTime() != null) { - sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); + sql.VALUES("update_time", "#{updateTime,jdbcType=DATE}"); } if (record.getSubmitOperatorId() != null) { @@ -88,6 +88,43 @@ public class HighApproveSqlProvider { sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); } + if (record.getApproveObject() != null) { + sql.VALUES("approve_object", "#{approveObject,jdbcType=LONGVARCHAR}"); + } + + return sql.toString(); + } + + public String selectByExampleWithBLOBs(HighApproveExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("object_type"); + sql.SELECT("object_id"); + sql.SELECT("object_name"); + sql.SELECT("approve_serial_no"); + sql.SELECT("remarks"); + sql.SELECT("`status`"); + sql.SELECT("create_time"); + sql.SELECT("update_time"); + sql.SELECT("submit_operator_id"); + sql.SELECT("submit_operator_name"); + sql.SELECT("approve_operator_id"); + sql.SELECT("approve_operator_name"); + sql.SELECT("ext_1"); + sql.SELECT("ext_2"); + sql.SELECT("ext_3"); + sql.SELECT("approve_object"); + sql.FROM("high_approve"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + return sql.toString(); } @@ -163,7 +200,7 @@ public class HighApproveSqlProvider { } if (record.getUpdateTime() != null) { - sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); + sql.SET("update_time = #{record.updateTime,jdbcType=DATE}"); } if (record.getSubmitOperatorId() != null) { @@ -194,6 +231,37 @@ public class HighApproveSqlProvider { sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); } + if (record.getApproveObject() != null) { + sql.SET("approve_object = #{record.approveObject,jdbcType=LONGVARCHAR}"); + } + + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByExampleWithBLOBs(Map parameter) { + SQL sql = new SQL(); + sql.UPDATE("high_approve"); + + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("object_type = #{record.objectType,jdbcType=INTEGER}"); + sql.SET("object_id = #{record.objectId,jdbcType=BIGINT}"); + sql.SET("object_name = #{record.objectName,jdbcType=VARCHAR}"); + sql.SET("approve_serial_no = #{record.approveSerialNo,jdbcType=VARCHAR}"); + sql.SET("remarks = #{record.remarks,jdbcType=VARCHAR}"); + sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + sql.SET("update_time = #{record.updateTime,jdbcType=DATE}"); + sql.SET("submit_operator_id = #{record.submitOperatorId,jdbcType=BIGINT}"); + sql.SET("submit_operator_name = #{record.submitOperatorName,jdbcType=VARCHAR}"); + sql.SET("approve_operator_id = #{record.approveOperatorId,jdbcType=BIGINT}"); + sql.SET("approve_operator_name = #{record.approveOperatorName,jdbcType=VARCHAR}"); + sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); + sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); + sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); + sql.SET("approve_object = #{record.approveObject,jdbcType=LONGVARCHAR}"); + + HighApproveExample example = (HighApproveExample) parameter.get("example"); applyWhere(sql, example, true); return sql.toString(); } @@ -210,7 +278,7 @@ public class HighApproveSqlProvider { sql.SET("remarks = #{record.remarks,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}"); + sql.SET("update_time = #{record.updateTime,jdbcType=DATE}"); sql.SET("submit_operator_id = #{record.submitOperatorId,jdbcType=BIGINT}"); sql.SET("submit_operator_name = #{record.submitOperatorName,jdbcType=VARCHAR}"); sql.SET("approve_operator_id = #{record.approveOperatorId,jdbcType=BIGINT}"); @@ -257,7 +325,7 @@ public class HighApproveSqlProvider { } if (record.getUpdateTime() != null) { - sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); + sql.SET("update_time = #{updateTime,jdbcType=DATE}"); } if (record.getSubmitOperatorId() != null) { @@ -288,6 +356,10 @@ public class HighApproveSqlProvider { sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); } + if (record.getApproveObject() != null) { + sql.SET("approve_object = #{approveObject,jdbcType=LONGVARCHAR}"); + } + sql.WHERE("id = #{id,jdbcType=BIGINT}"); return sql.toString(); 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 1854ffa4..322a4b6c 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -1250,7 +1250,7 @@ public interface HighOrderMapperExt { }) List getSelfOilStationOrderList(@Param("goodsId") String goodsId); - @Select("select * from high_order where order_status = 3 and pay_type != 3 and pay_real_price > 0 and whether_rebate = false ") + @Select("select * from high_order where order_status = 3 and pay_type != 3 and pay_real_price > 0 and whether_rebate = false group by create_time desc;") @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapper.java b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapper.java index 31a9fb7d..2eeaf604 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapper.java @@ -57,7 +57,10 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { "refund_fee, company_id, ", "pay_status, merch_id, ", "recharge_status, ext_1, ", - "ext_2, ext_3)", + "ext_2, ext_3, recharge_name, ", + "remarks, agent_key, ", + "object_id, abnormal_msg, ", + "whether_rebate)", "values (#{rechargePrice,jdbcType=DECIMAL}, #{type,jdbcType=INTEGER}, ", "#{operatorName,jdbcType=VARCHAR}, #{operatorType,jdbcType=INTEGER}, ", "#{orderNo,jdbcType=VARCHAR}, #{rechargeType,jdbcType=INTEGER}, ", @@ -76,7 +79,10 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { "#{refundFee,jdbcType=DECIMAL}, #{companyId,jdbcType=BIGINT}, ", "#{payStatus,jdbcType=INTEGER}, #{merchId,jdbcType=VARCHAR}, ", "#{rechargeStatus,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, ", - "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{rechargeName,jdbcType=VARCHAR}, ", + "#{remarks,jdbcType=VARCHAR}, #{agentKey,jdbcType=VARCHAR}, ", + "#{objectId,jdbcType=BIGINT}, #{abnormalMsg,jdbcType=VARCHAR}, ", + "#{whetherRebate,jdbcType=BIT})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(OutRechargeOrder record); @@ -125,7 +131,13 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { @Result(column="recharge_status", property="rechargeStatus", jdbcType=JdbcType.INTEGER), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), - @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), + @Result(column="recharge_name", property="rechargeName", jdbcType=JdbcType.VARCHAR), + @Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR), + @Result(column="agent_key", property="agentKey", jdbcType=JdbcType.VARCHAR), + @Result(column="object_id", property="objectId", jdbcType=JdbcType.BIGINT), + @Result(column="abnormal_msg", property="abnormalMsg", jdbcType=JdbcType.VARCHAR), + @Result(column="whether_rebate", property="whetherRebate", jdbcType=JdbcType.BIT) }) List selectByExample(OutRechargeOrderExample example); @@ -137,7 +149,8 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { "integral_deduction_price, pay_price, pay_real_price, pay_serial_no, create_timed, ", "pay_time, cancel_time, finish_time, out_refund_no, order_price, refund_time, ", "tp_refund_order_no, refund_id, refund_fee, company_id, pay_status, merch_id, ", - "recharge_status, ext_1, ext_2, ext_3", + "recharge_status, ext_1, ext_2, ext_3, recharge_name, remarks, agent_key, object_id, ", + "abnormal_msg, whether_rebate", "from out_recharge_order", "where id = #{id,jdbcType=BIGINT}" }) @@ -180,7 +193,13 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { @Result(column="recharge_status", property="rechargeStatus", jdbcType=JdbcType.INTEGER), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), - @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), + @Result(column="recharge_name", property="rechargeName", jdbcType=JdbcType.VARCHAR), + @Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR), + @Result(column="agent_key", property="agentKey", jdbcType=JdbcType.VARCHAR), + @Result(column="object_id", property="objectId", jdbcType=JdbcType.BIGINT), + @Result(column="abnormal_msg", property="abnormalMsg", jdbcType=JdbcType.VARCHAR), + @Result(column="whether_rebate", property="whetherRebate", jdbcType=JdbcType.BIT) }) OutRechargeOrder selectByPrimaryKey(Long id); @@ -232,7 +251,13 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { "recharge_status = #{rechargeStatus,jdbcType=INTEGER},", "ext_1 = #{ext1,jdbcType=VARCHAR},", "ext_2 = #{ext2,jdbcType=VARCHAR},", - "ext_3 = #{ext3,jdbcType=VARCHAR}", + "ext_3 = #{ext3,jdbcType=VARCHAR},", + "recharge_name = #{rechargeName,jdbcType=VARCHAR},", + "remarks = #{remarks,jdbcType=VARCHAR},", + "agent_key = #{agentKey,jdbcType=VARCHAR},", + "object_id = #{objectId,jdbcType=BIGINT},", + "abnormal_msg = #{abnormalMsg,jdbcType=VARCHAR},", + "whether_rebate = #{whetherRebate,jdbcType=BIT}", "where id = #{id,jdbcType=BIGINT}" }) int updateByPrimaryKey(OutRechargeOrder record); diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java index 6c2a78dd..bed63e07 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java @@ -146,4 +146,54 @@ public interface OutRechargeOrderMapperExt { @Result(column="count", property="count", jdbcType=JdbcType.BIGINT), }) OrderCountModel rechargeOrderByIndex(Integer code); + + @Select("select * from out_recharge_order where recharge_status = 202 and pay_status = 100 and pay_type != 3 and pay_real_price > 0 and whether_rebate = false group by create_timed desc ; ") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="recharge_price", property="rechargePrice", jdbcType=JdbcType.DECIMAL), + @Result(column="type", property="type", jdbcType=JdbcType.INTEGER), + @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR), + @Result(column="operator_type", property="operatorType", jdbcType=JdbcType.INTEGER), + @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), + @Result(column="recharge_type", property="rechargeType", jdbcType=JdbcType.INTEGER), + @Result(column="mem_discount_id", property="memDiscountId", jdbcType=JdbcType.BIGINT), + @Result(column="mem_discount_name", property="memDiscountName", jdbcType=JdbcType.VARCHAR), + @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), + @Result(column="user_name", property="userName", jdbcType=JdbcType.VARCHAR), + @Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR), + @Result(column="goods_id", property="goodsId", jdbcType=JdbcType.BIGINT), + @Result(column="recharge_content", property="rechargeContent", jdbcType=JdbcType.VARCHAR), + @Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER), + @Result(column="labor_union_card", property="laborUnionCard", jdbcType=JdbcType.VARCHAR), + @Result(column="integral_num", property="integralNum", jdbcType=JdbcType.DECIMAL), + @Result(column="discount_deduction_price", property="discountDeductionPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="integral_deduction_price", property="integralDeductionPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="pay_real_price", property="payRealPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR), + @Result(column="create_timed", property="createTimed", jdbcType=JdbcType.TIMESTAMP), + @Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="out_refund_no", property="outRefundNo", jdbcType=JdbcType.VARCHAR), + @Result(column="order_price", property="orderPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="tp_refund_order_no", property="tpRefundOrderNo", jdbcType=JdbcType.VARCHAR), + @Result(column="refund_id", property="refundId", jdbcType=JdbcType.VARCHAR), + @Result(column="refund_fee", property="refundFee", jdbcType=JdbcType.DECIMAL), + @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT), + @Result(column="pay_status", property="payStatus", jdbcType=JdbcType.INTEGER), + @Result(column="merch_id", property="merchId", jdbcType=JdbcType.VARCHAR), + @Result(column="recharge_status", property="rechargeStatus", jdbcType=JdbcType.INTEGER), + @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), + @Result(column="recharge_name", property="rechargeName", jdbcType=JdbcType.VARCHAR), + @Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR), + @Result(column="agent_key", property="agentKey", jdbcType=JdbcType.VARCHAR), + @Result(column="object_id", property="objectId", jdbcType=JdbcType.BIGINT), + @Result(column="abnormal_msg", property="abnormalMsg", jdbcType=JdbcType.VARCHAR), + @Result(column="whether_rebate", property="whetherRebate", jdbcType=JdbcType.BIT) + }) + List integralRebateRechargeOrder(); } diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderSqlProvider.java b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderSqlProvider.java index d359e26f..9322bcd7 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderSqlProvider.java @@ -180,6 +180,30 @@ public class OutRechargeOrderSqlProvider { sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); } + if (record.getRechargeName() != null) { + sql.VALUES("recharge_name", "#{rechargeName,jdbcType=VARCHAR}"); + } + + if (record.getRemarks() != null) { + sql.VALUES("remarks", "#{remarks,jdbcType=VARCHAR}"); + } + + if (record.getAgentKey() != null) { + sql.VALUES("agent_key", "#{agentKey,jdbcType=VARCHAR}"); + } + + if (record.getObjectId() != null) { + sql.VALUES("object_id", "#{objectId,jdbcType=BIGINT}"); + } + + if (record.getAbnormalMsg() != null) { + sql.VALUES("abnormal_msg", "#{abnormalMsg,jdbcType=VARCHAR}"); + } + + if (record.getWhetherRebate() != null) { + sql.VALUES("whether_rebate", "#{whetherRebate,jdbcType=BIT}"); + } + return sql.toString(); } @@ -228,6 +252,12 @@ public class OutRechargeOrderSqlProvider { sql.SELECT("ext_1"); sql.SELECT("ext_2"); sql.SELECT("ext_3"); + sql.SELECT("recharge_name"); + sql.SELECT("remarks"); + sql.SELECT("agent_key"); + sql.SELECT("object_id"); + sql.SELECT("abnormal_msg"); + sql.SELECT("whether_rebate"); sql.FROM("out_recharge_order"); applyWhere(sql, example, false); @@ -401,6 +431,30 @@ public class OutRechargeOrderSqlProvider { sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); } + if (record.getRechargeName() != null) { + sql.SET("recharge_name = #{record.rechargeName,jdbcType=VARCHAR}"); + } + + if (record.getRemarks() != null) { + sql.SET("remarks = #{record.remarks,jdbcType=VARCHAR}"); + } + + if (record.getAgentKey() != null) { + sql.SET("agent_key = #{record.agentKey,jdbcType=VARCHAR}"); + } + + if (record.getObjectId() != null) { + sql.SET("object_id = #{record.objectId,jdbcType=BIGINT}"); + } + + if (record.getAbnormalMsg() != null) { + sql.SET("abnormal_msg = #{record.abnormalMsg,jdbcType=VARCHAR}"); + } + + if (record.getWhetherRebate() != null) { + sql.SET("whether_rebate = #{record.whetherRebate,jdbcType=BIT}"); + } + applyWhere(sql, example, true); return sql.toString(); } @@ -448,6 +502,12 @@ public class OutRechargeOrderSqlProvider { sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); + sql.SET("recharge_name = #{record.rechargeName,jdbcType=VARCHAR}"); + sql.SET("remarks = #{record.remarks,jdbcType=VARCHAR}"); + sql.SET("agent_key = #{record.agentKey,jdbcType=VARCHAR}"); + sql.SET("object_id = #{record.objectId,jdbcType=BIGINT}"); + sql.SET("abnormal_msg = #{record.abnormalMsg,jdbcType=VARCHAR}"); + sql.SET("whether_rebate = #{record.whetherRebate,jdbcType=BIT}"); OutRechargeOrderExample example = (OutRechargeOrderExample) parameter.get("example"); applyWhere(sql, example, true); @@ -610,6 +670,30 @@ public class OutRechargeOrderSqlProvider { sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); } + if (record.getRechargeName() != null) { + sql.SET("recharge_name = #{rechargeName,jdbcType=VARCHAR}"); + } + + if (record.getRemarks() != null) { + sql.SET("remarks = #{remarks,jdbcType=VARCHAR}"); + } + + if (record.getAgentKey() != null) { + sql.SET("agent_key = #{agentKey,jdbcType=VARCHAR}"); + } + + if (record.getObjectId() != null) { + sql.SET("object_id = #{objectId,jdbcType=BIGINT}"); + } + + if (record.getAbnormalMsg() != null) { + sql.SET("abnormal_msg = #{abnormalMsg,jdbcType=VARCHAR}"); + } + + if (record.getWhetherRebate() != null) { + sql.SET("whether_rebate = #{whetherRebate,jdbcType=BIT}"); + } + sql.WHERE("id = #{id,jdbcType=BIGINT}"); return sql.toString(); diff --git a/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java b/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java index 4125646c..8cb38ec3 100644 --- a/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java +++ b/hai-service/src/main/java/com/hai/entity/ApiStarbucksProducts.java @@ -129,6 +129,18 @@ public class ApiStarbucksProducts implements Serializable { */ private Integer status; + private Integer count; + + private BigDecimal showPrice; + + public BigDecimal getShowPrice() { + return showPrice; + } + + public void setShowPrice(BigDecimal showPrice) { + this.showPrice = showPrice; + } + /** * ext_1 */ @@ -144,6 +156,14 @@ public class ApiStarbucksProducts implements Serializable { */ private String ext3; + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + private static final long serialVersionUID = 1L; public Long getId() { @@ -463,4 +483,4 @@ public class ApiStarbucksProducts implements Serializable { sb.append("]"); return sb.toString(); } -} \ No newline at end of file +} diff --git a/hai-service/src/main/java/com/hai/entity/HighApprove.java b/hai-service/src/main/java/com/hai/entity/HighApprove.java index daa7334e..6f9b4718 100644 --- a/hai-service/src/main/java/com/hai/entity/HighApprove.java +++ b/hai-service/src/main/java/com/hai/entity/HighApprove.java @@ -19,7 +19,7 @@ public class HighApprove implements Serializable { private Long id; /** - * 审批对象 1:卡券上架审批 2:卡卷价格审批 + * 审批对象 1:卡券上架审批 2:卡卷价格审批 3:卡券分发审批 */ private Integer objectType; @@ -84,6 +84,11 @@ public class HighApprove implements Serializable { private String ext3; + /** + * 审批对象 + */ + private String approveObject; + private static final long serialVersionUID = 1L; public Long getId() { @@ -214,6 +219,14 @@ public class HighApprove implements Serializable { this.ext3 = ext3; } + public String getApproveObject() { + return approveObject; + } + + public void setApproveObject(String approveObject) { + this.approveObject = approveObject; + } + @Override public boolean equals(Object that) { if (this == that) { @@ -241,7 +254,8 @@ public class HighApprove implements Serializable { && (this.getApproveOperatorName() == null ? other.getApproveOperatorName() == null : this.getApproveOperatorName().equals(other.getApproveOperatorName())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) - && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); + && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())) + && (this.getApproveObject() == null ? other.getApproveObject() == null : this.getApproveObject().equals(other.getApproveObject())); } @Override @@ -264,6 +278,7 @@ public class HighApprove implements Serializable { result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); + result = prime * result + ((getApproveObject() == null) ? 0 : getApproveObject().hashCode()); return result; } @@ -289,8 +304,9 @@ public class HighApprove implements Serializable { sb.append(", ext1=").append(ext1); sb.append(", ext2=").append(ext2); sb.append(", ext3=").append(ext3); + sb.append(", approveObject=").append(approveObject); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } -} \ No newline at end of file +} diff --git a/hai-service/src/main/java/com/hai/entity/HighApproveExample.java b/hai-service/src/main/java/com/hai/entity/HighApproveExample.java index 8bdb2317..f0fa0e3b 100644 --- a/hai-service/src/main/java/com/hai/entity/HighApproveExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighApproveExample.java @@ -2,6 +2,7 @@ package com.hai.entity; import java.util.ArrayList; import java.util.Date; +import java.util.Iterator; import java.util.List; public class HighApproveExample { @@ -125,6 +126,32 @@ public class HighApproveExample { criteria.add(new Criterion(condition, value1, value2)); } + protected void addCriterionForJDBCDate(String condition, Date value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + addCriterion(condition, new java.sql.Date(value.getTime()), property); + } + + protected void addCriterionForJDBCDate(String condition, List values, String property) { + if (values == null || values.size() == 0) { + throw new RuntimeException("Value list for " + property + " cannot be null or empty"); + } + List dateList = new ArrayList(); + Iterator iter = values.iterator(); + while (iter.hasNext()) { + dateList.add(new java.sql.Date(iter.next().getTime())); + } + addCriterion(condition, dateList, property); + } + + protected void addCriterionForJDBCDate(String condition, Date value1, Date value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + addCriterion(condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property); + } + public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; @@ -646,52 +673,52 @@ public class HighApproveExample { } public Criteria andUpdateTimeEqualTo(Date value) { - addCriterion("update_time =", value, "updateTime"); + addCriterionForJDBCDate("update_time =", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeNotEqualTo(Date value) { - addCriterion("update_time <>", value, "updateTime"); + addCriterionForJDBCDate("update_time <>", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeGreaterThan(Date value) { - addCriterion("update_time >", value, "updateTime"); + addCriterionForJDBCDate("update_time >", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { - addCriterion("update_time >=", value, "updateTime"); + addCriterionForJDBCDate("update_time >=", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeLessThan(Date value) { - addCriterion("update_time <", value, "updateTime"); + addCriterionForJDBCDate("update_time <", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { - addCriterion("update_time <=", value, "updateTime"); + addCriterionForJDBCDate("update_time <=", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeIn(List values) { - addCriterion("update_time in", values, "updateTime"); + addCriterionForJDBCDate("update_time in", values, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeNotIn(List values) { - addCriterion("update_time not in", values, "updateTime"); + addCriterionForJDBCDate("update_time not in", values, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeBetween(Date value1, Date value2) { - addCriterion("update_time between", value1, value2, "updateTime"); + addCriterionForJDBCDate("update_time between", value1, value2, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { - addCriterion("update_time not between", value1, value2, "updateTime"); + addCriterionForJDBCDate("update_time not between", value1, value2, "updateTime"); return (Criteria) this; } diff --git a/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java b/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java index 60e332b4..6bc226e1 100644 --- a/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java +++ b/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java @@ -85,7 +85,7 @@ public class OutRechargeOrder implements Serializable { private String rechargeContent; /** - * 1:支付宝 2:微信 3:汇联通工会卡 4:银联 5:银联分期 6:商户预充值 + * 1:支付宝 2:微信 3:汇联通工会卡 4:银联 5:银联分期 */ private Integer payType; @@ -200,6 +200,21 @@ public class OutRechargeOrder implements Serializable { private String ext3; + private String rechargeName; + + private String remarks; + + private String agentKey; + + private Long objectId; + + private String abnormalMsg; + + /** + * 是否返利 + */ + private Boolean whetherRebate; + private static final long serialVersionUID = 1L; public Long getId() { @@ -514,6 +529,54 @@ public class OutRechargeOrder implements Serializable { this.ext3 = ext3; } + public String getRechargeName() { + return rechargeName; + } + + public void setRechargeName(String rechargeName) { + this.rechargeName = rechargeName; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public String getAgentKey() { + return agentKey; + } + + public void setAgentKey(String agentKey) { + this.agentKey = agentKey; + } + + public Long getObjectId() { + return objectId; + } + + public void setObjectId(Long objectId) { + this.objectId = objectId; + } + + public String getAbnormalMsg() { + return abnormalMsg; + } + + public void setAbnormalMsg(String abnormalMsg) { + this.abnormalMsg = abnormalMsg; + } + + public Boolean getWhetherRebate() { + return whetherRebate; + } + + public void setWhetherRebate(Boolean whetherRebate) { + this.whetherRebate = whetherRebate; + } + @Override public boolean equals(Object that) { if (this == that) { @@ -564,7 +627,13 @@ public class OutRechargeOrder implements Serializable { && (this.getRechargeStatus() == null ? other.getRechargeStatus() == null : this.getRechargeStatus().equals(other.getRechargeStatus())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) - && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); + && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())) + && (this.getRechargeName() == null ? other.getRechargeName() == null : this.getRechargeName().equals(other.getRechargeName())) + && (this.getRemarks() == null ? other.getRemarks() == null : this.getRemarks().equals(other.getRemarks())) + && (this.getAgentKey() == null ? other.getAgentKey() == null : this.getAgentKey().equals(other.getAgentKey())) + && (this.getObjectId() == null ? other.getObjectId() == null : this.getObjectId().equals(other.getObjectId())) + && (this.getAbnormalMsg() == null ? other.getAbnormalMsg() == null : this.getAbnormalMsg().equals(other.getAbnormalMsg())) + && (this.getWhetherRebate() == null ? other.getWhetherRebate() == null : this.getWhetherRebate().equals(other.getWhetherRebate())); } @Override @@ -610,6 +679,12 @@ public class OutRechargeOrder implements Serializable { result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); + result = prime * result + ((getRechargeName() == null) ? 0 : getRechargeName().hashCode()); + result = prime * result + ((getRemarks() == null) ? 0 : getRemarks().hashCode()); + result = prime * result + ((getAgentKey() == null) ? 0 : getAgentKey().hashCode()); + result = prime * result + ((getObjectId() == null) ? 0 : getObjectId().hashCode()); + result = prime * result + ((getAbnormalMsg() == null) ? 0 : getAbnormalMsg().hashCode()); + result = prime * result + ((getWhetherRebate() == null) ? 0 : getWhetherRebate().hashCode()); return result; } @@ -658,8 +733,14 @@ public class OutRechargeOrder implements Serializable { sb.append(", ext1=").append(ext1); sb.append(", ext2=").append(ext2); sb.append(", ext3=").append(ext3); + sb.append(", rechargeName=").append(rechargeName); + sb.append(", remarks=").append(remarks); + sb.append(", agentKey=").append(agentKey); + sb.append(", objectId=").append(objectId); + sb.append(", abnormalMsg=").append(abnormalMsg); + sb.append(", whetherRebate=").append(whetherRebate); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } -} +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/entity/OutRechargeOrderExample.java b/hai-service/src/main/java/com/hai/entity/OutRechargeOrderExample.java index 418b45b4..e7cba03f 100644 --- a/hai-service/src/main/java/com/hai/entity/OutRechargeOrderExample.java +++ b/hai-service/src/main/java/com/hai/entity/OutRechargeOrderExample.java @@ -2615,6 +2615,406 @@ public class OutRechargeOrderExample { addCriterion("ext_3 not between", value1, value2, "ext3"); return (Criteria) this; } + + public Criteria andRechargeNameIsNull() { + addCriterion("recharge_name is null"); + return (Criteria) this; + } + + public Criteria andRechargeNameIsNotNull() { + addCriterion("recharge_name is not null"); + return (Criteria) this; + } + + public Criteria andRechargeNameEqualTo(String value) { + addCriterion("recharge_name =", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameNotEqualTo(String value) { + addCriterion("recharge_name <>", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameGreaterThan(String value) { + addCriterion("recharge_name >", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameGreaterThanOrEqualTo(String value) { + addCriterion("recharge_name >=", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameLessThan(String value) { + addCriterion("recharge_name <", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameLessThanOrEqualTo(String value) { + addCriterion("recharge_name <=", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameLike(String value) { + addCriterion("recharge_name like", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameNotLike(String value) { + addCriterion("recharge_name not like", value, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameIn(List values) { + addCriterion("recharge_name in", values, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameNotIn(List values) { + addCriterion("recharge_name not in", values, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameBetween(String value1, String value2) { + addCriterion("recharge_name between", value1, value2, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRechargeNameNotBetween(String value1, String value2) { + addCriterion("recharge_name not between", value1, value2, "rechargeName"); + return (Criteria) this; + } + + public Criteria andRemarksIsNull() { + addCriterion("remarks is null"); + return (Criteria) this; + } + + public Criteria andRemarksIsNotNull() { + addCriterion("remarks is not null"); + return (Criteria) this; + } + + public Criteria andRemarksEqualTo(String value) { + addCriterion("remarks =", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksNotEqualTo(String value) { + addCriterion("remarks <>", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksGreaterThan(String value) { + addCriterion("remarks >", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksGreaterThanOrEqualTo(String value) { + addCriterion("remarks >=", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksLessThan(String value) { + addCriterion("remarks <", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksLessThanOrEqualTo(String value) { + addCriterion("remarks <=", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksLike(String value) { + addCriterion("remarks like", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksNotLike(String value) { + addCriterion("remarks not like", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksIn(List values) { + addCriterion("remarks in", values, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksNotIn(List values) { + addCriterion("remarks not in", values, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksBetween(String value1, String value2) { + addCriterion("remarks between", value1, value2, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksNotBetween(String value1, String value2) { + addCriterion("remarks not between", value1, value2, "remarks"); + return (Criteria) this; + } + + public Criteria andAgentKeyIsNull() { + addCriterion("agent_key is null"); + return (Criteria) this; + } + + public Criteria andAgentKeyIsNotNull() { + addCriterion("agent_key is not null"); + return (Criteria) this; + } + + public Criteria andAgentKeyEqualTo(String value) { + addCriterion("agent_key =", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyNotEqualTo(String value) { + addCriterion("agent_key <>", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyGreaterThan(String value) { + addCriterion("agent_key >", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyGreaterThanOrEqualTo(String value) { + addCriterion("agent_key >=", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyLessThan(String value) { + addCriterion("agent_key <", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyLessThanOrEqualTo(String value) { + addCriterion("agent_key <=", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyLike(String value) { + addCriterion("agent_key like", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyNotLike(String value) { + addCriterion("agent_key not like", value, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyIn(List values) { + addCriterion("agent_key in", values, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyNotIn(List values) { + addCriterion("agent_key not in", values, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyBetween(String value1, String value2) { + addCriterion("agent_key between", value1, value2, "agentKey"); + return (Criteria) this; + } + + public Criteria andAgentKeyNotBetween(String value1, String value2) { + addCriterion("agent_key not between", value1, value2, "agentKey"); + return (Criteria) this; + } + + public Criteria andObjectIdIsNull() { + addCriterion("object_id is null"); + return (Criteria) this; + } + + public Criteria andObjectIdIsNotNull() { + addCriterion("object_id is not null"); + return (Criteria) this; + } + + public Criteria andObjectIdEqualTo(Long value) { + addCriterion("object_id =", value, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdNotEqualTo(Long value) { + addCriterion("object_id <>", value, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdGreaterThan(Long value) { + addCriterion("object_id >", value, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdGreaterThanOrEqualTo(Long value) { + addCriterion("object_id >=", value, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdLessThan(Long value) { + addCriterion("object_id <", value, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdLessThanOrEqualTo(Long value) { + addCriterion("object_id <=", value, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdIn(List values) { + addCriterion("object_id in", values, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdNotIn(List values) { + addCriterion("object_id not in", values, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdBetween(Long value1, Long value2) { + addCriterion("object_id between", value1, value2, "objectId"); + return (Criteria) this; + } + + public Criteria andObjectIdNotBetween(Long value1, Long value2) { + addCriterion("object_id not between", value1, value2, "objectId"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgIsNull() { + addCriterion("abnormal_msg is null"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgIsNotNull() { + addCriterion("abnormal_msg is not null"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgEqualTo(String value) { + addCriterion("abnormal_msg =", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgNotEqualTo(String value) { + addCriterion("abnormal_msg <>", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgGreaterThan(String value) { + addCriterion("abnormal_msg >", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgGreaterThanOrEqualTo(String value) { + addCriterion("abnormal_msg >=", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgLessThan(String value) { + addCriterion("abnormal_msg <", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgLessThanOrEqualTo(String value) { + addCriterion("abnormal_msg <=", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgLike(String value) { + addCriterion("abnormal_msg like", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgNotLike(String value) { + addCriterion("abnormal_msg not like", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgIn(List values) { + addCriterion("abnormal_msg in", values, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgNotIn(List values) { + addCriterion("abnormal_msg not in", values, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgBetween(String value1, String value2) { + addCriterion("abnormal_msg between", value1, value2, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgNotBetween(String value1, String value2) { + addCriterion("abnormal_msg not between", value1, value2, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andWhetherRebateIsNull() { + addCriterion("whether_rebate is null"); + return (Criteria) this; + } + + public Criteria andWhetherRebateIsNotNull() { + addCriterion("whether_rebate is not null"); + return (Criteria) this; + } + + public Criteria andWhetherRebateEqualTo(Boolean value) { + addCriterion("whether_rebate =", value, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateNotEqualTo(Boolean value) { + addCriterion("whether_rebate <>", value, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateGreaterThan(Boolean value) { + addCriterion("whether_rebate >", value, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateGreaterThanOrEqualTo(Boolean value) { + addCriterion("whether_rebate >=", value, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateLessThan(Boolean value) { + addCriterion("whether_rebate <", value, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateLessThanOrEqualTo(Boolean value) { + addCriterion("whether_rebate <=", value, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateIn(List values) { + addCriterion("whether_rebate in", values, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateNotIn(List values) { + addCriterion("whether_rebate not in", values, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateBetween(Boolean value1, Boolean value2) { + addCriterion("whether_rebate between", value1, value2, "whetherRebate"); + return (Criteria) this; + } + + public Criteria andWhetherRebateNotBetween(Boolean value1, Boolean value2) { + addCriterion("whether_rebate not between", value1, value2, "whetherRebate"); + return (Criteria) this; + } } /** diff --git a/hai-service/src/main/java/com/hai/enum_type/ApproveType.java b/hai-service/src/main/java/com/hai/enum_type/ApproveType.java index ce26d044..c9cb77fc 100644 --- a/hai-service/src/main/java/com/hai/enum_type/ApproveType.java +++ b/hai-service/src/main/java/com/hai/enum_type/ApproveType.java @@ -7,7 +7,8 @@ package com.hai.enum_type; */ public enum ApproveType { UP_SHELF_APPROVE(1, "卡卷上架审批"), - COUPON_PRICE_APPROVE(2, "卡卷价格审批") + COUPON_PRICE_APPROVE(2, "卡卷价格审批"), + COUPON_DISTRIBUTE_APPROVE(3, "卡卷分发审批"), ; private Integer type; diff --git a/hai-service/src/main/java/com/hai/service/BsIntegralRebateService.java b/hai-service/src/main/java/com/hai/service/BsIntegralRebateService.java index fd73ed1c..d59c62f0 100644 --- a/hai-service/src/main/java/com/hai/service/BsIntegralRebateService.java +++ b/hai-service/src/main/java/com/hai/service/BsIntegralRebateService.java @@ -77,6 +77,24 @@ public interface BsIntegralRebateService { **/ void deleteIntegralRebate(Long id); + /** + * @Author Sum1Dream + * @Name integralRebate + * @Description // 订单积分返利 + * @Date 11:32 2022/9/1 + * @Param [object] + * @Return void + */ void integralRebate(JSONObject object); + /** + * @Author Sum1Dream + * @Name integralRechargeRebate + * @Description // 话费订单返利 + * @Date 11:33 2022/9/1 + * @Param [object] + * @Return void + */ + void integralRechargeRebate(JSONObject object); + } diff --git a/hai-service/src/main/java/com/hai/service/CommonService.java b/hai-service/src/main/java/com/hai/service/CommonService.java index 21926282..a2ed2a4d 100644 --- a/hai-service/src/main/java/com/hai/service/CommonService.java +++ b/hai-service/src/main/java/com/hai/service/CommonService.java @@ -8,12 +8,15 @@ package com.hai.service; */ import com.alibaba.fastjson.JSONObject; +import com.hai.entity.ApiCity; import com.hai.entity.SecDictionary; import com.hai.entity.SecRegion; import com.hai.model.IndexCountModel; import com.hai.model.LineCountModel; import com.hai.model.OrderCountModel; import com.hai.model.OrderSumModel; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket; import org.apache.ibatis.type.BigDecimalTypeHandler; import java.math.BigDecimal; @@ -282,4 +285,15 @@ public interface CommonService { */ void configPlatform(JSONObject object); + /** + * @Author Sum1Dream + * @name findCityByName.java + * @Description // 根据名称查询城市 + * @Date 15:00 2022/5/12 + * @Param [String name] + * @return void + */ + ApiCity findCityByName(String name); + + } diff --git a/hai-service/src/main/java/com/hai/service/HighCouponService.java b/hai-service/src/main/java/com/hai/service/HighCouponService.java index 3fb1d46f..74e79dd7 100644 --- a/hai-service/src/main/java/com/hai/service/HighCouponService.java +++ b/hai-service/src/main/java/com/hai/service/HighCouponService.java @@ -73,6 +73,16 @@ public interface HighCouponService { **/ void priceApproveResult(HighApprove highApprove); + /** + * @Author Sum1Dream + * @Name distributeApprove + * @Description // 卡券分发审批 + * @Date 16:57 2022/8/31 + * @Param [highApprove] + * @Return void + */ + void distributeApprove(HighApprove highApprove); + /** * @Author 胡锐 * @Description 根据id查询卡卷基本信息、赠送信息 @@ -105,6 +115,13 @@ public interface HighCouponService { **/ List getCouponList(Map map); + /** + * @Author 胡锐 + * @Description 获取卡卷集合 + * @Date 2021/3/15 23:12 + **/ + List getCouponListByAll(Map map); + /** * @Author 胡锐 * @Description 获取数量 diff --git a/hai-service/src/main/java/com/hai/service/HighOrderService.java b/hai-service/src/main/java/com/hai/service/HighOrderService.java index 69b18dca..bcc36c5c 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderService.java @@ -561,7 +561,7 @@ public interface HighOrderService { * @Param [java.lang.Integer, java.lang.Long] * @return com.alibaba.fastjson.JSONObject */ - JSONObject orderSource(Integer goodsType , Long goodsId , String orderNo , Long companyId); + JSONObject orderSource(Integer goodsType , Long goodsId , String orderNo , Long companyId , Integer productId); /** * @Author Sum1Dream diff --git a/hai-service/src/main/java/com/hai/service/HighUserService.java b/hai-service/src/main/java/com/hai/service/HighUserService.java index 4f1d896b..89d38d05 100644 --- a/hai-service/src/main/java/com/hai/service/HighUserService.java +++ b/hai-service/src/main/java/com/hai/service/HighUserService.java @@ -57,6 +57,16 @@ public interface HighUserService { **/ HighUser findByOpenId(String openId); + /** + * @Author Sum1Dream + * @name findByOpenIdH5.java + * @Description // 根据h5openId查询 + * @Date 15:10 2022/8/23 + * @Param [java.lang.String] + * @return com.hai.entity.HighUser + */ + HighUser findByOpenIdH5(String openId); + /** * * @param unionId diff --git a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java index b47cddec..d0b735d6 100644 --- a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java +++ b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java @@ -176,5 +176,14 @@ public interface OutRechargeOrderService { */ Integer rechargeOrderNum(Long userId); + /** + * @Author Sum1Dream + * @name integralRebateRechargeOrder.java + * @Description // 查询话费未返利订单 + * @Date 17:49 2022/5/30 + * @Param [java.lang.Long] + * @return java.lang.Integer + */ + List integralRebateRechargeOrder(); } diff --git a/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java index a3eef794..6f64041d 100644 --- a/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java @@ -6,10 +6,8 @@ import com.hai.dao.BsIntegralRebateMapper; import com.hai.entity.BsIntegralRebate; import com.hai.entity.BsIntegralRebateExample; import com.hai.entity.HighOrder; -import com.hai.service.BsDistributionUserRelService; -import com.hai.service.BsIntegralRebateService; -import com.hai.service.HighOrderService; -import com.hai.service.HighUserService; +import com.hai.entity.OutRechargeOrder; +import com.hai.service.*; import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; @@ -31,6 +29,9 @@ public class BsIntegralRebateServiceImpl implements BsIntegralRebateService { @Resource private HighOrderService highOrderService; + @Resource + private OutRechargeOrderService outRechargeOrderService; + @Resource private BsDistributionUserRelService bsDistributionUserRelService; @@ -140,4 +141,49 @@ public class BsIntegralRebateServiceImpl implements BsIntegralRebateService { } } + + @Override + public void integralRechargeRebate(JSONObject object) { + + Map map = new HashMap<>(); + map.put("type" , object.getInteger("type")); + map.put("productId" , object.getLong("productId")); + map.put("companyId" , object.getLong("companyId")); + + if (object.getLong("companyId") != null) { + + BsIntegralRebate bsIntegralRebate = findIntegralRebateByMap(map); + + if (DateUtil.isEffectiveDate(object.getDate("createTime"), bsIntegralRebate.getStartTime() , bsIntegralRebate.getEndTime())) { + JSONObject jsonObject = new JSONObject(); + OutRechargeOrder order = outRechargeOrderService.findByOrderId(object.getLong("orderId")); + + order.setWhetherRebate(true); + + BigDecimal integralNum = object.getBigDecimal("price").multiply(bsIntegralRebate.getPercentage()).setScale( 0, BigDecimal.ROUND_HALF_UP ); + if (bsIntegralRebate.getFirstDistribution() !=null) { + BigDecimal integralNumFirst = object.getBigDecimal("price").multiply(bsIntegralRebate.getFirstDistribution()).setScale( 0, BigDecimal.ROUND_HALF_UP ); + jsonObject.put("integralNumFirst" , integralNumFirst); + } + if (bsIntegralRebate.getSecondDistribution() !=null) { + BigDecimal integralNumSecond = object.getBigDecimal("price").multiply(bsIntegralRebate.getSecondDistribution()).setScale( 0, BigDecimal.ROUND_HALF_UP ); + jsonObject.put("integralNumSecond" , integralNumSecond); + } + + order.setWhetherRebate(true); + + jsonObject.put("title" , object.getString("name")); + jsonObject.put("orderNo" , order.getOrderNo()); + jsonObject.put("userId" , object.getLong("userId")); + jsonObject.put("logoImg" , object.getString("logoImg")); + + bsDistributionUserRelService.distributionRebate(jsonObject); + outRechargeOrderService.updateOrder(order); + highUserService.goldHandle(object.getLong("userId"), integralNum.intValue(), 1, 4, object.getLong("orderId") , object.getString("remark") + integralNum); + + } + + } + + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java index 80ea1313..ad6bbe8a 100644 --- a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java @@ -17,7 +17,9 @@ import com.hai.service.CommonService; import com.hai.service.HighOrderService; import com.hai.service.HighUserService; import com.hai.service.SecConfigService; + import org.apache.commons.lang3.StringUtils; + import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -40,7 +42,7 @@ public class CommonServiceImpl implements CommonService { private long lastReadTime = 0; private long regionLastReadTime = 0; - + @Resource private SecRegionMapper regionMapper; @@ -65,6 +67,9 @@ public class CommonServiceImpl implements CommonService { @Resource private BsProductPayTypeMapper bsProductPayTypeMapper; + @Resource + private ApiCityMapper apiCityMapper; + private Map> dicCache = new HashMap>(); private List citiesCache = new ArrayList<>(); @@ -529,18 +534,20 @@ public class CommonServiceImpl implements CommonService { @Override public JSONObject findByLatAndLng(String lng, String lat) throws Exception { - Map map = new HashMap<>();//参数 - map.put("ak", "SfrwGH7INvjPq7BwCrYrioBQZm9XXxrR");//申请百度开放平台KEY(ak) - map.put("output", "json");// 输出Json数据 - map.put("extensions_town", "true");// 行政区划返回乡镇级数据(town),仅国内召回乡镇数据 - map.put("coordtype", "wgs84ll"); // GPS 经纬度类型 - map.put("location", lat+","+lng+"");//百度经纬度 - - String url = "http://api.map.baidu.com/reverse_geocoding/v3/"; - - System.out.println("请求经纬度========" + map); - - return HttpsUtils.doGet(url , map); + //参数 + Map map = new HashMap<>(); + //申请百度开放平台KEY(ak) + map.put("ak", "SfrwGH7INvjPq7BwCrYrioBQZm9XXxrR"); + // 输出Json数据 + map.put("output", "json"); + // 行政区划返回乡镇级数据(town),仅国内召回乡镇数据 + map.put("extensions_town", "true"); + // GPS 经纬度类型 + map.put("coordtype", "wgs84ll"); + //百度经纬度 + map.put("location", lat+","+lng+""); + + return HttpsUtils.doGet("http://api.map.baidu.com/reverse_geocoding/v3/" , map); } @@ -617,7 +624,21 @@ public class CommonServiceImpl implements CommonService { } } - // 清空支付方式配置 + @Override + public ApiCity findCityByName(String name) { + ApiCityExample example = new ApiCityExample(); + example.createCriteria().andCityNameEqualTo(name); + + List list = apiCityMapper.selectByExample(example); + + if (list.size()>0) { + return list.get(0); + } + + return null; + } + + // 清空支付方式配置 private void deletePayType(Long sourceId) { if (sourceId == null) { @@ -676,4 +697,5 @@ public class CommonServiceImpl implements CommonService { } } + } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java index 2c2a8386..542d7fb3 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java @@ -1,15 +1,16 @@ package com.hai.service.impl; +import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.dao.HighApproveMapper; -import com.hai.entity.HighApprove; -import com.hai.entity.HighApproveExample; -import com.hai.entity.HighCoupon; +import com.hai.entity.*; import com.hai.enum_type.ApproveType; import com.hai.model.HighCouponModel; +import com.hai.service.HighAgentService; import com.hai.service.HighApproveService; +import com.hai.service.HighCouponAgentService; import com.hai.service.HighCouponService; import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; @@ -36,8 +37,9 @@ public class HighApproveServiceImpl implements HighApproveService { @Resource private HighCouponService highCouponService; + @Override - @Transactional(propagation= Propagation.REQUIRES_NEW) + @Transactional(propagation= Propagation.REQUIRES_NEW ,rollbackFor = Exception.class) public void insertApprove(HighApprove highApprove) { // 卡卷上架审批 @@ -49,6 +51,11 @@ public class HighApproveServiceImpl implements HighApproveService { if (Objects.equals(highApprove.getObjectType(), ApproveType.COUPON_PRICE_APPROVE.getType())) { // 暂时不需要调用接口 } + + // 卡卷分发审批 + if (Objects.equals(highApprove.getObjectType(), ApproveType.COUPON_DISTRIBUTE_APPROVE.getType())) { + // 暂时不需要调用接口 + } highApproveMapper.insert(highApprove); } @@ -64,14 +71,18 @@ public class HighApproveServiceImpl implements HighApproveService { @Override public void approveProcessed(HighApprove highApprove) { - if (highApprove.getObjectType() == ApproveType.UP_SHELF_APPROVE.getType()) { + if (highApprove.getObjectType().equals(ApproveType.UP_SHELF_APPROVE.getType())) { highCouponService.upShelfApproveResult(highApprove); } - if (highApprove.getObjectType() == ApproveType.COUPON_PRICE_APPROVE.getType()) { + if (highApprove.getObjectType().equals(ApproveType.COUPON_PRICE_APPROVE.getType())) { highCouponService.priceApproveResult(highApprove); } + if (highApprove.getObjectType().equals(ApproveType.COUPON_DISTRIBUTE_APPROVE.getType())) { + highCouponService.distributeApprove(highApprove); + } + updateApprove(highApprove); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java index 37e49106..863eeaf8 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java @@ -71,7 +71,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { private HighCouponCodeOtherService couponCodeOtherService; @Override - @Transactional(propagation= Propagation.REQUIRES_NEW) + @Transactional(propagation= Propagation.REQUIRES_NEW , rollbackFor = Exception.class) public void assignCouponAgent(HighCouponAgentRel highCouponAgentRel,Integer stockCount) { if (highCouponAgentRel.getId() != null) { highCouponAgentRelMapper.updateByPrimaryKey(highCouponAgentRel); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java index 0d369a00..c3aa2277 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java @@ -1,8 +1,12 @@ package com.hai.service.impl; import com.alibaba.fastjson.JSON; +<<<<<<< HEAD import com.alicp.jetcache.anno.CacheType; import com.alicp.jetcache.anno.Cached; +======= +import com.alibaba.fastjson.JSONObject; +>>>>>>> dev_yy import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; @@ -37,6 +41,9 @@ public class HighCouponServiceImpl implements HighCouponService { @Resource private HighCouponMapper highCouponMapper; + @Resource + private HighCouponService highCouponService; + @Resource private HighCouponHandselService highCouponHandselService; @@ -55,8 +62,17 @@ public class HighCouponServiceImpl implements HighCouponService { @Resource private HighApproveService highApproveService; +<<<<<<< HEAD @Autowired private RedisTemplate redisTemplate; +======= + + @Resource + private HighAgentService highAgentService; + + @Resource + private HighCouponAgentService highCouponAgentService; +>>>>>>> dev_yy @Override @Transactional(propagation= Propagation.REQUIRES_NEW) @@ -286,6 +302,53 @@ public class HighCouponServiceImpl implements HighCouponService { highGoodsPriceReferService.updatePriceRefer(highGoodsPriceRefer); } + @Override + public void distributeApprove(HighApprove highApprove) { + JSONObject object = JSONObject.parseObject(highApprove.getApproveObject()); + + if (highApprove.getStatus() == 3) { + // 查询卡券详情 + HighCoupon coupon = highCouponService.getCouponById(object.getLong("couponId")); + if (coupon == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, ""); + } + + // 查询代理商 + HighAgent highAgent = highAgentService.findByAgentMsgId(object.getLong("agentId")); + if (highAgent == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_AGENT, ""); + } + + // 校验是否分配过 + HighCouponAgentRel couponAgent = highCouponAgentService.getRelByCouponAgent(object.getLong("couponId"), object.getLong("agentId"), object.getInteger("type")); + if (couponAgent != null) { + couponAgent.setStockCount(couponAgent.getStockCount() + object.getInteger("stockCount")); + couponAgent.setOperatorId(highApprove.getSubmitOperatorId()); + couponAgent.setOperatorName(highApprove.getSubmitOperatorName()); + highCouponAgentService.assignCouponAgent(couponAgent,object.getInteger("stockCount")); + } else { + + HighCouponAgentRel highCouponAgentRel = new HighCouponAgentRel(); + + highCouponAgentRel.setCouponName(coupon.getCouponName()); + highCouponAgentRel.setSalesPrice(coupon.getSalesPrice()); + // 状态 0:删除 1:正常 + highCouponAgentRel.setStatus(1); + highCouponAgentRel.setSalesCount(0); + highCouponAgentRel.setType(object.getInteger("type")); + highCouponAgentRel.setCouponId(object.getLong("couponId")); + highCouponAgentRel.setAgentId(object.getLong("agentId")); + highCouponAgentRel.setStockCount(object.getInteger("stockCount")); + highCouponAgentRel.setCreateTime(new Date()); + highCouponAgentRel.setOperatorId(highApprove.getSubmitOperatorId()); + highCouponAgentRel.setOperatorName(highApprove.getSubmitOperatorName()); + highCouponAgentService.assignCouponAgent(highCouponAgentRel,highCouponAgentRel.getStockCount()); + } + } + + + } + @Override public HighCoupon getCouponById(Long id) { HighCoupon highCoupon = highCouponMapper.selectByPrimaryKey(id); @@ -398,6 +461,60 @@ public class HighCouponServiceImpl implements HighCouponService { return coupons; } + @Override + public List getCouponListByAll(Map map) { + HighCouponExample example = new HighCouponExample(); + HighCouponExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getLong(map, "companyId") != null) { + criteria.andCompanyIdEqualTo(MapUtils.getLong(map, "companyId")); + } + + if (MapUtils.getLong(map, "merchantId") != null) { + criteria.andMerchantIdEqualTo(MapUtils.getLong(map, "merchantId")); + } + + if (StringUtils.isNotBlank(MapUtils.getString(map, "couponName"))) { + criteria.andCouponNameLike("%" + MapUtils.getString(map, "couponName") + "%"); + } + + if (MapUtils.getInteger(map, "couponType") != null) { + criteria.andCouponTypeEqualTo(MapUtils.getInteger(map, "couponType")); + } + + if (MapUtils.getInteger(map, "displayArea") != null) { + criteria.andDisplayAreaEqualTo(MapUtils.getInteger(map, "displayArea")); + } + + if (MapUtils.getInteger(map, "displayArea") != null) { + criteria.andDisplayAreaEqualTo(MapUtils.getInteger(map, "displayArea")); + } + + if (MapUtils.getInteger(map, "brandId") != null) { + criteria.andBrandIdEqualTo(MapUtils.getInteger(map, "brandId")); + } + + if (MapUtils.getInteger(map, "goodsTypeId") != null) { + criteria.andGoodsTypeIdEqualTo(MapUtils.getInteger(map, "goodsTypeId")); + } + + if (MapUtils.getInteger(map, "status") != null) { + criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); + } + + if (MapUtils.getInteger(map, "couponSource") != null) { + criteria.andCouponSourceEqualTo(MapUtils.getInteger(map, "status")); + } + + if (MapUtils.getInteger(map, "notCouponSource") != null) { + criteria.andCouponSourceNotEqualTo(MapUtils.getInteger(map, "notCouponSource")); + } + + example.setOrderByClause("create_time"); + + return highCouponMapper.selectByExample(example); + } + @Override public Long getCouponByCouponName(Long companyId,String couponName) { HighCouponExample example = new HighCouponExample(); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 0ad01aa2..1461ca06 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -1395,6 +1395,10 @@ public class HighOrderServiceImpl implements HighOrderService { // 扣预存款 this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam); } + + // 打印小票 + printGasOrder(highChildOrder.getGoodsId(), order, false); + } else if (store.getSourceType().equals(2)) { // 推送团油订单 Map paramMap = new HashMap<>(); @@ -2258,8 +2262,6 @@ public class HighOrderServiceImpl implements HighOrderService { // 1 星巴克 2 肯德基 3 会员充值 if (object.getInteger("productType") == 1) { - - List List = new ArrayList<>(); JSONArray array = object.getJSONArray("orderItems"); @@ -2288,7 +2290,7 @@ public class HighOrderServiceImpl implements HighOrderService { if (!object1.getString("milkBubble").equals("")) { contentMap.put("milkBubble", object1.getString("milkBubble")); } - if (!object1.getString("num").equals("")) { + if (!"".equals(object1.getString("num"))) { contentMap.put("num", object1.getString("num")); } List.add(JSON.toJSONString(contentMap)); @@ -3006,7 +3008,7 @@ public class HighOrderServiceImpl implements HighOrderService { } @Override - public JSONObject orderSource(Integer goodsType, Long goodsId , String orderNo , Long companyId) { + public JSONObject orderSource(Integer goodsType, Long goodsId , String orderNo , Long companyId , Integer productId) { JSONObject object = new JSONObject(); @@ -3050,6 +3052,13 @@ public class HighOrderServiceImpl implements HighOrderService { object.put("remark" , "会员充值订单" + orderNo + "积分返利:"); object.put("name" , "购买会员充值产品"); } + if (goodsType == 20) { + object.put("type" , 3); + object.put("productId", productId); + object.put("companyId", companyId); + object.put("remark" , "话费充值订单" + orderNo + "积分返利:"); + object.put("name" , "购买话费充值产品"); + } object.put("logoImg" , OrderLogoEnum.getNameByImgUrl(goodsType)); return object; @@ -3085,6 +3094,7 @@ public class HighOrderServiceImpl implements HighOrderService { /* if (MapUtils.getLong(map , "agentId") != null) { criteria.andIdentificationCodeEqualTo(MapUtils.getLong(map , "agentId")); } else { +<<<<<<< HEAD criteria.andIdentificationCodeIsNotNull(); }*/ @@ -3097,6 +3107,29 @@ public class HighOrderServiceImpl implements HighOrderService { order.setGoodsTypeName("购买:" + GoodsType.getNameByType(childOrder.get(0).getGoodsType())); order.setAgentName(user.getName()); }*/ +======= + criteria.andIdentificationCodeIsNotNull().andIdentificationCodeNotEqualTo(60L); + } + if (MapUtils.getLong(map , "code") != null) { + criteria.andIdentificationCodeEqualTo(MapUtils.getLong(map , "code")); + } + + List list = highOrderMapper.selectByExample(example); + + if (list.size() > 0) { + for (HighOrder order : list) { + HighUser user = highUserService.findByUserId(order.getIdentificationCode()); + order.setTime(DateUtil.date2String(order.getCreateTime() , "MM月dd日 HH:mm")); + List childOrder = getChildOrderByOrder(order.getId()); + order.setGoodsTypeName("购买:" + GoodsType.getNameByType(childOrder.get(0).getGoodsType())); + if (user != null) { + order.setAgentName(user.getName()); + } else { + order.setAgentName("暂无推广人"); + } + } + } +>>>>>>> dev_yy return list; } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java index d3d2814e..884935a7 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java @@ -143,6 +143,17 @@ public class HighUserServiceImpl implements HighUserService { return null; } + @Override + public HighUser findByOpenIdH5(String openId) { + HighUserExample example = new HighUserExample(); + example.createCriteria().andOpenIdH5EqualTo(openId).andStatusEqualTo(1); + List list = highUserMapper.selectByExample(example); + if (list != null && list.size() > 0) { + return list.get(0); + } + return null; + } + @Override public HighUser findByUnionId(String unionId) { HighUserExample example = new HighUserExample(); diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java index d574e491..adce9005 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java @@ -166,6 +166,19 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { DateUtil.format(MapUtils.getString(map, "createTimeE"), "yyyy-MM-dd HH:mm:ss")); } + if (MapUtils.getBoolean(map , "whetherTimeOut") != null && MapUtils.getBoolean(map , "whetherTimeOut")) { + // 获取当前时间 + Date date= new Date(); + Calendar calendar = new GregorianCalendar(); + calendar.setTime(date); + // 把日期往前减少三天,整数 往后推,负数往前移动 + calendar.add(Calendar.DATE, -3); + // 这个时间就是日期往后推一天的结果 + date = calendar.getTime(); + criteria.andCreateTimedLessThan(date); + } + + example.setOrderByClause("create_timed desc"); return outRechargeOrderMapper.selectByExample(example); } @@ -322,6 +335,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { outRechargeOrder.setOrderNo("RCG" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5)); outRechargeOrder.setCreateTimed(new Date()); outRechargeOrder.setGoodsId(goodsId); + outRechargeOrder.setWhetherRebate(false); outRechargeOrder.setMerchId(object.getString("mchId")); outRechargeOrder.setRechargePrice(outRechargePrice.getRechargePrice()); if (object.getLong("memDiscountId") != null) { @@ -435,33 +449,6 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { public void finishOrder(Long orderId) { OutRechargeOrder order = findByOrderId(orderId); if (order != null) { - - new Thread(() -> { - JSONObject object = new JSONObject(); - - object.put("type" , 3); - object.put("productId" , order.getOperatorType()); - object.put("companyId" , order.getCompanyId()); - object.put("price" , order.getPayRealPrice()); - object.put("userId" , order.getUserId()); - object.put("orderId" , order.getId()); - object.put("remark" , "话费订单" + order.getOrderNo() + "积分返利:"); - - - Map map = new HashMap<>(); - map.put("goldType", 1); - map.put("resType", 4); - map.put("userId", order.getUserId()); - map.put("resId", order.getId()); - - List goldRecs = highGoldRecService.getGoldRec(map); - - if (goldRecs.size() == 0) { - bsIntegralRebateService.integralRebate(object); - } - - }).start(); - order.setRechargeStatus(202); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款 order.setPayStatus(100); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款 order.setFinishTime(new Date()); @@ -1004,4 +991,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { return outRechargeOrderMapper.selectByExample(example).size(); } + @Override + public List integralRebateRechargeOrder() { + return outRechargeOrderMapper.integralRebateRechargeOrder(); + } + } diff --git a/hai-service/src/main/resources/prod-9401/commonConfig.properties b/hai-service/src/main/resources/prod-9401/commonConfig.properties index a2208f9b..52af6340 100644 --- a/hai-service/src/main/resources/prod-9401/commonConfig.properties +++ b/hai-service/src/main/resources/prod-9401/commonConfig.properties @@ -96,4 +96,5 @@ unionSecret=a0f380bb22cd4ce2a8d35f3bf437d6fa unionRsaKey=f2e6b6b95da445866194498c371a7c8af2e6b6b95da44586 #url -fileUrl=/home/project/hlt/filesystem/ +fileUrl=/home/project/hsg/filesystem/ + diff --git a/hai-service/src/main/resources/prod/commonConfig.properties b/hai-service/src/main/resources/prod/commonConfig.properties index bc86281c..6f7009f1 100644 --- a/hai-service/src/main/resources/prod/commonConfig.properties +++ b/hai-service/src/main/resources/prod/commonConfig.properties @@ -94,4 +94,5 @@ unionSecret=a0f380bb22cd4ce2a8d35f3bf437d6fa unionRsaKey=f2e6b6b95da445866194498c371a7c8af2e6b6b95da44586 #url -fileUrl=/home/project/hlt/filesystem/ +fileUrl=/home/project/hsg/filesystem/ + diff --git a/v1/hai-v1.iml b/v1/hai-v1.iml new file mode 100644 index 00000000..9ecb2698 --- /dev/null +++ b/v1/hai-v1.iml @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/v1/src/main/java/com/v1/config/AuthConfig.java b/v1/src/main/java/com/v1/config/AuthConfig.java index 208a9421..d85e96cd 100644 --- a/v1/src/main/java/com/v1/config/AuthConfig.java +++ b/v1/src/main/java/com/v1/config/AuthConfig.java @@ -95,6 +95,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/thirdParty/*") .excludePathPatterns("/selfOilStation/*") .excludePathPatterns("/order/*") + .excludePathPatterns("/wxMsg/*") ; } diff --git a/v1/src/main/java/com/v1/config/SysConfig.java b/v1/src/main/java/com/v1/config/SysConfig.java index 47b1abec..2a69f41b 100644 --- a/v1/src/main/java/com/v1/config/SysConfig.java +++ b/v1/src/main/java/com/v1/config/SysConfig.java @@ -9,5 +9,22 @@ import org.springframework.stereotype.Component; @PropertySource("classpath:/config.properties") public class SysConfig { + private String wxH5AppId; + private String wxH5AppSecret; + public String getWxH5AppId() { + return wxH5AppId; + } + + public void setWxH5AppId(String wxH5AppId) { + this.wxH5AppId = wxH5AppId; + } + + public String getWxH5AppSecret() { + return wxH5AppSecret; + } + + public void setWxH5AppSecret(String wxH5AppSecret) { + this.wxH5AppSecret = wxH5AppSecret; + } } diff --git a/v1/src/main/java/com/v1/config/WeChatQrcodeUtils.java b/v1/src/main/java/com/v1/config/WeChatQrcodeUtils.java new file mode 100644 index 00000000..ced8374d --- /dev/null +++ b/v1/src/main/java/com/v1/config/WeChatQrcodeUtils.java @@ -0,0 +1,121 @@ +package com.v1.config; + + +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.File; + +/** + * @serviceName WeChatQrcodeUtils.java + * @author Sum1Dream + * @version 1.0.0 + * @Description // 生成带参数的二维码 + * @createTime 16:11 2022/9/2 + **/ +@Slf4j +@Component +public class WeChatQrcodeUtils { + + @Autowired + private WxMpService wxMpService; + + /** + *
+     * 创建临时二维码ticket
+     * @param sceneId       场景值ID,临时二维码时为32位非0整型
+     * @param expireSeconds 该二维码有效时间,以秒为单位。 最大不超过2592000(即30天),此字段如果不填,则默认有效期为30秒。
+     * @auther: cao_wencao
+     * @date: 2019/2/18 16:58
+     * 
+ */ + public WxMpQrCodeTicket qrCodeCreateTmpTicket(int sceneId, Integer expireSeconds) throws WxErrorException { + WxMpQrCodeTicket wxMpQrCodeTicket = wxMpService.getQrcodeService().qrCodeCreateTmpTicket(sceneId, expireSeconds); + return wxMpQrCodeTicket; + } + + /** + *
+     * 创建临时二维码ticket
+     * @param sceneStr      场景值ID(字符串形式的ID),字符串类型,长度限制为1到64
+     * @param expireSeconds 该二维码有效时间,以秒为单位。 最大不超过2592000(即30天),此字段如果不填,则默认有效期为30秒。
+     * @auther: cao_wencao
+     * @date: 2019/2/18 17:01
+     * 
+ */ + public WxMpQrCodeTicket qrCodeCreateTmpTicket(String sceneStr, Integer expireSeconds) throws WxErrorException { + WxMpQrCodeTicket wxMpQrCodeTicket = wxMpService.getQrcodeService().qrCodeCreateTmpTicket(sceneStr, expireSeconds); + return wxMpQrCodeTicket; + } + + /** + *
+     * 创建永久二维码ticket
+     * @param sceneId 场景值ID,最大值为100000(目前参数只支持1--100000)
+     * @auther: cao_wencao
+     * @date: 2019/2/18 17:03
+     * 
+ */ + public WxMpQrCodeTicket qrCodeCreateLastTicket(int sceneId) throws WxErrorException { + return wxMpService.getQrcodeService().qrCodeCreateLastTicket(sceneId); + } + + /** + *
+     * 创建永久字符串二维码ticket
+     * @param sceneStr 参数。字符串类型长度现在为1到64
+     * @auther: cao_wencao
+     * @date: 2019/2/18 17:05
+     * 
+ */ + public WxMpQrCodeTicket qrCodeCreateLastTicket(String sceneStr) throws WxErrorException { + return wxMpService.getQrcodeService().qrCodeCreateLastTicket(sceneStr); + } + + /** + *
+     * 换取二维码图片文件,jpg格式
+     * @param ticket 二维码ticket
+     * @auther: cao_wencao
+     * @date: 2019/2/18 17:07
+     * 
+ */ + public File qrCodePicture(WxMpQrCodeTicket ticket) throws WxErrorException { + return wxMpService.getQrcodeService().qrCodePicture(ticket); + + } + + /** + *
+     * 换取二维码图片url地址(可以选择是否生成压缩的网址)
+     * @param ticket       二维码ticket
+     * @param needShortUrl 是否需要压缩的二维码地址
+     * @auther: cao_wencao
+     * @date: 2019/2/18 17:10
+     * 
+ */ + public String qrCodePictureUrl(String ticket, boolean needShortUrl) throws WxErrorException { + String qrCodeUrl = wxMpService.getQrcodeService().qrCodePictureUrl(ticket, needShortUrl); + return qrCodeUrl; + } + + /** + *
+     * 换取二维码图片url地址
+     * @param ticket 二维码ticket
+     * @auther: cao_wencao
+     * @date: 2019/2/18 17:11
+     * 
+ */ + public String qrCodePictureUrl(String ticket) throws WxErrorException { + String url = wxMpService.getQrcodeService().qrCodePictureUrl(ticket); + return url; + } + + +} diff --git a/v1/src/main/java/com/v1/config/WxConfig.java b/v1/src/main/java/com/v1/config/WxConfig.java new file mode 100644 index 00000000..286afac7 --- /dev/null +++ b/v1/src/main/java/com/v1/config/WxConfig.java @@ -0,0 +1,51 @@ +package com.v1.config; + +import com.hai.config.CommonSysConst; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; +import me.chanjar.weixin.mp.config.WxMpConfigStorage; +import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @serviceName .java + * @author Sum1Dream + * @version 1.0.0 + * @Description //TODO + * @createTime 16:24 2022/9/2 + **/ +@Configuration +public class WxConfig { + + + /** + * 微信客户端配置存储 + * + * @return + */ + @Bean + public WxMpConfigStorage wxMpConfigStorage() { + WxMpDefaultConfigImpl configStorage = new WxMpDefaultConfigImpl(); + // 公众号appId + configStorage.setAppId(SysConst.getSysConfig().getWxH5AppId()); + // 公众号appSecret + configStorage.setSecret(SysConst.getSysConfig().getWxH5AppSecret()); + return configStorage; + } + + /** + * @Author Sum1Dream + * @Name wxMpService + * @Description //TODO + * @Date 16:24 2022/9/2 + * @Param [] + * @Return WxMpService + */ + @Bean + public WxMpService wxMpService() { + WxMpService wxMpService = new WxMpServiceImpl(); + wxMpService.setWxMpConfigStorage(wxMpConfigStorage()); + return wxMpService; + } +} diff --git a/v1/src/main/java/com/v1/controller/WxMsgController.java b/v1/src/main/java/com/v1/controller/WxMsgController.java new file mode 100644 index 00000000..12e0928d --- /dev/null +++ b/v1/src/main/java/com/v1/controller/WxMsgController.java @@ -0,0 +1,140 @@ +package com.v1.controller; + +import com.alibaba.fastjson.JSONObject; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.pay.util.IOUtil; +import com.hai.common.pay.util.XmlUtil; +import com.hai.common.utils.HttpsUtils; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.common.utils.WxUtils; +import com.hai.model.ResponseData; +import com.hai.service.CommonService; +import com.v1.config.SysConst; +import com.v1.config.WeChatQrcodeUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +import me.chanjar.weixin.common.error.WxErrorException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import java.util.HashMap; +import java.util.Map; +import java.util.SortedMap; + +/** + * @author sum1dream + */ + +@Controller +@RequestMapping(value = "/wxMsg") +@Api(value = "自建站接口") +public class WxMsgController { + + private static Logger log = LoggerFactory.getLogger(ThirdPartyController.class); + + @Autowired + private WeChatQrcodeUtils weChatQrcodeUtils; + + + + @RequestMapping(value = "/verifyWxToken", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "验证servlet") + public String verifyWxToken(HttpServletRequest request) { + + try { + log.info("进入公众号!!!!!!!"); + // 反馈给微信服务器 + String resXml = ""; + // 微信支付系统发送的数据(格式) + String notifyXml; + notifyXml = IOUtil.inputStreamToString(request.getInputStream(), "UTF-8"); + + log.info("微信支付系统发送的数据:" + notifyXml); + SortedMap map = XmlUtil.parseXmlToTreeMap(notifyXml, "UTF-8"); + + // 区分消息类型 + String msgType = map.get("MsgType"); + log.info("微信支付系统发送的数据:" + msgType); + return null; + } catch (Exception e) { + return null; + } + + } + + @RequestMapping(value = "/getWxToken", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "获取微信token") + public ResponseData getWxToken() { + try { + Map params = new HashMap<>(); + params.put("appid", SysConst.getSysConfig().getWxH5AppId()); + params.put("secret", SysConst.getSysConfig().getWxH5AppSecret()); + params.put("grant_type", "client_credential"); + + JSONObject accessTokenObject = HttpsUtils.doGet("https://api.weixin.qq.com/cgi-bin/token", params); + if (accessTokenObject == null) { + log.error("getH5UserInfo error!", "获取微信access_token失败" ); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取微信access_token失败"); + } + + return ResponseMsgUtil.success(accessTokenObject); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + + /** + *
+     * @desc: 创建生成二维码
+     * @auth: cao_wencao
+     * @date: 2019/4/10 14:00
+     * 
+ */ + + @RequestMapping(value = "/createQrcode", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "创建生成二维码") + public ResponseData createQrcode(@RequestParam(name = "sceneId", required = false) Integer sceneId) { + try { + return ResponseMsgUtil.success(weChatQrcodeUtils.qrCodeCreateLastTicket(sceneId)); + } catch (WxErrorException e) { + return ResponseMsgUtil.exception(e); + } + } + + /** + *
+     * @desc: 通过ticket获取二维码(长链接URL)
+     * @auth: cao_wencao
+     * @date: 2019/4/10 14:00
+     * 
+ */ + @RequestMapping(value = "/getQrcodeUrl", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "创建生成二维码") + public ResponseData getQrcodeUrl(@RequestParam(name = "ticket", required = false) String ticket) { + try { + return ResponseMsgUtil.success(weChatQrcodeUtils.qrCodePictureUrl(ticket)); + } catch (WxErrorException e) { + return ResponseMsgUtil.exception(e); + } + } + + +} diff --git a/v1/src/main/resources/dev/config.properties b/v1/src/main/resources/dev/config.properties index e69de29b..b7bbc8e8 100644 --- a/v1/src/main/resources/dev/config.properties +++ b/v1/src/main/resources/dev/config.properties @@ -0,0 +1,2 @@ +wxH5AppId=wxa075e8509802f826 +wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5 diff --git a/v1/src/main/resources/dev/logback.xml b/v1/src/main/resources/dev/logback.xml index a7602e3d..eb31bd4d 100644 --- a/v1/src/main/resources/dev/logback.xml +++ b/v1/src/main/resources/dev/logback.xml @@ -63,6 +63,9 @@ + + +