Browse Source

Merge branch 'saas' of http://git.dayaedu.com/yonge/mec into zx_saas_cbs

# Conflicts:
#	pom.xml
zouxuan 11 months ago
parent
commit
97216a97a5
19 changed files with 162 additions and 65 deletions
  1. 2 2
      mec-application/src/main/java/com/ym/mec/student/controller/LessonCoursewareController.java
  2. 2 2
      mec-application/src/main/java/com/ym/mec/teacher/controller/LessonCoursewareController.java
  3. 1 1
      mec-application/src/main/java/com/ym/mec/web/controller/ExportController.java
  4. 8 0
      mec-application/src/main/java/com/ym/mec/web/controller/GoodsController.java
  5. 0 12
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java
  6. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentCalenderDetailDto.java
  7. 3 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Goods.java
  8. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/service/GoodsService.java
  9. 3 0
      mec-biz/src/main/java/com/ym/mec/biz/service/LessonCoursewareService.java
  10. 32 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java
  11. 62 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/LessonCoursewareServiceImpl.java
  12. 13 9
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java
  13. 11 8
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  14. 5 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  15. 3 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicScoreServiceImpl.java
  16. 9 4
      mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml
  17. 2 19
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
  18. 1 1
      mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml
  19. 1 1
      mec-common/audit-log/src/main/java/com/yonge/log/interceptor/AuditLogInterceptor.java

+ 2 - 2
mec-application/src/main/java/com/ym/mec/student/controller/LessonCoursewareController.java

@@ -64,8 +64,8 @@ public class LessonCoursewareController extends BaseController {
 
 	@ApiOperation(value = "获取课程详情")
 	@GetMapping("/getLessonCourseDetail/{id}")
-	public HttpResponseResult<CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail> getLessonCourseDetail(@PathVariable("id") String id){
-		return succeed(coursewareFeignService.lessonCoursewareDetailDetail(Long.parseLong(id)).feignData());
+	public HttpResponseResult<CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail> getLessonCourseDetail(@PathVariable("id") Long id){
+		return succeed(lessonCoursewareService.getLessonCourseDetail(id));
 	}
 
 	@ApiOperation(value = "获取课件关联的声部列表")

+ 2 - 2
mec-application/src/main/java/com/ym/mec/teacher/controller/LessonCoursewareController.java

@@ -64,8 +64,8 @@ public class LessonCoursewareController extends BaseController {
 
 	@ApiOperation(value = "获取课程详情")
 	@GetMapping("/getLessonCourseDetail/{id}")
-	public HttpResponseResult<CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail> getLessonCourseDetail(@PathVariable("id") String id){
-		return succeed(coursewareFeignService.lessonCoursewareDetailDetail(Long.parseLong(id)).feignData());
+	public HttpResponseResult<CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail> getLessonCourseDetail(@PathVariable("id") Long id){
+		return succeed(lessonCoursewareService.getLessonCourseDetail(id));
 	}
 
 	@ApiOperation(value = "获取课件关联的声部列表")

+ 1 - 1
mec-application/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -634,7 +634,7 @@ public class ExportController extends BaseController {
             HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学员编号", "学员姓名", "学员声部", "学员状态", "手机号",
                     "缴费开始日期", "缴费截止日期", "是否开启缴费", "缴费状态", "支付时间", "会员金额", "乐器金额", "课程金额", "辅件金额", "乐保金额", "活动金额"}, new String[]{
                     "userId", "sysUser.username", "studentRegistration.subjectName", "studentRegistration.musicGroupStatus.msg", "sysUser.phone",
-                    "startPaymentDateMgpc", "deadlinePaymentDateMgpc", "openFlag.msg", "paymentStatus.desc", "payTime",
+                    "startPaymentDateMgpc", "deadlinePaymentDateStr", "openFlag.msg", "paymentStatus.desc", "payTime",
                     "cloudAmount", "musicalAmount", "courseAmount", "accessoriesAmount", "maintenanceAmount", "activityAmount"}, rows);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");

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

@@ -13,6 +13,7 @@ import com.ym.mec.biz.service.GoodsCategoryService;
 import com.ym.mec.biz.service.GoodsService;
 import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -166,4 +167,11 @@ public class GoodsController extends BaseController {
     public Object queryGoodsBrandList() {
         return succeed(goodsService.queryGoodsBrandList());
     }
+
+    @ApiOperation(value = "复制商品")
+    @PostMapping("/copyGoods")
+    public HttpResponseResult<Object> copyGoods(Integer goodsId){
+        goodsService.copyGoods(goodsId);
+        return succeed();
+    }
 }

+ 0 - 12
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java

@@ -55,16 +55,6 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
      */
     MusicGroupPaymentCalender getForLock(@Param("id") Long id);
 
-    /**
-     * 根据指定乐团的缴费日期查询交集
-     *
-     * @param musicGroupId        乐团编号
-     * @param startPaymentDate    开始缴费日期
-     * @param deadlinePaymentDate 截止缴费日期
-     * @return
-     */
-    int queryIntersectionByPaymentDate(@Param("musicGroupId") String musicGroupId, @Param("startPaymentDate") Date startPaymentDate,
-                                       @Param("deadlinePaymentDate") Date deadlinePaymentDate, @Param("calenderId") Long calenderId);
 
     /**
      * 乐团最后一次交费信息
@@ -74,8 +64,6 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
      */
     MusicGroupPaymentCalender getLastStartOne(@Param("musicGroupId") String musicGroupId);
 
-    int queryIntersectionByDate(@Param("musicGroupId") String musicGroupId, @Param("startTime") String startTime, @Param("endTime") String endTime);
-
     /**
      * @param configValue:
      * @return void

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentCalenderDetailDto.java

@@ -19,4 +19,6 @@ public class MusicGroupPaymentCalenderDetailDto extends MusicGroupPaymentCalende
     private BigDecimal activityAmount = BigDecimal.ZERO;
     //课程
     private BigDecimal courseAmount = BigDecimal.ZERO;
+
+    private String deadlinePaymentDateStr;
 }

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Goods.java

@@ -197,6 +197,9 @@ public class Goods {
 
 	private String brandName;
 
+	@ApiModelProperty(value = "被复制的次数")
+	private Integer copyNum;
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/GoodsService.java

@@ -165,4 +165,6 @@ public interface GoodsService extends BaseService<Integer, Goods> {
     List<ProductCategoryDto> queryGoodsCategoryList();
 
     Map<String,String> getBrandMap();
+
+    void copyGoods(Integer goodsId);
 }

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/LessonCoursewareService.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareDetailWrapper;
 import com.ym.mec.biz.dal.mapper.LessonCoursewareMapper;
 import com.ym.mec.biz.dal.entity.LessonCourseware;
 import com.ym.mec.biz.dal.wrapper.LessonCoursewareWrapper;
@@ -18,5 +19,7 @@ public interface LessonCoursewareService extends IService<LessonCourseware> {
 
     //获取课件适用范围
     LessonCoursewareWrapper.UpdateRangeDetail getRangeType(Integer lessonCoursewareId);
+
+    CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail getLessonCourseDetail(Long id);
 }
 

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

@@ -35,6 +35,7 @@ import com.ym.mec.util.excel.POIUtil;
 import com.ym.mec.util.ini.IniFileUtil;
 import com.ym.mec.util.upload.UploadUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.math.NumberUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.ss.usermodel.PictureData;
@@ -47,7 +48,6 @@ import org.springframework.core.io.ClassPathResource;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
@@ -1512,4 +1512,35 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
         }
         return new HashMap<>();
     }
+
+    @Override
+	@Transactional(rollbackFor = Exception.class)
+    public void copyGoods(Integer goodsId) {
+		List<GoodsSub> goodsSubs = goodsSubService.lambdaQuery().eq(GoodsSub::getGoodsId, goodsId).list();
+		Goods goods = goodsDao.get(goodsId);
+		if (goods == null) {
+			throw new BizException("商品不存在");
+		}
+		Date now = new Date();
+		if(goods.getCopyNum() == null){
+			goods.setCopyNum(0);
+		}
+		//修改原有商品
+		goods.setCopyNum(goods.getCopyNum() + 1);
+		goodsDao.update(goods);
+		goods.setName(goods.getName() + "-副本" + goods.getCopyNum());
+		goods.setCopyNum(0);
+		goods.setId(null);
+		goods.setStatus(YesOrNoEnum.NO);
+		goods.setCreateTime(now);
+		goods.setUpdateTime(now);
+		goodsDao.insert(goods);
+		if(CollectionUtils.isNotEmpty(goodsSubs)){
+			List<GoodsSub> newGoodsSubs = goodsSubs.stream().peek(goodsSub -> {
+				goodsSub.setId(null);
+				goodsSub.setGoodsId(goods.getId());
+            }).collect(Collectors.toList());
+			goodsSubService.saveBatch(newGoodsSubs);
+		}
+	}
 }

+ 62 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/LessonCoursewareServiceImpl.java

@@ -2,18 +2,23 @@ package com.ym.mec.biz.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dayaedu.cbs.common.enums.school.EMaterialType;
 import com.dayaedu.cbs.openfeign.client.CoursewareFeignService;
+import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareDetailWrapper;
 import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareWrapper;
+import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsMaterialRefWrapper;
 import com.microsvc.toolkit.common.response.template.R;
 import com.ym.mec.biz.dal.dao.SubjectDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.entity.LessonCourseware;
 import com.ym.mec.biz.dal.entity.LessonCoursewareUserMapper;
+import com.ym.mec.biz.dal.entity.SysMusicScore;
 import com.ym.mec.biz.dal.mapper.LessonCoursewareMapper;
 import com.ym.mec.biz.dal.wrapper.LessonCoursewareWrapper;
 import com.ym.mec.biz.service.LessonCoursewareService;
 import com.ym.mec.biz.service.LessonCoursewareUserMapperService;
+import com.ym.mec.biz.service.SysMusicScoreService;
 import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.util.collection.MapUtil;
@@ -48,6 +53,8 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
     private SubjectDao subjectDao;
     @Resource
     private TeacherDao teacherDao;
+    @Resource
+    private SysMusicScoreService sysMusicScoreService;
 
     @Override
     public IPage<LessonCoursewareWrapper.LessonCoursewareDto> selectPage(IPage<LessonCoursewareWrapper.LessonCoursewareDto> page, LessonCoursewareWrapper.LessonCoursewareQuery query) {
@@ -183,5 +190,60 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
         return detail;
     }
 
+    @Override
+    public CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail getLessonCourseDetail(Long id) {
+        CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail detail = coursewareFeignService.lessonCoursewareDetailDetail(id).feignData();
+        if (detail == null) {
+            return null;
+        }
+        //获取知识点下的素材列表、下面关联的资源列表,如果applicationIdList是空的,那么把他剔除掉
+        this.setTreeResourceId(detail.getKnowledgePointList());
+        return detail;
+    }
+
+    //递归处理CbsLessonCoursewareDetailWrapper.KnowledgePointSmall
+    private void setTreeResourceId(List<CbsLessonCoursewareDetailWrapper.KnowledgePointSmall> knowledgePointList){
+        if(CollectionUtils.isNotEmpty(knowledgePointList)){
+            knowledgePointList.forEach(knowledgePointSmall -> {
+                this.setResourceId(knowledgePointSmall);
+                List<CbsLessonCoursewareDetailWrapper.KnowledgePointSmall> children = knowledgePointSmall.getChildren();
+                if(CollectionUtils.isNotEmpty(children)){
+                    this.setTreeResourceId(children);
+                }
+            });
+        }
+    }
+
+
+    private void setResourceId(CbsLessonCoursewareDetailWrapper.KnowledgePointSmall knowledgePointSmall){
+        List<CbsLessonCoursewareDetailWrapper.MaterialSmall> materialList = knowledgePointSmall.getMaterialList();
+        if(CollectionUtils.isNotEmpty(materialList)){
+            for (CbsLessonCoursewareDetailWrapper.MaterialSmall materialSmall : materialList) {
+                if(materialSmall.getType() == EMaterialType.SONG){
+                    SysMusicScore musicScore = sysMusicScoreService.getDao().getCbsId(Long.parseLong(materialSmall.getContent()));
+                    if(musicScore != null && musicScore.getShowFlag() == 1) {
+                        materialSmall.setContent(musicScore.getId().toString());
+                    }else {
+                        materialSmall.setContent(null);
+                    }
+                }
+                List<CbsMaterialRefWrapper.AddMaterialRef> materialRefs = materialSmall.getMaterialRefs();
+                if (CollectionUtils.isNotEmpty(materialRefs)){
+                    for (CbsMaterialRefWrapper.AddMaterialRef materialRef : materialRefs) {
+                        CbsMaterialRefWrapper.RelateMaterialInfo relateMaterialInfo = materialRef.getRelateMaterialInfo();
+                        if(relateMaterialInfo != null && StringUtils.equals(relateMaterialInfo.getType(),"SONG")
+                                && CollectionUtils.isNotEmpty(relateMaterialInfo.getApplicationIdList())){
+                            SysMusicScore musicScore = sysMusicScoreService.getDao().getCbsId(relateMaterialInfo.getId());
+                            if(musicScore != null && musicScore.getShowFlag() == 1) {
+                                materialRef.setResourceIdStr(musicScore.getId().toString());
+                            }
+                        }
+                    }
+                }
+            }
+            //剔除掉视频素材,且没有content的数据
+            materialList.removeIf(materialSmall -> materialSmall.getType() == EMaterialType.SONG && StringUtils.isEmpty(materialSmall.getContent()));
+        }
+    }
 }
 

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

@@ -20,6 +20,7 @@ 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.thirdparty.message.MessageSenderPluginContext;
+import com.ym.mec.thirdparty.yqpay.DateUtils;
 import com.ym.mec.util.collection.MapUtil;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -111,7 +112,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
                 push.put(userId, userId + "");
             }
             MusicGroup musicGroup = musicGroupDao.get(calender.getMusicGroupId());
-            String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
+            String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL_MDAYA);
             String memo = "4?" + baseUrl + "/#/musicGroupRenew?calenderId=" + calender.getId() + "&id=" + calender.getMusicGroupId();
             // 发送续费通知
             sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_WAIT_RENEW_MESSAGE, push,
@@ -423,7 +424,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
         //未缴费
         Map<Integer, String> studentMaps = MapUtil.convertMybatisMap(musicGroupPaymentCalenderDetailDao.queryNoPaymentAndNotZeroStudent(calenderId, studentIdList));
         MusicGroup musicGroup = musicGroupDao.get(paymentCalender.getMusicGroupId());
-        String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
+        String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL_MDAYA);
         String memo = "4?" + baseUrl + "/#/musicGroupRenew?calenderId=" + calenderId + "&id=" + musicGroup.getId();
         Map<Integer, String> push = new HashMap<>();
         for (Integer userId : studentIdList) {
@@ -451,23 +452,26 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
             List<StudentPaymentOrderDetail> orderDetail = studentPaymentOrderDetailDao.findByCalenderId(dataList.get(0).getMusicGroupPaymentCalenderId());
             Map<Integer, List<StudentPaymentOrderDetail>> orderDetailMap = orderDetail.stream().collect(Collectors.groupingBy(StudentPaymentOrderDetail::getUserId));
             for (MusicGroupPaymentCalenderDetailDto row : dataList) {
+                if(row.getDeadlinePaymentDateMgpc() != null){
+                    row.setDeadlinePaymentDateStr(DateUtils.formatDate(row.getDeadlinePaymentDateMgpc(), DateUtils.YYYY_MM_DD_DEF) + " 23:59:59");
+                }
                 List<StudentPaymentOrderDetail> orderDetailList = orderDetailMap.get(row.getUserId());
-                if (orderDetailList != null && orderDetailList.size() > 0) {
-                    BigDecimal totalAmount = orderDetailList.stream().map(e -> e.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+                if (CollectionUtils.isNotEmpty(orderDetailList)) {
+                    BigDecimal totalAmount = orderDetailList.stream().map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
                     //辅件
-                    BigDecimal accessoriesAmount = orderDetailList.stream().filter(e -> e.getType() == OrderDetailTypeEnum.ACCESSORIES).map(e -> e.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+                    BigDecimal accessoriesAmount = orderDetailList.stream().filter(e -> e.getType() == OrderDetailTypeEnum.ACCESSORIES).map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
                     row.setAccessoriesAmount(accessoriesAmount);
                     //会员金额
-                    BigDecimal cloudAmount = orderDetailList.stream().filter(e -> e.getType() == OrderDetailTypeEnum.CLOUD_TEACHER || e.getType() == OrderDetailTypeEnum.CLOUD_TEACHER_PLUS).map(e -> e.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+                    BigDecimal cloudAmount = orderDetailList.stream().filter(e -> e.getType() == OrderDetailTypeEnum.CLOUD_TEACHER || e.getType() == OrderDetailTypeEnum.CLOUD_TEACHER_PLUS).map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
                     row.setCloudAmount(cloudAmount);
                     //乐器
-                    BigDecimal musicalAmount = orderDetailList.stream().filter(e -> e.getType() == OrderDetailTypeEnum.MUSICAL).map(e -> e.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+                    BigDecimal musicalAmount = orderDetailList.stream().filter(e -> e.getType() == OrderDetailTypeEnum.MUSICAL).map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
                     row.setMusicalAmount(musicalAmount);
                     //乐保
-                    BigDecimal maintenanceAmount = orderDetailList.stream().filter(e -> e.getType() == OrderDetailTypeEnum.MAINTENANCE).map(e -> e.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+                    BigDecimal maintenanceAmount = orderDetailList.stream().filter(e -> e.getType() == OrderDetailTypeEnum.MAINTENANCE).map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
                     row.setMaintenanceAmount(maintenanceAmount);
                     //活动
-                    BigDecimal activityAmount = orderDetailList.stream().filter(e -> e.getType() == OrderDetailTypeEnum.PRACTICE || e.getType() == OrderDetailTypeEnum.VIP).map(e -> e.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+                    BigDecimal activityAmount = orderDetailList.stream().filter(e -> e.getType() == OrderDetailTypeEnum.PRACTICE || e.getType() == OrderDetailTypeEnum.VIP).map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
                     row.setActivityAmount(activityAmount);
 
                     totalAmount = totalAmount.subtract(accessoriesAmount).subtract(cloudAmount).subtract(musicalAmount).subtract(maintenanceAmount).subtract(activityAmount);

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

@@ -33,6 +33,7 @@ import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.mall.MallFeignService;
 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.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
@@ -192,7 +193,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
         PaymentCalenderStatusEnum status = musicGroupPaymentCalenderDto.getStatus();
 
-        Date date = new Date();
         String batchNo = idGeneratorService.generatorId() + "";
 
         MusicGroupPaymentDateRange musicGroupPaymentDateRange = musicGroupPaymentDateRangeList.get(0);
@@ -211,14 +211,14 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
         musicGroupPaymentCalender.setStartPaymentDate(musicGroupPaymentDateRange.getStartPaymentDate());
         musicGroupPaymentCalender.setStudentIds(musicGroupPaymentCalenderDto.getStudentIds());
         musicGroupPaymentCalender.setOperator(sysUser.getId());
-        musicGroupPaymentCalender.setCreateTime(date);
-        musicGroupPaymentCalender.setUpdateTime(date);
         musicGroupPaymentCalender.setStatus(status);
         musicGroupPaymentCalender.setOrganId(musicGroup.getOrganId());
         if (musicGroupPaymentCalender.getStatus() != AUDITING) {
+            Date date = new Date();
+            Date day = DateUtil.stringToDate(DateUtil.format(date, DateUtil.DEFAULT_PATTERN), DateUtil.DEFAULT_PATTERN);
             if (date.after(musicGroupPaymentCalender.getStartPaymentDate())) {
                 musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OPEN);
-            } else if (date.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
+            } else if (day.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
                 musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OVER);
             } else {
                 musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
@@ -763,9 +763,10 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
         musicGroupPaymentCalender.setStatus(status);
         musicGroupPaymentCalender.setOrganId(musicGroup.getOrganId());
         if (musicGroupPaymentCalender.getStatus() != AUDITING) {
+            Date day = DateUtil.stringToDate(DateUtil.format(date, DateUtil.DEFAULT_PATTERN), DateUtil.DEFAULT_PATTERN);
             if (date.after(musicGroupPaymentCalender.getStartPaymentDate())) {
                 musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OPEN);
-            } else if (date.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
+            } else if (day.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
                 musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OVER);
             } else {
                 musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
@@ -1028,6 +1029,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
             
             for (MusicGroupPaymentCalender musicGroupPaymentCalender : musicGroupPaymentCalenders) {
                 //如果是报名项目,将乐团改为审核中,缴费项目修改状态,审核状态改为审核通过
+                Date day = DateUtil.stringToDate(DateUtil.format(date, DateUtil.DEFAULT_PATTERN), DateUtil.DEFAULT_PATTERN);
                 if (musicGroupPaymentCalender.getPayUserType() == SCHOOL) {
                     if (musicGroupPaymentCalender.getCurrentTotalAmount().compareTo(BigDecimal.ZERO) > 0) {
                         musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OPEN);
@@ -1036,7 +1038,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
                     }
                 } else if (date.after(musicGroupPaymentCalender.getStartPaymentDate())) {
                     musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OPEN);
-                } else if (date.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
+                } else if (day.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
                     musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OVER);
                 } else {
                     musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
@@ -1409,7 +1411,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
             studentIds = musicGroupPaymentCalenderDetailDao.queryNoPaymentStudentIds(calenderId);
         }
         if (studentIds.size() > 0) {
-            String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
+            String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL_MDAYA);
             StringBuffer memo = new StringBuffer("4?").append(baseUrl).append("/#/musicGroupRenew?calenderId=").append(calenderId).append("&id=").append(musicGroup.getId());
             Map<Integer, String> push = new HashMap<>(studentIds.size());
             studentIds.forEach(e -> push.put(e, e.toString()));
@@ -1593,8 +1595,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
         List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.queryByPaymentStatus(null, statusList, PayUserType.STUDENT.getCode());
 
         List<MusicGroupPaymentCalender> updateMusicGroupPaymentCalenderList = new ArrayList<MusicGroupPaymentCalender>();
+        Date day = DateUtil.stringToDate(DateUtil.format(date, DateUtil.DEFAULT_PATTERN), DateUtil.DEFAULT_PATTERN);
         for (MusicGroupPaymentCalender mgpc : musicGroupPaymentCalenderList) {
-            if (mgpc.getDeadlinePaymentDate() != null && date.after(mgpc.getDeadlinePaymentDate()) && mgpc.getStatus() == PaymentCalenderStatusEnum.OPEN) {
+            if (mgpc.getDeadlinePaymentDate() != null && day.after(mgpc.getDeadlinePaymentDate()) && mgpc.getStatus() == PaymentCalenderStatusEnum.OPEN) {
                 // “进行中”更新至“已结束”
                 mgpc.setUpdateTime(date);
                 mgpc.setStatus(PaymentCalenderStatusEnum.OVER);

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

@@ -447,12 +447,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 				musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
 				insertMusicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
 			}
-			if (insertMusicGroupPaymentCalenderDetailList.size() > 0) {
+			if (CollectionUtils.isNotEmpty(insertMusicGroupPaymentCalenderDetailList)) {
 				musicGroupPaymentCalenderDetailDao.batchInsert(insertMusicGroupPaymentCalenderDetailList);
                 //创建学生课排课分钟数
                 Map<Integer, Long> userCalenderDetailMap = new HashMap<>(insertMusicGroupPaymentCalenderDetailList.size());
-                insertMusicGroupPaymentCalenderDetailList.stream().forEach(e -> userCalenderDetailMap.put(e.getUserId(), e.getId()));
-                Set<Integer> userIdList = studentBasicList.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
+                insertMusicGroupPaymentCalenderDetailList.forEach(e -> userCalenderDetailMap.put(e.getUserId(), e.getId()));
+                Set<Integer> userIdList = studentBasicList.stream().map(StudentImportDto::getUserId).collect(Collectors.toSet());
                 musicGroupPaymentStudentCourseDetailService.batchInsert(userIdList,musicGroupPaymentCalender,userCalenderDetailMap);
 			}
 		}
@@ -1814,7 +1814,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             if(musicGroupPaymentCalenderList == null || musicGroupPaymentCalenderList.size() == 0){
             	throw new BizException("没有审核中的缴费项目");
             }
-
+			Date day = DateUtil.stringToDate(DateUtil.format(date, DateUtil.DEFAULT_PATTERN), DateUtil.DEFAULT_PATTERN);
             musicGroupPaymentCalenderList.forEach(t -> {
                 if (t.getPayUserType() == SCHOOL) {
                     if (t.getCurrentTotalAmount().compareTo(BigDecimal.ZERO) > 0) {
@@ -1824,7 +1824,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                     }
                 } else if (date.after(t.getStartPaymentDate())) {
                     t.setStatus(PaymentCalenderStatusEnum.OPEN);
-                } else if (date.after(t.getDeadlinePaymentDate())) {
+                } else if (day.after(t.getDeadlinePaymentDate())) {
                     t.setStatus(PaymentCalenderStatusEnum.OVER);
                 } else {
                     t.setStatus(PaymentCalenderStatusEnum.NO);

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicScoreServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.beust.jcommander.internal.Lists;
 import com.dayaedu.cbs.common.enums.EClientType;
@@ -14,6 +15,7 @@ import com.dayaedu.cbs.openfeign.client.MusicFeignClientService;
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetApplicationExtendClientWrapper;
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.dayaedu.cbs.openfeign.wrapper.musicInstrument.CbsMusicalInstrumentWrapper;
+import com.google.common.collect.Maps;
 import com.microsvc.toolkit.common.response.template.R;
 import com.ym.mec.biz.dal.dao.SysMusicScoreAccompanimentDao;
 import com.ym.mec.biz.dal.dao.SysMusicScoreCategoriesDao;
@@ -34,6 +36,7 @@ import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;

+ 9 - 4
mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml

@@ -56,6 +56,7 @@
         <result column="child_organ_cost_price_" property="childOrganCostPrice"/>
         <result column="group_goods_" property="groupGoods"/>
         <result column="del_flag_" property="delFlag"/>
+        <result column="copy_num_" property="copyNum"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -81,14 +82,14 @@
          discount_price_,group_purchase_price_,brief_,desc_,is_new_,is_top_,status_,memo_,publish_time_,
          complement_goods_id_list_,update_time_,create_time_,type_,agree_cost_price_,stock_warning_,stock_type_
             ,student_show_organ_id_,education_show_organ_id_,replacement_show_organ_id_,course_fee_show_organ_id_,
-         member_fee_show_organ_id_,free_fee_show_organ_id_,tenant_id_,organ_cost_price_,group_goods_)
+         member_fee_show_organ_id_,free_fee_show_organ_id_,tenant_id_,organ_cost_price_,group_goods_,copy_num_)
         VALUES(#{goodsCategoryId},#{sn},#{name},#{brand},#{specification},#{image},#{stockCount},#{sellCount},#{marketPrice},
                #{discountPrice},#{groupPurchasePrice},#{brief},#{desc},
                #{isNew,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{isTop,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
                #{memo},#{publishTime},#{complementGoodsIdList},now(),now(),#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{agreeCostPrice},
                #{stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
                #{studentShowOrganId},#{educationShowOrganId},#{replacementShowOrganId},#{courseFeeShowOrganId},
-               #{memberFeeShowOrganId},#{freeFeeShowOrganId},#{tenantId},#{organCostPrice},#{groupGoods})
+               #{memberFeeShowOrganId},#{freeFeeShowOrganId},#{tenantId},#{organCostPrice},#{groupGoods},#{copyNum})
     </insert>
     <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
         INSERT INTO goods
@@ -96,7 +97,7 @@
         discount_price_,group_purchase_price_,brief_,desc_,update_time_,create_time_,type_,agree_cost_price_,sn_,
         stock_count_,stock_warning_,stock_type_
         ,student_show_organ_id_,education_show_organ_id_,replacement_show_organ_id_,course_fee_show_organ_id_,
-        member_fee_show_organ_id_,free_fee_show_organ_id_,tenant_id_,organ_cost_price_,group_goods_)
+        member_fee_show_organ_id_,free_fee_show_organ_id_,tenant_id_,organ_cost_price_,group_goods_,copy_num_)
         VALUES
         <foreach collection="list" separator="," item="goods">
             (#{goods.goodsCategoryId},#{goods.name},#{goods.brand},#{goods.specification},#{goods.image},#{goods.marketPrice},
@@ -106,7 +107,8 @@
             #{goods.stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             #{goods.stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             #{goods.studentShowOrganId},#{goods.educationShowOrganId},#{goods.replacementShowOrganId},
-            #{goods.courseFeeShowOrganId},#{goods.memberFeeShowOrganId},#{goods.freeFeeShowOrganId},#{goods.tenantId},#{goods.organCostPrice},#{goods.groupGoods}
+            #{goods.courseFeeShowOrganId},#{goods.memberFeeShowOrganId},#{goods.freeFeeShowOrganId},
+             #{goods.tenantId},#{goods.organCostPrice},#{goods.groupGoods},#{goods.copyNum}
             )
         </foreach>
     </insert>
@@ -141,6 +143,9 @@
             <if test="sn != null">
                 sn_ = #{sn},
             </if>
+            <if test="copyNum != null">
+                copy_num_ = #{copyNum},
+            </if>
             <if test="marketPrice != null">
                 market_price_ = #{marketPrice},
             </if>

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

@@ -64,14 +64,14 @@
             keyColumn="id_" keyProperty="id">
         INSERT INTO music_group_payment_calender
         (name_,music_group_id_,music_group_organization_course_settings_id_,pay_user_type_,reject_reason_,start_payment_date_,deadline_payment_date_,status_,expect_num_,
-        actual_num_,memo_,is_give_music_network_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,
+        actual_num_,memo_,is_give_music_network_,payment_valid_start_date_,payment_valid_end_date_,
         payment_pattern_,payment_type_,payment_amount_,batch_no_,audit_memo_,operator_,attribute1_,
          attribute2_,student_ids_,member_payment_amount_,member_rank_setting_id_,member_valid_date_
          ,original_member_payment_amount_,current_total_amount_,original_total_amount_,tenant_id_,organ_id_,
          cloud_teacher_payment_flag_,payment_item_show_state_,is_show_sale_price_,calender_fee_type_,calender_fee_json_,contract_url_)
         VALUES(#{name},#{musicGroupId},#{musicGroupOrganizationCourseSettingId},#{payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{rejectReason},#{startPaymentDate},#{deadlinePaymentDate},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-        #{expectNum},#{actualNum},#{memo},#{isGiveMusicNetwork},now(),now(),
+        #{expectNum},#{actualNum},#{memo},#{isGiveMusicNetwork},
         #{paymentValidStartDate},#{paymentValidEndDate},#{paymentPattern},#{paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{paymentAmount},#{batchNo},#{auditMemo},#{operator},#{attribute1},#{attribute2},#{studentIds},
                #{memberPaymentAmount},#{memberRankSettingId},#{memberValidDate},#{originalMemberPaymentAmount},
@@ -372,27 +372,10 @@
     <select id="getForLock" resultMap="MusicGroupPaymentCalender">
         SELECT * FROM music_group_payment_calender WHERE id_ = #{id} FOR UPDATE
     </select>
-	
-    <select id="queryIntersectionByPaymentDate" resultType="int" parameterType="map">
-        SELECT count(*) FROM music_group_payment_calender mgpc
-        WHERE music_group_id_ = #{musicGroupId} 
-        and (start_payment_date_ between #{startPaymentDate} and #{deadlinePaymentDate}
-        or deadline_payment_date_ between #{startPaymentDate} and #{deadlinePaymentDate})
-        <if test="calenderId != null">
-            AND mgpc.id_ != #{calenderId}
-        </if>
-    </select>
     
     <select id="getLastStartOne" resultMap="MusicGroupPaymentCalender">
         SELECT * FROM music_group_payment_calender WHERE music_group_id_ = #{musicGroupId} ORDER BY start_payment_date_ DESC LIMIT 1
     </select>
-    <select id="queryIntersectionByDate" resultType="java.lang.Integer">
-        SELECT COUNT(DISTINCT mgpcd.id_) FROM music_group_payment_calender mgpc
-        LEFT JOIN music_group_payment_calender_detail mgpcd ON mgpc.id_ = mgpcd.music_group_payment_calender_id_
-        WHERE mgpc.music_group_id_ = #{musicGroupId} AND mgpcd.payment_status_ != 'PAID_COMPLETED'
-        AND (DATE_FORMAT(mgpcd.start_payment_date_,'%Y-%m-%d') between #{startTime} AND #{endTime}
-        OR DATE_FORMAT(mgpcd.deadline_payment_date_,'%Y-%m-%d') between #{startTime} AND #{endTime})
-    </select>
     <select id="queryCalenderByDay" resultType="java.util.Map">
         SELECT mgpcd.music_group_payment_calender_id_ 'key',COUNT(mgpcd.payment_status_) 'value'
         FROM music_group_payment_calender_detail mgpcd

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

@@ -643,7 +643,7 @@
         MAX(cs.class_date_) class_date_,MAX(cs.start_class_time_) start_class_time_,MAX(cs.end_class_time_) end_class_time_,
         MAX(su1.real_name_) educational_teacher_name_,MAX(mg.educational_teacher_id_) educational_teacher_id_,MAX(cs.group_type_) group_type_,
         MAX(cs.actual_teacher_id_) actual_teacher_id_,MAX(su3.real_name_) actual_teacher_name_,
-        CASE WHEN MAX(sa.id_) IS NULL THEN 'TRUANT' ELSE MAX(sa.status_) END attendance_status_
+        IFNULL(MAX(sa.status_),'TRUANT') attendance_status_
         FROM course_schedule_student_payment cssp
         LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
         LEFT JOIN student_attendance sa ON cssp.course_schedule_id_ = sa.course_schedule_id_ AND sa.user_id_ = cssp.user_id_

+ 1 - 1
mec-common/audit-log/src/main/java/com/yonge/log/interceptor/AuditLogInterceptor.java

@@ -41,7 +41,7 @@ public class AuditLogInterceptor extends HandlerInterceptorAdapter {
 
     @Override
     public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
-//        syncSaveLog(request, handler);
+        syncSaveLog(request, handler);
     }
 
     public void syncSaveLog(HttpServletRequest request, Object handler) {