Compare commits

..

No commits in common. '14a6bbce12022721dff0788fe76ffc74972408ad' and '70df18c2d0c97e147dbb8d4b751fcc186708341e' have entirely different histories.

  1. 81
      openapi/src/main/java/com/openapi/controller/BsGasController.java
  2. 40
      service/src/main/java/com/hfkj/openapi/model/request/RequestQueryGasInfoModel.java
  3. 21
      service/src/main/java/com/hfkj/openapi/model/response/QueryGasGun.java
  4. 42
      service/src/main/java/com/hfkj/openapi/model/response/QueryGasOilPriceDetail.java
  5. 83
      service/src/main/java/com/hfkj/openapi/model/response/ResponseQueryGasInfoModel.java
  6. 47
      service/src/main/java/com/hfkj/openapi/model/response/ResponseQueryGasListModel.java
  7. 50
      service/src/main/java/com/hfkj/openapi/service/ApiGasService.java
  8. 4
      service/src/main/resources/prod/commonConfig.properties
  9. 4
      service/src/main/resources/prod2/commonConfig.properties

@ -10,16 +10,18 @@ import com.hfkj.common.utils.PageUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsAgentApiLogWithBLOBs;
import com.hfkj.entity.BsAgentApiParam;
import com.hfkj.entity.BsAgentMer;
import com.hfkj.entity.BsDiscountUser;
import com.hfkj.model.ResponseData;
import com.hfkj.openapi.model.request.*;
import com.hfkj.openapi.model.response.*;
import com.hfkj.openapi.service.ApiGasService;
import com.hfkj.openapi.model.request.RequestPushDiscountModel;
import com.hfkj.openapi.model.request.RequestPushPkDiscountModel;
import com.hfkj.openapi.model.request.RequestQueryCodeModel;
import com.hfkj.openapi.model.request.RequestQueryGasListModel;
import com.hfkj.openapi.model.response.ResponsePushDiscountModel;
import com.hfkj.openapi.model.response.ResponsePushDiscountPkModel;
import com.hfkj.openapi.model.response.ResponseQueryCodeModel;
import com.hfkj.service.agent.BsAgentApiLogService;
import com.hfkj.service.agent.BsAgentApiParamService;
import com.hfkj.service.agent.BsAgentDiscountService;
import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.discount.BsDiscountUserService;
import com.hfkj.service.gas.BsGasService;
import com.hfkj.service.merchant.BsMerchantService;
@ -49,12 +51,11 @@ public class BsGasController {
@Resource
private BsAgentApiParamService agentApiParamService;
@Resource
private BsAgentMerService agentMerService;
@Resource
private ApiGasService apiGasService;
private BsGasService gasService;
@Resource
private BsAgentApiLogService agentApiLogService;
@RequestMapping(value="/queryList",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "分页获取(全量)油站信息")
@ -79,9 +80,21 @@ public class BsGasController {
ResponseQueryGasListModel response = new ResponseQueryGasListModel();
List<Map<String,Object>> codeMapList = new ArrayList<>();
/*for (BsDiscountUser discountUser : codeDataList) {
Map<String,Object> codeMap = new HashMap<>();
codeMap.put("discountNo", discountUser.getDiscountNo());
codeMap.put("phone", discountUser.getUserPhone());
codeMap.put("code", discountUser.getDiscountStockCode());
codeMap.put("status", discountUser.getStatus());
codeMap.put("createTime", DateUtil.date2String(discountUser.getCreateTime(), DateUtil.Y_M_D_HMS));
codeMap.put("expirationDate", DateUtil.date2String(discountUser.getExpirationDate(), DateUtil.Y_M_D_HMS));
codeMapList.add(codeMap);
}*/
ResponsePushDiscountModel response = new ResponsePushDiscountModel();
response.setReqId(body.getReqId());
response.setAppId(body.getAppId());
response.setCodeList(codeMapList);
response.setSign(SignatureUtil.createSign(response, agentApiParamService.getParamByAppId(body.getAppId()).getAppSecret()));
log.info("返回参数:" + JSONObject.toJSONString(response));
apiLog.setResponseParam(JSONObject.toJSONString(response));
@ -103,54 +116,4 @@ public class BsGasController {
}
}
@RequestMapping(value="/queryGasInfoByGasNo",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取油站信息")
public ResponseData queryGasInfoByGasNo(@Validated @RequestBody RequestQueryGasInfoModel body) {
log.info("========= Start 获取油站信息 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
BsAgentApiLogWithBLOBs apiLog = new BsAgentApiLogWithBLOBs();
try {
// 验证签名
BsAgentApiParam apiParam = agentApiParamService.getParamByAppId(body.getAppId());
if (!SignatureUtil.checkSign(body.getSign(), body, apiParam.getAppSecret())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
// 验证请求id
if (agentApiLogService.isExist(body.getAppId(), body.getReqId())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_REQ_ID_ERR, "");
}
apiLog.setAppId(body.getAppId());
apiLog.setRequestId(body.getReqId());
apiLog.setRequestUrl("gas/queryGasInfoByGasNo");
apiLog.setRequestParam(JSONObject.toJSONString(body));
// 查询油站
BsAgentMer agentMer = agentMerService.getDetailByAgent(apiParam.getAgentId(), body.getGasNo());
if (agentMer == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未查到加油站信息");
}
ResponseQueryGasInfoModel response = apiGasService.queryGasInfo(apiParam.getAgentId(), body.getGasNo());
log.info("返回参数:" + JSONObject.toJSONString(response));
apiLog.setResponseParam(JSONObject.toJSONString(response));
return ResponseMsgUtil.success(response);
} catch (Exception e) {
log.info("出现异常:", e);
// 异常内容
ResponseData exception = ResponseMsgUtil.exception(e);
apiLog.setErrorContent(JSONObject.toJSONString(exception));
return exception;
} finally {
// 记录日志
if (apiLog.getAppId() != null) {
agentApiLogService.edit(apiLog);
}
log.info("========= END 获取油站信息 END ===========");
}
}
}

@ -1,40 +0,0 @@
package com.hfkj.openapi.model.request;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @className: RequestQueryGasListModel
* @author: HuRui
* @date: 2024/9/18
**/
@Data
public class RequestQueryGasInfoModel {
/**
* appid
*/
@NotBlank(message = "请求id必填项")
private String reqId;
/**
* appid
*/
@NotBlank(message = "appId必填项")
private String appId;
/**
* 油站编号
*/
@NotNull(message = "油站编号必填项")
private String gasNo;
/**
* 签名参数
*/
@NotBlank(message = "签名必填项")
private String sign;
}

@ -1,21 +0,0 @@
package com.hfkj.openapi.model.response;
import lombok.Data;
/**
* @className: RequestQueryGasListModel
* @author: HuRui
* @date: 2024/9/18
**/
@Data
public class QueryGasGun {
/**
* 油站编号
*/
private String gasNo;
/**
* 油站名称
*/
private String gasName;
}

@ -1,42 +0,0 @@
package com.hfkj.openapi.model.response;
import lombok.Data;
import java.math.BigDecimal;
/**
* @className: RequestQueryGasListModel
* @author: HuRui
* @date: 2024/9/18
**/
@Data
public class QueryGasOilPriceDetail {
/**
* 油站编号
*/
private String gasNo;
/**
* 油站名称
*/
private String gasName;
/**
* 油品类型
*/
private Integer oilType;
/**
* 油品类型名称
*/
private Integer oilTypeName;
/**
* 国标价
*/
private BigDecimal priceOfficial;
/**
* 油枪价
*/
private BigDecimal priceGun;
/**
* 优惠价
*/
private BigDecimal priceVip;
}

@ -1,83 +0,0 @@
package com.hfkj.openapi.model.response;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @className: RequestQueryGasListModel
* @author: HuRui
* @date: 2024/9/18
**/
@Data
public class ResponseQueryGasInfoModel {
/**
* 油站编号
*/
private String gasNo;
/**
* 油站名称
*/
private String gasName;
/**
* 省份编码
*/
private String provinceCode;
/**
* 油站所在省份
*/
private String provinceName;
/**
* 城市编码
*/
private String cityCode;
/**
* 油站所在城市
*/
private String cityName;
/**
* 区县码
*/
private String countyCode;
/**
* 油站所在区/
*/
private String countyName;
/**
* 油站详细地址
*/
private String gasAddress;
/**
* 油站经度
*/
private String gasAddressLongitude;
/**
* 油站维度
*/
private String gasAddressLatitude;
/**
* 油站状态
*/
private Integer gasStatus;
/**
* 油站logo
*/
private String gasLogo;
/**
* 油站图片
*/
private String gasImg;
/**
* 油品信息
*/
private List<QueryGasOilPriceDetail> oilPriceList;
/**
* 油枪信息
*/
private List<QueryGasGun> gasGunList;
}

@ -1,47 +0,0 @@
package com.hfkj.openapi.model.response;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @className: RequestQueryGasListModel
* @author: HuRui
* @date: 2024/9/18
**/
@Data
public class ResponseQueryGasListModel {
/**
* appid
*/
private String reqId;
/**
* appid
*/
@NotBlank(message = "appId必填项")
private String appId;
/**
* 分页页数
*/
@NotNull(message = "页数必填项")
private Integer pageNum;
/**
* 每页数量
*/
@Range(min = 1, max = 50,message = "数量必须设置在1至100之内")
@NotNull(message = "每页数量必填项")
private Integer pageSize;
/**
* 签名参数
*/
@NotBlank(message = "签名必填项")
private String sign;
}

@ -1,50 +0,0 @@
package com.hfkj.openapi.service;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.entity.BsMerchant;
import com.hfkj.model.GasModel;
import com.hfkj.openapi.model.response.ResponseQueryGasInfoModel;
import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.agent.BsAgentPriceService;
import com.hfkj.service.gas.BsGasOilGunNoService;
import com.hfkj.service.gas.BsGasService;
import com.hfkj.service.merchant.BsMerchantService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
/**
* @className: GasService
* @author: HuRui
* @date: 2024/11/12
**/
@Component("apiGasService")
public class ApiGasService {
@Resource
private BsAgentMerService agentMerService;
@Resource
private BsAgentPriceService agentPriceService;
@Resource
private BsMerchantService merchantService;
@Resource
private BsGasService gasService;
/**
* 查询油站详情
* @param agentId
* @param gasNo
*/
public ResponseQueryGasInfoModel queryGasInfo(Long agentId, String gasNo) {
// 油站详情
GasModel gasDetail = gasService.getGasDetail(gasNo);
if (gasDetail == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未查到加油站信息");
}
return null;
}
}

@ -6,8 +6,8 @@ wxMaAppId=wx8d49e2f83025229d
wxMaAppSecret=d8d6dcaef77d3b659258a01b5ddba5df
newLinkReqUrl=https://hcs.czb365.com
newLinkAppKey=318809884537696
newLinkAppSecret=e11a4dab74b71a7b730a06833da4217a
newLinkAppKey=305490138943968
newLinkAppSecret=dbf7dca3de20c2f2a41fd64cfb682be8
cqShellReqUrl=http://api.shenmapay.com/gateway.html
cqShellPartnerId=S0302208021401950202

@ -6,8 +6,8 @@ wxMaAppId=wx8d49e2f83025229d
wxMaAppSecret=d8d6dcaef77d3b659258a01b5ddba5df
newLinkReqUrl=https://hcs.czb365.com
newLinkAppKey=318809884537696
newLinkAppSecret=e11a4dab74b71a7b730a06833da4217a
newLinkAppKey=305490138943968
newLinkAppSecret=dbf7dca3de20c2f2a41fd64cfb682be8
cqShellReqUrl=http://api.shenmapay.com/gateway.html
cqShellPartnerId=S0302208021401950202

Loading…
Cancel
Save