|
@@ -7,10 +7,7 @@ import com.ym.mec.collectfee.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.collectfee.dao.*;
|
|
|
import com.ym.mec.collectfee.entity.*;
|
|
|
import com.ym.mec.collectfee.service.ApplyInfoService;
|
|
|
-import com.ym.mec.collectfee.utils.DES;
|
|
|
-import com.ym.mec.collectfee.utils.HttpUtil;
|
|
|
-import com.ym.mec.collectfee.utils.MapUtil;
|
|
|
-import com.ym.mec.collectfee.utils.XStreamUtil;
|
|
|
+import com.ym.mec.collectfee.utils.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -70,7 +67,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
String body = xs.toXML(applyInfo);
|
|
|
body = body.substring(body.indexOf("<user>")+6,body.indexOf("</user>"));
|
|
|
//推送mec注册接口
|
|
|
- body = getBody(body,12301,null,null);
|
|
|
+ body = getBody(body,12301);
|
|
|
Date date = new Date();
|
|
|
try {
|
|
|
applyInfo.setUpdateTime(date);
|
|
@@ -81,7 +78,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
body = xs.toXML(applyClass);
|
|
|
body = body.substring(body.indexOf("<body>")+6,body.indexOf("</body>"));
|
|
|
//推送mec用户缴费
|
|
|
- getBody(body,125218,null,null);
|
|
|
+ getBody(body,125218);
|
|
|
applyInfoDao.update(applyInfo);
|
|
|
return true;
|
|
|
}catch (Exception e){
|
|
@@ -146,7 +143,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
List<Branch> branchList = branchDao.findAll(null);
|
|
|
if(branchList == null || branchList.size() < 1){
|
|
|
String body = "<province>0</province>";
|
|
|
- body = getBody(body,121002,null,null);
|
|
|
+ body = getBody(body,121002);
|
|
|
body = "<body><branches>" + new String(Base64.getDecoder().decode(body)) + "</branches></body>";
|
|
|
ResponseBranchesBean branches = XStreamUtil.xmlToObject("body", ResponseBranchesBean.class, body);
|
|
|
branchDao.batchInsert(branches.getBranches());
|
|
@@ -169,7 +166,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
break;
|
|
|
}
|
|
|
String body = "<branchId>" + branch.getBranchId() + "</branchId>";
|
|
|
- body = getBody(body,121107,null,null);
|
|
|
+ body = getBody(body,121107);
|
|
|
body = "<body><schools>" + new String(Base64.getDecoder().decode(body)) + "</schools></body>";
|
|
|
ResponseSeminariesBean seminaries = XStreamUtil.xmlToObject("body", ResponseSeminariesBean.class, body);
|
|
|
if(seminaries.getSchools() == null || seminaries.getSchools().size() < 1){
|
|
@@ -221,7 +218,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
MecUser mecUser = mecUserDao.get(userId);
|
|
|
if(mecUser == null){
|
|
|
String body = "<body><userId>" + userId + "</userId></body>";
|
|
|
- body = getBody(body, 121313,null,null);
|
|
|
+ body = getBody(body, 121313);
|
|
|
if(!StringUtils.isEmpty(body)){
|
|
|
body = new String(Base64.getDecoder().decode(body));
|
|
|
mecUser = XStreamUtil.xmlToObject("student", MecUser.class, body);
|
|
@@ -264,13 +261,19 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
xs.autodetectAnnotations(true);
|
|
|
String body = xs.toXML(renewBean);
|
|
|
body = body.substring(body.indexOf("<body>")+6,body.indexOf("</body>"));
|
|
|
-// while (body.length()%8 != 0){
|
|
|
-// body = body+"0";
|
|
|
-// }
|
|
|
- byte[] encrypt = DES.encrypt(body.getBytes(), key.getBytes());
|
|
|
- body = getBody(new String(encrypt), 123255, 2,1);
|
|
|
- body = new String(Base64.getDecoder().decode(body),"UTF-8");
|
|
|
- if(StringUtils.isEmpty(body)){
|
|
|
+ body = CDesECB.encode(key,body);
|
|
|
+ RequestParamBean requestParamBean = new RequestParamBean();
|
|
|
+ requestParamBean.setBody(body);
|
|
|
+ requestParamBean.setHead(XStreamUtil.getOrdersHead(body,123255,publicKey,2,4));
|
|
|
+ Writer writer = new StringWriter();
|
|
|
+ writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
|
|
+ xs = new XStream();
|
|
|
+ xs.autodetectAnnotations(true);
|
|
|
+ xs.toXML(requestParamBean,writer);
|
|
|
+ body = HttpUtil.postXmlData(writer.toString(), url);
|
|
|
+ String errCode = body.substring(body.indexOf("<errCode>") + 9, body.indexOf("</errCode>"));
|
|
|
+// body = new String(CDesECB.decode(key,body.getBytes()));
|
|
|
+ if(!StringUtils.equals(errCode,"0")){
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
@@ -282,7 +285,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
|
|
|
|
|
|
private List<MecCourse> getCourses(String body) throws Exception{
|
|
|
- body = getBody(body,123031,null,null);
|
|
|
+ body = getBody(body,123031);
|
|
|
if(StringUtils.isEmpty(body)){
|
|
|
return null;
|
|
|
}
|
|
@@ -291,11 +294,11 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
return parseMecCourse.getCourses();
|
|
|
}
|
|
|
|
|
|
- private String getBody(String body,Integer cmd,Integer uid,Integer encrypt) throws Exception{
|
|
|
+ private String getBody(String body,Integer cmd) throws Exception{
|
|
|
body = Base64.getEncoder().encodeToString(body.getBytes());
|
|
|
RequestParamBean requestParamBean = new RequestParamBean();
|
|
|
requestParamBean.setBody(body);
|
|
|
- requestParamBean.setHead(XStreamUtil.getOrdersHead(body,cmd,publicKey,uid,encrypt));
|
|
|
+ requestParamBean.setHead(XStreamUtil.getOrdersHead(body,cmd,publicKey,null,null));
|
|
|
Writer writer = new StringWriter();
|
|
|
writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
|
|
XStream xs = new XStream();
|
|
@@ -305,6 +308,13 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
return body.substring(body.indexOf("<body>")+6,body.indexOf("</body>"));
|
|
|
}
|
|
|
|
|
|
+ public static void main(String[] args) throws Exception {
|
|
|
+ DES des = new DES();
|
|
|
+// body = des.encryption(body,key);
|
|
|
+ String s = des.decryption("e99a18c428cb38d5f260853678922e03","5qbrivhrKEHws/iz25I6bg==");
|
|
|
+ System.out.println(s);
|
|
|
+ }
|
|
|
+
|
|
|
private ResponseUserInfo parseRegisterInfo(String body){
|
|
|
body = "<body>" + new String(Base64.getDecoder().decode(body)) + "</body>";
|
|
|
ResponseUserInfo userInfo = XStreamUtil.xmlToObject("body", ResponseUserInfo.class, body);
|