|
@@ -11,13 +11,15 @@ import thyyxxk.wxservice_server.config.auth.PassToken;
|
|
|
import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.wxservice_server.dao.api.PowersiPluginDao;
|
|
|
import thyyxxk.wxservice_server.entity.ResultVo;
|
|
|
-import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.request.CommonRequest;
|
|
|
+import thyyxxk.wxservice_server.entity.medinsmobilepay.InsuinfoRequest;
|
|
|
import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.response.BillInfo;
|
|
|
import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.response.CommonResponse;
|
|
|
import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.response.Upload6201;
|
|
|
import thyyxxk.wxservice_server.factory.thmz.ThmzService;
|
|
|
import thyyxxk.wxservice_server.factory.thmz.model.QueryReceiptRequest;
|
|
|
import thyyxxk.wxservice_server.service.IdCardAnalyzeService;
|
|
|
+import thyyxxk.wxservice_server.utils.ResultVoUtil;
|
|
|
+import thyyxxk.wxservice_server.utils.TokenUtil;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
@@ -35,10 +37,17 @@ public class PowersiMiPayPlugin {
|
|
|
private static final String MZ_API_URL = "http://172.16.30.26:1100/mobilePayApi";
|
|
|
|
|
|
// 移动支付测试环境
|
|
|
- private final static String chnlId = "1I14E7CSC05E4460C80A0000D6788E13";
|
|
|
- private final static String sm4key = "1I14E7CSC05F4460C80A000070CF4673";
|
|
|
- private final static String prvKey = "AOyLayJnHqXC56ENBW2vdfd5aPrncBOA3TK27LkvXHfI";
|
|
|
- private final static String pubKey = "BBVwpoYbrrguE9NEpi0PDKYqJKS5w7lksW1nLtNmVctgrli+B/sKs83tZQBlV3FTvTSaaHbxNidsBjsdisd0XDE=";
|
|
|
+// private final static String chnlId = "1I14E7CSC05E4460C80A0000D6788E13";
|
|
|
+// private final static String sm4key = "1I14E7CSC05F4460C80A000070CF4673";
|
|
|
+// private final static String prvKey = "AOyLayJnHqXC56ENBW2vdfd5aPrncBOA3TK27LkvXHfI";
|
|
|
+// private final static String pubKey = "BBVwpoYbrrguE9NEpi0PDKYqJKS5w7lksW1nLtNmVctgrli+B/sKs83tZQBlV3FTvTSaaHbxNidsBjsdisd0XDE=";
|
|
|
+
|
|
|
+ private final static String chnlId = "FBEBNX3X60526RPYJQ7PZ4CRPNZO8NC9";
|
|
|
+ private final static String sm4key = "SN7YCGQA4R1JJELBZNGKEMV3O4P9KF9F";
|
|
|
+ private final static String prvKey = "ATePKWH4x/ooLSoA5A5rxDrCgCbhFzPG/FvdqF2RkEI=";
|
|
|
+ private final static String pubKey = "BLaISfgVDY1OdD22WBSXO1z/PwHialH1lKxeB1SN7ZkCPEutbMCUpIJnl/009sXoXw7ubAHxfpHyn2aSgXAvkHI=";
|
|
|
+
|
|
|
+
|
|
|
private final DataHandler dataHandler = DataHandler.newInstance(chnlId, sm4key, pubKey, prvKey);
|
|
|
|
|
|
@Autowired
|
|
@@ -49,38 +58,20 @@ public class PowersiMiPayPlugin {
|
|
|
dataHandler.setSkipVerify(true);
|
|
|
}
|
|
|
|
|
|
- @PassToken
|
|
|
- @GetMapping("/test1")
|
|
|
- public String test1() throws Exception {
|
|
|
- CommonRequest request = new CommonRequest();
|
|
|
- request.setIdNo("430821199207226813");
|
|
|
- request.setIdType("01");
|
|
|
- request.setUserName("丁捷");
|
|
|
- request.setOrgCodg("H43010500370");
|
|
|
- String ref = JSONObject.toJSONString(request);
|
|
|
- String req = dataHandler.buildReqData(ref);
|
|
|
- log.info("\n********************************** encrypt-req " +
|
|
|
- "**********************************" +
|
|
|
- "\n\n{}\n\n" +
|
|
|
- "*************************************************************************************", req);
|
|
|
- return req;
|
|
|
- }
|
|
|
-
|
|
|
- @PassToken
|
|
|
- @GetMapping("/test2")
|
|
|
- public CommonResponse test2(@RequestParam("val") String val) {
|
|
|
- CommonResponse response = new CommonResponse(val);
|
|
|
- response.setSuccess(true);
|
|
|
- return response;
|
|
|
- }
|
|
|
-
|
|
|
- @PassToken
|
|
|
- @PostMapping("/test3")
|
|
|
- public CommonResponse test3(@RequestBody JSONObject body) throws Exception {
|
|
|
- JSONObject data = decryptRequest(body);
|
|
|
- CommonResponse response = new CommonResponse(data.toJSONString());
|
|
|
- response.setSuccess(true);
|
|
|
- return response;
|
|
|
+ @PostMapping("/getOpenid")
|
|
|
+ public ResultVo<String> getOpenid(@RequestBody InsuinfoRequest request) throws Exception {
|
|
|
+ String[] hisOrdInfo = request.getHisOrdNum().split("_");
|
|
|
+ if (hisOrdInfo.length == 3) {
|
|
|
+ request.setPatNo(hisOrdInfo[0]);
|
|
|
+ request.setTimes(Integer.parseInt(hisOrdInfo[1]));
|
|
|
+ request.setSocialNo(dao.selectIdNo(hisOrdInfo[0]));
|
|
|
+ ResultVo<String> insuinfo = new RestTemplate().postForObject
|
|
|
+ (MZ_API_URL+"/queryInsuInfo", request, ResultVo.class);
|
|
|
+ if (insuinfo.getCode() != ExceptionEnum.SUCCESS.getCode()) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, insuinfo.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResultVoUtil.success(TokenUtil.getInstance().getUserOpenid());
|
|
|
}
|
|
|
|
|
|
private JSONObject decryptRequest(JSONObject body) throws Exception {
|
|
@@ -115,6 +106,7 @@ public class PowersiMiPayPlugin {
|
|
|
List<String> patNos = dao.selectPatientCount(request.getString("idNo"));
|
|
|
if (patNos.isEmpty()) {
|
|
|
JSONObject res = new JSONObject();
|
|
|
+ res.put("code", -1);
|
|
|
res.put("success", false);
|
|
|
res.put("message", "没有患者的建档信息。");
|
|
|
return res;
|
|
@@ -143,11 +135,15 @@ public class PowersiMiPayPlugin {
|
|
|
}
|
|
|
if (list.isEmpty()) {
|
|
|
JSONObject res = new JSONObject();
|
|
|
+ res.put("code", -1);
|
|
|
res.put("success", false);
|
|
|
res.put("message", "没有患者的待缴费信息。");
|
|
|
return res;
|
|
|
}
|
|
|
- String raw = dataHandler.buildReqData(JSONArray.toJSONString(list));
|
|
|
+ String listRef = JSONArray.toJSONString(list);
|
|
|
+ JSONObject temp = new JSONObject();
|
|
|
+ temp.put("billInfo", JSONArray.parseArray(listRef));
|
|
|
+ String raw = dataHandler.buildReqData(temp);
|
|
|
JSONObject response = JSONObject.parseObject(raw);
|
|
|
response.put("code", 0);
|
|
|
response.put("success", true);
|
|
@@ -164,6 +160,7 @@ public class PowersiMiPayPlugin {
|
|
|
String[] arr = bizId.split("_");
|
|
|
if (arr.length != 3) {
|
|
|
JSONObject res = new JSONObject();
|
|
|
+ res.put("code", -1);
|
|
|
res.put("success", false);
|
|
|
res.put("message", "bizId[" + bizId + "]不正确!");
|
|
|
return res;
|