--- /dev/null
+package com.supwisdom.dlpay.api.bean;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+import java.util.List;
+
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
+public class SourceTypeResponse extends ApiResponse {
+ private String name;
+ private String type;
+ private String value;
+ private List<SourceTypeResponse> sourceTypeList;
+
+}
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(name = "payTransactionProxy", url = "${payapi.url}")
public interface TransactionProxy {
@GetMapping("/api/transaction/inapp/query")
@JwtMethod
- TransactionQueryResponse query(@RequestBody String param);
+ TransactionQueryResponse query(@RequestParam("refno")String refno);
@PostMapping("/api/transaction/inapp/payinit")
@JwtMethod
@RequestMapping(value = "/api/user/biz_query", method = RequestMethod.GET)
@JwtMethod
CardBizResponse bizQuery(@RequestParam("refno") String refno);
+
+ @GetMapping("/api/user/getpaytypeList")
+ @JwtMethod
+ SourceTypeResponse getpaytypeList(@RequestParam("depositeSubjno") String depositeSubjno);
}
@Query("from TSourceType t where t.enable=true and t.checkable=true and t.tenantid=?1 order by t.sourceType ")
List<TSourceType> findNeedChecks(String tenantid);
+
+ List<TSourceType> findTSourceTypesByDepositeSubjno(String depositeSubjno);
}
package com.supwisdom.dlpay.api.service;
+import com.supwisdom.dlpay.api.bean.SourceTypeResponse;
import com.supwisdom.dlpay.api.domain.TSourceType;
import com.supwisdom.dlpay.api.domain.TSourceTypeCheckStatus;
import org.springframework.transaction.annotation.Propagation;
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
TSourceTypeCheckStatus saveOrUpdateSourceTypeCheckStatus(TSourceTypeCheckStatus s);
+ @Transactional(rollbackFor = Exception.class, readOnly = true)
+ SourceTypeResponse findTSourceTypesByDepositeSubjno(String depositeSubjno);
+
}
package com.supwisdom.dlpay.api.service.impl;
+import com.supwisdom.dlpay.api.bean.SourceTypeResponse;
import com.supwisdom.dlpay.api.dao.*;
import com.supwisdom.dlpay.api.domain.*;
import com.supwisdom.dlpay.api.service.SourceTypeService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
}
return sourceTypeCheckDao.save(s);
}
+
+ @Override
+ public SourceTypeResponse findTSourceTypesByDepositeSubjno(String depositeSubjno) {
+ SourceTypeResponse sourceTypeResponseR = new SourceTypeResponse();
+ List<TSourceType> tSourceTypes = sourceTypeDao.findTSourceTypesByDepositeSubjno(depositeSubjno);
+ List<SourceTypeResponse> sourceTypeList = new ArrayList<SourceTypeResponse>();
+ for(TSourceType tSourceType:tSourceTypes){
+ SourceTypeResponse sourceTypeResponse = new SourceTypeResponse();
+ sourceTypeResponse.setName(tSourceType.getPaydesc());
+ sourceTypeResponse.setType(tSourceType.getSourceType());
+ sourceTypeResponse.setValue(tSourceType.getSourceType());
+ sourceTypeList.add(sourceTypeResponse);
+ }
+ sourceTypeResponseR.setSourceTypeList(sourceTypeList);
+ return sourceTypeResponseR;
+ }
}
return agentResponse
}
+ override fun doPayNotify(param: Map<String, String>): AgentResponse<QrcodePayTrans> {
+ val agentResponse = AgentResponse<QrcodePayTrans>()
+ val transaction = consumePayService.getTransactionMainDtl(param["out_trade_no"], null, null)
+ if (transaction == null) {
+ agentResponse.code = AgentCode.REFNO_NOT_EXISTS
+ agentResponse.agentCode = AgentResponse.AGENTCODE_FAIL
+ return agentResponse
+ }
+ if (transaction.status == TradeDict.DTL_STATUS_SUCCESS) {
+ agentResponse.code = AgentCode.SUCCESS
+ agentResponse.agentMsg = "流水已成功,不能重复入账"
+ agentResponse.agentCode = AgentResponse.AGENTCODE_FAIL
+ return agentResponse
+ }
+ val sign = param["sign"]
+ if (StringUtils.isEmpty(sign)) {
+ logger.error("签名错误")
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentCode = AgentResponse.AGENTCODE_FAIL
+ agentResponse.agentMsg = "签名错误"
+ }
+ val temp = StringUtil.paraFilter(param)
+ var signStr = StringUtil.createLinkString(temp)
+ // val config = sourceTypeService.getConsumePaytypeConfig(TradeDict.PAYTYPE_WECHAT, transaction.shopDtl.shopaccno, false, false)
+ val key ="3VVhvjD2F0kHzayrjgLM81qcz39FgAv1"
+ signStr += "&key=$key"
+ val signRet = MD5.encodeByMD5(signStr)
+ logger.error("*******signStr=$signStr")
+ if (!signRet.equals(sign, ignoreCase = true)) {
+ logger.error("签名错误:$signRet,$sign")
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentCode = AgentResponse.AGENTCODE_FAIL
+ agentResponse.agentMsg = "签名错误"
+ }
+ val returnCode = param["return_code"]
+ val resultCode = param["result_code"]
+ if (!returnCode.isNullOrEmpty() && "SUCCESS" == returnCode
+ && !resultCode.isNullOrEmpty() && "SUCCESS" == resultCode) {
+ val transid = param["transaction_id"]
+ if (transid.isNullOrEmpty()) {
+ transactionService.success(transaction.refno)
+ } else {
+ transactionService.success(transaction.refno, transid, true)
+ }
+ agentResponse.code = AgentCode.SUCCESS
+ agentResponse.agentCode = resultCode
+ } else {
+ agentResponse.code = AgentCode.FAIL
+ agentResponse.agentCode = param["err_code"]
+ agentResponse.agentMsg = param["err_code_des"]
+ logger.error { "code=${param["err_code"]},des=${param["err_code_des"]}" }
+ }
+ return agentResponse
+ }
+
}
\ No newline at end of file
}
// 释放资源
inputStream.close()
- val resp = wechatService.doNotify(map)
+ val resp = wechatService.doPayNotify(map)
if (resp.code == AgentCode.SUCCESS) {
wechatPayResponse.agentBody = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>"
} else {
fun dopayInit(transaction: TTransactionMain): AgentResponse<QrcodePayTrans>
fun doPayQuery(transaction: TTransactionMain): AgentResponse<QrcodePayTrans>
+
+ fun doPayNotify(param: Map<String, String>): AgentResponse<QrcodePayTrans>
}
@Component("wechatAgent")
}
}
-@RestController("/api/notify")
+@RestController
+@RequestMapping("/api/notify")
class TransactionNotifyController(@Lazy private val tenantDetailsRegistrar: TenantDetailsRegistrar,
private val transactionServiceProxy: TransactionServiceProxy,
private val agentPayServiceContext: AgentPayServiceContext) {
@Autowired
private lateinit var transactionService: TransactionServiceProxy
+ @Autowired
+ private lateinit var sourceTypeService: SourceTypeService
+
@PostMapping("/open")
fun openAccount(@RequestBody param: OpenUserParam): ResponseEntity<Any> {
}
return ResponseBodyBuilder.successEntity(result)
}
+
+ @GetMapping("/getpaytypeList")
+ fun getpaytypeList(depositeSubjno: String): ResponseEntity<SourceTypeResponse> {
+ val sourceTypeResponse = sourceTypeService.findTSourceTypesByDepositeSubjno(depositeSubjno)
+ if(sourceTypeResponse.sourceTypeList==null||sourceTypeResponse.sourceTypeList.size<1){
+ return ResponseBodyBuilder.failEntity(sourceTypeResponse, TradeErrorCode.BUSINESS_DEAL_ERROR,
+ "未配置支付方式")
+ }
+ return ResponseBodyBuilder.successEntity(sourceTypeResponse)
+ }
}
\ No newline at end of file