修改话费订单导出

袁野 2 years ago
parent b64efc9198
commit 2af7e3de5e
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  2. 18
      hai-service/src/main/java/com/hai/dao/ApiProductConfigMapperExt.java
  3. 66
      hai-service/src/main/java/com/hai/model/ApiProductConfigModel.java
  4. 5
      hai-service/src/main/java/com/hai/service/ApiOpenService.java
  5. 2
      hai-service/src/main/java/com/hai/service/SecConfigService.java
  6. 10
      hai-service/src/main/java/com/hai/service/impl/ApiOpenServiceImpl.java
  7. 3
      hai-service/src/main/java/com/hai/service/impl/ApiProductServiceImpl.java
  8. 13
      hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java
  9. 7
      hai-service/src/main/java/com/hai/service/impl/SecConfigServiceImpl.java
  10. 63
      v1/src/main/java/com/v1/controller/RechargeProductController.java

File diff suppressed because one or more lines are too long

@ -46,31 +46,19 @@ public interface ApiProductConfigMapperExt {
@Select(value = { @Select(value = {
"<script>", "<script>",
" select ap.* , discount_price , apc.id as api_config_product_id , discount , apc.status as config_status from api_product ap join api_product_config apc on ap.id = apc.product_id where apc.status = 101", " select recharge_type , phone_recharge_type ,operator_type , recharge_price , discount_price , apc.id as api_config_product_id , discount from api_product ap join api_product_config apc on ap.id = apc.product_id where apc.status = 101",
" and merchants_id = #{merchantsId} and ap.recharge_type = = #{rechargeType}" + " and merchants_id = #{merchantsId} and ap.recharge_type = #{rechargeType}" +
"</script>" "</script>"
}) })
@Results({ @Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="recharge_type", property="rechargeType", jdbcType=JdbcType.INTEGER), @Result(column="recharge_type", property="rechargeType", jdbcType=JdbcType.INTEGER),
@Result(column="recharge_platform", property="rechargePlatform", jdbcType=JdbcType.VARCHAR),
@Result(column="phone_recharge_type", property="phoneRechargeType", jdbcType=JdbcType.INTEGER), @Result(column="phone_recharge_type", property="phoneRechargeType", jdbcType=JdbcType.INTEGER),
@Result(column="operator_type", property="operatorType", jdbcType=JdbcType.INTEGER), @Result(column="operator_type", property="operatorType", jdbcType=JdbcType.INTEGER),
@Result(column="recharge_price", property="rechargePrice", jdbcType=JdbcType.DECIMAL), @Result(column="recharge_price", property="rechargePrice", jdbcType=JdbcType.DECIMAL),
@Result(column="product_id", property="productId", jdbcType=JdbcType.BIGINT),
@Result(column="api_config_product_id", property="apiConfigProductId", jdbcType=JdbcType.BIGINT), @Result(column="api_config_product_id", property="apiConfigProductId", jdbcType=JdbcType.BIGINT),
@Result(column="sort", property="sort", jdbcType=JdbcType.INTEGER),
@Result(column="discount", property="discount", jdbcType=JdbcType.DECIMAL), @Result(column="discount", property="discount", jdbcType=JdbcType.DECIMAL),
@Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL), @Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT),
@Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="config_status", property="configStatus", 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)
}) })
List<ApiProductConfigModel> getMerchProduct(Long merchantsId , Integer rechargeType); List<ApiProductConfigModel> getMerchProduct(Long merchantsId , Integer rechargeType);

@ -5,7 +5,28 @@ import com.hai.entity.ApiProductConfig;
import java.math.BigDecimal; import java.math.BigDecimal;
public class ApiProductConfigModel extends ApiProduct { public class ApiProductConfigModel {
/**
* 充值类型 1:话费
*/
private Integer rechargeType;
/**
* 话费充值方式 1.快充 2慢充
*/
private Integer phoneRechargeType;
/**
* 运营商 1 电信 2.移动 3.联通
*/
private Integer operatorType;
/**
* 充值金额
*/
private BigDecimal rechargePrice;
/** /**
* 折扣比例 * 折扣比例
*/ */
@ -21,25 +42,36 @@ public class ApiProductConfigModel extends ApiProduct {
*/ */
private Long apiConfigProductId; private Long apiConfigProductId;
/** public Integer getRechargeType() {
* 101 正常 102 下架 100 删除 return rechargeType;
*/ }
private Integer configStatus;
public Integer getConfigStatus() { public void setRechargeType(Integer rechargeType) {
return configStatus; this.rechargeType = rechargeType;
} }
public void setConfigStatus(Integer configStatus) { public Integer getPhoneRechargeType() {
this.configStatus = configStatus; return phoneRechargeType;
} }
public Long getApiConfigProductId() { public void setPhoneRechargeType(Integer phoneRechargeType) {
return apiConfigProductId; this.phoneRechargeType = phoneRechargeType;
} }
public void setApiConfigProductId(Long apiConfigProductId) { public Integer getOperatorType() {
this.apiConfigProductId = apiConfigProductId; return operatorType;
}
public void setOperatorType(Integer operatorType) {
this.operatorType = operatorType;
}
public BigDecimal getRechargePrice() {
return rechargePrice;
}
public void setRechargePrice(BigDecimal rechargePrice) {
this.rechargePrice = rechargePrice;
} }
public BigDecimal getDiscount() { public BigDecimal getDiscount() {
@ -57,4 +89,12 @@ public class ApiProductConfigModel extends ApiProduct {
public void setDiscountPrice(BigDecimal discountPrice) { public void setDiscountPrice(BigDecimal discountPrice) {
this.discountPrice = discountPrice; this.discountPrice = discountPrice;
} }
public Long getApiConfigProductId() {
return apiConfigProductId;
}
public void setApiConfigProductId(Long apiConfigProductId) {
this.apiConfigProductId = apiConfigProductId;
}
} }

@ -1,6 +1,9 @@
package com.hai.service; package com.hai.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hai.entity.ApiMerchants;
import com.hai.entity.ApiProduct;
import com.hai.entity.ApiProductConfig;
/** /**
* @serviceName ApiOpenService.java * @serviceName ApiOpenService.java
@ -19,6 +22,6 @@ public interface ApiOpenService {
* @Param [com.alibaba.fastjson.JSONObject] * @Param [com.alibaba.fastjson.JSONObject]
* @return com.alibaba.fastjson.JSONObject * @return com.alibaba.fastjson.JSONObject
*/ */
JSONObject createOrder(JSONObject object) throws Exception; JSONObject createOrder(JSONObject object , ApiMerchants apiMerchants , ApiProductConfig productConfig) throws Exception;
} }

@ -59,6 +59,6 @@ public interface SecConfigService {
* @Param [java.util.Map<java.lang.String,java.lang.Object>] * @Param [java.util.Map<java.lang.String,java.lang.Object>]
* @return java.lang.Boolean * @return java.lang.Boolean
*/ */
Boolean isSignVerify(Map<String, Object> map) throws Exception; Boolean isSignVerify(Map<String, Object> map , String sign) throws Exception;
} }

@ -52,7 +52,7 @@ public class ApiOpenServiceImpl implements ApiOpenService {
@Override @Override
@Transactional(rollbackFor=Exception.class,isolation = Isolation.SERIALIZABLE,propagation= Propagation.REQUIRES_NEW) @Transactional(rollbackFor=Exception.class,isolation = Isolation.SERIALIZABLE,propagation= Propagation.REQUIRES_NEW)
public JSONObject createOrder(JSONObject object) throws Exception { public JSONObject createOrder(JSONObject object , ApiMerchants apiMerchants , ApiProductConfig productConfig) throws Exception {
Map<String, Object> orderMap = new HashMap<>(); Map<String, Object> orderMap = new HashMap<>();
orderMap.put("sourceOrderNo" , object.getString("orderNo")); orderMap.put("sourceOrderNo" , object.getString("orderNo"));
@ -60,20 +60,14 @@ public class ApiOpenServiceImpl implements ApiOpenService {
// 查询是否用重复订单 // 查询是否用重复订单
ApiOrderRecord apiOrderRecord = apiOrderRecordService.queryOrderResult(orderMap); ApiOrderRecord apiOrderRecord = apiOrderRecordService.queryOrderResult(orderMap);
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId"));
if (apiOrderRecord != null) { if (apiOrderRecord != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_ALREADY_EXISTS); throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_ALREADY_EXISTS);
} }
ApiProduct apiProduct = apiProductService.findById(object.getLong("goodsId")); ApiProduct apiProduct = apiProductService.findById(productConfig.getProductId());
// 查询商户配置产品
Map<String, Object> productMap = new HashMap<>();
productMap.put("productId" , object.getString("goodsId"));
productMap.put("merchantsId" , apiMerchants.getId());
ApiProductConfig productConfig = apiProductService.findMchProduct(productMap);
// 当前账号余额是否可以充值当前金额 // 当前账号余额是否可以充值当前金额
if (apiMerchants.getAmounts().compareTo(productConfig.getDiscountPrice()) < 0) { if (apiMerchants.getAmounts().compareTo(productConfig.getDiscountPrice()) < 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.INSUFFICIENT_BALANCE); throw ErrorHelp.genException(SysCode.System, ErrorCode.INSUFFICIENT_BALANCE);

@ -150,6 +150,9 @@ public class ApiProductServiceImpl implements ApiProductService {
if (MapUtils.getLong(map , "productId") != null) { if (MapUtils.getLong(map , "productId") != null) {
criteria.andProductIdEqualTo(MapUtils.getLong(map , "productId")); criteria.andProductIdEqualTo(MapUtils.getLong(map , "productId"));
} }
if (MapUtils.getLong(map , "id") != null) {
criteria.andIdEqualTo(MapUtils.getLong(map , "id"));
}
List<ApiProductConfig> list = apiProductConfigMapper.selectByExample(example); List<ApiProductConfig> list = apiProductConfigMapper.selectByExample(example);

@ -10,6 +10,7 @@ import com.hai.common.exception.SysCode;
import com.hai.common.utils.DateUtil; import com.hai.common.utils.DateUtil;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongConfig;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.dao.*; import com.hai.dao.*;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.enum_type.OrderPushType; import com.hai.enum_type.OrderPushType;
@ -487,6 +488,18 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
couponCodeOther.setStatus(20); couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date()); couponCodeOther.setCreateTime(new Date());
highCouponCodeOtherMapper.insert(couponCodeOther); highCouponCodeOtherMapper.insert(couponCodeOther);
Map<String, Object> map = new HashMap<>();
map.put("orderNo" , convertCode.getCouponCode());
map.put("distCouCount" , "1");
map.put("phone" , phone);
map.put("distributorId" , "1JnL8YMV");
map.put("couNo" , dataObject.getString("couNo"));
map.put("status" , "20");
map.put("couTypeCode" , dataObject.getString("couTypeCode"));
map.put("validStartDate" , dataObject.getDate("validStartDate"));
map.put("validEndDate" , dataObject.getDate("validEndDate"));
HuiLianTongUnionCardConfig.syncPayOrder(map);
} }
} }
// 推送记录 // 推送记录

@ -13,6 +13,7 @@ import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.SortedMap; import java.util.SortedMap;
@ -53,9 +54,9 @@ public class SecConfigServiceImpl implements SecConfigService {
@Override @Override
public Boolean isSignVerify(Map<String, Object> map) throws Exception { public Boolean isSignVerify(Map<String, Object> map, String sign) throws Exception {
String sign = WxUtils.generateSignApi(map , MapUtils.getString(map , "apiKey"), WXPayConstants.SignType.MD5); String signPost = WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5);
return MapUtils.getString(map, "sign").equals(sign); return signPost.equals(sign);
} }
} }

@ -12,6 +12,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import jdk.jfr.consumer.RecordedObject; import jdk.jfr.consumer.RecordedObject;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -51,6 +52,9 @@ public class RechargeProductController {
@Resource @Resource
private ApiProductService apiProductService; private ApiProductService apiProductService;
@Resource
private ApiOpenService apiOpenService;
@RequestMapping(value = "/getRechargeProduct", method = RequestMethod.POST) @RequestMapping(value = "/getRechargeProduct", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "获取充值产品") @ApiOperation(value = "获取充值产品")
@ -70,9 +74,9 @@ public class RechargeProductController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
} }
if (object.getString("apiKey") == null || if (StringUtils.isBlank(object.getString("apiKey")) ||
object.getString("merchId") == null || StringUtils.isBlank(object.getString("merchId")) ||
object.getString("sign") == null || StringUtils.isBlank(object.getString("sign")) ||
object.getInteger("rechargeType") == null object.getInteger("rechargeType") == null
) { ) {
log.error("getRechargeProduct error!", "请求参数校验失败!"); log.error("getRechargeProduct error!", "请求参数校验失败!");
@ -89,10 +93,9 @@ public class RechargeProductController {
Map<String , Object> map = new HashMap<>(); Map<String , Object> map = new HashMap<>();
map.put("apiKey" , object.getString("apiKey")); map.put("apiKey" , object.getString("apiKey"));
map.put("merchId" , object.getString("merchId")); map.put("merchId" , object.getString("merchId"));
map.put("rechargeType" , object.getString("type")); map.put("rechargeType" , object.getString("rechargeType"));
map.put("sign" , object.getString("sign"));
if (!secConfigService.isSignVerify(map)) { if (!secConfigService.isSignVerify(map , object.getString("sign"))) {
log.error("getRechargeProduct error!", "签名校验失败!"); log.error("getRechargeProduct error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
} }
@ -124,9 +127,9 @@ public class RechargeProductController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
} }
if (object.getString("apiKey") == null || if (StringUtils.isBlank(object.getString("apiKey")) ||
object.getString("sign") == null || StringUtils.isBlank(object.getString("merchId")) ||
object.getString("merchId") == null StringUtils.isBlank(object.getString("sign"))
) { ) {
log.error("getRechargeProduct error!", "请求参数校验失败!"); log.error("getRechargeProduct error!", "请求参数校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR);
@ -142,9 +145,8 @@ public class RechargeProductController {
Map<String , Object> map = new HashMap<>(); Map<String , Object> map = new HashMap<>();
map.put("apiKey" , object.getString("apiKey")); map.put("apiKey" , object.getString("apiKey"));
map.put("merchId" , object.getString("merchId")); map.put("merchId" , object.getString("merchId"));
map.put("sign" , object.getString("sign"));
if (!secConfigService.isSignVerify(map)) { if (!secConfigService.isSignVerify(map , object.getString("sign"))) {
log.error("getRechargeProduct error!", "签名校验失败!"); log.error("getRechargeProduct error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
} }
@ -176,11 +178,10 @@ public class RechargeProductController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
} }
if (object.getString("apiKey") == null || if (StringUtils.isBlank(object.getString("apiKey")) ||
object.getString("merchId") == null || StringUtils.isBlank(object.getString("merchId")) ||
object.getString("sign") == null || StringUtils.isBlank(object.getString("sign")) ||
object.getString("sourceOrderNo") == null StringUtils.isBlank(object.getString("sourceOrderNo"))
) { ) {
log.error("getRechargeProduct error!", "请求参数校验失败!"); log.error("getRechargeProduct error!", "请求参数校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR);
@ -197,9 +198,8 @@ public class RechargeProductController {
map.put("apiKey" , object.getString("apiKey")); map.put("apiKey" , object.getString("apiKey"));
map.put("merchId" , object.getString("merchId")); map.put("merchId" , object.getString("merchId"));
map.put("sourceOrderNo" , object.getString("sourceOrderNo")); map.put("sourceOrderNo" , object.getString("sourceOrderNo"));
map.put("sign" , object.getString("sign"));
if (!secConfigService.isSignVerify(map)) { if (!secConfigService.isSignVerify(map , object.getString("sign"))) {
log.error("getRechargeProduct error!", "签名校验失败!"); log.error("getRechargeProduct error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
} }
@ -252,13 +252,13 @@ public class RechargeProductController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
} }
if (object.getString("mobile") == null || if (StringUtils.isBlank(object.getString("mobile")) ||
object.getString("goodsId") == null || StringUtils.isBlank(object.getString("apiConfigProductId")) ||
object.getString("appKey") == null || StringUtils.isBlank(object.getString("appKey")) ||
object.getString("orderNo") == null || StringUtils.isBlank(object.getString("orderNo")) ||
object.getString("notifyUrl") == null || StringUtils.isBlank(object.getString("notifyUrl")) ||
object.getString("sign") == null || StringUtils.isBlank(object.getString("sign")) ||
object.getString("merchId") == null StringUtils.isBlank(object.getString("merchId"))
) { ) {
log.error("createOrder error!", "请求参数校验失败!"); log.error("createOrder error!", "请求参数校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR);
@ -273,29 +273,30 @@ public class RechargeProductController {
Map<String, Object> productMap = new HashMap<>(); Map<String, Object> productMap = new HashMap<>();
productMap.put("productId" , object.getString("goodsId")); productMap.put("id" , object.getString("apiConfigProductId"));
productMap.put("merchantsId" , apiMerchants.getId()); productMap.put("merchantsId" , apiMerchants.getId());
if (apiProductService.findMchProduct(productMap) == null) { ApiProductConfig apiProductConfig = apiProductService.findMchProduct(productMap);
if (apiProductConfig == null) {
log.error("createOrder error!", " 商品错误!"); log.error("createOrder error!", " 商品错误!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.PRODUCT_ERROR); throw ErrorHelp.genException(SysCode.System, ErrorCode.PRODUCT_ERROR);
} }
Map<String , Object> map = new HashMap<>(); Map<String , Object> map = new HashMap<>();
map.put("mobile" , object.getString("mobile")); map.put("mobile" , object.getString("mobile"));
map.put("goodsId" , object.getString("goodsId")); map.put("goodsId" , apiProductConfig.getProductId());
map.put("orderNo" , object.getString("orderNo")); map.put("orderNo" , object.getString("orderNo"));
map.put("notifyUrl" , object.getString("notifyUrl")); map.put("notifyUrl" , object.getString("notifyUrl"));
map.put("apiKey" , object.getString("apiKey")); map.put("apiKey" , object.getString("apiKey"));
map.put("merchId" , object.getString("merchId")); map.put("merchId" , object.getString("merchId"));
map.put("sign" , object.getString("sign"));
if (!secConfigService.isSignVerify(map)) { if (!secConfigService.isSignVerify(map, object.getString("sign"))) {
log.error("createOrder error!", "签名校验失败!"); log.error("createOrder error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
} }
return ResponseMsgUtil.success(apiMerchants.getAmounts()); return ResponseMsgUtil.success(apiOpenService.createOrder(object , apiMerchants , apiProductConfig));
} catch (Exception e) { } catch (Exception e) {
log.error("HighOpenApiController --> createOrder() error!", e); log.error("HighOpenApiController --> createOrder() error!", e);

Loading…
Cancel
Save