|
@@ -61,7 +61,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
@Service
|
|
|
@Slf4j
|
|
|
public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> implements ApplyInfoService {
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private ApplyInfoDao applyInfoDao;
|
|
|
@Autowired
|
|
@@ -159,6 +159,52 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public Boolean userRegister(String phone) {
|
|
|
+ try {
|
|
|
+ ApplyInfo applyInfo = applyInfoDao.findUserByPhone(phone,null);
|
|
|
+ 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();
|
|
|
+ xs.autodetectAnnotations(true);
|
|
|
+ xs.ignoreUnknownElements();
|
|
|
+ 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 {
|
|
|
+ applyInfo.setUpdateTime(date);
|
|
|
+ ResponseUserInfo userInfo = parseRegisterInfo(body);
|
|
|
+ applyInfo.setUserId(userInfo.getUserId());
|
|
|
+ applyInfo.setPushStatus(1);
|
|
|
+ applyInfo.setGClass(gClass);
|
|
|
+ RequestMecApplyClass applyClass = getApplyClass(applyInfo);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public RequestMecApplyClass getApplyClass(ApplyInfo applyInfo,Integer orderId) {
|
|
|
// Order order = orderDao.findOrderByStatus(applyInfo.getId(), null);
|
|
|
Order order = orderDao.get(orderId);
|
|
@@ -207,6 +253,50 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+ @Override
|
|
|
+ public RequestMecApplyClass getApplyClass(ApplyInfo applyInfo) {
|
|
|
+ //封装请求参数
|
|
|
+ RequestMecApplyClass applyClass = new RequestMecApplyClass();
|
|
|
+ //<studentId>学员编号</studentId>
|
|
|
+ applyClass.setStudentId(applyInfo.getUserId());
|
|
|
+ //<classId>课程班(乐团)编号</classId>
|
|
|
+ applyClass.setClassId(applyInfo.getClassId());
|
|
|
+ //<subName>学员专业名称</subName>
|
|
|
+ CourseGroupInfo groupInfo = courseGroupInfoDao.get(applyInfo.getCourseId());
|
|
|
+ applyClass.setSubName(groupInfo.getSubName());
|
|
|
+ //<remark>备注</remark>
|
|
|
+ //applyClass.setRemark(order.getRemark());
|
|
|
+ List<Course> courses = new ArrayList<>();
|
|
|
+ Course course = new Course();
|
|
|
+ //<courseId>课程组编号</courseId>
|
|
|
+ course.setCourseId(groupInfo.getId());
|
|
|
+ course.setTuitionFee(new BigDecimal(0));
|
|
|
+ courses.add(course);
|
|
|
+ applyClass.setCourses(courses);
|
|
|
+ //<amount>缴费总金额</amount>
|
|
|
+// applyClass.setAmount(order.getAmount());
|
|
|
+ applyClass.setAmount(new BigDecimal(0));
|
|
|
+ //<tuiFee>学费金额</tuiFee>
|
|
|
+// applyClass.setTuiFee(order.getTuiFee());
|
|
|
+ applyClass.setTuiFee(new BigDecimal(0));
|
|
|
+ //<goodsFee>乐器费用</goodsFee>
|
|
|
+// applyClass.setGoodsFee(order.getGoodsFee());
|
|
|
+ applyClass.setGoodsFee(new BigDecimal(0));
|
|
|
+ //<sdName>杂费名称</sdName>
|
|
|
+ List<Sundry> sundries = new ArrayList<>();
|
|
|
+ Sundry sundry = new Sundry();
|
|
|
+// sundry.setSdFee(order.getSdFee());
|
|
|
+ sundry.setSdFee(new BigDecimal(0));
|
|
|
+// String sdName = order.getSdName();
|
|
|
+// if(StringUtils.isEmpty(sdName)){
|
|
|
+// sdName = order.getRemark();
|
|
|
+// }
|
|
|
+// //<sdFee>杂费金额</sdFee>
|
|
|
+// sundry.setSdName(sdName);
|
|
|
+ sundries.add(sundry);
|
|
|
+ applyClass.setSundries(sundries);
|
|
|
+ return applyClass;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public List<Branch> getBranches() {
|