ソースを参照

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

孙镇亮 5 年 前
コミット
6c473f1a4c

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

@@ -1,9 +1,11 @@
 package com.ym.mec.collectfee.controller;
 
 
-import com.sun.tracing.dtrace.Attributes;
 import com.ym.mec.collectfee.common.web.BaseController;
-import com.ym.mec.collectfee.entity.*;
+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.service.ApplyInfoService;
 import com.ym.mec.collectfee.service.CourseGroupInfoService;
 import com.ym.mec.collectfee.service.OrderService;
@@ -19,7 +21,6 @@ import org.springframework.dao.DuplicateKeyException;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Date;
-import java.util.List;
 
 @RestController()
 @RequestMapping("user")
@@ -50,8 +51,11 @@ public class UserController extends BaseController {
         if(StringUtils.isEmpty(phone) || clazzId == null){
             return failed(Constants.PARAM_VERIFY_ERROR_MSG);
         }
+        if(applyInfoService.mecUserIsExist(phone)){
+            return failed(Constants.PARAM_EXIST_ERROR_MSG);
+        }
         ApplyInfo userByPhone = applyInfoService.findUserByPhone(phone, null);
-        if(userByPhone != null && userByPhone.getClassId()!=clazzId){//如果改用户存在其他团中
+        if(userByPhone != null && !userByPhone.getClassId().equals(clazzId)){//如果改用户存在其他团中
         	return failed(Constants.PARAM_EXIST_ERROR_MSG);
         }
         School school = schoolService.get(clazzId);
@@ -261,4 +265,9 @@ public class UserController extends BaseController {
         }
         return succeed(applyInfoService.findMecUser(userId));
     }
+
+    @PostMapping("/mecUserIsExist")
+    public Object mecUserIsExist(String phone){
+        return succeed(applyInfoService.mecUserIsExist(phone));
+    }
 }

+ 3 - 0
src/main/java/com/ym/mec/collectfee/controller/YqPayController.java

@@ -205,6 +205,9 @@ public class YqPayController extends BaseController {
 
         //课程组价格
         List<MecCourse> courses = applyInfoService.queryUserCourse(renewals.getUserId());//获取续费课程
+        if(courses == null){
+            return failed("您没有要学费的课程");
+        }
         MecCourse mecCourse4json = JSON.parseObject(renewals.getCourses(), MecCourse.class);
         if (mecCourse4json == null) {
             return failed("请选择续费课程");

+ 80 - 0
src/main/java/com/ym/mec/collectfee/entity/MecUserInfo.java

@@ -0,0 +1,80 @@
+package com.ym.mec.collectfee.entity;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ * 根据手机号获取的用户详情
+ */
+@XStreamAlias("userInfo")
+public class MecUserInfo {
+
+    private Integer userId;
+
+    private String userName;
+
+    private String mobile;
+
+    private String wxNum;
+
+    private String realName;
+
+    private String schoolName;
+
+    private Integer active;
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getWxNum() {
+        return wxNum;
+    }
+
+    public void setWxNum(String wxNum) {
+        this.wxNum = wxNum;
+    }
+
+    public String getRealName() {
+        return realName;
+    }
+
+    public void setRealName(String realName) {
+        this.realName = realName;
+    }
+
+    public String getSchoolName() {
+        return schoolName;
+    }
+
+    public void setSchoolName(String schoolName) {
+        this.schoolName = schoolName;
+    }
+
+    public Integer getActive() {
+        return active;
+    }
+
+    public void setActive(Integer active) {
+        this.active = active;
+    }
+}

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

@@ -77,4 +77,10 @@ public interface ApplyInfoService extends BaseService<Integer, ApplyInfo> {
      * @param subId
      */
     void updateUserSub(String userId, Integer subId, Integer courseId);
+
+    /**
+     * 查询手机号在mec是否存在
+     * @param phone
+     */
+    boolean mecUserIsExist(String phone);
 }

+ 19 - 0
src/main/java/com/ym/mec/collectfee/service/impl/ApplyInfoServiceImpl.java

@@ -310,6 +310,25 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 		}
 	}
 
+	@Override
+	public boolean mecUserIsExist(String phone) {
+		try {
+			String body = "<body><uType>1</uType><uName>" + phone +"</uName></body>";
+			body = getBody(body, 120431);
+			body = new String(Base64.getDecoder().decode(body));
+			if(StringUtils.isEmpty(body)){
+				return false;
+			}
+			MecUserInfo mecUserInfo = XStreamUtil.xmlToObject("userInfo", MecUserInfo.class, body);
+			if(mecUserInfo == null || StringUtils.isNotEmpty(mecUserInfo.getMobile())){
+				return true;
+			}
+		}catch (Exception e){
+			e.printStackTrace();
+		}
+		return false;
+	}
+
 
 	private List<MecCourse> getCourses(String body) throws Exception{
 		body = getBody(body,123031);

+ 1 - 1
src/main/java/com/ym/mec/collectfee/service/impl/SchoolServiceImpl.java

@@ -79,7 +79,7 @@ public class SchoolServiceImpl extends BaseServiceImpl<Integer, School> implemen
 			//发送短信
 			//获取所有用户手机号列表
 			List<String> userPhone = applyInfoDao.findUserByClass(classId,null);
-			String[] objects = (String[]) userPhone.toArray();
+			String[] objects=userPhone.toArray(new String[userPhone.size()]);
 			SmsExample.setBatchOnlySms(appId,secretKey,host,algorithm,String.format(Constants.SMS_TEMPLATE, DateUtils.getDayForAfter(new Date(), 2)),null,objects,isGizp,encode);
 		}
 	}

+ 1 - 1
src/main/resources/config/mybatis/RenewalsMapper.xml

@@ -69,6 +69,6 @@
 
 	<!-- 根据order_id获取小课信息 -->
 	<select id="getRenewalsByOrderId" resultMap="Renewals">
-		SELECT * FROM `order` WHERE order_id = #{orderId}
+		SELECT * FROM `renewals` WHERE order_id = #{orderId}
 	</select>
 </mapper>