Commit ab3d984d authored by 5359's avatar 5359

中登网开发

parent e34160ab
...@@ -18,7 +18,7 @@ import java.util.Date; ...@@ -18,7 +18,7 @@ import java.util.Date;
@ExtensionAttribute(disable = true) @ExtensionAttribute(disable = true)
@Table(name = "HLS_WS_REQUESTS") @Table(name = "HLS_WS_REQUESTS")
public class HlsWsRequests extends BaseDTO { public class HlsWsRequests {
@Id @Id
@GeneratedValue @GeneratedValue
......
...@@ -7,6 +7,7 @@ import com.hand.app.zhongDengWang.dto.FndZhongDengLines; ...@@ -7,6 +7,7 @@ import com.hand.app.zhongDengWang.dto.FndZhongDengLines;
import com.hand.app.zhongDengWang.dto.FndZhongDengBatch; import com.hand.app.zhongDengWang.dto.FndZhongDengBatch;
import com.hand.app.zhongDengWang.dto.HlsWsRequests; import com.hand.app.zhongDengWang.dto.HlsWsRequests;
import com.hand.app.zhongDengWang.service.IZdwWsRequestsService; import com.hand.app.zhongDengWang.service.IZdwWsRequestsService;
import com.hand.app.zhongDengWang.mapper.HlsWsRequestsMapper;
import com.hand.app.zhongDengWang.service.IFndZhongDengLinesService; import com.hand.app.zhongDengWang.service.IFndZhongDengLinesService;
import com.hand.app.zhongDengWang.mapper.ZdwLoginTokenInterfaceMapper; import com.hand.app.zhongDengWang.mapper.ZdwLoginTokenInterfaceMapper;
import com.hand.app.zhongDengWang.mapper.FndZhongDengLinesMapper; import com.hand.app.zhongDengWang.mapper.FndZhongDengLinesMapper;
...@@ -44,6 +45,8 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService { ...@@ -44,6 +45,8 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
@Autowired @Autowired
IZdwWsRequestsService zdwWsRequestsService; IZdwWsRequestsService zdwWsRequestsService;
@Autowired @Autowired
HlsWsRequestsMapper hlsWsRequestsMapper;
@Autowired
FndAtmAttachmentMapper fndAtmAttachmentMapper; FndAtmAttachmentMapper fndAtmAttachmentMapper;
@Autowired @Autowired
FndZhongDengBatchMapper fndZhongDengBatchMapper; FndZhongDengBatchMapper fndZhongDengBatchMapper;
...@@ -119,16 +122,16 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService { ...@@ -119,16 +122,16 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
hlsWsRequests.setRequestDate(new Date()); hlsWsRequests.setRequestDate(new Date());
hlsWsRequests.setRequestWsdlUrl(wsdlUrl); hlsWsRequests.setRequestWsdlUrl(wsdlUrl);
hlsWsRequests.setFunctionName("INIT_REGISTER"); hlsWsRequests.setFunctionName("INIT_REGISTER");
hlsWsRequests.setReturnStatus("1");
hlsWsRequests.setRequestClob(requestClob); hlsWsRequests.setRequestClob(requestClob);
hlsWsRequests.setStatusDate(new Date()); hlsWsRequests.setStatusDate(new Date());
hlsWsRequests.setParameterType("XML"); hlsWsRequests.setParameterType("XML");
hlsWsRequests.setPkValue(pkValue); hlsWsRequests.setPkValue(pkValue);
hlsWsRequestsMapper.insertSelective(hlsWsRequests);
return hlsWsRequests; return hlsWsRequests;
} }
public JSONObject registerInit(String registerTypeBz, String platformAuthCode, String loginToken, String xmlFileName, String xmlFileContent) { public JSONObject registerInit(String registerTypeBz, String platformAuthCode, String loginToken, String xmlFileName, String xmlFileContent, Long lineId) {
JSONObject resultJson = new JSONObject(); JSONObject resultJson = new JSONObject();
...@@ -136,6 +139,7 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService { ...@@ -136,6 +139,7 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
String encryLoginToken = ""; String encryLoginToken = "";
String attachmentZipPath = ""; String attachmentZipPath = "";
String encryPlatformAuthCode = ""; String encryPlatformAuthCode = "";
HlsWsRequests hlsWsRequests = new HlsWsRequests();
try { try {
/*SM2算法加密*/ /*SM2算法加密*/
...@@ -143,15 +147,19 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService { ...@@ -143,15 +147,19 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
encryXmlFileContent = SM2Utils.encryptByKeyStr(xmlFileContent, clientKey); encryXmlFileContent = SM2Utils.encryptByKeyStr(xmlFileContent, clientKey);
encryPlatformAuthCode = SM2Utils.encryptByKeyStr(platformAuthCode, clientKey); encryPlatformAuthCode = SM2Utils.encryptByKeyStr(platformAuthCode, clientKey);
WSInitRegisterServiceService service = new WSInitRegisterServiceService(); // WSInitRegisterServiceService service = new WSInitRegisterServiceService();
WSInitRegisterService reg = service.getWSInitRegisterServicePort(); // WSInitRegisterService reg = service.getWSInitRegisterServicePort();
/*插入接口日志表*/ /*插入接口日志表*/
byte[] returns = reg.initRegister(registerTypeBz.getBytes(), encryPlatformAuthCode.getBytes(), encryLoginToken.getBytes(), xmlFileName.getBytes(), encryXmlFileContent.getBytes(), ClientUtils.getAttachmentZip(attachmentZipPath)); // hlsWsRequests = createRequestLog(service.getWSDLDocumentLocation().toString(), xmlFileContent, lineId);
// byte[] returns = "<feedback>\n<registertype>LR</registertype>\n<registerresult>001</registerresult>\n<registernumber>I0000001</registernumber>\n<authorizationcode>A0000001</authorizationcode>\n<errors>\n<error>RegInfoError:100_001</error>\n</errors>\n</feedback>\n".getBytes(); hlsWsRequests = createRequestLog("https://ws.zhongdengwang.org.cn/mfrs_ws_test/services/InitRegisterService?wsdl", xmlFileContent, lineId);
// byte[] returns = reg.initRegister(registerTypeBz.getBytes(), encryPlatformAuthCode.getBytes(), encryLoginToken.getBytes(), xmlFileName.getBytes(), encryXmlFileContent.getBytes(), ClientUtils.getAttachmentZip(attachmentZipPath));
byte[] returns = "<feedback>\n<registertype>LR</registertype>\n<registerresult>001</registerresult>\n<registernumber>I0000001</registernumber>\n<authorizationcode>A0000001</authorizationcode>\n<errors>\n<error>RegInfoError:100_001</error>\n</errors>\n</feedback>\n".getBytes();
resultJson.put("code", "0"); resultJson.put("code", "0");
resultJson.put("info", new String(returns)); resultJson.put("info", new String(returns));
hlsWsRequests.setReturnStatus("S");
hlsWsRequests.setResponseClob(new String(returns));
System.out.println("dddd" + new String(returns)); System.out.println("dddd" + new String(returns));
} catch (Exception e) { } catch (Exception e) {
...@@ -159,8 +167,11 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService { ...@@ -159,8 +167,11 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
e.printStackTrace(); e.printStackTrace();
resultJson.put("code", "-1"); resultJson.put("code", "-1");
resultJson.put("info", e.getMessage()); resultJson.put("info", e.getMessage());
hlsWsRequests.setReturnStatus("E");
hlsWsRequests.setResponsedDate(new Date());
} }
hlsWsRequestsMapper.updateByPrimaryKeySelective(hlsWsRequests);
return resultJson; return resultJson;
} }
...@@ -211,9 +222,8 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService { ...@@ -211,9 +222,8 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
fndZhongDengLines.setLineId(batch.getLineId()); fndZhongDengLines.setLineId(batch.getLineId());
fndZhongDengLines = fndZhongDengLinesMapper.selectByPrimaryKey(fndZhongDengLines); fndZhongDengLines = fndZhongDengLinesMapper.selectByPrimaryKey(fndZhongDengLines);
if (Objects.nonNull(fndZhongDengLines)) { if (Objects.nonNull(fndZhongDengLines) && "UPING".equalsIgnoreCase(fndZhongDengLines.getUpStatus())) {
String xmlFileContent = ""; String xmlFileContent = "";
String encryXmlFileContent = "";
String attachmentZipPath = ""; String attachmentZipPath = "";
try { try {
String registerResult = ""; String registerResult = "";
...@@ -229,28 +239,16 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService { ...@@ -229,28 +239,16 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
/*解析xml文件内容*/ /*解析xml文件内容*/
xmlFileContent = new String(ClientUtils.getxmlFileContent(fndAtmAttachmentDto.getFilePath())); xmlFileContent = new String(ClientUtils.getxmlFileContent(fndAtmAttachmentDto.getFilePath()));
/*SM2算法加密*/
// loginToken = SM2Utils.encryptByKeyStr(loginToken, clientKey);
// encryXmlFileContent = SM2Utils.encryptByKeyStr(xmlFileContent, clientKey);
// platformAuthCode = SM2Utils.encryptByKeyStr(platformAuthCode, clientKey);
// WSInitRegisterServiceService service = new WSInitRegisterServiceService();
// WSInitRegisterService reg = service.getWSInitRegisterServicePort();
/*插入接口日志表*/ /*插入接口日志表*/
HlsWsRequests hlsWsRequests = createRequestLog("https://ws.zhongdengwang.org.cn/mfrs_ws_test/services/InitRegisterService?wsdl", xmlFileContent, batch.getLineId()); if ("INIT".equalsIgnoreCase(fndZhongDengLines.getUpStage())) {
// byte[] returns = reg.initRegister(fndZhongDengLines.getTypebz().getBytes(), platformAuthCode.getBytes(), loginToken.getBytes(), fndAtmAttachmentDto.getFileName().getBytes(), encryXmlFileContent.getBytes(), ClientUtils.getAttachmentZip(attachmentZipPath)); resultJson = registerInit(fndZhongDengLines.getTypebz(), platformAuthCode, loginToken, fndAtmAttachmentDto.getFileName(), xmlFileContent, fndZhongDengLines.getLineId());
// if ("INIT".equalsIgnoreCase(fndZhongDengLines.getUpStage())) { }
//resultJson = registerInit(fndZhongDengLines.getTypebz(), platformAuthCode, loginToken, fndAtmAttachmentDto.getFileName(), xmlFileContent);
// }
String returns = ""; String returns = "";
// if ("0".equalsIgnoreCase(resultJson.getString("code"))) { if ("0".equalsIgnoreCase(resultJson.getString("code"))) {
// returns = resultJson.getString("info"); returns = resultJson.getString("info");
// } else { } else {
// returns = "<feedback>\n<registertype>LR</registertype>\n<registerresult>001</registerresult>\n<registernumber>I0000001</registernumber>\n<authorizationcode>A0000001</authorizationcode>\n<errors>\n<error>\n" + resultJson.getString("info") + "</error>\n</errors>\n</feedback>\n"; returns = "<feedback>\n<registertype>LR</registertype>\n<registerresult>001</registerresult>\n<registernumber>I0000001</registernumber>\n<authorizationcode>A0000001</authorizationcode>\n<errors>\n<error>\n" + resultJson.getString("info") + "</error>\n</errors>\n</feedback>\n";
// } }
returns = "<feedback>\n<registertype>LR</registertype>\n<registerresult>001</registerresult>\n<registernumber>I0000001</registernumber>\n<authorizationcode>A0000001</authorizationcode>\n<errors>\n<error>RegInfoError:100_001</error>\n</errors>\n</feedback>\n";
hlsWsRequests.setResponseClob(returns);
/*解析接口返回结果*/ /*解析接口返回结果*/
returnJson = XML.toJSONObject(returns); returnJson = XML.toJSONObject(returns);
...@@ -264,15 +262,12 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService { ...@@ -264,15 +262,12 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
fndZhongDengLines.setAuthorizationCode(authorizationCode); fndZhongDengLines.setAuthorizationCode(authorizationCode);
fndZhongDengLines.setUpStatus("SUCCESS"); fndZhongDengLines.setUpStatus("SUCCESS");
fndZhongDengLines.setReturnMsg("上报成功"); fndZhongDengLines.setReturnMsg("上报成功");
hlsWsRequests.setReturnStatus("SUCCESS");
/*失败*/ /*失败*/
} else { } else {
error = returnJson.getJSONObject("feedback").getString("errors"); error = returnJson.getJSONObject("feedback").getString("errors");
fndZhongDengLines.setUpStatus("FAIL"); fndZhongDengLines.setUpStatus("FAIL");
fndZhongDengLines.setReturnMsg(error); fndZhongDengLines.setReturnMsg(error);
hlsWsRequests.setReturnStatus("FAIL");
} }
hlsWsRequests.setResponsedDate(new Date());
fndZhongDengLines.setUpDate(new Date()); fndZhongDengLines.setUpDate(new Date());
fndZhongDengLines.set__status(DTOStatus.UPDATE); fndZhongDengLines.set__status(DTOStatus.UPDATE);
......
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