添加汇付支付
This commit is contained in:
parent
902b2cf2c7
commit
de1c3764fb
|
|
@ -0,0 +1,200 @@
|
|||
package com.chaozhanggui.admin.system.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.common.system.config.RespBody;
|
||||
import com.chaozhanggui.dao.system.dao.TbPlussMerchantBaseInfoMapper;
|
||||
import com.chaozhanggui.dao.system.entity.TbPlussMerchantBaseInfo;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.RestClientException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@RequestMapping("open")
|
||||
@Slf4j
|
||||
public class OpenNessController {
|
||||
|
||||
|
||||
@Autowired
|
||||
RestTemplate restTemplate;
|
||||
|
||||
|
||||
@Autowired
|
||||
TbPlussMerchantBaseInfoMapper tbPlussMerchantBaseInfoMapper;
|
||||
|
||||
|
||||
@Value("${openness.apiurl}")
|
||||
private String apiurl;
|
||||
|
||||
|
||||
|
||||
@RequestMapping("querySumAmount")
|
||||
public RespBody querySumAmount(@RequestHeader("userId") String userId){
|
||||
TbPlussMerchantBaseInfo baseInfo= tbPlussMerchantBaseInfoMapper.selectByUserId(userId);
|
||||
if(ObjectUtil.isEmpty(baseInfo)){
|
||||
return new RespBody("700001","商户信息不存在");
|
||||
}
|
||||
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||
|
||||
JSONObject object=new JSONObject();
|
||||
object.put("merchantCode",baseInfo.getMerchantcode());
|
||||
HttpEntity<String> body = new HttpEntity<String>(object.toString(),headers);
|
||||
|
||||
ResponseEntity<String> response= restTemplate.postForEntity(apiurl.concat("/order/querySumAmount"),body,String.class);
|
||||
log.info("queryOrder:{}",response);
|
||||
if(response.getStatusCodeValue()==200){
|
||||
Map o= JSONObject.parseObject(response.getBody(), Map.class);
|
||||
return new RespBody("000000",o);
|
||||
|
||||
}
|
||||
return new RespBody("000000");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping("queryRecentlyData")
|
||||
public RespBody queryRecentlyData(@RequestHeader("userId") String userId){
|
||||
TbPlussMerchantBaseInfo baseInfo= tbPlussMerchantBaseInfoMapper.selectByUserId(userId);
|
||||
if(ObjectUtil.isEmpty(baseInfo)){
|
||||
return new RespBody("700001","商户信息不存在");
|
||||
}
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||
|
||||
JSONObject object=new JSONObject();
|
||||
object.put("merchantCode",baseInfo.getMerchantcode());
|
||||
HttpEntity<String> body = new HttpEntity<String>(object.toString(),headers);
|
||||
|
||||
ResponseEntity<String> response= restTemplate.postForEntity(apiurl.concat("/order/queryRecentlyData"),body,String.class);
|
||||
log.info("queryRecentlyData:{}",response);
|
||||
if(response.getStatusCodeValue()==200){
|
||||
List o= JSONObject.parseObject(response.getBody(), List.class);
|
||||
return new RespBody("000000",o);
|
||||
|
||||
}
|
||||
return new RespBody("000000");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping("queryRecentYears")
|
||||
public RespBody queryRecentYears(@RequestHeader("userId") String userId){
|
||||
TbPlussMerchantBaseInfo baseInfo= tbPlussMerchantBaseInfoMapper.selectByUserId(userId);
|
||||
if(ObjectUtil.isEmpty(baseInfo)){
|
||||
return new RespBody("700001","商户信息不存在");
|
||||
}
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||
|
||||
JSONObject object=new JSONObject();
|
||||
object.put("merchantCode",baseInfo.getMerchantcode());
|
||||
HttpEntity<String> body = new HttpEntity<String>(object.toString(),headers);
|
||||
|
||||
ResponseEntity<String> response= restTemplate.postForEntity(apiurl.concat("/order/queryRecentYears"),body,String.class);
|
||||
log.info("queryRecentlyData:{}",response);
|
||||
if(response.getStatusCodeValue()==200){
|
||||
List o= JSONObject.parseObject(response.getBody(), List.class);
|
||||
return new RespBody("000000",o);
|
||||
|
||||
}
|
||||
return new RespBody("000000");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping("queryOrder")
|
||||
public RespBody queryOrder(@RequestHeader("userId") String userId,@RequestBody Map<String,Object> map){
|
||||
|
||||
TbPlussMerchantBaseInfo baseInfo= tbPlussMerchantBaseInfoMapper.selectByUserId(userId);
|
||||
if(ObjectUtil.isEmpty(baseInfo)){
|
||||
return new RespBody("700001","商户信息不存在");
|
||||
}
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||
|
||||
JSONObject object=new JSONObject();
|
||||
object.put("merchantCode",baseInfo.getMerchantcode());
|
||||
// for(String key:map.keySet()){
|
||||
// object.put(key,map.get(key));
|
||||
// }
|
||||
HttpEntity<String> body = new HttpEntity<String>(object.toString(),headers);
|
||||
|
||||
ResponseEntity<String> response= restTemplate.postForEntity(apiurl.concat("/order/queryOrder"),body,String.class);
|
||||
log.info("queryOrder:{}",response);
|
||||
if(response.getStatusCodeValue()==200){
|
||||
PageInfo o= JSONObject.parseObject(response.getBody(), PageInfo.class);
|
||||
return new RespBody("000000",o);
|
||||
|
||||
}
|
||||
return new RespBody("000000");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping("queryOrgan")
|
||||
public RespBody queryOrgan(@RequestHeader("userId") String userId,@RequestBody Map<String,Object> map){
|
||||
|
||||
TbPlussMerchantBaseInfo baseInfo= tbPlussMerchantBaseInfoMapper.selectByUserId(userId);
|
||||
if(ObjectUtil.isEmpty(baseInfo)){
|
||||
return new RespBody("700001","商户信息不存在");
|
||||
}
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||
|
||||
JSONObject object=new JSONObject();
|
||||
object.put("merchantCode",baseInfo.getMerchantcode());
|
||||
if(ObjectUtil.isNotEmpty(map)&&map.size()>0){
|
||||
for(String key:map.keySet()){
|
||||
object.put(key,map.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
HttpEntity<String> body = new HttpEntity<String>(object.toString(),headers);
|
||||
|
||||
ResponseEntity<String> response= restTemplate.postForEntity(apiurl.concat("/order/queryOrgan"),body,String.class);
|
||||
log.info("queryOrder:{}",response);
|
||||
if(response.getStatusCodeValue()==200){
|
||||
|
||||
Map o= JSONObject.parseObject(response.getBody(), Map.class);
|
||||
return new RespBody("000000",o);
|
||||
|
||||
}
|
||||
return new RespBody("000000");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.chaozhanggui.admin.system.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.admin.system.model.CreateAgencyReq;
|
||||
import com.chaozhanggui.admin.system.util.MD5Util;
|
||||
import com.chaozhanggui.common.system.util.StringUtil;
|
||||
|
|
@ -14,9 +15,15 @@ import com.github.pagehelper.PageHelper;
|
|||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -53,6 +60,14 @@ public class AgencyService {
|
|||
@Resource
|
||||
private TbPlussIdCardMapper idCardMapper;
|
||||
|
||||
@Autowired
|
||||
RestTemplate restTemplate;
|
||||
|
||||
|
||||
|
||||
@Value("${openness.angenturl}")
|
||||
private String angenturl;
|
||||
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
@ -122,6 +137,8 @@ public class AgencyService {
|
|||
userInfo.setFacecert("0");
|
||||
userInfoMapper.insert(userInfo);
|
||||
|
||||
String inviteCode=getRandomNum();
|
||||
|
||||
TbPlussUserApp userApp=new TbPlussUserApp();
|
||||
userApp.setLoginname(agencyReq.getAngencyCode());
|
||||
userApp.setUsername(agencyReq.getAgencyName());
|
||||
|
|
@ -131,7 +148,7 @@ public class AgencyService {
|
|||
userApp.setCreatedt(new Date());
|
||||
userApp.setStatus(0);
|
||||
userApp.setParentid(userPromotion.getUserId());
|
||||
userApp.setInvitenum(getRandomNum());
|
||||
userApp.setInvitenum(inviteCode);
|
||||
userApp.setToken(agencyReq.getAngencyCode());
|
||||
userApp.setIsfixedrate("0");
|
||||
userApp.setAutoaudit("");
|
||||
|
|
@ -157,6 +174,30 @@ public class AgencyService {
|
|||
newPromotion.setCreateTime(new Date());
|
||||
userPromotionMapper.insert(newPromotion);
|
||||
|
||||
|
||||
if(agencyReq.getUserType().equals("AG")){
|
||||
log.info("正在注册大代理用户");
|
||||
//通知生成代理用户
|
||||
try {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||
|
||||
JSONObject object=new JSONObject();
|
||||
object.put("invite",inviteCode);
|
||||
object.put("mobile",agencyReq.getPhone());
|
||||
object.put("rate",agencyReq.getFee());
|
||||
object.put("sign",MD5Util.md5(agencyReq.getPhone().concat(inviteCode).concat("2580")));
|
||||
HttpEntity<String> body = new HttpEntity<String>(object.toString());
|
||||
log.info("请求生成大代理对应的信息:{}",object.toString());
|
||||
ResponseEntity<String> response= restTemplate.postForEntity(angenturl,body,String.class);
|
||||
log.info("生成对应的大代理信息成功:{}",response.toString());
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return new RespBody("000000");
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class Userservice {
|
|||
|
||||
public RespBody doLogin(String loginName,String password,String userType,String ip) throws Exception {
|
||||
Boolean flag=false;
|
||||
if("FO".equals(userType)||"SO".equals(userType)||"MG".equals(userType)){
|
||||
if("FO".equals(userType)||"SO".equals(userType)||"MG".equals(userType)||"MC".equals(userType)){
|
||||
flag=true;
|
||||
}
|
||||
if(!flag){
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ hf:
|
|||
account:
|
||||
backUrl: http://gw.sxczgkj.cn/admin/notifyCallback/feedCallBack
|
||||
wxLite:
|
||||
appId: wxfc7bd92a462eb191
|
||||
appId: wx0dcea6001b0a8fb4
|
||||
wxPub:
|
||||
appId: wxfc7bd92a462eb191
|
||||
appId: wx0dcea6001b0a8fb4
|
||||
path: http://admintestapi.sxczgkj.cn/wap/api/trans/pay
|
||||
|
|
@ -36,7 +36,7 @@ hf:
|
|||
account:
|
||||
backUrl: http://newadminapi.sxczgkj.cn/admin/notifyCallback/feedCallBack
|
||||
wxLite:
|
||||
appId: wxfc7bd92a462eb191
|
||||
appId: wx0dcea6001b0a8fb4
|
||||
wxPub:
|
||||
appId: wxfc7bd92a462eb191
|
||||
appId: wx0dcea6001b0a8fb4
|
||||
path: https://ky.sxczgkj.cn/wap/api/trans/pay
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
spring:
|
||||
profiles:
|
||||
active: prod
|
||||
active: dev
|
||||
server:
|
||||
port: 18071
|
||||
servlet:
|
||||
|
|
@ -47,5 +47,7 @@ sxf:
|
|||
domain: https://openapi.tianquetech.com
|
||||
orgId: "02668880"
|
||||
publicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjo1+KBcvwDSIo+nMYLeOJ19Ju4ii0xH66ZxFd869EWFWk/EJa3xIA2+4qGf/Ic7m7zi/NHuCnfUtUDmUdP0JfaZiYwn+1Ek7tYAOc1+1GxhzcexSJLyJlR2JLMfEM+rZooW4Ei7q3a8jdTWUNoak/bVPXnLEVLrbIguXABERQ0Ze0X9Fs0y/zkQFg8UjxUN88g2CRfMC6LldHm7UBo+d+WlpOYH7u0OTzoLLiP/04N1cfTgjjtqTBI7qkOGxYs6aBZHG1DJ6WdP+5w+ho91sBTVajsCxAaMoExWQM2ipf/1qGdsWmkZScPflBqg7m0olOD87ymAVP/3Tcbvi34bDfwIDAQAB
|
||||
|
||||
|
||||
openness:
|
||||
angenturl: https://p40312246f.goho.co/proxy/agent/registeragent
|
||||
customerurl:
|
||||
apiurl: https://openformweb.sxczgkj.cn/opennssService
|
||||
|
|
|
|||
|
|
@ -175,6 +175,12 @@
|
|||
<version>1.2.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>1.0.18</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
Loading…
Reference in New Issue