Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

Joburgess 5 лет назад
Родитель
Сommit
b4f94a7234

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/PaymentChannelTypeEnum.java

@@ -3,7 +3,7 @@ package com.ym.mec.biz.dal.enums;
 import com.ym.mec.common.enums.BaseEnum;
 
 public enum PaymentChannelTypeEnum implements BaseEnum<String, PaymentChannelTypeEnum> {
-	PER("PER", "个人"), COM("com", "公司");
+	PER("PER", "个人"), COM("COM", "公司");
 
 	private String code;
 

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderService.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 import com.huifu.adapay.model.payment.PayChannelEnum;
 import com.ym.mec.biz.dal.entity.Goods;
@@ -65,4 +66,6 @@ public interface StudentPaymentOrderService extends BaseService<Long, StudentPay
 
 	void queryOrderStatus() throws Exception;
 
+	void updateOrder(Map<String, String> rpMap) throws Exception;
+
 }

+ 21 - 30
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -24,6 +24,7 @@ import com.ym.mec.util.http.HttpUtil;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
@@ -319,7 +320,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         studentPaymentOrder.setVersion(0);
 
         Date date = new Date();
-        
+
         if(registerPayDto.getIsUseBalancePayment() || amount.doubleValue() == 0){
         	SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(userId);
         	if(userCashAccount == null){
@@ -328,25 +329,19 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         	if(userCashAccount.getBalance().subtract(amount).doubleValue() > 0){
         		// 更新订单信息
         		studentPaymentOrder.setBalancePaymentAmount(amount);
-                studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
                 studentPaymentOrder.setUpdateTime(date);
                 studentPaymentOrderService.update(studentPaymentOrder);
                 studentPaymentOrder.setVersion(studentPaymentOrder.getVersion()+1);
-                
-        		sysUserCashAccountService.updateBalance(userId, amount.negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"乐团续费");
-        		
-        		//更新下次续费时间
-        		/*musicGroupStudentFee.setUpdateTime(date);
-                musicGroupStudentFee.setLatestPaidTime(date);
-                musicGroupStudentFee.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
-                musicGroupStudentFee.setTemporaryCourseFee(new BigDecimal(0));
-                musicGroupStudentFee.setNextPaymentDate(musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId));
-                musicGroupStudentFeeDao.update(musicGroupStudentFee);*/
 
-                Map<String,Object> result=new HashMap<>();
-                result.put("orderNo",studentPaymentOrder.getOrderNo());
+        		sysUserCashAccountService.updateBalance(userId, amount.negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"乐团续费");
 
-                return result;
+                Map<String,String> notifyMap=new HashMap<>();
+                notifyMap.put("tradeState", "1");
+                notifyMap.put("merOrderNo", studentPaymentOrder.getOrderNo());
+                notifyMap.put("channelType", channelType);
+                notifyMap.put("orderNo", "");
+                studentPaymentOrderService.updateOrder(notifyMap);
+                return notifyMap;
         	}else{
 				if (userCashAccount.getBalance().doubleValue() > 0) {
 					sysUserCashAccountService.updateBalance(userId, userCashAccount.getBalance().negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐团续费");
@@ -357,10 +352,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 				}
         	}
         }
-        
+
 
         Map payMap = payService.getPayMap(
-                orderAmount,
+                amount,
                 orderNo,
                 "http://mstutest.dayaedu.com/api-student/studentOrder/notify",
                 "http://mstutest.dayaedu.com/#/paymentresult?orderNo=" + orderNo,
@@ -474,22 +469,18 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         	if(userCashAccount.getBalance().subtract(amount).doubleValue() > 0){
         		// 更新订单信息
         		studentPaymentOrder.setBalancePaymentAmount(amount);
-                studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
                 studentPaymentOrder.setUpdateTime(date);
                 studentPaymentOrderService.update(studentPaymentOrder);
                 
         		sysUserCashAccountService.updateBalance(userId, amount.negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"乐团续费");
-        		
-        		//更新下次续费时间
-        		/*musicGroupStudentFee.setUpdateTime(date);
-                musicGroupStudentFee.setLatestPaidTime(date);
-                musicGroupStudentFee.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
-                musicGroupStudentFee.setTemporaryCourseFee(new BigDecimal(0));
-                musicGroupStudentFee.setNextPaymentDate(musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId));
-                musicGroupStudentFeeDao.update(musicGroupStudentFee);*/
-                Map<String,Object> result=new HashMap<>();
-                result.put("orderNo",studentPaymentOrder.getOrderNo());
-        		return result;
+
+                Map<String,String> notifyMap=new HashMap<>();
+                notifyMap.put("tradeState", "1");
+                notifyMap.put("merOrderNo", studentPaymentOrder.getOrderNo());
+                notifyMap.put("channelType", channelType);
+                notifyMap.put("orderNo", "");
+                studentPaymentOrderService.updateOrder(notifyMap);
+                return notifyMap;
         	}else{
 				if (userCashAccount.getBalance().doubleValue() > 0) {
 					sysUserCashAccountService.updateBalance(userId, userCashAccount.getBalance().negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐团续费");
@@ -502,7 +493,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
 
         Map payMap = payService.getPayMap(
-                orderAmount,
+                amount,
                 orderNo,
                 "http://mstutest.dayaedu.com/api-student/studentOrder/notify",
                 "http://mstutest.dayaedu.com/#/paymentresult?orderNo=" + orderNo,

+ 12 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java

@@ -5,6 +5,7 @@ import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.entity.CooperationOrgan;
 import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.SysAccount;
+import com.ym.mec.biz.dal.enums.PaymentChannelTypeEnum;
 import com.ym.mec.biz.service.PayService;
 import com.ym.mec.biz.service.StudentPaymentOrderService;
 import com.ym.mec.biz.service.SysAccountService;
@@ -61,11 +62,15 @@ public class PayServiceImpl implements PayService {
 
         //支付通道决策
         Map unionPay = new HashMap();
-        SysAccount routingAccount = getRoutingAccount(company,amount);
+        SysAccount routingAccount = getRoutingAccount(company, amount);
+        PaymentChannelTypeEnum paymentChannelType = PaymentChannelTypeEnum.COM;
+        if(routingAccount.getType().equals("PER")){
+            paymentChannelType = PaymentChannelTypeEnum.PER;
+        }
         Map payMap = null;
         String type = null;
         if (routingAccount.getChannel().equals("YQPAY")) {
-            payMap = YqPayUtil.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody,routingAccount.getMerNo(), routingAccount.getRoutingMerNo());
+            payMap = YqPayUtil.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, routingAccount.getMerNo(), routingAccount.getRoutingMerNo());
             type = "YQPAY";
         } else {
             payMap = new Pay().getPayMap(amount, orderNo, notifyUrl, orderSubject, orderBody);
@@ -74,6 +79,7 @@ public class PayServiceImpl implements PayService {
 
         unionPay.put("orderNo", orderNo);
         unionPay.put("type", type);
+        unionPay.put("paymentChannelType", paymentChannelType);
         unionPay.put("payMap", payMap);
         return unionPay;
     }
@@ -85,6 +91,7 @@ public class PayServiceImpl implements PayService {
 
     /**
      * 获取收款账户
+     *
      * @param company
      * @param money
      * @return
@@ -105,6 +112,9 @@ public class PayServiceImpl implements PayService {
             channel = sysConfigDao.findConfigValue("com_account_channel");
             type = "COM";
         }
+        if (company.equals("yadie")) {
+            type = "PER";
+        }
         routingAccount = sysAccountService.getAccount(company, channel, type, null);
 
         return routingAccount;

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -164,7 +164,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         closeOrders(orderNoList);
     }
 
-    private void updateOrder(Map<String, String> rpMap) throws Exception {
+    public void updateOrder(Map<String, String> rpMap) throws Exception {
         DealStatusEnum status = rpMap.get("tradeState").equals("1") ? DealStatusEnum.SUCCESS : DealStatusEnum.FAILED;
         StudentPaymentOrder order = findOrderByOrderNo(rpMap.get("merOrderNo"));
         if (order == null || !order.getStatus().equals(DealStatusEnum.ING)) {

+ 5 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -507,6 +507,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     @Transactional(rollbackFor = Exception.class)
     public StudentRegistration queryByUserIdAndMusicGroupId(Integer userId, String musicGroupId) {
         StudentRegistration registration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
+        if(registration == null){
+            return null;
+        }
         SysUserCashAccount account = sysUserCashAccountDao.getLocked(userId);
         registration.setBalance(account.getBalance());
         registration.setTransferStudent(registration.getTemporaryCourseFee() == null ? 0 : 1);
@@ -863,13 +866,13 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 throw new BizException("减去缴费人数失败");
             }
             //发送缴费成功通知(短信 + push)
-            String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL + studentRegistration.getMusicGroupId());
+            String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + studentRegistration.getMusicGroupId();
 
             Map<Integer, String> map = new HashMap<>(1);
             map.put(studentPaymentOrder.getUserId(), studentRegistration.getParentsPhone());
             sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI,
                     MessageTypeEnum.STUDENT_SMS_PAYMENT_FAILED, map, null, 0, "1",
-                    studentApplyUrl);
+                    HttpUtil.getSortUrl(studentApplyUrl));
 //            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
 //                    MessageTypeEnum.STUDENT_SMS_PAYMENT_FAILED,map,null,0,"1",
 //                    studentApplyUrl);

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml

@@ -317,7 +317,7 @@
 			csts.subsidy_ = #{subsidy},
 			csts.expect_salary_ = #{salary},
 			csts.update_time_ = now()
-		WHERE csts.user_id_ = #{userId} and csts.class_group_id_ = #{classGroupId} and csts.settlement_time_ is null and CONCAT(cs.class_date_,' ',cs.start_class_time_) &gt; #{startDateTime}
+		WHERE csts.user_id_ = #{userId} and csts.class_group_id_ = #{classGroupId} and csts.settlement_time_ is null and CONCAT(cs.class_date_,' ',cs.start_class_time_) &gt;= #{startDateTime}
 	</update>
     <update id="batchUpdateTeacherExpectSalary">
 		UPDATE course_schedule_teacher_salary

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/MusicGroupMapper.xml

@@ -383,7 +383,7 @@
 	<select id="findUserMusicGroup" resultMap="MusicGroup">
 		SELECT mg.* FROM music_group mg
 		LEFT JOIN student_registration sr on sr.music_group_id_ = mg.id_
-		WHERE sr.user_id_ = #{UserId} AND sr.payment_status_= '2' ORDER BY sr.id_ ASC LIMIT 1
+		WHERE sr.user_id_ = #{UserId} ORDER BY sr.id_ ASC LIMIT 1
 	</select>
 
     <select id="findMusicGroup" resultMap="MusicGroup">

+ 10 - 1
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiOperation;
 import java.math.BigDecimal;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 
 import javax.annotation.Resource;
@@ -237,8 +238,12 @@ public class MusicGroupController extends BaseController {
         if (ApplyOrder != null) {
             return failed(HttpStatus.CONTINUE, "您有待支付的订单");
         }
+        Map payMap = musicGroupService.pay(registerPayDto);
+        if(payMap.containsKey("tradeState")){
+            return failed(HttpStatus.CREATED, "恭喜您,报名成功!");
+        }
 
-        return succeed(musicGroupService.pay(registerPayDto));
+        return succeed(payMap);
     }
 
     @ApiOperation(value = "乐团报名重新支付")
@@ -256,6 +261,10 @@ public class MusicGroupController extends BaseController {
         if (ApplyOrder != null) {
             return failed("您已支付成功,请勿重复支付");
         }
+        Map payMap = musicGroupService.rePay(registerPayDto);
+        if(payMap.containsKey("tradeState")){
+            return failed(HttpStatus.CREATED, "恭喜您,报名成功!");
+        }
 
         return succeed(musicGroupService.rePay(registerPayDto));
     }

+ 0 - 6
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherController.java

@@ -58,12 +58,6 @@ public class TeacherController extends BaseController {
         return succeed(teacherService.getDetail(id));
     }
 
-    @ApiOperation(value = "分页查询教师列表")
-    @GetMapping("/queryPage")
-    public Object queryPage(TeacherQueryInfo queryInfo) {
-        return succeed(teacherService.queryPageDetail(queryInfo));
-    }
-
     @ApiOperation(value = "根据教师编号查询教师课程班列表")
     @GetMapping("/getClass")
     @ApiParam(value = "教师编号", required = true)

+ 1 - 1
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yqpay/YqPayUtil.java

@@ -15,7 +15,7 @@ public class YqPayUtil {
 
     public static Map<String, Object> getRequestMap(String notifyUrl, Map<String, Object> resultMap) throws Exception {
         Map<String, Object> rqMap = new LinkedHashMap<>();
-        rqMap.put("merNo", merNo);
+        rqMap.put("merNo", resultMap.get("sellerNo"));
         rqMap.put("version", version);
         rqMap.put("notifyUrl", notifyUrl);
         rqMap.put("timestamp", DateUtils.getDateTime());