Jelajahi Sumber

Merge branch 'mall_order_export' of http://git.dayaedu.com/yonge/mec into master_saas

zouxuan 2 tahun lalu
induk
melakukan
48efa617bf

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentBasicInfoDao.java

@@ -9,4 +9,6 @@ public interface StudentBasicInfoDao extends BaseDAO<Integer, StudentBasicInfo>
     Integer getMaxId();
 
     void updateSubjectTeacher();
+
+    void updateStudentBasicInfo();
 }

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentStatisticsDao.java

@@ -13,6 +13,9 @@ import java.util.Map;
 public interface StudentStatisticsDao extends BaseDAO<Integer, StudentStatistics> {
 
     //更新乐团主管、指导老师
+    void updateCooperationOrgan();
+
+    //更新乐团主管、指导老师
     void updateTeacherAndEdu();
 
     //更新总课时数、已完成、剩余课时数、最近30天课耗

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

@@ -47,7 +47,7 @@ public enum ExportEnum implements BaseEnum<String, ExportEnum> {
     VIP_COURSE_REVIEWS("VIP_COURSE_REVIEWS", "VIP评论列表导出"),
     DEGREE_REGISTRATION("DEGREE_REGISTRATION", "考级报名导出"),
     COOPERATION_ORGAN("COOPERATION_ORGAN", "合作单位导出"),
-    MALL_ROUTE_ORDER_LIST("ROUTE_ORDER_LIST", "商城财务管理导出"),
+    MALL_ROUTE_ORDER_LIST("MALL_ROUTE_ORDER_LIST", "商城财务管理导出"),
     ROUTE_ORDER_LIST1("ROUTE_ORDER_LIST1", "财务管理导出1"),
     ROUTE_ORDER_LIST2("ROUTE_ORDER_LIST2", "财务管理导出2"),
     TEACHER_DEFAULT_SALARY("TEACHER_DEFAULT_SALARY", "老师默认课酬导出"),

+ 26 - 20
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java

@@ -1716,26 +1716,8 @@ public class ExportServiceImpl implements ExportService {
             }
             row.setTransferFee(transferFee);
             row.setPlatformFee(row.getActualAmount().multiply(tenantConfig.getChargeRate()).divide(new BigDecimal(1000), 2, BigDecimal.ROUND_HALF_UP));
-            if(StringUtils.isNotEmpty(row.getGoodsJson())){
-                List<JSONObject> orderItemList = JSONObject.parseArray(JSONObject.parseObject(row.getGoodsJson()).getString("orderItemList"), JSONObject.class);
-                for (JSONObject json : orderItemList) {
-                    try {
-                        String category = productCategoryMap.get(Long.parseLong(json.get("productId").toString()));
-                        BigDecimal realAmount = new BigDecimal(json.get("realAmount").toString());
-                        int index = categoryNames.indexOf(category) + 1;
-                        if(index == 0){
-                            continue;
-                        }
-                        Method method = row.getClass().getMethod("getCategory" + index, null);
-                        BigDecimal invoke = (BigDecimal)method.invoke(row);
-                        invoke = invoke.add(realAmount);
-                        Method method1 = row.getClass().getMethod("setCategory" + index, BigDecimal.class);
-                        method1.invoke(row,invoke);
-                    }catch (Exception e){
-                        e.printStackTrace();
-                    }
-                }
-            }
+            //解析json
+            this.parseGoodsJson(row,categoryNames,productCategoryMap);
             //活动购买的商品列表
             String paymentChannel = "";
             if (row.getPaymentChannel() == null) {
@@ -1761,6 +1743,30 @@ public class ExportServiceImpl implements ExportService {
         HSSFWorkbook workbook = POIUtil.exportExcel(header, body, studentPaymentOrderExportDtos);
         exportManagerDownload(workbook, managerDownload);
     }
+
+    private void parseGoodsJson(StudentPaymentOrderMallExportDto row,List<String> categoryNames,Map<Long,String> productCategoryMap){
+        if(StringUtils.isNotEmpty(row.getGoodsJson())){
+            List<JSONObject> orderItemList = JSONObject.parseArray(JSONObject.parseObject(row.getGoodsJson()).getString("orderItemList"), JSONObject.class);
+            for (JSONObject json : orderItemList) {
+                try {
+                    String category = productCategoryMap.get(Long.parseLong(json.get("productId").toString()));
+                    BigDecimal realAmount = new BigDecimal(json.get("realAmount").toString());
+                    int index = categoryNames.indexOf(category) + 1;
+                    if(index == 0){
+                        continue;
+                    }
+                    Method method = row.getClass().getMethod("getCategory" + index, null);
+                    BigDecimal invoke = (BigDecimal)method.invoke(row);
+                    invoke = invoke.add(realAmount);
+                    Method method1 = row.getClass().getMethod("setCategory" + index, BigDecimal.class);
+                    method1.invoke(row,invoke);
+                }catch (Exception e){
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
     @Override
     public void orderList(Map<String, Object> params, ManagerDownload managerDownload) {
         List<StudentPaymentOrderExportDto> studentPaymentOrderExportDtos = studentPaymentOrderService.ExportQueryPage(params);

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

@@ -43,6 +43,8 @@ public class StudentStatisticsServiceImpl extends BaseServiceImpl<Integer, Stude
 
 	@Override
 	public void updateStudentStatistics() {
+		//更新学员基本信息
+		studentBasicInfoDao.updateStudentBasicInfo();
 		RedisTemplate<String, Integer> redisTemplate = redisCache.getRedisTemplate();
 		Integer num = redisTemplate.opsForValue().get("updateStudentStatisticsNum:");
 		if(num == null || num == 1){
@@ -51,22 +53,31 @@ public class StudentStatisticsServiceImpl extends BaseServiceImpl<Integer, Stude
 			}
 			//更新未排课总数
 			studentStatisticsDao.updateNoCourseNum();
+		}else if (num == 2){
 			//更新未开始价值总和
 			studentStatisticsDao.updateNotStartCourseFee();
+		}else if (num == 3){
 			//更新未排课价值
 			studentStatisticsDao.updateNoCourseFee();
-		}else if (num == 2){
+		}else if (num == 4){
 			//更新第一次课的时间\最近一次课时间
 			studentStatisticsDao.updateFirstAndLastCourseTime();
+		}else if (num == 5){
 			//更新进行中课程组数量
 			studentStatisticsDao.updateNormalGroupNum();
+		}else if (num == 6){
 			//更新总课时数、已完成、剩余课时数、最近30天课耗、最近1年课耗
 			studentStatisticsDao.updateCourseNum();
-		} else if (num == 3) {
+		}else if (num == 7){
 			//更新声部班老师
 			studentBasicInfoDao.updateSubjectTeacher();
+		}else if (num == 8){
 			//更新乐团主管、指导老师
 			studentStatisticsDao.updateTeacherAndEdu();
+		}else if (num == 8){
+			//更新学员合作单位
+			studentStatisticsDao.updateCooperationOrgan();
+		} else if (num == 9) {
 			//更新第一次付费时间
 			studentStatisticsDao.updateFirstOrderTime();
 			num = 0;

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/StudentBasicInfoMapper.xml

@@ -101,4 +101,7 @@
 	<update id="updateSubjectTeacher">
 		SELECT updateSubjectTeacher()
 	</update>
+	<update id="updateStudentBasicInfo">
+		SELECT updateStudentBasicInfo()
+	</update>
 </mapper>

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/StudentStatisticsMapper.xml

@@ -189,6 +189,9 @@
 	<select id="queryPage" resultMap="StudentStatistics" parameterType="map">
 		SELECT * FROM student_statistics ORDER BY id_ <include refid="global.limit"/>
 	</select>
+	<update id="updateCooperationOrgan">
+		SELECT updateCooperationOrgan()
+	</update>
 	<update id="updateTeacherAndEdu">
 		SELECT updateTeacherAndEdu()
 	</update>