Browse Source

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

zouxuan 3 years ago
parent
commit
76cb05d9bf

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ImSendGroupMessage.java

@@ -34,6 +34,9 @@ public class ImSendGroupMessage {
     @ApiModelProperty(value = "文件大小")
     private Long fileSize;
 
+    @ApiModelProperty(value = "消息发送类型即时 NOW、定时发送 TIMING")
+    private String sendType = "TIMING";
+
     @ApiModelProperty(value = "消息类型(IMG,FILE)")
     private ImSendTypeEnum messageType;
 
@@ -50,6 +53,14 @@ public class ImSendGroupMessage {
 
     private Date updateTime;
 
+    public String getSendType() {
+        return sendType;
+    }
+
+    public void setSendType(String sendType) {
+        this.sendType = sendType;
+    }
+
     public String getOperator() {
         return operator;
     }

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java

@@ -132,6 +132,9 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     TEACHER_PUSH_VIP_COURSE_APPLY_RESULT("TEACHER_PUSH_VIP_COURSE_APPLY_RESULT", "VIP课申请结果"),
     TEACHER_PUSH_VIP_COURSE_ADD("TEACHER_PUSH_VIP_COURSE_ADD", "VIP课新增"),
 
+    GOOD_HABITS_TRAINING_CAMP_EXPERIENCE_QUALIFICATION_PUSH("GOOD_HABITS_TRAINING_CAMP_EXPERIENCE_QUALIFICATION_PUSH", "好习惯养成训练营体验资格"),
+    GOOD_HABITS_TRAINING_CAMP_EXPERIENCE_QUALIFICATION_SMS("GOOD_HABITS_TRAINING_CAMP_EXPERIENCE_QUALIFICATION_SMS", "好习惯养成训练营体验资格"),
+
 
     //    EDUCATION_PUSH_MUSIC_GROUP_FOUND("EDUCATION_PUSH_MUSIC_GROUP_FOUND", "乐团成立"),
 //    EDUCATION_PUSH_MUSIC_GROUP_CLOSE("EDUCATION_PUSH_MUSIC_GROUP_CLOSE", "乐团关闭"),

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/ImSendGroupMessageQueryInfo.java

@@ -15,6 +15,17 @@ public class ImSendGroupMessageQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "发送人")
     private String senderId;
 
+    @ApiModelProperty(value = "消息发送类型即时 NOW、定时发送 TIMING")
+    private String sendType;
+
+    public String getSendType() {
+        return sendType;
+    }
+
+    public void setSendType(String sendType) {
+        this.sendType = sendType;
+    }
+
     public String getSenderId() {
         return senderId;
     }

+ 8 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImLiveBroadcastRoomServiceImpl.java

@@ -473,6 +473,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
 
     //获取该直播间所有数据写入数据库-并清理缓存
     private void insertAndCleanLiveData(String roomUid, Integer speakerId) {
+        log.info("insertAndCleanLiveData >>>> roomUid : {}", roomUid);
         Date now = new Date();
         //总观看人数
         List<ImLiveBroadcastRoomMember> memberList = new ArrayList<>();
@@ -507,6 +508,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
         if (speakerCache.isExists()) {
             ImLiveBroadcastRoomData liveData = new ImLiveBroadcastRoomData();
             RoomSpeakerInfo speakerInfo = speakerCache.get();
+            log.info("insertAndCleanLiveData >>>> speakerInfo : {}", JSONObject.toJSONString(speakerInfo));
             liveData.setTenantId(speakerInfo.getTenantId());
             liveData.setRoomUid(roomUid);
             liveData.setLikeNum(like);
@@ -1191,17 +1193,20 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
      * @param nowMinutes 现在观看时长
      */
     private int getLookMinutes(Date startDT, Date endDT, Integer nowMinutes) {
+        if (Objects.isNull(nowMinutes)) {
+            nowMinutes = 0;
+        }
         if (Objects.isNull(startDT)) {
-            return 0;
+            return nowMinutes;
         }
         if (startDT.getTime() > endDT.getTime()) {
-            return 0;
+            return nowMinutes;
         }
         //课程结束时间-课程开始时间
         long durationTime = endDT.getTime() - startDT.getTime();
         //相差多少分钟
         int minutesBetween = new Long(durationTime / 1000 / 60).intValue();
-        minutesBetween += Objects.isNull(nowMinutes) ? 0 : nowMinutes;
+        minutesBetween += nowMinutes;
         return Math.max(minutesBetween, 0);
     }
 

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

@@ -10,20 +10,11 @@ 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.service.impl.BaseServiceImpl;
-import net.coobird.thumbnailator.Thumbnails;
-import org.apache.commons.codec.binary.Base64;
 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 javax.imageio.ImageIO;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.URL;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -62,6 +53,7 @@ public class ImSendGroupMessageServiceImpl extends BaseServiceImpl<Long, ImSendG
 		messageDto.setSenderId(user.getId().toString());
 		messageDto.setOperator(user.getRealName());
 		if(Objects.isNull(messageDto.getSendTime())){
+			messageDto.setSendType("NOW");
 			messageDto.setSendTime(new Date());
 			messageDto.setSendFlag(true);
 			send(messageDto);

+ 13 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberRankSettingServiceImpl.java

@@ -18,7 +18,9 @@ import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.adapay.Payment;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
+import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
+import com.ym.mec.util.http.HttpUtil;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.joda.time.LocalDate;
@@ -643,6 +645,17 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
 //                    sysCouponCodeService.exchangeCoupon(userId,giveCouponId,
 //                            studentPaymentOrder.getId(),giveCouponNum,2,null);
 //                }
+                Map<Integer, String> phoneMaps = MapUtil.convertMybatisMap(teacherDao.queryPhoneByIds(userId.toString()));
+                String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
+                StringBuffer pushUrl = new StringBuffer(baseApiUrl).append("/#/artistRegistration");
+                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.STUDENT_SMS_CLOUD_PAYMENT,phoneMaps,
+                        null,0,"",null, HttpUtil.getSortUrl(pushUrl.toString()));
+
+                StringBuffer notifyUrl = new StringBuffer("8?").append(baseApiUrl).append("/#/artistRegistration");
+                Map<Integer, String> userIdMaps = new HashMap<>(1);
+                userIdMaps.put(userId, userId.toString());
+                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.GOOD_HABITS_TRAINING_CAMP_EXPERIENCE_QUALIFICATION_PUSH,userIdMaps,
+                        null,0,notifyUrl.toString(),"STUDENT");
             }else {
                 //齐齐哈尔购买成功默认激活
                 // 活动时间:

+ 48 - 27
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TempLittleArtistTrainingCampServiceImpl.java

@@ -75,19 +75,7 @@ public class TempLittleArtistTrainingCampServiceImpl extends ServiceImpl<TempLit
     public void add(TempLittleArtistTrainingCampDto dto) {
         SysUser user = getUser();
         Date now = DateUtil.toDate(LocalDate.now().toString());
-        if (dto.getApplyEndDate().getTime() < now.getTime()) {
-            throw new BizException("报名结束时间不能小于今天");
-        }
-        if (dto.getApplyStartDate().getTime() > dto.getApplyEndDate().getTime()) {
-            throw new BizException("报名开始时间不能大于结束时间");
-        }
-        if (dto.getTrainStartDate().getTime() > dto.getTrainEndDate().getTime()) {
-            throw new BizException("训练开始时间不能大于训练结束时间");
-        }
-        //报名结束时间必需小于训练开始时间
-        if (dto.getTrainStartDate().getTime() < dto.getApplyEndDate().getTime()) {
-            throw new BizException("报名结束时间必需小于训练开始时间");
-        }
+        checkDateTime(dto, now);
         TempLittleArtistTrainingCamp entity = new TempLittleArtistTrainingCamp();
         BeanUtils.copyProperties(dto, entity);
         entity.setState(TempLittleArtistTrainingCamp.NOT_START);
@@ -107,9 +95,16 @@ public class TempLittleArtistTrainingCampServiceImpl extends ServiceImpl<TempLit
     @Override
     public void update(TempLittleArtistTrainingCampDto dto) {
         SysUser user = getUser();
+        Date now = DateUtil.toDate(LocalDate.now().toString());
+        checkDateTime(dto, now);
         TempLittleArtistTrainingCamp entity = Optional.ofNullable(dto.getId())
                 .map(this::getById)
                 .orElseThrow(() -> new BizException("训练营不存在"));
+        int count = tempLittleArtistTrainingCampUserRelationService.count(Wrappers.<TempLittleArtistTrainingCampUserRelation>lambdaQuery()
+                .eq(TempLittleArtistTrainingCampUserRelation::getActivityId, entity.getId()));
+        if (count > 0) {
+            throw new BizException("训练营已有学生报名,无法修改");
+        }
         entity.setName(dto.getName());
         entity.setApplyStartDate(dto.getApplyStartDate());
         entity.setApplyEndDate(dto.getApplyEndDate());
@@ -122,6 +117,25 @@ public class TempLittleArtistTrainingCampServiceImpl extends ServiceImpl<TempLit
     }
 
     /**
+     * 校验时间
+     */
+    private void checkDateTime(TempLittleArtistTrainingCampDto dto, Date now) {
+        if (dto.getApplyEndDate().getTime() < now.getTime()) {
+            throw new BizException("报名结束时间不能小于今天");
+        }
+        if (dto.getApplyStartDate().getTime() > dto.getApplyEndDate().getTime()) {
+            throw new BizException("报名开始时间不能大于结束时间");
+        }
+        if (dto.getTrainStartDate().getTime() > dto.getTrainEndDate().getTime()) {
+            throw new BizException("训练开始时间不能大于训练结束时间");
+        }
+        //报名结束时间必需小于训练开始时间
+        if (dto.getTrainStartDate().getTime() < dto.getApplyEndDate().getTime()) {
+            throw new BizException("报名结束时间必需小于训练开始时间");
+        }
+    }
+
+    /**
      * 删除训练营
      */
     @Transactional(rollbackFor = Exception.class)
@@ -130,6 +144,11 @@ public class TempLittleArtistTrainingCampServiceImpl extends ServiceImpl<TempLit
         TempLittleArtistTrainingCamp entity = Optional.ofNullable(id)
                 .map(this::getById)
                 .orElseThrow(() -> new BizException("训练营不存在"));
+        int count = tempLittleArtistTrainingCampUserRelationService.count(Wrappers.<TempLittleArtistTrainingCampUserRelation>lambdaQuery()
+                .eq(TempLittleArtistTrainingCampUserRelation::getActivityId, entity.getId()));
+        if (count > 0) {
+            throw new BizException("训练营已有学生报名,无法删除");
+        }
         entity.setDelFlag(1);
         this.updateById(entity);
     }
@@ -295,15 +314,14 @@ public class TempLittleArtistTrainingCampServiceImpl extends ServiceImpl<TempLit
         Map<String, Object> result = new HashMap<>();
         result.put("user", userRelation);
         if (CollectionUtils.isNotEmpty(campList)) {
-            campList.sort(Comparator.comparing(TempLittleArtistTrainingCamp::getApplyStartDate));
-        }
-        if (CollectionUtils.isNotEmpty(campList)) {
-            campList.forEach(a -> {
-                int count = tempLittleArtistTrainingCampUserRelationService.count(Wrappers.<TempLittleArtistTrainingCampUserRelation>lambdaQuery()
-                        .eq(TempLittleArtistTrainingCampUserRelation::getActivityId, a.getId())
-                );
-                a.setUserCount(count);
-            });
+            campList = campList.stream()
+                    .peek(a -> {
+                        int count = tempLittleArtistTrainingCampUserRelationService.count(Wrappers.<TempLittleArtistTrainingCampUserRelation>lambdaQuery()
+                                .eq(TempLittleArtistTrainingCampUserRelation::getActivityId, a.getId()));
+                        a.setUserCount(count);
+                    })
+                    .sorted(Comparator.comparing(TempLittleArtistTrainingCamp::getApplyStartDate))
+                    .collect(Collectors.toList());
         }
         result.put("campList", campList);
         return result;
@@ -445,23 +463,26 @@ public class TempLittleArtistTrainingCampServiceImpl extends ServiceImpl<TempLit
         SysUser user = getUser();
         //查询训练营人员关系
         TempLittleArtistTrainingCampUserRelation campUser = tempLittleArtistTrainingCampUserRelationService.getOne(Wrappers.<TempLittleArtistTrainingCampUserRelation>lambdaQuery()
-                .eq(TempLittleArtistTrainingCampUserRelation::getUserId, user.getId()));
+                .eq(TempLittleArtistTrainingCampUserRelation::getUserId, user.getId())
+                .eq(TempLittleArtistTrainingCampUserRelation::getState, TempLittleArtistTrainingCampUserRelation.APPLY)
+        );
         if (Objects.isNull(campUser)) {
             return null;
         }
-        //查询训练营
+        //查询在训练中的训练营
         TempLittleArtistTrainingCamp camp = this.getOne(Wrappers.<TempLittleArtistTrainingCamp>lambdaQuery()
                 .eq(TempLittleArtistTrainingCamp::getId, campUser.getActivityId())
+                .eq(TempLittleArtistTrainingCamp::getState, TempLittleArtistTrainingCamp.ING)
                 .eq(TempLittleArtistTrainingCamp::getDelFlag, 0));
         if (Objects.isNull(camp)) {
             return null;
         }
-
+        LocalDate now = LocalDate.now();
         TempCampUserTrainingPlayTimeVo vo = new TempCampUserTrainingPlayTimeVo();
         Map<String, Object> param = new HashMap<>();
         param.put("userId", user.getId());
-        param.put("startTime", DateUtil.dateToString(camp.getTrainStartDate()) + " 00:00:00");
-        param.put("endTime", DateUtil.dateToString(camp.getTrainEndDate()) + " 23:59:59");
+        param.put("startTime", now + " 00:00:00");
+        param.put("endTime", now + " 23:59:59");
         Integer playTime = baseMapper.queryUserTrainingPlayTime(param);
         vo.setPlayTime(playTime);
         vo.setTrainStartDate(camp.getTrainStartDate());

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

@@ -50,6 +50,11 @@ public class TempLittleArtistTrainingCampUserRelationServiceImpl extends Service
     @Override
     public void add(Integer campId) {
         SysUser user = getUser();
+        TempLittleArtistTrainingCampUserRelation one = this.getOne(Wrappers.<TempLittleArtistTrainingCampUserRelation>lambdaQuery()
+                .eq(TempLittleArtistTrainingCampUserRelation::getUserId, user.getId()));
+        if (Objects.nonNull(one) && Objects.nonNull(one.getActivityId())) {
+            throw new BizException("您已登记训练营!");
+        }
         int count = this.count(Wrappers.<TempLittleArtistTrainingCampUserRelation>lambdaUpdate()
                 .set(TempLittleArtistTrainingCampUserRelation::getActivityId, campId));
         if (count == 2000) {

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

@@ -16,6 +16,7 @@
 		<result column="file_name_" property="fileName" />
 		<result column="file_size_" property="fileSize" />
 		<result column="message_type_" property="messageType" />
+		<result column="send_type_" property="sendType" />
 		<result column="send_flag_" property="sendFlag" />
 		<result column="send_time_" property="sendTime" />
 		<result column="operator_" property="operator" />
@@ -36,14 +37,17 @@
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ImSendGroupMessage" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO im_send_group_message (message_content_,sender_id_,extra,target_ids_,file_url_,file_name_,
-		                                   file_size_,message_type_,send_flag_,send_time_,create_time_,update_time_,operator_)
+		                                   file_size_,message_type_,send_flag_,send_time_,create_time_,update_time_,operator_,send_type_)
 		VALUES(#{messageContent},#{senderId},#{extra},#{targetIds},#{fileUrl},#{fileName},#{fileSize},
-		       #{messageType},#{sendFlag},#{sendTime},NOW(),NOW(),#{operator})
+		       #{messageType},#{sendFlag},#{sendTime},NOW(),NOW(),#{operator},#{sendType})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.ImSendGroupMessage">
 		UPDATE im_send_group_message <set>
+			<if test="sendType != null">
+				send_type_ = #{sendType},
+			</if>
 			<if test="operator != null">
 				operator_ = #{operator},
 			</if>
@@ -101,6 +105,9 @@
 			<if test="senderId != null">
 				AND sender_id_ = #{senderId}
 			</if>
+			<if test="sendType != null">
+				AND send_type_ = #{sendType}
+			</if>
 		</where>
 	</sql>
 	

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

@@ -132,7 +132,7 @@
             <if test="param.search != null ">
                 AND (
                 d.`id_` LIKE CONCAT('%', #{param.search},'%')
-                OR d.`name_` LIKE CONCAT('%', #{param.search},'%')
+                OR d.`username_` LIKE CONCAT('%', #{param.search},'%')
                 OR d.`phone_` LIKE CONCAT('%', #{param.search},'%')
                 )
             </if>

+ 1 - 1
mec-common/common-core/src/main/java/com/ym/mec/common/page/PageUtil.java

@@ -40,12 +40,12 @@ public class PageUtil {
         int limit = Integer.parseInt(String.valueOf(source.getSize()));
         PageInfo<T> resultPage = new PageInfo<>();
         resultPage.setRows(source.getRecords());
+        resultPage.setPageNo(Long.valueOf(source.getCurrent()).intValue());
         resultPage.setLimit(limit);
         resultPage.setTotal(total);
         return resultPage;
     }
 
-
     /**
      * 获取Map中的关键字获取分页数据
      *

+ 4 - 0
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/message/provider/JiguangPushPlugin.java

@@ -92,6 +92,10 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
 		android_extras.put("url", url);
 		android_extras.put("memo", url);
 		android.put("extras", android_extras);
+        //2022年5月27日 增加以下参数,是因为安卓无法跳转到APP中
+        JSONObject intentParam = new JSONObject();
+        intentParam.put("url", "intent:#Intent;action=android.intent.action.MAIN;end");
+        android.put("intent", intentParam);
 
 		JSONObject ios = new JSONObject();// ios通知内容
 		ios.put("alert", alert);