Bläddra i källkod

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java
Joburgess 4 år sedan
förälder
incheckning
ca24ec3ddf

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/IndexBaseMonthDataDao.java

@@ -165,4 +165,10 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @return
      */
     List<Long> queryStudentVisit(@Param("organIdsStr") String organIdsStr);
+
+    List<IndexBaseMonthData> getFinancePayData();
+
+    List<IndexBaseMonthData> getFinanceBalanceData();
+
+    List<IndexBaseMonthData> getFinanceActualData();
 }

+ 5 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/IndexDataType.java

@@ -38,7 +38,11 @@ public enum IndexDataType implements BaseEnum<String, IndexDataType> {
 
     MUSIC_GROUP_COURSE("MUSIC_GROUP_COURSE","乐团课"),
     VIP_GROUP_COURSE("VIP_GROUP_COURSE","VIP课"),
-    PRACTICE_GROUP_COURSE("PRACTICE_GROUP_COURSE","网管课");
+    PRACTICE_GROUP_COURSE("PRACTICE_GROUP_COURSE","网管课"),
+
+    FINANCE_PAY("FINANCE_PAY","财务支出"),
+    FINANCE_BALANCE_AMOUNT("FINANCE_BALANCE_AMOUNT","余额收入"),
+    FINANCE_AMOUNT("FINANCE_AMOUNT","现金收入");
 
     private String code;
 

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

@@ -2957,10 +2957,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
     @Override
     public PageInfo<ClassGroupTeachersDto> queryClassGroupPage(ClassGroupQueryInfo queryInfo) {
+        if(queryInfo.getGroupType() == null){
+            queryInfo.setGroupType(MUSIC);
+        }
         PageInfo<ClassGroupTeachersDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
         Map<String, Object> params = new HashMap<String, Object>();
         MapUtil.populateMap(params, queryInfo);
-
+        params.put("groupType",queryInfo.getGroupType().getCode());
         List<ClassGroupTeachersDto> dataList = null;
         int count = classGroupDao.countClassGroup(params);
         if (count > 0) {

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

@@ -194,6 +194,11 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		saveData(indexBaseMonthDataDao.getGroupCourseData(dayStr, GroupType.VIP), dayStr, IndexDataType.VIP_GROUP_COURSE);
 		saveData(indexBaseMonthDataDao.getGroupCourseData(dayStr, GroupType.PRACTICE), dayStr, IndexDataType.PRACTICE_GROUP_COURSE);
 
+		//财务数据
+		saveData(indexBaseMonthDataDao.getFinancePayData(),month,IndexDataType.FINANCE_PAY);
+		saveData(indexBaseMonthDataDao.getFinanceBalanceData(),month,IndexDataType.FINANCE_BALANCE_AMOUNT);
+		saveData(indexBaseMonthDataDao.getFinanceActualData(),month,IndexDataType.FINANCE_AMOUNT);
+
 		return result;
 	}
 
@@ -334,7 +339,6 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		two.setDesc(IndexErrorType.STUDENT_INFO.getMsg());
 		List<IndexErrInfoDto> twoChild = new ArrayList<>();
 
-
 		Date firstDayOfMonth = DateUtil.getFirstDayOfMonth(DateUtil.addMonths(date, -1));
 
 		twoChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_NOT_PAYMENT, IndexErrorType.STUDENT_NOT_PAYMENT.getMsg(), indexBaseMonthDataDao.countNoPaymentStudentNum(organIds), indexBaseMonthDataDao.getNoPaymentMusicGroup(organIds)));

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

@@ -49,11 +49,11 @@ public class InspectionItemPlanConclusionServiceImpl extends BaseServiceImpl<Lon
         //时间早于/晚于计划时间当天,不能提交
         InspectionItemPlan inspectionItemPlan = inspectionItemPlanDao.get(planId);
         if (nowDate.before(DateUtil.trunc(inspectionItemPlan.getPlanStart()))) {
-            throw new BizException("提时间不能早于日程安排当天");
+            throw new BizException("提时间不能早于日程安排当天");
         }
 
         if (nowDate.after(DateUtil.getLastTimeWithDay(inspectionItemPlan.getPlanStart()))) {
-            throw new BizException("提时间不能晚于日程安排当天");
+            throw new BizException("提时间不能晚于日程安排当天");
         }
 
         inspectionItemPlanConclusionDao.delByPlanIdAndCheckItem(planId, checkItem);

+ 19 - 3
mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -1406,7 +1406,7 @@
 
     <sql id="queryClassGroupPageSql">
         <where>
-            cg.group_type_ = 'MUSIC' AND cg.del_flag_ = 0
+            cg.group_type_ = #{groupType} AND cg.del_flag_ = 0
             <if test="type != null">
                 AND type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
@@ -1420,12 +1420,28 @@
     </sql>
     <select id="countClassGroup" resultType="int">
         SELECT COUNT(cg.id_) FROM class_group cg
-        LEFT JOIN music_group mg ON mg.id_ = cg.music_group_id_
+        <if test="groupType == 'MUSIC'">
+            LEFT JOIN music_group mg ON mg.id_ = cg.music_group_id_
+        </if>
+        <if test="groupType == 'VIP'">
+            LEFT JOIN vip_group mg ON mg.id_ = cg.music_group_id_
+        </if>
+        <if test="groupType == 'PRACTICE'">
+            LEFT JOIN practice_group mg ON mg.id_ = cg.music_group_id_
+        </if>
         <include refid="queryClassGroupPageSql"/>
     </select>
     <select id="queryClassGroupPage" resultMap="ClassGroupTeachers">
         SELECT cg.*,mg.name_ music_group_name_,o.name_ organName FROM class_group cg
-        LEFT JOIN music_group mg ON mg.id_ = cg.music_group_id_
+        <if test="groupType == 'MUSIC'">
+            LEFT JOIN music_group mg ON mg.id_ = cg.music_group_id_
+        </if>
+        <if test="groupType == 'VIP'">
+            LEFT JOIN vip_group mg ON mg.id_ = cg.music_group_id_
+        </if>
+        <if test="groupType == 'PRACTICE'">
+            LEFT JOIN practice_group mg ON mg.id_ = cg.music_group_id_
+        </if>
         LEFT JOIN organization o ON o.id_ = mg.organ_id_
         <include refid="queryClassGroupPageSql"/>
         ORDER BY cg.id_ DESC

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

@@ -513,7 +513,7 @@
 		LEFT JOIN music_group mg ON mgpc.music_group_id_ = mg.id_
 		WHERE
 		mg.status_ = 'PROGRESS'
-		AND mgpc.payment_valid_end_date_ &lt; NOW()
+		AND DATE_FORMAT(NOW(),'%Y-%m-%d') >= DATE_FORMAT(mgpc.payment_valid_start_date_,'%Y-%m-%d')
 		AND mgpcd.payment_status_ = 'NON_PAYMENT'
 		<if test="organIds!=null and organIds.size()>0">
 			AND mg.organ_id_ IN
@@ -532,7 +532,7 @@
 			LEFT JOIN music_group mg ON mgpc.music_group_id_ = mg.id_
 		WHERE
 			mg.status_ = 'PROGRESS'
-			AND mgpc.payment_valid_end_date_ &lt; NOW()
+			AND DATE_FORMAT(NOW(),'%Y-%m-%d') >= DATE_FORMAT(mgpc.payment_valid_start_date_,'%Y-%m-%d')
 			AND mgpcd.payment_status_ = 'NON_PAYMENT'
 			<if test="organIds!=null and organIds.size()>0">
 				AND mg.organ_id_ IN
@@ -557,18 +557,19 @@
 
 	<select id="queryStudentAttendanceInfo" resultType="java.lang.Long">
 		SELECT
-			DISTINCT cssp.user_id_
+			DISTINCT cssp.id_
 		FROM
 			course_schedule_student_payment cssp
 			LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
 			LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cssp.course_schedule_id_ AND sa.user_id_ = cssp.user_id_
 			LEFT JOIN student_visit sv ON cssp.id_=sv.object_id_
 		WHERE
+				cs.status_ = 'OVER'
 			<if test="type!=null and type=='LEAVE'">
-				(sa.status_ = 'LEAVE' AND sa.remark_ IS NOT NULL AND sv.id_ IS NULL)
+				AND (sa.status_ = 'LEAVE' AND sa.remark_ IS NOT NULL AND sv.id_ IS NULL)
 			</if>
 			<if test="type!=null and type=='TRUANT'">
-				(sa.status_ = 'TRUANT' OR sa.id_ IS NULL)
+				AND (sa.status_ = 'TRUANT' OR sa.id_ IS NULL)
 			</if>
 			<if test="firstDayOfMonth != null">
 				AND cs.class_date_ >= DATE_FORMAT(#{firstDayOfMonth},'%Y-%m-%d')
@@ -583,7 +584,7 @@
     <select id="getAttendanceError" resultType="java.lang.Long">
 		SELECT DISTINCT ta.id_ FROM teacher_attendance ta
 		LEFT JOIN course_schedule cs ON ta.course_schedule_id_ = cs.id_
-		WHERE (ta.sign_in_status_ = 0 OR ta.sign_out_status_ = 0)
+		WHERE (ta.sign_in_status_ = 0 OR ta.sign_out_status_ = 0) AND cs.status_ = 'OVER'
 		AND (ta.sign_in_time_ IS NOT NULL OR ta.sign_out_time_ IS NOT NULL) AND ta.dispose_content_ IS NULL
 		<if test="organIds != null and organIds != ''">
 			AND FIND_IN_SET(cs.organ_id_,#{organIds})
@@ -595,7 +596,7 @@
 	<select id="getNoAttendance" resultType="java.lang.Long">
 		SELECT DISTINCT ta.id_ FROM teacher_attendance ta
 		LEFT JOIN course_schedule cs ON ta.course_schedule_id_ = cs.id_
-		WHERE ta.sign_in_time_ IS NULL AND ta.sign_out_time_ IS NULL AND ta.dispose_content_ IS NULL
+		WHERE ta.sign_in_time_ IS NULL AND cs.status_ = 'OVER' AND ta.sign_out_time_ IS NULL AND ta.dispose_content_ IS NULL
 		<if test="organIds != null and organIds != ''">
 			AND FIND_IN_SET(cs.organ_id_,#{organIds})
 		</if>
@@ -648,7 +649,7 @@
 		FROM
 			inspection_item_plan
 		WHERE
-			conclusion_status_ = 0
+			conclusion_status_ = 1
 		<if test="organIds!=null and organIds.size()>0">
 			AND organ_id_ IN
 			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
@@ -656,4 +657,25 @@
 			</foreach>
 		</if>
 	</select>
+	<select id="getFinancePayData"  resultMap="IndexBaseMonthData">
+		SELECT SUM(fe.amount_) total_num_,SUM(fe.amount_) activate_num_,SUM(fe.amount_) percent_,fe.organ_id_,DATE_FORMAT(NOW(),'%Y-%m-%d') month_ FROM financial_expenditure fe
+		WHERE DATE_FORMAT(fe.create_time_,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
+		AND del_flag_ = 0 GROUP BY fe.organ_id_
+	</select>
+	<select id="getFinanceBalanceData" resultMap="IndexBaseMonthData">
+		SELECT spo.organ_id_,SUM(CASE WHEN spo.payment_channel_ = 'BALANCE' THEN spo.balance_payment_amount_ ELSE 0 END) total_num_,
+			   SUM(CASE WHEN spo.payment_channel_ = 'BALANCE' THEN spo.balance_payment_amount_ ELSE 0 END) activate_num_,
+			   SUM(CASE WHEN spo.payment_channel_ = 'BALANCE' THEN spo.balance_payment_amount_ ELSE 0 END) percent_,DATE_FORMAT(NOW(),'%Y-%m-%d') month_
+		FROM student_payment_order spo
+		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
+		GROUP BY spo.organ_id_
+	</select>
+	<select id="getFinanceActualData" resultMap="IndexBaseMonthData">
+		SELECT spo.organ_id_,SUM(CASE WHEN spo.payment_channel_ = 'BALANCE' THEN 0 ELSE spo.actual_amount_ END) total_num_,
+			   SUM(CASE WHEN spo.payment_channel_ = 'BALANCE' THEN 0 ELSE spo.actual_amount_ END) activate_num_,
+			   SUM(CASE WHEN spo.payment_channel_ = 'BALANCE' THEN 0 ELSE spo.actual_amount_ END) percent_,DATE_FORMAT(NOW(),'%Y-%m-%d') month_
+		FROM student_payment_order spo
+		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
+		GROUP BY spo.organ_id_
+	</select>
 </mapper>

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

@@ -536,7 +536,9 @@
     </update>
 
     <select id="queryStudentNum" resultType="map">
-        SELECT count(distinct sr.user_id_) total_num_,sum(case when sr.create_time_ >= timestamp(date_add(curdate(), interval - day(curdate()) + 1 day)) then 1 else 0 end) new_num_,sum(case when sr.music_group_status_ = 'QUIT' and sr.update_time_ >= timestamp(date_add(curdate(), interval - day(curdate()) + 1 day)) then 1 else 0 end) quit_num_
+        SELECT count(distinct sr.user_id_) total_num_,
+               sum(case when sr.create_time_ >= timestamp(date_add(curdate(), interval - day(curdate()) + 1 day)) then 1 else 0 end) new_num_,
+               sum(case when sr.music_group_status_ = 'QUIT' and sr.update_time_ >= timestamp(date_add(curdate(), interval - day(curdate()) + 1 day)) then 1 else 0 end) quit_num_
         FROM student_registration sr left join music_group mg on sr.music_group_id_ = mg.id_
         where mg.organ_id_ not in (36,38)
    		<if test="organId != null">

+ 2 - 2
mec-web/src/main/java/com/ym/mec/web/controller/IndexController.java

@@ -9,6 +9,7 @@ import com.ym.mec.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
+import java.math.BigDecimal;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -100,7 +101,7 @@ public class IndexController extends BaseController {
 		Map<String, Object> incomeExpendMap = sysUserCashAccountDetailDao.queryStatisticsWithCurrentMonth(organId);
 		
 		Map<String, Object> incomeMap = studentPaymentOrderDao.queryIncomeStatisticsWithCurrentMonth(organId);
-		
+
 		ModelMap model = new ModelMap();
 		model.put("musicDatas", musicDatas);
 		model.put("teacherDatas", teacherDatas);
@@ -112,7 +113,6 @@ public class IndexController extends BaseController {
 		model.put("demoGroupNum", demoGroupNum);
 		model.put("incomeExpendMap", incomeExpendMap);
 		model.put("incomeMap", incomeMap);
-
 		return succeed(model);
 	}