提交代理商

dev-discount
袁野 2 years ago
parent 970390e0e9
commit 884daa1f39
  1. 179
      hai-bweb/src/main/java/com/bweb/controller/ApiMerchantsController.java
  2. 26
      hai-bweb/src/main/java/com/bweb/controller/HighOpenApiController.java
  3. 2
      hai-bweb/src/main/resources/dev/application.yml
  4. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  5. 9
      hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java
  6. 2
      hai-cweb/src/main/resources/dev/application.yml
  7. 29
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  8. 38
      hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java
  9. 2
      hai-service/src/main/java/com/hai/entity/HighOrder.java
  10. 1
      hai-service/src/main/java/com/hai/enum_type/OrderPayModelEnum.java
  11. 1
      hai-service/src/main/java/com/hai/enum_type/OrderPayTypeEnum.java
  12. 163
      hai-service/src/main/java/com/hai/model/ApiRechargePhoneModel.java
  13. 112
      hai-service/src/main/java/com/hai/model/ApiThirdOrderModel.java
  14. 11
      hai-service/src/main/java/com/hai/service/ApiMerchantsService.java
  15. 16
      hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java
  16. 10
      hai-service/src/main/java/com/hai/service/impl/ApiMerchantsServiceImpl.java
  17. 292
      hai-service/src/main/java/com/hai/service/impl/ApiOpenServiceImpl.java
  18. 9
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  19. 5
      v1/src/main/java/com/v1/controller/ApiMerchantsController.java
  20. 7
      v1/src/main/java/com/v1/controller/ApiOrderController.java
  21. 7
      v1/src/main/java/com/v1/controller/HighOrderController.java
  22. 27
      v1/src/main/java/com/v1/controller/RechargeProductController.java
  23. 5
      v1/src/main/java/com/v1/controller/SelfOilStationController.java
  24. 22
      v1/src/main/java/com/v1/controller/ThirdPartyController.java

@ -280,84 +280,107 @@ public class ApiMerchantsController {
}
}
// @RequestMapping(value = "/getListMerchProduct", method = RequestMethod.GET)
// @ResponseBody
// @ApiOperation(value = "查询商户产品")
// public ResponseData getListMerchProduct(@RequestParam(value = "merchantId", required = true) Long merchantId) {
// try {
//
// return ResponseMsgUtil.success(apiMerchantsService.getListMerchProduct(merchantId));
//
// } catch (Exception e) {
// log.error("ApiMerchantsController --> findById() error!", e);
// return ResponseMsgUtil.exception(e);
// }
// }
//
// @RequestMapping(value = "/getPhoneOrderList", method = RequestMethod.GET)
// @ResponseBody
// @ApiOperation(value = "获取订单")
// public ResponseData getPhoneOrderList(
// @RequestParam(name = "rechargeStatus", required = false) String rechargeStatus,
// @RequestParam(name = "orderNo", required = false) String orderNo,
// @RequestParam(name = "operatorType", required = false) String operatorType,
// @RequestParam(name = "laborUnionCard", required = false) String laborUnionCard,
// @RequestParam(name = "rechargeContent", required = false) String rechargeContent,
// @RequestParam(name = "userPhone", required = false) String userPhone,
// @RequestParam(name = "rechargeType", required = false) String rechargeType,
// @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,
// @RequestParam(name = "pageSize", required = true) Integer pageSize,
// HttpServletRequest request) {
// try {
//
// SessionObject sessionObject = userCenter.getSessionObject(request);
// UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
//
// Map<String, Object> map = new HashMap<>();
//
// if (companyId != null) {
// map.put("companyId", companyId);
// } else if (userInfoModel.getSecRole().getRoleType() != 1){
// if (userInfoModel.getSecRole().getRoleType() == 7) {
// map.put("companyId", 23);
// } else {
// map.put("companyId", userInfoModel.getBsCompany().getId());
// }
// }
//
// 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);
// map.put("userPhone", userPhone);
// map.put("rechargeType", rechargeType);
// map.put("payType", payType);
// if (payTimeS != null && payTimeE != null ) {
// map.put("payTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeS));
// map.put("payTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeE));
// }
// if (createTimeS != null && createTimeE != null) {
// map.put("createTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeS));
// map.put("createTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeE));
// }
//
// PageHelper.startPage(pageNum, pageSize);
// return ResponseMsgUtil.success(new PageInfo<>(outRechargeOrderService.getListRechargeOrder(map)));
//
// } catch (Exception e) {
// log.error("HighOrderController --> getUserOrderList() error!", e);
// return ResponseMsgUtil.exception(e);
// }
// }
@RequestMapping(value = "/getApiRechargePhoneByList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取API充值话费订单")
public ResponseData getApiRechargePhoneByList(
@RequestParam(name = "payStatus", required = false) Integer payStatus,
@RequestParam(name = "rechargeStatus", required = false) Integer rechargeStatus,
@RequestParam(name = "callbackStatus", required = false) Integer callbackStatus,
@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "sourceOrderNo", required = false) String sourceOrderNo,
@RequestParam(name = "operators", required = false) String operators,
@RequestParam(name = "rechargeNumber", required = false) String rechargeNumber,
@RequestParam(name = "payTimeS", required = false) Long payTimeS,
@RequestParam(name = "payTimeE", required = false) Long payTimeE,
@RequestParam(name = "createTimeS", required = false) Long createTimeS,
@RequestParam(name = "createTimeE", required = false) Long createTimeE,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
Map<String, Object> map = new HashMap<>();
if (userInfoModel.getApiMerchants() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前账户权限不足");
}
map.put("rechargeStatus", rechargeStatus);
map.put("payStatus", payStatus);
map.put("merchId", userInfoModel.getApiMerchants().getMchId());
map.put("callbackStatus", callbackStatus);
map.put("orderNo", orderNo);
map.put("sourceOrderNo", sourceOrderNo);
map.put("operators", operators);
map.put("rechargeNumber", rechargeNumber);
if (payTimeS != null && payTimeE != null ) {
map.put("payTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeS));
map.put("payTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeE));
}
if (createTimeS != null && createTimeE != null) {
map.put("createTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeS));
map.put("createTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeE));
}
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(outRechargeOrderService.getApiRechargePhoneByList(map)));
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getApiThirdOrderByList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询API第三方订单列表")
public ResponseData getApiThirdOrderByList(
@RequestParam(name = "orderStatus", required = false) Integer orderStatus,
@RequestParam(name = "callbackStatus", required = false) Integer callbackStatus,
@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "productType", required = false) Integer productType,
@RequestParam(name = "sourceOrderNo", required = false) String sourceOrderNo,
@RequestParam(name = "payTimeS", required = false) Long payTimeS,
@RequestParam(name = "payTimeE", required = false) Long payTimeE,
@RequestParam(name = "createTimeS", required = false) Long createTimeS,
@RequestParam(name = "createTimeE", required = false) Long createTimeE,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
Map<String, Object> map = new HashMap<>();
if (userInfoModel.getApiMerchants() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前账户权限不足");
}
map.put("orderStatus", orderStatus);
map.put("merchId", userInfoModel.getApiMerchants().getMchId());
map.put("callbackStatus", callbackStatus);
map.put("productType", productType);
map.put("orderNo", orderNo);
map.put("sourceOrderNo", sourceOrderNo);
if (payTimeS != null && payTimeE != null ) {
map.put("payTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeS));
map.put("payTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeE));
}
if (createTimeS != null && createTimeE != null) {
map.put("createTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeS));
map.put("createTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeE));
}
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(apiMerchantsService.getApiThirdOrderByList(map)));
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -18,6 +18,7 @@ import com.hai.entity.HighUser;
import com.hai.enum_type.OrderPushType;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.ApiIpAddressService;
import com.hai.service.HighOpenApiService;
import com.hai.service.HighUserService;
import com.hai.service.SecConfigService;
@ -65,6 +66,10 @@ public class HighOpenApiController {
private HuiLianTongConfig huiLianTongConfig;
@Resource
private ApiIpAddressService apiIpAddressService;
@RequestMapping(value = "/getGuizhouSinopecList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取专属优惠券")
@ -99,7 +104,7 @@ public class HighOpenApiController {
@RequestMapping(value="/getGuizhouSinopecList",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取贵州中石化电子卡券")
public ResponseData getGuizhouSinopecList(HttpServletRequest request) {
public ResponseData getGuizhouSinopecList(@RequestBody JSONObject object ,HttpServletRequest request) {
try {
String ip = "";
@ -110,9 +115,9 @@ public class HighOpenApiController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
// 获取token
@ -147,11 +152,10 @@ public class HighOpenApiController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
// 获取token
String token = huiLianTongConfig.getToken();
@ -183,9 +187,9 @@ public class HighOpenApiController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
log.error("couJointDist error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
// 获取token

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

File diff suppressed because one or more lines are too long

@ -334,7 +334,7 @@ public class HighThirdPartyController {
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (StringUtils.isBlank(object.getString("customerMobile")) ||
StringUtils.isBlank(object.getString("regionId")) ||
StringUtils.isBlank(object.getString("companyId")) ||
object.getInteger("productType") == null ||
object.getInteger("platformId") == null
) {
@ -342,14 +342,9 @@ public class HighThirdPartyController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
SecRegion region = commonService.getParentByRegion(object.getLong("regionId"));
if (region != null) {
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString());
object.put("companyId", String.valueOf(bsCompany.getId()));
}
object.put("userId", userInfoModel.getHighUser().getId());
object.put("mchId", request.getHeader("mchId"));
object.put("companyId", object.getString("companyId"));
return ResponseMsgUtil.success(highOrderService.insertThirdProduct(object));

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

@ -1285,4 +1285,33 @@ public interface HighOrderMapperExt {
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<HighOrder> integralRebateOrder();
@Select({"<script>" +
"SELECT" +
" ho.id as orderId ," +
" aor.order_no as orderNo ," +
" source_order_no as sourceOrderNo ," +
" ho.total_price as orderPrice ," +
" ho.pay_price as payPrice ," +
" ho.order_status as orderStatus ," +
" aor.status as callbackStatus ," +
" ho.create_time as createTime ," +
" ho.pay_time as payTime" +
" from high_order ho join api_order_record aor on ho.id = aor.order_id " +
" where 1 = 1 " +
"<if test='map.merchId != null'> and merch_id = #{map.merchId} </if>",
"<if test='map.orderNo != null'> and aor.order_no = #{map.orderNo} </if>",
"<if test='map.sourceOrderNo != null'> and aor.source_order_no = #{map.sourceOrderNo} </if>",
"<if test='map.orderStatus != null'> and order_status = #{map.orderStatus} </if>",
"<if test='map.productType != null'> and ho.product_type = #{map.productType} </if>",
"<if test='map.callbackStatus != null'> and aor.status = #{map.callbackStatus} </if>",
"<if test='map.createTimeS != null'> <![CDATA[ and ho.create_time >= #{map.createTimeS} ]]> </if>",
"<if test='map.createTimeE != null'> <![CDATA[ and ho.create_time <= #{map.createTimeE} ]]> </if>",
"<if test='map.payTimeS != null'> <![CDATA[ and ho.pay_time >= #{map.payTimeS} ]]> </if>",
"<if test='map.payTimeE != null'> <![CDATA[ and ho.pay_time <= #{map.payTimeE} ]]> </if>",
" ORDER BY ho.create_time DESC" +
"</script>"
})
List<ApiThirdOrderModel> getApiThirdOrderByList(@Param("map") Map<String,Object> map);
}

@ -3,10 +3,7 @@ package com.hai.dao;
import com.hai.entity.HighOrder;
import com.hai.entity.OutRechargeOrder;
import com.hai.model.OrderCountModel;
import com.hai.model.OutOrderModel;
import com.hai.model.OutRechargeOrderModel;
import com.hai.model.OutUserOrderModel;
import com.hai.model.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
@ -196,4 +193,37 @@ public interface OutRechargeOrderMapperExt {
@Result(column="whether_rebate", property="whetherRebate", jdbcType=JdbcType.BIT)
})
List<OutRechargeOrder> integralRebateRechargeOrder();
@Select({"<script>" +
"SELECT" +
" aor.order_no as orderNo ," +
" source_order_no as sourceOrderNo ," +
" oro.operator_name as operators ," +
" recharge_content as rechargeNumber ," +
" recharge_price as rechargePrice ," +
" pay_price as payPrice ," +
" create_timed as createTimed ," +
" pay_time as payTime ," +
" finish_time as finishTime ," +
" pay_status as payStatus ," +
" recharge_status as rechargeStatus ," +
" aor.status as callbackStatus from" +
" out_recharge_order oro join api_order_record aor on oro.id = aor.order_id " +
" where 1 = 1 " +
"<if test='map.merchId != null'> and merch_id = #{map.merchId} </if>",
"<if test='map.orderNo != null'> and oro.order_no = #{map.orderNo} </if>",
"<if test='map.sourceOrderNo != null'> and aor.source_order_no = #{map.sourceOrderNo} </if>",
"<if test='map.rechargeStatus != null'> and recharge_status = #{map.rechargeStatus} </if>",
"<if test='map.payStatus != null'> and pay_status = #{map.payStatus} </if>",
"<if test='map.callbackStatus != null'> and aor.status = #{map.callbackStatus} </if>",
"<if test='map.operators != null'> and oro.operator_name LIKE '%${map.operators}%' </if>",
"<if test='map.rechargeNumber != null'> and recharge_content LIKE '%${map.rechargeNumber}%' </if>",
"<if test='map.createTimeS != null'> <![CDATA[ and create_timed >= #{map.createTimeS} ]]> </if>",
"<if test='map.createTimeE != null'> <![CDATA[ and create_timed <= #{map.createTimeE} ]]> </if>",
"<if test='map.payTimeS != null'> <![CDATA[ and pay_time >= #{map.payTimeS} ]]> </if>",
"<if test='map.payTimeE != null'> <![CDATA[ and pay_time <= #{map.payTimeE} ]]> </if>",
" ORDER BY create_timed DESC" +
"</script>"
})
List<ApiRechargePhoneModel> getApiRechargePhoneByList(@Param("map") Map<String,Object> map);
}

@ -73,7 +73,7 @@ public class HighOrder implements Serializable {
private Integer payModel;
/**
* 支付方式 1支付宝 2微信 3金币 4汇联通工会卡 5银联 6银联分期
* 支付方式 1支付宝 2微信 3金币 4汇联通工会卡 5银联 6银联分期 7.API商户账号
*/
private Integer payType;

@ -9,6 +9,7 @@ public enum OrderPayModelEnum {
type2(2 , "第三方平台"),
type3(3 , "混合"),
type4(4 , "油卡"),
type5(5 , "商户余额"),
;
private Integer type;

@ -12,6 +12,7 @@ public enum OrderPayTypeEnum {
type5(5 , "银联"),
type6(6 , "银联分期"),
type7(7 , "嗨森逛油卡"),
type8(8 , "API商户"),
;
private Integer type;

@ -0,0 +1,163 @@
package com.hai.model;
import java.math.BigDecimal;
import java.util.Date;
public class ApiRechargePhoneModel {
/**
* 订单号码
*/
private String orderNo;
/**
* 来源订单号
*/
private String sourceOrderNo;
/**
* 运营商
*/
private String operators;
/**
* 充值号码
*/
private String rechargeNumber;
/**
* 充值金额
*/
private BigDecimal rechargePrice;
/**
* 支付金额
*/
private BigDecimal payPrice;
/**
* 创建时间
*/
private Date createTimed;
/**
* 支付时间
*/
private Date payTime;
/**
* 完成时间
*/
private Date finishTime;
/**
* 支付状态 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款
*/
private Integer payStatus;
/**
* 充值状态201:充值中 202充值成功 203充值失败 204:未充值
*/
private Integer rechargeStatus;
/**
* 回调状态 100 :未回调 101已回调 102回调未响应 103预备回调
*/
private Integer callbackStatus;
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getSourceOrderNo() {
return sourceOrderNo;
}
public void setSourceOrderNo(String sourceOrderNo) {
this.sourceOrderNo = sourceOrderNo;
}
public String getOperators() {
return operators;
}
public void setOperators(String operators) {
this.operators = operators;
}
public String getRechargeNumber() {
return rechargeNumber;
}
public void setRechargeNumber(String rechargeNumber) {
this.rechargeNumber = rechargeNumber;
}
public BigDecimal getRechargePrice() {
return rechargePrice;
}
public void setRechargePrice(BigDecimal rechargePrice) {
this.rechargePrice = rechargePrice;
}
public BigDecimal getPayPrice() {
return payPrice;
}
public void setPayPrice(BigDecimal payPrice) {
this.payPrice = payPrice;
}
public Date getCreateTimed() {
return createTimed;
}
public void setCreateTimed(Date createTimed) {
this.createTimed = createTimed;
}
public Date getPayTime() {
return payTime;
}
public void setPayTime(Date payTime) {
this.payTime = payTime;
}
public Date getFinishTime() {
return finishTime;
}
public void setFinishTime(Date finishTime) {
this.finishTime = finishTime;
}
public Integer getPayStatus() {
return payStatus;
}
public void setPayStatus(Integer payStatus) {
this.payStatus = payStatus;
}
public Integer getRechargeStatus() {
return rechargeStatus;
}
public void setRechargeStatus(Integer rechargeStatus) {
this.rechargeStatus = rechargeStatus;
}
public Integer getCallbackStatus() {
return callbackStatus;
}
public void setCallbackStatus(Integer callbackStatus) {
this.callbackStatus = callbackStatus;
}
}

@ -0,0 +1,112 @@
package com.hai.model;
import java.math.BigDecimal;
import java.util.Date;
public class ApiThirdOrderModel {
/**
* 订单号码
*/
private String orderNo;
/**
* 来源订单号
*/
private String sourceOrderNo;
/**
* 订单金额
*/
private BigDecimal orderPrice;
/**
* 支付金额
*/
private BigDecimal payPrice;
/**
* 创建时间
*/
private Date createTime;
/**
* 支付时间
*/
private Date payTime;
/**
* 订单状态1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 6.退款中 7.拒绝退款
*/
private Integer orderStatus;
/**
* 回调状态 100 :未回调 101已回调 102回调未响应 103预备回调
*/
private Integer callbackStatus;
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getSourceOrderNo() {
return sourceOrderNo;
}
public void setSourceOrderNo(String sourceOrderNo) {
this.sourceOrderNo = sourceOrderNo;
}
public BigDecimal getOrderPrice() {
return orderPrice;
}
public void setOrderPrice(BigDecimal orderPrice) {
this.orderPrice = orderPrice;
}
public BigDecimal getPayPrice() {
return payPrice;
}
public void setPayPrice(BigDecimal payPrice) {
this.payPrice = payPrice;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getPayTime() {
return payTime;
}
public void setPayTime(Date payTime) {
this.payTime = payTime;
}
public Integer getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(Integer orderStatus) {
this.orderStatus = orderStatus;
}
public Integer getCallbackStatus() {
return callbackStatus;
}
public void setCallbackStatus(Integer callbackStatus) {
this.callbackStatus = callbackStatus;
}
}

@ -5,6 +5,7 @@ import com.hai.entity.ApiAmountRecord;
import com.hai.entity.ApiMerchants;
import com.hai.entity.ApiProductConfig;
import com.hai.model.ApiProductConfigModel;
import com.hai.model.ApiThirdOrderModel;
import java.math.BigDecimal;
import java.util.List;
@ -109,5 +110,15 @@ public interface ApiMerchantsService {
*/
List<ApiProductConfigModel> getMerchProduct(Long merchantId , Integer rechargeType);
/**
* @Author Sum1Dream
* @Name getApiThirdOrderByList
* @Description // 查询API第三方订单列表
* @Date 18:19 2023/1/4
* @Param [map]
* @Return java.util.List<com.hai.model.ApiThirdOrderModel>
*/
List<ApiThirdOrderModel> getApiThirdOrderByList(Map<String , Object> map);
}

@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.hai.entity.HighUserCard;
import com.hai.entity.OutRechargeChildOrder;
import com.hai.entity.OutRechargeOrder;
import com.hai.model.OrderCountModel;
import com.hai.model.OutOrderModel;
import com.hai.model.OutRechargeOrderModel;
import com.hai.model.OutUserOrderModel;
import com.hai.model.*;
import io.swagger.models.auth.In;
import java.math.BigDecimal;
@ -186,4 +183,15 @@ public interface OutRechargeOrderService {
*/
List<OutRechargeOrder> integralRebateRechargeOrder();
/**
* @Author Sum1Dream
* @Name getApiRechargePhoneByList
* @Description // 查询API话费订单列表
* @Date 15:53 2023/1/4
* @Param [map]
* @Return java.util.List<com.hai.model.ApiRechargePhoneModel>
*/
List<ApiRechargePhoneModel> getApiRechargePhoneByList(Map<String , Object> map);
}

@ -9,9 +9,11 @@ import com.hai.common.utils.RedisUtil;
import com.hai.dao.ApiAmountRecordMapper;
import com.hai.dao.ApiMerchantsMapper;
import com.hai.dao.ApiProductConfigMapper;
import com.hai.dao.HighOrderMapper;
import com.hai.entity.*;
import com.hai.enum_type.UserObjectTypeEnum;
import com.hai.model.ApiProductConfigModel;
import com.hai.model.ApiThirdOrderModel;
import com.hai.model.UserInfoModel;
import com.hai.service.ApiMerchantsService;
import com.hai.service.SecUserService;
@ -48,6 +50,9 @@ public class ApiMerchantsServiceImpl implements ApiMerchantsService {
@Resource
private SecUserService secUserService;
@Resource
private HighOrderMapper highOrderMapper;
@Override
@Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW)
public void insertApiMerchants(ApiMerchants apiMerchants) throws Exception {
@ -187,5 +192,8 @@ public class ApiMerchantsServiceImpl implements ApiMerchantsService {
return apiProductConfigMapper.getMerchProduct(merchantId , rechargeType);
}
@Override
public List<ApiThirdOrderModel> getApiThirdOrderByList(Map<String, Object> map) {
return highOrderMapper.getApiThirdOrderByList(map);
}
}

@ -12,10 +12,13 @@ import com.hai.config.CommonSysConst;
import com.hai.config.QianZhuConfig;
import com.hai.config.RechargeConfig;
import com.hai.dao.HighChildOrderMapper;
import com.hai.dao.HighOrderMapper;
import com.hai.dao.OutRechargeOrderMapper;
import com.hai.entity.*;
import com.hai.enum_type.OrderPayModelEnum;
import com.hai.enum_type.OrderPayTypeEnum;
import com.hai.service.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
@ -54,13 +57,24 @@ public class ApiOpenServiceImpl implements ApiOpenService {
@Resource
private HighOrderMapper highOrderMapper;
@Resource
private HighChildOrderMapper highChildOrderMapper;
@Resource
private ApiMemberProductService apiMemberProductService;
@Resource
private SecConfigService secConfigService;
@Resource
private HighOrderService highOrderService;
@Override
@Transactional(rollbackFor=Exception.class,isolation = Isolation.SERIALIZABLE,propagation= Propagation.REQUIRES_NEW)
public void createOrder(JSONObject object , ApiMerchants apiMerchants , ApiProductConfig productConfig) throws Exception {
Map<String, Object> orderMap = new HashMap<>();
orderMap.put("sourceOrderNo" , object.getString("orderNo"));
orderMap.put("sourceOrderNo" , object.getString("sourceOrderNo"));
// 查询是否用重复订单
ApiOrderRecord apiOrderRecord = apiOrderRecordService.queryOrderResult(orderMap);
@ -114,9 +128,10 @@ public class ApiOpenServiceImpl implements ApiOpenService {
outRechargeOrder.setRechargeType(apiProduct.getPhoneRechargeType());
outRechargeOrder.setOrderPrice(productConfig.getDiscountPrice());
outRechargeOrder.setPayPrice(productConfig.getDiscountPrice());
outRechargeOrder.setPayRealPrice(productConfig.getDiscountPrice());
outRechargeOrder.setRechargeContent(object.getString("mobile"));
outRechargeOrder.setPayTime(new Date());
outRechargeOrder.setUserName(apiMerchants.getUserName());
outRechargeOrder.setUserName(apiMerchants.getMerchantName());
outRechargeOrder.setUserPhone(apiMerchants.getPhone());
outRechargeOrder.setPayType(6);
outRechargeOrder.setCompanyId(6666L);
@ -135,7 +150,7 @@ public class ApiOpenServiceImpl implements ApiOpenService {
ApiOrderRecord apiOrderRecordPost = new ApiOrderRecord();
apiOrderRecordPost.setStatus(103);
apiOrderRecordPost.setOrderNo(outRechargeOrder.getOrderNo());
apiOrderRecordPost.setSourceOrderNo(apiAmountRecord.getSourceOrderNo());
apiOrderRecordPost.setSourceOrderNo(object.getString("sourceOrderNo"));
apiOrderRecordPost.setCreateTime(new Date());
apiOrderRecordPost.setMchId(apiMerchants.getMchId());
apiOrderRecordPost.setOrderId(outRechargeOrder.getId());
@ -154,6 +169,7 @@ public class ApiOpenServiceImpl implements ApiOpenService {
// 查询充值子订单
Map<String, Object> childOrderMap = new HashMap<>();
childOrderMap.put("parent_order_id", outRechargeOrder.getId());
childOrderMap.put("status", 102);
@ -177,8 +193,8 @@ public class ApiOpenServiceImpl implements ApiOpenService {
// 查询充值子订单
Map<String, Object> childOrderMap103 = new HashMap<>();
childOrderMap.put("parent_order_id", outRechargeOrder.getId());
childOrderMap.put("status", 103);
childOrderMap103.put("parent_order_id", outRechargeOrder.getId());
childOrderMap103.put("status", 103);
List<OutRechargeChildOrder> childOrderList103 = outRechargeChildOrderService.getListRechargeChildOrder(childOrderMap103);
if (childOrderList103.size() > 0) {
@ -211,11 +227,12 @@ public class ApiOpenServiceImpl implements ApiOpenService {
}
JSONObject returnObject = RechargeConfig.rechargeOrderByJj(object);
object.put("return_content", returnObject);
if (returnObject != null && returnObject.getLong("code") == 200) {
childOrder.setStatus(102);
} else {
childOrder.setStatus(103);
}
childOrder.setStatus(102);
// if (returnObject != null && returnObject.getLong("code") == 200) {
// childOrder.setStatus(102);
// } else {
// childOrder.setStatus(103);
// }
rechargePlatformType = 1;
break;
}
@ -271,15 +288,27 @@ public class ApiOpenServiceImpl implements ApiOpenService {
@Override
@Transactional(rollbackFor=Exception.class,isolation = Isolation.SERIALIZABLE,propagation= Propagation.REQUIRES_NEW)
public void createOrder(JSONObject object , ApiMerchants apiMerchants) throws Exception {
// 定义订单
HighOrder highOrder = new HighOrder();
highOrder.setMerchId(object.getString("mchId"));
highOrder.setMerchId(apiMerchants.getMchId());
highOrder.setWhetherRebate(false);
highOrder.setMemPhone(apiMerchants.getPhone());
highOrder.setMemName(apiMerchants.getMerchantName());
highOrder.setMemId(apiMerchants.getId());
highOrder.setCreateTime(new Date());
highOrder.setOrderStatus(1);
highOrder.setProductType(object.getInteger("productType"));
highOrder.setPayModel(OrderPayModelEnum.type5.getType());
highOrder.setPayType(OrderPayTypeEnum.type8.getType());
highOrder.setOrderNo("HF" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5));
highOrderMapper.insert(highOrder);
// 订单总金额
BigDecimal marketPriceTotal = new BigDecimal(0);
JSONObject jsonObject = null;
// 定义下单json对象
JSONObject jsonObject;
// 获取token
JSONObject userToken = QianZhuConfig.getTokenV2(apiMerchants.getId().toString(), apiMerchants.getMerchantName(), apiMerchants.getPhone());
@ -290,8 +319,15 @@ public class ApiOpenServiceImpl implements ApiOpenService {
// 1 星巴克 2 肯德基 3 会员充值
if (object.getInteger("productType") == 1) {
// 判断当前商户是否有权限下单
if (!secConfigService.isConfig("STARBUCKS_CONFIG" , object.getString("merchId"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前帐户无权限查询!");
}
List<String> List = new ArrayList<>();
// 获取下单内容
JSONArray array = object.getJSONArray("orderItems");
// 组装下单数据
@ -322,8 +358,10 @@ public class ApiOpenServiceImpl implements ApiOpenService {
if (!"".equals(object1.getString("num"))) {
contentMap.put("num", object1.getString("num"));
}
// 添加到LIST
List.add(JSON.toJSONString(contentMap));
}
// 下单
jsonObject = QianZhuConfig.starbucksOrders(apiMerchants.getId().toString(), object.getString("storeCode"), List.toString().replace(" ", ""), object.getString("customerMobile"));
@ -344,56 +382,198 @@ public class ApiOpenServiceImpl implements ApiOpenService {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("message"));
}
// 插入订单内容
highOrder.setOrderNo(jsonObject.getJSONObject("data").getString("orderNo"));
highOrder.setCreateTime(new Date());
highOrder.setMemId(apiMerchants.getId());
highOrder.setMemName(apiMerchants.getMerchantName());
highOrder.setMemPhone(apiMerchants.getPhone());
highOrder.setOrderStatus(1);
highOrderMapper.insert(highOrder);
// 获取星巴克订单内容
JSONArray starbucksOrder = orderObject.getJSONObject("data").getJSONArray("orderItems");
// for (Object starbucksObject : starbucksOrder) {
// JSONObject childObject = (JSONObject) starbucksObject;
// HighChildOrder childOrder = new HighChildOrder();
// childOrder.setOrderId(highOrder.getId());
// childOrder.setChildOrdeStatus(1);
// childOrder.setGoodsType(9);
// childOrder.setStoreId(object.getLong("storeCode"));
// childOrder.setGoodsId(object.getLong("productId"));
// childOrder.setStoreAddress(childObject.getString("storeAddress"));
// childOrder.setStoreName(childObject.getString("storeName"));
// childOrder.setGoodsName(childObject.getString("productName"));
// childOrder.setGoodsImg(childObject.getString("imgUrl"));
// childOrder.setSaleCount(childObject.getInteger("quantity"));
// childOrder.setGoodsPrice(childObject.getBigDecimal("marketPrice"));
//
// // 计算利润
// BigDecimal profitPrice = childObject.getBigDecimal("marketPrice").multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100)));
// // 计算子订单支付金额
// BigDecimal childPrice = childObject.getBigDecimal("unitPrice").add(profitPrice).setScale(2 , RoundingMode.HALF_UP);
// if (childPrice.compareTo(childObject.getBigDecimal("marketPrice")) > 0) {
// childPrice = childObject.getBigDecimal("marketPrice");
// }
// if (object.getLong("memDiscountId") != null) {
// childOrder.setGoodsActualPrice(childObject.getBigDecimal("marketPrice"));
// } else {
// childOrder.setGoodsActualPrice(childPrice);
// }
// childPrice = childPrice.multiply(childObject.getBigDecimal("quantity"));
// // 计算总订单实际支付金额
// orderPayPrice = orderPayPrice.add(childPrice);
// // 计算市场价金额
// marketPrice = marketPrice.add(childObject.getBigDecimal("marketPrice").multiply(childObject.getBigDecimal("quantity")));
// childOrder.setTotalPrice(childPrice);
// highChildOrderMapper.insert(childOrder);
// }
// 循环获取星巴克订单
for (Object starbucksObject : starbucksOrder) {
JSONObject childObject = (JSONObject) starbucksObject;
HighChildOrder childOrder = new HighChildOrder();
childOrder.setOrderId(highOrder.getId());
childOrder.setChildOrdeStatus(1);
childOrder.setMemId(highOrder.getMemId());
childOrder.setGoodsType(9);
childOrder.setStoreId(object.getLong("storeCode"));
childOrder.setGoodsId(childObject.getLong("id"));
childOrder.setStoreAddress(childObject.getString("storeAddress"));
childOrder.setStoreName(childObject.getString("storeName"));
childOrder.setGoodsName(childObject.getString("productName"));
childOrder.setGoodsImg(childObject.getString("imgUrl"));
childOrder.setSaleCount(childObject.getInteger("quantity"));
childOrder.setGoodsPrice(childObject.getBigDecimal("marketPrice"));
// 计算子订单支付金额
BigDecimal childPrice = childObject.getBigDecimal("marketPrice");
childOrder.setGoodsActualPrice(childPrice);
// 计算市场价金额
childOrder.setTotalPrice(childPrice.multiply(childObject.getBigDecimal("quantity")));
marketPriceTotal = marketPriceTotal.add(childOrder.getTotalPrice());
highChildOrderMapper.insert(childOrder);
}
// 拼接json对象
object.put("sourceType" , 5);
object.put("content" , apiMerchants.getMerchantName() + "|" + "星巴克下单" + "|扣款" + marketPriceTotal);
}else if (object.getInteger("productType") == 2) {
// 判断当前商户是否有肯德基下单权限
if (!secConfigService.isConfig("KFC_CONFIG" , object.getString("merchId"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前帐户无权限查询!");
}
// 判断就餐方式
if (object.getInteger("eatType") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请选择就餐方式!");
}
// 下单
jsonObject = QianZhuConfig.createKfcOrder(object.getInteger("eatType"), object.getString("storeCode"), object.getString("customerMobile"), object.getString("orderItems"), apiMerchants.getId().toString());
// 判断下单是否成功
if (!Objects.equals(jsonObject.getString("code"), "10000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("message"));
}
// 根据订单号查询订单详情
JSONObject orderObject = QianZhuConfig.getKfcOrderByOrderNo(jsonObject.getJSONObject("data").getString("orderNo"));
// 判断下单是否成功
if (!orderObject.getBoolean("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("message"));
}
// 获取肯德基订单内容
JSONArray kfcOrder = orderObject.getJSONObject("data").getJSONObject("kfcPlaceOrder").getJSONArray("items");
for (Object kfcObject : kfcOrder) {
JSONObject childObject = (JSONObject) kfcObject;
HighChildOrder childOrder = new HighChildOrder();
childOrder.setOrderId(highOrder.getId());
childOrder.setChildOrdeStatus(1);
childOrder.setGoodsType(4);
childOrder.setMemId(highOrder.getMemId());
childOrder.setExt6(object.getString("storeCode"));
childOrder.setGoodsId(childObject.getLong("productId"));
childOrder.setStoreAddress(orderObject.getJSONObject("data").getJSONObject("kfcPlaceOrder").getString("storeAddress"));
childOrder.setStoreName(orderObject.getJSONObject("data").getJSONObject("kfcPlaceOrder").getString("storeName"));
childOrder.setGoodsName(childObject.getString("productName"));
childOrder.setGoodsImg(childObject.getString("imageUrl"));
childOrder.setSaleCount(childObject.getInteger("quantity"));
childOrder.setGoodsPrice(childObject.getBigDecimal("originPrice"));
// 计算利润
// 计算子订单支付金额
BigDecimal childPrice = childObject.getBigDecimal("originPrice");
childOrder.setGoodsActualPrice(childPrice);
// 计算市场价金额
childOrder.setTotalPrice(childPrice.multiply(childObject.getBigDecimal("quantity")));
marketPriceTotal = marketPriceTotal.add(childOrder.getTotalPrice());
highChildOrderMapper.insert(childOrder);
}
// 拼接json对象
object.put("sourceType" , 4);
object.put("content" , apiMerchants.getMerchantName() + "|" + "肯德基下单" + "|扣款" + marketPriceTotal);
} else if (object.getInteger("productType") == 3) {
// 判断是否有会员充值下单权限
if (!secConfigService.isConfig("MEMBER_RECHARGE_CONFIG" , object.getString("merchId"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前帐户无权限查询!");
}
// 获取会员充值
ApiMemberProduct memberProduct = apiMemberProductService.findById(object.getLong("goodsId"));
if (memberProduct == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前产品不可购买");
}
object.put("productId", memberProduct.getProductId());
HighChildOrder childOrder = new HighChildOrder();
childOrder.setOrderId(highOrder.getId());
childOrder.setChildOrdeStatus(1);
childOrder.setGoodsType(10);
childOrder.setStoreId(object.getLong("storeCode"));
childOrder.setGoodsId(memberProduct.getId());
childOrder.setGoodsName(memberProduct.getName());
childOrder.setSaleCount(1);
childOrder.setMemId(highOrder.getMemId());
childOrder.setGoodsPrice(memberProduct.getPrice());
childOrder.setGoodsActualPrice(memberProduct.getPrice());
// 计算市场价金额
childOrder.setTotalPrice(memberProduct.getPrice());
marketPriceTotal = marketPriceTotal.add(childOrder.getTotalPrice());
highChildOrderMapper.insert(childOrder);
object.put("sourceType" , 6);
object.put("content" , apiMerchants.getMerchantName() + "|" + "第三方会员充值下单" + "|扣款" + marketPriceTotal);
}
// 当前账号余额是否可以充值当前金额
if (apiMerchants.getAmounts().compareTo(marketPriceTotal) < 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.INSUFFICIENT_BALANCE);
}
highOrder.setTotalPrice(marketPriceTotal);
highOrder.setPayPrice(marketPriceTotal);
highOrder.setPayRealPrice(marketPriceTotal);
highOrder.setPayablePrice(marketPriceTotal);
ApiAmountRecord apiAmountRecord = apiMerchantAmount(highOrder , apiMerchants , object);
highOrder.setOrderStatus(2);
highOrder.setPayTime(new Date());
highOrder.setPaySerialNo("22" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5));
highOrderMapper.updateByPrimaryKey(highOrder);
// 更新子订单状态
List<HighChildOrder> childOrderList = highOrderService.getChildOrderByOrder(highOrder.getId());
for (HighChildOrder highChildOrder : childOrderList) {
highChildOrder.setChildOrdeStatus(2);
highChildOrderMapper.updateByPrimaryKey(highChildOrder);
}
// 插入订单记录
ApiOrderRecord apiOrderRecordPost = new ApiOrderRecord();
apiOrderRecordPost.setStatus(103);
apiOrderRecordPost.setOrderNo(highOrder.getOrderNo());
apiOrderRecordPost.setSourceOrderNo(apiAmountRecord.getSourceOrderNo());
apiOrderRecordPost.setCreateTime(new Date());
apiOrderRecordPost.setMchId(apiMerchants.getMchId());
apiOrderRecordPost.setOrderId(highOrder.getId());
apiOrderRecordPost.setGoodsId(apiMerchants.getMchId());
apiOrderRecordPost.setNotifyUrl(object.getString("notifyUrl"));
apiOrderRecordPost.setUpdateTime(new Date());
apiOrderRecordService.insertOrderRecord(apiOrderRecordPost);
}
private ApiAmountRecord apiMerchantAmount(HighOrder highOrder , ApiMerchants apiMerchants , JSONObject object) throws Exception {
// 插入金额记录
// 变更前金额
BigDecimal beforeAmount = apiMerchants.getAmounts();
// 计算金额
apiMerchants.setAmounts(apiMerchants.getAmounts().subtract(highOrder.getPayPrice()));
// 变更后金额
BigDecimal afterAmount = apiMerchants.getAmounts();
apiMerchantsService.updateApiMerchants(apiMerchants);
ApiAmountRecord apiAmountRecord = new ApiAmountRecord();
apiAmountRecord.setCreateTime(new Date());
apiAmountRecord.setUpdateTime(new Date());
apiAmountRecord.setMchId(apiMerchants.getMchId());
apiAmountRecord.setStatus(100);
apiAmountRecord.setAmount(highOrder.getPayPrice());
apiAmountRecord.setAfterAmount(afterAmount);
apiAmountRecord.setBeforeAmount(beforeAmount);
apiAmountRecord.setAmountType(2);
apiAmountRecord.setSourceType(object.getInteger("sourceType"));
apiAmountRecord.setSourceOrderNo(object.getString("sourceOrderNo"));
apiAmountRecord.setSourceId(apiMerchants.getId());
apiAmountRecord.setSourceContent(object.getString("content"));
apiAmountRecordService.insertAmountRecord(apiAmountRecord);
return apiAmountRecord;
}
}

@ -11,6 +11,7 @@ import com.hai.common.security.AESEncodeUtil;
import com.hai.common.utils.*;
import com.hai.config.*;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.dao.HighOrderMapper;
import com.hai.dao.OutRechargeOrderMapper;
import com.hai.dao.OutRechargeOrderMapperExt;
import com.hai.entity.*;
@ -101,9 +102,6 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Resource
private ApiMerchantsService apiMerchantsService;
@Resource
private HighGoldRecService highGoldRecService;
@Resource
private ApiAmountRecordService apiAmountRecordService;
@ -996,4 +994,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
return outRechargeOrderMapper.integralRebateRechargeOrder();
}
@Override
public List<ApiRechargePhoneModel> getApiRechargePhoneByList(Map<String, Object> map) {
return outRechargeOrderMapper.getApiRechargePhoneByList(map);
}
}

@ -37,6 +37,9 @@ public class ApiMerchantsController {
@Resource
private SecConfigService secConfigService;
@Resource
private ApiIpAddressService apiIpAddressService;
@RequestMapping(value = "/checkAccountBalance", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询帐户余额")
@ -51,7 +54,7 @@ public class ApiMerchantsController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}

@ -45,6 +45,9 @@ public class ApiOrderController {
@Resource
private ApiOpenService apiOpenService;
@Resource
private ApiIpAddressService apiIpAddressService;
@RequestMapping(value = "/createOrder", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "充值预下单")
@ -59,8 +62,8 @@ public class ApiOrderController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
log.error("createOrder error!", "非法ip地址,请联系管理人员!");
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}

@ -52,6 +52,9 @@ public class HighOrderController {
@Resource
private HighOrderService highOrderService;
@Resource
private ApiIpAddressService apiIpAddressService;
@RequestMapping(value = "/getCallOrderList", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取话费订单列表")
@ -66,7 +69,7 @@ public class HighOrderController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
@ -134,7 +137,7 @@ public class HighOrderController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}

@ -57,6 +57,9 @@ public class RechargeProductController {
@Resource
private ApiOpenService apiOpenService;
@Resource
private ApiIpAddressService apiIpAddressService;
@RequestMapping(value = "/getRechargeProduct", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取充值产品")
@ -71,7 +74,7 @@ public class RechargeProductController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
@ -131,11 +134,12 @@ public class RechargeProductController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
if (StringUtils.isBlank(object.getString("apiKey")) ||
StringUtils.isBlank(object.getString("timetable")) ||
StringUtils.isBlank(object.getString("merchId")) ||
@ -210,16 +214,17 @@ public class RechargeProductController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
log.error("createOrder error!", "非法ip地址,请联系管理人员!");
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
if (StringUtils.isBlank(object.getString("mobile")) ||
StringUtils.isBlank(object.getString("apiConfigProductId")) ||
StringUtils.isBlank(object.getString("apiKey")) ||
StringUtils.isBlank(object.getString("timetable")) ||
StringUtils.isBlank(object.getString("orderNo")) ||
StringUtils.isBlank(object.getString("sourceOrderNo")) ||
StringUtils.isBlank(object.getString("notifyUrl")) ||
StringUtils.isBlank(object.getString("sign")) ||
StringUtils.isBlank(object.getString("merchId"))
@ -247,11 +252,16 @@ public class RechargeProductController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.PRODUCT_ERROR);
}
if (apiProductConfig.getStatus() == 102) {
log.error("createOrder error!", " 商品状态错误!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "商品状态错误");
}
Map<String , Object> map = new HashMap<>();
map.put("mobile" , object.getString("mobile"));
map.put("apiConfigProductId" , object.getString("apiConfigProductId"));
map.put("timetable" , object.getString("timetable"));
map.put("orderNo" , object.getString("orderNo"));
map.put("sourceOrderNo" , object.getString("sourceOrderNo"));
map.put("notifyUrl" , object.getString("notifyUrl"));
map.put("apiKey" , object.getString("apiKey"));
map.put("merchId" , object.getString("merchId"));
@ -266,6 +276,11 @@ public class RechargeProductController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT);
}
if (!secConfigService.isConfig("PHONE_CONFIG" , object.getString("merchId"))) {
log.error("getAllCities error!", "当前帐户无权限查询!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前帐户无权限查询!");
}
apiOpenService.createOrder(object , apiMerchants , apiProductConfig);
return ResponseMsgUtil.success("下单成功");

@ -46,6 +46,9 @@ public class SelfOilStationController {
@Resource
private HighOrderService highOrderService;
@Resource
private ApiIpAddressService apiIpAddressService;
@RequestMapping(value = "/getSelfOilStationOrderList", method = RequestMethod.POST)
@ -62,7 +65,7 @@ public class SelfOilStationController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}

@ -135,7 +135,7 @@ public class ThirdPartyController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
@ -202,7 +202,7 @@ public class ThirdPartyController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
@ -277,7 +277,7 @@ public class ThirdPartyController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
@ -337,7 +337,7 @@ public class ThirdPartyController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
@ -425,7 +425,7 @@ public class ThirdPartyController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
@ -489,8 +489,8 @@ public class ThirdPartyController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
log.error("createOrder error!", "非法ip地址,请联系管理人员!");
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
@ -498,7 +498,7 @@ public class ThirdPartyController {
StringUtils.isBlank(object.getString("productType")) ||
StringUtils.isBlank(object.getString("apiKey")) ||
StringUtils.isBlank(object.getString("timetable")) ||
StringUtils.isBlank(object.getString("orderNo")) ||
StringUtils.isBlank(object.getString("sourceOrderNo")) ||
StringUtils.isBlank(object.getString("notifyUrl")) ||
StringUtils.isBlank(object.getString("sign")) ||
StringUtils.isBlank(object.getString("merchId"))
@ -514,15 +514,11 @@ public class ThirdPartyController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST);
}
Map<String, Object> productMap = new HashMap<>();
Map<String , Object> map = new HashMap<>();
map.put("customerMobile" , object.getString("customerMobile"));
map.put("productType" , object.getString("productType"));
map.put("timetable" , object.getString("timetable"));
map.put("orderNo" , object.getString("orderNo"));
map.put("sourceOrderNo" , object.getString("sourceOrderNo"));
map.put("notifyUrl" , object.getString("notifyUrl"));
map.put("apiKey" , object.getString("apiKey"));
map.put("merchId" , object.getString("merchId"));

Loading…
Cancel
Save