zouxuan 3 years ago
parent
commit
35e3cf6284

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentGoodsSellDao.java

@@ -57,7 +57,7 @@ public interface StudentGoodsSellDao extends BaseDAO<Integer, StudentGoodsSell>
      * @param autoAffirmReceiveTime:
      * @return java.util.List<java.lang.String>
      */
-    String queryNoAffirmOrderNo(String autoAffirmReceiveTime);
+    String queryNoAffirmOrderNo(@Param("autoAffirmReceiveTime") String autoAffirmReceiveTime);
 
     /**
      * @describe 自动确认收货

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

@@ -2802,7 +2802,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         if(StringUtils.isEmpty(configValue)){
             throw new BizException("请配置会员团每学期赠送课程分钟数");
         }
-        Integer giveCourseTime = Integer.parseInt(configValue);
+        Integer giveCourseTime = Integer.parseInt(configValue)>>1;
 
         Boolean confirmGenerate = false;
         if (Objects.nonNull(classGroup4MixDtos.get(0).getConfirmGenerate())) {

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

@@ -12,6 +12,7 @@ import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.redis.service.RedisCache;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
@@ -332,7 +333,13 @@ public class MusicGroupSchoolTermCourseDetailServiceImpl extends BaseServiceImpl
 		int week = DateUtil.date2Week1(startCourseDate);
 		int weekSize = DateUtil.getWeekDays(startCourseDate, courseDetail.getEndSchoolTerm(), week).size();
 		int i = weekSize * 4 * 45;
-		courseDetail.setTotalCourseTime(i > 3960?3960:i);
+		Integer tenantId = TenantContextHolder.getTenantId();
+		String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.MEMBER_GROUP_TERM_GIVE_COURSE_TIME,tenantId);
+		if(StringUtils.isEmpty(configValue)){
+			throw new BizException("请配置会员团每学期赠送课程分钟数");
+		}
+		Integer giveCourseTime = Integer.parseInt(configValue);
+		courseDetail.setTotalCourseTime(i > giveCourseTime?giveCourseTime:i);
 		courseDetail.setStartCourseDate(startCourseDate);
 		return courseDetail;
 	}

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

@@ -120,6 +120,7 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
         if(StringUtils.isEmpty(configValue)){
             throw new BizException("请配置会员团每学期赠送课程分钟数");
         }
+        Integer giveCourseTime = Integer.parseInt(configValue)>>1;
 
         //课程形态
         Map<String, Object> courseForm = JSON.parseObject(musicGroup.getCourseForm(), Map.class);
@@ -182,12 +183,12 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
 			OrganizationCourseUnitPriceSettings singleUnitPriceSettings = organizationCourseUnitPriceSettingsService.queryByOrganIdAndCourseTypeAndChargeType(musicGroup.getOrganId(), CourseScheduleType.SINGLE, musicGroup.getChargeTypeId());
 			if (singleUnitPriceSettings != null) {
 				memberCoursePrice.put(CourseScheduleType.SINGLE.name(),
-						singleUnitPriceSettings.getUnitPrice().multiply(new BigDecimal(configValue)).setScale(0, BigDecimal.ROUND_HALF_UP));
+						singleUnitPriceSettings.getUnitPrice().multiply(new BigDecimal(giveCourseTime)).setScale(0, BigDecimal.ROUND_HALF_UP));
 			}
 			OrganizationCourseUnitPriceSettings mixUnitPriceSettings = organizationCourseUnitPriceSettingsService.queryByOrganIdAndCourseTypeAndChargeType(musicGroup.getOrganId(), CourseScheduleType.MIX, musicGroup.getChargeTypeId());
 			if (mixUnitPriceSettings != null) {
 				memberCoursePrice.put(CourseScheduleType.MIX.name(),
-						mixUnitPriceSettings.getUnitPrice().multiply(new BigDecimal(configValue)).setScale(0, BigDecimal.ROUND_HALF_UP));
+						mixUnitPriceSettings.getUnitPrice().multiply(new BigDecimal(giveCourseTime)).setScale(0, BigDecimal.ROUND_HALF_UP));
 			}
 			
 			musicGroupSubjectGoodsAndInfo.setMemberCoursePrice(memberCoursePrice);

+ 15 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java

@@ -16,6 +16,7 @@ import com.ym.mec.biz.service.TenantInfoService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.util.collection.MapUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -60,10 +61,13 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());
             dataList = studentGoodsSellDao.queryStudentGoodsOrders(params);
-            Integer autoAffirmReceiveTime = Integer.parseInt(sysConfigDao.findConfigValue("auto_affirm_receive_time"));
-            dataList.forEach(e -> {
-                e.setAutoAffirmReceiveTime(autoAffirmReceiveTime);
-            });
+            Integer tenantId = TenantContextHolder.getTenantId();
+            String autoAffirmReceiveTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.AUTO_AFFIRM_RECEIVE_TIME,tenantId);
+            if(StringUtils.isNotEmpty(autoAffirmReceiveTime)){
+                dataList.forEach(e -> {
+                    e.setAutoAffirmReceiveTime(Integer.parseInt(autoAffirmReceiveTime));
+                });
+            }
         }
         if (count == 0) {
             dataList = new ArrayList<>();
@@ -111,10 +115,13 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());
             dataList = studentGoodsSellDao.queryStudentPaymentOrders(params);
-            Integer autoAffirmReceiveTime = Integer.parseInt(sysConfigDao.findConfigValue("auto_affirm_receive_time"));
-            dataList.forEach(e -> {
-                e.setAutoAffirmReceiveTime(autoAffirmReceiveTime);
-            });
+            Integer tenantId = TenantContextHolder.getTenantId();
+            String autoAffirmReceiveTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.AUTO_AFFIRM_RECEIVE_TIME,tenantId);
+            if(StringUtils.isNotEmpty(autoAffirmReceiveTime)){
+                dataList.forEach(e -> {
+                    e.setAutoAffirmReceiveTime(Integer.parseInt(autoAffirmReceiveTime));
+                });
+            }
         }
         if (count == 0) {
             dataList = new ArrayList<>();

+ 11 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -11,15 +11,13 @@ import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.page.*;
-import com.ym.mec.biz.service.CloudTeacherOrderService;
-import com.ym.mec.biz.service.StudentManageService;
-import com.ym.mec.biz.service.StudentService;
-import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.entity.ImResult;
 import com.ym.mec.common.entity.ImUserModel;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
@@ -104,6 +102,8 @@ public class StudentManageServiceImpl implements StudentManageService {
     private OrganizationDegreeCourseFeeDao organizationDegreeCourseFeeDao;
     @Autowired
     private ActivityUserMapperDao activityUserMapperDao;
+    @Autowired
+    private SysTenantConfigService sysTenantConfigService;
 
     @Override
     public PageInfo<StudentManageListDto> findStudentsByOrganId(StudentManageQueryInfo queryInfo) {
@@ -912,6 +912,12 @@ public class StudentManageServiceImpl implements StudentManageService {
         //学员请假异常提醒(获取前两个月的)
         Date date = new Date();
         PageInfo<StudentErrorLeaveDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+
+        Integer tenantId = TenantContextHolder.getTenantId();
+        String studentErrorLeaveNum = sysTenantConfigService.getTenantConfigValue(SysConfigService.STUDENT_ERROR_LEAVE_NUM, tenantId);
+        if(StringUtils.isEmpty(studentErrorLeaveNum)){
+            return pageInfo;
+        }
         Map<String, Object> params = new HashMap<>();
         MapUtil.populateMap(params, queryInfo);
         params.put("offset", pageInfo.getOffset());
@@ -931,6 +937,7 @@ public class StudentManageServiceImpl implements StudentManageService {
         List<StudentErrorLeaveDto> dataList = new ArrayList<>();
         if (count > 0) {
             //获取近两个月异常请假次数
+            params.put("studentErrorLeave",studentErrorLeaveNum);
             Map<Integer,BigDecimal> leaveNumMap = MapUtil.convertIntegerMap(indexBaseMonthDataDao.getStudentErrorLeaveNumMap(params));
             pageInfo.setTotal(count);
             dataList = indexBaseMonthDataDao.queryStudentErrorLeave(params);

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

@@ -1688,7 +1688,7 @@
 		<if test="search != null and search != ''">
 			AND (sa.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 		</if>
-		GROUP BY sa.user_id_,DATE_FORMAT(cs.class_date_,'%Y-%m') HAVING COUNT(sa.id_) > 1 AND COUNT(sa.id_) > SUM(sa.leave_visit_flag_) ORDER BY cs.class_date_ DESC)c
+		GROUP BY sa.user_id_,DATE_FORMAT(cs.class_date_,'%Y-%m') HAVING COUNT(sa.id_) >= #{studentErrorLeaveNum} AND COUNT(sa.id_) > SUM(sa.leave_visit_flag_) ORDER BY cs.class_date_ DESC)c
 		GROUP BY c.user_id_
 	</select>
 

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

@@ -94,6 +94,6 @@
 	</select>
     <select id="queryPushCourseTermMusicIds" resultType="java.lang.String">
 		SELECT music_group_id_ FROM music_group_school_term_course_detail
-		GROUP BY music_group_id_ HAVING DATEDIFF(NOW(),MAX(end_school_term_)) = #{remindCourseTime}
+		GROUP BY music_group_id_ HAVING DATEDIFF(MAX(end_school_term_),NOW()) = #{remindCourseTime}
 	</select>
 </mapper>

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

@@ -153,9 +153,9 @@
     <select id="queryNoAffirmOrderNo" resultType="java.lang.String">
 		SELECT GROUP_CONCAT(DISTINCT so.order_no_) FROM sell_order so
 		LEFT JOIN student_payment_order spo ON spo.order_no_ = so.order_no_
-		WHERE spo.status_ = 'SUCCESS'
+		WHERE spo.status_ = 'SUCCESS' AND spo.receive_status_ = 'NO_RECEIVE'
 		<if test="autoAffirmReceiveTime != null and autoAffirmReceiveTime != ''">
-			AND TIMESTAMPDIFF(HOUR,spo.pay_time_,NOW()) >= #{autoAffirmReceiveTime}
+			AND TIMESTAMPDIFF(DAY,spo.pay_time_,NOW()) >= #{autoAffirmReceiveTime}
 		</if>
 	</select>
 	<resultMap type="com.ym.mec.biz.dal.dto.StudentPaymentOrderDto" id="StudentPaymentOrderDto" extends="com.ym.mec.biz.dal.dao.StudentPaymentOrderDao.StudentPaymentOrder">

+ 8 - 0
mec-web/src/main/java/com/ym/mec/web/controller/SysTenantConfigController.java

@@ -5,6 +5,7 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.entity.SysConfig;
 import com.ym.mec.biz.service.SysTenantConfigService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.yonge.log.model.AuditLogAnnotation;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -48,4 +49,11 @@ public class SysTenantConfigController extends BaseController {
 		sysTenantConfigService.batchUpSet(sysConfigs,sysUser.getTenantId());
 		return succeed();
 	}
+
+	@ApiOperation(value = "获取单个配置")
+	@PostMapping(value = "findByName")
+    @PreAuthorize("@pcs.hasPermissions('sysTenantConfig/findByName')")
+	public Object findByName(String configName) {
+		return succeed(sysTenantConfigService.getTenantConfigValue(configName,TenantContextHolder.getTenantId()));
+	}
 }

+ 4 - 4
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -477,10 +477,10 @@ public class TaskController extends BaseController {
 	@ApiOperation("每天10点推送排课、续费提醒")
 	@GetMapping(value = "/musicSchoolTermPush")
 	public void musicSchoolTermPush() {
-		Object o = redisCache.get("musicSchoolTermPush");
-		if(o != null){
-			return;
-		}
+//		Object o = redisCache.get("musicSchoolTermPush");
+//		if(o != null){
+//			return;
+//		}
 		List<TenantInfo> tenantInfos = tenantInfoService.list(new QueryWrapper<TenantInfo>().eq("state_",1));
 		if(tenantInfos != null && tenantInfos.size() > 0){
 			for (TenantInfo tenantInfo : tenantInfos) {