zouxuan 4 年之前
父节点
当前提交
38694ba46a

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalender.java

@@ -54,7 +54,7 @@ public class MusicGroupPaymentCalender {
 	}
 
 	public enum PaymentType implements BaseEnum<String, PaymentType> {
-		ADD_STUDENT("新增学员"), ADD_COURSE("临时加课"), MUSIC_COURSE("乐团课程");
+		ADD_STUDENT("新增学员"), ADD_COURSE("临时加课"), MUSIC_APPLY("乐团报名"),MUSIC_RENEW("乐团续费");
 
 		private String desc;
 

+ 12 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderCourseSettings.java

@@ -14,6 +14,9 @@ public class MusicGroupPaymentCalenderCourseSettings {
 	
 	/**  */
 	private Long musicGroupPaymentCalenderId;
+
+	/**  */
+	private String name;
 	
 	/** 课程类型 */
 	private CourseSchedule.CourseScheduleType courseType;
@@ -38,7 +41,15 @@ public class MusicGroupPaymentCalenderCourseSettings {
 	
 	/**  */
 	private java.util.Date updateTime;
-	
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
 	public void setId(Integer id){
 		this.id = id;
 	}

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

@@ -1,53 +1,40 @@
 package com.ym.mec.biz.service.impl;
 
-import java.math.BigDecimal;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.stream.Collectors;
-
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dto.CalenderPushDto;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDetailDto;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDto;
-import com.ym.mec.biz.dal.dto.SimpleUserDto;
-import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
-import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.common.page.QueryInfo;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupOrganizationCourseSettingsDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
-import com.ym.mec.biz.dal.dto.CalenderPushDto;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupOrganizationCourseSettingsDetail;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
-import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
 import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
+import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
 import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.biz.service.SysMessageService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.IdGeneratorService;
 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.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.stream.Collectors;
 
 @Service
 public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentCalender> implements MusicGroupPaymentCalenderService {
@@ -71,6 +58,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	@Autowired
 	private MusicGroupDao musicGroupDao;
 	@Autowired
+	private MusicGroupBuildLogDao musicGroupBuildLogDao;
+	@Autowired
 	private SysConfigDao sysConfigDao;
 	@Autowired
 	private SysMessageService sysMessageService;
@@ -146,9 +135,14 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			}
 			
 			//如果是报名,需要修改乐团状态
-			if (musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_COURSE) {
+			if (musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY) {
+				if(musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT){
+					throw new BizException("创建失败:缴费项目类型不匹配");
+				}
 				musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
 				musicGroup.setUpdateTime(date);
+				//记录操作日志
+				musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(草稿 -> 审核中)", sysUser.getId(), ""));
 				musicGroupDao.update(musicGroup);
 			}
 		}
@@ -275,7 +269,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			}
 			
 			//如果是报名,需要修改乐团状态
-			if (musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_COURSE) {
+			if (musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY) {
 				musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
 				musicGroup.setUpdateTime(date);
 				musicGroupDao.update(musicGroup);
@@ -404,7 +398,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			operatorIds.removeAll(Collections.singleton(null));
 			Map<Integer, String> realNameMap = getMap("sys_user", "id_", "real_name_", operatorIds, Integer.class, String.class);
 			dataList.forEach(e->{
-				e.setOperatorName(organNameMap.get(e.getOrganId()));
+				e.setOrganName(organNameMap.get(e.getOrganId()));
 				e.setOperatorName(realNameMap.get(e.getOperator()));
 			});
 		}
@@ -440,11 +434,18 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
 		}
 		//如果是报名,需要修改乐团状态
-		if (musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_COURSE) {
+		if (musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY) {
 			MusicGroup musicGroup = musicGroupDao.get(musicGroupPaymentCalender.getMusicGroupId());
 			musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
 			musicGroup.setUpdateTime(date);
 			musicGroupDao.update(musicGroup);
+			SysUser sysUser = sysUserFeignService.queryUserInfo();
+			if(sysUser == null || sysUser.getId() == null){
+				throw new BizException("请重新登录");
+			}
+			//记录操作日志
+			musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroup.getId(), "报名缴费项目通过(草稿 -> 审核中)", sysUser.getId(), ""));
+
 		}
 		musicGroupPaymentCalender.setAuditMemo(auditMemo);
 		musicGroupPaymentCalender.setUpdateTime(date);
@@ -463,7 +464,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	}
 
 	@Override
-	@Transactional(rollbackFor = Exception.class)
+	@Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
 	public boolean autoUpdateMusicGroupPaymentCalenderStatus() {
 		// 获取当天创建且未缴费的数据,并推送
 		List<MusicGroupPaymentCalenderDetail> details = musicGroupPaymentCalenderDetailDao.queryNoPaymentCanPushList();
@@ -521,15 +522,15 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 						mgpcd.setUpdateTime(date);
 						updateMusicGroupPaymentCalenderDetailList.add(mgpcd);
 
-						if (mgpc.getIsGiveMusicNetwork()) {
-							// 更新fee表,且加1
-							musicGroupStudentFee = feeMap.get(mgpcd.getUserId());
-							if (musicGroupStudentFee != null) {
-								musicGroupStudentFee.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
-								musicGroupStudentFee.setUpdateTime(date);
+						// 更新fee表,且加1
+						musicGroupStudentFee = feeMap.get(mgpcd.getUserId());
+						if (musicGroupStudentFee != null) {
+							musicGroupStudentFee.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
+							musicGroupStudentFee.setUpdateTime(date);
+							if(mgpc.getIsGiveMusicNetwork()){
 								musicGroupStudentFee.setRemainNetworkClassTimes(musicGroupStudentFee.getContinuousAbsenteeismTimes() + 1);
-								updateMusicGroupStudentFeeList.add(musicGroupStudentFee);
 							}
+							updateMusicGroupStudentFeeList.add(musicGroupStudentFee);
 						}
 					}
 				}

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

@@ -213,7 +213,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public String createGroup(SubFeeSettingDto subFeeSettingDto) throws Exception {
+    public String createGroup(SubFeeSettingDto subFeeSettingDto){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if (sysUser == null || sysUser.getId() == null) {
             throw new BizException("获取用户信息失败");

+ 13 - 9
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderCourseSettingsMapper.xml

@@ -15,6 +15,7 @@
 		<result column="course_original_price_" property="courseOriginalPrice" />
 		<result column="course_current_price_" property="courseCurrentPrice" />
 		<result column="is_student_optional_" property="isStudentOptional" />
+		<result column="name_" property="name" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 	</resultMap>
@@ -33,20 +34,23 @@
 	<insert id="insert"
 		parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings"
 		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval
-			AS ID FROM DUAL </selectKey> -->
 		INSERT INTO music_group_payment_calender_course_settings
-		(music_group_payment_calender_id_,course_type_,course_total_minuties_,unit_price_,course_original_price_,course_current_price_,is_student_optional_,create_time_,update_time_)
-		VALUES(#{musicGroupPaymentCalenderId},#{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{courseTotalMinuties},#{unitPrice},#{courseOriginalPrice},#{courseCurrentPrice},#{isStudentOptional},#{createTime},#{updateTime})
+		(music_group_payment_calender_id_,course_type_,course_total_minuties_,unit_price_,course_original_price_,
+		course_current_price_,is_student_optional_,create_time_,update_time_,name_)
+		VALUES(#{musicGroupPaymentCalenderId},#{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{courseTotalMinuties},
+		#{unitPrice},#{courseOriginalPrice},#{courseCurrentPrice},#{isStudentOptional},#{createTime},#{updateTime},#{name})
 	</insert>
 	
 	<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
 		INSERT INTO music_group_payment_calender_course_settings
-		(music_group_payment_calender_id_,course_type_,course_total_minuties_,unit_price_,course_original_price_,course_current_price_,is_student_optional_,create_time_,update_time_)
+		(music_group_payment_calender_id_,course_type_,course_total_minuties_,unit_price_,course_original_price_,
+		course_current_price_,is_student_optional_,create_time_,update_time_,name_)
 		VALUES
 		<foreach collection="list" item="item" separator=",">
-		(#{item.musicGroupPaymentCalenderId},#{item.courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.courseTotalMinuties},#{item.unitPrice},#{item.courseOriginalPrice},#{item.courseCurrentPrice},#{item.isStudentOptional},#{item.createTime},#{item.updateTime})
+		(#{item.musicGroupPaymentCalenderId},#{item.courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+		#{item.courseTotalMinuties},#{item.unitPrice},#{item.courseOriginalPrice},#{item.courseCurrentPrice},
+		#{item.isStudentOptional},#{item.createTime},#{item.updateTime},#{name})
 		</foreach>
 	</insert>
 
@@ -55,12 +59,12 @@
 		parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings">
 		UPDATE music_group_payment_calender_course_settings
 		<set>
+			<if test="name != null and name != ''">
+				name_ = #{name},
+			</if>
 			<if test="isStudentOptional != null">
 				is_student_optional_ = #{isStudentOptional},
 			</if>
-			<if test="id != null">
-				id_ = #{id},
-			</if>
 			<if test="unitPrice != null">
 				unit_price_ = #{unitPrice},
 			</if>

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

@@ -367,7 +367,7 @@
         <result property="payUserType" column="pay_user_type_"/>
         <result property="calenderSettingsName" column="calender_settings_name_"/>
         <result property="paymentPattern" column="payment_pattern_"/>
-        <result property="paymentValidEndDate" column="payment_valid_start_date_"/>
+        <result property="paymentValidStartDate" column="payment_valid_start_date_"/>
         <result property="paymentValidEndDate" column="payment_valid_end_date_"/>
         <result property="startPaymentDate" column="start_payment_date_"/>
         <result property="deadlinePaymentDate" column="deadline_payment_date_"/>
@@ -405,6 +405,7 @@
         LEFT JOIN music_group_payment_calender_course_settings mgpccs ON mgpc.id_ = mgpccs.music_group_payment_calender_id_
         <include refid="MusicGroupPaymentCalenderAuditDtoSql"/>
         GROUP BY mgpc.id_
+        ORDER BY create_time_ DESC
         <include refid="global.limit"/>
     </select>
 </mapper>

+ 29 - 0
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java

@@ -1,16 +1,24 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
 import com.ym.mec.common.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Arrays;
+import java.util.List;
+
 @RequestMapping("musicGroupPaymentCalender")
 @Api(tags = "乐团缴费日历服务")
 @RestController
@@ -18,6 +26,10 @@ public class MusicGroupPaymentCalenderController extends BaseController {
 
     @Autowired
     private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
 
     @ApiOperation(value = "分页查询乐团缴费日历列表")
     @GetMapping(value = "/queryPage", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@@ -62,6 +74,23 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     @GetMapping("/auditList")
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/auditList')")
     public Object auditList(MusicGroupPaymentCalenderQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        if(!sysUser.getIsSuperAdmin()){
+            Employee employee = employeeDao.get(sysUser.getId());
+            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+                queryInfo.setOrganId(employee.getOrganIdList());
+            }else if(StringUtils.isEmpty(employee.getOrganIdList())){
+                return failed("用户所在分部异常");
+            }else {
+                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+                if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
+                    return failed("非法请求");
+                }
+            }
+        }
         return succeed(musicGroupPaymentCalenderService.auditList(queryInfo));
     }