Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/collect_fee

周箭河 5 years ago
parent
commit
6451eba24e

+ 21 - 4
src/main/java/com/ym/mec/collectfee/controller/UserController.java

@@ -4,10 +4,7 @@ package com.ym.mec.collectfee.controller;
 import com.ym.mec.collectfee.common.page.PageInfo;
 import com.ym.mec.collectfee.common.page.QueryInfo;
 import com.ym.mec.collectfee.common.web.BaseController;
-import com.ym.mec.collectfee.entity.ApplyInfo;
-import com.ym.mec.collectfee.entity.MusicTeamsPageInfo;
-import com.ym.mec.collectfee.entity.School;
-import com.ym.mec.collectfee.entity.StudentsQueryInfo;
+import com.ym.mec.collectfee.entity.*;
 import com.ym.mec.collectfee.service.ApplyInfoService;
 import com.ym.mec.collectfee.service.CourseGroupInfoService;
 import com.ym.mec.collectfee.service.OrderService;
@@ -178,4 +175,24 @@ public class UserController extends BaseController {
         applyInfoService.update(applyInfo);
         return succeed("修改成功");
     }
+
+    @ApiOperation(value = "学员课程班查询,本接口用于查询指定学员报名的课程班(小课或乐团)列表")
+    @PostMapping("/queryUserCourse")
+    @ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "用户编号", required = true, dataType = "Integer")})
+    public Object queryUserCourse(Integer userId){
+        if(userId == null){
+            return failed("参数校验异常");
+        }
+        return succeed(applyInfoService.queryUserCourse(userId));
+    }
+
+    /**
+     * 推送学生续费成功的订单数据到mec
+     * @return
+     */
+    @PostMapping("/pushRenew")
+    public Object pushRenew(RenewBean renewBean){
+        applyInfoService.pushRenew(renewBean);
+        return succeed();
+    }
 }

+ 8 - 4
src/main/java/com/ym/mec/collectfee/dao/ApplyInfoDao.java

@@ -1,10 +1,7 @@
 package com.ym.mec.collectfee.dao;
 
 import com.ym.mec.collectfee.common.dao.BaseDAO;
-import com.ym.mec.collectfee.entity.ApplyInfo;
-import com.ym.mec.collectfee.entity.ApplyInfoPage;
-import com.ym.mec.collectfee.entity.ResponseUserInfo;
-import com.ym.mec.collectfee.entity.StudentsQueryInfo;
+import com.ym.mec.collectfee.entity.*;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Component;
 
@@ -32,4 +29,11 @@ public interface ApplyInfoDao extends BaseDAO<Integer, ApplyInfo> {
     List<ApplyInfoPage> queryUserPage(Map<String, Object> queryInfo);
 
     int queryUserCount(Map<String, Object> params);
+
+    /**
+     * 根据mec用户信息查询用户信息
+     * @param userId
+     * @return
+     */
+    ApplyInfo findByUserId(Integer userId);
 }

+ 11 - 0
src/main/java/com/ym/mec/collectfee/dao/MecUserDao.java

@@ -0,0 +1,11 @@
+package com.ym.mec.collectfee.dao;
+
+import com.ym.mec.collectfee.common.dao.BaseDAO;
+import com.ym.mec.collectfee.entity.MecUser;
+import org.springframework.stereotype.Component;
+
+@Component
+public interface MecUserDao extends BaseDAO<Integer, MecUser> {
+
+	
+}

+ 226 - 0
src/main/java/com/ym/mec/collectfee/entity/MecCourse.java

@@ -0,0 +1,226 @@
+package com.ym.mec.collectfee.entity;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(mec_course):
+ */
+@XStreamAlias("course")
+public class MecCourse {
+	
+	/**  */
+	private Integer classId;
+
+	/**  */
+	private Integer classType;
+	
+	/**  */
+	private String className;
+	
+	/**  */
+	private Integer classForm;
+	
+	/**  */
+	private Integer courseId;
+	
+	/**  */
+	private String subName;
+	
+	/**  */
+	private Integer studentId;
+	
+	/**  */
+	private String realName;
+	
+	/**  */
+	private Integer chargeType;
+	
+	/**  */
+	private Integer chargeAcct;
+	
+	/**  */
+	private Integer chargeMode;
+	
+	/**  */
+	private java.math.BigDecimal price;
+	
+	/**  */
+	private String planBegin;
+	
+	/**  */
+	private Integer planCycle;
+	
+	/**  */
+	private Integer duration;
+	
+	/**  */
+	private String teaNames;
+	
+	/**  */
+	private java.math.BigDecimal tuBalance;
+	
+	/**  */
+	private java.math.BigDecimal lsBalance;
+	
+	/**  */
+	private Integer buyCount;
+
+	public Integer getClassType() {
+		return classType;
+	}
+
+	public void setClassType(Integer classType) {
+		this.classType = classType;
+	}
+			
+	public void setClassId(Integer classId){
+		this.classId = classId;
+	}
+	
+	public Integer getClassId(){
+		return this.classId;
+	}
+			
+	public void setClassName(String className){
+		this.className = className;
+	}
+	
+	public String getClassName(){
+		return this.className;
+	}
+			
+	public void setClassForm(Integer classForm){
+		this.classForm = classForm;
+	}
+	
+	public Integer getClassForm(){
+		return this.classForm;
+	}
+			
+	public void setCourseId(Integer courseId){
+		this.courseId = courseId;
+	}
+	
+	public Integer getCourseId(){
+		return this.courseId;
+	}
+			
+	public void setSubName(String subName){
+		this.subName = subName;
+	}
+	
+	public String getSubName(){
+		return this.subName;
+	}
+			
+	public void setStudentId(Integer studentId){
+		this.studentId = studentId;
+	}
+	
+	public Integer getStudentId(){
+		return this.studentId;
+	}
+			
+	public void setRealName(String realName){
+		this.realName = realName;
+	}
+	
+	public String getRealName(){
+		return this.realName;
+	}
+			
+	public void setChargeType(Integer chargeType){
+		this.chargeType = chargeType;
+	}
+	
+	public Integer getChargeType(){
+		return this.chargeType;
+	}
+			
+	public void setChargeAcct(Integer chargeAcct){
+		this.chargeAcct = chargeAcct;
+	}
+	
+	public Integer getChargeAcct(){
+		return this.chargeAcct;
+	}
+			
+	public void setChargeMode(Integer chargeMode){
+		this.chargeMode = chargeMode;
+	}
+	
+	public Integer getChargeMode(){
+		return this.chargeMode;
+	}
+			
+	public void setPrice(java.math.BigDecimal price){
+		this.price = price;
+	}
+	
+	public java.math.BigDecimal getPrice(){
+		return this.price;
+	}
+			
+	public void setPlanBegin(String planBegin){
+		this.planBegin = planBegin;
+	}
+	
+	public String getPlanBegin(){
+		return this.planBegin;
+	}
+			
+	public void setPlanCycle(Integer planCycle){
+		this.planCycle = planCycle;
+	}
+	
+	public Integer getPlanCycle(){
+		return this.planCycle;
+	}
+			
+	public void setDuration(Integer duration){
+		this.duration = duration;
+	}
+	
+	public Integer getDuration(){
+		return this.duration;
+	}
+			
+	public void setTeaNames(String teaNames){
+		this.teaNames = teaNames;
+	}
+	
+	public String getTeaNames(){
+		return this.teaNames;
+	}
+			
+	public void setTuBalance(java.math.BigDecimal tuBalance){
+		this.tuBalance = tuBalance;
+	}
+	
+	public java.math.BigDecimal getTuBalance(){
+		return this.tuBalance;
+	}
+			
+	public void setLsBalance(java.math.BigDecimal lsBalance){
+		this.lsBalance = lsBalance;
+	}
+	
+	public java.math.BigDecimal getLsBalance(){
+		return this.lsBalance;
+	}
+			
+	public void setBuyCount(Integer buyCount){
+		this.buyCount = buyCount;
+	}
+	
+	public Integer getBuyCount(){
+		return this.buyCount;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 216 - 0
src/main/java/com/ym/mec/collectfee/entity/MecUser.java

@@ -0,0 +1,216 @@
+package com.ym.mec.collectfee.entity;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(mec_user):
+ */
+@XStreamAlias("student")
+public class MecUser {
+
+	/**  */
+	private Integer userId;
+	
+	/**  */
+	private String userName;
+	
+	/**  */
+	private String mobile;
+	
+	/**  */
+	private Integer branchId;
+	
+	/**  */
+	private Integer city;
+	
+	/**  */
+	private String realName;
+	
+	/**  */
+	private Integer sex;
+	
+	/**  */
+	private Integer ethnic;
+	
+	/**  */
+	private String cardNo;
+	
+	/**  */
+	private String birthDay;
+	
+	/**  */
+	private String company;
+	
+	/**  */
+	@XStreamAlias("class")
+	private String clazz;
+	
+	/**  */
+	private String pName;
+	
+	/**  */
+	private String pCompany;
+	
+	/**  */
+	private java.math.BigDecimal balance;
+	
+	/**  */
+	private Integer active;
+	
+	/**  */
+	private String wxAccount;
+	
+	/**  */
+	private String aliAccount;
+	
+	public void setUserId(Integer userId){
+		this.userId = userId;
+	}
+	
+	public Integer getUserId(){
+		return this.userId;
+	}
+			
+	public void setUserName(String userName){
+		this.userName = userName;
+	}
+	
+	public String getUserName(){
+		return this.userName;
+	}
+			
+	public void setMobile(String mobile){
+		this.mobile = mobile;
+	}
+	
+	public String getMobile(){
+		return this.mobile;
+	}
+			
+	public void setBranchId(Integer branchId){
+		this.branchId = branchId;
+	}
+	
+	public Integer getBranchId(){
+		return this.branchId;
+	}
+			
+	public void setCity(Integer city){
+		this.city = city;
+	}
+	
+	public Integer getCity(){
+		return this.city;
+	}
+			
+	public void setRealName(String realName){
+		this.realName = realName;
+	}
+	
+	public String getRealName(){
+		return this.realName;
+	}
+			
+	public void setSex(Integer sex){
+		this.sex = sex;
+	}
+	
+	public Integer getSex(){
+		return this.sex;
+	}
+			
+	public void setEthnic(Integer ethnic){
+		this.ethnic = ethnic;
+	}
+	
+	public Integer getEthnic(){
+		return this.ethnic;
+	}
+			
+	public void setCardNo(String cardNo){
+		this.cardNo = cardNo;
+	}
+	
+	public String getCardNo(){
+		return this.cardNo;
+	}
+			
+	public void setBirthDay(String birthDay){
+		this.birthDay = birthDay;
+	}
+	
+	public String getBirthDay(){
+		return this.birthDay;
+	}
+			
+	public void setCompany(String company){
+		this.company = company;
+	}
+	
+	public String getCompany(){
+		return this.company;
+	}
+			
+	public void setClazz(String clazz){
+		this.clazz = clazz;
+	}
+	
+	public String getClazz(){
+		return this.clazz;
+	}
+			
+	public void setPName(String pName){
+		this.pName = pName;
+	}
+	
+	public String getPName(){
+		return this.pName;
+	}
+			
+	public void setPCompany(String pCompany){
+		this.pCompany = pCompany;
+	}
+	
+	public String getPCompany(){
+		return this.pCompany;
+	}
+			
+	public void setBalance(java.math.BigDecimal balance){
+		this.balance = balance;
+	}
+	
+	public java.math.BigDecimal getBalance(){
+		return this.balance;
+	}
+			
+	public void setActive(Integer active){
+		this.active = active;
+	}
+	
+	public Integer getActive(){
+		return this.active;
+	}
+			
+	public void setWxAccount(String wxAccount){
+		this.wxAccount = wxAccount;
+	}
+	
+	public String getWxAccount(){
+		return this.wxAccount;
+	}
+			
+	public void setAliAccount(String aliAccount){
+		this.aliAccount = aliAccount;
+	}
+	
+	public String getAliAccount(){
+		return this.aliAccount;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 20 - 0
src/main/java/com/ym/mec/collectfee/entity/ParseMecCourse.java

@@ -0,0 +1,20 @@
+package com.ym.mec.collectfee.entity;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+import java.util.List;
+
+@XStreamAlias("body")
+public class ParseMecCourse {
+
+    @XStreamAlias("courses")
+    private List<MecCourse> courses;
+
+    public List<MecCourse> getCourses() {
+        return courses;
+    }
+
+    public void setCourses(List<MecCourse> courses) {
+        this.courses = courses;
+    }
+}

+ 78 - 0
src/main/java/com/ym/mec/collectfee/entity/RenewBean.java

@@ -0,0 +1,78 @@
+package com.ym.mec.collectfee.entity;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+import java.math.BigDecimal;
+
+@XStreamAlias("body")
+public class RenewBean {
+    private Integer userId;
+
+    private Integer classId;
+
+    private Integer way;
+
+    private BigDecimal pay;
+
+    private Integer chargeMode;
+
+    private BigDecimal buy;
+
+    private String remark;
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public Integer getClassId() {
+        return classId;
+    }
+
+    public void setClassId(Integer classId) {
+        this.classId = classId;
+    }
+
+    public Integer getWay() {
+        return way;
+    }
+
+    public void setWay(Integer way) {
+        this.way = way;
+    }
+
+    public BigDecimal getPay() {
+        return pay;
+    }
+
+    public void setPay(BigDecimal pay) {
+        this.pay = pay;
+    }
+
+    public Integer getChargeMode() {
+        return chargeMode;
+    }
+
+    public void setChargeMode(Integer chargeMode) {
+        this.chargeMode = chargeMode;
+    }
+
+    public BigDecimal getBuy() {
+        return buy;
+    }
+
+    public void setBuy(BigDecimal buy) {
+        this.buy = buy;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+}

+ 1 - 1
src/main/java/com/ym/mec/collectfee/entity/RequestHead.java

@@ -26,7 +26,7 @@ public class RequestHead {
     private String ret = "xml";
 
     //加密类型 0不加密(默认),1DES加密,2专用算法1,3专用算法2,4DES加密(Ansi版, ECB模式,PKCS5)
-    private Integer encrypt = 0;
+    private Integer encrypt = 4;
 
     //签名
     private String sign;

+ 0 - 4
src/main/java/com/ym/mec/collectfee/entity/RequestParamBean.java

@@ -1,11 +1,7 @@
 package com.ym.mec.collectfee.entity;
 
-import com.thoughtworks.xstream.XStream;
 import com.thoughtworks.xstream.annotations.XStreamAlias;
 
-import java.io.StringWriter;
-import java.io.Writer;
-
 @XStreamAlias("request")
 public class RequestParamBean {
 

+ 16 - 0
src/main/java/com/ym/mec/collectfee/service/ApplyInfoService.java

@@ -3,6 +3,7 @@ package com.ym.mec.collectfee.service;
 import com.ym.mec.collectfee.common.service.BaseService;
 import com.ym.mec.collectfee.entity.ApplyInfo;
 import com.ym.mec.collectfee.entity.Branch;
+import com.ym.mec.collectfee.entity.RenewBean;
 import com.ym.mec.collectfee.entity.StudentsQueryInfo;
 
 import java.util.List;
@@ -47,4 +48,19 @@ public interface ApplyInfoService extends BaseService<Integer, ApplyInfo> {
     Object getUserRegisterViewDetail(Integer stuId);
 
     Object queryUserPage(StudentsQueryInfo queryInfo);
+
+    /**
+     *本接口用于查询指定学员报名的课程班(小课或乐团)列表
+     * @param userId
+     * @return
+     */
+    Object queryUserCourse(Integer userId);
+
+    /**
+     * 推送续费成功订单到mec
+     * @param orderId 订单编号
+     * @param chargeMode 收费方式
+     * @return
+     */
+    boolean pushRenew(RenewBean renewBean);
 }

+ 8 - 0
src/main/java/com/ym/mec/collectfee/service/MecUserService.java

@@ -0,0 +1,8 @@
+package com.ym.mec.collectfee.service;
+
+import com.ym.mec.collectfee.common.service.BaseService;
+import com.ym.mec.collectfee.entity.MecUser;
+
+public interface MecUserService extends BaseService<Integer, MecUser> {
+
+}

+ 102 - 22
src/main/java/com/ym/mec/collectfee/service/impl/ApplyInfoServiceImpl.java

@@ -7,6 +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;
@@ -14,6 +15,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+
 import java.io.StringWriter;
 import java.io.Writer;
 import java.util.*;
@@ -24,6 +26,8 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 	@Autowired
 	private ApplyInfoDao applyInfoDao;
 	@Autowired
+	private MecUserDao mecUserDao;
+	@Autowired
 	private OrderDao orderDao;
 	@Autowired
 	private CourseGroupInfoDao courseGroupInfoDao;
@@ -38,6 +42,9 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 	@Value("${common.properties.mec-url}")
 	private String url;
 
+	@Value("${common.properties.key}")
+	private String key;
+
 	@Override
 	public BaseDAO<Integer, ApplyInfo> getDAO() {
 		return applyInfoDao;
@@ -63,7 +70,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);
+				body = getBody(body,12301,null);
 				Date date = new Date();
 				try {
 					applyInfo.setUpdateTime(date);
@@ -74,7 +81,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);
+					getBody(body,125218,null);
 					applyInfoDao.update(applyInfo);
 					return true;
 				}catch (Exception e){
@@ -139,7 +146,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);
+				body = getBody(body,121002,null);
 				body = "<body><branches>" + new String(Base64.getDecoder().decode(body)) + "</branches></body>";
 				ResponseBranchesBean branches = XStreamUtil.xmlToObject("body", ResponseBranchesBean.class, body);
 				branchDao.batchInsert(branches.getBranches());
@@ -152,19 +159,6 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 		return null;
 	}
 
-	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));
-		Writer writer = new StringWriter();
-		writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
-		XStream xs = new XStream();
-		xs.toXML(requestParamBean,writer);
-		body = HttpUtil.postXmlData(writer.toString(), url);
-		return body.substring(body.indexOf("<body>")+6,body.indexOf("</body>"));
-	}
-
 	@Override
 	public void saveSeminary() {
 		try {
@@ -175,7 +169,7 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 					break;
 				}
 				String body = "<branchId>" + branch.getBranchId() + "</branchId>";
-				body = getBody(body,121107);
+				body = getBody(body,121107,null);
 				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){
@@ -197,11 +191,6 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 		}else {
 			vIewDetail.put("isCopperPipe",false);
 		}
-		/*if("圆号,上低音,长号,大号".contains(subName.split("\\.")[1])){
-			vIewDetail.put("isCopperPipe",true);
-		}else {
-			vIewDetail.put("isCopperPipe",false);
-		}*/
 		return vIewDetail;
 	}
 
@@ -225,6 +214,97 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 		return pageInfo;
 	}
 
+	@Override
+	public Object queryUserCourse(Integer userId) {
+		try {
+			//获取学员信息
+			MecUser mecUser = mecUserDao.get(userId);
+			if(mecUser == null){
+				String body = "<body><userId>" + userId + "</userId></body>";
+				body = getBody(body, 121313,null);
+				if(!StringUtils.isEmpty(body)){
+					body = new String(Base64.getDecoder().decode(body));
+					mecUser = XStreamUtil.xmlToObject("student", MecUser.class, body);
+					//同步mec用户数据
+					mecUserDao.insert(mecUser);
+				}
+			}
+			//获取学员课程班数据
+			//1小课,2乐团
+			String body = "<body><userId>" + userId + "</userId><classType>1</classType></body>";
+			List<MecCourse> coursesMin = getCourses(body);
+			body = "<body><userId>" + userId + "</userId><classType>2</classType></body>";
+			List<MecCourse> coursesMax = getCourses(body);
+			if(coursesMin != null && coursesMin.size() > 0){
+				coursesMin.forEach( e -> {
+					e.setClassType(1);
+				} );
+			}else {
+				coursesMin = new ArrayList<>();
+			}
+			if(coursesMax != null && coursesMax.size() > 0){
+				coursesMax.forEach( e -> {
+					e.setClassType(2);
+				} );
+			}else {
+				coursesMax = new ArrayList<>();
+			}
+			coursesMin.addAll(coursesMax);
+			return coursesMin;
+		}catch (Exception e){
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	@Override
+	public boolean pushRenew(RenewBean renewBean) {
+		try {
+			XStream xs = new XStream();
+			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);
+			body = new String(Base64.getDecoder().decode(body),"UTF-8");
+			if(StringUtils.isEmpty(body)){
+				return false;
+			}
+			return true;
+		}catch (Exception e){
+			e.printStackTrace();
+		}
+		return false;
+	}
+
+
+	private List<MecCourse> getCourses(String body) throws Exception{
+		body = getBody(body,123031,null);
+		if(StringUtils.isEmpty(body)){
+			return null;
+		}
+		body = "<body><courses>" + new String(Base64.getDecoder().decode(body)) + "</courses></body>";
+		ParseMecCourse parseMecCourse = XStreamUtil.xmlToObject("body", ParseMecCourse.class, body);
+		return parseMecCourse.getCourses();
+	}
+
+	private String getBody(String body,Integer cmd,Integer uid) throws Exception{
+		body = Base64.getEncoder().encodeToString(body.getBytes());
+		RequestParamBean requestParamBean = new RequestParamBean();
+		requestParamBean.setBody(body);
+		requestParamBean.setHead(XStreamUtil.getOrdersHead(body,cmd,publicKey,uid));
+		Writer writer = new StringWriter();
+		writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
+		XStream xs = new XStream();
+		xs.autodetectAnnotations(true);
+		xs.toXML(requestParamBean,writer);
+		body = HttpUtil.postXmlData(writer.toString(), url);
+		return body.substring(body.indexOf("<body>")+6,body.indexOf("</body>"));
+	}
+
 	private ResponseUserInfo parseRegisterInfo(String body){
 		body = "<body>" + new String(Base64.getDecoder().decode(body)) + "</body>";
 		ResponseUserInfo userInfo = XStreamUtil.xmlToObject("body", ResponseUserInfo.class, body);

+ 22 - 0
src/main/java/com/ym/mec/collectfee/service/impl/MecUserServiceImpl.java

@@ -0,0 +1,22 @@
+package com.ym.mec.collectfee.service.impl;
+
+import com.ym.mec.collectfee.common.dao.BaseDAO;
+import com.ym.mec.collectfee.common.service.impl.BaseServiceImpl;
+import com.ym.mec.collectfee.dao.MecUserDao;
+import com.ym.mec.collectfee.entity.MecUser;
+import com.ym.mec.collectfee.service.MecUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class MecUserServiceImpl extends BaseServiceImpl<Integer, MecUser> implements MecUserService {
+	
+	@Autowired
+	private MecUserDao mecUserDao;
+
+	@Override
+	public BaseDAO<Integer, MecUser> getDAO() {
+		return mecUserDao;
+	}
+	
+}

+ 2 - 2
src/main/java/com/ym/mec/collectfee/service/impl/OrderServiceImpl.java

@@ -65,7 +65,7 @@ public class OrderServiceImpl extends BaseServiceImpl<Integer, Order> implements
 
 			body = Base64.getEncoder().encodeToString(body.getBytes());
 			requestParamBean.setBody(body);
-			requestParamBean.setHead(XStreamUtil.getOrdersHead(body,121512,publicKey));
+			requestParamBean.setHead(XStreamUtil.getOrdersHead(body,121512,publicKey,null));
 
 			xs.autodetectAnnotations(true);
 			writer = new StringWriter();
@@ -97,7 +97,7 @@ public class OrderServiceImpl extends BaseServiceImpl<Integer, Order> implements
 			String body = "<classId>" + clazzId + "</classId><schoolId>" + schoolId + "</schoolId>";
 			body = Base64.getEncoder().encodeToString(body.getBytes());
 			requestParamBean.setBody(body);
-			requestParamBean.setHead(XStreamUtil.getOrdersHead(body,124005,publicKey));
+			requestParamBean.setHead(XStreamUtil.getOrdersHead(body,124005,publicKey,null));
 			XStream xs = new XStream();
 			xs.autodetectAnnotations(true);
 			Writer writer = new StringWriter();

+ 54 - 0
src/main/java/com/ym/mec/collectfee/utils/DES.java

@@ -0,0 +1,54 @@
+package com.ym.mec.collectfee.utils;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.DESKeySpec;
+import java.security.Key;
+import java.security.SecureRandom;
+import java.security.spec.KeySpec;
+
+public class DES {
+    //加密算是是des
+    private static final String ALGORITHM = "DES";
+    //转换格式
+    private static final String TRANSFORMATION = "DES/ECB/PKCS5Padding";
+
+    //利用8个字节64位的key给src加密
+    @SuppressWarnings("unused")
+    public static byte[] encrypt(byte[] src,byte[]key)
+    {
+        try {
+            //加密
+            Cipher cipher = Cipher.getInstance(TRANSFORMATION);
+            SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance(ALGORITHM);
+            KeySpec keySpec = new DESKeySpec(key);
+            SecretKey secretKey = secretKeyFactory.generateSecret(keySpec);
+            cipher.init(Cipher.ENCRYPT_MODE, secretKey,new SecureRandom());
+            byte[] enMsgBytes = cipher.doFinal(src);
+            return enMsgBytes;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    //利用8个字节64位的key给src解密
+    @SuppressWarnings("unused")
+    public static byte[] decrypt(byte[] encryptBytes,byte[]key){
+        try {
+            //解密
+            //Cipher deCipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
+            Cipher deCipher = Cipher.getInstance(TRANSFORMATION);
+            SecretKeyFactory deDecretKeyFactory = SecretKeyFactory.getInstance(ALGORITHM);
+            KeySpec deKeySpec = new DESKeySpec(key);
+            SecretKey deSecretKey = deDecretKeyFactory.generateSecret(deKeySpec);
+            deCipher.init(Cipher.DECRYPT_MODE, deSecretKey,new SecureRandom());
+            byte[] deMsgBytes = deCipher.doFinal(encryptBytes);
+            return deMsgBytes;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+}

+ 4 - 1
src/main/java/com/ym/mec/collectfee/utils/XStreamUtil.java

@@ -16,10 +16,13 @@ public final class XStreamUtil {
 
 	}
 
-	public static RequestHead getOrdersHead(String body,Integer cmd,String publicKey){
+	public static RequestHead getOrdersHead(String body,Integer cmd,String publicKey,Integer uid){
 		RequestHead head = new RequestHead();
 		head.setMsgId(getRandom(7));
 		head.setCmd(cmd);
+		if(uid != null){
+			head.setUid(uid);
+		}
 		head.setSign(XStreamUtil.getSign(head, body, publicKey));
 		return head;
 	}

+ 1 - 0
src/main/resources/application.yml

@@ -64,4 +64,5 @@ common:
   properties:
     mec-publicKey: e99a18c428cb38d5f260853678922e03
     mec-url: http://101.200.2.249:9001/api/sys
+    key: e99a18c428cb38d5f260853678922e03
 

+ 5 - 1
src/main/resources/config/mybatis/ApplyInfoMapper.xml

@@ -71,7 +71,7 @@
 		INSERT INTO apply_info (course_id_,class_id_,user_id_,branch_id_,name_,sex_,birthday_,city_,school_,grade_,g_class_,sub_id_,is_adjust_,patriarch_phone_,patriarch_name_,patriarch_unit_,update_time_,create_time_) VALUES
 		(#{courseId},#{classId},#{userId},#{branchId},#{name},#{sex},#{birthday},#{city},#{school},#{grade},#{gClass},#{subId},#{isAdjust},#{patriarchPhone},#{patriarchName},#{patriarchUnit},#{updateTime},#{createTime})
 	</insert>
-	
+
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.collectfee.entity.ApplyInfo">
 		UPDATE apply_info
@@ -193,4 +193,8 @@
 		LEFT JOIN `order` o ON ai.id_ = o.user_id
 		<include refid="studentsPage"/>
 	</select>
+
+	<select id="findByUserId" resultMap="ApplyInfo">
+		SELECT * FROM apply_info WHERE user_id_ = #{userId}
+	</select>
 </mapper>

+ 115 - 0
src/main/resources/config/mybatis/MecUserMapper.xml

@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--
+这个文件是自动生成的。
+不要修改此文件。所有改动将在下次重新自动生成时丢失。
+-->
+<mapper namespace="com.ym.mec.collectfee.dao.MecUserDao">
+	
+	<resultMap type="com.ym.mec.collectfee.entity.MecUser" id="MecUser">
+		<result column="user_id_" property="userId" />
+		<result column="user_name_" property="userName" />
+		<result column="mobile_" property="mobile" />
+		<result column="branch_id_" property="branchId" />
+		<result column="city_" property="city" />
+		<result column="real_name_" property="realName" />
+		<result column="sex_" property="sex" />
+		<result column="ethnic_" property="ethnic" />
+		<result column="card_no_" property="cardNo" />
+		<result column="birth_day_" property="birthDay" />
+		<result column="company_" property="company" />
+		<result column="clazz_" property="clazz" />
+		<result column="p_name_" property="pName" />
+		<result column="p_company_" property="pCompany" />
+		<result column="balance_" property="balance" />
+		<result column="active_" property="active" />
+		<result column="wx_account_" property="wxAccount" />
+		<result column="ali_account_" property="aliAccount" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="MecUser" >
+		SELECT * FROM mec_user WHERE user_id_ = #{userId} 
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="MecUser">
+		SELECT * FROM mec_user ORDER BY user_id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.collectfee.entity.MecUser" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO mec_user (user_id_,user_name_,mobile_,branch_id_,city_,real_name_,sex_,ethnic_,card_no_,birth_day_,company_,clazz_,p_name_,p_company_,balance_,active_,wx_account_,ali_account_) VALUES(#{userId},#{userName},#{mobile},#{branchId},#{city},#{realName},#{sex},#{ethnic},#{cardNo},#{birthDay},#{company},#{clazz},#{pName},#{pCompany},#{balance},#{active},#{wxAccount},#{aliAccount})
+	</insert>
+	
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.collectfee.entity.MecUser">
+		UPDATE mec_user
+		<set>
+			<if test="company != null and company != ''">
+				company_ = #{company},
+			</if>
+			<if test="userName != null and userName != ''">
+				user_name_ = #{userName},
+			</if>
+			<if test="ethnic != null">
+				ethnic_ = #{ethnic},
+			</if>
+			<if test="cardNo != null">
+				card_no_ = #{cardNo},
+			</if>
+			<if test="clazz != null">
+				clazz_ = #{clazz},
+			</if>
+			<if test="birthDay != null">
+				birth_day_ = #{birthDay},
+			</if>
+			<if test="branchId != null">
+				branch_id_ = #{branchId},
+			</if>
+			<if test="sex != null">
+				sex_ = #{sex},
+			</if>
+			<if test="realName != null">
+				real_name_ = #{realName},
+			</if>
+			<if test="wxAccount != null">
+				wx_account_ = #{wxAccount},
+			</if>
+			<if test="city != null">
+				city_ = #{city},
+			</if>
+			<if test="pCompany != null">
+				p_company_ = #{pCompany},
+			</if>
+			<if test="pName != null">
+				p_name_ = #{pName},
+			</if>
+			<if test="active != null">
+				active_ = #{active},
+			</if>
+			<if test="mobile != null">
+				mobile_ = #{mobile},
+			</if>
+			<if test="aliAccount != null">
+				ali_account_ = #{aliAccount},
+			</if>
+		</set>
+		WHERE user_id_ = #{userId}
+	</update>
+	
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM mec_user WHERE user_id_ = #{userId} 
+	</delete>
+	
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="MecUser" parameterType="map">
+		SELECT * FROM mec_user ORDER BY user_id_ <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="findCount" resultType="int">
+		SELECT COUNT(*) FROM mec_user
+	</select>
+</mapper>