孙镇亮 5 years ago
parent
commit
c6fbbe5b72

+ 24 - 3
src/main/java/com/ym/mec/collectfee/controller/UserController.java

@@ -53,7 +53,7 @@ public class UserController extends BaseController {
 
         ApplyInfo userByPhone = applyInfoService.findUserByPhone(phone, null);
 
-        if (userByPhone == null && applyInfoService.mecUserIsExist(phone)) {
+        if (userByPhone == null && applyInfoService.mecUserIsExist(phone)!=null) {
             return failed(Constants.PARAM_EXIST_ERROR_MSG);
         }
         if (userByPhone != null && !userByPhone.getClassId().equals(clazzId)) {//如果改用户存在其他团中
@@ -72,6 +72,27 @@ public class UserController extends BaseController {
         }
         return succeed(userByPhone);
     }
+    
+    /**
+     * 查询用户详情
+     *
+     * @param phone
+     * @param clazzId
+     * @return
+     */
+    @GetMapping("/getMecUser")
+    public Object getMecUser(String phone) {
+        if (StringUtils.isEmpty(phone)) {
+            return failed(Constants.PARAM_VERIFY_ERROR_MSG);
+        }
+        
+        MecUserInfo mecUser = applyInfoService.mecUserIsExist(phone);
+        MecUser user = null;
+        if(mecUser != null){
+        	user = applyInfoService.findMecUser(mecUser.getUserId());
+        }
+        return succeed(user);
+    }
 
     /**
      * 用户报名
@@ -221,11 +242,11 @@ public class UserController extends BaseController {
      */
 //    @ApiOperation(value = "开启乐团缴费功能")
     @PostMapping("/openClassPay")
-    public Object openClassPay(Integer id, String smsMsg, int type, int isSingle) {//1是线上 2 线下
+    public Object openClassPay(Integer id, String smsMsg, int type, int isSingle, int amountType) {//1是线上 2 线下 amountType 1-800 2-1500
         if (id == null || (isSingle > 1 || isSingle < 0) || (type == 2 && StringUtils.isEmpty(smsMsg))) {
             return failed(Constants.PARAM_VERIFY_ERROR_MSG);
         }
-        schoolService.openClassPay(id, smsMsg, type, isSingle);
+        schoolService.openClassPay(id, smsMsg, type, isSingle, amountType);
         return succeed();
     }
 

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

@@ -668,4 +668,30 @@ public class YqPayController extends BaseController {
         }
 
     }
+    
+    /**
+     * 续费支付
+     *
+     * @return String
+     * @throws Exception
+     */
+//    @ApiOperation(value = "续费支付", notes = "续费支付")
+    @PostMapping("/promotionPay")
+    public Object promotionPay(@ModelAttribute @Validated Renewals renewals) throws Exception {
+        MecUser mecUser = applyInfoService.findMecUser(renewals.getUserId());
+        if (mecUser == null) {
+            return failed("续费用户不存在");
+        }
+        renewals.setBranchId(mecUser.getBranchId());
+
+        String orderNo = GenerateNum.getInstance().GenerateOrderNo(); //自己系统订单号
+        //获取分佣账户
+        Integer branchId = 1002;//默认分佣账户;
+        Account routingAccount = accountService.getRoutingAccount(branchId, amount);
+
+        Order order = renewalsService.addRenewalsOrder(renewals, amount, orderNo, pickCourses, routingAccount, remark);
+
+        Map rqMap = orderService.getPayMap(routingAccount, order, null); //获取支付map
+        return succeed(rqMap);
+    }
 }

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

@@ -64,9 +64,9 @@ public class YqRegController {
         return "/reg/register";
     }
 
-   // @GetMapping("/pcy")
+   @GetMapping("/pcy")
     public String pcy(ModelMap map) throws Exception {
-        String notifyUrl = "http://47.99.212.176:9000/yqpay/notify"; //主动通知地址
+        String notifyUrl = "https://pay.dayaedu.com/api/yqpay/notify"; //主动通知地址
 
         String seraialNumber = GenerateNum.getInstance().GenerateOrderNo();
 
@@ -83,7 +83,7 @@ public class YqRegController {
 
    // @GetMapping("/webcom")
     public String webcom(ModelMap map) throws Exception {
-        String notifyUrl = "http://47.99.212.176:9000/yqpay/notify"; //主动通知地址
+        String notifyUrl = "https://pay.dayaedu.com/api/yqpay/notify"; //主动通知地址
 
         String seraialNumber = GenerateNum.getInstance().GenerateOrderNo();
 

+ 11 - 0
src/main/java/com/ym/mec/collectfee/entity/School.java

@@ -41,6 +41,8 @@ public class School {
 	
 	/**  */
 	private java.util.Date updateTime;
+	
+	private int amountType;
 
 	public String geteDeposit() {
 		return eDeposit;
@@ -150,4 +152,13 @@ public class School {
 	public void setIsSingle(Integer isSingle) {
 		this.isSingle = isSingle;
 	}
+
+	public int getAmountType() {
+		return amountType;
+	}
+
+	public void setAmountType(int amountType) {
+		this.amountType = amountType;
+	}
+	
 }

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

@@ -1,13 +1,22 @@
 package com.ym.mec.collectfee.service;
 
-import com.ym.mec.collectfee.common.page.PageInfo;
-import com.ym.mec.collectfee.common.service.BaseService;
-import com.ym.mec.collectfee.entity.*;
-
-import javax.servlet.http.HttpSession;
 import java.util.List;
 import java.util.Map;
 
+import javax.servlet.http.HttpSession;
+
+import com.ym.mec.collectfee.common.page.PageInfo;
+import com.ym.mec.collectfee.common.service.BaseService;
+import com.ym.mec.collectfee.entity.ApplyInfo;
+import com.ym.mec.collectfee.entity.ApplyInfoPage;
+import com.ym.mec.collectfee.entity.Branch;
+import com.ym.mec.collectfee.entity.MecCourse;
+import com.ym.mec.collectfee.entity.MecUser;
+import com.ym.mec.collectfee.entity.MecUserInfo;
+import com.ym.mec.collectfee.entity.RenewBean;
+import com.ym.mec.collectfee.entity.RequestMecApplyClass;
+import com.ym.mec.collectfee.entity.StudentsQueryInfo;
+
 public interface ApplyInfoService extends BaseService<Integer, ApplyInfo> {
 
     /**
@@ -72,7 +81,7 @@ public interface ApplyInfoService extends BaseService<Integer, ApplyInfo> {
      * @return
      */
     MecUser findMecUser(Integer userId);
-
+    
     /**
      * 推送续费成功订单到mec
      * @param orderId 订单编号
@@ -92,7 +101,7 @@ public interface ApplyInfoService extends BaseService<Integer, ApplyInfo> {
      * 查询手机号在mec是否存在
      * @param phone
      */
-    boolean mecUserIsExist(String phone);
+    MecUserInfo mecUserIsExist(String phone);
 
     /**
      * 发送短信验证码

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

@@ -12,7 +12,7 @@ public interface SchoolService extends BaseService<Integer, School> {
      * 开启乐团缴费
      * @param classId
      */
-    void openClassPay(Integer classId,String smsMsg,int type,int isSingle);
+    void openClassPay(Integer classId,String smsMsg,int type,int isSingle,int amountType);
 
     /**
      * 缴费成功发送短信

+ 7 - 6
src/main/java/com/ym/mec/collectfee/service/impl/ApplyInfoServiceImpl.java

@@ -502,23 +502,24 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 	}
 
 	@Override
-	public boolean mecUserIsExist(String phone) {
+	public MecUserInfo 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)){
-				return false;
+				return null;
 			}
 			MecUserInfo mecUserInfo = XStreamUtil.xmlToObject("userInfo", MecUserInfo.class, body);
-			if(mecUserInfo == null || StringUtils.isNotEmpty(mecUserInfo.getMobile())){
-				return true;
-			}
+//			if(mecUserInfo == null || StringUtils.isNotEmpty(mecUserInfo.getMobile())){
+//				return true;
+//			}
+			return mecUserInfo;
 		}catch (Exception e){
 			e.printStackTrace();
 		}
-		return false;
+		return null;
 	}
 
 	@Override

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

@@ -75,12 +75,13 @@ public class SchoolServiceImpl extends BaseServiceImpl<Integer, School> implemen
 	}
 
 	@Override
-	public void openClassPay(Integer classId,String smsMsg,int type,int isSingle) {
+	public void openClassPay(Integer classId,String smsMsg,int type,int isSingle, int amountType) {
 		School school = schoolDao.get(classId);
 		if(school != null && school.getStatus() == 1){
 			school.setUpdateTime(new Date());
 			school.setStatus(2);
 			school.setIsSingle(isSingle);
+			school.setAmountType(amountType);//1默认800 2新增值1500
 			schoolDao.update(school);
 			//发送短信
 			//获取所有用户手机号列表

+ 5 - 2
src/main/resources/application.yml

@@ -13,7 +13,10 @@ spring:
 
   datasource:
     name: test
-    url: jdbc:mysql://47.96.80.97:3306/daya_pay?useUnicode=true&characterEncoding=UTF8&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
+  #  url: jdbc:mysql://47.96.80.97:3306/daya_pay?useUnicode=true&characterEncoding=UTF8&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
+  #  username: root
+  #  password: dayayuemeng2019
+    url: jdbc:mysql://localhost:3306/daya_pay?useUnicode=true&characterEncoding=UTF8&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
     username: root
     password: dayayuemeng2019
     # 使用druid数据源
@@ -70,7 +73,7 @@ yq-pay:
 common:
   properties:
     mec-publicKey: 96e021bdc8c20c5afe238bf2ba12c171
-    mec-url: http://101.200.3.78:9001/api/sys
+    mec-url: http://47.94.172.18:9001/api/sys
     key: 96e021bdc8c20c5afe238bf2ba12c171
     keyId: 1490
     sms-appId: EUCP-EMY-SMS1-1AIHP

+ 4 - 0
src/main/resources/config/mybatis/SchoolMapper.xml

@@ -19,6 +19,7 @@
 		<result column="is_single_" property="isSingle" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
+		<result column="amount_type_" property="amountType" />
 	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -76,6 +77,9 @@
 			<if test="isSingle != null">
 				is_single_ = #{isSingle},
 			</if>
+			<if test="amountType != null">
+				amount_type_ = #{amountType}
+			</if>
 		</set>
 		WHERE id_ = #{id}
 	</update>