Commit 46f96d11 authored by 胡建龙's avatar 胡建龙

[fix]修改近期明细查询接口查询逻辑

parent 240d64c1
......@@ -10,5 +10,5 @@ import com.hand.hap.mybatis.common.Mapper;
* Time: 9:08
*/
public interface HlsEbankCcbTransactionMapper extends Mapper<HlsEbankCcbTransaction> {
Integer queryByCmbOrderId(String CmbOrderId);
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chinapay.mapper.HlsEbankCcbTransactionMapper">
<select id="queryByCmbOrderId" resultType="java.lang.Integer">
select count(*) from hls_ebank_ccb_transaction hect where hect.cmb_order_id = #{CmbOrderId} limit 1
</select>
</mapper>
\ No newline at end of file
......@@ -38,7 +38,8 @@ public class PingAnController extends BaseController {
@RequestMapping("/bedl/InquiryIntoTheCurrentDetailsOfMainSubaccountAccountTwo")
@ResponseBody
public JSONObject recentDetailQuery(HttpServletRequest request,@RequestBody(required = true) JSONObject reqParams){
return pingAnService.invoke("bedl/InquiryIntoTheCurrentDetailsOfMainSubaccountAccountTwo",reqParams);
IRequest iRequest = createRequestContext(request);
return pingAnService.preInvoke(iRequest,"bedl/InquiryIntoTheCurrentDetailsOfMainSubaccountAccountTwo",reqParams);
}
@ApiModelProperty("明细通知接口(BEDL_ZNA001)")
......
......@@ -11,4 +11,6 @@ public interface PingAnService {
JSONObject invoke(String interfaceName, JSONObject params);
ResponseData detailNotify(IRequest iRequest, JSONObject data);
public JSONObject preInvoke(IRequest iRequest, String interfaceName, JSONObject params);
}
......@@ -44,6 +44,8 @@ public class PingAnServiceImpl implements PingAnService {
private IHapInterfaceHeaderService headerService;
@Autowired
private IHlsEbankCcbTransactionService hlsEbankCcbTransactionService;
@Autowired
private HlsEbankCcbTransactionMapper hlsEbankCcbTransactionMapper;
private Logger logger = LoggerFactory.getLogger(getClass());
......@@ -73,7 +75,26 @@ public class PingAnServiceImpl implements PingAnService {
if (Objects.nonNull(result)) {
// 通信成功
if ("200".equals(result.getCode() + "")) {
// todo 不同接口返回不同数据,需要确认返回结果的格式
JSONObject res = JSONObject.parseObject(result.getData());
switch (interfaceName) {
case "bedl/SubAcctMaintenance" :
hlsWsRequests.setFunctionName("pingAn_SubAcctMaintenance");
responseData.put("data",res);
break;
case "bedl/InquiryIntoTheCurrentDetailsOfMainSubaccountAccountTwo" :
hlsWsRequests.setFunctionName("pingAn_recentDetailQuery");
responseData.put("data",res);
break;
case "bedl/DetailReportQueryNew" :
hlsWsRequests.setFunctionName("pingAn_DetailReportQueryNew");
//返回数组类型数据,所以
JSONArray fileArr = JSONArray.parseArray(result.getData());
responseData.put("data",fileArr);
//进行文件下载
dowloadDetailFile(res);
break;
}
// 具体业务是否请求成功判定,目前观察成功请求可能没有Code值
if ("000000".equals(res.getString("Code")) || Objects.isNull(res.getString("Code"))){
hlsWsRequests.setReturnStatus("s");
......@@ -89,21 +110,6 @@ public class PingAnServiceImpl implements PingAnService {
responseData.put(Constants.RESP_MSG ,res.getJSONArray("Errors").getJSONObject(0).getString("ErrorMessage"));
}
}
// todo 不同接口返回不同数据,需要确认返回结果的格式
switch (interfaceName) {
case "bedl/SubAcctMaintenance" :
hlsWsRequests.setFunctionName("pingAn_SubAcctMaintenance");
responseData.put("data",res);
break;
case "bedl/InquiryIntoTheCurrentDetailsOfMainSubaccountAccountTwo" :
hlsWsRequests.setFunctionName("pingAn_recentDetailQuery");
responseData.put("data",res);
break;
case "bedl/DetailReportQueryNew" :
hlsWsRequests.setFunctionName("pingAn_DetailReportQueryNew");
responseData.put("data",res);
break;
}
} else {
//请求失败
hlsWsRequests.setReturnStatus("f");
......@@ -203,4 +209,59 @@ public class PingAnServiceImpl implements PingAnService {
ccbTransaction.setReturnMsg(data.getString("STT_VCH_PART"));
return hlsEbankCcbTransactionService.insertSelective(iRequest, ccbTransaction);
}
//下载回单文件
private boolean dowloadDetailFile(JSONObject data){
return true;
}
/**
* 近期明细查询
* @param interfaceName
* @param params
* @return
*/
public JSONObject preInvoke(IRequest iRequest, String interfaceName, JSONObject params) {
JSONObject responseData = new JSONObject();
int pageNo = 0;
String isEnd = "N";
while("N".equalsIgnoreCase(isEnd)){
params.put("PageNo",++pageNo);
JSONObject res = invoke(interfaceName, params);
isEnd = res.getString("isEnd");
// 对当前查询到的数据进行存表
JSONObject data = res.getJSONObject("data");
JSONArray arr = data.getJSONArray("list");
if (Objects.nonNull(arr)){
batchSaveTransactionByC00602(iRequest,arr);
}
}
responseData.put(Constants.RESP_CODE, "0000");
responseData.put("respMsg", "请求成功");
return responseData;
}
private void batchSaveTransactionByC00602(IRequest iRequest, JSONArray arr) {
for (int i = 0; i < arr.size(); i++) {
HlsEbankCcbTransaction ccbTransaction = new HlsEbankCcbTransaction();
JSONObject data = arr.getJSONObject(i);
int exist = hlsEbankCcbTransactionMapper.queryByCmbOrderId(data.getString("JournalNo"));
if (exist == 0){
ccbTransaction.setMerId(ApiUtils.AcctNo);
ccbTransaction.setSttVchCardNo(data.getString("SubAccount"));
ccbTransaction.setSttAcDate(data.getString("AccountDate"));
ccbTransaction.setCmbOrderId(data.getString("JournalNo"));
ccbTransaction.setTranType(data.getString("DCFlag"));
ccbTransaction.setAmount(data.getDouble("TranAmount"));
ccbTransaction.setSttVchRcvAcNo(data.getString("OppAccountNo"));
ccbTransaction.setSttVchRcvAcName(data.getString("OppAccountName"));
ccbTransaction.setSttVchRcvBkName(data.getString("OppBankName"));
ccbTransaction.setSttVchRcvBkNo(data.getString("OppBankNo"));
ccbTransaction.setSttVchRemark(data.getString("Remark"));
ccbTransaction.setReturnCode(data.getString("abstractCode"));
ccbTransaction.setReturnMsg(data.getString("abstract"));
hlsEbankCcbTransactionService.insertSelective(iRequest, ccbTransaction);
}
}
}
}
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