Merge branch '2.0-dev' of http://gitea.dctpay.com/hurui/hai-server into 2.0-dev
commit
f66e8baa0d
@ -0,0 +1,49 @@ |
||||
package com.bweb.controller; |
||||
|
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.hai.common.utils.ResponseMsgUtil; |
||||
import com.hai.entity.ApiBlxCoupon; |
||||
import com.hai.model.ResponseData; |
||||
import com.hai.openApi.service.ApiBlxCouponService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
@Controller |
||||
@RequestMapping(value = "/apiCoupon") |
||||
@Api(value = "外部卡券查询") |
||||
public class ApiCouponController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(HighDiscountPackageController.class); |
||||
|
||||
@Resource |
||||
private ApiBlxCouponService apiBlxCouponService; |
||||
|
||||
@RequestMapping(value = "/getBlxCouponList", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "获取比邻星停车券列表") |
||||
public ResponseData getBlxCouponList( @RequestParam(name = "pageNum", required = true) Integer pageNum, |
||||
@RequestParam(name = "pageSize", required = true) Integer pageSize) { |
||||
try { |
||||
|
||||
PageHelper.startPage(pageNum, pageSize); |
||||
return ResponseMsgUtil.success(new PageInfo<>(apiBlxCouponService.getBlxCouponList(new HashMap<>()))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighDiscountPackageController --> getDiscountPackageList() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,77 @@ |
||||
package com.hai.schedule; |
||||
|
||||
import com.alibaba.fastjson.JSONArray; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hai.config.QianZhuConfig; |
||||
import com.hai.entity.ApiBlxCoupon; |
||||
import com.hai.entity.ApiStarbucksProducts; |
||||
import com.hai.openApi.config.BlxConfig; |
||||
import com.hai.openApi.service.ApiBlxCouponService; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.scheduling.annotation.Scheduled; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
@Configuration |
||||
public class ApiBlxCouponSchedule { |
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ApiBlxCouponSchedule.class); |
||||
|
||||
@Resource |
||||
private ApiBlxCouponService apiBlxCouponService; |
||||
|
||||
@Resource |
||||
private BlxConfig blxConfig; |
||||
|
||||
@Scheduled(cron="0 0/60 * * * ?") //每60分钟执行一次
|
||||
public void getBlxCoupon() { |
||||
JSONObject object = blxConfig.queryCouponPage(); |
||||
|
||||
if (object.getInteger("code") == 1) { |
||||
|
||||
JSONArray jsonArray = object.getJSONObject("data").getJSONArray("records"); |
||||
|
||||
for (int i = 0; i < jsonArray.size(); i++) { |
||||
if (jsonArray.getJSONObject(i).getString("couponCode") != null) { |
||||
ApiBlxCoupon apiBlxCoupon = apiBlxCouponService.findBlxCoupon(jsonArray.getJSONObject(i).getString("couponCode")); |
||||
if (apiBlxCoupon == null) { |
||||
apiBlxCoupon = new ApiBlxCoupon(); |
||||
apiBlxCoupon.setCouponCode(jsonArray.getJSONObject(i).getString("couponCode")); |
||||
apiBlxCoupon.setCouponStatus(jsonArray.getJSONObject(i).getInteger("couponStatus")); |
||||
apiBlxCoupon.setCreateTime(new Date()); |
||||
apiBlxCoupon.setCouponName(jsonArray.getJSONObject(i).getString("couponName")); |
||||
apiBlxCoupon.setDenomination(jsonArray.getJSONObject(i).getInteger("denomination")); |
||||
apiBlxCoupon.setUpdateTime(new Date()); |
||||
apiBlxCoupon.setMinPrice(jsonArray.getJSONObject(i).getInteger("minPrice")); |
||||
apiBlxCoupon.setUseStartTime(jsonArray.getJSONObject(i).getDate("useStartTime")); |
||||
apiBlxCoupon.setUseEndTime(jsonArray.getJSONObject(i).getDate("useEndTime")); |
||||
apiBlxCoupon.setCouponStatus(jsonArray.getJSONObject(i).getInteger("couponStatus")); |
||||
apiBlxCoupon.setReceiveDays(jsonArray.getJSONObject(i).getInteger("receiveDays")); |
||||
apiBlxCoupon.setReceiveLimit(jsonArray.getJSONObject(i).getInteger("receiveLimit")); |
||||
apiBlxCouponService.insertBlxCoupon(apiBlxCoupon); |
||||
|
||||
} else { |
||||
apiBlxCoupon.setCouponStatus(jsonArray.getJSONObject(i).getInteger("couponStatus")); |
||||
apiBlxCoupon.setCouponName(jsonArray.getJSONObject(i).getString("couponName")); |
||||
apiBlxCoupon.setDenomination(jsonArray.getJSONObject(i).getInteger("denomination")); |
||||
apiBlxCoupon.setUpdateTime(new Date()); |
||||
apiBlxCoupon.setMinPrice(jsonArray.getJSONObject(i).getInteger("minPrice")); |
||||
apiBlxCoupon.setUseStartTime(jsonArray.getJSONObject(i).getDate("useStartTime")); |
||||
apiBlxCoupon.setUseEndTime(jsonArray.getJSONObject(i).getDate("useEndTime")); |
||||
apiBlxCoupon.setCouponStatus(jsonArray.getJSONObject(i).getInteger("couponStatus")); |
||||
apiBlxCoupon.setReceiveDays(jsonArray.getJSONObject(i).getInteger("receiveDays")); |
||||
apiBlxCoupon.setReceiveLimit(jsonArray.getJSONObject(i).getInteger("receiveLimit")); |
||||
apiBlxCouponService.editBlxCoupon(apiBlxCoupon); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,83 @@ |
||||
package com.hai.openApi.config; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hai.common.utils.HttpsUtils; |
||||
import com.hai.common.utils.RedisUtil; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
@Component |
||||
public class BlxConfig { |
||||
|
||||
@Resource |
||||
private RedisUtil redisUtil; |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name generateJw |
||||
* @Description // 获取token
|
||||
* @Date 10:42 2023/7/11 |
||||
* @Param [] |
||||
* @Return java.lang.String |
||||
*/ |
||||
public String generateJw() { |
||||
Object token = redisUtil.get("BlxToken"); |
||||
|
||||
if (token == null) { |
||||
Map<String , Object > map = new HashMap<>(); |
||||
map.put("organizeCode" , "dhy"); |
||||
|
||||
JSONObject object = HttpsUtils.doGet("https://vertical-formats-gateway.blx.bodata.cn:18443/admin/api/generateJwt" , map); |
||||
|
||||
return object.getString("data"); |
||||
|
||||
|
||||
} |
||||
return token.toString(); |
||||
} |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name queryCouponPage |
||||
* @Description // 获取比邻星停车券列表
|
||||
* @Date 10:57 2023/7/11 |
||||
* @Param [] |
||||
* @Return com.alibaba.fastjson.JSONObject |
||||
*/ |
||||
public JSONObject queryCouponPage() { |
||||
|
||||
Map<String , Object > map = new HashMap<>(); |
||||
map.put("rows" , "20"); |
||||
map.put("currPage" , "1"); |
||||
|
||||
Map<String , Object> header = new HashMap<>(); |
||||
header.put("token" , generateJw()); |
||||
|
||||
return HttpsUtils.doPost("https://vertical-formats-gateway.blx.bodata.cn:18443/admin/api/qureyCouponPage" , map , header); |
||||
|
||||
} |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name sendCoupon |
||||
* @Description // 发放券
|
||||
* @Date 11:01 2023/7/11 |
||||
* @Param [object] |
||||
* @Return com.alibaba.fastjson.JSONObject |
||||
*/ |
||||
public JSONObject sendCoupon(JSONObject object) { |
||||
Map<String , Object > map = new HashMap<>(); |
||||
map.put("couponCode" , object.getString("couponCode")); |
||||
map.put("receiverPhone" , object.getString("receiverPhone")); |
||||
map.put("receiverCount" , object.getInteger("receiverCount")); |
||||
|
||||
Map<String , Object> header = new HashMap<>(); |
||||
header.put("token" , generateJw()); |
||||
|
||||
return HttpsUtils.doPost("https://vertical-formats-gateway.blx.bodata.cn:18443/admin/api/qureyCouponPage" , map , header); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,50 @@ |
||||
package com.hai.openApi.service; |
||||
|
||||
import com.hai.entity.ApiBlxCoupon; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public interface ApiBlxCouponService { |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name insertBlxCoupon |
||||
* @Description // 新增停车券
|
||||
* @Date 14:20 2023/7/11 |
||||
* @Param [apiBlxCoupon] |
||||
* @Return void |
||||
*/ |
||||
void insertBlxCoupon(ApiBlxCoupon apiBlxCoupon); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name editBlxCoupon |
||||
* @Description // 修改停车券
|
||||
* @Date 14:23 2023/7/11 |
||||
* @Param [apiBlxCoupon] |
||||
* @Return void |
||||
*/ |
||||
void editBlxCoupon(ApiBlxCoupon apiBlxCoupon); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name FindBlxCoupon |
||||
* @Description // 根据卡券编码查询券
|
||||
* @Date 14:23 2023/7/11 |
||||
* @Param [couponCode] |
||||
* @Return com.hai.entity.ApiBlxCoupon |
||||
*/ |
||||
ApiBlxCoupon findBlxCoupon(String couponCode); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getBlxCouponList |
||||
* @Description // 查询停车券列表
|
||||
* @Date 14:23 2023/7/11 |
||||
* @Param [map] |
||||
* @Return java.util.List<com.hai.entity.ApiBlxCoupon> |
||||
*/ |
||||
List<ApiBlxCoupon> getBlxCouponList(Map<String , Object> map); |
||||
|
||||
} |
@ -0,0 +1,55 @@ |
||||
package com.hai.openApi.service.impl; |
||||
|
||||
import com.hai.dao.ApiBlxCouponMapper; |
||||
import com.hai.entity.ApiBlxCoupon; |
||||
import com.hai.entity.ApiBlxCouponExample; |
||||
import com.hai.openApi.service.ApiBlxCouponService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service("apiBlxCouponService") |
||||
public class ApiBlxCouponServiceImpl implements ApiBlxCouponService { |
||||
|
||||
@Resource |
||||
private ApiBlxCouponMapper apiBlxCouponMapper; |
||||
|
||||
@Override |
||||
public void insertBlxCoupon(ApiBlxCoupon apiBlxCoupon) { |
||||
apiBlxCouponMapper.insert(apiBlxCoupon); |
||||
} |
||||
|
||||
@Override |
||||
public void editBlxCoupon(ApiBlxCoupon apiBlxCoupon) { |
||||
apiBlxCouponMapper.updateByPrimaryKey(apiBlxCoupon); |
||||
} |
||||
|
||||
@Override |
||||
public ApiBlxCoupon findBlxCoupon(String couponCode) { |
||||
ApiBlxCouponExample example = new ApiBlxCouponExample(); |
||||
ApiBlxCouponExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
criteria.andCouponCodeEqualTo(couponCode); |
||||
|
||||
List<ApiBlxCoupon> apiBlxCoupons = apiBlxCouponMapper.selectByExample(example); |
||||
|
||||
if (apiBlxCoupons.size() > 0) { |
||||
return apiBlxCoupons.get(0); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public List<ApiBlxCoupon> getBlxCouponList(Map<String, Object> map) { |
||||
|
||||
ApiBlxCouponExample example = new ApiBlxCouponExample(); |
||||
ApiBlxCouponExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
criteria.andCouponStatusEqualTo(1); |
||||
|
||||
return apiBlxCouponMapper.selectByExample(example); |
||||
} |
||||
} |
@ -0,0 +1,59 @@ |
||||
package com.hai.order.model; |
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty; |
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* 订单退款模型 |
||||
* @className: ExportGasOrderModel |
||||
* @author: 袁野 |
||||
* @date: 2022/10/28 |
||||
**/ |
||||
@Data |
||||
public class ExportOrderModel { |
||||
|
||||
@ColumnWidth(25) |
||||
@ExcelProperty("推广人") |
||||
private String userName; |
||||
|
||||
@ColumnWidth(25) |
||||
@ExcelProperty("标题") |
||||
private String title; |
||||
|
||||
@ColumnWidth(15) |
||||
@ExcelProperty("客户电话") |
||||
private String memPhone; |
||||
|
||||
@ColumnWidth(25) |
||||
@ExcelProperty("交易单号") |
||||
private String orderNo; |
||||
|
||||
@ColumnWidth(13) |
||||
@ExcelProperty(value = "应付金额") |
||||
private BigDecimal payablePrice; |
||||
|
||||
@ColumnWidth(13) |
||||
@ExcelProperty(value = "实付金额") |
||||
private BigDecimal payPrice; |
||||
|
||||
@ColumnWidth(15) |
||||
@ExcelProperty("创建时间") |
||||
private Date createTime; |
||||
|
||||
@ColumnWidth(15) |
||||
@ExcelProperty("支付时间") |
||||
private Date payTime; |
||||
|
||||
@ColumnWidth(15) |
||||
@ExcelProperty("完成时间") |
||||
private Date finishTime; |
||||
|
||||
@ColumnWidth(15) |
||||
@ExcelProperty("备注") |
||||
private String remark; |
||||
|
||||
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,99 @@ |
||||
package com.v1.controller.business; |
||||
|
||||
|
||||
import com.hai.openApi.service.ApiBlxCouponService; |
||||
import com.hai.openApi.service.ApiMobileRechargeProductService; |
||||
import com.hai.order.type.OrderProductType; |
||||
import com.hai.service.ApiIpAddressService; |
||||
import com.hai.service.ApiMerchantsService; |
||||
import com.hai.service.SecConfigService; |
||||
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.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
@RestController |
||||
@RequestMapping(value="/blxCoupon") |
||||
@Api(value="优惠券") |
||||
public class BlxCouponController { |
||||
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(MobileRechargeController.class); |
||||
|
||||
@Resource |
||||
private ApiMerchantsService apiMerchantsService; |
||||
|
||||
@Resource |
||||
private SecConfigService secConfigService; |
||||
|
||||
@Resource |
||||
private ApiBlxCouponService apiBlxCouponService; |
||||
|
||||
@Resource |
||||
private ApiIpAddressService apiIpAddressService; |
||||
|
||||
|
||||
// @RequestMapping(value = "/getCouponList", method = RequestMethod.POST)
|
||||
// @ResponseBody
|
||||
// @ApiOperation(value = "获取话费充值产品")
|
||||
// public ResponseData getCouponList(@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 (!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("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);
|
||||
// }
|
||||
//
|
||||
// if (!secConfigService.isConfig(OrderProductType.PRODUCT_TYPE9.getApiCode(), object.getString("merchId"))) {
|
||||
// log.error("getAllCities error!", "当前帐户无权限查询!");
|
||||
// throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "");
|
||||
// }
|
||||
//
|
||||
// Map<String , Object> map = new HashMap<>();
|
||||
// map.put("apiKey" , apiMerchants.getApiKey());
|
||||
// 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);
|
||||
// }
|
||||
//
|
||||
// return ResponseMsgUtil.success(apiBlxCouponService.getBlxCouponList(object.getString("merchId")));
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// log.error("HighOpenApiController --> getRechargeProduct() error!", e);
|
||||
// return ResponseMsgUtil.exception(e);
|
||||
// }
|
||||
// }
|
||||
|
||||
} |
Loading…
Reference in new issue