|
@@ -11,6 +11,7 @@ import com.ym.mec.collectfee.utils.CDesECB;
|
|
|
import com.ym.mec.collectfee.utils.HttpUtil;
|
|
|
import com.ym.mec.collectfee.utils.MapUtil;
|
|
|
import com.ym.mec.collectfee.utils.XStreamUtil;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -22,6 +23,7 @@ import java.io.Writer;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> implements ApplyInfoService {
|
|
|
|
|
|
@Autowired
|
|
@@ -63,6 +65,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
if(applyInfo != null && applyInfo.getStatus() == 1 && applyInfo.getPushStatus() != 1){
|
|
|
//组装请求
|
|
|
applyInfo.setRealName(applyInfo.getName());
|
|
|
+ String gClass = applyInfo.getgClass();
|
|
|
applyInfo.setgClass(applyInfo.getGrade() + applyInfo.getgClass());
|
|
|
applyInfo.setMobile(applyInfo.getPatriarchPhone());
|
|
|
XStream xs = new XStream();
|
|
@@ -71,6 +74,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注册接口
|
|
|
+ log.info("推送到用户数据到mec注册 body: " + body);
|
|
|
body = getBody(body,121301);
|
|
|
Date date = new Date();
|
|
|
try {
|
|
@@ -78,14 +82,17 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
ResponseUserInfo userInfo = parseRegisterInfo(body);
|
|
|
applyInfo.setUserId(userInfo.getUserId());
|
|
|
applyInfo.setPushStatus(1);
|
|
|
+ applyInfo.setGClass(gClass);
|
|
|
RequestMecApplyClass applyClass = getApplyClass(applyInfo,orderId);
|
|
|
body = xs.toXML(applyClass);
|
|
|
body = body.substring(body.indexOf("<body>")+6,body.indexOf("</body>"));
|
|
|
//推送mec用户缴费
|
|
|
+ log.info("推送到用户数据到mec缴费 body: " + body);
|
|
|
getBody(body,125218);
|
|
|
applyInfoDao.update(applyInfo);
|
|
|
return true;
|
|
|
}catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
applyInfo.setPushStatus(2);
|
|
|
applyInfoDao.update(applyInfo);
|
|
|
}
|
|
@@ -109,7 +116,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
//<classId>课程班(乐团)编号</classId>
|
|
|
applyClass.setClassId(applyInfo.getClassId());
|
|
|
//<subName>学员专业名称</subName>
|
|
|
- CourseGroupInfo groupInfo = courseGroupInfoDao.get(applyInfo.getSubId());
|
|
|
+ CourseGroupInfo groupInfo = courseGroupInfoDao.get(applyInfo.getCourseId());
|
|
|
applyClass.setSubName(groupInfo.getSubName());
|
|
|
//<remark>备注</remark>
|
|
|
applyClass.setRemark(order.getRemark());
|
|
@@ -256,6 +263,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
MecUser mecUser = mecUserDao.get(userId);
|
|
|
if(mecUser == null){
|
|
|
String body = "<body><userId>" + userId + "</userId></body>";
|
|
|
+ log.info("获取学员信息mec body: " + body);
|
|
|
body = getBody(body, 121313);
|
|
|
if(!StringUtils.isEmpty(body)){
|
|
|
body = new String(Base64.getDecoder().decode(body));
|
|
@@ -278,6 +286,7 @@ 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>"));
|
|
|
+ log.info("推送续费数据到mec body: " + body);
|
|
|
body = CDesECB.encode(key,body);
|
|
|
RequestParamBean requestParamBean = new RequestParamBean();
|
|
|
requestParamBean.setBody(body);
|
|
@@ -288,6 +297,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
xs.autodetectAnnotations(true);
|
|
|
xs.toXML(requestParamBean,writer);
|
|
|
body = HttpUtil.postXmlData(writer.toString(), url);
|
|
|
+ log.info("mec响应的续费数据 body: " + body);
|
|
|
body = body.substring(body.indexOf("<errCode>") + 9, body.indexOf("</errCode>"));
|
|
|
// body = new String(CDesECB.decode(key,body.getBytes()));
|
|
|
// body = CDesECB.decodeValue(key,body);
|
|
@@ -314,6 +324,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
public boolean mecUserIsExist(String phone) {
|
|
|
try {
|
|
|
String body = "<body><uType>1</uType><uName>" + phone +"</uName></body>";
|
|
|
+ log.info("用户是否存在mec系统 body: " + body);
|
|
|
body = getBody(body, 120431);
|
|
|
body = new String(Base64.getDecoder().decode(body));
|
|
|
if(StringUtils.isEmpty(body)){
|
|
@@ -351,6 +362,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
xs.autodetectAnnotations(true);
|
|
|
xs.toXML(requestParamBean,writer);
|
|
|
body = HttpUtil.postXmlData(writer.toString(), url);
|
|
|
+ log.info("mec响应参数 body: " + body + " ,cmd: " + cmd);
|
|
|
return body.substring(body.indexOf("<body>")+6,body.indexOf("</body>"));
|
|
|
}
|
|
|
|