dev-discount
胡锐 2 years ago
commit 7b11f5d1ef
  1. 3
      hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java
  2. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  3. 27
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  4. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  5. 1
      hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java
  6. 16
      hai-cweb/src/main/java/com/cweb/controller/HighUserController.java
  7. 2
      hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java
  8. 2
      hai-cweb/src/main/java/com/cweb/controller/SendSmsController.java
  9. 27
      hai-cweb/src/main/java/com/cweb/controller/WechatController.java
  10. 21
      hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java
  11. 4
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  12. 2
      hai-schedule/src/main/java/com/hai/schedule/ApiThirdProductSchedule.java
  13. 5
      hai-service/src/main/java/com/hai/common/exception/ErrorCode.java
  14. 2
      hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java
  15. 3
      hai-service/src/main/java/com/hai/config/MessageConfig.java
  16. 16
      hai-service/src/main/java/com/hai/dao/HighCouponMapper.java
  17. 14
      hai-service/src/main/java/com/hai/dao/HighCouponSqlProvider.java
  18. 27
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  19. 24
      hai-service/src/main/java/com/hai/entity/HighCoupon.java
  20. 60
      hai-service/src/main/java/com/hai/entity/HighCouponExample.java
  21. 21
      hai-service/src/main/java/com/hai/entity/HighOrder.java
  22. 191
      hai-service/src/main/java/com/hai/model/SelfOilStationModel.java
  23. 7
      hai-service/src/main/java/com/hai/service/HighOrderService.java
  24. 5
      hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java
  25. 14
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  26. 4
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  27. 74
      hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java
  28. 2
      v1/src/main/java/com/v1/config/AuthConfig.java
  29. 36
      v1/src/main/java/com/v1/config/ToolConfig.java
  30. 175
      v1/src/main/java/com/v1/controller/HighOrderController.java
  31. 32
      v1/src/main/java/com/v1/controller/RechargeProductController.java
  32. 116
      v1/src/main/java/com/v1/controller/SelfOilStationController.java
  33. 18
      v1/src/main/java/com/v1/controller/ThirdPartyController.java

@ -270,7 +270,10 @@ public class HighCouponController {
coupon.setSalesPrice(highCoupon.getSalesPrice());
coupon.setDiscountPrice(highCoupon.getDiscountPrice());
coupon.setIsPresent(highCoupon.getIsPresent());
coupon.setBuyPoints(highCoupon.getBuyPoints());
coupon.setOperatorId(userInfoModel.getSecUser().getId());
coupon.setGoodsTypeId(highCoupon.getGoodsTypeId());
coupon.setBrandId(highCoupon.getBrandId());
coupon.setOperatorName(userInfoModel.getSecUser().getUserName());
coupon.setUpdateTime(new Date());
coupon.setStatus(3); // 状态:0.删除 1.编辑中 2.已上架 3.已下架 101.上架审批中 102.上架审批驳回

File diff suppressed because one or more lines are too long

@ -134,6 +134,10 @@ public class HighOrderController {
}
}
// 定义当前卡券是否可以直冲积分
boolean buyPoints = false;
BigDecimal totalPrice = new BigDecimal("0");
BigDecimal totalActualPrice = new BigDecimal("0");
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
@ -202,6 +206,11 @@ public class HighOrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "系统维护中");
}
}
if (coupon.getBuyPoints()) {
buyPoints = true;
}
childOrder.setGoodsActualPrice(childOrder.getGoodsPrice());
childOrder.setGoodsName(coupon.getCouponName());
childOrder.setGoodsImg(coupon.getCouponImg());
@ -399,9 +408,25 @@ public class HighOrderController {
totalPrice = totalPrice.add(childOrder.getTotalPrice());
totalActualPrice = totalActualPrice.add(childOrder.getGoodsActualPrice());
}
// 积分抵扣金额
BigDecimal integralDeductionPrice = new BigDecimal(0);
if (buyPoints && highOrder.getPayGold() != null) {
integralDeductionPrice = new BigDecimal(highOrder.getPayGold()).divide(new BigDecimal(100));
highUserService.goldHandle(userInfoModel.getHighUser().getId(), highOrder.getPayGold(), 2, 2, highOrder.getId());
BigDecimal payGold = new BigDecimal(highOrder.getPayGold());
if (payGold.compareTo(totalActualPrice.subtract(integralDeductionPrice)) < 0) {
highOrder.setPayModel(2); // 支付模式:1 金币,2 第三方平台,3 混合
highOrder.setPayType(2); // 支付方式: 1:支付宝 2:微信 3:金币
}
}
highOrder.setMerchId(request.getHeader("mchId"));
highOrder.setTotalPrice(totalPrice);
highOrder.setPayPrice(totalActualPrice);
highOrder.setPayPrice(totalActualPrice.subtract(integralDeductionPrice));
highOrder.setDeductionPrice(highOrder.getTotalPrice().subtract(totalActualPrice));
// 是否使用了优惠券

File diff suppressed because one or more lines are too long

@ -324,6 +324,7 @@ public class HighThirdPartyController {
}
object.put("userId", userInfoModel.getHighUser().getId());
object.put("mchId", request.getHeader("mchId"));
return ResponseMsgUtil.success(highOrderService.insertThirdProduct(object));

@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Objects;
/**
* @Auther: 袁野
@ -171,8 +172,7 @@ public class HighUserController {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (StringUtils.isBlank(body.getString("password"))
|| StringUtils.isBlank(body.getString("newPassword"))) {
if ( StringUtils.isBlank(body.getString("newPassword")) || StringUtils.isBlank(body.getString("code"))) {
log.error("HighUserController --> setUserPayPwd() error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
@ -184,14 +184,16 @@ public class HighUserController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_SET_USER_PAY_PWD, "");
}
if (!AESEncodeUtil.aesEncrypt(body.getString("password")).equals(userPayPassword.getPassword())) {
log.error("HighUserController --> setUserPayPwd() error!", "修改失败,旧密码不一致");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "修改失败,旧密码不一致");
}
// 获取手机号验证码
String phoneSmsCode = (String) redisUtil.get("SMS_"+ userInfoModel.getHighUser().getPhone());
// 验证码校验
if (StringUtils.isNotBlank(phoneSmsCode) && Objects.equals(phoneSmsCode,body.getString("code"))) {
userPayPassword.setPassword(AESEncodeUtil.aesEncrypt(body.getString("newPassword")));
highUserPayPasswordService.editUserPayPwd(userPayPassword);
return ResponseMsgUtil.success("操作成功");
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "操作失败");
}
} catch (Exception e) {
log.error("HighUserController --> updateUserPayPwd() error!", e);

@ -53,6 +53,7 @@ public class OutRechargeOrderController {
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (StringUtils.isBlank(object.getString("rechargeContent")) ||
object.getLong("goodsId") == null
) {
@ -60,6 +61,7 @@ public class OutRechargeOrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
object.put("mchId", request.getHeader("mchId"));
object.put("userId", userInfoModel.getHighUser().getId());
return ResponseMsgUtil.success(outRechargeOrderService.insertOrder(object));

@ -51,6 +51,8 @@ public class SendSmsController {
break;
case 5 :
smsMsgId = MessageConfig.HWMSG_ID5;
case 6 :
smsMsgId = MessageConfig.HWMSG_ID6;
break;
default :
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂无当前模版");

@ -14,8 +14,7 @@ import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.security.*;
import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.RedisUtil;
@ -248,6 +247,7 @@ public class WechatController {
@ResponseBody
@ApiOperation(value = "根据手机号码登陆")
public ResponseData loginByTel(@RequestParam(value = "phone", required = true) String phone,
@RequestParam(value = "code", required = true) String code,
HttpServletRequest request, HttpServletResponse response) {
try {
@ -255,7 +255,26 @@ public class WechatController {
// 根据手机号查询用户
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.setStatus(1);
// 用户信息完整状态
// 0:完整
// 1:需要填写用户信息
// 2:需要填写手机号
user.setInfoCompleteStatus(1);
highUserService.insertUser(user);
}
// 获取手机号验证码
String phoneSmsCode = (String) redisUtil.get("SMS_"+ phone);
// 验证码校验
if (StringUtils.isNotBlank(phoneSmsCode) && Objects.equals(phoneSmsCode,code)) {
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
@ -264,6 +283,10 @@ public class WechatController {
SessionObject so = new SessionObject(user.getPhone(), 1, highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "验证码错误");
}
} catch (Exception e) {

@ -393,6 +393,26 @@ public class CzOrderController {
}
@RequestMapping(value="/apiCallBack",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "apiCallBack")
public String test(@RequestBody String reqBodyStr) {
try {
if (StringUtils.isBlank(reqBodyStr)) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
System.out.println("reqBodyStr");
return "SUCCESS";
} catch (Exception e) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
}
@RequestMapping(value="/orderToPayByWx",method = RequestMethod.POST)
@ResponseBody
@ -583,6 +603,5 @@ public class CzOrderController {
apiOrderRecord.setRequestTime(new Date());
apiOrderRecordService.updateOrderRecord(apiOrderRecord);
}
}

@ -152,10 +152,10 @@ public class OrderController {
// 商品类型 1:卡卷 2:金币充值 3:加油站
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
if (childOrder.getGiveawayType() == false && childOrder.getGoodsType() == 1) {
if (!childOrder.getGiveawayType() && childOrder.getGoodsType() == 1) {
HighCoupon coupon = highCouponService.getCouponById(childOrder.getGoodsId());
// 支付类型:1.微信支付 2.金币支付
if (coupon.getPayType() != 1) {
if (coupon.getPayType() != 1 && !coupon.getBuyPoints()) {
log.error("OrderController --> orderToPay() ERROR", "只支持微信支持");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",只支持微信支付");
}

@ -72,7 +72,7 @@ public class ApiThirdProductSchedule {
}
}
@Scheduled(cron = "0 0 1 * * ?") // 获取星巴克产品 每日凌晨1点执行一次
@Scheduled(cron = "0 0 1 * * ?") // 获取肯德基门店 每日凌晨1点执行一次
public void getKfcStore() throws Exception {
JSONObject jsonObject = QianZhuConfig.getKfcStore();

@ -130,13 +130,14 @@ public enum ErrorCode {
REQUEST_TIMED_OUT("3006","请求超时,请稍后重试"),
SIGN_VERIFY("6001","签名校验失败"),
ACCOUNT_NOT_EXIST("6002","账号不存在"),
ACCOUNT_NOT_EXIST("6002","帐户不存在"),
PHONE_ERROR("6003","手机号码格式有误"),
INSUFFICIENT_BALANCE("6006","账户余额不足,请及时充值"),
ORDER_ALREADY_EXISTS("6007","订单已存在"),
IP_ERROR("6008","IP不在白名单"),
PRODUCT_ERROR("6009","商品错误"),
MERCHANT_NOT_AUTHORIZED("6010","商户无权限"),
MERCHANT_NOT_AUTHORIZED("6010","帐户无权限"),
TIME_OUT("6011","请求时间超时"),
MSG_EVENT_NULL("2999","消息类型为空"),
USE_VISIT_ILLEGAL("4001","用户身份错误"),

@ -293,7 +293,7 @@ public class HuiLianTongUnionCardConfig {
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject syncPayOrder(Map<String, Object> map) throws Exception {
return request("fuelCouponsTest/syncPayOrder", map);
return request("fuelCoupons/syncPayOrder", map);
}

@ -44,6 +44,9 @@ public class MessageConfig {
// 嗨森逛账号登录
public final static String HWMSG_ID5 = "SMS_22050700002";
// 嗨森逛账号登录支付密码修改
public final static String HWMSG_ID6 = "SMS_22072500001";
private static final String[] HEX_DIGITS = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};
private static Logger log = LoggerFactory.getLogger(MessageConfig.class);

@ -53,7 +53,7 @@ public interface HighCouponMapper extends HighCouponMapperExt {
"ext_3, `status`, display_area, ",
"coupon_source, distributor, ",
"goods_type_id, brand_id, ",
"reserve_status)",
"reserve_status, buy_points)",
"values (#{companyId,jdbcType=BIGINT}, #{merchantId,jdbcType=BIGINT}, ",
"#{couponKey,jdbcType=VARCHAR}, #{couponName,jdbcType=VARCHAR}, ",
"#{couponPrice,jdbcType=DECIMAL}, #{couponImg,jdbcType=VARCHAR}, ",
@ -68,7 +68,7 @@ public interface HighCouponMapper extends HighCouponMapperExt {
"#{ext3,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{displayArea,jdbcType=INTEGER}, ",
"#{couponSource,jdbcType=INTEGER}, #{distributor,jdbcType=INTEGER}, ",
"#{goodsTypeId,jdbcType=INTEGER}, #{brandId,jdbcType=INTEGER}, ",
"#{reserveStatus,jdbcType=BIT})"
"#{reserveStatus,jdbcType=BIT}, #{buyPoints,jdbcType=BIT})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighCoupon record);
@ -110,7 +110,8 @@ public interface HighCouponMapper extends HighCouponMapperExt {
@Result(column="distributor", property="distributor", jdbcType=JdbcType.INTEGER),
@Result(column="goods_type_id", property="goodsTypeId", jdbcType=JdbcType.INTEGER),
@Result(column="brand_id", property="brandId", jdbcType=JdbcType.INTEGER),
@Result(column="reserve_status", property="reserveStatus", jdbcType=JdbcType.BIT)
@Result(column="reserve_status", property="reserveStatus", jdbcType=JdbcType.BIT),
@Result(column="buy_points", property="buyPoints", jdbcType=JdbcType.BIT)
})
List<HighCoupon> selectByExample(HighCouponExample example);
@ -120,7 +121,8 @@ public interface HighCouponMapper extends HighCouponMapperExt {
"coupon_carousel_img, coupon_desc, coupon_type, sales_end_time, recycle_day, ",
"limit_number, sales_price, discount_price, sales_count, is_present, create_time, ",
"update_time, operator_id, operator_name, pay_type, ext_1, ext_2, ext_3, `status`, ",
"display_area, coupon_source, distributor, goods_type_id, brand_id, reserve_status",
"display_area, coupon_source, distributor, goods_type_id, brand_id, reserve_status, ",
"buy_points",
"from high_coupon",
"where id = #{id,jdbcType=BIGINT}"
})
@ -156,7 +158,8 @@ public interface HighCouponMapper extends HighCouponMapperExt {
@Result(column="distributor", property="distributor", jdbcType=JdbcType.INTEGER),
@Result(column="goods_type_id", property="goodsTypeId", jdbcType=JdbcType.INTEGER),
@Result(column="brand_id", property="brandId", jdbcType=JdbcType.INTEGER),
@Result(column="reserve_status", property="reserveStatus", jdbcType=JdbcType.BIT)
@Result(column="reserve_status", property="reserveStatus", jdbcType=JdbcType.BIT),
@Result(column="buy_points", property="buyPoints", jdbcType=JdbcType.BIT)
})
HighCoupon selectByPrimaryKey(Long id);
@ -201,7 +204,8 @@ public interface HighCouponMapper extends HighCouponMapperExt {
"distributor = #{distributor,jdbcType=INTEGER},",
"goods_type_id = #{goodsTypeId,jdbcType=INTEGER},",
"brand_id = #{brandId,jdbcType=INTEGER},",
"reserve_status = #{reserveStatus,jdbcType=BIT}",
"reserve_status = #{reserveStatus,jdbcType=BIT},",
"buy_points = #{buyPoints,jdbcType=BIT}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(HighCoupon record);

@ -152,6 +152,10 @@ public class HighCouponSqlProvider {
sql.VALUES("reserve_status", "#{reserveStatus,jdbcType=BIT}");
}
if (record.getBuyPoints() != null) {
sql.VALUES("buy_points", "#{buyPoints,jdbcType=BIT}");
}
return sql.toString();
}
@ -193,6 +197,7 @@ public class HighCouponSqlProvider {
sql.SELECT("goods_type_id");
sql.SELECT("brand_id");
sql.SELECT("reserve_status");
sql.SELECT("buy_points");
sql.FROM("high_coupon");
applyWhere(sql, example, false);
@ -338,6 +343,10 @@ public class HighCouponSqlProvider {
sql.SET("reserve_status = #{record.reserveStatus,jdbcType=BIT}");
}
if (record.getBuyPoints() != null) {
sql.SET("buy_points = #{record.buyPoints,jdbcType=BIT}");
}
applyWhere(sql, example, true);
return sql.toString();
}
@ -378,6 +387,7 @@ public class HighCouponSqlProvider {
sql.SET("goods_type_id = #{record.goodsTypeId,jdbcType=INTEGER}");
sql.SET("brand_id = #{record.brandId,jdbcType=INTEGER}");
sql.SET("reserve_status = #{record.reserveStatus,jdbcType=BIT}");
sql.SET("buy_points = #{record.buyPoints,jdbcType=BIT}");
HighCouponExample example = (HighCouponExample) parameter.get("example");
applyWhere(sql, example, true);
@ -512,6 +522,10 @@ public class HighCouponSqlProvider {
sql.SET("reserve_status = #{reserveStatus,jdbcType=BIT}");
}
if (record.getBuyPoints() != null) {
sql.SET("buy_points = #{buyPoints,jdbcType=BIT}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();

@ -1219,4 +1219,31 @@ public interface HighOrderMapperExt {
"</script>"
})
Map<String, Object> countGasStoreOrder(@Param("param") Map<String, Object> param);
@Select({
"<script>",
"select",
"order_no , goods_name as oil_station_name , gas_staff_name , gas_oil_type , gas_oil_no ,gas_gun_no , gas_price_official , gas_price_gun , gas_oil_liters , b.total_price as gas_price , mem_phone as user_phone , pay_time ,create_time , order_status ",
"from high_order a join high_child_order b on a.id = b.order_id where ",
" b.goods_id in (${goodsId}) ",
" group by a.order_no ",
"</script>"
})
@Results({
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="oil_station_name", property="oilStationName", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_staff_name", property="gasStaffName", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_oil_type", property="gasOilType", jdbcType=JdbcType.INTEGER),
@Result(column="gas_oil_no", property="gasOilNo", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_gun_no", property="gasGunNo", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_price_official", property="gasPriceOfficial", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_price_gun", property="gasPriceGun", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_oil_liters", property="gasOilLiters", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_price", property="gasPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="order_status", property="orderStatus", jdbcType=JdbcType.INTEGER),
})
List<SelfOilStationModel> getSelfOilStationOrderList(@Param("goodsId") String goodsId);
}

@ -122,7 +122,7 @@ public class HighCoupon extends HighCouponModel implements Serializable {
private String operatorName;
/**
* 支付类型1.微信支付 2.金币支付
* 支付类型1.微信支付 2.金币支付 3. 银联支付 4. 汇联通支付
*/
private Integer payType;
@ -138,7 +138,7 @@ public class HighCoupon extends HighCouponModel implements Serializable {
private Integer status;
/**
* 1.赠券专区 2.金币专区 3 银联专区 4. 优选商品
* 1.赠券专区 2.金币专区 3. 银联专区 4. 优选商品 5. 贵州工会卡专区
*/
private Integer displayArea;
@ -163,10 +163,15 @@ public class HighCoupon extends HighCouponModel implements Serializable {
private Integer brandId;
/**
* 是否预约产品 0 1
* 是否需要预约 0 1
*/
private Boolean reserveStatus;
/**
* 是否自动充值积分 0 1
*/
private Boolean buyPoints;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -425,6 +430,14 @@ public class HighCoupon extends HighCouponModel implements Serializable {
this.reserveStatus = reserveStatus;
}
public Boolean getBuyPoints() {
return buyPoints;
}
public void setBuyPoints(Boolean buyPoints) {
this.buyPoints = buyPoints;
}
@Override
public boolean equals(Object that) {
if (this == that) {
@ -468,7 +481,8 @@ public class HighCoupon extends HighCouponModel implements Serializable {
&& (this.getDistributor() == null ? other.getDistributor() == null : this.getDistributor().equals(other.getDistributor()))
&& (this.getGoodsTypeId() == null ? other.getGoodsTypeId() == null : this.getGoodsTypeId().equals(other.getGoodsTypeId()))
&& (this.getBrandId() == null ? other.getBrandId() == null : this.getBrandId().equals(other.getBrandId()))
&& (this.getReserveStatus() == null ? other.getReserveStatus() == null : this.getReserveStatus().equals(other.getReserveStatus()));
&& (this.getReserveStatus() == null ? other.getReserveStatus() == null : this.getReserveStatus().equals(other.getReserveStatus()))
&& (this.getBuyPoints() == null ? other.getBuyPoints() == null : this.getBuyPoints().equals(other.getBuyPoints()));
}
@Override
@ -507,6 +521,7 @@ public class HighCoupon extends HighCouponModel implements Serializable {
result = prime * result + ((getGoodsTypeId() == null) ? 0 : getGoodsTypeId().hashCode());
result = prime * result + ((getBrandId() == null) ? 0 : getBrandId().hashCode());
result = prime * result + ((getReserveStatus() == null) ? 0 : getReserveStatus().hashCode());
result = prime * result + ((getBuyPoints() == null) ? 0 : getBuyPoints().hashCode());
return result;
}
@ -548,6 +563,7 @@ public class HighCoupon extends HighCouponModel implements Serializable {
sb.append(", goodsTypeId=").append(goodsTypeId);
sb.append(", brandId=").append(brandId);
sb.append(", reserveStatus=").append(reserveStatus);
sb.append(", buyPoints=").append(buyPoints);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();

@ -2135,6 +2135,66 @@ public class HighCouponExample {
addCriterion("reserve_status not between", value1, value2, "reserveStatus");
return (Criteria) this;
}
public Criteria andBuyPointsIsNull() {
addCriterion("buy_points is null");
return (Criteria) this;
}
public Criteria andBuyPointsIsNotNull() {
addCriterion("buy_points is not null");
return (Criteria) this;
}
public Criteria andBuyPointsEqualTo(Boolean value) {
addCriterion("buy_points =", value, "buyPoints");
return (Criteria) this;
}
public Criteria andBuyPointsNotEqualTo(Boolean value) {
addCriterion("buy_points <>", value, "buyPoints");
return (Criteria) this;
}
public Criteria andBuyPointsGreaterThan(Boolean value) {
addCriterion("buy_points >", value, "buyPoints");
return (Criteria) this;
}
public Criteria andBuyPointsGreaterThanOrEqualTo(Boolean value) {
addCriterion("buy_points >=", value, "buyPoints");
return (Criteria) this;
}
public Criteria andBuyPointsLessThan(Boolean value) {
addCriterion("buy_points <", value, "buyPoints");
return (Criteria) this;
}
public Criteria andBuyPointsLessThanOrEqualTo(Boolean value) {
addCriterion("buy_points <=", value, "buyPoints");
return (Criteria) this;
}
public Criteria andBuyPointsIn(List<Boolean> values) {
addCriterion("buy_points in", values, "buyPoints");
return (Criteria) this;
}
public Criteria andBuyPointsNotIn(List<Boolean> values) {
addCriterion("buy_points not in", values, "buyPoints");
return (Criteria) this;
}
public Criteria andBuyPointsBetween(Boolean value1, Boolean value2) {
addCriterion("buy_points between", value1, value2, "buyPoints");
return (Criteria) this;
}
public Criteria andBuyPointsNotBetween(Boolean value1, Boolean value2) {
addCriterion("buy_points not between", value1, value2, "buyPoints");
return (Criteria) this;
}
}
/**

@ -232,6 +232,11 @@ public class HighOrder implements Serializable {
private String gasStaffCode;
/**
* 是否自动充值积分 0 1
*/
private Boolean buyPoints;
public String getGasStaffCode() {
return gasStaffCode;
}
@ -618,6 +623,22 @@ public class HighOrder implements Serializable {
this.ext3 = ext3;
}
public Boolean getTyAgent() {
return isTyAgent;
}
public void setTyAgent(Boolean tyAgent) {
isTyAgent = tyAgent;
}
public Boolean getBuyPoints() {
return buyPoints;
}
public void setBuyPoints(Boolean buyPoints) {
this.buyPoints = buyPoints;
}
@Override
public boolean equals(Object that) {
if (this == that) {

@ -0,0 +1,191 @@
package com.hai.model;
import java.math.BigDecimal;
import java.util.Date;
public class SelfOilStationModel {
/**
* 订单流水号
*/
private String orderNo;
/**
* 油站名称
*/
private String oilStationName;
/**
* 加油站加油员名称
*/
private String gasStaffName;
/**
* 加油站油品类型 1:汽油:2:柴油;3:天然气
*/
private Integer gasOilType;
/**
* 加油站油号
*/
private String gasOilNo;
/**
* 加油站油抢号
*/
private String gasGunNo;
/**
* 加油站国标价
*/
private BigDecimal gasPriceOfficial;
/**
* 加油站油枪价
*/
private BigDecimal gasPriceGun;
/**
* 加油站加油升数
*/
private BigDecimal gasOilLiters;
/**
* 加油站加油金额
*/
private BigDecimal gasPrice;
/**
* 用户电话
*/
private String userPhone;
/**
* 支付时间
*/
private Date payTime;
/**
* 生成时间
*/
private Date createTime;
/**
* 订单状态1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 6.退款中 7.拒绝退款
*/
private Integer orderStatus;
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getOilStationName() {
return oilStationName;
}
public void setOilStationName(String oilStationName) {
this.oilStationName = oilStationName;
}
public String getGasStaffName() {
return gasStaffName;
}
public void setGasStaffName(String gasStaffName) {
this.gasStaffName = gasStaffName;
}
public Integer getGasOilType() {
return gasOilType;
}
public void setGasOilType(Integer gasOilType) {
this.gasOilType = gasOilType;
}
public String getGasOilNo() {
return gasOilNo;
}
public void setGasOilNo(String gasOilNo) {
this.gasOilNo = gasOilNo;
}
public String getGasGunNo() {
return gasGunNo;
}
public void setGasGunNo(String gasGunNo) {
this.gasGunNo = gasGunNo;
}
public BigDecimal getGasPriceOfficial() {
return gasPriceOfficial;
}
public void setGasPriceOfficial(BigDecimal gasPriceOfficial) {
this.gasPriceOfficial = gasPriceOfficial;
}
public BigDecimal getGasPriceGun() {
return gasPriceGun;
}
public void setGasPriceGun(BigDecimal gasPriceGun) {
this.gasPriceGun = gasPriceGun;
}
public BigDecimal getGasOilLiters() {
return gasOilLiters;
}
public void setGasOilLiters(BigDecimal gasOilLiters) {
this.gasOilLiters = gasOilLiters;
}
public BigDecimal getGasPrice() {
return gasPrice;
}
public void setGasPrice(BigDecimal gasPrice) {
this.gasPrice = gasPrice;
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public Date getPayTime() {
return payTime;
}
public void setPayTime(Date payTime) {
this.payTime = payTime;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(Integer orderStatus) {
this.orderStatus = orderStatus;
}
}

@ -527,4 +527,11 @@ public interface HighOrderService {
* @return void
**/
void thirdCancelOrder(Long orderId);
/**
* 查询自建站列表
* @param goodsId
* @return
*/
List<SelfOilStationModel> getSelfOilStationOrderList(String goodsId);
}

@ -249,11 +249,6 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
// 设置库存
highDiscountPackage.setTotalStock(totalStock + num);
highDiscountPackageMapper.updateByPrimaryKey(highDiscountPackage);
// 设置库存
highDiscountPackage.setTotalStock(totalStock + num);
highDiscountPackageMapper.updateByPrimaryKey(highDiscountPackage);
}

@ -1220,6 +1220,9 @@ public class HighOrderServiceImpl implements HighOrderService {
if (MapUtils.getString(map, "phone") != null) {
criteria.andMemPhoneEqualTo(MapUtils.getString(map, "phone"));
}
if (MapUtils.getString(map, "merchId") != null) {
criteria.andMerchIdEqualTo(MapUtils.getString(map, "merchId"));
}
example.setOrderByClause("create_time desc");
List<HighOrder> list = highOrderMapper.selectByExample(example);
@ -1228,6 +1231,7 @@ public class HighOrderServiceImpl implements HighOrderService {
order.setHighChildOrderList(getChildOrderByOrder(order.getId()));
}
}
return list;
}
@ -1826,6 +1830,7 @@ public class HighOrderServiceImpl implements HighOrderService {
public HighOrder insertThirdProduct(JSONObject object) throws Exception {
HighOrder highOrder = new HighOrder();
highOrder.setMerchId(object.getString("mchId"));
HighUser user = highUserService.findByUserId(object.getLong("userId"));
JSONObject jsonObject = null;
@ -1892,8 +1897,8 @@ public class HighOrderServiceImpl implements HighOrderService {
}
// 下单
jsonObject = QianZhuConfig.starbucksOrders(user.getId().toString(), object.getString("storeCode"), List.toString().replace(" ", ""), object.getString("customerMobile"));
// jsonObject = QianZhuConfig.starbucksOrders(user.getId().toString(), "50562", List.toString().replace(" ", ""), object.getString("customerMobile"));
// jsonObject = QianZhuConfig.starbucksOrders(user.getId().toString(), object.getString("storeCode"), List.toString().replace(" ", ""), object.getString("customerMobile"));
jsonObject = QianZhuConfig.starbucksOrders(user.getId().toString(), "50562", List.toString().replace(" ", ""), object.getString("customerMobile"));
// 判断下单是否成功
if (!Objects.equals(jsonObject.getString("code"), "200")) {
@ -2587,4 +2592,9 @@ public class HighOrderServiceImpl implements HighOrderService {
}
}
@Override
public List<SelfOilStationModel> getSelfOilStationOrderList(String goodsId) {
return highOrderMapper.getSelfOilStationOrderList(goodsId);
}
}

@ -142,6 +142,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
if (MapUtils.getInteger(map, "operatorType") != null) {
criteria.andOperatorTypeEqualTo(MapUtils.getInteger(map, "operatorType"));
}
if (MapUtils.getString(map, "merchId") != null) {
criteria.andMerchIdEqualTo(MapUtils.getString(map, "merchId"));
}
if (MapUtils.getInteger(map, "rechargeStatus") != null) {
criteria.andRechargeStatusEqualTo(MapUtils.getInteger(map, "rechargeStatus"));
@ -313,6 +316,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.setMerchId(object.getString("mchId"));
outRechargeOrder.setRechargePrice(outRechargePrice.getRechargePrice());
if (object.getLong("memDiscountId") != null) {
outRechargeOrder.setPayPrice(outRechargePrice.getRechargePrice());

@ -157,7 +157,7 @@ public class GoodsOrderServiceImpl implements PayService {
HighCoupon coupon = highCouponService.getCouponById(highChildOrder.getGoodsId());
// 是否预约
if (coupon.getReserveStatus() == true) {
if (coupon.getReserveStatus()) {
HighOrderPre orderPre = new HighOrderPre();
orderPre.setCompanyId(coupon.getCompanyId());
orderPre.setMerchantId(coupon.getMerchantId());
@ -180,55 +180,55 @@ public class GoodsOrderServiceImpl implements PayService {
// 贵州中石化
if (coupon.getCouponSource() == 4) {
// 获取token
String token = huiLianTongConfig.getToken();
// String token = huiLianTongConfig.getToken();
Map<String,Object> push = new HashMap<>();
push.put("token", token);
// push.put("token", token);
push.put("couTypeCode", coupon.getCouponKey());
push.put("distCouCount", highChildOrder.getSaleCount());
push.put("userPhone", highUser.getPhone());
push.put("thirdUserId", highUser.getUnionId());
// 推送给高速
JSONObject returnParam = HuiLianTongConfig.couJointDist(token, order.getOrderNo(),coupon.getCouponKey(), highChildOrder.getSaleCount(), highUser.getPhone(), highUser.getUnionId());
if (returnParam != null && returnParam.getString("result").equals("success")) {
JSONArray dataArray = returnParam.getJSONArray("data");
for (Object data : dataArray) {
JSONObject dataObject = (JSONObject) data;
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
couponCodeOther.setType(1);
couponCodeOther.setOrderId(order.getId());
couponCodeOther.setChildOrderId(highChildOrder.getId());
couponCodeOther.setCouTypeCode(dataObject.getString("couTypeCode"));
couponCodeOther.setCouNo(dataObject.getString("couNo"));
couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date());
couponCodeOther.setActiveTime(dataObject.getDate("activeTime"));
couponCodeOther.setValidStartDate(dataObject.getDate("validStartDate"));
couponCodeOther.setValidEndDate(dataObject.getDate("validEndDate"));
highCouponCodeOtherMapper.insert(couponCodeOther);
// 卡卷关联用户
HighUserCoupon highUserCoupon = new HighUserCoupon();
highUserCoupon.setMerchantId(coupon.getMerchantId());
highUserCoupon.setCouponId(coupon.getId());
highUserCoupon.setUserId(order.getMemId());
highUserCoupon.setCreateTime(new Date());
highUserCoupon.setQrCodeImg(dataObject.getString("couNo"));
highUserCoupon.setUseEndTime(dataObject.getDate("validEndDate"));
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponMapper.insert(highUserCoupon);
}
}
// // 推送给高速
// JSONObject returnParam = HuiLianTongConfig.couJointDist(token, order.getOrderNo(),coupon.getCouponKey(), highChildOrder.getSaleCount(), highUser.getPhone(), highUser.getUnionId());
// if (returnParam != null && returnParam.getString("result").equals("success")) {
// JSONArray dataArray = returnParam.getJSONArray("data");
// for (Object data : dataArray) {
// JSONObject dataObject = (JSONObject) data;
// HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
// couponCodeOther.setType(1);
// couponCodeOther.setOrderId(order.getId());
// couponCodeOther.setChildOrderId(highChildOrder.getId());
// couponCodeOther.setCouTypeCode(dataObject.getString("couTypeCode"));
// couponCodeOther.setCouNo(dataObject.getString("couNo"));
// couponCodeOther.setStatus(20);
// couponCodeOther.setCreateTime(new Date());
// couponCodeOther.setActiveTime(dataObject.getDate("activeTime"));
// couponCodeOther.setValidStartDate(dataObject.getDate("validStartDate"));
// couponCodeOther.setValidEndDate(dataObject.getDate("validEndDate"));
// highCouponCodeOtherMapper.insert(couponCodeOther);
//
// // 卡卷关联用户
// HighUserCoupon highUserCoupon = new HighUserCoupon();
// highUserCoupon.setMerchantId(coupon.getMerchantId());
// highUserCoupon.setCouponId(coupon.getId());
// highUserCoupon.setUserId(order.getMemId());
// highUserCoupon.setCreateTime(new Date());
// highUserCoupon.setQrCodeImg(dataObject.getString("couNo"));
// highUserCoupon.setUseEndTime(dataObject.getDate("validEndDate"));
// highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
// highUserCouponMapper.insert(highUserCoupon);
// }
// }
// 推送记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type6.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(returnParam.getString("result"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(push));
highGasOrderPush.setReturnContent(returnParam.toJSONString());
// highGasOrderPush.setCode(returnParam.getString("result"));
// highGasOrderPush.setRequestContent(JSONObject.toJSONString(push));
// highGasOrderPush.setReturnContent(returnParam.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
} else {

@ -93,6 +93,8 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/rechargeProduct/*")
.excludePathPatterns("/gzSinopec/*")
.excludePathPatterns("/thirdParty/*")
.excludePathPatterns("/selfOilStation/*")
.excludePathPatterns("/order/*")
;
}

@ -0,0 +1,36 @@
package com.v1.config;
import java.util.Date;
/**
* @serviceName ToolConfig.java
* @author Sum1Dream
* @version 1.0.0
* @Description // 对外接口 方法类
* @createTime 10:03 2022/7/26
**/
public class ToolConfig {
/**
* @Author Sum1Dream
* @name timetableCheck.java
* @Description // 时间戳校验
* @Date 10:08 2022/7/26
* @Param [java.lang.Long, java.lang.Long]
* @return java.lang.Boolean
*/
public static Boolean timetableCheck(Long minNum , Long timetable) {
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
// 获得两个时间的毫秒时间差异
long diff = new Date().getTime() - timetable;
// 计算差多少分钟
long min = diff % nd % nh / nm;
return min <= minNum;
}
}

@ -0,0 +1,175 @@
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.utils.ResponseMsgUtil;
import com.hai.entity.ApiMerchants;
import com.hai.model.ResponseData;
import com.hai.service.*;
import com.v1.config.ToolConfig;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
* @serviceName rechargeProductController.java
* @author Sum1Dream
* @version 1.0.0
* @Description // 充值产品接口
* @createTime 17:14 2022/6/9
**/
@Controller
@RequestMapping(value = "/order")
@Api(value = "订单")
public class HighOrderController {
private static Logger log = LoggerFactory.getLogger(HighOrderController.class);
@Resource
private ApiMerchantsService apiMerchantsService;
@Resource
private SecConfigService secConfigService;
@Resource
private OutRechargeOrderService outRechargeOrderService;
@Resource
private HighOrderService highOrderService;
@RequestMapping(value = "/getCallOrderList", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取话费订单列表")
public ResponseData getCallOrderList(@RequestBody JSONObject object , HttpServletRequest request ) {
try {
String ip = "";
// 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , 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("merchId")) ||
StringUtils.isBlank(object.getString("timetable")) ||
StringUtils.isBlank(object.getString("sign"))
) {
log.error("getRechargeProduct error!", "请求参数校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR);
}
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId"));
if (apiMerchants == null) {
log.error("getRechargeProduct error!", "商户号错误!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST);
}
Map<String , Object> map = new HashMap<>();
map.put("apiKey" , object.getString("apiKey"));
map.put("timetable" , object.getString("timetable"));
map.put("merchId" , object.getString("merchId"));
if (!secConfigService.isSignVerify(map , object.getString("sign"))) {
log.error("getRechargeProduct error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) {
log.error("getRechargeProduct error!", "请求时间超过15分钟!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
Map<String, Object> postMap = new HashMap<>();
postMap.put("merchId" , object.getString("merchId"));
return ResponseMsgUtil.success(outRechargeOrderService.getListRechargeOrder(postMap));
} catch (Exception e) {
log.error("HighOpenApiController --> getRechargeProduct() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getOrderList", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取订单列表")
public ResponseData getOrderList(@RequestBody JSONObject object , HttpServletRequest request ) {
try {
String ip = "";
// 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , 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("merchId")) ||
StringUtils.isBlank(object.getString("timetable")) ||
StringUtils.isBlank(object.getString("sign"))
) {
log.error("getRechargeProduct error!", "请求参数校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR);
}
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId"));
if (apiMerchants == null) {
log.error("getRechargeProduct error!", "商户号错误!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST);
}
Map<String , Object> map = new HashMap<>();
map.put("apiKey" , object.getString("apiKey"));
map.put("timetable" , object.getString("timetable"));
map.put("merchId" , object.getString("merchId"));
if (!secConfigService.isSignVerify(map , object.getString("sign"))) {
log.error("getRechargeProduct error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) {
log.error("getRechargeProduct error!", "请求时间超过15分钟!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
Map<String, Object> postMap = new HashMap<>();
postMap.put("merchId" , object.getString("merchId"));
return ResponseMsgUtil.success(highOrderService.getOrderList(postMap));
} catch (Exception e) {
log.error("HighOpenApiController --> getRechargeProduct() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -8,6 +8,7 @@ import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.*;
import com.hai.model.ResponseData;
import com.hai.service.*;
import com.v1.config.ToolConfig;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.MapUtils;
@ -19,7 +20,9 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -74,6 +77,7 @@ public class RechargeProductController {
}
if (StringUtils.isBlank(object.getString("apiKey")) ||
StringUtils.isBlank(object.getString("timetable")) ||
StringUtils.isBlank(object.getString("merchId")) ||
StringUtils.isBlank(object.getString("sign")) ||
object.getInteger("rechargeType") == null
@ -90,6 +94,7 @@ public class RechargeProductController {
}
Map<String , Object> map = new HashMap<>();
map.put("timetable" , object.getString("timetable"));
map.put("apiKey" , object.getString("apiKey"));
map.put("merchId" , object.getString("merchId"));
map.put("rechargeType" , object.getString("rechargeType"));
@ -99,6 +104,11 @@ public class RechargeProductController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) {
log.error("getRechargeProduct error!", "请求时间超过15分钟!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
return ResponseMsgUtil.success(apiMerchantsService.getMerchProduct(apiMerchants.getId() , object.getInteger("rechargeType")));
} catch (Exception e) {
@ -128,6 +138,7 @@ public class RechargeProductController {
if (StringUtils.isBlank(object.getString("apiKey")) ||
StringUtils.isBlank(object.getString("merchId")) ||
StringUtils.isBlank(object.getString("timetable")) ||
StringUtils.isBlank(object.getString("sign"))
) {
log.error("getRechargeProduct error!", "请求参数校验失败!");
@ -143,6 +154,7 @@ public class RechargeProductController {
Map<String , Object> map = new HashMap<>();
map.put("apiKey" , object.getString("apiKey"));
map.put("timetable" , object.getString("timetable"));
map.put("merchId" , object.getString("merchId"));
if (!secConfigService.isSignVerify(map , object.getString("sign"))) {
@ -150,6 +162,11 @@ public class RechargeProductController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) {
log.error("getRechargeProduct error!", "请求时间超过15分钟!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
return ResponseMsgUtil.success(apiMerchants.getAmounts());
} catch (Exception e) {
@ -178,6 +195,7 @@ public class RechargeProductController {
}
if (StringUtils.isBlank(object.getString("apiKey")) ||
StringUtils.isBlank(object.getString("timetable")) ||
StringUtils.isBlank(object.getString("merchId")) ||
StringUtils.isBlank(object.getString("sign")) ||
StringUtils.isBlank(object.getString("sourceOrderNo"))
@ -195,6 +213,7 @@ public class RechargeProductController {
Map<String , Object> map = new HashMap<>();
map.put("apiKey" , object.getString("apiKey"));
map.put("timetable" , object.getString("timetable"));
map.put("merchId" , object.getString("merchId"));
map.put("sourceOrderNo" , object.getString("sourceOrderNo"));
@ -203,6 +222,10 @@ public class RechargeProductController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) {
log.error("getRechargeProduct error!", "请求时间超过15分钟!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
ApiOrderRecord apiOrderRecord = apiOrderRecordService.queryOrderResult(map);
@ -254,6 +277,7 @@ public class RechargeProductController {
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("notifyUrl")) ||
StringUtils.isBlank(object.getString("sign")) ||
@ -285,6 +309,7 @@ public class RechargeProductController {
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("notifyUrl" , object.getString("notifyUrl"));
map.put("apiKey" , object.getString("apiKey"));
@ -294,6 +319,12 @@ public class RechargeProductController {
log.error("createOrder error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) {
log.error("getRechargeProduct error!", "请求时间超过15分钟!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
apiOpenService.createOrder(object , apiMerchants , apiProductConfig);
return ResponseMsgUtil.success("下单成功");
@ -303,4 +334,5 @@ public class RechargeProductController {
}
}
}

@ -0,0 +1,116 @@
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.utils.ResponseMsgUtil;
import com.hai.entity.ApiMerchants;
import com.hai.entity.HighOrder;
import com.hai.entity.SecConfig;
import com.hai.model.ResponseData;
import com.hai.model.SelfOilStationModel;
import com.hai.service.*;
import com.v1.config.ToolConfig;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping(value = "/selfOilStation")
@Api(value = "自建站接口")
public class SelfOilStationController {
private static Logger log = LoggerFactory.getLogger(SelfOilStationController.class);
@Resource
private ApiMerchantsService apiMerchantsService;
@Resource
private SecConfigService secConfigService;
@Resource
private HighOrderService highOrderService;
@RequestMapping(value = "/getSelfOilStationOrderList", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取自建站订单")
public ResponseData getSelfOilStationOrderList(@RequestBody JSONObject object , HttpServletRequest request ) {
try {
String ip = "";
// 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , 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")) ||
StringUtils.isBlank(object.getString("sign"))
) {
log.error("getRechargeProduct error!", "请求参数校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR);
}
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId"));
if (apiMerchants == null) {
log.error("getRechargeProduct error!", "错误商户,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST);
}
Map<String , Object> map = new HashMap<>();
map.put("timetable" , object.getString("timetable"));
map.put("apiKey" , object.getString("apiKey"));
map.put("merchId" , object.getString("merchId"));
if (!secConfigService.isSignVerify(map , object.getString("sign"))) {
log.error("getRechargeProduct error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
if (!secConfigService.isConfig("SELF_OIL_STATION_CONFIG" , object.getString("merchId"))) {
log.error("getAllCities error!", "当前帐户无权限!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前帐户无权限!");
}
if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) {
log.error("getRechargeProduct error!", "请求时间超过15分钟!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
SecConfig config = secConfigService.findByCodeType(object.getString("merchId"));
return ResponseMsgUtil.success(highOrderService.getSelfOilStationOrderList(config.getCodeValue()));
} catch (Exception e) {
log.error("HighOpenApiController --> getRechargeProduct() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -75,13 +75,13 @@ public class ThirdPartyController {
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId"));
if (apiMerchants == null) {
log.error("getRechargeProduct error!", "户号错误!");
log.error("getRechargeProduct error!", "户号错误!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST);
}
if (!secConfigService.isConfig("KFC_CONFIG" , object.getString("merchId"))) {
log.error("getAllCities error!", "当前户无权限查询!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前户无权限查询!");
log.error("getAllCities error!", "当前户无权限查询!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前户无权限查询!");
}
Map<String , Object> map = new HashMap<>();
@ -135,13 +135,13 @@ public class ThirdPartyController {
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId"));
if (apiMerchants == null) {
log.error("getRechargeProduct error!", "户号错误!");
log.error("getRechargeProduct error!", "户号错误!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST);
}
if (!secConfigService.isConfig("KFC_CONFIG" , object.getString("merchId"))) {
log.error("getAllCities error!", "当前户无权限查询!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前户无权限查询!");
log.error("getAllCities error!", "当前户无权限查询!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前户无权限查询!");
}
Map<String , Object> map = new HashMap<>();
@ -202,13 +202,13 @@ public class ThirdPartyController {
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId"));
if (apiMerchants == null) {
log.error("getRechargeProduct error!", "户号错误!");
log.error("getRechargeProduct error!", "户号错误!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST);
}
if (!secConfigService.isConfig("KFC_CONFIG" , object.getString("merchId"))) {
log.error("getAllCities error!", "当前户无权限查询!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前户无权限查询!");
log.error("getAllCities error!", "当前户无权限查询!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前户无权限查询!");
}
Map<String , Object> map = new HashMap<>();

Loading…
Cancel
Save