mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 03:46:50 +08:00
Merge branch 'zcwy-master' into zcwy0912
This commit is contained in:
@@ -11,12 +11,14 @@ import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.module.boecase.dao.CasesMajorTypeDao;
|
||||
import com.xboe.module.boecase.dto.*;
|
||||
import com.xboe.module.boecase.entity.CasesMajorType;
|
||||
import com.xboe.module.boecase.service.ICasesRecommendPushRecordService;
|
||||
import com.xboe.module.boecase.vo.CaseExportVo;
|
||||
import com.xboe.module.dict.entity.DictItem;
|
||||
import com.xboe.module.excel.ExportsExcelSenderUtil;
|
||||
|
||||
import com.xboe.system.user.dao.UserDao;
|
||||
import com.xboe.system.user.entity.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -63,6 +65,9 @@ public class CasesApi extends ApiBaseController {
|
||||
@Resource
|
||||
private UserDao userDao;
|
||||
|
||||
@Autowired
|
||||
private ICasesRecommendPushRecordService casesRecommendPushRecordService;
|
||||
|
||||
/**
|
||||
* 用于后台管理
|
||||
* @param pager
|
||||
@@ -523,14 +528,22 @@ public class CasesApi extends ApiBaseController {
|
||||
if(StringUtil.isBlank(cases.getAuthorId())){
|
||||
return badRequest("请选择作者");
|
||||
}
|
||||
// if(StringUtils.isBlank(cases.getType())){
|
||||
// return badRequest("type参数不能为空");
|
||||
// }
|
||||
if(cases.getExcellent()==null){
|
||||
cases.setExcellent(false);
|
||||
}
|
||||
if(StringUtils.isBlank(cases.getConfidentialityLevel())) {
|
||||
cases.setConfidentialityLevel("内部");
|
||||
}
|
||||
|
||||
try {
|
||||
casesService.update(cases);
|
||||
// 修改案例表 可能用不到
|
||||
if(StringUtils.isNotBlank(cases.getType()) && cases.getType().equals("recommend")){
|
||||
casesRecommendPushRecordService.update(cases);
|
||||
}
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
log.error("更新案例错误",e);
|
||||
|
||||
@@ -21,9 +21,8 @@ import java.util.List;
|
||||
*/
|
||||
@Repository
|
||||
public interface CasesRecordDao extends JpaRepository<Cases, String>, JpaSpecificationExecutor<Cases> {
|
||||
|
||||
@Query(nativeQuery = true, value = "select c.* from ( select b.*" +
|
||||
" from boe_cases_recommend_push_record a INNER JOIN boe_cases b on a.case_id = b.id" +
|
||||
" from boe_cases_recommend_push_record a left JOIN boe_cases b on a.case_id = b.id" +
|
||||
" where b.deleted=0 and a.push_status = 3 and a.deleted=0 and a.push_user_id= :#{#condition.userId}" +
|
||||
" and if(IFNULL(:#{#condition.keyWord},'')!='',b.title like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.author_name like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
@@ -40,9 +39,12 @@ public interface CasesRecordDao extends JpaRepository<Cases, String>, JpaSpecifi
|
||||
" or if(:#{#condition.org2Empty}, 1=2, b.org_domain_parent2 in (:#{#condition.org2}))" +
|
||||
" or if(:#{#condition.org3Empty}, 1=2, b.org_domain_parent3 in (:#{#condition.org3}))" +
|
||||
")" +
|
||||
" and if(:#{#condition.isSysType1Empty} , 1=1, b.sys_type1 = :#{#condition.sysType1} )"+
|
||||
" and if(:#{#condition.isSysType2Empty} , 1=1, b.sys_type2 = :#{#condition.sysType2} )"+
|
||||
" and if(:#{#condition.isSysType3Empty} , 1=1, b.sys_type3 = :#{#condition.sysType3} )"+
|
||||
" order by a.sys_create_time DESC, a.read_flag ASC) as c group by c.id",
|
||||
countQuery = "select count(*) FROM (select c.* from ( select b.*" +
|
||||
" from boe_cases_recommend_push_record a INNER JOIN boe_cases b on a.case_id = b.id " +
|
||||
" from boe_cases_recommend_push_record a left JOIN boe_cases b on a.case_id = b.id " +
|
||||
" where b.deleted=0 and a.push_status = 3 and a.deleted=0 and a.push_user_id= :#{#condition.userId}" +
|
||||
" and if(IFNULL(:#{#condition.keyWord},'')!='',b.title like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.author_name like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
@@ -59,6 +61,9 @@ public interface CasesRecordDao extends JpaRepository<Cases, String>, JpaSpecifi
|
||||
" or if(:#{#condition.org2Empty}, 1=1, b.org_domain_parent2 in (:#{#condition.org2}))" +
|
||||
" or if(:#{#condition.org3Empty}, 1=1, b.org_domain_parent3 in (:#{#condition.org3}))" +
|
||||
")" +
|
||||
" and if(:#{#condition.isSysType1Empty} , 1=1, b.sys_type1 = :#{#condition.sysType1} )"+
|
||||
" and if(:#{#condition.isSysType2Empty} , 1=1, b.sys_type2 = :#{#condition.sysType2} )"+
|
||||
" and if(:#{#condition.isSysType3Empty} , 1=1, b.sys_type3 = :#{#condition.sysType3} )"+
|
||||
" order by a.sys_create_time DESC, a.read_flag ASC ) as c group by c.id) as d")
|
||||
Page<Cases> queryList(Pageable pageable, @Param("condition") CasePageVo casePage);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xboe.module.boecase.dto;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@@ -98,4 +99,10 @@ public class CasePageVo extends PageDto {
|
||||
return this.isOrg1Empty() && this.isOrg2Empty() && this.isOrg3Empty();
|
||||
}
|
||||
|
||||
public boolean isSysType1Empty(){ return StrUtil.isEmpty(this.sysType1); }
|
||||
|
||||
public boolean isSysType2Empty(){ return StrUtil.isEmpty(this.sysType2); }
|
||||
|
||||
public boolean isSysType3Empty(){ return StrUtil.isEmpty(this.sysType3); }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package com.xboe.module.boecase.entity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.BaseEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 案例表
|
||||
* */
|
||||
@@ -243,6 +244,15 @@ public class Cases extends BaseEntity {
|
||||
@Column(name = "case_value")
|
||||
private String caseValue;
|
||||
|
||||
// 种类字段1
|
||||
@Column(name = "sys_type1")
|
||||
private String sysType1;
|
||||
//种类字段2
|
||||
@Column(name = "sys_type2")
|
||||
private String sysType2;
|
||||
//种类字段3
|
||||
@Column(name = "sys_type3")
|
||||
private String sysType3;
|
||||
|
||||
/**
|
||||
* 最佳案例标识
|
||||
@@ -257,6 +267,18 @@ public class Cases extends BaseEntity {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime excellentTime;
|
||||
|
||||
/**
|
||||
* type 种类
|
||||
* 区分 案例/推荐案例
|
||||
*/
|
||||
@Transient
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
|
||||
|
||||
@Transient
|
||||
private List<String> majorIds;
|
||||
|
||||
@@ -296,6 +318,8 @@ public class Cases extends BaseEntity {
|
||||
public Long getRecommends1() {
|
||||
return recommends1;
|
||||
}
|
||||
|
||||
|
||||
@Transient
|
||||
public void setRecommends1(Long recommends1) {
|
||||
this.recommends1 = recommends1;
|
||||
|
||||
@@ -79,6 +79,26 @@ public class CasesRecommendPushRecord extends BaseEntity {
|
||||
@Column(name = "read_start_time")
|
||||
private Date readStartTime;
|
||||
|
||||
/**
|
||||
* sysType1
|
||||
*/
|
||||
@Column(name = "sys_type1")
|
||||
private String sysType1;
|
||||
|
||||
/**
|
||||
* sysType2
|
||||
*/
|
||||
@Column(name = "sys_type2")
|
||||
private String sysType2;
|
||||
|
||||
/**
|
||||
* sysType3
|
||||
*/
|
||||
@Column(name = "sys_type3")
|
||||
private String sysType3;
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 最后查看时间
|
||||
// */
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xboe.module.boecase.service;
|
||||
|
||||
import com.xboe.core.CurrentUser;
|
||||
import com.xboe.module.boecase.entity.Cases;
|
||||
import com.xboe.module.boecase.entity.CasesRecommend;
|
||||
import com.xboe.module.boecase.entity.CasesRecommendPushRecord;
|
||||
import com.xboe.module.boecase.vo.CasesRecommendLaunchVo;
|
||||
@@ -45,10 +46,17 @@ public interface ICasesRecommendPushRecordService {
|
||||
*/
|
||||
boolean startRead(String caseRecommendId);
|
||||
|
||||
boolean update(Cases cases);
|
||||
|
||||
// /**
|
||||
// * 结束读
|
||||
// * @param caseRecommendId
|
||||
// * @return
|
||||
// */
|
||||
// boolean endRead(String caseRecommendId);
|
||||
|
||||
/**
|
||||
* 推荐案例修改
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.xboe.module.boecase.service.ICasesRecommendPushRecordService;
|
||||
import com.xboe.module.boecase.vo.CasesRecommendLaunchVo;
|
||||
import com.xboe.system.user.dao.UserDao;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -225,6 +226,28 @@ public class CasesRecommendPushRecordServiceImpl implements ICasesRecommendPushR
|
||||
.builder()) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(Cases cases) {
|
||||
String sysType1 = "";
|
||||
String sysType2 = "";
|
||||
String sysType3 = "";
|
||||
if(StringUtils.isNotEmpty(cases.getSysType1())){
|
||||
sysType1 = cases.getSysType1();
|
||||
}
|
||||
if(StringUtils.isNotEmpty(cases.getSysType2())){
|
||||
sysType2 = cases.getSysType2();
|
||||
}
|
||||
if(StringUtils.isNotEmpty(cases.getSysType3())){
|
||||
sysType3 = cases.getSysType3();
|
||||
}
|
||||
return casesRecommendPushRecordDao.update(UpdateBuilder.from(CasesRecommendPushRecord.class)
|
||||
.addUpdateField("sys_type1",sysType1)
|
||||
.addUpdateField("sys_type2",sysType2)
|
||||
.addUpdateField("sys_type3",sysType3)
|
||||
.addFilter(FieldFilters.eq("id",cases.getId())).builder()
|
||||
) > 0;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean endRead(String caseRecommendId) {
|
||||
// CasesRecommendPushRecord casesRecommendPushRecord = casesRecommendPushRecordDao.get(caseRecommendId);
|
||||
|
||||
@@ -276,6 +276,17 @@ public class CasesServiceImpl implements ICasesService {
|
||||
if (StringUtils.isNotBlank(caseVo.getCaseType())) {
|
||||
filters.add(FieldFilters.eq("caseType", caseVo.getCaseType()));
|
||||
}
|
||||
// 新增sysTepe1,sysTepe2,sysTepe3 字段
|
||||
if(StringUtils.isNotBlank(caseVo.getSysType1())){
|
||||
filters.add(FieldFilters.eq("sys_type1", caseVo.getSysType1()));
|
||||
}
|
||||
if(StringUtils.isNotBlank(caseVo.getSysType2())){
|
||||
filters.add(FieldFilters.eq("sys_type2", caseVo.getSysType2()));
|
||||
}
|
||||
if(StringUtils.isNotBlank(caseVo.getSysType3())){
|
||||
filters.add(FieldFilters.eq("sys_type3", caseVo.getSysType3()));
|
||||
}
|
||||
|
||||
if (caseVo.getIsTop() != null && caseVo.getIsTop()) {
|
||||
query.addOrder(OrderCondition.desc("isTop"));
|
||||
query.addOrder(OrderCondition.desc("topTime"));
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Map;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -216,6 +217,18 @@ public class StudyServiceImpl implements IStudyService{
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateLastTime(String studyContentId, int lastStudyTime,String aid) {
|
||||
// 获取时长
|
||||
StudyCourseItem sci = scItemDao.findOne(FieldFilters.eq("id", studyContentId),FieldFilters.eq("aid", aid));
|
||||
Integer endTime = sci.getLastStudyTime();
|
||||
// 间隔时长
|
||||
int abs = 0;
|
||||
if(lastStudyTime - endTime < 0){
|
||||
//从头开始
|
||||
abs = lastStudyTime;
|
||||
}else{
|
||||
// 获取时长
|
||||
abs = lastStudyTime - endTime;
|
||||
}
|
||||
// 更新最后的学习时间点
|
||||
LocalDateTime now=LocalDateTime.now();
|
||||
UpdateBuilder update=UpdateBuilder.from(StudyCourseItem.class);
|
||||
@@ -226,6 +239,14 @@ public class StudyServiceImpl implements IStudyService{
|
||||
update.addUpdateField("lastTime", now);
|
||||
scItemDao.update(update.builder());
|
||||
//增加用户的学习时长,在api中调用
|
||||
|
||||
// 添加学习时长
|
||||
String contentId = sci.getContentId();
|
||||
UpdateBuilder updSc=UpdateBuilder.from(StudyCourse.class);
|
||||
|
||||
// 追加总时长
|
||||
String sql="Update boe_study_course set total_duration=total_duration+"+abs+",status=(case when status<2 then 2 else status end),progress=(case when progress=0 then 1 else progress end) where id=?1";
|
||||
scDao.sqlUpdate(sql,contentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user