Commit cf8559c8 by liangkaiping

copy

parent d09f09c2
# album-project 专辑
\ No newline at end of file
专辑
\ No newline at end of file
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yizhi</groupId>
<artifactId>cloud-album</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.yizhi</groupId>
<version>1.0-SNAPSHOT</version>
<artifactId>cloud-album-api</artifactId>
<dependencies>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-common-api</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-util</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-core</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-orm</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package com.yizhi.album.application.feign;
import com.yizhi.album.application.vo.domain.AlStudentActivityRecord;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = "album", contextId = "AlStudentActivityRecordClient")
public interface AlStudentActivityRecordClient {
@GetMapping("/remote/alStudentActivityRecord/statistics/getRecordeAllWorkId")
public List<Long> getRecordeAllWorkId();
@GetMapping("/remote/alStudentActivityRecord/statistics/getAllRecordeByTimeLimit")
public List<AlStudentActivityRecord> getAllRecordeByTimeLimit(@RequestParam(value="startDate",required=true)String startDate,@RequestParam(value="endDate",required=true)String endDate,@RequestParam(value="relationId",required=true)Long relationId);
}
package com.yizhi.album.application.feign;
import com.yizhi.album.application.vo.domain.AlThemeActivity;
import com.yizhi.album.application.vo.AlbumVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@FeignClient(name = "album", contextId = "AlThemeActivityClient")
public interface AlThemeActivityClient {
@PostMapping("/remote/alThemeActivity/save")
public Boolean sava(@RequestBody AlbumVo vo);
@GetMapping("/remote/alThemeActivity/delete")
public Boolean delete(@RequestParam(name = "id") Long id);
@PostMapping("/remote/alThemeActivity/sortActivity")
public Boolean sortActivity(@RequestBody List<AlThemeActivity> list);
@PostMapping("/remote/alThemeActivity/unLock")
public Boolean unLock(@RequestBody AlThemeActivity activity);
@GetMapping("/remote/alThemeActivity/list")
public AlbumVo list(@RequestParam(name = "albumId") Long albumId);
}
package com.yizhi.album.application.feign;
import com.yizhi.album.application.vo.domain.AlTheme;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@FeignClient(name = "album", contextId = "AlThemeClient")
public interface AlThemeClient {
@GetMapping("/remote/alTheme/delete")
public Boolean delete(@RequestParam(name = "id")Long id);
@PostMapping("/remote/alTheme/sortActivity")
public int sortTheme(@RequestBody List<AlTheme> list);
@GetMapping("/remote/alTheme/updateName")
public Boolean updateName(@RequestParam(name = "id") Long id,@RequestParam(name = "albumId") Long albumId,@RequestParam(name = "name") String name);
}
package com.yizhi.album.application.feign;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.album.application.vo.domain.AlbumClassify;
import com.yizhi.album.application.vo.AlbumClassifyVo;
import com.yizhi.album.application.vo.ApiAlbumClassifyVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@FeignClient(name = "album", contextId = "AlbumClassifyClient")
public interface AlbumClassifyClient {
@GetMapping("/remote/albumClassify/find/id")
public AlbumClassify getById(@RequestParam(name = "id") Long id);
@ApiOperation("添加分类")
@RequestMapping(value = "/remote/albumClassify/save", method = RequestMethod.POST)
public int saveClassify(@RequestBody AlbumClassify classify);
/**
* 检查是否存在分类名称
*
* @param name 分类名称
* @param parentId 分类的上级id(一级分类为0)
* @param siteId 站点id
* @param type 检查类型(1:新增,2:修改(需要传classifyId))
* @param classifyId 分类id,修改检查时用到
* @return 不存在返回true,存放相同名返回false
*/
@GetMapping("/remote/albumClassify/check/name")
public boolean checkExtisClassifyName(@RequestParam(name = "name") String name,
@RequestParam(name = "parentId", required = false) Long parentId, @RequestParam(name="siteId") Long siteId,
@RequestParam(name="type") Integer type, @RequestParam(name = "classifyId", required = false) Long classifyId);
@ApiOperation("分类删除")
@RequestMapping(value = "/remote/albumClassify/delete", method = RequestMethod.POST)
public int deleteClassify(@RequestBody AlbumClassify classify);
@ApiOperation("分类名称修改")
@RequestMapping(value = "/remote/albumClassify/update", method = RequestMethod.POST)
public int updateClassify(@RequestBody AlbumClassify classify);
@ApiOperation("分类查询")
@RequestMapping(value = "/remote/albumClassify/list", method = RequestMethod.GET)
public Page<AlbumClassify> listClassify(@RequestParam(required = false, name = "isStartHQ") Boolean isStartHQ,
@RequestParam(required = false,name = "name") String name, @RequestParam(name = "pageNo") Integer pageNo, @RequestParam(name = "pageSize") Integer pageSize,
@RequestParam(name = "companyId") Long companyId, @RequestParam(name = "siteId") Long siteId,
@RequestParam(name = "orgIds", required = false) List<Long> orgIds);
@ApiOperation("分类排序")
@RequestMapping(value = "/remote/albumClassify/sort", method = RequestMethod.POST)
public int sortClassify(@RequestBody List<AlbumClassify> list);
@ApiOperation("分类分页查询")
@RequestMapping(value = "/remote/albumClassify/page/list", method = RequestMethod.GET)
public Page<ApiAlbumClassifyVo> pageList(@RequestParam(name = "name", required = false) String name,
@RequestParam(name = "pageNo") Integer pageNo, @RequestParam(name = "pageSize") Integer pageSize,
@RequestParam(name = "companyId") Long companyId, @RequestParam(name = "siteId") Long siteId,
@RequestParam(name = "orgIds", required = false) List<Long> orgIds);
/**
* 验证同站点下 同级的分类不能重名
*
* @param name 分类名
* @param layer 分类层级
* @param companyId 企业名
* @param siteId 站点id
* @param id 分类id (修改的时候传入)
* @return Boolean
*/
@GetMapping("/remote/albumClassify/vail/name")
public Boolean vailName(@RequestParam(name = "name") String name, @RequestParam(name = "layer") Integer layer,
@RequestParam(name = "companyId") Long companyId, @RequestParam(name = "siteId") Long siteId,
@RequestParam(name = "id", required = false) Long id);
@GetMapping("/remote/albumClassify/getClassifyName")
public String getClassifyName(@RequestParam("classifyId") Long classifyId);
@GetMapping("/remote/albumClassify/classify/list")
public List<AlbumClassifyVo> listClassifyInfo(
@RequestParam(value="classifyId",required = false) Long classifyId);
}
package com.yizhi.album.application.feign;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.album.application.vo.*;
import com.yizhi.album.application.vo.domain.Album;
import com.yizhi.album.application.vo.domain.AlbumVisibleRange;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.core.application.vo.DroolsVo;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@FeignClient(name = "album", contextId = "AlbumClient")
public interface AlbumClient {
/**
* 管理端专辑列表接口
* @param name
* @param alClassifyId
* @param status
* @param overed
* @param companyId
* @param siteId
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping("/remote/album/list")
public Page<Album> list(@RequestParam(name = "name",required = false) String name,
@RequestParam(name = "alClassifyId",required = false) Long alClassifyId, @RequestParam(name = "status",required = false) Integer status,
@RequestParam(name = "overed",required = false) Integer overed, @RequestParam(name = "companyId") Long companyId,
@RequestParam(name = "siteId") Long siteId, @RequestParam(name = "pageNo") Integer pageNo,
@RequestParam(name = "pageSize") Integer pageSize);
/**
* 管理端专辑详情接口
* @param id
* @return
*/
@GetMapping("/remote/album/get")
public Album get(@RequestParam(name = "id") Long id);
/**
* 管理端专辑主体新增接口
* @param albumVo
* @return
*/
@PostMapping("/remote/album/save")
public AlbumVo save(@RequestBody AlbumVo albumVo);
/**
* 管理端专辑主体修改接口
* @param albumVo
* @return
*/
@PostMapping("/remote/album/update")
public Boolean update(@RequestBody AlbumVo albumVo);
/**
* 专辑下架 当专辑为上架状态 1 时 才下架
*
* @param albumId 参数中有专辑主键id
* @return
*/
@GetMapping("/remote/album/down")
public Boolean down(@RequestParam(name = "albumId") Long albumId);
/**
* 专辑上架
*
* @param albumId 参数中有专辑主键id
* @return
*/
@Deprecated
@GetMapping(value = "/remote/album/up")
public Boolean up(@RequestParam(name = "albumId") Long albumId,@RequestParam(name = "type")Integer type);
/**
* 专辑上架
*
* @param albumId 参数中有专辑主键id
* @return
*/
@GetMapping(value = "/remote/album/up2")
public Integer up2(@RequestParam(name = "albumId") Long albumId,@RequestParam(name = "type")Integer type);
/**
* 专辑可见范围新增
* @param albumVisableRanges
* @return
*/
@PostMapping("/remote/album/authorize/insert")
public Boolean insertAlbumVisibleRanges(@RequestBody List<AlbumVisibleRange> albumVisableRanges);
/**
* 专辑可见范围查看
* @param albumId
* @return
*/
@GetMapping("/remote/album/VisibleRange")
public List<AlbumVisibleRange> VisibleRange(@RequestParam("albumId") Long albumId);
/**
* 专辑课程清单导出
* @param albumId
* @return
*/
@GetMapping("/remote/album/activity/export")
public Map<String, Object> activityExport(@RequestParam(name = "albumId", required = true) Long albumId);
/**
* 专辑列表查询
* @param name
* @param companyId
* @param siteId
* @return
*/
@GetMapping("/remote/album/searchList")
public List<Album> searchList(@RequestParam(name = "name",required = false) String name,@RequestParam(name = "ids",required = false) List<Long> ids,
@RequestParam(name = "companyId") Long companyId, @RequestParam(name = "siteId") Long siteId);
/**
* 学员端专辑首页列表
* @param apiSearchAlbumVo
* @return
*/
@PostMapping("/remote/album/searchPage")
public Page<ApiListAlbumVo> searchPage(@RequestBody ApiSearchAlbumVo apiSearchAlbumVo);
/**
* 学员端我的专辑
* @param siteId
* @param accountId
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping("/remote/album/getMyAlbumList")
public Page<ApiListAlbumVo> getMyAlbumList(@RequestParam("siteId") Long siteId,
@RequestParam("accountId") Long accountId, @RequestParam(name = "pageNo") Integer pageNo,
@RequestParam(name = "pageSize") Integer pageSize);
/**
* 学员端专辑详情
* @param albumId
* @param accountId
* @param siteId
* @param companyId
* @return
*/
@GetMapping("/remote/album/getDeatil")
public AlbumDetailVo getDeatil(@RequestParam("albumId") Long albumId, @RequestParam("accountId") Long accountId, @RequestParam("siteId") Long siteId, @RequestParam("companyId") Long companyId);
/**
* 学员端专辑内容
* @param albumId
* @param accountId
* @param siteId
* @param companyId
* @param type
* @param display
* @return
*/
@GetMapping("/remote/album/getContent")
public List<AlbumThemeVo> getContent(@RequestParam("albumId") Long albumId,
@RequestParam("accountId") Long accountId, @RequestParam("siteId") Long siteId,
@RequestParam("companyId") Long companyId, @RequestParam("type") Integer type,
@RequestParam("display") Integer display);
/**
* 首页获取专辑列表
* @param ids
* @return
*/
@PostMapping("/remote/album/getPortalList")
public List<ApiListAlbumVo> getPortalList(@RequestBody List<Long> ids);
/**
* 我的订阅专辑
* @param vo
* @return
*/
@PostMapping("/remote/album/getMySubscribePage")
public Page<ApiListAlbumVo> getMySubscribePage(@RequestBody ApiSearchAlbumVo vo);
@PostMapping("/remote/album/delete")
public Integer delete(@RequestBody List<Long> ids);
@PostMapping("/remote/album/getMyAlbumCount")
public Integer getMyAlbumCount(@RequestBody RequestContext context);
@PostMapping("/remote/album/getSubcribeNum")
public Integer getSubcribeNum(@RequestBody List<Long> ids);
@GetMapping("/remote/album/getPageByDrools")
Page<DroolsVo> getPageByDrools(@RequestParam("field") String field,
@RequestParam(value = "value", required = false) String value,
@RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize);
/**
* 日历任务获取专辑列表
* @return
*/
@PostMapping("/remote/album/getPageToCalendar")
public Page<AlbumCalendarVo> getPageToCalendar(@ApiParam("paramVo") @RequestBody CalendarTaskParamVo paramVo);
@PostMapping("/remote/album/listNoIds")
public Page<Album> listNoIds(@RequestBody ApiSearchAlbumVo vo);
}
package com.yizhi.album.application.feign;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@FeignClient(name = "album", contextId = "AlbumJobHandleClient")
public interface AlbumJobHandleClient {
/**
* 定时任务执行实际的处理逻辑类
* 定时任务业务逻辑处理
*
* @param
* @return
*/
@GetMapping("/remote/album/albumUnLock")
@ApiOperation(value = "定时解锁专辑课程", response = String.class)
public void unLockCourse();
}
package com.yizhi.album.application.feign;
import com.yizhi.album.application.vo.domain.ClassifyStrategy;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(name = "album", contextId = "ClassifyStrategyClient")
public interface ClassifyStrategyClient {
@GetMapping("/remote/classifyStrategy/update")
public ClassifyStrategy update(@RequestParam(value = "type", required = true) Integer type,@RequestParam(value = "status", required = true) Integer status);
@GetMapping("/remote/classifyStrategy/get")
public ClassifyStrategy get(@RequestParam(value = "companyId", required = true) Long companyId,@RequestParam(value = "siteId", required = true) Long siteId);
}
package com.yizhi.album.application.feign;
import com.yizhi.album.application.vo.AlbumVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = "album", contextId = "StatisticsAlbumClient")
public interface StatisticsAlbumClient {
/**
* 所有专辑
* @param companyId
* @param siteId
* @return
*/
@GetMapping("/remote/statisticsAlbum/getAllAlbums")
public List<AlbumVo> getAllAlbums(@RequestParam(name = "companyId",required = false)Long companyId,@RequestParam(name = "siteId",required = false)Long siteId);
}
package com.yizhi.album.application.vo;
import java.util.List;
import com.yizhi.album.application.vo.domain.AlThemeActivity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class AlThemeVo {
@ApiModelProperty(value = "专辑主题id")
private Long id;
@ApiModelProperty(value = "专辑id")
private Long albumId;
@ApiModelProperty(value = "主题名称")
private String name;
@ApiModelProperty(value = "排序字段")
private Integer sort;
@ApiModelProperty(value = "主题活动")
private List<AlThemeActivity> activities;
@ApiModelProperty(value = "主题活动删除id")
private List<Long> deleteList;
}
package com.yizhi.album.application.vo;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "专辑内容--活动vo")
public class AlbumActivityVo {
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "专辑id")
private Long albumId;
@ApiModelProperty(value = "关联的活动的id")
private Long relationId;
@ApiModelProperty(value = "活动名称,从活动那边取过来,不能自定义")
private String name;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "当前状态")
private String status;
@ApiModelProperty(value = "解锁状态 0已解锁 1发布及解锁 2自定义解锁")
private Integer unlock;
@ApiModelProperty(value = "课程更新时间")
private Date updateTime;
@ApiModelProperty(value = "课程更新标识")
private Integer isNew;
@ApiModelProperty(value = "课程时长")
private Long duration;
}
package com.yizhi.album.application.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class AlbumCalendarVo {
@ApiModelProperty(value = "专辑主键id")
private Long id;
@ApiModelProperty(value = "专辑名称")
private String name;
@ApiModelProperty(value = "专辑封面图")
private String image;
@ApiModelProperty("业务按钮状态")
public List<String> taskButtonStatus;
@ApiModelProperty(value = "日历任务开始时间:enable-task不为0时,有值")
private Date taskStartDate;
@ApiModelProperty(value = "日历任务结束时间:enable-task不为0时,有值")
private Date taskEndDate;
}
package com.yizhi.album.application.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class AlbumClassifyVo {
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "层级")
private Integer layer;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "编码")
private String code;
@ApiModelProperty(value = "状态")
private Integer status;
private String createTime;
private Integer total;
@ApiModelProperty(value = "状态")
private Integer sort;
@ApiModelProperty(value = "描述")
private String description;
@ApiModelProperty(value = "是否存在子节点")
private Boolean existChildNode = false;
}
package com.yizhi.album.application.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class AlbumDetailVo {
@ApiModelProperty(value = "专辑id")
private Long id;
@ApiModelProperty(value = "专辑名称")
private String name;
@ApiModelProperty(value = "专辑封面图")
private String image;
@ApiModelProperty(value = "分类id")
private Long classifyId;
@ApiModelProperty(value = "学习时长")
private Long duration;
@ApiModelProperty(value = "学习数")
private Integer studyNum;
@ApiModelProperty(value = "最新解锁时间")
private Date unLockTime;
@ApiModelProperty("完成状态 0:连载中,1已完结")
private Integer overed;
@ApiModelProperty(value = "完成百分比")
private Integer percent;
@ApiModelProperty(value = "专辑介绍")
private String description;
private String tags;
@ApiModelProperty(value = "评论设置0上架评论及评分1关闭评论")
private Integer commentEnable;
@ApiModelProperty(value = "专辑资料 0显示 1不显示 默认显示")
private Integer documentEnable;
@ApiModelProperty(value = "显示模式 0全部显示 1只显示已解锁课程 默认全部显示")
private Integer display;
@ApiModelProperty(value = "专辑是否订阅 0未订阅 1已订阅")
private Integer subscribe;
@ApiModelProperty(value = "订阅数")
private Integer subscribeNum;
@ApiModelProperty(value = "已完结状态下;课程数量")
private Integer courseNum;
}
package com.yizhi.album.application.vo;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "专辑内容--主题vo")
public class AlbumThemeVo {
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "主题名称")
private String name;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "课程更新时间")
private Date updateTime;
@ApiModelProperty(value = "课程更新标识")
private Integer isNew;
@ApiModelProperty(value = "活动集合")
private List<AlbumActivityVo> list = new ArrayList<AlbumActivityVo>();
}
package com.yizhi.album.application.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class AlbumVo {
@ApiModelProperty(value = "专辑主键id")
private Long id;
@ApiModelProperty(value = "专辑名称")
private String name;
@ApiModelProperty(value = "0 未上架 1 已上架 2 草稿")
private Integer shelves;
@ApiModelProperty(value = "分类id")
private Long classifyId;
@ApiModelProperty(value = "分类名称")
private String classifyName;
@ApiModelProperty(value = "专辑封面图")
private String image;
@ApiModelProperty(value = "专辑介绍")
private String description;
private String tags;
@ApiModelProperty(value = "可见范围 0 游客 1 平台用户 2 指定范围")
private Integer scope;
@ApiModelProperty(value = "评论设置0上架评论及评分1关闭评论")
private Integer commentEnable;
private Long companyId;
private Long orgId;
private Long siteId;
private Long createById;
private String createByName;
@ApiModelProperty("创建时间,列表的时候用")
private Date createTime;
private Long updateById;
private String updateByName;
private Date updateTime;
@ApiModelProperty(value = "专辑资料 0显示 1不显示 默认显示")
private Integer documentEnable;
@ApiModelProperty(value = "0:默认未删除;1表示删除")
private Integer delFlg;
@ApiModelProperty(value = "完成状态 0连载中 1已完结")
private Integer overed;
@ApiModelProperty(value = "显示模式 0全部显示 1只显示已解锁课程 默认全部显示")
private Integer display;
@ApiModelProperty(value = "连载中最近解锁时间")
private String newest;
@ApiModelProperty(value = "课程时长")
private Long duration;
@ApiModelProperty(value = "学习人数")
private Integer studyCount;
@ApiModelProperty(value = "主题列表")
private List<AlThemeVo> list;
@ApiModelProperty(value = "删除的主题id")
private List<Long> deleteList;
@ApiModelProperty(value = "评论人数")
private Integer commentCount;
@ApiModelProperty(value = "订阅人数")
private Integer subscribeCount;
@ApiModelProperty(value = "未解锁课程数")
private Integer lockNum;
@ApiModelProperty(value = "专辑是否在日历中显示 默认为 0:不开启 1:开启")
private Integer enableTask;
@ApiModelProperty(value = "日历任务开始时间:enable-task不为0时,有值")
private Date taskStartDate;
@ApiModelProperty(value = "日历任务结束时间:enable-task不为0时,有值")
private Date taskEndDate;
}
package com.yizhi.album.application.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Data
public class ApiAlbumClassifyVo {
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "父id ")
private Long parentId;
@ApiModelProperty(value = "层级")
private Integer layer;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "编码")
private String code;
@ApiModelProperty(value = "备注")
private String description;
@ApiModelProperty(value = "状态")
private Integer status;
private Long createById;
private String createByName;
private Date createTime;
private Long updateById;
private String updateByName;
private Date updateTime;
private Long orgId;
private Long companyId;
private Long siteId;
@ApiModelProperty(value = "顶层节点id")
private Long rootId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "分类路径")
private String path;
@ApiModelProperty(value = "上一个主键ID")
private Long moveUpId = -1L;
@ApiModelProperty(value = "下一个主键ID")
private Long moveDownId = -1L;
private List<ApiAlbumClassifyVo> children = new ArrayList<ApiAlbumClassifyVo>();
}
package com.yizhi.album.application.vo;
import java.util.Date;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Api(
tags = {"ApiListAlbumVo"},
description = "课程接对象"
)
@Data
public class ApiListAlbumVo {
@ApiModelProperty(value = "专辑id")
private Long id;
@ApiModelProperty(value = "专辑名称")
private String name;
@ApiModelProperty(value = "专辑封面图")
private String image;
@ApiModelProperty(value = "分类id")
private Long classifyId;
@ApiModelProperty(value = "学习时长")
private Long duration;
@ApiModelProperty(value = "学习数")
private Integer studyNum;
@ApiModelProperty(value = "最新解锁时间")
private Date unLockTime;
@ApiModelProperty("完成状态 0:连载中,1已完结")
private Integer overed;
@ApiModelProperty(value = "完成百分比")
private Integer percent;
@ApiModelProperty(value = "更新标识")
private Integer isNew;
@ApiModelProperty(value = "已完结状态下;课程数量")
private Integer courseNum;
}
package com.yizhi.album.application.vo;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ApiSearchAlbumVo {
@ApiModelProperty(value = "专辑名称")
private String name;
@ApiModelProperty(value = "分类id")
private Long classifyId;
@ApiModelProperty(value = "当前用户学员")
private Long accountId;
private Long companyId;
private Long siteId;
private Integer pageNo;
private Integer pageSize;
private List<Long> ids;
}
package com.yizhi.album.application.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class CalendarTaskParamVo {
@ApiModelProperty("时间参数")
public Date date;
@ApiModelProperty("业务类型")
public Integer taskType = 0;
@ApiModelProperty("当前页数")
public Integer pageNo;
@ApiModelProperty("页内条数")
public Integer pageSize;
}
package com.yizhi.album.application.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 专辑分类策略
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Data
@ApiModel(value = "ClassifyStrategyVO", description = "专辑分类策略")
public class ClassifyStrategyVO {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "策略类型 0平铺式 1展开式 默认平铺式")
private Integer type;
@ApiModelProperty(value = "状态")
private Integer status;
private Long createById;
private String createByName;
private Date createTime;
private Long updateById;
private String updateByName;
private Date updateTime;
private Long companyId;
private Long siteId;
}
package com.yizhi.album.application.vo.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 学员完成专辑活动记录
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Data
@ApiModel(value = "AlStudentActivityRecord", description = "学员完成专辑活动记录")
public class AlStudentActivityRecord {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "学员id")
private Long accountId;
@ApiModelProperty(value = "冗余专辑id")
private Long albumId;
@ApiModelProperty(value = "课程id")
private Long relationId;
@ApiModelProperty(value = "若是课程,需要记录学习时长")
private Long seconds;
@ApiModelProperty(value = "是否完成(1是,0否),默认未完成。")
private Integer finished;
@ApiModelProperty(value = "完成时间")
private Date finishDate;
@ApiModelProperty(value = "所属站点id")
private Long siteId;
}
package com.yizhi.album.application.vo.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 专辑 - 主题
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Data
@ApiModel(value = "AlTheme", description = "专辑 - 主题")
public class AlTheme {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "所属专辑id")
private Long albumId;
@ApiModelProperty(value = "主题名称")
private String name;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "是否删除(1是,0否),默认否")
private Integer deleted;
@ApiModelProperty(value = "创建者id")
private Long createById;
@ApiModelProperty(value = "创建者名称")
private String createByName;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新者id")
private Long updateById;
@ApiModelProperty(value = "修改者名称")
private String updateByName;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "站点id")
private Long siteId;
@ApiModelProperty(value = "组织id")
private Long orgId;
@ApiModelProperty(value = "企业id")
private Long companyId;
}
package com.yizhi.album.application.vo.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 主题中的课程
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Data
@ApiModel(value = "AlThemeActivity", description = "主题中的课程")
public class AlThemeActivity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "冗余专辑id")
private Long albumId;
@ApiModelProperty(value = "主题id")
private Long themeId;
@ApiModelProperty(value = "主题名称")
private String themeName;
@ApiModelProperty(value = "课程id")
private Long relationId;
@ApiModelProperty(value = "课程code")
private String relationCode;
@ApiModelProperty(value = "课程名称")
private String name;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "是否删除(1是,0否),默认否")
private Integer deleted;
@ApiModelProperty(value = "解锁状态 0已解锁 1发布及解锁 2自定义解锁")
private Integer unlock;
@ApiModelProperty(value = "解锁时间")
private Date unlockTime;
@ApiModelProperty(value = "创建者id")
private Long createById;
@ApiModelProperty(value = "创建者名称")
private String createByName;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新者id")
private Long updateById;
@ApiModelProperty(value = "修改者名称")
private String updateByName;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "站点id")
private Long siteId;
@ApiModelProperty(value = "组织id")
private Long orgId;
@ApiModelProperty(value = "企业id")
private Long companyId;
}
package com.yizhi.album.application.vo.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 专辑表
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Data
@ApiModel(value = "Album", description = "专辑表")
public class Album {
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty(value = "专辑名称")
private String name;
@ApiModelProperty(value = "专辑封面图")
private String image;
@ApiModelProperty(value = "专辑介绍")
private String description;
@ApiModelProperty(value = "自定义关键字")
private String tags;
@ApiModelProperty(value = "0 未上架 1 已上架 2草稿")
private Integer shelves;
private Long createById;
private String createByName;
private Date createTime;
private Long updateById;
private String updateByName;
private Date updateTime;
private Long companyId;
private Long orgId;
private Long siteId;
@ApiModelProperty(value = "分类id")
private Long classifyId;
@ApiModelProperty(value = "可见范围 1 平台用户 2 指定范围 默认全平台可见")
private Integer scope;
@ApiModelProperty(value = "专辑评论 0显示 1不显示 默认显示")
private Integer commentEnable;
@ApiModelProperty(value = "专辑资料 0显示 1不显示 默认显示")
private Integer documentEnable;
@ApiModelProperty(value = "0:默认未删除;1表示删除")
private Integer delFlg;
@ApiModelProperty(value = "完成状态 0连载中 1已完结")
private Integer overed;
@ApiModelProperty(value = "显示模式 0全部显示 1只显示已解锁课程 默认全部显示")
private Integer display;
@ApiModelProperty(value = "专辑是否在日历中显示 默认为 0:不开启 1:开启")
private Integer enableTask;
@ApiModelProperty(value = "日历任务开始时间:enable-task不为0时,有值")
private Date taskStartDate;
@ApiModelProperty(value = "日历任务结束时间:enable-task不为0时,有值")
private Date taskEndDate;
}
package com.yizhi.album.application.vo.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 专辑分类
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Data
@ApiModel(value = "AlbumClassify", description = "专辑分类")
public class AlbumClassify {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "父id ")
private Long parentId;
@ApiModelProperty(value = "层级")
private Integer layer;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "分类编码")
private String code;
@ApiModelProperty(value = "备注")
private String description;
@ApiModelProperty(value = "状态")
private Integer status;
private Long createById;
private String createByName;
private Date createTime;
private Long updateById;
private String updateByName;
private Date updateTime;
private Long orgId;
private Long companyId;
private Long siteId;
@ApiModelProperty(value = "顶层节点id")
private Long rootId;
@ApiModelProperty(value = "排序")
private Integer sort;
private String path;
}
package com.yizhi.album.application.vo.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
* 专辑可见范围表
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@ApiModel(value = "AlbumVisableRange", description = "专辑可见范围表")
@Data
public class AlbumVisibleRange {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "专辑主键_ID,外键")
private Long albumId;
@ApiModelProperty(value = "1用户 2组织")
private Integer type;
@ApiModelProperty(value = "存放人或组织的ID")
private Long relationId;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "真实姓名")
private String fullName;
@ApiModelProperty(value = "0删除 1有效,默认有效")
private Integer state;
@ApiModelProperty(value = "站点_ID")
private Long siteId;
@ApiModelProperty(value = "企业_ID")
private Long companyId;
}
package com.yizhi.album.application.vo.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 专辑分类策略
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Data
@ApiModel(value = "ClassifyStrategy", description = "专辑分类策略")
public class ClassifyStrategy {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "策略类型 0平铺式 1展开式 默认平铺式")
private Integer type;
@ApiModelProperty(value = "状态")
private Integer status;
private Long createById;
private String createByName;
private Date createTime;
private Long updateById;
private String updateByName;
private Date updateTime;
private Long companyId;
private Long siteId;
}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yizhi</groupId>
<artifactId>cloud-album</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>cloud-album-service</artifactId>
<dependencies>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-album-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-system-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-common-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-comment-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-point-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-job-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-site-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-course-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-newMessage-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!--<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-course-studyLog-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>-->
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-orm</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-util</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- deploy 时跳过该模块 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package com.yizhi.album.application;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients(basePackages = {"com.yizhi"})
@ComponentScan(basePackages = {"com.yizhi"})
public class AlbumApplication {
public static void main(String[] args) {
SpringApplication.run(AlbumApplication.class, args);
}
}
package com.yizhi.album.application;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig extends WebMvcConfigurerAdapter {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("专辑")
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.yizhi.album.application"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("专辑")
//版本
.version("1.0")
.build();
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("docs.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
package com.yizhi.album.application.controller;
import com.yizhi.album.application.mapper.AlStudentActivityRecordMapper;
import com.yizhi.album.application.vo.domain.AlStudentActivityRecord;
import com.yizhi.util.application.beanutil.BeanCopyListUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 学员完成专辑活动记录 前端控制器
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@RestController
@RequestMapping("/alStudentActivityRecord")
public class AlStudentActivityRecordController {
@Autowired
private AlStudentActivityRecordMapper aStudentActivityRecordMapper;
@GetMapping("/statistics/getRecordeAllWorkId")
public List<Long> getRecordeAllWorkId(){
return aStudentActivityRecordMapper.getRecordeAllWorkId();
}
@GetMapping("/statistics/getAllRecordeByTimeLimit")
public List<AlStudentActivityRecord> getAllRecordeByTimeLimit(@RequestParam(value="startDate",required=true)String startDate, @RequestParam(value="endDate",required=true)String endDate, @RequestParam(value="relationId",required=true)Long relationId){
List<AlStudentActivityRecord> alStudentActivityRecords =
BeanCopyListUtil.copyListProperties(aStudentActivityRecordMapper.getAllRecordeByTimeLimit(startDate, endDate, relationId), AlStudentActivityRecord::new);
return alStudentActivityRecords;
}
}
package com.yizhi.album.application.controller;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.yizhi.album.application.domain.AlTheme;
import com.yizhi.album.application.domain.Album;
import com.yizhi.album.application.service.IAlThemeActivityService;
import com.yizhi.album.application.service.IAlThemeService;
import com.yizhi.album.application.service.IAlbumService;
import com.yizhi.album.application.vo.AlThemeVo;
import com.yizhi.album.application.vo.AlbumVo;
import com.yizhi.album.application.vo.domain.AlThemeActivity;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.util.application.beanutil.BeanCopyListUtil;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p>
* 主题中的课程 前端控制器
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@RestController
@RequestMapping("/alThemeActivity")
public class AlThemeActivityControllerV2 {
private Logger logger = LoggerFactory.getLogger(AlThemeActivityControllerV2.class);
@Autowired
private IAlbumService albumService;
@Autowired
private IAlThemeActivityService alThemeActivityService;
@Autowired
private IAlThemeService alThemeService;
@Autowired
IdGenerator idGenerator;
@PostMapping("/save")
public Boolean sava(@RequestBody AlbumVo vo) {
RequestContext context = ContextHolder.get();
Long siteId = context.getSiteId();
Long accountId = context.getAccountId();
Long companyId = context.getCompanyId();
Long orgId = context.getOrgId();
Date date = new Date();
String name = context.getAccountName();
List<AlThemeVo> themeVos = vo.getList();
Album album = albumService.selectById(vo.getId());
album.setOvered(vo.getOvered());
album.setUpdateById(accountId);
album.setUpdateByName(name);
album.setUpdateTime(date);
album.setDisplay(vo.getDisplay());
albumService.updateById(album);
//删除主题
if (CollectionUtils.isNotEmpty(vo.getDeleteList())) {
for(Long id:vo.getDeleteList()) {
AlTheme theme = alThemeService.selectById(id);
theme.setDeleted(1);
theme.setUpdateById(accountId);
theme.setUpdateByName(name);
theme.setUpdateTime(date);
alThemeService.updateById(theme);
}
}
if (CollectionUtils.isNotEmpty(themeVos)) {
for(AlThemeVo themeVo:themeVos) {
//删除主题中活动
if (CollectionUtils.isNotEmpty(themeVo.getDeleteList())) {
for(Long id:themeVo.getDeleteList()) {
com.yizhi.album.application.domain.AlThemeActivity activity = alThemeActivityService.selectById(id);
activity.setDeleted(1);
activity.setUpdateById(accountId);
activity.setUpdateByName(name);
activity.setUpdateTime(date);
alThemeActivityService.updateById(activity);
}
}
AlTheme theme = new AlTheme();
if (themeVo.getId()==null||themeVo.getId()==0) {
if (!alThemeService.vaidName(null,vo.getId(), themeVo.getName(), siteId)) {
return Boolean.FALSE;
}
theme.setId(idGenerator.generate());
theme.setCreateById(accountId);
theme.setCreateByName(name);
theme.setCreateTime(date);
theme.setSiteId(siteId);
theme.setCompanyId(companyId);
theme.setOrgId(orgId);
}else {
theme.setId(themeVo.getId());
if (!alThemeService.vaidName(themeVo.getId(),vo.getId(), themeVo.getName(), siteId)) {
return Boolean.FALSE;
}
}
theme.setAlbumId(themeVo.getAlbumId());
theme.setName(themeVo.getName());
theme.setSort(themeVo.getSort());
theme.setDeleted(0);
theme.setUpdateById(accountId);
theme.setUpdateByName(name);
theme.setUpdateTime(date);
alThemeService.insertOrUpdate(theme);
for(AlThemeActivity activityVo:themeVo.getActivities()) {
AlThemeActivity activity = new AlThemeActivity();
if (activityVo.getId()==null||activityVo.getId()==0) {
activity.setId(idGenerator.generate());
activity.setCreateById(accountId);
activity.setCreateByName(name);
activity.setCreateTime(date);
activity.setSiteId(siteId);
activity.setCompanyId(companyId);
activity.setOrgId(orgId);
}else {
activity.setId(activityVo.getId());
}
activity.setAlbumId(activityVo.getAlbumId());
activity.setThemeId(theme.getId());
activity.setThemeName(theme.getName());
activity.setRelationId(activityVo.getRelationId());
activity.setRelationCode(activityVo.getRelationCode());
activity.setName(activityVo.getName());
activity.setSort(activityVo.getSort());
activity.setDeleted(0);
// activity.setUnlock(activityVo.getUnlock());
activity.setUnlock(vo.getShelves() == 1 && activityVo.getUnlock() == 1 ? 0 : activityVo.getUnlock());
activity.setUnlockTime(activityVo.getUnlockTime());
com.yizhi.album.application.domain.AlThemeActivity alThemeActivity = new com.yizhi.album.application.domain.AlThemeActivity();
BeanUtils.copyProperties(activity, alThemeActivity);
alThemeActivityService.insertOrUpdate(alThemeActivity);
}
}
}
return Boolean.TRUE;
}
@GetMapping("/delete")
public Boolean delete(@RequestParam(name = "id")Long id) {
RequestContext context = ContextHolder.get();
Long accountId = context.getAccountId();
String name = context.getAccountName();
Date date = new Date();
boolean b = false;
com.yizhi.album.application.domain.AlThemeActivity activity = new com.yizhi.album.application.domain.AlThemeActivity();
BeanUtils.copyProperties(alThemeActivityService.selectById(id), activity);
/*AlThemeActivity activity = alThemeActivityService.selectById(id);*/
if (activity!=null) {
activity.setDeleted(1);
activity.setUpdateById(accountId);
activity.setUpdateByName(name);
activity.setUpdateTime(date);
b = alThemeActivityService.updateById(activity);
}
return b;
}
@PostMapping("/sortActivity")
public Boolean sortActivity(@RequestBody List<AlThemeActivity> list) {
logger.info("管理端传入要排序的ID列表==========================:" + list);
List<com.yizhi.album.application.domain.AlThemeActivity> alThemeActivities =
BeanCopyListUtil.copyListProperties(list, com.yizhi.album.application.domain.AlThemeActivity::new);
return alThemeActivityService.sortActivity(alThemeActivities);
}
@PostMapping("/unLock")
public Boolean unLock(@RequestBody AlThemeActivity activity) {
logger.info("管理端传入定时解锁的活动==========================:" + activity);
com.yizhi.album.application.domain.AlThemeActivity alThemeActivity = new com.yizhi.album.application.domain.AlThemeActivity();
BeanUtils.copyProperties(activity, alThemeActivity);
return alThemeActivityService.updateById(alThemeActivity);
}
@GetMapping("/list")
public AlbumVo list(@RequestParam(name = "albumId")Long albumId){
AlbumVo albumVo = new AlbumVo();
Album album = albumService.selectById(albumId);
albumVo.setId(album.getId());
albumVo.setName(album.getName());
albumVo.setShelves(album.getShelves());
albumVo.setClassifyId(album.getClassifyId());
albumVo.setImage(album.getImage());
albumVo.setDescription(album.getDescription());
albumVo.setTags(album.getTags());
albumVo.setScope(album.getScope());
albumVo.setCommentEnable(album.getCommentEnable());
albumVo.setDocumentEnable(album.getDocumentEnable());
albumVo.setOvered(album.getOvered());
albumVo.setDisplay(album.getDisplay());
List<AlThemeVo> list = new ArrayList<AlThemeVo>();
AlTheme theme = new AlTheme();
theme.setAlbumId(albumId);
theme.setDeleted(0);
EntityWrapper<AlTheme> wrapper = new EntityWrapper<AlTheme>(theme);
wrapper.orderBy("sort", true);
List<AlTheme> themes = alThemeService.selectList(wrapper);
for(AlTheme alTheme:themes) {
AlThemeVo themeVo = new AlThemeVo();
themeVo.setAlbumId(albumId);
themeVo.setId(alTheme.getId());
themeVo.setName(alTheme.getName());
List<com.yizhi.album.application.domain.AlThemeActivity> activities = new ArrayList<com.yizhi.album.application.domain.AlThemeActivity>();
com.yizhi.album.application.domain.AlThemeActivity activity = new com.yizhi.album.application.domain.AlThemeActivity();
activity.setThemeId(alTheme.getId());
activity.setDeleted(0);
EntityWrapper<com.yizhi.album.application.domain.AlThemeActivity> entityWrapper = new EntityWrapper<com.yizhi.album.application.domain.AlThemeActivity>(activity);
entityWrapper.orderBy("sort", true);
activities = alThemeActivityService.selectList(entityWrapper);
activities.forEach(e->e.setThemeName(alTheme.getName()));
List<AlThemeActivity> alThemeActivities = BeanCopyListUtil.copyListProperties(activities, AlThemeActivity::new);
themeVo.setActivities(alThemeActivities);
list.add(themeVo);
}
albumVo.setList(list);
return albumVo;
}
}
package com.yizhi.album.application.controller;
import com.yizhi.album.application.domain.AlTheme;
import com.yizhi.album.application.service.IAlThemeService;
import com.yizhi.album.application.service.IAlbumService;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
/**
* <p>
* 专辑 - 主题 前端控制器
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@RestController
@RequestMapping("/alTheme")
public class AlThemeController {
private Logger logger = LoggerFactory.getLogger(AlThemeActivityControllerV2.class);
@Autowired
private IAlbumService albumService;
@Autowired
private IAlThemeService alThemeService;
@Autowired
IdGenerator idGenerator;
@GetMapping("/delete")
public Boolean delete(@RequestParam(name = "id")Long id) {
RequestContext context = ContextHolder.get();
Long accountId = context.getAccountId();
String name = context.getAccountName();
Date date = new Date();
boolean b = false;
AlTheme theme = alThemeService.selectById(id);
if (theme!=null) {
theme.setDeleted(1);
theme.setUpdateById(accountId);
theme.setUpdateByName(name);
theme.setUpdateTime(date);
b = alThemeService.updateById(theme);
}
return b;
}
@PostMapping("/sortActivity")
public int sortTheme(@RequestBody List<AlTheme> list) {
logger.info("管理端传入要排序的ID列表==========================:" + list);
return alThemeService.sortTheme(list);
}
@GetMapping("/updateName")
public Boolean updateName(@RequestParam(name = "id") Long id,@RequestParam(name = "albumId") Long albumId,@RequestParam(name = "name") String name) {
RequestContext context = ContextHolder.get();
Long siteId = context.getSiteId();
Long accountId = context.getAccountId();
String accountName = context.getAccountName();
Date date = new Date();
Boolean vaidName = alThemeService.vaidName(id,albumId, name, siteId);
if (!vaidName) {
return Boolean.FALSE;
}
AlTheme theme = alThemeService.selectById(id);
theme.setName(name);
theme.setUpdateById(accountId);
theme.setUpdateByName(accountName);
theme.setUpdateTime(date);
alThemeService.updateById(theme);
return Boolean.TRUE;
}
}
package com.yizhi.album.application.controller;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.yizhi.album.application.domain.ClassifyStrategy;
import com.yizhi.album.application.service.IClassifyStrategyService;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
/**
* <p>
* 专辑分类策略 前端控制器
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@RestController
@RequestMapping("/classifyStrategy")
public class ClassifyStrategyController {
@Autowired
private IClassifyStrategyService classifyStrategyService;
@Autowired
com.yizhi.application.orm.id.IdGenerator IdGenerator;
@GetMapping("/update")
public com.yizhi.album.application.vo.domain.ClassifyStrategy update(@RequestParam(value = "type", required = true) Integer type, @RequestParam(value = "status", required = true) Integer status) {
RequestContext context = ContextHolder.get();
Long siteId = context.getSiteId();
Long companyId = context.getCompanyId();
Long accountId = context.getAccountId();
String name = context.getAccountName();
Date date = new Date();
ClassifyStrategy strategy = new ClassifyStrategy();
strategy.setSiteId(siteId);
strategy.setCompanyId(companyId);
EntityWrapper<ClassifyStrategy> wrapper = new EntityWrapper<ClassifyStrategy>(strategy);
ClassifyStrategy one = classifyStrategyService.selectOne(wrapper);
if (one==null) {
one = new ClassifyStrategy();
one.setId(IdGenerator.generate());
one.setType(type);
one.setStatus(status);
one.setCreateById(accountId);
one.setCreateByName(name);
one.setCreateTime(date);
one.setCompanyId(companyId);
one.setSiteId(siteId);
classifyStrategyService.insert(one);
}else {
one.setType(type);
one.setStatus(status);
one.setUpdateById(accountId);
one.setUpdateByName(name);
one.setUpdateTime(date);
classifyStrategyService.updateById(one);
}
com.yizhi.album.application.vo.domain.ClassifyStrategy classifyStrategy = new com.yizhi.album.application.vo.domain.ClassifyStrategy();
BeanUtils.copyProperties(one, classifyStrategy);
return classifyStrategy;
}
@GetMapping("/get")
public com.yizhi.album.application.vo.domain.ClassifyStrategy get(@RequestParam(value = "companyId", required = true) Long companyId, @RequestParam(value = "siteId", required = true) Long siteId) {
ClassifyStrategy strategy = new ClassifyStrategy();
strategy.setSiteId(siteId);
strategy.setCompanyId(companyId);
EntityWrapper<ClassifyStrategy> wrapper = new EntityWrapper<ClassifyStrategy>(strategy);
ClassifyStrategy one = classifyStrategyService.selectOne(wrapper);
com.yizhi.album.application.vo.domain.ClassifyStrategy classifyStrategy = new com.yizhi.album.application.vo.domain.ClassifyStrategy();
BeanUtils.copyProperties(strategy, classifyStrategy);
return classifyStrategy;
}
}
package com.yizhi.album.application.controller;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.yizhi.album.application.domain.AlTheme;
import com.yizhi.album.application.domain.AlThemeActivity;
import com.yizhi.album.application.domain.Album;
import com.yizhi.album.application.mapper.AlbumMapper;
import com.yizhi.album.application.service.IAlThemeActivityService;
import com.yizhi.album.application.service.IAlThemeService;
import com.yizhi.album.application.service.IAlbumService;
import com.yizhi.album.application.vo.AlThemeVo;
import com.yizhi.album.application.vo.AlbumVo;
import com.yizhi.comment.application.feign.ManageCommentClient;
import com.yizhi.comment.application.feign.SubscribeClient;
import com.yizhi.course.application.feign.CoursePcClient;
import com.yizhi.util.application.beanutil.BeanCopyListUtil;
import com.yizhi.util.application.constant.TpActivityType;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* <p>
* 专辑报表用
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@RestController
@RequestMapping("/statisticsAlbum")
public class StatisticsAlbumController {
@Autowired
private IAlbumService albumService;
@Autowired
private AlbumMapper albumMapper;
@Autowired
private IAlThemeActivityService alThemeActivityService;
@Autowired
private IAlThemeService alThemeService;
@Autowired
private CoursePcClient coursePcClient;
@Autowired
private ManageCommentClient commentClient;
@Autowired
private SubscribeClient subscribeClient;
@GetMapping("/getAllAlbums")
public List<AlbumVo> getAllAlbums(@RequestParam(name = "companyId",required = false)Long companyId, @RequestParam(name = "siteId",required = false)Long siteId){
List<AlbumVo> allAlbums = new ArrayList<AlbumVo>();
List<Long> list = albumMapper.getAllAlbums(companyId, siteId);
List<Long> courseIds = new ArrayList<Long>();
if (CollectionUtils.isNotEmpty(list)) {
for(Long albumId:list) {
int num = 0;
AlbumVo albumVo = new AlbumVo();
Album album = albumService.selectById(albumId);
albumVo.setId(album.getId());
albumVo.setName(album.getName());
albumVo.setShelves(album.getShelves());
albumVo.setClassifyId(album.getClassifyId());
albumVo.setImage(album.getImage());
albumVo.setDescription(album.getDescription());
albumVo.setTags(album.getTags());
albumVo.setScope(album.getScope());
albumVo.setCommentEnable(album.getCommentEnable());
albumVo.setDocumentEnable(album.getDocumentEnable());
albumVo.setOvered(album.getOvered());
albumVo.setDisplay(album.getDisplay());
albumVo.setSiteId(album.getSiteId());
albumVo.setCompanyId(album.getCompanyId());
albumVo.setCreateTime(album.getCreateTime());
List<AlThemeVo> list1 = new ArrayList<AlThemeVo>();
AlTheme theme = new AlTheme();
theme.setAlbumId(albumId);
theme.setDeleted(0);
EntityWrapper<AlTheme> wrapper = new EntityWrapper<AlTheme>(theme);
wrapper.orderBy("sort", true);
List<AlTheme> themes = alThemeService.selectList(wrapper);
for(AlTheme alTheme:themes) {
AlThemeVo themeVo = new AlThemeVo();
themeVo.setAlbumId(albumId);
themeVo.setId(alTheme.getId());
themeVo.setName(alTheme.getName());
List<AlThemeActivity> activities = new ArrayList<AlThemeActivity>();
AlThemeActivity activity = new AlThemeActivity();
activity.setThemeId(alTheme.getId());
activity.setDeleted(0);
EntityWrapper<AlThemeActivity> entityWrapper = new EntityWrapper<AlThemeActivity>(activity);
entityWrapper.orderBy("sort", true);
activities = alThemeActivityService.selectList(entityWrapper);
for(AlThemeActivity alThemeActivity:activities) {
alThemeActivity.setThemeName(alTheme.getName());
if (alThemeActivity.getUnlock().equals(0)) {
courseIds.add(alThemeActivity.getRelationId());
}else {
num++;
}
}
List<com.yizhi.album.application.vo.domain.AlThemeActivity> alThemeActivities =
BeanCopyListUtil.copyListProperties(activities, com.yizhi.album.application.vo.domain.AlThemeActivity::new);
themeVo.setActivities(alThemeActivities);
list1.add(themeVo);
}
Map<Long, Long> durations = coursePcClient.getMaterialTimeByCourseIds(courseIds);
Long duration = (long) 0;
if (null != durations && durations.size() > 0) {
for (Long h : durations.keySet()) {
duration = duration + (durations.get(h) != null ? durations.get(h) : 0l);
}
}
albumVo.setCommentCount(commentClient.getCommentNum(albumId, TpActivityType.TYPE_ALBUM));
albumVo.setSubscribeCount(subscribeClient.getSubscribeNum(albumId, TpActivityType.TYPE_ALBUM));
albumVo.setDuration(duration);
albumVo.setList(list1);
albumVo.setLockNum(num);
allAlbums.add(albumVo);
courseIds.clear();
}
}
return allAlbums;
}
}
package com.yizhi.album.application.controller.remote;
import com.yizhi.album.application.mapper.AlStudentActivityRecordMapper;
import com.yizhi.album.application.vo.domain.AlStudentActivityRecord;
import com.yizhi.util.application.beanutil.BeanCopyListUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 学员完成专辑活动记录 前端控制器
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@RestController(value = "alStudentActivityRecordController1")
@RequestMapping("/remote/alStudentActivityRecord")
public class AlStudentActivityRecordController {
@Autowired
private AlStudentActivityRecordMapper aStudentActivityRecordMapper;
@GetMapping("/statistics/getRecordeAllWorkId")
public List<Long> getRecordeAllWorkId(){
return aStudentActivityRecordMapper.getRecordeAllWorkId();
}
@GetMapping("/statistics/getAllRecordeByTimeLimit")
public List<AlStudentActivityRecord> getAllRecordeByTimeLimit(@RequestParam(value="startDate",required=true)String startDate, @RequestParam(value="endDate",required=true)String endDate, @RequestParam(value="relationId",required=true)Long relationId){
List<AlStudentActivityRecord> alStudentActivityRecord =
BeanCopyListUtil.copyListProperties(aStudentActivityRecordMapper.getAllRecordeByTimeLimit(startDate, endDate, relationId), AlStudentActivityRecord::new);
return alStudentActivityRecord;
}
}
package com.yizhi.album.application.controller.remote;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.yizhi.album.application.domain.AlTheme;
import com.yizhi.album.application.domain.AlThemeActivity;
import com.yizhi.album.application.domain.Album;
import com.yizhi.album.application.service.IAlThemeActivityService;
import com.yizhi.album.application.service.IAlThemeService;
import com.yizhi.album.application.service.IAlbumService;
import com.yizhi.album.application.vo.AlThemeVo;
import com.yizhi.album.application.vo.AlbumVo;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.util.application.beanutil.BeanCopyListUtil;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p>
* 主题中的课程 前端控制器
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@RestController
@RequestMapping("/remote/alThemeActivity")
public class AlThemeActivityController {
private Logger logger = LoggerFactory.getLogger(AlThemeActivityController.class);
@Autowired
private IAlbumService albumService;
@Autowired
private IAlThemeActivityService alThemeActivityService;
@Autowired
private IAlThemeService alThemeService;
@Autowired
IdGenerator idGenerator;
@PostMapping("/save")
public Boolean sava(@RequestBody AlbumVo vo) {
RequestContext context = ContextHolder.get();
Long siteId = context.getSiteId();
Long accountId = context.getAccountId();
Long companyId = context.getCompanyId();
Long orgId = context.getOrgId();
Date date = new Date();
String name = context.getAccountName();
List<AlThemeVo> themeVos = vo.getList();
Album album = albumService.selectById(vo.getId());
album.setOvered(vo.getOvered());
album.setUpdateById(accountId);
album.setUpdateByName(name);
album.setUpdateTime(date);
album.setDisplay(vo.getDisplay());
albumService.updateById(album);
//删除主题
if (CollectionUtils.isNotEmpty(vo.getDeleteList())) {
for(Long id:vo.getDeleteList()) {
AlTheme theme = alThemeService.selectById(id);
theme.setDeleted(1);
theme.setUpdateById(accountId);
theme.setUpdateByName(name);
theme.setUpdateTime(date);
alThemeService.updateById(theme);
}
}
if (CollectionUtils.isNotEmpty(themeVos)) {
for(AlThemeVo themeVo:themeVos) {
//删除主题中活动
if (CollectionUtils.isNotEmpty(themeVo.getDeleteList())) {
for(Long id:themeVo.getDeleteList()) {
AlThemeActivity activity = alThemeActivityService.selectById(id);
activity.setDeleted(1);
activity.setUpdateById(accountId);
activity.setUpdateByName(name);
activity.setUpdateTime(date);
alThemeActivityService.updateById(activity);
}
}
AlTheme theme = new AlTheme();
if (themeVo.getId()==null||themeVo.getId()==0) {
if (!alThemeService.vaidName(null,vo.getId(), themeVo.getName(), siteId)) {
return Boolean.FALSE;
}
theme.setId(idGenerator.generate());
theme.setCreateById(accountId);
theme.setCreateByName(name);
theme.setCreateTime(date);
theme.setSiteId(siteId);
theme.setCompanyId(companyId);
theme.setOrgId(orgId);
}else {
theme.setId(themeVo.getId());
if (!alThemeService.vaidName(themeVo.getId(),vo.getId(), themeVo.getName(), siteId)) {
return Boolean.FALSE;
}
}
theme.setAlbumId(themeVo.getAlbumId());
theme.setName(themeVo.getName());
theme.setSort(themeVo.getSort());
theme.setDeleted(0);
theme.setUpdateById(accountId);
theme.setUpdateByName(name);
theme.setUpdateTime(date);
alThemeService.insertOrUpdate(theme);
for(com.yizhi.album.application.vo.domain.AlThemeActivity activityVo:themeVo.getActivities()) {
AlThemeActivity activity = new AlThemeActivity();
if (activityVo.getId()==null||activityVo.getId()==0) {
activity.setId(idGenerator.generate());
activity.setCreateById(accountId);
activity.setCreateByName(name);
activity.setCreateTime(date);
activity.setSiteId(siteId);
activity.setCompanyId(companyId);
activity.setOrgId(orgId);
}else {
activity.setId(activityVo.getId());
}
activity.setAlbumId(activityVo.getAlbumId());
activity.setThemeId(theme.getId());
activity.setThemeName(theme.getName());
activity.setRelationId(activityVo.getRelationId());
activity.setRelationCode(activityVo.getRelationCode());
activity.setName(activityVo.getName());
activity.setSort(activityVo.getSort());
activity.setDeleted(0);
// activity.setUnlock(activityVo.getUnlock());
activity.setUnlock(vo.getShelves() == 1 && activityVo.getUnlock() == 1 ? 0 : activityVo.getUnlock());
activity.setUnlockTime(activityVo.getUnlockTime());
alThemeActivityService.insertOrUpdate(activity);
}
}
}
return Boolean.TRUE;
}
@GetMapping("/delete")
public Boolean delete(@RequestParam(name = "id")Long id) {
RequestContext context = ContextHolder.get();
Long accountId = context.getAccountId();
String name = context.getAccountName();
Date date = new Date();
boolean b = false;
AlThemeActivity activity = alThemeActivityService.selectById(id);
if (activity!=null) {
activity.setDeleted(1);
activity.setUpdateById(accountId);
activity.setUpdateByName(name);
activity.setUpdateTime(date);
b = alThemeActivityService.updateById(activity);
}
return b;
}
@PostMapping("/sortActivity")
public Boolean sortActivity(@RequestBody List<AlThemeActivity> list) {
logger.info("管理端传入要排序的ID列表==========================:" + list);
return alThemeActivityService.sortActivity(list);
}
@PostMapping("/unLock")
public Boolean unLock(@RequestBody AlThemeActivity activity) {
logger.info("管理端传入定时解锁的活动==========================:" + activity);
return alThemeActivityService.updateById(activity);
}
@GetMapping("/list")
public AlbumVo list(@RequestParam(name = "albumId")Long albumId){
AlbumVo albumVo = new AlbumVo();
Album album = albumService.selectById(albumId);
albumVo.setId(album.getId());
albumVo.setName(album.getName());
albumVo.setShelves(album.getShelves());
albumVo.setClassifyId(album.getClassifyId());
albumVo.setImage(album.getImage());
albumVo.setDescription(album.getDescription());
albumVo.setTags(album.getTags());
albumVo.setScope(album.getScope());
albumVo.setCommentEnable(album.getCommentEnable());
albumVo.setDocumentEnable(album.getDocumentEnable());
albumVo.setOvered(album.getOvered());
albumVo.setDisplay(album.getDisplay());
List<AlThemeVo> list = new ArrayList<AlThemeVo>();
AlTheme theme = new AlTheme();
theme.setAlbumId(albumId);
theme.setDeleted(0);
EntityWrapper<AlTheme> wrapper = new EntityWrapper<AlTheme>(theme);
wrapper.orderBy("sort", true);
List<AlTheme> themes = alThemeService.selectList(wrapper);
for(AlTheme alTheme:themes) {
AlThemeVo themeVo = new AlThemeVo();
themeVo.setAlbumId(albumId);
themeVo.setId(alTheme.getId());
themeVo.setName(alTheme.getName());
List<AlThemeActivity> activities = new ArrayList<>();
AlThemeActivity activity = new AlThemeActivity();
activity.setThemeId(alTheme.getId());
activity.setDeleted(0);
EntityWrapper<AlThemeActivity> entityWrapper = new EntityWrapper<AlThemeActivity>(activity);
entityWrapper.orderBy("sort", true);
activities = alThemeActivityService.selectList(entityWrapper);
activities.forEach(e->e.setThemeName(alTheme.getName()));
List<com.yizhi.album.application.vo.domain.AlThemeActivity> alThemeActivities =
BeanCopyListUtil.copyListProperties(activities, com.yizhi.album.application.vo.domain.AlThemeActivity::new);
themeVo.setActivities(alThemeActivities);
list.add(themeVo);
}
albumVo.setList(list);
return albumVo;
}
}
package com.yizhi.album.application.controller.remote;
import com.yizhi.album.application.controller.AlThemeActivityControllerV2;
import com.yizhi.album.application.domain.AlTheme;
import com.yizhi.album.application.service.IAlThemeService;
import com.yizhi.album.application.service.IAlbumService;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
/**
* <p>
* 专辑 - 主题 前端控制器
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@RestController(value = "alThemeController1")
@RequestMapping("/remote/alTheme")
public class AlThemeController {
private Logger logger = LoggerFactory.getLogger(AlThemeActivityControllerV2.class);
@Autowired
private IAlbumService albumService;
@Autowired
private IAlThemeService alThemeService;
@Autowired
IdGenerator idGenerator;
@GetMapping("/delete")
public Boolean delete(@RequestParam(name = "id")Long id) {
RequestContext context = ContextHolder.get();
Long accountId = context.getAccountId();
String name = context.getAccountName();
Date date = new Date();
boolean b = false;
AlTheme theme = alThemeService.selectById(id);
if (theme!=null) {
theme.setDeleted(1);
theme.setUpdateById(accountId);
theme.setUpdateByName(name);
theme.setUpdateTime(date);
b = alThemeService.updateById(theme);
}
return b;
}
@PostMapping("/sortActivity")
public int sortTheme(@RequestBody List<AlTheme> list) {
logger.info("管理端传入要排序的ID列表==========================:" + list);
return alThemeService.sortTheme(list);
}
@GetMapping("/updateName")
public Boolean updateName(@RequestParam(name = "id") Long id,@RequestParam(name = "albumId") Long albumId,@RequestParam(name = "name") String name) {
RequestContext context = ContextHolder.get();
Long siteId = context.getSiteId();
Long accountId = context.getAccountId();
String accountName = context.getAccountName();
Date date = new Date();
Boolean vaidName = alThemeService.vaidName(id,albumId, name, siteId);
if (!vaidName) {
return Boolean.FALSE;
}
AlTheme theme = alThemeService.selectById(id);
theme.setName(name);
theme.setUpdateById(accountId);
theme.setUpdateByName(accountName);
theme.setUpdateTime(date);
alThemeService.updateById(theme);
return Boolean.TRUE;
}
}
package com.yizhi.album.application.controller.remote;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.yizhi.album.application.domain.ClassifyStrategy;
import com.yizhi.album.application.service.IClassifyStrategyService;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
/**
* <p>
* 专辑分类策略 前端控制器
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@RestController(value = "classifyStrategyController1")
@RequestMapping("/remote/classifyStrategy")
public class ClassifyStrategyController {
@Autowired
private IClassifyStrategyService classifyStrategyService;
@Autowired
com.yizhi.application.orm.id.IdGenerator IdGenerator;
@GetMapping("/update")
public com.yizhi.album.application.vo.domain.ClassifyStrategy update(@RequestParam(value = "type", required = true) Integer type, @RequestParam(value = "status", required = true) Integer status) {
RequestContext context = ContextHolder.get();
Long siteId = context.getSiteId();
Long companyId = context.getCompanyId();
Long accountId = context.getAccountId();
String name = context.getAccountName();
Date date = new Date();
ClassifyStrategy strategy = new ClassifyStrategy();
strategy.setSiteId(siteId);
strategy.setCompanyId(companyId);
EntityWrapper<ClassifyStrategy> wrapper = new EntityWrapper<ClassifyStrategy>(strategy);
ClassifyStrategy one = classifyStrategyService.selectOne(wrapper);
if (one==null) {
one = new ClassifyStrategy();
one.setId(IdGenerator.generate());
one.setType(type);
one.setStatus(status);
one.setCreateById(accountId);
one.setCreateByName(name);
one.setCreateTime(date);
one.setCompanyId(companyId);
one.setSiteId(siteId);
classifyStrategyService.insert(one);
}else {
one.setType(type);
one.setStatus(status);
one.setUpdateById(accountId);
one.setUpdateByName(name);
one.setUpdateTime(date);
classifyStrategyService.updateById(one);
}
com.yizhi.album.application.vo.domain.ClassifyStrategy classifyStrategy = new com.yizhi.album.application.vo.domain.ClassifyStrategy();
BeanUtils.copyProperties(one, classifyStrategy);
return classifyStrategy;
}
@GetMapping("/get")
public com.yizhi.album.application.vo.domain.ClassifyStrategy get(@RequestParam(value = "companyId", required = true) Long companyId, @RequestParam(value = "siteId", required = true) Long siteId) {
ClassifyStrategy strategy = new ClassifyStrategy();
strategy.setSiteId(siteId);
strategy.setCompanyId(companyId);
EntityWrapper<ClassifyStrategy> wrapper = new EntityWrapper<ClassifyStrategy>(strategy);
ClassifyStrategy one = classifyStrategyService.selectOne(wrapper);
com.yizhi.album.application.vo.domain.ClassifyStrategy classifyStrategy = new com.yizhi.album.application.vo.domain.ClassifyStrategy();
BeanUtils.copyProperties(one, classifyStrategy);
return classifyStrategy;
}
}
package com.yizhi.album.application.controller.remote;
import com.yizhi.album.application.service.IAlbumService;
import com.yizhi.album.application.util.BuildJob;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
/**
* <p>
* 前端控制器
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@RestController(value = "remoteJobHandleController1")
@Api(tags = "专辑涉及job接口")
@RequestMapping("/remote/album")
public class RemoteJobHandleController {
@Autowired
private BuildJob buildJob;
@Autowired
private IAlbumService albumService;
private Logger logger = LoggerFactory.getLogger(RemoteJobHandleController.class);
/**
* 定时任务执行实际的处理逻辑类
* 定时任务业务逻辑处理
*
* @param
* @return
*/
@GetMapping("/albumUnLock")
@ApiOperation(value = "定时解锁专辑课程", response = String.class)
public void unLockCourse() {
try {
logger.info("开始处理定时任务");
albumService.unLockCourse();
} catch (Exception e) {
e.printStackTrace();
logger.info("定时任务处理异常");
}
}
@GetMapping("/buildJob")
@ApiOperation(value = "构建一个job任务,默认每五分钟处理,也可指定cron表达式", response = String.class)
public void buildJob(@RequestParam(value = "hanldeTime",required = false)Date hanldeTime ) throws Exception {
if (hanldeTime == null){
buildJob.buildJobDefault("定时解锁专辑课程,默认每五分钟处理一次");
}else {
buildJob.buildJob(new Date().toString(),hanldeTime);
}
}
}
package com.yizhi.album.application.controller.remote;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.yizhi.album.application.domain.AlTheme;
import com.yizhi.album.application.domain.AlThemeActivity;
import com.yizhi.album.application.domain.Album;
import com.yizhi.album.application.mapper.AlbumMapper;
import com.yizhi.album.application.service.IAlThemeActivityService;
import com.yizhi.album.application.service.IAlThemeService;
import com.yizhi.album.application.service.IAlbumService;
import com.yizhi.album.application.vo.AlThemeVo;
import com.yizhi.album.application.vo.AlbumVo;
import com.yizhi.comment.application.feign.ManageCommentClient;
import com.yizhi.comment.application.feign.SubscribeClient;
import com.yizhi.course.application.feign.CoursePcClient;
import com.yizhi.util.application.beanutil.BeanCopyListUtil;
import com.yizhi.util.application.constant.TpActivityType;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* <p>
* 专辑报表用
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@RestController(value = "statisticsAlbumController1")
@RequestMapping("/remote/statisticsAlbum")
public class StatisticsAlbumController {
@Autowired
private IAlbumService albumService;
@Autowired
private AlbumMapper albumMapper;
@Autowired
private IAlThemeActivityService alThemeActivityService;
@Autowired
private IAlThemeService alThemeService;
@Autowired
private CoursePcClient coursePcClient;
@Autowired
private ManageCommentClient commentClient;
@Autowired
private SubscribeClient subscribeClient;
@GetMapping("/getAllAlbums")
public List<AlbumVo> getAllAlbums(@RequestParam(name = "companyId",required = false)Long companyId,@RequestParam(name = "siteId",required = false)Long siteId){
List<AlbumVo> allAlbums = new ArrayList<AlbumVo>();
List<Long> list = albumMapper.getAllAlbums(companyId, siteId);
List<Long> courseIds = new ArrayList<Long>();
if (CollectionUtils.isNotEmpty(list)) {
for(Long albumId:list) {
int num = 0;
AlbumVo albumVo = new AlbumVo();
Album album = albumService.selectById(albumId);
albumVo.setId(album.getId());
albumVo.setName(album.getName());
albumVo.setShelves(album.getShelves());
albumVo.setClassifyId(album.getClassifyId());
albumVo.setImage(album.getImage());
albumVo.setDescription(album.getDescription());
albumVo.setTags(album.getTags());
albumVo.setScope(album.getScope());
albumVo.setCommentEnable(album.getCommentEnable());
albumVo.setDocumentEnable(album.getDocumentEnable());
albumVo.setOvered(album.getOvered());
albumVo.setDisplay(album.getDisplay());
albumVo.setSiteId(album.getSiteId());
albumVo.setCompanyId(album.getCompanyId());
albumVo.setCreateTime(album.getCreateTime());
List<AlThemeVo> list1 = new ArrayList<AlThemeVo>();
AlTheme theme = new AlTheme();
theme.setAlbumId(albumId);
theme.setDeleted(0);
EntityWrapper<AlTheme> wrapper = new EntityWrapper<AlTheme>(theme);
wrapper.orderBy("sort", true);
List<AlTheme> themes = alThemeService.selectList(wrapper);
for(AlTheme alTheme:themes) {
AlThemeVo themeVo = new AlThemeVo();
themeVo.setAlbumId(albumId);
themeVo.setId(alTheme.getId());
themeVo.setName(alTheme.getName());
List<AlThemeActivity> activities = new ArrayList<AlThemeActivity>();
AlThemeActivity activity = new AlThemeActivity();
activity.setThemeId(alTheme.getId());
activity.setDeleted(0);
EntityWrapper<AlThemeActivity> entityWrapper = new EntityWrapper<AlThemeActivity>(activity);
entityWrapper.orderBy("sort", true);
activities = alThemeActivityService.selectList(entityWrapper);
for(AlThemeActivity alThemeActivity:activities) {
alThemeActivity.setThemeName(alTheme.getName());
if (alThemeActivity.getUnlock().equals(0)) {
courseIds.add(alThemeActivity.getRelationId());
}else {
num++;
}
}
//拷贝vo
List<com.yizhi.album.application.vo.domain.AlThemeActivity> alThemeActivityVoList = new ArrayList<>();
for (AlThemeActivity alThemeActivity : activities) {
com.yizhi.album.application.vo.domain.AlThemeActivity activityVo = new com.yizhi.album.application.vo.domain.AlThemeActivity();
BeanUtils.copyProperties(alThemeActivity,activityVo);
alThemeActivityVoList.add(activityVo);
}
themeVo.setActivities(alThemeActivityVoList);
list1.add(themeVo);
}
Map<Long, Long> durations = coursePcClient.getMaterialTimeByCourseIds(courseIds);
Long duration = (long) 0;
if (null != durations && durations.size() > 0) {
for (Long h : durations.keySet()) {
duration = duration + (durations.get(h) != null ? durations.get(h) : 0l);
}
}
albumVo.setCommentCount(commentClient.getCommentNum(albumId, TpActivityType.TYPE_ALBUM));
albumVo.setSubscribeCount(subscribeClient.getSubscribeNum(albumId, TpActivityType.TYPE_ALBUM));
albumVo.setDuration(duration);
albumVo.setList(list1);
albumVo.setLockNum(num);
allAlbums.add(albumVo);
courseIds.clear();
}
}
return allAlbums;
}
}
package com.yizhi.album.application.domain;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 学员完成专辑活动记录
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Data
@ApiModel(value = "AlStudentActivityRecord", description = "学员完成专辑活动记录")
@TableName("al_student_activity_record")
public class AlStudentActivityRecord {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "学员id")
@TableField("account_id")
private Long accountId;
@ApiModelProperty(value = "冗余专辑id")
@TableField("album_id")
private Long albumId;
@ApiModelProperty(value = "课程id")
@TableField("relation_id")
private Long relationId;
@ApiModelProperty(value = "若是课程,需要记录学习时长")
private Long seconds;
@ApiModelProperty(value = "是否完成(1是,0否),默认未完成。")
private Integer finished;
@ApiModelProperty(value = "完成时间")
@TableField("finish_date")
private Date finishDate;
@ApiModelProperty(value = "所属站点id")
@TableField("site_id")
private Long siteId;
}
package com.yizhi.album.application.domain;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 专辑 - 主题
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Data
@ApiModel(value = "AlTheme", description = "专辑 - 主题")
@TableName("al_theme")
public class AlTheme {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "所属专辑id")
@TableField("album_id")
private Long albumId;
@ApiModelProperty(value = "主题名称")
private String name;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "是否删除(1是,0否),默认否")
private Integer deleted;
@ApiModelProperty(value = "创建者id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(value = "创建者名称")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(value = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "更新者id")
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@ApiModelProperty(value = "修改者名称")
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@ApiModelProperty(value = "修改时间")
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@ApiModelProperty(value = "站点id")
@TableField("site_id")
private Long siteId;
@ApiModelProperty(value = "组织id")
@TableField("org_id")
private Long orgId;
@ApiModelProperty(value = "企业id")
@TableField("company_id")
private Long companyId;
}
package com.yizhi.album.application.domain;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 主题中的课程
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Data
@ApiModel(value = "AlThemeActivity", description = "主题中的课程")
@TableName("al_theme_activity")
public class AlThemeActivity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键id")
private Long id;
@ApiModelProperty(value = "冗余专辑id")
@TableField("album_id")
private Long albumId;
@ApiModelProperty(value = "主题id")
@TableField("theme_id")
private Long themeId;
@ApiModelProperty(value = "主题名称")
private String themeName;
@ApiModelProperty(value = "课程id")
@TableField("relation_id")
private Long relationId;
@ApiModelProperty(value = "课程code")
@TableField("relation_code")
private String relationCode;
@ApiModelProperty(value = "课程名称")
private String name;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "是否删除(1是,0否),默认否")
private Integer deleted;
@ApiModelProperty(value = "解锁状态 0已解锁 1发布及解锁 2自定义解锁")
private Integer unlock;
@ApiModelProperty(value = "解锁时间")
@TableField("unlock_time")
private Date unlockTime;
@ApiModelProperty(value = "创建者id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(value = "创建者名称")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(value = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "更新者id")
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@ApiModelProperty(value = "修改者名称")
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@ApiModelProperty(value = "修改时间")
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@ApiModelProperty(value = "站点id")
@TableField("site_id")
private Long siteId;
@ApiModelProperty(value = "组织id")
@TableField("org_id")
private Long orgId;
@ApiModelProperty(value = "企业id")
@TableField("company_id")
private Long companyId;
}
package com.yizhi.album.application.domain;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 专辑表
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Data
@ApiModel(value = "Album", description = "专辑表")
@TableName("album")
public class Album {
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty(value = "专辑名称")
private String name;
@ApiModelProperty(value = "专辑封面图")
private String image;
@ApiModelProperty(value = "专辑介绍")
private String description;
@ApiModelProperty(value = "自定义关键字")
private String tags;
@ApiModelProperty(value = "0 未上架 1 已上架 2草稿")
private Integer shelves;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@TableField("company_id")
private Long companyId;
@TableField("org_id")
private Long orgId;
@TableField("site_id")
private Long siteId;
@ApiModelProperty(value = "分类id")
@TableField("classify_id")
private Long classifyId;
@ApiModelProperty(value = "可见范围 1 平台用户 2 指定范围 默认全平台可见")
private Integer scope;
@ApiModelProperty(value = "专辑评论 0显示 1不显示 默认显示")
@TableField("comment_enable")
private Integer commentEnable;
@ApiModelProperty(value = "专辑资料 0显示 1不显示 默认显示")
@TableField("document_enable")
private Integer documentEnable;
@ApiModelProperty(value = "0:默认未删除;1表示删除")
@TableField("del_flg")
private Integer delFlg;
@ApiModelProperty(value = "完成状态 0连载中 1已完结")
private Integer overed;
@ApiModelProperty(value = "显示模式 0全部显示 1只显示已解锁课程 默认全部显示")
private Integer display;
@ApiModelProperty(value = "专辑是否在日历中显示 默认为 0:不开启 1:开启")
@TableField("enable_task")
private Integer enableTask;
@ApiModelProperty(value = "日历任务开始时间:enable-task不为0时,有值")
@TableField(value = "task_start_date")
private Date taskStartDate;
@ApiModelProperty(value = "日历任务结束时间:enable-task不为0时,有值")
@TableField(value = "task_end_date")
private Date taskEndDate;
}
package com.yizhi.album.application.domain;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 专辑分类
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Data
@ApiModel(value = "AlbumClassify", description = "专辑分类")
@TableName("album_classify")
public class AlbumClassify extends Model<AlbumClassify>{
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "父id ")
@TableField("parent_id")
private Long parentId;
@ApiModelProperty(value = "层级")
private Integer layer;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "分类编码")
private String code;
@ApiModelProperty(value = "备注")
private String description;
@ApiModelProperty(value = "状态")
private Integer status;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@TableField("org_id")
private Long orgId;
@TableField("company_id")
private Long companyId;
@TableField("site_id")
private Long siteId;
@ApiModelProperty(value = "顶层节点id")
@TableField("root_id")
private Long rootId;
@ApiModelProperty(value = "排序")
private Integer sort;
private String path;
@Override
protected Serializable pkVal() {
// TODO Auto-generated method stub
return this.id;
}
}
package com.yizhi.album.application.domain;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableLogic;
import com.baomidou.mybatisplus.annotations.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
* 专辑可见范围表
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@ApiModel(value = "AlbumVisableRange", description = "专辑可见范围表")
@TableName("album_visible_range")
@Data
public class AlbumVisibleRange {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "专辑主键_ID,外键")
@TableField("album_id")
private Long albumId;
@ApiModelProperty(value = "1用户 2组织")
private Integer type;
@ApiModelProperty(value = "存放人或组织的ID")
@TableField("relation_id")
private Long relationId;
@ApiModelProperty(value = "名称")
@TableField("name")
private String name;
@ApiModelProperty(value = "真实姓名")
@TableField("full_name")
private String fullName;
@ApiModelProperty(value = "0删除 1有效,默认有效")
@TableLogic
private Integer state;
@ApiModelProperty(value = "站点_ID")
@TableField("site_id")
private Long siteId;
@ApiModelProperty(value = "企业_ID")
@TableField("company_id")
private Long companyId;
}
package com.yizhi.album.application.domain;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <p>
* 专辑分类策略
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Data
@ApiModel(value = "ClassifyStrategy", description = "专辑分类策略")
@TableName("classify_strategy")
public class ClassifyStrategy {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "策略类型 0平铺式 1展开式 默认平铺式")
private Integer type;
@ApiModelProperty(value = "状态")
private Integer status;
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@TableField("company_id")
private Long companyId;
@TableField("site_id")
private Long siteId;
}
package com.yizhi.album.application.event;
import com.yizhi.album.application.domain.AlStudentActivityRecord;
import com.yizhi.album.application.mapper.AlStudentActivityRecordMapper;
import com.yizhi.album.application.mapper.AlThemeActivityMapper;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.core.application.cache.CacheNamespace;
import com.yizhi.core.application.cache.RedisCache;
import com.yizhi.core.application.event.EventWrapper;
import com.yizhi.util.application.event.TrainingProjectEvent;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Transactional
public class AlEventHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(AlEventHandler.class);
@Autowired
private IdGenerator idGenerator;
@Autowired
private RedisCache redisCache;
@Autowired
private AlStudentActivityRecordMapper alStudentActivityRecordMapper;
@Autowired
private AlThemeActivityMapper alThemeActivityMapper;
public void handle(EventWrapper<TrainingProjectEvent> ew) {
TrainingProjectEvent event = ew.getData();
LOGGER.info("接收到消息:{}", event);
List<Long> list = alThemeActivityMapper.getIdsByActivityId(event.getId(), event.getSiteId());
if (CollectionUtils.isNotEmpty(list)) {
for(Long id :list) {
AlStudentActivityRecord aar = new AlStudentActivityRecord();
aar.setId(idGenerator.generate());
aar.setAccountId(event.getAccountId());
aar.setAlbumId(id);
aar.setFinishDate(event.getNow());
aar.setFinished(event.getCourseFinished() == null ? 0 : event.getCourseFinished() ? 1 : 0);
aar.setSeconds(event.getCourseSeconds());
aar.setRelationId(event.getId());
aar.setSiteId(event.getSiteId());
LOGGER.info("入库主题活动完成记录:{}", aar);
Integer result = alStudentActivityRecordMapper.insert(aar);
// 缓存完成记录
if (result.equals(1)) {
if (aar.getFinished().equals(1)) {
cacheRecord(CacheNamespace.AL_ACTIVITY_FINISHED, aar.getAccountId(), aar.getRelationId(), id,1);
cacheDeleteUnfinished(aar.getAccountId(), aar.getRelationId(),id);
} else {
cacheRecord(CacheNamespace.AL_ACTIVITY_UNFINISHED, aar.getAccountId(), aar.getRelationId(),id, 0);
}
}
}
}
}
/**
* 缓存学习记录
*
* @param keyPrefix
* @param accountId
* @param id planId or relationId
*/
private void cacheRecord(String keyPrefix, long accountId, long id,long albumId, Integer finished) {
redisCache.hsetIfAbsent(keyPrefix.concat(String.valueOf(accountId+":"+albumId)), String.valueOf(id),
String.valueOf(finished));
}
/**
* 删除已完成中曾经的未完成记录
*
* @param accountId
* @param relationId
*/
private void cacheDeleteUnfinished(long accountId, long relationId,long albumId) {
redisCache.hdel(CacheNamespace.AL_ACTIVITY_UNFINISHED.concat(String.valueOf(accountId+":"+albumId)),
new String[] { String.valueOf(relationId) });
}
}
package com.yizhi.album.application.event;
import com.yizhi.core.application.event.EventWrapper;
import com.yizhi.util.application.constant.QueueConstant;
import com.yizhi.util.application.event.TrainingProjectEvent;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@RabbitListener(queues = QueueConstant.ALBUM_EVENT_QUEUE)
public class AlEventListener {
@Autowired
private AlEventHandler alEventHandler;
@RabbitHandler
public void processBizEvent(EventWrapper<TrainingProjectEvent> ew) {
alEventHandler.handle(ew);
}
}
package com.yizhi.album.application.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.yizhi.album.application.domain.AlStudentActivityRecord;
import com.yizhi.album.application.vo.ApiListAlbumVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 学员完成专辑活动记录 Mapper 接口
* </p>
*
* @author hc123
* @since 2019-12-30
*/
public interface AlStudentActivityRecordMapper extends BaseMapper<AlStudentActivityRecord> {
public List<ApiListAlbumVo> getStudentNumByIds(@Param(value = "ids") List<Long> ids);
public Integer getStudyNum(@Param(value = "albumId") Long albumId);
List<Long> getRecordeAllWorkId();
List<AlStudentActivityRecord> getAllRecordeByTimeLimit(@Param(value="startDate")String startDate,@Param(value="endDate")String endDate,@Param("relationId")Long relationId);
Integer getStatus(@Param(value = "albumId") Long albumId, @Param(value = "accountId") Long accountId,
@Param(value = "siteId") Long siteId,@Param("relationId")Long relationId);
}
<?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.yizhi.album.application.mapper.AlStudentActivityRecordMapper">
<!-- 通用查询映射结果 -->
<resultMap id="ApiResultMap"
type="com.yizhi.album.application.vo.ApiListAlbumVo">
<id column="id" property="id" />
<result column="name" property="name" />
<result column="image" property="image" />
<result column="classify_id" property="classifyId" />
<result column="overed" property="overed" />
<result column="valid" property="valid" />
<result column="update_time" property="unLockTime" />
</resultMap>
<select id="getStudentNumByIds"
resultType="com.yizhi.album.application.vo.ApiListAlbumVo">
select COUNT(DISTINCT a.account_id) studyNum,a.album_id id FROM
al_student_activity_record a
where a.album_id
IN
<foreach collection="ids" index="index" item="id"
separator="," open="(" close=")">
#{id}
</foreach>
GROUP BY a.album_id
</select>
<select id="getStudyNum" resultType="java.lang.Integer">
select COUNT(DISTINCT
a.account_id) studyNum FROM al_student_activity_record
a
where
a.album_id
=#{albumId}
</select>
<select id="getRecordeAllWorkId" resultType="java.lang.Long">
SELECT DISTINCT(relation_id) FROM `al_theme_activity` a LEFT JOIN album b on a.album_id=b.id where a.deleted = 0
</select>
<select id="getAllRecordeByTimeLimit"
resultType="com.yizhi.album.application.vo.domain.AlStudentActivityRecord">
select * from al_student_activity_record a LEFT JOIN album b on a.album_id=b.id
where relation_id=#{relationId} and b.shelves = 1 and b.del_flg =0
<if
test="startDate!=null and startDate!='' and endDate!=null and endDate!=''">
AND (<![CDATA[ DATE_FORMAT(finish_date,'%Y-%m-%d')<=DATE_FORMAT(#{endDate,jdbcType=VARCHAR},'%Y-%m-%d') ]]>
AND <![CDATA[ DATE_FORMAT(finish_date,'%Y-%m-%d')>=DATE_FORMAT(#{startDate,jdbcType=VARCHAR},'%Y-%m-%d') ]]>)
</if>
</select>
<select id="getStatus" resultType="java.lang.Integer">
select MAX(finished) from al_student_activity_record where
relation_id=#{relationId} and album_id = #{albumId} and account_id =
#{accountId} and site_id = #{siteId}
</select>
</mapper>
package com.yizhi.album.application.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.yizhi.album.application.domain.AlThemeActivity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 主题中的课程 Mapper 接口
* </p>
*
* @author hc123
* @since 2019-12-30
*/
public interface AlThemeActivityMapper extends BaseMapper<AlThemeActivity> {
Integer maxSort(@Param(value = "themeId")Long themeId,@Param(value = "siteId")Long siteId);
List<AlThemeActivity> list(@Param(value = "themeId")Long themeId,@Param(value = "type")Integer type);
List<Long> getIdsByActivityId(@Param("activityId") Long activityId, @Param("siteId") Long siteId);
}
<?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.yizhi.album.application.mapper.AlThemeActivityMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap"
type="com.yizhi.album.application.domain.AlThemeActivity">
<id column="id" property="id" />
<result column="album_id" property="albumId" />
<result column="theme_id" property="themeId" />
<result column="relation_id" property="relationId" />
<result column="relation_code" property="relationCode" />
<result column="name" property="name" />
<result column="sort" property="sort" />
<result column="deleted" property="deleted" />
<result column="unlock" property="unlock" />
<result column="unlock_time" property="unlockTime" />
<result column="create_by_id" property="createById" />
<result column="create_by_name" property="createByName" />
<result column="create_time" property="createTime" />
<result column="update_by_id" property="updateById" />
<result column="update_by_name" property="updateByName" />
<result column="update_time" property="updateTime" />
<result column="company_id" property="companyId" />
<result column="org_id" property="orgId" />
<result column="site_id" property="siteId" />
</resultMap>
<select id="maxSort" resultType="java.lang.Integer">
SELECT
IFNULL(max(a.sort),0)
FROM
al_theme_activity a
WHERE
a.`theme_id` = #{themeId}
AND a.site_id =
#{siteId}
AND a.deleted = 0
</select>
<select id="list" resultMap="BaseResultMap">
SELECT
*
FROM
al_theme_activity a
WHERE
a.deleted = 0
AND a.theme_id = #{themeId}
<choose>
<when test="type != null and type==0">
AND a.`unlock` = 0
</when>
<otherwise>
AND a.`unlock` != 0
</otherwise>
</choose>
ORDER BY a.sort
</select>
<select id="getIdsByActivityId" resultType="java.lang.Long">
select distinct a.id
from album a
left join al_theme_activity ata on ata.album_id = a.id
where ata.relation_id = #{activityId} and a.site_id = #{siteId} and ata.unlock=0 and a.shelves=1 and a.del_flg=0
</select>
</mapper>
package com.yizhi.album.application.mapper;
import com.yizhi.album.application.domain.AlTheme;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* <p>
* 专辑 - 主题 Mapper 接口
* </p>
*
* @author hc123
* @since 2019-12-30
*/
public interface AlThemeMapper extends BaseMapper<AlTheme> {
Integer vailName(@Param(value = "id") Long id,@Param(value = "albumId") Long albumId, @Param(value = "name") String name, @Param(value = "siteId") Long siteId);
}
<?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.yizhi.album.application.mapper.AlThemeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap"
type="com.yizhi.album.application.domain.AlTheme">
<id column="id" property="id" />
<result column="name" property="name" />
<result column="album_id" property="albumId" />
<result column="sort" property="sort" />
<result column="deleted" property="deleted" />
<result column="create_by_id" property="createById" />
<result column="create_by_name" property="createByName" />
<result column="create_time" property="createTime" />
<result column="update_by_id" property="updateById" />
<result column="update_by_name" property="updateByName" />
<result column="update_time" property="updateTime" />
<result column="company_id" property="companyId" />
<result column="org_id" property="orgId" />
<result column="site_id" property="siteId" />
</resultMap>
<select id="vailName" resultType="java.lang.Integer">
SELECT
COUNT(a.id)
FROM
al_theme a
WHERE
a.`name` = #{name}
AND a.site_id =
#{siteId}
AND a.`album_id` = #{albumId}
<if test="id!=null ">
AND a.`id` != #{id}
</if>
AND a.deleted = 0
</select>
</mapper>
package com.yizhi.album.application.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.yizhi.album.application.domain.AlbumClassify;
import com.yizhi.album.application.vo.AlbumClassifyVo;
import com.yizhi.album.application.vo.ApiAlbumClassifyVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds;
import java.util.List;
/**
* <p>
* 专辑分类 Mapper 接口
* </p>
*
* @author hc123
* @since 2019-12-30
*/
public interface AlbumClassifyMapper extends BaseMapper<AlbumClassify> {
/**
* 查找这个父级分类下的最大排序数
* @param parentId
* @return
*/
int selectSort(@Param("ParentId") Long parentId);
/**
*查找这个分类下的层数
* @param parentId
* @return
*/
@Select("select ifnull(layer,0)\n" +
"from cloud_album.album_classify\n" +
"where parent_id=#{ParentId}\n" +
"limit 1")
int selectLayer(@Param("ParentId") Long parentId);
/**
* 根据id查找层级
* @param Id
* @return
*/
int selectParentLayer(@Param("Id") Long Id);
/**
* 根据id查找root_id
* @param Id
* @return
*/
Long selectRootid(@Param("Id") Long Id);
/**
* 根据id查找其有没有子级分类
* @param Id
* @return
*/
Long selectChild(@Param("Id") Long Id);
/**
* 根据分类id查找下面所挂的专辑
* @param Id
* @return
*/
Long selectAlbum(@Param("Id") Long Id, @Param("siteId") Long siteId);
List<ApiAlbumClassifyVo> selectListByCompanyId(@Param("companyId") Long companyId, @Param("name") String name,
@Param("orgIds") List<Long> orgIds, @Param("siteId") Long siteId,
RowBounds rowBounds);
Integer selectCountByCompanyId(@Param("companyId") Long companyId,@Param("name") String name,@Param("orgIds") List<Long> orgIds,@Param("siteId") Long siteId);
List<AlbumClassify> selectClassifyByRootId(@Param("ids") List<Long> ids);
List<AlbumClassify> selectClassifyByLayer(@Param("companyId") Long companyId,@Param("siteId") Long siteId,@Param("layer") Integer layer);
@Select("<script>" +
"SELECT parent_id AS id ,COUNT(0) AS total FROM album_classify " +
"WHERE parent_id in " +
"<foreach collection=\"classifyIds\" open=\"(\" close=\")\" separator=\",\" item=\"cid\" index=\"index\">"+
"#{cid}"+
"</foreach>"+
" GROUP BY parent_id" +
"</script>")
List<AlbumClassifyVo> findExistChildNodes(@Param("classifyIds") List<Long> classifyIds);
}
<?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.yizhi.album.application.mapper.AlbumClassifyMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.yizhi.album.application.domain.AlbumClassify">
<id column="id" property="id"/>
<result column="parent_id" property="parentId"/>
<result column="layer" property="layer"/>
<result column="name" property="name"/>
<result column="code" property="code"/>
<result column="description" property="description"/>
<result column="status" property="status"/>
<result column="create_by_id" property="createById"/>
<result column="create_by_name" property="createByName"/>
<result column="create_time" property="createTime"/>
<result column="update_by_id" property="updateById"/>
<result column="update_by_name" property="updateByName"/>
<result column="update_time" property="updateTime"/>
<result column="org_id" property="orgId"/>
<result column="company_id" property="companyId"/>
<result column="site_id" property="siteId"/>
<result column="root_id" property="rootId"/>
<result column="sort" property="sort"/>
<result column="path" property="path"/>
</resultMap>
<resultMap id="ApiResultMap" type="com.yizhi.album.application.vo.ApiAlbumClassifyVo">
<id column="id" property="id"/>
<result column="parent_id" property="parentId"/>
<result column="layer" property="layer"/>
<result column="name" property="name"/>
<result column="code" property="code"/>
<result column="description" property="description"/>
<result column="status" property="status"/>
<result column="create_by_id" property="createById"/>
<result column="create_by_name" property="createByName"/>
<result column="create_time" property="createTime"/>
<result column="update_by_id" property="updateById"/>
<result column="update_by_name" property="updateByName"/>
<result column="update_time" property="updateTime"/>
<result column="org_id" property="orgId"/>
<result column="company_id" property="companyId"/>
<result column="site_id" property="siteId"/>
<result column="root_id" property="rootId"/>
<result column="sort" property="sort"/>
<result column="path" property="path"/>
</resultMap>
<select id="selectListByCompanyId" resultMap="ApiResultMap">
SELECT
c.*
FROM
album_classify c
WHERE
c.company_id = #{companyId}
AND
c.site_id = #{siteId}
AND
c.layer = 1
AND
c.status = 1
<if test="name != null">
AND ( c.`name` LIKE CONCAT('%', #{name}, '%'))
</if>
ORDER BY
c.sort DESC
</select>
<select id="selectCountByCompanyId" resultType="java.lang.Integer">
SELECT
count(c.id)
FROM
album_classify c
WHERE
c.company_id = #{companyId}
AND
c.site_id = #{siteId}
AND
c.layer = 1
AND
c.status = 1
<if test="name != null">
AND ( c.`name` LIKE CONCAT('%', #{name}, '%'))
</if>
</select>
<select id="selectClassifyByRootId" resultMap="BaseResultMap">
SELECT
*
FROM
album_classify c
WHERE
c.status = 1
AND
(c.id in <foreach collection="ids" open="(" close=")" separator="," item="item">#{item}</foreach>)
ORDER BY
c.layer ASC
</select>
<!-- 查询层级分类 -->
<select id="selectClassifyByLayer" resultMap="BaseResultMap">
SELECT
c.*
FROM
album_classify c
WHERE
c.company_id = #{companyId}
AND
c.site_id = #{siteId}
AND
c.status = 1
<if test="layer != null">
AND c.layer = #{layer}
</if>
ORDER BY
c.sort DESC
</select>
<select id="selectSort" resultType="java.lang.Integer">
SELECT
ifnull(max(sort), 0)
FROM
cloud_album.album_classify
WHERE
parent_id = #{ParentId}
LIMIT 1
</select>
<select id="selectParentLayer" resultType="java.lang.Integer">
SELECT
layer
FROM
cloud_album.album_classify
WHERE
id = #{Id}
LIMIT 1
</select>
<select id="selectRootid" resultType="java.lang.Long">
SELECT
root_id
FROM
cloud_album.album_classify
WHERE
id = #{Id}
LIMIT 1
</select>
<select id="selectChild" resultType="java.lang.Long">
SELECT
ifnull(id, 0)
FROM
cloud_album.album_classify
WHERE
parent_id = #{Id}
AND STATUS = 1
LIMIT 1
</select>
<select id="selectAlbum" resultType="java.lang.Long">
SELECT
ifnull(id, 0)
FROM
cloud_album.album
WHERE
classify_id = #{Id}
and site_id = #{siteId}
AND del_flg = 0
LIMIT 1
</select>
</mapper>
package com.yizhi.album.application.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.album.application.domain.Album;
import com.yizhi.album.application.vo.AlbumActivityVo;
import com.yizhi.album.application.vo.AlbumThemeVo;
import com.yizhi.album.application.vo.ApiListAlbumVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import java.util.Date;
import java.util.List;
/**
* <p>
* 专辑表 Mapper 接口
* </p>
*
* @author hc123
* @since 2019-12-30
*/
public interface AlbumMapper extends BaseMapper<Album> {
List<Album> searchPage(@Param("name") String name, @Param("alClassifyId") Long alClassifyId,
@Param("status") Integer status, @Param("overed") Integer overed, @Param("companyId") Long companyId,
@Param("siteId") Long siteId, Page<Album> page);
Integer vailName(@Param(value = "id") Long id, @Param(value = "name") String name,
@Param(value = "siteId") Long siteId);
List<Album> selectAlbumList(@Param("name") String name,@Param(value = "ids") List<Long> ids, @Param("companyId") Long companyId,
@Param("siteId") Long siteId);
List<Album> selectAlbumPage(@Param("name") String name,@Param(value = "ids") List<Long> ids, @Param("companyId") Long companyId,
@Param("siteId") Long siteId,Page<Album> page);
List<ApiListAlbumVo> searchPageSubClassify(@Param("name") String name, @Param("classifyIds") List<Long> classifyIds,
@Param("ids") List<Long> ids, @Param("companyId") Long companyId, @Param("siteId") Long siteId,
RowBounds rowBounds);
List<Long> getCourseIds(@Param(value = "id") Long id);
List<Long> getMyStudyList(@Param(value = "siteId") Long siteId, @Param(value = "accountId") Long accountId,Page<Long> page);
Integer finished(@Param(value = "ids") List<Long> ids,@Param(value = "albumId") Long albumId, @Param(value = "accountId") Long accountId,
@Param(value = "siteId") Long siteId);
Integer unLockNum(@Param(value = "albumId") Long albumId);
List<AlbumThemeVo> geThemeVos(@Param(value = "albumId") Long albumId, @Param(value = "type") Integer type);
List<AlbumActivityVo> getActivityVos(@Param(value = "albumId") Long albumId, @Param(value = "type") Integer type,
@Param(value = "display") Integer display);
List<Long> getLockList();
List<ApiListAlbumVo> getMySubscribePage(@Param("ids") List<Long> ids, Page<ApiListAlbumVo> page);
List<Long> getAllAlbums(@Param("companyId") Long companyId, @Param("siteId") Long siteId);
List<Long> getIdsByAlbumId(@Param(value = "albumId") Long albumId);
Integer getMyAlbumNum(@Param(value = "siteId") Long siteId, @Param(value = "accountId") Long accountId);
Integer getSubscribeNum(@Param("ids") List<Long> ids);
List<Long> getIdsByDate(@Param("currentDate") Date currentDate, @Param("siteId") Long siteId);
List<Album> getPageToCalendar(@Param("passIds") List<Long> passIds,
@Param("albumIdsFromVisibeRange") List<Long> albumIdsFromVisibeRange,
@Param("currentDate") Date currentDate,
@Param("siteId") Long siteId,
Page page);
Integer getPageToCalendarNum(@Param("passIds") List<Long> passIds,
@Param("albumIdsFromVisibeRange") List<Long> albumIdsFromVisibeRange,
@Param("currentDate") Date currentDate,
@Param("siteId") Long siteId);
/**
* 获取已完结状态下的专辑内课程数
* @param albumId 专辑id
*/
Long getAlbumTotalCourseCount(@Param("albumId") Long albumId);
}
package com.yizhi.album.application.mapper;
import java.util.List;
import com.yizhi.album.application.domain.AlbumVisibleRange;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.mapper.BaseMapper;
public interface AlbumVisibleRangeMapper extends BaseMapper<AlbumVisibleRange>{
List<Long> selectAlbumIdByRelationId(@Param("relationIds") List<Long> relationIds);
List<Long> getUsefulIds(@Param("ids") List<Long> ids,
@Param("relationIds") List<Long> relationIds,
@Param("siteId") Long siteId);
}
<?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.yizhi.album.application.mapper.AlbumVisibleRangeMapper">
<select id="selectAlbumIdByRelationId" resultType="java.lang.Long">
<if test="relationIds != null">
select album_id
from album_visible_range
<where>
state = 1
and relation_id in
<foreach collection="relationIds" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
</where>
</if>
</select>
<select id="getUsefulIds" resultType="java.lang.Long">
<if test="relationIds != null">
select album_id from album_visible_range
<where>
state = 1
and relation_id in
<foreach collection="relationIds" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
<if test="ids != null and ids.size()>0">
and album_id in <foreach collection="ids" open="(" close=")" item="id" separator=","> #{id} </foreach>
</if>
</where>
</if>
</select>
</mapper>
\ No newline at end of file
package com.yizhi.album.application.mapper;
import com.yizhi.album.application.domain.ClassifyStrategy;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* <p>
* 专辑分类策略 Mapper 接口
* </p>
*
* @author hc123
* @since 2019-12-30
*/
public interface ClassifyStrategyMapper extends BaseMapper<ClassifyStrategy> {
}
package com.yizhi.album.application.service;
import com.yizhi.album.application.domain.AlStudentActivityRecord;
import com.baomidou.mybatisplus.service.IService;
/**
* <p>
* 学员完成专辑活动记录 服务类
* </p>
*
* @author hc123
* @since 2019-12-30
*/
public interface IAlStudentActivityRecordService extends IService<AlStudentActivityRecord> {
}
package com.yizhi.album.application.service;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.album.application.domain.AlThemeActivity;
import java.util.List;
/**
* <p>
* 主题中的课程 服务类
* </p>
*
* @author hc123
* @since 2019-12-30
*/
public interface IAlThemeActivityService extends IService<AlThemeActivity> {
public Integer maxSort(Long id,Long siteId);
public Boolean sortActivity(List<AlThemeActivity> list);
public List<AlThemeActivity> list(Long themeId,Integer type);
}
package com.yizhi.album.application.service;
import com.yizhi.album.application.domain.AlTheme;
import java.util.List;
import com.baomidou.mybatisplus.service.IService;
/**
* <p>
* 专辑 - 主题 服务类
* </p>
*
* @author hc123
* @since 2019-12-30
*/
public interface IAlThemeService extends IService<AlTheme> {
public Boolean vaidName(Long id,Long albumId, String name, Long siteId);
public Integer sortTheme(List<AlTheme> list);
}
package com.yizhi.album.application.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.album.application.domain.AlbumClassify;
import com.yizhi.album.application.vo.AlbumClassifyVo;
import com.yizhi.album.application.vo.ApiAlbumClassifyVo;
import com.yizhi.core.application.vo.DroolsVo;
import java.util.List;
/**
* <p>
* 专辑分类 服务类
* </p>
*
* @author hc123
* @since 2019-12-30
*/
public interface IAlbumClassifyService extends IService<AlbumClassify> {
/**
* 检查是否存在分类名称
* @param name 分类名称
* @param parentId 分类的上级id(一级分类为0)
* @param siteId 站点id
* @param type 检查类型(1:新增,2:修改(需要传classifyId))
* @param classifyId 分类id,修改检查时用到
* @return 不存在返回true,存放相同名返回false
*/
boolean checkExtisClassifyName(String name, Long parentId,Long siteId,
int type, Long classifyId);
/**
* 添加一个新的课程分类
* @param classify
* @return
*/
int saveClassify(AlbumClassify classify);
/**
* 根据父级分类查询是否存在子分类
* @param classifyIds
* @return
*/
List<AlbumClassifyVo> findExistChildNodes(List<Long> classifyIds);
/**
* 根据id,删除分类
* @param id
* @return
*/
int deleteClassify(Long id);
/**
* 根据分类对象修改分类
* @param classify
* @return
*/
int updateClassify(AlbumClassify classify);
/**
* 根据名称查询分类
* @param name
* @return
*/
Page<AlbumClassify> listClassify(String name, Integer pageNo, Integer pageSize,Long companyId,List<Long> orgIds,Long siteId,Boolean isStartHQ );
/**
* 学员端查询课程分类
* @return
*/
List<AlbumClassify> listStuClassify(Long companyId,Long siteId);
/**
* 更换排序
* @param list
* @return int
*/
int updateClassiyfsort(List<AlbumClassify> list);
/**
* 管理端专辑分类分页查询
* @param companyId 企业id
* @param name 分类名
* @param orgIds 管辖区 部门id list
* @param pageNo 分页 第几页
* @param pageSize 分页数
* @return Page<ApiClassifyVo>
*/
Page<ApiAlbumClassifyVo> selectListByCompanyId( Long companyId,String name,List<Long> orgIds,Long siteId,Integer pageNo,Integer pageSize);
List<AlbumClassify> selectClassifyByPath(List<Long> ids);
/**
* 根据分类层级查询分类
* @param companyId 企业id
* @param siteId 站点id
* @param layer 分类层级
* @return
*/
List<AlbumClassify> selectClassifyByLayer(Long companyId, Long siteId,Integer layer);
Page<DroolsVo> getClassifyNameByDrools(String field, String value, Page<DroolsVo> page);
}
package com.yizhi.album.application.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.album.application.domain.Album;
import com.yizhi.album.application.vo.*;
import com.yizhi.core.application.vo.DroolsVo;
import java.util.Date;
import java.util.List;
/**
* <p>
* 专辑表 服务类
* </p>
*
* @author hc123
* @since 2019-12-30
*/
public interface IAlbumService extends IService<Album> {
public Page<Album> searchPage(String name, Long alClassifyId, Integer status, Integer overed, Long companyId,
Long siteId, Integer pageNo, Integer pageSize);
public AlbumVo save(AlbumVo albumVo);
public Boolean update(AlbumVo albumVo);
public Boolean vaidName(Long id, String name, Long siteId);
public List<Album> searchlList(String name,List<Long> ids, Long companyId, Long siteId);
public Page<ApiListAlbumVo> searchPageSubClassify(String name, List<Long> classifyIds, List<Long> relationIds,
Long companyId, Long siteId, int pageNo, int pageSize);
public List<Long> getMyStudyList(Long siteId,Long accountId,Page<Long> ids);
public Integer finished(List<Long> ids,Long album,Long accountId,Long siteId);
public Integer unLockNum(Long albumId);
public Integer getStudyNum(Long albumId);
public List<AlbumThemeVo> getThemes(Long albumId, Integer type);
public List<AlbumActivityVo> getActivitys(Long themeId, Integer type, Integer display);
public void unLockCourse();
public Page<ApiListAlbumVo> getMySubscribePage(List<Long> ids, int pageNo, int pageSize);
Page<DroolsVo> getPageByDrools(String field, String value, Page<DroolsVo> page);
Page<AlbumCalendarVo> getPageToCalendar(Date date, Page<Album> page);
}
package com.yizhi.album.application.service;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.album.application.domain.AlbumVisibleRange;
public interface IAlbumVisbleRangeService extends IService<AlbumVisibleRange>{
}
package com.yizhi.album.application.service;
import com.yizhi.album.application.domain.ClassifyStrategy;
import com.baomidou.mybatisplus.service.IService;
/**
* <p>
* 专辑分类策略 服务类
* </p>
*
* @author hc123
* @since 2019-12-30
*/
public interface IClassifyStrategyService extends IService<ClassifyStrategy> {
}
package com.yizhi.album.application.service.impl;
import com.yizhi.album.application.domain.AlStudentActivityRecord;
import com.yizhi.album.application.mapper.AlStudentActivityRecordMapper;
import com.yizhi.album.application.service.IAlStudentActivityRecordService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 学员完成专辑活动记录 服务实现类
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Service
public class AlStudentActivityRecordServiceImpl extends ServiceImpl<AlStudentActivityRecordMapper, AlStudentActivityRecord> implements IAlStudentActivityRecordService {
}
package com.yizhi.album.application.service.impl;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yizhi.album.application.domain.AlThemeActivity;
import com.yizhi.album.application.mapper.AlThemeActivityMapper;
import com.yizhi.album.application.service.IAlThemeActivityService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 主题中的课程 服务实现类
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Service
public class AlThemeActivityServiceImpl extends ServiceImpl<AlThemeActivityMapper, AlThemeActivity> implements IAlThemeActivityService {
@Override
public Integer maxSort(Long themeId,Long siteId) {
// TODO Auto-generated method stub
return this.baseMapper.maxSort(themeId,siteId);
}
@Override
public Boolean sortActivity(List<AlThemeActivity> list) {
if (list.size() == 2) {
AlThemeActivity activityFirst = list.get(0);
AlThemeActivity activityLast = list.get(1);
if(activityFirst.getSort().equals(activityLast.getSort())){
activityLast.setSort(activityLast.getSort().intValue()-1);
}
if ((activityFirst.getUnlock().equals(0)&!activityLast.getUnlock().equals(0))||(!activityFirst.getUnlock().equals(0)&activityLast.getUnlock().equals(0))) {
return Boolean.FALSE;
}
this.baseMapper.updateById(activityFirst);
this.baseMapper.updateById(activityLast);
}
return Boolean.TRUE;
}
@Override
public List<AlThemeActivity> list(Long themeId, Integer type) {
// TODO Auto-generated method stub
return this.baseMapper.list(themeId, type);
}
}
package com.yizhi.album.application.service.impl;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yizhi.album.application.domain.AlTheme;
import com.yizhi.album.application.mapper.AlThemeMapper;
import com.yizhi.album.application.service.IAlThemeService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 专辑 - 主题 服务实现类
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Service
public class AlThemeServiceImpl extends ServiceImpl<AlThemeMapper, AlTheme> implements IAlThemeService {
@Override
public Boolean vaidName(Long id,Long albumId, String name, Long siteId) {
Integer count = this.baseMapper.vailName(id,albumId, name, siteId);
if (count>0) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
@Override
public Integer sortTheme(List<AlTheme> list) {
if (list.size() == 2) {
AlTheme themeFirst = list.get(0);
AlTheme themeLast = list.get(1);
if(themeFirst.getSort().equals(themeLast.getSort())){
themeLast.setSort(themeLast.getSort().intValue()-1);
}
this.baseMapper.updateById(themeFirst);
this.baseMapper.updateById(themeLast);
}
return 1;
}
}
package com.yizhi.album.application.service.impl;
import com.yizhi.album.application.domain.AlbumVisibleRange;
import com.yizhi.album.application.mapper.AlbumVisibleRangeMapper;
import com.yizhi.album.application.service.IAlbumVisbleRangeService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
@Service
public class AlbumVisibleRangeServiceImpl extends ServiceImpl<AlbumVisibleRangeMapper, AlbumVisibleRange> implements IAlbumVisbleRangeService {
}
package com.yizhi.album.application.service.impl;
import com.yizhi.album.application.domain.ClassifyStrategy;
import com.yizhi.album.application.mapper.ClassifyStrategyMapper;
import com.yizhi.album.application.service.IClassifyStrategyService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 专辑分类策略 服务实现类
* </p>
*
* @author hc123
* @since 2019-12-30
*/
@Service
public class ClassifyStrategyServiceImpl extends ServiceImpl<ClassifyStrategyMapper, ClassifyStrategy> implements IClassifyStrategyService {
}
package com.yizhi.album.application.task;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.yizhi.album.application.domain.AlTheme;
import com.yizhi.album.application.domain.AlThemeActivity;
import com.yizhi.album.application.service.IAlThemeActivityService;
import com.yizhi.album.application.service.IAlThemeService;
import com.yizhi.album.application.vo.AlThemeVo;
import com.yizhi.core.application.context.TaskContext;
import com.yizhi.core.application.file.constant.FileConstant;
import com.yizhi.core.application.file.task.AbstractDefaultTask;
import com.yizhi.core.application.file.util.OssUpload;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Component
public class ActivityListExport extends AbstractDefaultTask<String, Map<String, Object>> {
private static final Logger logger = LoggerFactory.getLogger(ActivityListExport.class);
@Autowired
private IAlThemeActivityService alThemeActivityService;
@Autowired
private IAlThemeService alThemeService;
@Override
protected String execute(Map<String, Object> arg0) {
Long accountId = (Long) arg0.get("accountId");
Long siteId = (Long) arg0.get("siteId");
Long companyId = (Long) arg0.get("companyId");
Long taskId = (Long) arg0.get("taskId");
Date submitTime = (Date) arg0.get("submitTime");
String serialNo = (String) arg0.get("serialNo");
String taskName = (String) arg0.get("taskName");
String name = (String) arg0.get("name");
Long albumId = (Long) arg0.get("albumId");
/**
* 走异步任务
*/
TaskContext taskContext = new TaskContext(taskId, serialNo, taskName, accountId, submitTime, siteId, companyId);
working(taskContext);
String upLoadUrl = null;
String requestPath = FileConstant.SAVE_PATH;
File fileDir = new File(requestPath);
if (!fileDir.exists()) {
fileDir.mkdir();
}
// 课程清单开始组装
AlTheme theme = new AlTheme();
theme.setAlbumId(albumId);
theme.setDeleted(0);
EntityWrapper<AlTheme> wrapper = new EntityWrapper<AlTheme>(theme);
wrapper.orderBy("sort", true);
List<AlTheme> themes = alThemeService.selectList(wrapper);
List<AlThemeActivity> list = new ArrayList<AlThemeActivity>();
for (AlTheme alTheme : themes) {
AlThemeVo themeVo = new AlThemeVo();
themeVo.setAlbumId(albumId);
themeVo.setId(alTheme.getId());
themeVo.setName(alTheme.getName());
AlThemeActivity activity = new AlThemeActivity();
activity.setThemeId(alTheme.getId());
activity.setDeleted(0);
EntityWrapper<AlThemeActivity> entityWrapper = new EntityWrapper<AlThemeActivity>(activity);
entityWrapper.orderBy("sort", true);
List<AlThemeActivity> activities = alThemeActivityService.selectList(entityWrapper);
activities.forEach(e->e.setThemeName(alTheme.getName()));
list.addAll(activities);
}
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat ff = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
try {
//excel生成过程: excel-->sheet-->row-->cell
// 第一步,创建一个Excel文件
XSSFWorkbook wb = new XSSFWorkbook();
// 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
XSSFSheet sheet = wb.createSheet(name+"-课程清单"+sf.format(submitTime));
sheet.setDefaultColumnWidth(56);
XSSFFont font = wb.createFont();
font.setFontName("宋体");
font.setFontHeightInPoints((short) 16);
font.setBold(false);
XSSFCellStyle style = wb.createCellStyle();
style.setFont(font);
style.setAlignment(HorizontalAlignment.LEFT); // 创建一个左对齐格式
style.setVerticalAlignment(VerticalAlignment.CENTER);
// 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
XSSFRow row = sheet.createRow((int) 0);
row.setHeightInPoints((float) 21);
// 合并单元格
CellRangeAddress cra=new CellRangeAddress(0,0,0,3); // 起始行, 终止行, 起始列, 终止列
sheet.addMergedRegion(cra);
XSSFCell cell = row.createCell((short) 0);
cell.setCellValue(name+"-课程清单"+sf.format(submitTime));
cell.setCellStyle(style);
XSSFRow row1 = sheet.createRow((int) 1);
row1.setHeightInPoints((float) 18);
// 合并单元格
CellRangeAddress cra1=new CellRangeAddress(1,1,0,3); // 起始行, 终止行, 起始列, 终止列
sheet.addMergedRegion(cra1);
XSSFCell cell1 = row1.createCell((short) 0);
cell1.setCellValue("报表生成时间:"+ff.format(submitTime));
XSSFCellStyle style1 = wb.createCellStyle();
XSSFFont font1 = wb.createFont();
font1.setFontName("宋体");
font1.setFontHeightInPoints((short) 14);
font1.setBold(false);
style1.setFont(font1);
style1.setAlignment(HorizontalAlignment.LEFT);
style1.setVerticalAlignment(VerticalAlignment.CENTER);
cell1.setCellStyle(style1);
XSSFRow row2 = sheet.createRow((int) 2);
XSSFCellStyle style2 = wb.createCellStyle();
XSSFFont font2 = wb.createFont();
font2.setFontName("宋体");
font2.setFontHeightInPoints((short) 12);
font2.setBold(true);
style2.setFont(font2);
style2.setAlignment(HorizontalAlignment.CENTER);
style2.setVerticalAlignment(VerticalAlignment.CENTER);
row2.setHeightInPoints((float) 15.6);
row2.createCell((short) 0).setCellValue("课程名称");
row2.getCell(0).setCellStyle(style2);
row2.createCell((short) 1).setCellValue("解锁状态");
row2.getCell(1).setCellStyle(style2);
row2.createCell((short) 2).setCellValue("主题名称");
row2.getCell(2).setCellStyle(style2);
row2.createCell((short) 3).setCellValue("课程编码");
row2.getCell(3).setCellStyle(style2);
AlThemeActivity vo = new AlThemeActivity();
for(int i=0;i<list.size();i++) {
XSSFCellStyle style3 = wb.createCellStyle();
XSSFFont font3 = wb.createFont();
font3.setBold(false);
font3.setFontHeightInPoints((short) 10);
style3.setFont(font3);
style3.setAlignment(HorizontalAlignment.CENTER); // 创建一个居中格式
style3.setVerticalAlignment(VerticalAlignment.CENTER);
row = sheet.createRow(i + 3);
row.setHeightInPoints((float) 13.2);
// 第四步,创建单元格,并设置值
vo=list.get(i);
if(vo!=null&&vo.getName()!=null) {
row.createCell((short) 0).setCellValue(vo.getName());
row.getCell(0).setCellStyle(style3);
}
if(vo!=null&&vo.getUnlock()!=null) {
String unLock = "";
if (vo.getUnlock().equals(0)) {
unLock="已解锁";
}else if (vo.getUnlock().equals(1)) {
unLock="发布及解锁";
}else {
unLock=ff.format(vo.getUnlockTime());
}
row.createCell((short) 1).setCellValue(unLock);
row.getCell(1).setCellStyle(style3);
}
if(vo!=null&&vo.getThemeName()!=null) {
row.createCell((short) 2).setCellValue(vo.getThemeName());
row.getCell(2).setCellStyle(style3);
}
if(vo!=null&&vo.getRelationCode()!=null) {
row.createCell((short) 3).setCellValue(vo.getRelationCode());
row.getCell(3).setCellStyle(style3);
}
}
// 第五步,写入实体数据 实际应用中这些数据从数据库得到,
StringBuffer fileNameSb = new StringBuffer().append(name+"-课程清单").append(sf.format(submitTime)).append(".xlsx");
String fileName = fileNameSb.toString();
String path = new StringBuffer().append(requestPath).append(fileNameSb).toString();
FileOutputStream os=null;
File file=null;
try {
os= new FileOutputStream(path);
wb.write(os);
//阿里云返回url
upLoadUrl = OssUpload.upload(path, fileName);
file=new File(path);
success(taskContext,"成功", upLoadUrl);
} catch (Exception e1) {
logger.error("写入数据到Excel的过程中或者上传到阿里云中发生错误",e1);
fail(taskContext, "写入数据到Excel的过程中或者上传到阿里云中发生错误"+e1.getMessage());
}
finally {
if(os!=null) {
os.close();
}
if(wb!=null) {
wb.close();
}
if(file!=null) {
file.delete();
}
}
} catch (Exception e) {
logger.error(name+"专辑课程清单导出过程中发生错误,请查看日志",e);
fail(taskContext, name+"专辑课程清单导出过程中发生错误,请查看日志"+e.getMessage());
}
return upLoadUrl;
}
}
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment