Commit a30c86de by jinxin

微信退款接口开发

parent c88a05a6
......@@ -124,5 +124,11 @@ public interface LicenceOrderApiService {
*/
ServiceResponse<Boolean> checkLicenceOrder(Long orderId,Integer flag,String reason,String enterpriseId,String wxEnterpriseId,String creatorName);
/**
* 微信退款
* @return
*/
ServiceResponse<Boolean> wxRefund(Long orderId);
}
package com.gic.haoban.manage.web.config;
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
/**
* Created by tgs on 2020/2/23.
*/
@Configuration
@EnableApolloConfig
public class Config {
@Value("${corpid}")
private String corpid;
@Value("${suiteid}")
private String suiteId;
@Value("${host}")
private String host;
@Value("${wxSuiteid}")
private String wxSuiteid;
/**
* 企业微信许可账号购买信息
*/
@Value("${accountName}")
private String accountName;
@Value("${accountNumber}")
private String accountNumber;
@Value("${bankName}")
private String bankName;
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public String getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
}
public String getBankName() {
return bankName;
}
public void setBankName(String bankName) {
this.bankName = bankName;
}
public String getCorpid() {
return corpid;
}
public void setCorpid(String corpid) {
this.corpid = corpid;
}
public String getSuiteId() {
return suiteId;
}
public void setSuiteId(String suiteId) {
this.suiteId = suiteId;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getWxSuiteid() {
return wxSuiteid;
}
public void setWxSuiteid(String wxSuiteid) {
this.wxSuiteid = wxSuiteid;
}
}
......@@ -19,6 +19,7 @@ import com.gic.haoban.manage.api.dto.licence.LicenceOrderPageDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.licence.LicenceOrderApiService;
import com.gic.haoban.manage.web.config.Config;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.licence.LicenceOrderPageQO;
import com.gic.haoban.manage.web.vo.licence.LicenceOrderPageVO;
......@@ -53,6 +54,8 @@ public class LicenceOrderController {
private EnterpriseService enterpriseService;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService;
@Autowired
private Config config;
/**
* 查询订单详情
......@@ -102,8 +105,11 @@ public class LicenceOrderController {
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String clerkName = loginUser.getClerkName();
Boolean result = licenceOrderApiService.updateLicenceOrderType(orderId, 2, enterpriseId, wxEnterpriseId, clerkName, 1).getResult();
//微信退款 todo
//微信退款
ServiceResponse<Boolean> response = licenceOrderApiService.wxRefund(orderId);
if (!response.isSuccess()){
return RestResponse.failure(response.getCode(),response.getMessage());
}
return RestResponse.successResult(result);
}
......@@ -181,5 +187,20 @@ public class LicenceOrderController {
ServiceResponse<List<String>> orderIdList = licenceOrderApiService.getOrderIdList(param, type, loginUser.getWxEnterpriseId());
return RestResponse.successResult(orderIdList.getResult());
}
/**
* 查询开户信息
*/
@RequestMapping("get-account-info")
public RestResponse<HashMap<String, String>> getAccountInfo() {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
HashMap<String, String> result = new HashMap<>(8);
result.put("accountName",config.getAccountName());
result.put("accountNumber",config.getAccountNumber());
result.put("bankName",config.getBankName());
return RestResponse.successResult(result);
}
}
......@@ -48,5 +48,13 @@ public class LicenceOrderPageQO extends BasePageInfo implements Serializable {
* 订单创建结束时间
*/
private String endTime;
/**
* 支付方式 1在线支付 2对公转账
*/
private Integer payType;
/**
* gic商户Id
*/
private String enterpriseId;
}
......@@ -109,5 +109,18 @@ public class LicenceOrderPageVO implements Serializable {
*/
private String creatorName;
/**
* gic品牌名称
*/
private String enterpriseName;
/**
* 企业微信商户名称
*/
private String wxEnterpriseName;
/**
* 企业微信支付时间
*/
private Date qywxPayTime;
}
......@@ -39,7 +39,7 @@ public class LicenceOrderVO implements Serializable {
*/
private String wxEnterpriseId;
/**
* 微信商户名称
* 企业微信商户名称
*/
private String wxEnterpriseName;
......
......@@ -61,7 +61,7 @@ public interface TabHaobanLicenceOrderMapper {
Integer updateQywxOrderType(@Param("orderId") Long orderId, @Param("type") Integer type);
/**
* 上订单支付凭证
* 上订单支付凭证
*
* @param orderId
* @param voucher
......
......@@ -25,8 +25,12 @@ import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.licence.LicenceOrderProgressService;
import com.gic.haoban.manage.service.service.licence.LicenceOrderService;
import com.gic.haoban.manage.service.util.DingUtils;
import com.gic.thirdparty.api.dto.RefundReqDataDTO;
import com.gic.thirdparty.api.dto.RefundResDataDTO;
import com.gic.thirdparty.api.service.Pay4WXService;
import com.gic.wechat.api.dto.qywx.fee.CreateOrderResponseDTO;
import com.gic.wechat.api.dto.qywx.fee.qdto.CreateOrderQDTO;
import com.gic.wechat.api.dto.qywx.response.QywxResponseDTO;
import com.gic.wechat.api.service.qywx.QywxOrderApiService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -66,6 +70,8 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
private Config config;
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Autowired
private Pay4WXService pay4WXService;
@Override
public ServiceResponse<LicenceOrderDTO> getLicenceOrderDetail(Long orderId,Integer type) {
......@@ -285,6 +291,30 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
@Override
public ServiceResponse<Boolean> checkLicenceOrder(Long orderId, Integer flag, String reason,String enterpriseId,String wxEnterpriseId,String creatorName) {
licenceOrderService.checkLicenceOrder(orderId,flag,reason,enterpriseId,wxEnterpriseId,creatorName);
return null;
return ServiceResponse.success(true);
}
@Override
public ServiceResponse<Boolean> wxRefund(Long orderId) {
TabHaobanLicenceOrder order = licenceOrderService.getLicenceOrderDetail(orderId);
if (null == order ){
return ServiceResponse.failure("-9999","订单id有误!");
}
if (2==order.getPayType()){
return ServiceResponse.success(false);
}
RefundReqDataDTO reqData = new RefundReqDataDTO(order.getWxOrderId(), String.valueOf(orderId), null,String.valueOf(orderId), 1,
1, null,null);
RefundResDataDTO refund = pay4WXService.refund(reqData);
if (refund != null && "FAIL".equals(refund.getReturn_code())){
//微信退款失败
return ServiceResponse.failure(refund.getReturn_code(),refund.getReturn_msg());
}
//更新微信订单状态
licenceOrderService.updateLicenceOrderType(order.getOrderId(), 4,order.getEnterpriseId(),order.getWxEnterpriseId(),"系统",1);
//记录支付时间
licenceOrderService.saveCallBackTime(order.getOrderId(),1,new Date());
return ServiceResponse.success(true);
}
}
......@@ -205,5 +205,6 @@
<dubbo:reference interface="com.gic.member.tag.api.service.MemberTagGroupApiService" id="memberTagGroupApiService" timeout="10000" retries="0"/>
<dubbo:reference interface="com.gic.enterprise.api.service.ScreeningDetailService" id="screeningDetailService" timeout="10000" retries="0"/>
<dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxOrderApiService" id="qywxOrderApiService" timeout="10000" retries="0"/>
<dubbo:reference id="pay4WXService" interface="com.gic.thirdparty.api.service.Pay4WXService" timeout="10000" retries="0" check="false"/>
</beans>
\ No newline at end of file
......@@ -193,7 +193,7 @@
<update id="uploadLicenceOrderVoucher">
UPDATE tab_haoban_licence_order
SET voucher = #{voucher} ,update_time = now(),pay_time = now()
SET voucher = #{voucher} ,update_time = now(),pay_time = now(),order_status=5
WHERE order_id = #{orderId}
and delete_flag = 0
</update>
......
......@@ -45,4 +45,9 @@ public class LicenceOrderServiceTest {
public void test4(){
ServiceResponse<Boolean> result = licenceOrderApiService.payLicenceOrder(512360219787935783L, "ca66a01b79474c40b3e7c7f93daf1a3b");
}
@Test
public void test5(){
ServiceResponse<Boolean> booleanServiceResponse = licenceOrderApiService.wxRefund(513465761444937732L);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment