liujc 2 years ago
parent
commit
5f521a0d12

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

@@ -69,4 +69,6 @@ public interface MusicGroupQuitDao extends BaseDAO<Long, MusicGroupQuit> {
     * @date 2023/5/11 09:39
     */
     List<MusicGroupQuitPageDto> queryPageBySchool(Map<String, Object> params);
+
+    Boolean countRedPointBySchool(@Param("musicGroupIds") List<String> musicGroupIds);
 }

+ 15 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysNewsInformationDao.java

@@ -0,0 +1,15 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ym.mec.biz.dal.entity.SysNewsInformation;
+
+/**
+ * 新闻资讯表(SysNewsInformation)表数据库访问层
+ *
+ * @author zx
+ * @since 2023-05-11 16:08:25
+ */
+public interface SysNewsInformationDao extends BaseMapper<SysNewsInformation> {
+
+}
+

+ 139 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysNewsInformation.java

@@ -0,0 +1,139 @@
+package com.ym.mec.biz.dal.entity;
+
+
+import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.ym.mec.common.enums.BaseEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.Getter;
+import org.springframework.web.bind.annotation.GetMapping;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 新闻资讯表(SysNewsInformation)表实体类
+ *
+ * @author zx
+ * @since 2023-05-11 16:08:27
+ */
+@Data
+@ApiModel(value = "sys_news_information-新闻资讯表")
+public class SysNewsInformation implements Serializable {
+    @TableId(value = "id_", type = IdType.AUTO)
+    private Long id;
+
+    @TableField("title_")
+    @ApiModelProperty(value = "标题")
+    private String title;
+
+    @TableField("content_")
+    @ApiModelProperty(value = "内容")
+    private String content;
+
+    @TableField("cover_image_")
+    @ApiModelProperty(value = "封面图片")
+    private String coverImage;
+
+    @TableField("type_")
+    @ApiModelProperty(value = "类型")
+    private Integer type;
+
+    @TableField("sub_type_")
+    @ApiModelProperty(value = "子类型")
+    private Integer subType;
+
+    @TableField("status_")
+    @ApiModelProperty(value = "状态(1-可见 0-不可见)")
+    private String status;
+
+    @TableField("online_time_")
+    @ApiModelProperty(value = "上线时间")
+    private Date onlineTime;
+
+    @TableField("offline_time_")
+    @ApiModelProperty(value = "下线时间")
+    private Date offlineTime;
+
+    @TableField("memo_")
+    @ApiModelProperty(value = "备注")
+    private String memo;
+
+    @TableField("create_time_")
+    private Date createTime;
+
+    @TableField("update_time_")
+    private Date updateTime;
+
+    @TableField("link_url_")
+    @ApiModelProperty(value = "链接地址")
+    private String linkUrl;
+
+    @TableField("href_target_")
+    @ApiModelProperty(value = "跳转类型_bank,_slef")
+    private String hrefTarget;
+
+    @TableField("order_")
+    @ApiModelProperty(value = "顺序号")
+    private Integer order;
+
+    @TableField("del_flag_")
+    @ApiModelProperty(value = "${column.comment}")
+    private Integer delFlag;
+
+    @TableField("tenant_id_")
+    @ApiModelProperty(value = "1-对内;2-对外")
+    private Integer tenantId;
+
+    @TableField("video_cover_image_")
+    @ApiModelProperty(value = "视频封面")
+    private String videoCoverImage;
+
+    @TableField("attribute1_")
+    @ApiModelProperty(value = "${column.comment}")
+    private String attribute1;
+
+    @TableField("attribute2_")
+    @ApiModelProperty(value = "${column.comment}")
+    private String attribute2;
+
+    @TableField("subject_id_list_")
+    @ApiModelProperty(value = "声部列表")
+    private String subjectIdList;
+
+    @TableField("organ_id_list_")
+    @ApiModelProperty(value = "所属分部")
+    private String organIdList;
+
+    @TableField("red_point_")
+    @ApiModelProperty(value = "红点类型")
+    private ERedPointEnum redPoint;
+
+    @Getter
+    public enum ERedPointEnum implements BaseEnum<String, ERedPointEnum> {
+
+        BACKLOG("待办事项"),
+        SITE_MANAGE("场地管理"),
+        ;
+
+        private final String describe;
+
+        @EnumValue
+        private final String code;
+
+        ERedPointEnum(String describe) {
+            this.describe = describe;
+            this.code = this.name();
+        }
+
+        @Override
+        public String getCode() {
+            return this.name();
+        }
+    }
+}
+

+ 37 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/school/dto/NewsInformationDto.java

@@ -0,0 +1,37 @@
+package com.ym.mec.biz.dal.school.dto;
+
+import com.ym.mec.biz.dal.entity.SysNewsInformation;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class NewsInformationDto {
+    private Long id;
+
+    @ApiModelProperty(value = "标题")
+    private String title;
+
+    @ApiModelProperty(value = "内容")
+    private String content;
+
+    @ApiModelProperty(value = "封面图片")
+    private String coverImage;
+
+    @ApiModelProperty(value = "类型")
+    private Integer type;
+
+    @ApiModelProperty(value = "子类型")
+    private Integer subType;
+
+    @ApiModelProperty(value = "链接地址")
+    private String linkUrl;
+
+    @ApiModelProperty(value = "跳转类型_bank,_slef")
+    private String hrefTarget;
+
+    @ApiModelProperty(value = "红点类型")
+    private SysNewsInformation.ERedPointEnum redPoint;
+
+    @ApiModelProperty(value = "是否有红点")
+    private Boolean redPointFlag = false;
+}

+ 24 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysNewsInformationService.java

@@ -0,0 +1,24 @@
+package com.ym.mec.biz.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.biz.dal.dao.SysNewsInformationDao;
+import com.ym.mec.biz.dal.entity.SysNewsInformation;
+import com.ym.mec.biz.dal.school.dto.NewsInformationDto;
+import com.ym.mec.common.exception.BizException;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+/**
+ * 新闻资讯表(SysNewsInformation)表服务接口
+ *
+ * @author zx
+ * @since 2023-05-11 16:08:27
+ */
+public interface SysNewsInformationService extends IService<SysNewsInformation> {
+
+    SysNewsInformationDao getDao();
+
+    List<NewsInformationDto> queryPage(Integer type,Integer coopId) throws Exception;
+}
+

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

@@ -6041,11 +6041,15 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		LocalDate endDate = LocalDate.parse(endTerm, formatter);
 		Map<String, List<DailySummaryOfClassesForTheCurrentSemesterDto>> result = new LinkedHashMap<>(30);
 		LocalDate currentWeekStart = startDate.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
+		DateTimeFormatter format = DateTimeFormatter.ofPattern("yy年MM月dd日");
 		StringBuffer sb;
 		while (!currentWeekStart.isAfter(endDate)) {
 			int currentWeekNumber = (int) ChronoUnit.WEEKS.between(startDate, currentWeekStart);
-			sb = new StringBuffer("第").append(toChineseNumber(currentWeekNumber)).append("周");
+			String weekStart = currentWeekStart.format(format);
+			sb = new StringBuffer("第").append(toChineseNumber(currentWeekNumber)).append("周 (").append(weekStart).append("-");
 			LocalDate currentWeekEnd = currentWeekStart.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY));
+			String endStart = currentWeekEnd.format(format);
+			sb.append(endStart).append(")");
 			List<DailySummaryOfClassesForTheCurrentSemesterDto> currentWeekDates = new ArrayList<>();
 			for (DailySummaryOfClassesForTheCurrentSemesterDto dto : summary) {
 				if (!dto.getCourseDate().isBefore(currentWeekStart) && dto.getCourseDate().isBefore(currentWeekEnd)) {

+ 81 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysNewsInformationServiceImpl.java

@@ -0,0 +1,81 @@
+package com.ym.mec.biz.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.gson.JsonObject;
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dao.MusicGroupQuitDao;
+import com.ym.mec.biz.dal.dao.SysNewsInformationDao;
+import com.ym.mec.biz.dal.entity.SysNewsInformation;
+import com.ym.mec.biz.dal.school.dto.NewsInformationDto;
+import com.ym.mec.biz.service.SysNewsInformationService;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.tenant.TenantContextHolder;
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.collections.CollectionUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * 新闻资讯表(SysNewsInformation)表服务实现类
+ *
+ * @author zx
+ * @since 2023-05-11 16:08:28
+ */
+@Service("sysNewsInformationService")
+public class SysNewsInformationServiceImpl extends ServiceImpl<SysNewsInformationDao, SysNewsInformation> implements SysNewsInformationService {
+
+    private final static Logger log = LoggerFactory.getLogger(SysNewsInformationServiceImpl.class);
+
+    @Override
+    public SysNewsInformationDao getDao(){
+            return this.baseMapper;
+    }
+
+    @Resource
+    private MusicGroupQuitDao musicGroupQuitDao;
+    @Resource
+    private MusicGroupDao musicGroupDao;
+
+    @Override
+    public List<NewsInformationDto> queryPage(Integer type,Integer coopId) throws Exception {
+        List<SysNewsInformation> dtos = this.lambdaQuery()
+                .eq(SysNewsInformation::getType, type)
+                .eq(SysNewsInformation::getStatus, 1)
+                .eq(SysNewsInformation::getDelFlag, false)
+                .orderByAsc(SysNewsInformation::getOrder).list();
+        List<NewsInformationDto> resultList = new ArrayList<>();
+        if(CollectionUtils.isNotEmpty(dtos)){
+            List<String> musicGroupIds = musicGroupDao.findNormalByCooperationId(coopId);
+            if(CollectionUtils.isNotEmpty(musicGroupIds)){
+                for (SysNewsInformation dto : dtos) {
+                    NewsInformationDto informationDto = JSON.parseObject(JSON.toJSONString(dto), NewsInformationDto.class);
+                    if(informationDto.getRedPoint() != null){
+                        //统计是否有红点
+                        switch (informationDto.getRedPoint()) {
+                            //待办事项
+                            case BACKLOG:
+                                informationDto.setRedPointFlag(musicGroupQuitDao.countRedPointBySchool(musicGroupIds));
+                                break;
+                            case SITE_MANAGE:
+                                //todo 场地管理
+                                break;
+                        }
+                    }
+                    resultList.add(informationDto);
+                }
+            }
+        }
+        return resultList;
+    }
+
+}
+

+ 7 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupQuitMapper.xml

@@ -245,4 +245,11 @@
             </if>
         </where>
     </select>
+    <select id="countRedPointBySchool" resultType="java.lang.Boolean">
+        select COUNT(0) from music_group_quit mgq WHERE mgq.school_staff_audit_status_ = 'ING'
+        AND mgq.music_group_id_ IN
+        <foreach collection="musicGroupIds" open="(" close=")" item="musicGroupId" separator=",">
+            #{musicGroupId}
+        </foreach>
+    </select>
 </mapper>

+ 5 - 0
mec-biz/src/main/resources/config/mybatis/SysNewsInformationMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ym.mec.biz.dal.dao.SysNewsInformationDao">
+
+</mapper>

+ 41 - 0
mec-web/src/main/java/com/ym/mec/web/controller/school/SchoolSysNewsInformationController.java

@@ -0,0 +1,41 @@
+package com.ym.mec.web.controller.school;
+
+
+import com.ym.mec.biz.dal.school.dto.NewsInformationDto;
+import com.ym.mec.biz.service.SysNewsInformationService;
+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 org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 新闻资讯表(SysNewsInformation)表控制层
+ *
+ * @author zx
+ * @since 2023-05-11 16:08:21
+ */
+@Api(tags = "新闻资讯表")
+@RestController
+@RequestMapping("/sysNewsInformation")
+public class SchoolSysNewsInformationController extends BaseController {
+    /**
+     * 服务对象
+     */
+    @Resource
+    private SysNewsInformationService sysNewsInformationService;
+
+    @ApiOperation(value = "分页查询")
+    @GetMapping("queryPage")
+    public HttpResponseResult<List<NewsInformationDto>> queryPage(Integer type, @RequestHeader Integer coopId) throws Exception {
+        return succeed(sysNewsInformationService.queryPage(type,coopId));
+    }
+
+}
+