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

Merge remote-tracking branch 'origin/master'

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

+ 68 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/PayService.java

@@ -0,0 +1,68 @@
+package com.ym.mec.biz.service;
+
+
+import com.ym.mec.thirdparty.yqpay.YqPayUtil;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.stereotype.Service;
+
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/** 
+ * 上传工具服务层实现类
+ */
+@Service
+public class PayService {
+
+	/**
+	 * 返回订单提交数据
+	 * @param amount 金额
+	 * @param orderNo 订单编号
+	 * @param notifyUrl 异步通知地址
+	 * @param returnUrl 支付返回地址
+	 * @param orderSubject 订单标题
+	 * @param orderBody 订单内容
+	 * @return
+	 * @throws Exception
+	 */
+	public Map getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody) throws Exception {
+
+//        String notifyUrl = ""; //异步通知地址
+//        String returnUrl = ""; //还回地址
+//        String orderBody = "大雅乐盟培训课程";//订单内容
+//        String orderSubject = "培训订单";//订单标题
+//        String orderNo = "2019121263844";//订单编号
+//        BigDecimal amount = new BigDecimal("6543"); //订单金额
+
+		String payUrl = "https://qyfapi.95epay.com/api/api/hPay/toPayHtml";//支付提交地址
+		String payChannels = "{\"weChatPay\":true,\"weChatPayMobile\":false,\"aliPay\":true,\"fastpayXy\":true,\"aliPayMobile\":false,\"balancePay\":false}";//支付方式配置
+
+		//List<Map> tempRoutingList = new ArrayList();
+//        Map<String, Object> routingList = new HashMap<>();
+//        routingList.put("routingMerNo", routingAccount.getSellerNo());//分佣账户
+////      routingList.put("routingFee", order.getAmount()); //分佣金额
+//        routingList.put("routingFee", order.getAmount().subtract((order.getAmount().multiply(new BigDecimal(0.28)).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_UP))); //分佣金额
+//        tempRoutingList.add(routingList);
+//
+
+		Map<String, Object> resultMap = new LinkedHashMap<String, Object>();
+		resultMap.put("sellerNo", "0021677"); //收款商户号
+		resultMap.put("payChannels", payChannels); //支付方式
+		resultMap.put("orderBody", orderBody); //订单信息
+		resultMap.put("payAmount", amount); //支付金额
+		resultMap.put("apiPayType", "1"); //*API支付类型1-即时支付,2-担保支付,3-预授权支付*/
+		resultMap.put("tradeType", "0"); //*交易类型1—充值,0—收款*
+		resultMap.put("merMerOrderNo", orderNo); //商户订单号
+		resultMap.put("orderSubject", orderSubject); //订单标题
+		resultMap.put("returnUrl", returnUrl); //前台页面地址
+		//resultMap.put("tempRoutingList", JSON.toJSONString(tempRoutingList));//分账设置
+		Map rqMap = new YqPayUtil(notifyUrl, resultMap).getRequestMap();
+		rqMap.put("host", payUrl);
+		return rqMap;
+	}
+
+}

BIN
mec-biz/src/main/resources/config/certificate/sq_formal_sign.cer


BIN
mec-biz/src/main/resources/config/certificate/yqpay.cer


+ 0 - 0
mec-biz/src/main/resources/config/certificate/yqpay.pfx


+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/controller/HomeWorkController.java

@@ -79,7 +79,7 @@ public class HomeWorkController {
     @PostMapping(value = "/workDetail")
     public BaseResponse workDetail(@RequestBody HomeWorkDetailReq req) {
         BaseResponse baseResponse = new BaseResponse();
-        if(req == null || req.getMusicGroupId() == null || req.getClassGroupId() == null || req.getWorkId() == null){
+        if(req == null || req.getWorkId() == null){
             baseResponse.setReturnCode(ReturnCodeEnum.CODE_206.getCode());
             baseResponse.setMessage(ReturnCodeEnum.CODE_206.getValue());
             return baseResponse;

+ 4 - 1
mec-education/src/main/java/com/ym/mec/education/req/StudentReq.java

@@ -19,5 +19,8 @@ public class StudentReq extends BaseQuery {
     private String studentName;
 
     @ApiModelProperty(value = "学员编号")
-    private String studentId;
+    private Integer studentId;
+
+    @ApiModelProperty(value = "老师编号")
+    private Integer teacherId;
 }

+ 2 - 2
mec-education/src/main/java/com/ym/mec/education/resp/StudentResp.java

@@ -58,8 +58,8 @@ public class StudentResp implements Serializable {
         private String classTime;
         @ApiModelProperty(value = "缴费状态,已缴费,待续费,已续费", example = "已续费")
         private String renewStatus;
-        @ApiModelProperty(value = "学校经纬度", example = "118.800454,32.083998")
-        private String schoolLongitudeLatitude;
+        @ApiModelProperty(value = "学校名称", example = "武汉市红领巾小学")
+        private String schoolName;
         @ApiModelProperty(value = "课程类别 1 乐团 2 vip", example = "1")
         private Integer courseType;
         @ApiModelProperty(value = "讲课老师", example = "张老师")

+ 2 - 2
mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleServiceImpl.java

@@ -258,7 +258,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper,
                         studentCourseSchedule.setMusicGroupId(classGroup.getMusicGroupId());
                         School school = schoolService.getById(musicGroup.getSchoolId());
                         Optional.ofNullable(school).ifPresent(value -> studentCourseSchedule.
-                            setSchoolLongitudeLatitude(value.getLongitudeLatitude()));
+                            setSchoolName(value.getName()));
                     });
                     QueryWrapper<MusicGroupPaymentCalender> paymentCalenderQueryWrapper = new QueryWrapper<>();
                     paymentCalenderQueryWrapper.lambda().eq(MusicGroupPaymentCalender::getMusicGroupId, musicGroup.getId());
@@ -282,7 +282,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper,
                             studentCourseSchedule.setMusicGroupId(classGroup.getMusicGroupId());
                             School school = schoolService.getById(vipGroupParam.getTeacherSchoolId());
                             Optional.ofNullable(school).ifPresent(value -> studentCourseSchedule.
-                                setSchoolLongitudeLatitude(value.getLongitudeLatitude()));
+                                setSchoolName(value.getName()));
                         });
                     }
                     studentCourseSchedule.setCourseType(2);

+ 4 - 4
mec-education/src/main/java/com/ym/mec/education/service/impl/StudentCourseHomeworkServiceImpl.java

@@ -115,21 +115,21 @@ public class StudentCourseHomeworkServiceImpl extends ServiceImpl<StudentCourseH
     public BaseResponse getHomeWorkDetail(HomeWorkDetailReq req) {
 
         HomeWrokDetailResp resp = new HomeWrokDetailResp();
-        MusicGroup musicGroup = musicGroupService.getById(req.getMusicGroupId());
+       /* MusicGroup musicGroup = musicGroupService.getById(req.getMusicGroupId());
         if(musicGroup == null){
             return  BaseResponse.noDataExists();
         }
         ClassGroup classGroup =  classGroupService.getById(req.getClassGroupId());
         if(classGroup == null){
             return  BaseResponse.noDataExists();
-        }
+        }*/
         StudentCourseHomework homework = this.getById(req.getWorkId());
         if(homework == null){
             return  BaseResponse.noDataExists();
         }
         BeanUtils.copyProperties(homework,resp);
-        resp.setGroupName(musicGroup.getName());
-        resp.setClassName(classGroup.getName());
+        //resp.setGroupName(musicGroup.getName());
+        //resp.setClassName(classGroup.getName());
 
         //回复留言
         QueryWrapper<StudentCourseHomeworkReply> queryWrapper = new QueryWrapper<>();

+ 0 - 3
mec-student/pom.xml

@@ -11,9 +11,6 @@
 	<artifactId>mec-student</artifactId>
 	<name>mec-student</name>
 	<url>http://maven.apache.org</url>
-	<properties>
-		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-	</properties>
 	<dependencies>
 		<dependency>
 			<groupId>org.springframework.cloud</groupId>

+ 1 - 1
mec-student/src/main/java/com/ym/mec/student/config/ResourceServerConfig.java

@@ -22,7 +22,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 
 	@Override
 	public void configure(HttpSecurity http) throws Exception {
-		http.csrf().disable().authorizeRequests().antMatchers("/v2/api-docs", "/register/findSubByMusicGroupId","/register/findGoodsGroups").permitAll().anyRequest().authenticated().and().httpBasic();
+		http.csrf().disable().authorizeRequests().antMatchers("/v2/api-docs", "/register/findSubByMusicGroupId", "/register/add","/musicGroup/test","musicGroup/getSubjectGoodsAndInfo").permitAll().anyRequest().authenticated().and().httpBasic();
 	}
 
 	@Override

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

@@ -20,6 +20,7 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.LinkedHashMap;
@@ -31,7 +32,7 @@ import java.util.Map;
 @RestController
 public class MusicGroupController extends BaseController {
 
-    @Autowired
+    @Resource
     private SysUserFeignService sysUserFeignService;
     @Autowired
     private MusicGroupService musicGroupService;
@@ -45,6 +46,7 @@ public class MusicGroupController extends BaseController {
     private GoodsService goodsService;
     @Autowired
     private StudentPaymentOrderService studentPaymentOrderService;
+    @Autowired PayService payService;
 
     @ApiOperation("获取学生所在乐团列表")
     @GetMapping(value = "/queryUserMusicGroups")
@@ -146,4 +148,12 @@ public class MusicGroupController extends BaseController {
         rqMap.put("payUrl", "http://pay.url");
         return succeed(rqMap);
     }
+
+    @GetMapping("/test")
+    public Object test() throws Exception {
+
+        BigDecimal amount = new BigDecimal("200");
+        Map map = payService.getPayMap(amount,"201910113456789386903","https://pay.dayaedu.com/notify","https://baodiu.com","测试订单","测试订单");
+        return succeed(map);
+    }
 }

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

@@ -26,7 +26,7 @@ public class YqPayUtil {
         rqMap.put("apiContent", JSON.toJSONString(resultMap));
         rqMap.put("signType", signType);
         String beforeSignedData = CFCARAUtil.joinMapValue(rqMap, '&');
-        this.sign = CFCARAUtil.signMessageByP1(beforeSignedData, "certificate/yqpay.pfx", "aaa123123");
+        this.sign = CFCARAUtil.signMessageByP1(beforeSignedData, "config/certificate/yqpay.pfx","aaa123123");
         rqMap.put("sign", this.sign);
         this.requestMap = rqMap;
     }

BIN
mec-thirdparty/src/main/resources/config/certificate/sq_formal_sign.cer


BIN
mec-thirdparty/src/main/resources/config/certificate/yqpay.cer


BIN
mec-thirdparty/src/main/resources/config/certificate/yqpay.pfx