Browse Source

Merge branch 'zx_saas_payment_config_0218' of http://git.dayaedu.com/yonge/mec into dev

zouxuan 5 months ago
parent
commit
60aa2a4fed
18 changed files with 399 additions and 368 deletions
  1. 17 27
      mec-application/src/main/java/com/ym/mec/student/controller/RepairController.java
  2. 21 52
      mec-application/src/main/java/com/ym/mec/student/controller/ReplacementInstrumentActivityController.java
  3. 6 11
      mec-application/src/main/java/com/ym/mec/student/controller/SubjectChangeController.java
  4. 12 20
      mec-application/src/main/java/com/ym/mec/teacher/controller/EduRepairController.java
  5. 3 3
      mec-application/src/main/java/com/ym/mec/web/controller/APIController.java
  6. 14 16
      mec-application/src/main/java/com/ym/mec/web/controller/education/EduRepairController.java
  7. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/ReplacementInstrumentActivityService.java
  8. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderService.java
  9. 3 2
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRepairService.java
  10. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/SubjectChangeService.java
  11. 5 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ChildrenDayReserveServiceImpl.java
  12. 12 7
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberRankSettingServiceImpl.java
  13. 45 41
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java
  14. 17 9
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentActivityServiceImpl.java
  15. 88 39
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java
  16. 85 87
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  17. 44 32
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java
  18. 22 15
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java

+ 17 - 27
mec-application/src/main/java/com/ym/mec/student/controller/RepairController.java

@@ -3,12 +3,7 @@ package com.ym.mec.student.controller;
 
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.entity.StudentGoodsSell;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.StudentRepair;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
-import com.ym.mec.biz.dal.enums.PayStatus;
 import com.ym.mec.biz.dal.page.GoodsCategoryQueryInfo;
 import com.ym.mec.biz.dal.page.GoodsQueryInfo;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
@@ -19,12 +14,9 @@ import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
-import java.util.Map;
+import javax.annotation.Resource;
 import java.util.Optional;
 
 @RequestMapping("${app-config.url.student:}/repair")
@@ -32,17 +24,15 @@ import java.util.Optional;
 @RestController
 public class RepairController extends BaseController {
 
-    @Autowired
+    @Resource
     private SysUserService sysUserService;
-    @Autowired
+    @Resource
     private StudentRepairService studentRepairService;
-    @Autowired
-    private StudentPaymentOrderService studentPaymentOrderService;
-    @Autowired
+    @Resource
     private GoodsService goodsService;
-    @Autowired
+    @Resource
     private GoodsCategoryService goodsCategoryService;
-    @Autowired
+    @Resource
     private StudentGoodsSellService studentGoodsSellService;
 
     @ApiOperation("添加商品销售订单")
@@ -51,37 +41,37 @@ public class RepairController extends BaseController {
         if(studentGoodsSell.getUserId() == null){
             studentGoodsSell.setUserId(sysUserService.getUserId());
         }
-        if (studentGoodsSell.getIsRepeatPay() == false) {
+        /*if (!studentGoodsSell.getIsRepeatPay()) {
             List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.GOODS_SELL, null, studentGoodsSell.getUserId(), DealStatusEnum.ING,
                     OrderTypeEnum.GOODS_SELL);
-            if (list.size() > 0) {
+            if (CollectionUtils.isNotEmpty(list)) {
             	StudentPaymentOrder applyOrder = list.get(list.size() - 1);
             	// 查询订单状态
                 PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder);
                 if(payStatus == PayStatus.SUCCESSED){
             		throw new BizException("订单已支付成功,请勿重复支付");
-            	}/*else if(payStatus == PayStatus.PAYING){
+            	}*//*else if(payStatus == PayStatus.PAYING){
             		throw new BizException("订单还在交易中,请稍后重试");
-            	}*/
+            	}*//*
                 return failed(HttpStatus.CONTINUE, "您有待支付的订单");
             }
-        }
+        }*/
         studentGoodsSell.setAuthorUser(studentGoodsSell.getUserId());
-        Map map = studentRepairService.addGoodsSellOrder(studentGoodsSell);
-        if(map.containsKey("tradeState")){
+        return studentRepairService.addGoodsSellOrder(studentGoodsSell);
+        /*if(map.containsKey("tradeState")){
             return failed(HttpStatus.CREATED, map,"恭喜您,购买成功!");
         }
-        return succeed(map);
+        return succeed(map);*/
     }
 
     @ApiOperation("学员扫码支付")
     @PostMapping(value = "/studentPaymentGoodsOrder")
     public HttpResponseResult studentPaymentGoodsOrder(Integer goodsSellId) throws Exception {
-        Map map = studentRepairService.studentPaymentGoodsOrder(goodsSellId);
-        if(map.containsKey("tradeState")){
+        return studentRepairService.studentPaymentGoodsOrder(goodsSellId);
+        /*if(map.containsKey("tradeState")){
             return failed(HttpStatus.CREATED, map,"恭喜您,购买成功!");
         }
-        return succeed(map);
+        return succeed(map);*/
     }
 
 

+ 21 - 52
mec-application/src/main/java/com/ym/mec/student/controller/ReplacementInstrumentActivityController.java

@@ -1,17 +1,14 @@
 package com.ym.mec.student.controller;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityDto;
 import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto;
 import com.ym.mec.biz.dal.dto.ReplacementPayDto;
 import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
 import com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.enums.PayStatus;
 import com.ym.mec.biz.service.ReplacementInstrumentActivityService;
 import com.ym.mec.biz.service.ReplacementInstrumentCooperationService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
@@ -19,25 +16,21 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.Map;
+import javax.annotation.Resource;
 
 @RequestMapping("${app-config.url.student:}/replacementInstrumentActivity")
 @Api(tags = "乐器置换调查问卷")
 @RestController
 public class ReplacementInstrumentActivityController extends BaseController {
 
-    @Autowired
+    @Resource
     private ReplacementInstrumentActivityService replacementInstrumentActivityService;
-    @Autowired
-    private SysUserFeignService sysUserFeignService;
-    @Autowired
+    @Resource
+    private SysUserService sysUserService;
+    @Resource
     private ReplacementInstrumentCooperationService replacementInstrumentCooperationService;
-    @Autowired
-    private StudentPaymentOrderService studentPaymentOrderService;
 
     @ApiOperation(value = "新增调查问卷")
     @PostMapping("/insert")
@@ -54,10 +47,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @ApiOperation(value = "新版获取学员基本信息")
     @GetMapping("queryUserInfoByCooperationId")
     public Object queryUserInfoByCooperationId(Integer cooperationId) {
-        SysUser user = sysUserFeignService.queryUserInfo();
-        if (user == null) {
-            return failed(HttpStatus.FORBIDDEN, "请登录");
-        }
+        SysUser user = sysUserService.getUser();
         ReplacementInstrumentCooperation replacementInstrumentCooperation = replacementInstrumentCooperationService.get(cooperationId);
         Integer cooperationOrganId = replacementInstrumentCooperation.getCooperationOrganId();
         return succeed(replacementInstrumentActivityService.queryUserInfo(cooperationOrganId,user,cooperationId));
@@ -66,10 +56,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @ApiOperation(value = "获取学员基本信息")
     @GetMapping("queryUserInfo")
     public Object queryUserInfo(Integer cooperationOrganId) {
-        SysUser user = sysUserFeignService.queryUserInfo();
-        if (user == null) {
-            return failed(HttpStatus.FORBIDDEN, "请登录");
-        }
+        SysUser user = sysUserService.getUser();
         ReplacementInstrumentCooperation cooperation = replacementInstrumentCooperationService.findByCooperationOrganIdAndTopicId(cooperationOrganId,null);
         return succeed(replacementInstrumentActivityService.queryUserInfo(cooperationOrganId,user,cooperation.getId()));
     }
@@ -77,10 +64,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @ApiOperation(value = "修改调查问卷")
     @PostMapping("/update")
     public Object update(ReplacementInstrumentActivity replacementInstrumentActivity) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            throw new BizException("用户信息获取失败,请重新登陆");
-        }
+        sysUserService.getUser();
         replacementInstrumentActivityService.update(replacementInstrumentActivity);
         return succeed();
     }
@@ -88,10 +72,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @ApiOperation(value = "获取调查问卷")
     @GetMapping("/get")
     public Object get(Integer id) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            throw new BizException("用户信息获取失败,请重新登陆");
-        }
+        sysUserService.getUser();
         return succeed(replacementInstrumentActivityService.get(id));
     }
 
@@ -99,10 +80,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @GetMapping("/getInfo")
     @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "置换id", required = true, dataType = "int")})
     public HttpResponseResult<ReplacementInstrumentActivityStatDto> getInfo(Integer id) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            throw new BizException("用户信息获取失败,请重新登陆");
-        }
+        sysUserService.getUser();
         return succeed(replacementInstrumentActivityService.getInfo(id));
     }
 
@@ -110,10 +88,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @GetMapping("/getInfoByCooperationOrganId")
     @ApiImplicitParams({@ApiImplicitParam(name = "cooperationOrganId", value = "合作单位id", required = true, dataType = "int")})
     public HttpResponseResult<ReplacementInstrumentActivityStatDto> getInfoByCooperationOrganId(Integer cooperationOrganId) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            return failed(HttpStatus.FORBIDDEN, "请重新登陆");
-        }
+        SysUser sysUser = sysUserService.getUser();
         ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityService.findByUserId(cooperationOrganId, sysUser.getId(),null);
         if(replacementInstrumentActivity == null){
         	return failed("未查询到您参与调查的记录");
@@ -126,10 +101,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @GetMapping("/getInfoByCooperationId")
     @ApiImplicitParams({@ApiImplicitParam(name = "cooperationId", value = "置换活动编号", required = true, dataType = "int")})
     public HttpResponseResult<ReplacementInstrumentActivityStatDto> getInfoByCooperationId(Integer cooperationId) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            return failed(HttpStatus.FORBIDDEN, "请重新登陆");
-        }
+        SysUser sysUser = sysUserService.getUser();
         ReplacementInstrumentCooperation replacementInstrumentCooperation = replacementInstrumentCooperationService.get(cooperationId);
         ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityService.findByUserId(replacementInstrumentCooperation.getCooperationOrganId(),
                 sysUser.getId(),
@@ -144,10 +116,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @ApiOperation(value = "置换支付")
     @PostMapping("/pay")
     public HttpResponseResult pay(@RequestBody ReplacementPayDto replacementPayDto) throws Exception {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            throw new BizException("用户信息获取失败,请重新登陆");
-        }
+        SysUser sysUser = sysUserService.getUser();
         ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityService.get(replacementPayDto.getId());
         if (replacementInstrumentActivity == null) {
             throw new BizException("乐器置换不存在,请核查");
@@ -165,22 +134,22 @@ public class ReplacementInstrumentActivityController extends BaseController {
             return failed("您已支付成功,请勿重复支付");
         }
         //判断用户是否已存在订单
-        if (replacementInstrumentActivity.getPayStatus().equals(1) && !replacementPayDto.getRePay()) {
+        /*if (replacementInstrumentActivity.getPayStatus().equals(1) && !replacementPayDto.getRePay()) {
         	
         	StudentPaymentOrder applyOrder = studentPaymentOrderService.getUserReplacementIngOrder(replacementInstrumentActivity.getUserId(), replacementInstrumentActivity.getId());
         	// 查询订单状态
             PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder);
             if(payStatus == PayStatus.SUCCESSED){
         		throw new BizException("订单已支付成功,请勿重复支付");
-        	}/*else if(payStatus == PayStatus.PAYING){
+        	}*//*else if(payStatus == PayStatus.PAYING){
         		throw new BizException("订单还在交易中,请稍后重试");
-        	}*/
+        	}*//*
             return failed(HttpStatus.CONTINUE, "您有待支付的订单");
-        }
-        Map payMap = replacementInstrumentActivityService.pay(replacementPayDto);
-        if (payMap.containsKey("tradeState")) {
+        }*/
+        return replacementInstrumentActivityService.pay(replacementPayDto);
+        /*if (payMap.containsKey("tradeState")) {
             return failed(HttpStatus.CREATED, payMap, "恭喜您,支付成功!");
         }
-        return succeed(payMap);
+        return succeed(payMap);*/
     }
 }

+ 6 - 11
mec-application/src/main/java/com/ym/mec/student/controller/SubjectChangeController.java

@@ -15,22 +15,21 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.Map;
+import javax.annotation.Resource;
 
 @RequestMapping("${app-config.url.student:}/subjectChange")
 @Api(tags = "声部更换服务")
 @RestController
 public class SubjectChangeController extends BaseController {
 
-    @Autowired
+    @Resource
     private SubjectChangeService subjectChangeService;
-    @Autowired
+    @Resource
     private SubjectChangeDao subjectChangeDao;
-    @Autowired
+    @Resource
     private StudentPaymentOrderService studentPaymentOrderService;
 
 
@@ -46,7 +45,7 @@ public class SubjectChangeController extends BaseController {
 
     @ApiOperation(value = "支付更换声部费用")
     @PostMapping("/payChange")
-    public HttpResponseResult<Map> payChange(@RequestBody SubjectChangeParamDto subjectChangeParamDto) throws Exception {
+    public HttpResponseResult payChange(@RequestBody SubjectChangeParamDto subjectChangeParamDto) throws Exception {
         SubjectChange subjectChange = subjectChangeDao.get(subjectChangeParamDto.getId());
         if (!subjectChangeParamDto.getRepay() && subjectChange.getStatus().equals(SubjectChangeStatusEnum.ING)) {
         	
@@ -59,11 +58,7 @@ public class SubjectChangeController extends BaseController {
             return failed(HttpStatus.CONTINUE, "您有待支付的订单");
         }
         subjectChangeParamDto.setTenantId(subjectChange.getTenantId());
-        Map payMap = subjectChangeService.payChange(subjectChangeParamDto);
-        if (payMap.containsKey("tradeState")) {
-            return failed(HttpStatus.CREATED, payMap, "恭喜您,支付成功!");
-        }
-        return succeed(payMap);
+        return subjectChangeService.payChange(subjectChangeParamDto);
     }
 
 

+ 12 - 20
mec-application/src/main/java/com/ym/mec/teacher/controller/EduRepairController.java

@@ -2,11 +2,7 @@ package com.ym.mec.teacher.controller;
 
 import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.entity.StudentGoodsSell;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.Teacher;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.dal.page.GoodsCategoryQueryInfo;
 import com.ym.mec.biz.dal.page.GoodsQueryInfo;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
@@ -18,11 +14,9 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
+import javax.annotation.Resource;
 import java.util.Map;
 import java.util.Objects;
 
@@ -31,19 +25,17 @@ import java.util.Objects;
 @RestController
 public class EduRepairController extends BaseController {
 
-    @Autowired
+    @Resource
     private SysUserService sysUserService;
-    @Autowired
+    @Resource
     private TeacherService teacherService;
-    @Autowired
+    @Resource
     private StudentRepairService studentRepairService;
-    @Autowired
-    private StudentPaymentOrderService studentPaymentOrderService;
-    @Autowired
+    @Resource
     private GoodsService goodsService;
-    @Autowired
+    @Resource
     private GoodsCategoryService goodsCategoryService;
-    @Autowired
+    @Resource
     private StudentGoodsSellService studentGoodsSellService;
 
     @ApiImplicitParams({
@@ -60,21 +52,21 @@ public class EduRepairController extends BaseController {
     @ApiOperation("添加商品销售订单")
     @PostMapping(value = "/addGoodsSellOrder")
     public HttpResponseResult addGoodsSellOrder(@RequestBody StudentGoodsSell studentGoodsSell) throws Exception {
-        if (studentGoodsSell.getIsRepeatPay() == false) {
+        /*if (studentGoodsSell.getIsRepeatPay() == false) {
             List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.GOODS_SELL, null, studentGoodsSell.getUserId(), DealStatusEnum.ING,
                     OrderTypeEnum.RENEW);
             if (list.size() > 0) {
                 return failed(HttpStatus.CONTINUE, "该学员有待支付的订单");
             }
-        }
+        }*/
         Integer userId = sysUserService.getUserId();
         studentGoodsSell.setTeacherId(userId);
         studentGoodsSell.setAuthorUser(userId);
-        Map map = studentRepairService.addGoodsSellOrder(studentGoodsSell);
-        if (map.containsKey("tradeState")) {
+        return studentRepairService.addGoodsSellOrder(studentGoodsSell);
+        /*if (map.containsKey("tradeState")) {
             return failed(HttpStatus.CREATED, map, "恭喜您,购买成功!");
         }
-        return succeed(map);
+        return succeed(map);*/
     }
 
     @ApiOperation("获取学生信息")

+ 3 - 3
mec-application/src/main/java/com/ym/mec/web/controller/APIController.java

@@ -125,7 +125,7 @@ public class APIController extends BaseController {
 		queryInfo.setOrganId(sysUser.getOrganId());
 		queryInfo.setUserId(sysUser.getId());
 		List<StudentVipGroupShowListDto> listDtos = vipGroupService.queryVipPracticeGroups(queryInfo);
-		return CollectionUtils.isEmpty(listDtos)?false:true;
+		return !CollectionUtils.isEmpty(listDtos);
 	}
 
 
@@ -145,13 +145,13 @@ public class APIController extends BaseController {
 
 	// 商城订单优惠券金额
 	@PostMapping("/couponAmount")
-	public HttpResponseResult<Map> couponAmount(@RequestBody MallCreateOrderModel model) {
+	public HttpResponseResult<Map<String,Object>> couponAmount(@RequestBody MallCreateOrderModel model) {
 		return succeed(studentPaymentOrderService.couponAmount(model));
 	}
 
 	// 商城保存订单详情数据
 	@PostMapping("/mallSaveOrderInfo")
-	public HttpResponseResult<Map> mallSaveOrderInfo(@RequestBody MallCreateOrderModel model) {
+	public HttpResponseResult mallSaveOrderInfo(@RequestBody MallCreateOrderModel model) {
 		studentPaymentOrderService.mallSaveOrderInfo(model);
 		return succeed();
 	}

+ 14 - 16
mec-application/src/main/java/com/ym/mec/web/controller/education/EduRepairController.java

@@ -41,25 +41,23 @@ import java.util.stream.Collectors;
 @RestController
 public class EduRepairController extends BaseController {
 
-    @Autowired
+    @Resource
     private SysUserService sysUserService;
-    @Autowired
+    @Resource
     private EmployeeDao employeeDao;
-    @Autowired
+    @Resource
     private StudentRepairService studentRepairService;
-    @Autowired
-    private StudentPaymentOrderService studentPaymentOrderService;
-    @Autowired
+    @Resource
     private SubjectService subjectService;
-    @Autowired
+    @Resource
     private GoodsService goodsService;
-    @Autowired
+    @Resource
     private GoodsCategoryService goodsCategoryService;
-    @Autowired
+    @Resource
     private StudentGoodsSellService studentGoodsSellService;
-    @Autowired
+    @Resource
     private StudentInstrumentService studentInstrumentService;
-    @Autowired
+    @Resource
     private StudentInstrumentDao studentInstrumentDao;
     @Resource
     private MallFeignService mallFeignService;
@@ -87,21 +85,21 @@ public class EduRepairController extends BaseController {
     @ApiOperation("添加商品销售订单")
     @PostMapping(value = "/addGoodsSellOrder")
     public HttpResponseResult addGoodsSellOrder(@RequestBody StudentGoodsSell studentGoodsSell) throws Exception {
-        if (studentGoodsSell.getIsRepeatPay() == false) {
+        /*if (studentGoodsSell.getIsRepeatPay() == false) {
             List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.GOODS_SELL, null,studentGoodsSell.getUserId(), DealStatusEnum.ING,
                     OrderTypeEnum.RENEW);
             if (list.size() > 0) {
                 return failed(HttpStatus.CONTINUE, "该学员有待支付的订单");
             }
-        }
+        }*/
         Integer userId = sysUserService.getUserId();
         studentGoodsSell.setTeacherId(userId);
         studentGoodsSell.setAuthorUser(userId);
-        Map map = studentRepairService.addGoodsSellOrder(studentGoodsSell);
-        if(map.containsKey("tradeState")){
+        return studentRepairService.addGoodsSellOrder(studentGoodsSell);
+        /*if(map.containsKey("tradeState")){
             return failed(HttpStatus.CREATED, map,"恭喜您,购买成功!");
         }
-        return succeed(map);
+        return succeed(map);*/
     }
 
     @ApiOperation("添加维修单")

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/ReplacementInstrumentActivityService.java

@@ -7,6 +7,7 @@ import com.ym.mec.biz.dal.dto.ReplacementPayDto;
 import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.page.ReplacementInstrumentActivityQueryInfo;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
@@ -27,7 +28,7 @@ public interface ReplacementInstrumentActivityService extends BaseService<Intege
      * @return
      * @throws Exception
      */
-    Map pay(ReplacementPayDto replacementPayDto) throws Exception;
+    HttpResponseResult pay(ReplacementPayDto replacementPayDto) throws Exception;
 
     /**
      * 支付回调处理

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

@@ -264,7 +264,7 @@ public interface StudentPaymentOrderService extends BaseService<Long, StudentPay
     BaseResult<Map<String, Object>> refund(String orderNo, String notifyUrl, String refundNo);
 
     // 查询优惠券优惠券金额
-    Map couponAmount(MallCreateOrderModel model);
+    Map<String,Object> couponAmount(MallCreateOrderModel model);
 
     // 订单收货状态更新
     void receive(String orderNo, boolean autoReceive);

+ 3 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRepairService.java

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.entity.StudentGoodsSell;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.StudentRepair;
 import com.ym.mec.biz.dal.page.RepairStudentQueryInfo;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
@@ -94,7 +95,7 @@ public interface StudentRepairService extends BaseService<Integer, StudentRepair
      * @date 2020/9/16
      * @time 13:47
      */
-    Map addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception;
+    HttpResponseResult addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception;
 
     /**
      * @param goodsSellId:
@@ -105,7 +106,7 @@ public interface StudentRepairService extends BaseService<Integer, StudentRepair
      * @date 2020/9/16
      * @time 13:47
      */
-    Map studentPaymentGoodsOrder(Integer goodsSellId) throws Exception;
+    HttpResponseResult studentPaymentGoodsOrder(Integer goodsSellId) throws Exception;
 
     /**
      * @param order:

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/SubjectChangeService.java

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.SubjectChange;
 import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
 import com.ym.mec.biz.dal.page.SubjectChangeQueryInfo;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
@@ -25,7 +26,7 @@ public interface SubjectChangeService extends BaseService<Integer, SubjectChange
      * @param isUseBalancePayment
      * @return
      */
-    Map payChange(SubjectChangeParamDto subjectChangeParamDto) throws Exception;
+    HttpResponseResult payChange(SubjectChangeParamDto subjectChangeParamDto) throws Exception;
 
     /**
      * 添加声部更换

+ 5 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ChildrenDayReserveServiceImpl.java

@@ -18,6 +18,7 @@ import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
 
+import org.apache.commons.collections.CollectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -128,7 +129,7 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil
             //统计
             pageInfo.setStatInfo(childrenDayReserveDao.childrenStatistics(params));
             //获取乐团在读人数
-            List<String> musicGroupIds = dataList.stream().map(e -> e.getMusicGroupId()).collect(Collectors.toList());
+            List<String> musicGroupIds = dataList.stream().map(ChildrenStatisticsDto::getMusicGroupId).collect(Collectors.toList());
             Map<String, Long> normalNum = MapUtil.convertIntegerMap(studentRegistrationService.countNormalNum(musicGroupIds));
             dataList.forEach(e -> {
                 e.setNormalNum(normalNum.get(e.getMusicGroupId()) == null ? 0 : normalNum.get(e.getMusicGroupId()).intValue());
@@ -180,7 +181,7 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil
         List<ChildrenDayDegreeDetail> details = childrenDayDegreeDetailService.getByUserIdAndStatus(degreePayDto.getUserId(), 1);
 
         //处理关闭订单
-        if (details.size() > 0 && degreePayDto.getRePay()) {
+        if (CollectionUtils.isNotEmpty(details) && degreePayDto.getRePay()) {
             Long orderId = details.get(0).getOrderId();
             StudentPaymentOrder oldOrder = studentPaymentOrderService.get(orderId);
             if (oldOrder != null) {
@@ -220,7 +221,7 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil
             }
             List<ChildrenDayDegreeDetail> hasList = details.stream().filter(e -> e.getType().equals(1)).filter(e -> e.getSubjectId().equals(degreePayDto.getSubject()))
                     .filter(e -> e.getLevel().equals(degreePayDto.getMusicGradeLevel())).collect(Collectors.toList());
-            if (hasList.size() > 0) {
+            if (CollectionUtils.isNotEmpty(hasList)) {
                 throw new BizException("您已报考同声部同等级,请勿重复报考");
             }
 
@@ -233,7 +234,7 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil
         if (degreePayDto.getTheoryLevel() != null && degreePayDto.getTheoryLevel() > 0) {
             List<ChildrenDayDegreeDetail> hasList = details.stream().filter(e -> e.getType().equals(2))
                     .filter(e -> e.getLevel().equals(degreePayDto.getTheoryLevel())).collect(Collectors.toList());
-            if (hasList.size() > 0) {
+            if (CollectionUtils.isNotEmpty(hasList)) {
                 throw new BizException("您已报考同等级乐理,请勿重复报考");
             }
         }

+ 12 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberRankSettingServiceImpl.java

@@ -612,10 +612,14 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
     public HttpResponseResult buy2Qqhe(MemberPayParamDto dto) throws Exception {
         //获取学员信息
         SysUser sysUser = getSysUser();
-        if (!dto.getRepeatPay()) {
-            //查询是否有待支付订单
-            List<StudentPaymentOrder> studentPaymentOrders = studentPaymentOrderService.queryByCondition(GroupType.MEMBER,
-                    null, sysUser.getId(), DealStatusEnum.ING, OrderTypeEnum.MEMBER);
+        //查询是否有待支付订单
+        List<StudentPaymentOrder> studentPaymentOrders = studentPaymentOrderService.queryByCondition(GroupType.MEMBER,
+                null, sysUser.getId(), DealStatusEnum.ING, OrderTypeEnum.MEMBER);
+        HttpResponseResult result1 = studentPaymentOrderService.checkRepeatPay(studentPaymentOrders.get(0), dto.getRepeatPay());
+        if (result1.getCode() != 200) {
+            return result1;
+        }
+        /*if (!dto.getRepeatPay()) {
             if (CollectionUtils.isNotEmpty(studentPaymentOrders)) {
                 return BaseController.failed(HttpStatus.CONTINUE, studentPaymentOrders.get(0), "您有待支付的订单,是否继续支付");
             }
@@ -646,7 +650,7 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
             } else {
                 return BaseController.failed("该订单已关闭,请重新购买!");
             }
-        }
+        }*/
 
         int val = dto.getVal();
         //获取赠送的月份
@@ -705,8 +709,9 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
             logger.info("closeBuy2Qqhe>>>>> 未找到 orderNo {}", orderNo);
             return BaseController.succeed();
         }
+        studentPaymentOrderService.checkRepeatPay(orderByOrderNo, true);
         //订单是ing 才可以关闭
-        if (orderByOrderNo.getStatus().getCode().equals(DealStatusEnum.ING.getCode())) {
+        /*if (orderByOrderNo.getStatus().getCode().equals(DealStatusEnum.ING.getCode())) {
             //有第三方支付编号的 要主动去查询一下
             checkOrder(orderByOrderNo);
             //关闭订单  退余额 退优惠券
@@ -718,7 +723,7 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
             return BaseController.succeed();
         } else if (orderByOrderNo.getStatus().getCode().equals(DealStatusEnum.SUCCESS.getCode())) {
             throw new BizException("该订单已经支付成功,无法关闭。");
-        }
+        }*/
         return BaseController.succeed();
     }
 

+ 45 - 41
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -25,6 +25,7 @@ import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
 import com.ym.mec.util.string.MessageFormatter;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -37,9 +38,9 @@ import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
-import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.time.*;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.WeekFields;
@@ -2938,20 +2939,20 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         if (teacherDefaultSalary == null) {
             throw new BizException("请设置教师课酬");
         }
-        BigDecimal studentSingleCourseCost = amount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
+        BigDecimal studentSingleCourseCost = amount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, RoundingMode.DOWN);
 
         BigDecimal oneMonthOriginalPrice = practiceGroupBuyParams.getDrillTimesOnWeek() == 1 ? practiceGroupSellPrice.getOnceOriginalPrice() : practiceGroupSellPrice.getTwiceOriginalPrice();
         BigDecimal originalAmount = ZERO;
         if (Objects.nonNull(oneMonthOriginalPrice)) {
             originalAmount = oneMonthOriginalPrice.multiply(new BigDecimal(practiceGroupBuyParams.getBuyMonths()));
         }
-        BigDecimal studentSingleCourseOriginalCost = originalAmount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
+        BigDecimal studentSingleCourseOriginalCost = originalAmount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, RoundingMode.DOWN);
 
         //使用优惠券
         StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(practiceGroupBuyParams.getCouponIdList(), amount, true);
         //实际支付金额,去除优惠券
         BigDecimal actualPrice = studentPaymentOrder.getExpectAmount();
-        BigDecimal divide = actualPrice.divide(new BigDecimal(practiceCourses.size()), ROUND_DOWN);
+        BigDecimal divide = actualPrice.divide(new BigDecimal(practiceCourses.size()), RoundingMode.DOWN);
         BigDecimal firstAmount = actualPrice.subtract(divide.multiply(new BigDecimal(practiceCourses.size()))).add(divide);
         for (int i = 0; i < practiceCourses.size(); i++) {
             CourseSchedule courseSchedule = practiceCourses.get(i);
@@ -3005,8 +3006,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             courseScheduleService.checkNewCourseSchedules(practiceCourses, false, false);
         } catch (Exception e) {
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-            String errMessage = new String();
-            if (e.getMessage().indexOf("主教冲突") != -1) {
+            String errMessage;
+            if (e.getMessage().contains("主教冲突")) {
                 errMessage = "抱歉啦,当前所选时段组合,「" + teacher.getRealName() + "」老师已被预约,请重新选择时段或更换老师后重试。";
             } else {
                 String courseName = e.getMessage().substring(e.getMessage().indexOf(")-") + 2);
@@ -3079,11 +3080,11 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         }
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
-        Map<String, BigDecimal> classFee = new HashMap<>();
+        /*Map<String, BigDecimal> classFee = new HashMap<>();
         classFee.put("course", amount);
         classFee.put("instrument", BigDecimal.ZERO);
         classFee.put("accessories", BigDecimal.ZERO);
-        classFee.put("other", BigDecimal.ZERO);
+        classFee.put("other", BigDecimal.ZERO);*/
         try {
             Map<String, Object> payMap = payService.getPayMap(
                     amount,
@@ -3317,7 +3318,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         BigDecimal singleClassMinutesPrice = practiceGroupSellPrice.getSingleClassMinutesPrice();
         //实际支付金额,去除优惠券
         BigDecimal actualPrice = order.getExpectAmount();
-        BigDecimal divide = actualPrice.divide(new BigDecimal(courseSchedules.size()), ROUND_DOWN);
+        BigDecimal divide = actualPrice.divide(new BigDecimal(courseSchedules.size()), RoundingMode.DOWN);
         BigDecimal firstAmount = actualPrice.subtract(divide.multiply(new BigDecimal(courseSchedules.size()))).add(divide);
 
         SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
@@ -3336,7 +3337,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             }
             VipGroupSalarySettlementTypeDto salarySettlement = vipGroupSalarySettlementDto.getPracticeSalarySettlement();
             if (salarySettlement.getSalarySettlementType() == SalarySettlementTypeEnum.FIXED_SALARY) {
-                teacherDefaultSalary = salarySettlement.getSettlementValue().setScale(2, BigDecimal.ROUND_CEILING);
+                teacherDefaultSalary = salarySettlement.getSettlementValue().setScale(2, RoundingMode.CEILING);
             }
         }
 
@@ -3414,7 +3415,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                     LocalTime courseStartTime = LocalTime.parse(courseJson.getString(weekNumStr), DateUtil.timeFormatter);
                     LocalTime courseEndTime = courseStartTime.plusMinutes(practiceCourseMinutes);
                     if (PracticeGroupType.COME_ON_PACKAGE.equals(userPracticeGroup.getType())) {
-                        courseEndTime = courseStartTime.plusMinutes(2 * practiceCourseMinutes);
+                        courseEndTime = courseStartTime.plusMinutes(2L * practiceCourseMinutes);
                     }
                     newCourseJson.put("startTime", courseStartTime.format(DateUtil.timeFormatter));
                     newCourseJson.put("endTime", courseEndTime.format(DateUtil.timeFormatter));
@@ -3523,7 +3524,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         List<StudentPaymentOrder> userGroupOrders = studentPaymentOrderDao.findUserGroupOrders(userId, practiceGroupId.toString(), GroupType.PRACTICE, null);
         Map<DealStatusEnum, List<StudentPaymentOrder>> statusOrderMap = userGroupOrders.stream().collect(Collectors.groupingBy(StudentPaymentOrder::getStatus));
         List<StudentPaymentOrder> successOrders = statusOrderMap.get(DealStatusEnum.SUCCESS);
-        if (!CollectionUtils.isEmpty(successOrders) && successOrders.size() > 0) {
+        if (CollectionUtils.isNotEmpty(successOrders)) {
             Map<String, Object> result = new HashMap<>();
             result.put("orderNo", successOrders.get(0).getOrderNo());
             return BaseController.succeed(result);
@@ -3591,11 +3592,11 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         }
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
-        Map<String, BigDecimal> classFee = new HashMap<>();
+        /*Map<String, BigDecimal> classFee = new HashMap<>();
         classFee.put("course", newOrder.getActualAmount());
         classFee.put("instrument", BigDecimal.ZERO);
         classFee.put("accessories", BigDecimal.ZERO);
-        classFee.put("other", BigDecimal.ZERO);
+        classFee.put("other", BigDecimal.ZERO);*/
 
         Map<String, Object> payMap = payService.getPayMap(
                 newOrder.getActualAmount(),
@@ -3675,10 +3676,13 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.PRACTICE, groupId + "", userId, DealStatusEnum.ING,
                     OrderTypeEnum.PRACTICE_GROUP_BUY);
 
-            if (list.size() > 0) {
-                StudentPaymentOrder applyOrder = list.get(list.size() - 1);
+            if (!CollectionUtils.isEmpty(list)) {
+                HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(list.get(list.size() - 1), true);
+                if (result.getCode() != 200) {
+                    return result;
+                }
                 // 查询订单状态
-                PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder);
+                /*PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder);
                 if (payStatus == PayStatus.SUCCESSED) {
                     throw new BizException("订单已支付成功,请勿重复支付");
                 }
@@ -3690,7 +3694,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                             PlatformCashAccountDetailTypeEnum.REFUNDS, "购买网管课支付失败");
                 }
                 studentPaymentOrderService.update(applyOrder);
-                sysCouponCodeService.quit(applyOrder.getCouponCodeId());
+                sysCouponCodeService.quit(applyOrder.getCouponCodeId());*/
             }
 
         } else if (practiceGroup.getGroupStatus().equals(GroupStatusEnum.NORMAL)) {
@@ -3701,10 +3705,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         return BaseController.succeed();
     }
 
-    public static void main(String[] args) {
-
-    }
-
     @Override
     public void pushStudyReport(Date expiredDate, String pushType) {
         if (Objects.isNull(expiredDate)) {
@@ -3768,13 +3768,13 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());
             dataList = practiceGroupDao.findPracticeGroupsReviews(params);
-            if (dataList != null && dataList.size() > 0) {
-                List<Integer> subjectIds = dataList.stream().map(practiceGroup -> practiceGroup.getSubjectId()).distinct().collect(Collectors.toList());
-                Set<Integer> organIds = dataList.stream().map(practiceGroup -> practiceGroup.getOrganId()).collect(Collectors.toSet());
+            if (CollectionUtils.isNotEmpty(dataList)) {
+                List<Integer> subjectIds = dataList.stream().map(PracticeGroup::getSubjectId).distinct().collect(Collectors.toList());
+                Set<Integer> organIds = dataList.stream().map(PracticeGroup::getOrganId).collect(Collectors.toSet());
                 List<String> practiceGroupIds = dataList.stream().map(e -> String.valueOf(e.getId())).distinct().collect(Collectors.toList());
 
                 List<ClassGroup> classGroupsByVipGroups = classGroupDao
-                        .findByMusicGroupsAndType(practiceGroupIds.stream().map(groupId -> String.valueOf(groupId)).collect(Collectors.toList()),
+                        .findByMusicGroupsAndType(practiceGroupIds.stream().map(String::valueOf).collect(Collectors.toList()),
                                 GroupType.PRACTICE.getCode());
                 Map<String, ClassGroup> vipGroupClassGroupMap = classGroupsByVipGroups.stream().collect(Collectors.toMap(ClassGroup::getMusicGroupId, classGroup -> classGroup));
                 //当前课时,总课时
@@ -3785,7 +3785,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                 Map<Long, String> subjectNames = MapUtil.convertMybatisMap(subjectDao.findBySubjecIds(StringUtils.join(subjectIds, ",")));
                 Map<Integer, String> organNames = MapUtil.convertMybatisMap(organizationDao.findOrganNameMapList(organIds));
                 dataList.forEach(e -> {
-                    e.setSubjectName(subjectNames.get(e.getSubjectId().intValue()));
+                    e.setSubjectName(subjectNames.get(e.getSubjectId()));
                     e.setOrganName(organNames.get(e.getOrganId()));
                     ClassGroup classGroup = vipGroupClassGroupMap.get(e.getId().toString());
                     if (Objects.nonNull(classGroup)) {
@@ -3901,7 +3901,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         BigDecimal totalPrice = BigDecimal.ZERO;
         if (practice.getAllCourseNum() != null) {
             BigDecimal onlineClassNum = new BigDecimal(practice.getAllCourseNum());
-            totalPrice = practiceGroupSellPrice.getSingleClassMinutesPrice().multiply(onlineClassNum).setScale(0, BigDecimal.ROUND_CEILING);
+            totalPrice = practiceGroupSellPrice.getSingleClassMinutesPrice().multiply(onlineClassNum).setScale(0, RoundingMode.CEILING);
         }
 
         //课程购买费用计算
@@ -3918,7 +3918,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             if(vipGroupActivity.getFixedCourseNumFlag()){
                 totalPrice = vipGroupActivity.getMarketPrice();
             }else {
-                totalPrice = totalPrice.multiply(vipGroupActivity.getDiscount()).divide(new BigDecimal(100), CommonConstants.DECIMAL_PLACE, ROUND_DOWN).setScale(0, BigDecimal.ROUND_CEILING);
+                totalPrice = totalPrice.multiply(vipGroupActivity.getDiscount()).divide(new BigDecimal(100), CommonConstants.DECIMAL_PLACE, RoundingMode.DOWN).setScale(0, RoundingMode.CEILING);
             }
         }
         //教师课酬线上单课酬计算
@@ -3936,8 +3936,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         }
 
         results.put("totalPrice", totalPrice);
-        results.put("onlineTeacherSalary", teacherDefaultSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
-        results.put("giveTeacherDefaultSalary", giveTeacherDefaultSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
+        results.put("onlineTeacherSalary", teacherDefaultSalary.setScale(2, RoundingMode.HALF_UP));
+        results.put("giveTeacherDefaultSalary", giveTeacherDefaultSalary.setScale(2, RoundingMode.HALF_UP));
         return results;
     }
 
@@ -3981,8 +3981,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             }
         }
 
-        results.put("onlineTeacherSalary", teacherDefaultSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
-        results.put("giveTeacherDefaultSalary", giveTeacherDefaultSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
+        results.put("onlineTeacherSalary", teacherDefaultSalary.setScale(2, RoundingMode.HALF_UP));
+        results.put("giveTeacherDefaultSalary", giveTeacherDefaultSalary.setScale(2, RoundingMode.HALF_UP));
         return results;
     }
 
@@ -4172,15 +4172,19 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                         user.getId(),
                         DealStatusEnum.ING,
                         OrderTypeEnum.PRACTICE_GROUP_BUY);
-        if (list.size() > 0) {
+        if (CollectionUtils.isNotEmpty(list)) {
             StudentPaymentOrder applyOrder = list.get(list.size() - 1);
+            HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(applyOrder, practiceGroupBuyParams.getRepeatPay());
+            if (result.getCode() != 200) {
+                return result;
+            }
             // 查询订单状态
-            PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder);
+            /*PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder);
             if (payStatus == PayStatus.SUCCESSED) {
                 throw new BizException("订单已支付成功,请勿重复支付");
-            }/*else if(payStatus == PayStatus.PAYING){
+            }*//*else if(payStatus == PayStatus.PAYING){
                 throw new BizException("订单还在交易中,请稍后重试");
-            }*/
+            }*//*
             if (!practiceGroupBuyParams.getRepeatPay()) {
                 return BaseController.failed(HttpStatus.CONTINUE, "您有待支付的订单");
             }
@@ -4192,7 +4196,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                         PlatformCashAccountDetailTypeEnum.REFUNDS, "购买网管课支付失败");
             }
             studentPaymentOrderService.update(applyOrder);
-            sysCouponCodeService.quit(applyOrder.getCouponCodeId());
+            sysCouponCodeService.quit(applyOrder.getCouponCodeId());*/
         }
 
         ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(practiceGroupBuyParams.getPracticeGroupId().toString(), ClassGroupTypeEnum.PRACTICE.getCode());
@@ -4209,7 +4213,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 
         VipGroupActivity vipGroupActivity = null;
         if (Objects.nonNull(practiceGroup.getVipGroupActivityId())) {
-            vipGroupActivity = vipGroupActivityDao.get(practiceGroup.getVipGroupActivityId().intValue());
+            vipGroupActivity = vipGroupActivityDao.get(practiceGroup.getVipGroupActivityId());
         }
 
         if (Objects.nonNull(vipGroupActivity) && Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes()) && vipGroupActivity.getStudentMaxUsedTimes() != -1) {
@@ -4294,11 +4298,11 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
         //分类费用 course,instrument,accessories,other
-        Map<String, BigDecimal> classFee = new HashMap<>();
+        /*Map<String, BigDecimal> classFee = new HashMap<>();
         classFee.put("course", amount);
         classFee.put("instrument", BigDecimal.ZERO);
         classFee.put("accessories", BigDecimal.ZERO);
-        classFee.put("other", BigDecimal.ZERO);
+        classFee.put("other", BigDecimal.ZERO);*/
         Map<String, Object> payMap = payService.getPayMap(
                 amount,
                 balance,

+ 17 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentActivityServiceImpl.java

@@ -10,7 +10,9 @@ import java.util.stream.Collectors;
 
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.service.*;
+import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.dto.BrandDto;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.mall.MallFeignService;
 import org.apache.commons.lang.math.NumberUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -18,6 +20,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
+import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -302,7 +305,7 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Map pay(ReplacementPayDto replacementPayDto) throws Exception {
+    public HttpResponseResult pay(ReplacementPayDto replacementPayDto) throws Exception {
         ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityDao.getLock(replacementPayDto.getId());
         Integer userId = replacementInstrumentActivity.getUserId();
 
@@ -311,23 +314,27 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
         }
 
         //处理关闭订单
-        if (replacementInstrumentActivity.getPayStatus().equals(1) && replacementPayDto.getRePay()) {
+        if (replacementInstrumentActivity.getPayStatus().equals(1)/* && replacementPayDto.getRePay()*/) {
             StudentPaymentOrder oldOrder = studentPaymentOrderService.getUserReplacementIngOrder(userId, replacementInstrumentActivity.getId());
             if (oldOrder != null) {
-                
+                HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(oldOrder, replacementPayDto.getRePay());
+                if (result.getCode() != 200) {
+                    return result;
+                }
+
                 // 查询订单状态
-                PayStatus payStatus = studentPaymentOrderService.queryPayStatus(oldOrder);
+                /*PayStatus payStatus = studentPaymentOrderService.queryPayStatus(oldOrder);
                 if(payStatus != PayStatus.FAILED){
                 	if(payStatus == PayStatus.SUCCESSED){
                 		throw new BizException("订单已支付成功,请勿重复支付");
-                	}/*else if(payStatus == PayStatus.PAYING){
+                	}*//*else if(payStatus == PayStatus.PAYING){
                 		throw new BizException("订单还在交易中,请稍后重试");
-                	}*/
+                	}*//*
                 }
                 
                 oldOrder.setStatus(DealStatusEnum.FAILED);
                 oldOrder.setMemo("用户手动关闭");
-                studentPaymentOrderService.callOrderCallBack(oldOrder);
+                studentPaymentOrderService.callOrderCallBack(oldOrder);*/
             }
         }
 
@@ -390,7 +397,8 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
             notifyMap.put("channelType", channelType);
             notifyMap.put("orderNo", "");
             studentPaymentOrderService.updateOrder(notifyMap);
-            return notifyMap;
+            return BaseController.failed(HttpStatus.CREATED, notifyMap, "恭喜您,支付成功!");
+//            return notifyMap;
         }
 
         String orderSubject = "乐器置换";
@@ -414,7 +422,7 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
         studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
         studentPaymentOrder.setUpdateTime(nowDate);
         studentPaymentOrderService.update(studentPaymentOrder);
-        return payMap;
+        return BaseController.succeed(payMap);
     }
 
     @Override

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

@@ -327,28 +327,31 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
             return;
         }
         
-        List<String> orderNoList = new ArrayList<String>();
-
         for (StudentPaymentOrder payingOrder : payingOrders) {
-            //if (payingOrder.getTransNo() == null && "205".equals(payingOrder.getPaymentAccountNo()) && DateUtil.isSameDay(payingOrder.getCreateTime(), new Date())) {
-            if (payingOrder.getTransNo() == null && "205".equals(payingOrder.getPaymentAccountNo())) {
+            //查询支付超过10分钟的
+            if (DateUtil.minutesBetween(payingOrder.getCreateTime(), date) < 30) {
                 continue;
             }
+            TenantContextHolder.setTenantId(payingOrder.getTenantId());
+            //if (payingOrder.getTransNo() == null && "205".equals(payingOrder.getPaymentAccountNo()) && DateUtil.isSameDay(payingOrder.getCreateTime(), new Date())) {
             if (payingOrder.getTransNo() == null) {
-                orderNoList.add(payingOrder.getOrderNo());
-                continue;
-            }
-            //查询支付超过10分钟的
-            if (DateUtil.minutesBetween(payingOrder.getCreateTime(), date) < 10) {
-                continue;
+                if ("205".equals(payingOrder.getPaymentAccountNo())){
+                    continue;
+                }else {
+                    payingOrder.setStatus(CLOSE);
+                    payingOrder.setMemo("未拉起,超时未支付关闭");
+                    callOrderCallBack(payingOrder);
+                    continue;
+                }
             }
             try {
-            	updateOrderStatus(date, payingOrder);
+                updateOrderStatus(date, payingOrder);
             }catch (Exception e) {
-				logger.error("执行[订单状态查询]任务失败", e);
-			}
+				logger.error("执行[订单状态查询]任务失败,订单号:{}", payingOrder.getOrderNo(), e);
+			}finally {
+                TenantContextHolder.clearTenantId();
+            }
         }
-        closeOrders(orderNoList);
     }
 
     @Override
@@ -400,13 +403,30 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         OrderCancelModel  model = new OrderCancelModel();
         model.setPayChannel(paymentResp.getPaymentChannel());
 //        String status = (String) payment.get("status");
-        if (paymentResp.getPaymentStatus() == PaymentStatus.FAILED || (DateUtil.minutesBetween(DateUtil.addHours(payingOrder.getUpdateTime(), 2),date) > 0)) {
+        if (paymentResp.getPaymentStatus() == PaymentStatus.FAILED) {
             rpMap.put("remarks", paymentResp.getMsg());
             rpMap.put("tradeState", "0");
             model.setStatus(false);
         }else if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED) {
             rpMap.put("tradeState", "1");
             model.setStatus(true);
+        } else if (paymentResp.getPaymentStatus() == PaymentStatus.PENDDING) {
+            PaymentClose close = paymentService.close(payingOrder.getTransNo(), "超时未支付关闭", payingOrder.getOrderNo());
+            if (close == null) {
+                log.error("订单关闭失败,orderNo:{}", payingOrder.getOrderNo());
+                return model;
+            }
+            if (close.getStatus() == PaymentStatus.SUCCESSED) {
+                log.info("关闭订单返回:{}", close);
+                payingOrder.setStatus(CLOSE);
+                payingOrder.setMemo("超时未支付关闭");
+                callOrderCallBack(payingOrder);
+                return model;
+            } else {
+                log.info("关闭订单返回:{}", close);
+                return model;
+            }
+
         }
         /*if (status.equals("succeeded")) {
             rpMap.put("tradeState", "1");
@@ -417,8 +437,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
             model.setStatus(false);
         }*/
 
-        if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED ||
-                (paymentResp.getPaymentStatus() == PaymentStatus.FAILED || payingOrder.getCreateTime().before(DateUtil.addMinutes(new Date(), -35)))) {
+        if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED || paymentResp.getPaymentStatus() == PaymentStatus.FAILED) {
             try {
                 updateOrder(rpMap); //更新订单
                 model.setSuccess(true);
@@ -915,16 +934,17 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public PayStatus queryPayStatus(StudentPaymentOrder studentPaymentOrder) throws Exception {
-    	
+
     	String paymentChannel = studentPaymentOrder.getPaymentChannel();
     	String orderNo = studentPaymentOrder.getOrderNo();
     	String transNo = studentPaymentOrder.getTransNo();
-    	
+
         if (StringUtils.isBlank(transNo)) {
             return PayStatus.FAILED;
         }
-        
+
     	/*HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(studentPaymentOrder.getTenantId(), studentPaymentOrder.getPaymentChannel());
         if(hfMerchantConfig == null){
         	throw new BizException("机构[{}]汇付商户信息找不到", studentPaymentOrder.getTenantId());
@@ -1107,17 +1127,43 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     @Transactional(rollbackFor = Exception.class)
     public HttpResponseResult checkRepeatPay(StudentPaymentOrder order, Boolean repeatPay) throws Exception {
         // 查询订单状态
-        PayStatus payStatus = this.queryPayStatus(order);
-        if (payStatus == PayStatus.SUCCESSED) {
-            throw new BizException("订单已支付成功,请勿重复支付");
-        }
-        if (!repeatPay && payStatus == PayStatus.PAYING) {
-            return BaseController.failed(HttpStatus.CONTINUE, "您有支付中的订单,是否继续支付");
+        String paymentChannel = order.getPaymentChannel();
+        String orderNo = order.getOrderNo();
+        String transNo = order.getTransNo();
+
+        if (StringUtils.isNotEmpty(transNo)) {
+            BasePaymentService paymentService = paymentServiceContext.getPaymentService(paymentChannel + "_" + order.getTenantId());
+            if (paymentService == null) {
+                log.error("获取支付服务异常,稍后请重试,orderNo:{}", order.getOrderNo());
+                throw new BizException("获取支付服务异常,稍后请重试");
+            }
+            PaymentResp paymentResp = paymentService.query(transNo, orderNo);
+            if (paymentResp == null) {
+                log.error("订单支付状态获取异常,稍后请重试,transNo:{},orderNo:{},paymentChannel:{}", transNo, orderNo, paymentChannel);
+                throw new BizException("订单支付状态获取异常,稍后请重试");
+            }
+            if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED) {
+                throw new BizException("订单已支付成功,请勿重复支付");
+            }else if (paymentResp.getPaymentStatus() == PaymentStatus.PENDDING) {
+                if (!repeatPay) {
+                    return BaseController.failed(HttpStatus.CONTINUE, "您有支付中的订单,是否继续支付");
+                }
+                PaymentClose close = paymentService.close(order.getTransNo(), "超时未支付关闭", order.getOrderNo());
+                if (close == null) {
+                    log.error("订单关闭失败,orderNo:{}", order.getOrderNo());
+                    throw new BizException("订单关闭失败,稍后请重试");
+                }
+                if (close.getStatus() != PaymentStatus.SUCCESSED) {
+                    log.error("关闭订单失败,orderNo:{},msg:{}", order.getOrderNo(), close.getMsg());
+                    throw new BizException("关闭订单失败,稍后请重试");
+                }
+            } else {
+                return BaseController.failed("该订单已关闭,请重新购买!");
+            }
         }
         //处理关闭订单
         order.setStatus(CLOSE);
-        order.setMemo("关闭订单");
-
+        order.setMemo("用户主动关闭订单");
         
         Date nowDate = new Date();
         //增加商品库存
@@ -1312,14 +1358,18 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
             if (orderByOrderNo == null) {
                 throw new BizException("未找到原订单");
             }
+            HttpResponseResult result = this.checkRepeatPay(orderByOrderNo, true);
+            if (result.getCode() != 200) {
+                throw new BizException(result.getMsg());
+            }
             amount = orderByOrderNo.getActualAmount();
             balance = orderByOrderNo.getBalancePaymentAmount();
             // 已有订单,先关单
-            orderByOrderNo.setStatus(CLOSE);
+            /*orderByOrderNo.setStatus(CLOSE);
             orderByOrderNo.setMemo("关闭订单");
             this.update(orderByOrderNo);
             //退优惠券
-            sysCouponCodeService.quit(orderByOrderNo.getCouponCodeId());
+            sysCouponCodeService.quit(orderByOrderNo.getCouponCodeId());*/
         }
 
 
@@ -1885,8 +1935,8 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
-    public Map couponAmount(MallCreateOrderModel model) {
-        Map payMap = new HashMap();
+    public Map<String,Object> couponAmount(MallCreateOrderModel model) {
+        Map<String,Object> payMap = new HashMap(2);
         StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(model.getCouponIdList(), model.getAmount(),false);
         payMap.put("mallCouponAmount",studentPaymentOrder.getCouponRemitFee() == null?BigDecimal.ZERO:studentPaymentOrder.getCouponRemitFee());
         payMap.put("mallStatus",1);
@@ -1932,7 +1982,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
                 && e.getGroupType() != GroupType.MEMBER
                 && e.getGroupType() != GroupType.ACTIVITY
                 && e.getGroupType() != GroupType.VIP
-                && e.getGroupType() != GroupType.LIVE).map(e -> e.getId()).collect(Collectors.toList());
+                && e.getGroupType() != GroupType.LIVE).map(StudentPaymentOrder::getId).collect(Collectors.toList());
         Map<Long, List<StudentPaymentOrderExportDto>> feeByTypeMap = new HashMap<>();
         Map<Long, BigDecimal> childRepairMap = new HashMap<>();
         if (!org.springframework.util.CollectionUtils.isEmpty(otherOrderIds)) {
@@ -1943,7 +1993,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         //获取外部订单,将学校商品采购划分为大件乐器
         Map<String, StudentPaymentRouteOrder> routeOrderMap = new HashMap<>();
         List<String> outOrderNos = studentPaymentOrderExportDtos.stream().filter(e -> e.getGroupType() == GroupType.OUTORDER && e.getType() == OrderTypeEnum.SCHOOL)
-        .map(e -> e.getOrderNo()).collect(Collectors.toList());
+        .map(StudentPaymentOrder::getOrderNo).collect(Collectors.toList());
         if(CollectionUtils.isNotEmpty(outOrderNos)){
             List<StudentPaymentRouteOrder> routeOrders = studentPaymentRouteOrderService.getDao().queryByOrderNos(outOrderNos);
             if (CollectionUtils.isNotEmpty(routeOrders)){
@@ -1955,7 +2005,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
 //        List<Integer> organIds = studentPaymentOrderExportDtos.stream().map(e -> e.getOrganId()).distinct().collect(Collectors.toList());
         Map<Integer, String> userOrganNameMap = this.getMap("organization","id_","name_",true,1,Integer.class,String.class);
         //按分部分组
-        Map<Integer, List<StudentPaymentOrderExportDto>> listMap = studentPaymentOrderExportDtos.stream().collect(Collectors.groupingBy(e -> e.getOrganId()));
+        Map<Integer, List<StudentPaymentOrderExportDto>> listMap = studentPaymentOrderExportDtos.stream().collect(Collectors.groupingBy(StudentPaymentOrder::getOrganId));
         List<OperatingTotalIncomeDto> incomeDtos = new ArrayList<>();
         //承担课程的云教练收入
         String month = params.get("month").toString();
@@ -2057,15 +2107,14 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
                                 row.setDegreeFee(row.getActualAmount());
                             }else {
                                 String[] feeTypes = row.getMemo().split(";");
-                                List<String> feeTypeList = Arrays.asList(feeTypes);
-                                for (String feeTypeStr : feeTypeList) {
+                                for (String feeTypeStr : feeTypes) {
                                     int index = feeTypeStr.lastIndexOf(":");
                                     if (index < 0) {
                                         continue;
                                     }
                                     BigDecimal typeFee = new BigDecimal(feeTypeStr.substring(index + 1));
                                     if (row.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
-                                        typeFee = typeFee.multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, BigDecimal.ROUND_DOWN);
+                                        typeFee = typeFee.multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, RoundingMode.DOWN);
                                     }
                                     if (feeTypeStr.contains("VIP")) {
                                         row.setVipCourseFee(typeFee);
@@ -2243,7 +2292,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         if (CollectionUtils.isEmpty(orderSkuSyncs)) {
             return;
         }
-        List<String> orderNos = orderSkuSyncs.stream().map(e -> e.getOrderNo()).collect(Collectors.toList());
+        List<String> orderNos = orderSkuSyncs.stream().map(OrderSkuSync::getOrderNo).collect(Collectors.toList());
         List<SellOrder> sellOrders = sellOrderDao.queryByOrganNos(orderNos);
         if (CollectionUtils.isEmpty(sellOrders)) {
             return;

+ 85 - 87
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -28,7 +28,6 @@ import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.http.HttpStatus;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@@ -39,6 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
@@ -56,104 +56,103 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     @Resource
     private StudentRegistrationDao studentRegistrationDao;
-    @Autowired
+    @Resource
     private StudentPaymentOrderService studentPaymentOrderService;
-    @Autowired
+    @Resource
     private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
-    @Autowired
+    @Resource
     private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
-    @Autowired
+    @Resource
     private CourseScheduleService courseScheduleService;
-    @Autowired
+    @Resource
     private TeacherDao teacherDao;
-    @Autowired
+    @Resource
     private ClassGroupService classGroupDao;
-    @Autowired
+    @Resource
     private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
-    @Autowired
+    @Resource
     private ClassGroupStudentMapperService classGroupStudentMapperDao;
-    @Autowired
+    @Resource
     private SysMessageService sysMessageService;
-    @Autowired
+    @Resource
     private SendSeoMessageSource sendSeoMessageSource;
-    @Autowired
+    @Resource
     private MusicGroupSubjectPlanDao musicGroupSubjectPlanDao;
-    @Autowired
+    @Resource
     private SubjectDao subjectDao;
-    @Autowired
+    @Resource
     private SysUserCashAccountDao sysUserCashAccountDao;
-    @Autowired
+    @Resource
     private StudentDao studentDao;
-
     @Lazy
-    @Autowired
+    @Resource
     private ContractService contractService;
-    @Autowired
+    @Resource
     private ImFeignService imFeignService;
-    @Autowired
+    @Resource
     private ImGroupMemberService imGroupMemberService;
-    @Autowired
+    @Resource
     private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
-    @Autowired
+    @Resource
     private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
-    @Autowired
+    @Resource
     private SubjectService subjectService;
-    @Autowired
+    @Resource
     private SysConfigDao sysConfigDao;
-    @Autowired
+    @Resource
     private SysTenantConfigService sysTenantConfigService;
-    @Autowired
+    @Resource
     private MusicGroupDao musicGroupDao;
-    @Autowired
+    @Resource
     private SysUserCashAccountDetailService sysUserCashAccountDetailService;
-    @Autowired
+    @Resource
     private SysUserCashAccountService sysUserCashAccountService;
-    @Autowired
+    @Resource
     private SysUserFeignService sysUserFeignService;
-    @Autowired
+    @Resource
     private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
-    @Autowired
+    @Resource
     private SubjectChangeDao subjectChangeDao;
-    @Autowired
+    @Resource
     private GoodsDao goodsDao;
-    @Autowired
+    @Resource
     private GoodsService goodsService;
-    @Autowired
+    @Resource
     private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
-    @Autowired
+    @Resource
     private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
-    @Autowired
+    @Resource
     private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
-    @Autowired
+    @Resource
     private StudentCourseFeeDetailDao studentCourseFeeDetailDao;
-    @Autowired
+    @Resource
     private CourseScheduleDao courseScheduleDao;
-    @Autowired
+    @Resource
     private OrganizationDao organizationDao;
-    @Autowired
+    @Resource
     private StudentService studentService;
-    @Autowired
+    @Resource
     private ImGroupDao imGroupDao;
-    @Autowired
+    @Resource
     private StudentInstrumentDao studentInstrumentDao;
-    @Autowired
+    @Resource
     private MusicGroupPaymentCalenderStudentDetailDao musicGroupPaymentCalenderStudentDetailDao;
-    @Autowired
+    @Resource
     private CloudTeacherOrderService cloudTeacherOrderService;
-    @Autowired
+    @Resource
     private SysCouponCodeService sysCouponCodeService;
-    @Autowired
+    @Resource
     private SysUserCashAccountLogService sysUserCashAccountLogService;
-    @Autowired
+    @Resource
     private MusicGroupPaymentCalenderActivityService musicGroupPaymentCalenderActivityService;
-    @Autowired
+    @Resource
     private MusicGroupPaymentCalenderMemberService musicGroupPaymentCalenderMemberService;
-    @Autowired
+    @Resource
     private MusicGroupPaymentCalenderRepairService musicGroupPaymentCalenderRepairService;
 
-    @Autowired
+    @Resource
     private ImUserFriendService imUserFriendService;
-    @Autowired
+    @Resource
     private SysUserService sysUserService;
 
     @Override
@@ -367,14 +366,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailDao.findUserApplyOrder(studentId, musicGroupId,
                     DealStatusEnum.SUCCESS);
 
-            if (studentPaymentOrderDetailList != null && studentPaymentOrderDetailList.size() > 0) {
+            if (CollectionUtils.isNotEmpty(studentPaymentOrderDetailList)) {
 
                 Map<Long, StudentPaymentOrderDetail> maintenanceMap = studentPaymentOrderDetailList.stream()
                         .filter(t -> (t.getType() == MAINTENANCE))
-                        .collect(Collectors.toMap(t -> t.getStudentInstrumentId(), StudentPaymentOrderDetail -> StudentPaymentOrderDetail));
+                        .collect(Collectors.toMap(StudentPaymentOrderDetail::getStudentInstrumentId, StudentPaymentOrderDetail -> StudentPaymentOrderDetail));
 
                 List<Long> instrumentIdList = new ArrayList<Long>(maintenanceMap.keySet());
-                if (instrumentIdList != null && instrumentIdList.size() > 0) {
+                if (CollectionUtils.isNotEmpty(instrumentIdList)) {
                     List<StudentInstrument> studentInstrumentList = studentInstrumentDao.queryById(instrumentIdList);
 
                     for (StudentInstrument si : studentInstrumentList) {
@@ -418,14 +417,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public List<Map<String, Object>> getNoClassStuBySubjectId(String musicGroupId, String actualSubjectId) {
         List<StudentRegistration> students = studentRegistrationDao.getNoClassStuBySubjectId(musicGroupId, actualSubjectId);
         List<Map<String, Object>> mapArrayList = new ArrayList<>();
-        if (students != null && students.size() > 0) {
+        if (CollectionUtils.isNotEmpty(students)) {
             String[] subjectIds = actualSubjectId.split(",");
-            if (subjectIds != null && subjectIds.length > 0) {
+            if (subjectIds.length > 0) {
                 List<Map<Integer, String>> subjectNames = subjectDao.queryNameByIds(actualSubjectId);
                 Map<Integer, String> subjectNameMap = MapUtil.convertMybatisMap(subjectNames);
-                for (int i = 0; i < subjectIds.length; i++) {
+                for (String id : subjectIds) {
                     Map<String, Object> resultMap = new HashMap<>(3);
-                    int subjectId = Integer.parseInt(subjectIds[i]);
+                    int subjectId = Integer.parseInt(id);
                     List<StudentRegistration> collect = students.stream().filter(e -> e.getActualSubjectId().equals(subjectId)).collect(Collectors.toList());
                     resultMap.put("subjectId", subjectId);
                     resultMap.put("subjectName", subjectNameMap.get(subjectId));
@@ -469,7 +468,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         sysUser.setPhone(studentRegistration.getParentsPhone());
         sysUser.setOrganId(studentRegistration.getOrganId());
 
-        Boolean updateNameFlag = false;
+        boolean updateNameFlag = false;
 
         if (StringUtils.isEmpty(sysUser.getUsername())) {
             sysUser.setUsername(studentRegistration.getName());
@@ -566,13 +565,13 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetail4goodsGroup.setRemitFee(BigDecimal.ZERO);
                 OrderDetailTypeEnum type = null;
                 if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
-                    type = OrderDetailTypeEnum.MUSICAL;//todo  乐器
+                    type = OrderDetailTypeEnum.MUSICAL;//  乐器
                     goodsGroup.setPrice(goodsGroup.getPrice().subtract(remitFee));
                     studentPaymentOrderDetail4goodsGroup.setRemitFee(remitFee);
                 } else if (goodsGroup.getType().equals(GoodsType.ACCESSORIES)) {
-                    type = OrderDetailTypeEnum.ACCESSORIES;//todo 辅件
+                    type = OrderDetailTypeEnum.ACCESSORIES;// 辅件
                 } else if (goodsGroup.getType().equals(GoodsType.OTHER)) {
-                    type = OrderDetailTypeEnum.TEACHING;//todo 教谱
+                    type = OrderDetailTypeEnum.TEACHING;// 教谱
                 }
                 studentPaymentOrderDetail4goodsGroup.setType(type);
 
@@ -621,7 +620,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
         }
 
-        //新的课程形态  todo  合奏课  单技课
+        //新的课程形态    合奏课  单技课
         if (CollectionUtils.isNotEmpty(newCourses)) {
             BigDecimal courseRemitFee = goodsDto.getCourseRemitFee();
             for (MusicGroupPaymentCalenderCourseSettings newCourse : newCourses) {
@@ -655,7 +654,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
         }
 
-        //乐保 todo  乐保
+        //乐保   乐保
         if (registerPayDto.getBuyMaintenance()) {
             if (StringUtils.isEmpty(maintenanceGoodsId)) {
                 throw new BizException("有乐器才能购买乐保,请核查");
@@ -672,7 +671,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             studentPaymentOrderDetailList.add(maintenanceOrderDetail);
         }
 
-        //活动 todo  VIP 或 网管课
+        //活动   VIP 或 网管课
         List<MusicGroupPaymentCalenderActivity> calenderActivities = null;
         List<Long> buyCalenderActivityId = registerPayDto.getBuyCalenderActivityId();
         if (CollectionUtils.isNotEmpty(buyCalenderActivityId)) {
@@ -700,7 +699,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         }
 
 
-        //云教练/云教练+  todo  团练宝
+        //云教练/云教练+    团练宝
         if (buyCloudTeacher || (Objects.nonNull(calender) && calender.getPayUserType() == MusicGroupPaymentCalender.PayUserType.SCHOOL)) {
             List<MusicGroupPaymentCalenderMember> calenderMembers = new ArrayList<>();
             if(buyCloudTeacher){
@@ -827,7 +826,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                           ){
         Date date = new Date();
         List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
-        //新的课程形态  todo  合奏课  单技课
+        //新的课程形态  合奏课  单技课
         if (CollectionUtils.isNotEmpty(newCourses)) {
             for (MusicGroupPaymentCalenderCourseSettings newCourse : newCourses) {
                 StudentPaymentOrderDetail studentPaymentOrderDetailCourse = new StudentPaymentOrderDetail();
@@ -841,7 +840,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
         }
 
-        //乐保 todo  乐保
+        //乐保 乐保
         if (Objects.nonNull(calenderRepair)) {
             StudentPaymentOrderDetail maintenanceOrderDetail = new StudentPaymentOrderDetail();
             maintenanceOrderDetail.setType(MAINTENANCE);
@@ -854,7 +853,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             studentPaymentOrderDetailList.add(maintenanceOrderDetail);
         }
 
-        //活动 todo  VIP 或 网管课
+        //活动 VIP 或 网管课
         if(CollectionUtils.isNotEmpty(calenderActivities)){
             for (MusicGroupPaymentCalenderActivity calenderActivity : calenderActivities) {
                 StudentPaymentOrderDetail maintenanceOrderDetail = new StudentPaymentOrderDetail();
@@ -874,7 +873,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
         }
 
-        //云教练/云教练+  todo  团练宝
+        //云教练/云教练+   团练宝
         if(CollectionUtils.isNotEmpty(calenderMembers)){
             for (MusicGroupPaymentCalenderMember calenderMember : calenderMembers) {
                 StudentPaymentOrderDetail cloudTeacherOrderDetail = new StudentPaymentOrderDetail();
@@ -901,13 +900,12 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
      * 计算使用优惠券后的每个明细均摊的金额
      *
      * @param couponParam          优惠券的信息
-     * @param orderDetailGroupList 订单信息
      */
     private void calculateCoupon(Map<String, CouponPayTypeInfo> couponParam,List<StudentPaymentOrderDetail> paymentOrderDetails) {
         List<StudentPaymentOrderDetail> singleTypeList = new ArrayList<>();
         List<StudentPaymentOrderDetail> allTypeList = new ArrayList<>();
         paymentOrderDetails.forEach(e->e.setCouponDetailTypeEnum(CouponDetailTypeEnum.valueOf(CouponDetailTypeEnum.of(e.getType().getCode()))));
-        Map<CouponDetailTypeEnum, List<StudentPaymentOrderDetail>> orderDetailGroupList = paymentOrderDetails.stream().collect(Collectors.groupingBy(e -> e.getCouponDetailTypeEnum()));
+        Map<CouponDetailTypeEnum, List<StudentPaymentOrderDetail>> orderDetailGroupList = paymentOrderDetails.stream().collect(Collectors.groupingBy(StudentPaymentOrderDetail::getCouponDetailTypeEnum));
         //先处理”非全类型券“的数据
         orderDetailGroupList.forEach((e, list) -> {
             //根据OrderDetailTypeEnum类型找到对应的券类型,默认全类型
@@ -1116,9 +1114,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public void insertStudent(String studentIds, String oldMusicGroupId, String newMusicGroupId,
                               Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect,String batchNo) {
         //获取欠费学员列表
-        List<Integer> studentIdList = Arrays.asList(studentIds.split(",")).stream().mapToInt(idStr -> Integer.valueOf(idStr)).boxed().collect(Collectors.toList());
+        List<Integer> studentIdList = Arrays.stream(studentIds.split(",")).mapToInt(Integer::valueOf).boxed().collect(Collectors.toList());
         List<Integer> noPaymentUserIds = musicGroupPaymentCalenderDetailDao.queryNoPaymentUserIds(newMusicGroupId, studentIdList,batchNo);
-        if (noPaymentUserIds.size() > 0) {
+        if (CollectionUtils.isNotEmpty(noPaymentUserIds)) {
             throw new BizException("操作失败:有欠费的学员不允许创建缴费");
         }
         SysUser sysUser1 = sysUserFeignService.queryUserInfo();
@@ -1128,14 +1126,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         BigDecimal amount = BigDecimal.ZERO;
         for (StudentRegistration studentRegistration : studentRegistrations) {
             List<MusicGroupPaymentCalenderStudentDetail> details = collect.get(studentRegistration.getUserId());
-            BigDecimal masterTotalPrice = details.stream().map(e -> e.getCutAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
+            BigDecimal masterTotalPrice = details.stream().map(MusicGroupPaymentCalenderStudentDetail::getCutAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
             if (masterTotalPrice.doubleValue() > studentRegistration.getSurplusCourseFee().doubleValue()) {
                 throw new BizException("用户信息发生变动,请重新提交");
             }
             if (oldMusicGroupId.equals(newMusicGroupId)) {
                 continue;
             }
-            courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(oldMusicGroupId), null, GroupType.MUSIC);
+            courseScheduleStudentPaymentService.updateCourseActualPrice(Collections.singletonList(oldMusicGroupId), null, GroupType.MUSIC);
             //记录课程余额消费日志
             if (studentRegistration.getSurplusCourseFee().doubleValue() > 0d && masterTotalPrice.doubleValue() > 0d) {
                 StudentCourseFeeDetail studentCourseFeeDetail = new StudentCourseFeeDetail();
@@ -1200,7 +1198,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentCourseFeeDetails.add(studentCourseFeeDetail);
             }
         }
-        if (studentCourseFeeDetails.size() > 0) {
+        if (CollectionUtils.isNotEmpty(studentCourseFeeDetails)) {
             studentCourseFeeDetailDao.batchInsert(studentCourseFeeDetails);
         }
     }
@@ -1227,7 +1225,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 //        classGroupDao.updateClassStudentNum(classGroupId.longValue(), 1);
         //3、学生加入新班级未开始课程
         List<CourseSchedule> noStartCoursesByClassGroupId = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupId);
-        if (noStartCoursesByClassGroupId != null && noStartCoursesByClassGroupId.size() > 0) {
+        if (CollectionUtils.isNotEmpty(noStartCoursesByClassGroupId)) {
             courseScheduleList.addAll(noStartCoursesByClassGroupId);
         }
         return courseScheduleList;
@@ -1253,8 +1251,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         String snapClassIds = studentAddDto.getSnapClassIds();
         if (StringUtils.isNotEmpty(snapClassIds)) {
             String[] split = snapClassIds.split(",");
-            for (int i = 0; i < split.length; i++) {
-                addStudent(Integer.parseInt(split[i]), userId, nowDate, courseScheduleList);
+            for (String s : split) {
+                addStudent(Integer.parseInt(s), userId, nowDate, courseScheduleList);
             }
         }
         List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
@@ -1271,7 +1269,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             courseScheduleStudentPayments.add(courseScheduleStudentPayment);
         }
 
-        if (courseScheduleStudentPayments.size() == 0) {
+        if (CollectionUtils.isEmpty(courseScheduleStudentPayments)) {
             return;
         }
         courseScheduleStudentPaymentService.batchInsert(courseScheduleStudentPayments);
@@ -1728,7 +1726,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public BigDecimal updateUserSurplusCourseFee(Integer userId, String musicGroupId, BigDecimal amount, String memo, Integer operatorId) {
         StudentRegistration studentRegistration = studentRegistrationDao.lockWithUserAndMusic(userId, musicGroupId);
         if (Objects.isNull(studentRegistration)) {
-            LOGGER.error("学员{}-{}可用排课余额更新失败:学员注册信息不存在", amount);
+            LOGGER.error("学员{}-{}可用排课余额更新失败:学员注册信息不存在", userId, musicGroupId);
             return BigDecimal.ZERO;
         }
 
@@ -1806,7 +1804,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     @Override
     public List<StudentRegistration> getMusicGroupStuReBack(String musicGroupId) {
-        courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(musicGroupId), null, GroupType.MUSIC);
+        courseScheduleStudentPaymentService.updateCourseActualPrice(Collections.singletonList(musicGroupId), null, GroupType.MUSIC);
         return this.findMusicGroupStudent(musicGroupId, null);
     }
 
@@ -1922,7 +1920,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             if(totalPayNum == 0){
                 pageInfo.setPayScale(new BigDecimal(0));
             }else {
-                pageInfo.setPayScale(new BigDecimal(firstPayNum).multiply(new BigDecimal(100)).divide(new BigDecimal(totalPayNum), 2, BigDecimal.ROUND_HALF_UP));
+                pageInfo.setPayScale(new BigDecimal(firstPayNum).multiply(new BigDecimal(100)).divide(new BigDecimal(totalPayNum), 2, RoundingMode.HALF_UP));
             }
         }
 
@@ -2004,7 +2002,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
         List<StudentPaymentOrder> updateList = new ArrayList<StudentPaymentOrder>();
 
-        if (studentPaymentOrderList != null && studentPaymentOrderList.size() > 0) {
+        if (CollectionUtils.isNotEmpty(studentPaymentOrderList)) {
             for (StudentPaymentOrder studentPaymentOrder : studentPaymentOrderList) {
                 if (StringUtils.equals("205", studentPaymentOrder.getPaymentAccountNo())) {
                     studentPaymentOrder.setStatus(DealStatusEnum.CLOSE);
@@ -2015,7 +2013,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
         }
 
-        if (updateList.size() > 0) {
+        if (CollectionUtils.isNotEmpty(updateList)) {
             studentPaymentOrderService.batchUpdate(updateList);
         }
 
@@ -2051,7 +2049,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
         List<StudentPaymentOrder> updateList = new ArrayList<StudentPaymentOrder>();
 
-        if (studentPaymentOrderList != null && studentPaymentOrderList.size() > 0) {
+        if (CollectionUtils.isNotEmpty(studentPaymentOrderList)) {
             for (StudentPaymentOrder studentPaymentOrder : studentPaymentOrderList) {
                 if (StringUtils.equals("205", studentPaymentOrder.getPaymentAccountNo())) {
                     studentPaymentOrder.setStatus(DealStatusEnum.CLOSE);
@@ -2062,7 +2060,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
         }
 
-        if (updateList.size() > 0) {
+        if (CollectionUtils.isNotEmpty(updateList)) {
             studentPaymentOrderService.batchUpdate(updateList);
         }
 

+ 44 - 32
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -16,8 +16,10 @@ import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.RepairStudentQueryInfo;
 import com.ym.mec.biz.service.*;
+import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.dto.BrandDto;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
@@ -32,6 +34,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Lazy;
+import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
@@ -46,7 +49,8 @@ import java.util.stream.Collectors;
 
 import static com.ym.mec.biz.dal.enums.CouponDetailTypeEnum.ACCESSORIES;
 import static com.ym.mec.biz.dal.enums.CouponDetailTypeEnum.MUSICAL;
-import static com.ym.mec.biz.dal.enums.DealStatusEnum.*;
+import static com.ym.mec.biz.dal.enums.DealStatusEnum.ING;
+import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS;
 
 @Service
 public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRepair> implements StudentRepairService {
@@ -157,7 +161,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
-    public Map addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception {
+    public HttpResponseResult addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception {
         //关闭老订单
         StudentPaymentOrderAddress studentPaymentOrderAddress = null;
         if (StringUtils.isNotBlank(studentGoodsSell.getAddress())) {
@@ -169,7 +173,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 
         if (StringUtils.isNotEmpty(studentGoodsSell.getOrderNo())) {
             StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(studentGoodsSell.getOrderNo());
-            if (orderByOrderNo.getBalancePaymentAmount() != null && orderByOrderNo.getBalancePaymentAmount().longValue() != 0l) {
+            if (orderByOrderNo.getBalancePaymentAmount() != null && orderByOrderNo.getBalancePaymentAmount().longValue() != 0L) {
                 studentGoodsSell.setIsUseBalancePayment(true);
             } else {
                 studentGoodsSell.setIsUseBalancePayment(false);
@@ -178,15 +182,19 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             if (orderByOrderNo.getStatus() == SUCCESS) {
                 throw new BizException("您已支付请勿重复提交");
             } else if (orderByOrderNo.getStatus() == ING) {
+                HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(orderByOrderNo, true);
+                if (result.getCode() != 200) {
+                    return result;
+                }
 
                 // 查询订单状态
-                PayStatus payStatus = studentPaymentOrderService.queryPayStatus(orderByOrderNo);
+                /*PayStatus payStatus = studentPaymentOrderService.queryPayStatus(orderByOrderNo);
                 if (payStatus != PayStatus.FAILED) {
                     if (payStatus == PayStatus.SUCCESSED) {
                         throw new BizException("订单已支付成功,请勿重复支付");
-                    }/*else if(payStatus == PayStatus.PAYING){
+                    }*//*else if(payStatus == PayStatus.PAYING){
                 		throw new BizException("订单还在交易中,请稍后重试");
-                	}*/
+                	}*//*
                 }
 
                 orderByOrderNo.setStatus(CLOSE);
@@ -200,7 +208,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                 Date nowDate = new Date();
                 //增加商品库存
                 List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(orderByOrderNo.getId());
-                String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
+                String goodsIds = studentPaymentOrderDetailList.stream().map(StudentPaymentOrderDetail::getMinuendStockGoodsIdList).filter(StringUtils::isNotBlank).collect(Collectors.joining(","));
                 if (StringUtils.isNotBlank(goodsIds)) {
 //                    GoodsProcurement goodsProcurement = null;
                     List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
@@ -224,7 +232,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                         batchUpdateGoodsMap.put(goods.getId(), goods);
 
                         // 进货清单
-                        /*goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
+                        *//*goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
                         if (goodsProcurement != null) {
                             if (goodsProcurementMap.get(goodsProcurement.getId()) != null) {
                                 goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
@@ -232,18 +240,18 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                             goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
                             goodsProcurement.setUpdateTime(nowDate);
                             goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
-                        }*/
+                        }*//*
 
                     }
 
-                    /*if (goodsProcurementMap.size() > 0) {
+                    *//*if (goodsProcurementMap.size() > 0) {
                         goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
-                    }*/
+                    }*//*
 
                     if (batchUpdateGoodsMap.size() > 0) {
                         goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
                     }
-                }
+                }*/
             }
             StudentGoodsSell byOrderNo = studentGoodsSellDao.findByOrderNo(studentGoodsSell.getOrderNo());
             if (byOrderNo != null) {
@@ -326,7 +334,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         String orderNo = idGeneratorService.generatorId("payment") + "";
         studentGoodsSell.setOrderNo(orderNo);
         List<Integer> couponIdList = studentGoodsSell.getCouponIdList();
-        if (couponIdList != null && couponIdList.size() > 0) {
+        if (CollectionUtils.isNotEmpty(couponIdList)) {
             studentGoodsSell.setCouponIds(StringUtils.join(couponIdList, ","));
         }
         studentGoodsSell.setTenantId(student.getTenantId());
@@ -339,7 +347,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         if (studentGoodsSell.getType() == 1) {
             Map<String, Object> repairInfoMap = new HashMap<>();
             MapUtil.populateMap(repairInfoMap, studentGoodsSell);
-            return repairInfoMap;
+            return BaseController.succeed(repairInfoMap);
         }
 
         studentPaymentOrder.setUserId(studentId);
@@ -380,7 +388,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             notifyMap.put("merOrderNo", studentPaymentOrder.getOrderNo());
             studentPaymentOrderService.updateOrder(notifyMap);
             notifyMap.put("orderNo", orderNo);
-            return notifyMap;
+            return BaseController.failed(HttpStatus.CREATED, notifyMap,"恭喜您,购买成功!");
         }
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
@@ -399,18 +407,18 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
         studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
         studentPaymentOrderService.update(studentPaymentOrder);
-        return payMap;
+        return BaseController.succeed(payMap);
     }
 
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
-    public Map studentPaymentGoodsOrder(Integer goodsSellId) throws Exception {
+    public HttpResponseResult studentPaymentGoodsOrder(Integer goodsSellId) throws Exception {
         StudentGoodsSell studentGoodsSell = studentGoodsSellDao.get(goodsSellId);
         Integer studentId = studentGoodsSell.getUserId();
         studentService.getDao().lockUser(studentId);
         List<GoodsSellDto> goodsSellDtos = JSONObject.parseArray(studentGoodsSell.getGoodsJson(), GoodsSellDto.class);
-        List<Integer> goodsIds = goodsSellDtos.stream().map(e -> e.getGoodsId()).collect(Collectors.toList());
+        List<Integer> goodsIds = goodsSellDtos.stream().map(GoodsSellDto::getGoodsId).collect(Collectors.toList());
         Map<Integer, String> integerStringMap = getMap("goods", "id_", "type_", goodsIds, studentGoodsSell.getTenantId(), Integer.class, String.class);
         Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds, studentGoodsSell.getTenantId(), Integer.class, BigDecimal.class);
         for (GoodsSellDto goodsSellDto : goodsSellDtos) {
@@ -439,7 +447,11 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         if (StringUtils.isNotEmpty(orderNo1)) {
             studentPaymentOrder = studentPaymentOrderService.findOrderByOrderNo(orderNo1);
             if (studentPaymentOrder != null) {
-                if (studentPaymentOrder.getStatus() == DealStatusEnum.SUCCESS) {
+                HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(studentPaymentOrder, true);
+                if (result.getCode() != 200) {
+                    return result;
+                }
+                /*if (studentPaymentOrder.getStatus() == DealStatusEnum.SUCCESS) {
                     throw new BizException("该订单已支付");
                 }
                 //关闭老订单
@@ -453,7 +465,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                 if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
                     sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "关闭订单");
                 }
-                sysCouponCodeService.quit(studentPaymentOrder.getCouponCodeId());
+                sysCouponCodeService.quit(studentPaymentOrder.getCouponCodeId());*/
             }
         }
         studentGoodsSellDao.update(studentGoodsSell);
@@ -501,7 +513,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             notifyMap.put("merOrderNo", studentPaymentOrder.getOrderNo());
             studentPaymentOrderService.updateOrder(notifyMap);
             notifyMap.put("orderNo", orderNo);
-            return notifyMap;
+            return BaseController.failed(HttpStatus.CREATED, notifyMap,"恭喜您,购买成功!");
         }
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
@@ -520,7 +532,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
         studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
         studentPaymentOrderService.update(studentPaymentOrder);
-        return payMap;
+        return BaseController.succeed(payMap);
     }
 
     @Override
@@ -566,7 +578,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         String goodsJson = repairInfo.getGoodsJson();
         if (StringUtils.isNotEmpty(goodsJson)) {
             repairGoodsDtos = JSONObject.parseArray(goodsJson, RepairGoodsDto.class);
-            List<Integer> goodsIds = repairGoodsDtos.stream().map(e -> e.getId()).collect(Collectors.toList());
+            List<Integer> goodsIds = repairGoodsDtos.stream().map(RepairGoodsDto::getId).collect(Collectors.toList());
             Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds, student.getTenantId(), Integer.class, BigDecimal.class);
             repairGoodsDtos.forEach(e -> {
                 e.setGroupPurchasePrice(map.get(e.getId()));
@@ -593,7 +605,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         }
         StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(couponIdList, amount, repairInfo.getType() != 1);
         amount = studentPaymentOrder.getActualAmount();
-        if (couponIdList != null && couponIdList.size() > 0) {
+        if (CollectionUtils.isNotEmpty(couponIdList)) {
             repairInfo.setCouponIds(StringUtils.join(couponIdList, ","));
         }
         studentRepairDao.insert(repairInfo);
@@ -797,7 +809,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         StudentRepair repairInfo = studentRepairDao.getRepairInfo(id);
         String couponIds = repairInfo.getCouponIds();
         if (StringUtils.isNotEmpty(couponIds)) {
-            List<Integer> collect = Arrays.stream(couponIds.split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
+            List<Integer> collect = Arrays.stream(couponIds.split(",")).map(Integer::valueOf).collect(Collectors.toList());
             repairInfo.setCouponCodeDtos(sysCouponCodeService.findByIdList(collect));
         }
         String goodsJson = repairInfo.getGoodsJson();
@@ -835,7 +847,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         String goodsJson = studentRepair.getGoodsJson();
         if (StringUtils.isNotEmpty(goodsJson)) {
             repairGoodsDtos = JSONObject.parseArray(goodsJson, RepairGoodsDto.class);
-            BigDecimal reduce = repairGoodsDtos.stream().map(e -> e.getGroupPurchasePrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+            BigDecimal reduce = repairGoodsDtos.stream().map(RepairGoodsDto::getGroupPurchasePrice).reduce(BigDecimal.ZERO, BigDecimal::add);
             amount = amount.add(reduce);
         }
         amount = amount.subtract(studentRepair.getExemptionAmount());
@@ -952,7 +964,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             }
         }
 
-        if (studentPaymentOrderDetailList.size() > 0) {
+        if (CollectionUtils.isNotEmpty(studentPaymentOrderDetailList)) {
             studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
         }
 
@@ -987,11 +999,11 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
 
-        Map<String, BigDecimal> classFee = new HashMap<>();
+        /*Map<String, BigDecimal> classFee = new HashMap<>();
         classFee.put("course", BigDecimal.ZERO);
         classFee.put("instrument", BigDecimal.ZERO);
         classFee.put("accessories", BigDecimal.ZERO);
-        classFee.put("other", amount);
+        classFee.put("other", amount);*/
 
         Map payMap = payService.getPayMap(
                 amount,
@@ -1080,7 +1092,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 
             //增加商品库存
             List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(studentPaymentOrder.getId());
-            String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
+            String goodsIds = studentPaymentOrderDetailList.stream().map(StudentPaymentOrderDetail::getMinuendStockGoodsIdList).filter(StringUtils::isNotBlank).collect(Collectors.joining(","));
             if (StringUtils.isNotBlank(goodsIds)) {
 //                GoodsProcurement goodsProcurement = null;
                 List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
@@ -1120,7 +1132,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                     goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
                 }*/
 
-                if (batchUpdateGoodsMap.size() > 0) {
+                if (!batchUpdateGoodsMap.isEmpty()) {
                     goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
                 }
             }
@@ -1241,7 +1253,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             if (repairInfo.getType().equals(1)) { //线上
                 imContent = repairInfo.getStudentName() + "学员您好,请尽快寄送乐器至维修点,我们会尽快完成保养维修\n" +
                         "联系人:" + repairInfo.getEmployeeName() + "(" + repairInfo.getEmployeePhone() + ")\n" +
-                        "地址:" + repairInfo.getEmployeeAddress() + "";
+                        "地址:" + repairInfo.getEmployeeAddress();
 
                 sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_REPAIR_ONLINE_PAYMENT_SUCCESS, map, null, 0, null, "STUDENT",
                         repairInfo.getStudentName(), repairInfo.getEmployeeName(), repairInfo.getEmployeePhone(), repairInfo.getEmployeeAddress());

+ 22 - 15
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java

@@ -6,7 +6,9 @@ import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.SubjectChangeQueryInfo;
 import com.ym.mec.biz.service.*;
+import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.IdGeneratorService;
@@ -14,15 +16,16 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
+import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
@@ -134,15 +137,19 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Map payChange(SubjectChangeParamDto subjectChangeParamDto) throws Exception {
+    public HttpResponseResult payChange(SubjectChangeParamDto subjectChangeParamDto) throws Exception {
         Date date = new Date();
         SubjectChange subjectChange = subjectChangeDao.get(subjectChangeParamDto.getId());
         if (subjectChangeParamDto.getRepay()) {
             StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.get(subjectChange.getOrderId().longValue());
 
             if (studentPaymentOrder != null && studentPaymentOrder.getStatus() == DealStatusEnum.ING) {
+                HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(studentPaymentOrder, true);
+                if (result.getCode() != 200) {
+                    return result;
+                }
                 // 查询订单状态
-                PayStatus payStatus = studentPaymentOrderService.queryPayStatus(studentPaymentOrder);
+                /*PayStatus payStatus = studentPaymentOrderService.queryPayStatus(studentPaymentOrder);
                 if (payStatus == PayStatus.SUCCESSED) {
                     throw new BizException("订单已支付成功,请勿重复支付");
                 }
@@ -176,7 +183,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         				batchUpdateGoodsMap.put(goods.getId(), goods);
         				
         				// 进货清单
-        				/*goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
+        				*//*goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
         				if(goodsProcurement != null){
         					if(goodsProcurementMap.get(goodsProcurement.getId()) != null){
         						goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
@@ -184,18 +191,18 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         					goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
         					goodsProcurement.setUpdateTime(date);
         					goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
-        				}*/
+        				}*//*
         				
                 	}
                 	
-                	/*if(goodsProcurementMap.size() > 0){
+                	*//*if(goodsProcurementMap.size() > 0){
                 		goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
-                	}*/
+                	}*//*
                     
                     if(batchUpdateGoodsMap.size() > 0){
                     	goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
                     }
-                }
+                }*/
             }
         }
 
@@ -209,7 +216,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         HashSet<String> musicGroupIds = new HashSet<>();
         musicGroupIds.add(subjectChange.getMusicGroupId());
         List<MusicGroupPurchaseList> musicGroupPurchaseListCount = musicGroupPurchaseListDao.getCount(musicGroupIds);
-        if (musicGroupPurchaseListCount.size() > 0) {
+        if (CollectionUtils.isNotEmpty(musicGroupPurchaseListCount)) {
             throw new BizException("乐团当前状态不能缴声部更改费用");
         }
         BigDecimal amount = subjectChange.getGoodsMargin().add(subjectChange.getCourseMargin());
@@ -289,12 +296,12 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         	}
         }
     	
-    	if(subjectChange.getChangeMusical() != subjectChange.getOriginalMusical()){
+    	if(!Objects.equals(subjectChange.getChangeMusical(), subjectChange.getOriginalMusical())){
     		changeGoodsList.add(subjectChange.getChangeMusical()+"");
     	}
         
-        if(changeGoodsList.size() > 0){
-            String goodsIdsStr = changeGoodsList.stream().map(t -> t.toString()).collect(Collectors.joining(","));
+        if(CollectionUtils.isNotEmpty(changeGoodsList)){
+            String goodsIdsStr = String.join(",", changeGoodsList);
         	List<Goods> goodsList = goodsService.findGoodsByIds(goodsIdsStr);
         	Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
         	Goods goods = null;
@@ -361,7 +368,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
                 studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
         	}
             
-            if(studentPaymentOrderDetailList.size() > 0){
+            if(CollectionUtils.isNotEmpty(studentPaymentOrderDetailList)){
             	studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
             }
         }
@@ -375,7 +382,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
             notifyMap.put("orderNo", "");
             studentPaymentOrderService.updateOrder(notifyMap);
             notifyMap.put("orderNo", orderNo);
-            return notifyMap;
+            return BaseController.failed(HttpStatus.CREATED, notifyMap, "恭喜您,支付成功!");
         }
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
@@ -395,7 +402,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
         studentPaymentOrder.setUpdateTime(date);
         studentPaymentOrderService.update(studentPaymentOrder);
-        return payMap;
+        return BaseController.succeed(payMap);
     }
 
     @Override