Browse Source

缴费项目优化

zouxuan 3 years ago
parent
commit
e923a32631

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentBaseCalender.java

@@ -9,6 +9,9 @@ import java.util.Date;
 import java.util.List;
 
 public class MusicGroupPaymentBaseCalender {
+	@ApiModelProperty(value = "是否继续操作", required = true)
+	private Boolean confirmCreate = false;
+
 	private Long calenderId;
 
 	@ApiModelProperty(value = "乐团编号", required = true)
@@ -51,6 +54,14 @@ public class MusicGroupPaymentBaseCalender {
 	@ApiModelProperty(value = "进行中加学员拓展信息", required = false)
 	private CalenderAddStudent calenderAddStudent;
 
+	public Boolean getConfirmCreate() {
+		return confirmCreate;
+	}
+
+	public void setConfirmCreate(Boolean confirmCreate) {
+		this.confirmCreate = confirmCreate;
+	}
+
 	public Long getCalenderId() {
 		return calenderId;
 	}

+ 4 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderService.java

@@ -8,8 +8,10 @@ import java.util.Set;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
+import org.springframework.ui.ModelMap;
 
 public interface MusicGroupPaymentCalenderService extends BaseService<Long, MusicGroupPaymentCalender> {
 
@@ -25,7 +27,7 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 	 * @param musicGroupPaymentBaseCalender
 	 * @return
 	 */
-	String create1(MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender);
+	HttpResponseResult<ModelMap> create1(MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender);
 	
 	/**
 	 * 获取明细
@@ -195,7 +197,7 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 	* @author zx
 	* @date 2021/12/27 20:43
 	*/
-    String merge1(MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender);
+	HttpResponseResult<ModelMap> merge1(MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender);
 
     MusicGroupPaymentCalender getMusicGroupRegCalender(String musicGroupId);
 

+ 13 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -16,7 +16,9 @@ import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
 import com.ym.mec.biz.event.source.GroupEventSource;
 import com.ym.mec.biz.event.source.SendSeoMessageSource;
 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;
@@ -26,9 +28,11 @@ import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.ui.ModelMap;
 
 import java.math.BigDecimal;
 import java.util.*;
@@ -147,12 +151,12 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
             throw new BizException("请登录");
         }
         // 所有缴费项目已完成排课才能创建下一个缴费项目
-        String organBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null, musicGroupPaymentCalenderDto.getIgnoreBatchNoList());
+        /*String organBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null, musicGroupPaymentCalenderDto.getIgnoreBatchNoList());
         if (StringUtils.isNoneBlank(organBatchNo)) {
             if (StringUtils.isEmpty(musicGroupPaymentCalenderDto.getBatchNo()) || !musicGroupPaymentCalenderDto.getBatchNo().equals(organBatchNo)) {
                 throw new BizException("当前乐团存在未排课的缴费项目,请先完成排课再操作");
             }
-        }
+        }*/
 
         List<MusicGroupPaymentCalenderStudentDetail> calenderStudentDetails = musicGroupPaymentCalenderDto.getMusicGroupPaymentCalenderStudentDetails();
 
@@ -222,7 +226,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public String create1(MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender) {
+    public HttpResponseResult<ModelMap> create1(MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender) {
         checkObjectNull(musicGroupPaymentBaseCalender, o -> {
             throw new BizException("参数校验异常");
         });
@@ -237,19 +241,13 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
             throw new BizException("请登录");
         });
 
-//		if(musicGroupPaymentBaseCalender.getCalenderActivityList() == null
-//				&& musicGroupPaymentBaseCalender.getCalenderMember() == null
-//				&& musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList() == null
-//				&& musicGroupPaymentBaseCalender.getMusicRepair() == null){
-//			throw new BizException("请选择一个缴费项目");
-//		}
         if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS && musicGroup.getStatus() != MusicGroupStatusEnum.PRE_BUILD_FEE) {
             throw new BizException("创建缴费失败:已存在缴费项目");
         }
         // 所有缴费项目已完成排课才能创建下一个缴费项目
         String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null, null);
-        if (StringUtils.isNoneBlank(orignBatchNo)) {
-            throw new BizException("当前乐团存在未排课的缴费项目,请先完成排课再操作");
+        if (!musicGroupPaymentBaseCalender.getConfirmCreate() && StringUtils.isNoneBlank(orignBatchNo)) {
+            return BaseController.failed(HttpStatus.MULTI_STATUS,"当前乐团存在未排课的缴费项目,请再次确认操作");
         }
 
         // 不是进行中,只能创建一次缴费
@@ -426,7 +424,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
                 executor.shutdown();
             }
         }
-        return batchNo;
+        ModelMap map = new ModelMap(1);
+        map.put("musicGroupPaymentCalenderBatchNo", batchNo);
+        return BaseController.succeed(map);
     }
 
     //校验缴费项目进行中加学员
@@ -1221,7 +1221,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public String merge1(MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender) {
+    public HttpResponseResult<ModelMap> merge1(MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender) {
         del(musicGroupPaymentBaseCalender.getCalenderId());
         return create1(musicGroupPaymentBaseCalender);
     }

+ 5 - 11
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java

@@ -58,7 +58,7 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     @ApiOperation(value = "新增乐团缴费日历")
     @PostMapping(value = "/add", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/add')")
-    public Object add(@RequestBody MusicGroupPaymentCalenderDto musicGroupPaymentCalenderDto) {
+    public HttpResponseResult add(@RequestBody MusicGroupPaymentCalenderDto musicGroupPaymentCalenderDto) {
     	String batchNo = musicGroupPaymentCalenderService.create(musicGroupPaymentCalenderDto);
         ModelMap map = new ModelMap(1);
         map.put("musicGroupPaymentCalenderBatchNo", batchNo);
@@ -68,21 +68,15 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     @ApiOperation(value = "新增乐团缴费日历")
     @PostMapping(value = "/createCalender", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/createCalender')")
-    public Object createCalender(@RequestBody MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender) {
-    	String batchNo = musicGroupPaymentCalenderService.create1(musicGroupPaymentBaseCalender);
-        ModelMap map = new ModelMap(1);
-        map.put("musicGroupPaymentCalenderBatchNo", batchNo);
-        return succeed(map);
+    public HttpResponseResult<ModelMap> createCalender(@RequestBody MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender) {
+    	return musicGroupPaymentCalenderService.create1(musicGroupPaymentBaseCalender);
     }
 
     @ApiOperation(value = "修改乐团缴费日历")
     @PostMapping(value = "/updateCalender", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/updateCalender')")
-    public Object updateCalender(@RequestBody MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender) {
-    	String batchNo = musicGroupPaymentCalenderService.merge1(musicGroupPaymentBaseCalender);
-        ModelMap map = new ModelMap(1);
-        map.put("musicGroupPaymentCalenderBatchNo", batchNo);
-        return succeed(map);
+    public HttpResponseResult<ModelMap> updateCalender(@RequestBody MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender) {
+    	return musicGroupPaymentCalenderService.merge1(musicGroupPaymentBaseCalender);
     }
 
     @ApiOperation(value = "待审核的缴费项目撤回")