Compare commits
No commits in common. "canteenpay" and "master" have entirely different histories.
canteenpay
...
master
|
|
@ -62,8 +62,6 @@ public class CleaningServicesOrder implements Serializable {
|
|||
private String ordno;
|
||||
|
||||
private Integer tenantId;
|
||||
|
||||
private String tradeId;
|
||||
// /**
|
||||
// * 类型
|
||||
// */
|
||||
|
|
@ -215,13 +213,5 @@ public class CleaningServicesOrder implements Serializable {
|
|||
public void setTenantId(Integer tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public String getTradeId() {
|
||||
return tradeId;
|
||||
}
|
||||
|
||||
public void setTradeId(String tradeId) {
|
||||
this.tradeId = tradeId;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@ public class Customer {
|
|||
@JsonProperty("custId")
|
||||
private String custId;
|
||||
|
||||
@JsonProperty("openid")
|
||||
private String openid;
|
||||
|
||||
@JsonProperty("custThirdId")
|
||||
private String custThirdId;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@ import lombok.Data;
|
|||
@Data
|
||||
public class PayReturnInfo {
|
||||
|
||||
@JsonProperty("tradeId")
|
||||
private String tradeId;
|
||||
|
||||
/** 客户编号 */
|
||||
@JsonProperty("custNum")
|
||||
private String custNum;
|
||||
|
|
@ -74,15 +71,6 @@ public class PayReturnInfo {
|
|||
|
||||
// Getters and Setters
|
||||
|
||||
|
||||
public String getTradeId() {
|
||||
return tradeId;
|
||||
}
|
||||
|
||||
public void setTradeId(String tradeId) {
|
||||
this.tradeId = tradeId;
|
||||
}
|
||||
|
||||
public String getCustNum() {
|
||||
return custNum;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,24 +61,25 @@ public class CleaningServicesOrderServiceImpl extends ServiceImpl<CleaningServic
|
|||
|
||||
@Value("${niu.niupayurl}")
|
||||
private String niupayurl;
|
||||
|
||||
@Value("${niu.niusearchuserurl}")
|
||||
private String niusearchuserurl;
|
||||
|
||||
@Value("${niu.niupayreturnurl}")
|
||||
private String niupayreturnurl;
|
||||
|
||||
@Value("${niu.applicationid}")
|
||||
private String applicationid;
|
||||
|
||||
@Value("${niu.applicationidpsw}")
|
||||
private String applicationidpsw;
|
||||
|
||||
@Value("${niu.sncode}")
|
||||
private String sncode;
|
||||
|
||||
@Value("${niu.serialnum}")
|
||||
private String serialnum;
|
||||
|
||||
@Value("${canteen.searchuserurl}")
|
||||
private String canteenSearchUserUrl;
|
||||
@Value("${canteen.payurl}")
|
||||
private String canteenPayUrl;
|
||||
|
||||
|
||||
@Resource
|
||||
private OtherServiceClient otherServiceClient;
|
||||
|
|
@ -108,16 +109,27 @@ public class CleaningServicesOrderServiceImpl extends ServiceImpl<CleaningServic
|
|||
*/
|
||||
private RestResult payByNiu(GreenUserInfo userInfo, CleaningServicesOrder dto) {
|
||||
//1 先查询人员对应的卡号
|
||||
//应用秘钥
|
||||
String appsecret = applicationidpsw;
|
||||
//传参
|
||||
HashMap<Object, Object> bodyMap = new HashMap<>(2);
|
||||
if (StringUtils.isEmpty(userInfo.getMobile())) {
|
||||
log.info("下单没有配置手机号,无法下单,请联系管理员配置");
|
||||
return new RestResult(Constant.FAILED, "没有配置手机号,无法下单,请联系管理员配置");
|
||||
}
|
||||
// bodyMap.put("mobile", "15996330508");
|
||||
bodyMap.put("mobile", userInfo.getMobile());
|
||||
HttpRequest request = HttpUtil.createPost(canteenSearchUserUrl);
|
||||
log.info("request=" + JSONUtil.toJsonStr(bodyMap));
|
||||
request.body(JSONUtil.toJsonStr(bodyMap), ContentType.JSON.toString());
|
||||
//请求内容字典排序,转换为String
|
||||
String content = JSON.toJSONString(bodyMap, SerializerFeature.MapSortField, SerializerFeature.WriteMapNullValue);
|
||||
log.info("请求内容转换为JSON字符串,字典排序:{}", content);
|
||||
//构造请求验签参数方法
|
||||
|
||||
// Map<String, Object> map = makeSign(content, appsecret, bodyMap);
|
||||
Map<String, Object> map = makeSign(content, applicationidpsw, bodyMap);
|
||||
// HttpRequest request = HttpUtil.createPost(IpConfig.SEARCH_USER);
|
||||
HttpRequest request = HttpUtil.createPost(niusearchuserurl);
|
||||
log.info("request=" + JSONUtil.toJsonStr(map));
|
||||
request.body(JSONUtil.toJsonStr(map), ContentType.JSON.toString());
|
||||
HttpResponse response = request.execute();
|
||||
log.info("response={}", response.body());
|
||||
//转成实体类
|
||||
|
|
@ -131,20 +143,19 @@ public class CleaningServicesOrderServiceImpl extends ServiceImpl<CleaningServic
|
|||
return new RestResult(Constant.FAILED, "没有找到对应餐卡,无法下单,请联系管理员配置");
|
||||
}
|
||||
Customer customer = customerList.get(0);
|
||||
Map<String, Object> payBodyMap = new HashMap<>();
|
||||
Double usePrice = dto.getUsePrice();
|
||||
int convertedPrice = (int) (usePrice * 100);
|
||||
payBodyMap.put("amount", convertedPrice);
|
||||
//传参
|
||||
HashMap<Object, Object> bodyMapForPayContent = new HashMap<>(2);
|
||||
//构建 content
|
||||
intoMapEnity(bodyMapForPayContent, dto, customer);
|
||||
String payContent = JSON.toJSONString(bodyMapForPayContent, SerializerFeature.MapSortField, SerializerFeature.WriteMapNullValue);
|
||||
log.info("content: " + payContent);
|
||||
// Map<String, Object> payBodyMap = makeSign(payContent, appsecret, bodyMapForPayContent);
|
||||
Map<String, Object> payBodyMap = makeSign(payContent, applicationidpsw, bodyMapForPayContent);
|
||||
|
||||
HttpRequest requestForPay = HttpUtil.createPost(canteenPayUrl);
|
||||
// HttpRequest requestForPay = HttpUtil.createPost(IpConfig.PAY_URL_TEST);
|
||||
HttpRequest requestForPay = HttpUtil.createPost(niupayurl);
|
||||
log.info("request=" + JSONUtil.toJsonStr(payBodyMap));
|
||||
requestForPay.body(JSONUtil.toJsonStr(payBodyMap), ContentType.JSON.toString());
|
||||
requestForPay.header("Content-Type", "application/json");
|
||||
requestForPay.header("MERCHANT-ID", "378915229716713472");
|
||||
requestForPay.header("custId", customer.getCustId());
|
||||
requestForPay.header("openid", customer.getOpenid());
|
||||
requestForPay.header("source-type", "7");
|
||||
requestForPay.header("sign", "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkqpPYMDEBTiLgH08AnVYMH1WfHlB5dZC8mRq4aHmvKpGdRgeE11EylhVLsm2N5ryNYI6THgwQpL0jJ9g3lTaq4KzR8LkJlBbyFrnaflB3AtNQugg59f77eMSjHx4cTKbLWtyRfxNR2QK6AjBLkMH2v3GL4dn0aGml9fcN0cL4xLH8g8HJ1DEMGx6cJGQhuE7eQqsUkmmBs7ElbXfOFHWhLFOAgZ98Ieeog5JDnewGMl4yqyytFIPcv2VDlb46MmnZciwXYmZh5W1B9ltmO6LNvJj0itWB1ObTGzKJf9WQDG2Xq38JqFm0TttJAKxYb95ZQGZnmwIDAQAB");
|
||||
HttpResponse responseForPay = requestForPay.execute();
|
||||
log.info("response={}", response.body());
|
||||
log.info("responseForPay={}", responseForPay.body());
|
||||
|
|
@ -154,9 +165,7 @@ public class CleaningServicesOrderServiceImpl extends ServiceImpl<CleaningServic
|
|||
log.error("扣款食堂卡失败,请检查");
|
||||
return new RestResult(Constant.FAILED, "扣款食堂卡无响应,请联系管理员");
|
||||
}
|
||||
if (StringUtils.isNotNull(apiResponseForPay) && apiResponseForPay.getCode() == 200) {
|
||||
String tradeId = apiResponseForPay.getData().getTradeId();
|
||||
dto.setTradeId(tradeId);
|
||||
if (StringUtils.isNotNull(apiResponseForPay) && apiResponseForPay.getCode() == 10000) {
|
||||
int result = dao.insert(dto);
|
||||
if (result == 1) {
|
||||
return new RestResult(Constant.SUCCESS, "扣款成功," + "扣款金额为:" + apiResponseForPay.getData().getRealAmount() + "余额为:" + apiResponseForPay.getData().getWalletBal());
|
||||
|
|
|
|||
|
|
@ -155,10 +155,4 @@ niu:
|
|||
# sncode: 2ad34554g2 #虚拟支付设备
|
||||
# serialnum: 02022840
|
||||
|
||||
canteen:
|
||||
searchuserurl: http://sgwpdm.ah.sgcc.com.cn/canteen/custInfo/queryCustInfoDetailForApp
|
||||
payurl: http://sgwpdm.ah.sgcc.com.cn/canteen/api/v2/mobile/order/stage/pay
|
||||
refundurl: http://sgwpdm.ah.sgcc.com.cn/canteen/api/v2/mobile/order/stage/refund
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -187,10 +187,10 @@
|
|||
insert into cleaning_services_order(service_name, ordno, user_id, name, status, order_time, use_price, price,
|
||||
unit,
|
||||
description, created_by, created_time, updated_time, updated_by, is_deleted,
|
||||
tenant_id, phone, service_id, trade_id)
|
||||
tenant_id, phone, service_id)
|
||||
values (#{serviceName}, #{ordno},#{userId}, #{name},#{status}, #{orderTime}, #{usePrice}, #{price}, #{unit},
|
||||
#{description}, #{createdBy}, #{createdTime}, #{updatedTime}, #{updatedBy}, #{isDeleted}, #{tenantId},
|
||||
#{phone}, #{serviceId}, #{tradeId})
|
||||
#{phone}, #{serviceId})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
|
|
|
|||
Loading…
Reference in New Issue