From be77b74c9fb230c6e9f153fb312fdbe8d325a828 Mon Sep 17 00:00:00 2001 From: gjq Date: Wed, 8 Dec 2021 18:23:11 +0800 Subject: [PATCH] ... --- .../controller/ContentController.java | 17 ++- .../casesfirst/CaseTypeController.java | 39 +++--- .../frontapi/FrontContentController.java | 24 ++-- .../activity/mapper/CaseTypeMapper.java | 11 +- .../activity/mapper/DataDictItemMapper.java | 6 + .../activity/mapper/DataDictMapper.java | 24 ++-- .../com/nbclass/activity/model/Content.java | 15 +++ .../activity/service/CaseTypeService.java | 12 +- .../service/ElasticSearchService.java | 11 +- .../service/impl/CaseTypeServiceImpl.java | 13 +- .../service/impl/ContentServiceImpl.java | 21 +++- .../service/impl/DataDictServiceImpl.java | 10 +- .../impl/ElasticSearchServiceImpl.java | 28 +++-- .../com/nbclass/config/DateConverter.java | 4 +- src/main/resources/application-dev.yml | 2 +- .../mapper/activity/CaseTypeMapper.xml | 17 +-- .../mapper/activity/ContentMapper.xml | 18 +++ .../mapper/activity/DataDictItemMapper.xml | 8 ++ .../mapper/activity/DataDictMapper.xml | 47 +++++--- .../templates/content/application.html | 100 +++++++++++++-- .../resources/templates/content/edit2.html | 29 +++-- .../resources/templates/content/list2.html | 114 ++++++++++++++++-- src/main/resources/templates/index/index.html | 3 + 23 files changed, 429 insertions(+), 144 deletions(-) diff --git a/src/main/java/com/nbclass/activity/controller/ContentController.java b/src/main/java/com/nbclass/activity/controller/ContentController.java index 502d172..0cc30b9 100644 --- a/src/main/java/com/nbclass/activity/controller/ContentController.java +++ b/src/main/java/com/nbclass/activity/controller/ContentController.java @@ -424,11 +424,20 @@ public class ContentController extends BaseController { User loginUser = getLoginUser(); User user = userService.selectByUsername(loginUser.getUsername()); application.setUserId(Long.parseLong(user.getId().toString())); - //根据userId获取微信用户信息 - WxUser wxUser = service.getQyWxUser(user.getUsername()); - //根据部门id获取用户领导 - List checks = service.getUserLeader(wxUser.getDepartment()); + List checks; + if(!loginUser.getUserId().equals("admin")){ + //根据userId获取微信用户信息 + WxUser wxUser = service.getQyWxUser(user.getUsername()); + //根据部门id获取用户领导 + checks = service.getUserLeader(wxUser.getDepartment()); + }else { + checks = new ArrayList<>(); + Check check = new Check(); + check.setCheckId(1L); + checks.add(check); + } application.setChecks(checks); + //添加审核申请单 service.saveApplication(application); return Result.success(); diff --git a/src/main/java/com/nbclass/activity/controller/casesfirst/CaseTypeController.java b/src/main/java/com/nbclass/activity/controller/casesfirst/CaseTypeController.java index 9eec68d..3371520 100644 --- a/src/main/java/com/nbclass/activity/controller/casesfirst/CaseTypeController.java +++ b/src/main/java/com/nbclass/activity/controller/casesfirst/CaseTypeController.java @@ -1,15 +1,21 @@ package com.nbclass.activity.controller.casesfirst; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageInfo; import com.nbclass.activity.model.*; import com.nbclass.activity.service.CaseTypeService; +import com.nbclass.activity.service.ElasticSearchService; import com.nbclass.vo.base.Result; 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.RestController; +import java.util.ArrayList; import java.util.List; +import java.util.Map; /** * 案例web前台 @@ -23,6 +29,9 @@ public class CaseTypeController { @Autowired private CaseTypeService caseTypeService; + @Autowired + private ElasticSearchService elasticSearchService; + /** * 数据字典(案例类型、案例用途、创意形式、节日事件)列表查询 * @return @@ -43,28 +52,24 @@ public class CaseTypeController { return Result.success(list); } - /** - * 案例库列表 - * @param page - * @param pageSize - * @return - */ - @GetMapping("/getListCase") - public Result getListCase(Integer page,Integer pageSize){ - PageInfo list = caseTypeService.getListCase(page,pageSize); - return Result.success(list); - } /** - * 案例搜索框 - * @param parameter 任意参数(案例标签,案例标题,案例编号) - * @param dictItemId 案例类型id + * 案例列表 + * @param keyWord 任意参数(案例标签,案例标题,案例编号) + * @param tagIds 标签id * @return */ @GetMapping("/getSearchCase") - public Result getSearchCase(String parameter,Integer dictItemId,Integer page,Integer pageSize){ - PageInfo list = caseTypeService.getSearchCase(parameter,dictItemId,page,pageSize); - return Result.success(list); + public Result getSearchCase(String keyWord,String tagIds,Integer page,Integer pageSize){ + Map map = elasticSearchService.getList(page,pageSize,"",keyWord,tagIds,""); + List list = (List) map.get("rows"); + for (Content content : list) { + Content listCase = caseTypeService.getListCase(content.getId()); + content.setUserTotal(listCase.getUserTotal()); + content.setTotalScore(listCase.getTotalScore()); + } + map.put("rows",list); + return Result.success(map); } /** diff --git a/src/main/java/com/nbclass/activity/controller/frontapi/FrontContentController.java b/src/main/java/com/nbclass/activity/controller/frontapi/FrontContentController.java index 4585cd5..f102ad7 100644 --- a/src/main/java/com/nbclass/activity/controller/frontapi/FrontContentController.java +++ b/src/main/java/com/nbclass/activity/controller/frontapi/FrontContentController.java @@ -16,6 +16,8 @@ import com.nbclass.exception.ParameterException; import com.nbclass.system.controller.BaseController; import com.nbclass.vo.base.Result; +import java.util.Map; + /** * i前端获取案例查询 * @author Leon @@ -24,10 +26,10 @@ import com.nbclass.vo.base.Result; @RestController @RequestMapping("/front/api/content") public class FrontContentController extends BaseController { - + // @Resource // private ContentService service; - + @Resource private ElasticSearchService esService; @@ -39,14 +41,14 @@ public class FrontContentController extends BaseController { * @return */ @RequestMapping("/list") - public Result getList(String type, HttpServletResponse response, - @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize, + public Result getList(String type, HttpServletResponse response, + @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize, String keyWord, String tagIds, String sourceIds){ response.setHeader("Access-Control-Allow-Origin", "*"); if(StringUtils.isNotBlank(type)){ type = type.trim().toLowerCase(); - if(!ContentType.ppqa.key().equals(type) && !ContentType.ggqa.key().equals(type) && - !ContentType.design.key().equals(type) && !ContentType.video.key().equals(type) && + if(!ContentType.ppqa.key().equals(type) && !ContentType.ggqa.key().equals(type) && + !ContentType.design.key().equals(type) && !ContentType.video.key().equals(type) && !ContentType.h5.key().equals(type) && !ContentType.ldhd.key().equals(type) && !ContentType.others.key().equals(type)){ throw new ParameterException("参数[type]不是有效的数据!"); @@ -54,10 +56,10 @@ public class FrontContentController extends BaseController { } // List tagIdList = CommonUtils.toIntList(tagIds); // List sourceIdList = CommonUtils.toIntList(sourceIds); - JSONObject resultObj = esService.getList(pageNum, pageSize, type, keyWord, tagIds, sourceIds); + Map resultObj = esService.getList(pageNum, pageSize, type, keyWord, tagIds, sourceIds); return Result.success(resultObj); } - + /** * 根据id查找单条记录 * @param id @@ -71,8 +73,8 @@ public class FrontContentController extends BaseController { throw new ParameterException("参数[type]不能为空!"); } type=type.trim().toLowerCase(); - if(!ContentType.ppqa.key().equals(type) && !ContentType.ggqa.key().equals(type) && - !ContentType.design.key().equals(type) && !ContentType.video.key().equals(type) && + if(!ContentType.ppqa.key().equals(type) && !ContentType.ggqa.key().equals(type) && + !ContentType.design.key().equals(type) && !ContentType.video.key().equals(type) && !ContentType.h5.key().equals(type) && !ContentType.ldhd.key().equals(type) && !ContentType.others.key().equals(type)){ throw new ParameterException("参数[type]不是有效的数据!"); @@ -84,5 +86,5 @@ public class FrontContentController extends BaseController { Content content = esService.findById(id); return Result.success(content); } - + } diff --git a/src/main/java/com/nbclass/activity/mapper/CaseTypeMapper.java b/src/main/java/com/nbclass/activity/mapper/CaseTypeMapper.java index efd868f..3c4691f 100644 --- a/src/main/java/com/nbclass/activity/mapper/CaseTypeMapper.java +++ b/src/main/java/com/nbclass/activity/mapper/CaseTypeMapper.java @@ -25,19 +25,12 @@ public interface CaseTypeMapper { */ List getDictionariesType(); - /** - * 案例搜索框 - * @param dictItemId 案例类型id - * @return - */ - List getSearchCase(@Param("parameter") String parameter, - @Param("dictItemId") Integer dictItemId); /** - * 案例库列表 + * 案例(评分总人数、总评分) * @return */ - List getListCase(); + Content getListCase(Long contentId); /** * 获取案例标签 diff --git a/src/main/java/com/nbclass/activity/mapper/DataDictItemMapper.java b/src/main/java/com/nbclass/activity/mapper/DataDictItemMapper.java index 612fda0..e925f58 100644 --- a/src/main/java/com/nbclass/activity/mapper/DataDictItemMapper.java +++ b/src/main/java/com/nbclass/activity/mapper/DataDictItemMapper.java @@ -56,4 +56,10 @@ public interface DataDictItemMapper extends MyMapper { * @return */ String[] getTagId(String name); + + /** + * 查询案例关联字典值tid + * @return + */ + List getContentDict(); } diff --git a/src/main/java/com/nbclass/activity/mapper/DataDictMapper.java b/src/main/java/com/nbclass/activity/mapper/DataDictMapper.java index 4e9c905..d9382b6 100644 --- a/src/main/java/com/nbclass/activity/mapper/DataDictMapper.java +++ b/src/main/java/com/nbclass/activity/mapper/DataDictMapper.java @@ -10,34 +10,34 @@ import com.nbclass.activity.model.DataDictItem; import com.nbclass.util.MyMapper; public interface DataDictMapper extends MyMapper { - + /** * 根据条件查询列表 * @param entity * @return */ public List getList(DataDict entity); - + /** * 删除前验证 * @param list * @return */ public Long delCheck(List list); - + /** * 根据id批量删除记录 * @param list */ public void deleteByIds(List list); - + /** * 通过字典Key获取子集 * @param datakey * @return */ public List getItemsByKey(@Param(value="datakey")String datakey); - + /** * 根据字典名获取列表 * @param datakey @@ -45,7 +45,7 @@ public interface DataDictMapper extends MyMapper { * @return */ public List getItemsByNames(@Param(value="datakey")String datakey, @Param("tagNames")List tagNames); - + /** * 保存字典item * @param entity @@ -60,10 +60,10 @@ public interface DataDictMapper extends MyMapper { List getDataDictTemName(@Param("tagNames")ArrayList postTagList); /** - * 获取自定义标签id + * 获取所有标签 * @return */ - Long getDataDictID(); + List getDataDictID(); /** * 查询字典值是否重复 @@ -72,4 +72,10 @@ public interface DataDictMapper extends MyMapper { */ int getDataDicName(String name); -} \ No newline at end of file + /** + * 获取自定义标签id + * @return + */ + Long getDataDictIDLabels(); + +} diff --git a/src/main/java/com/nbclass/activity/model/Content.java b/src/main/java/com/nbclass/activity/model/Content.java index 8ce2412..7549d0b 100644 --- a/src/main/java/com/nbclass/activity/model/Content.java +++ b/src/main/java/com/nbclass/activity/model/Content.java @@ -27,11 +27,21 @@ public class Content implements Serializable { */ private Date createtime; + /** + * 创建时间区间 + */ + private Date createtimeSection; + /** * 修改时间 */ private Date updatetime; + /** + * 创建时间区间 + */ + private Date updatetimeSection; + /** * 案例类型[ppqa:品牌全案, ggqa:公关全案, design:创意设计, video:视频动画, h5:技术开发, ldhd:落地活动, others:其他案例] */ @@ -133,6 +143,11 @@ public class Content implements Serializable { */ private Date onlineTime; + /** + * 上线时间区间 + */ + private Date onlineTimeSection; + /** * 可见性 */ diff --git a/src/main/java/com/nbclass/activity/service/CaseTypeService.java b/src/main/java/com/nbclass/activity/service/CaseTypeService.java index ef1a4dd..a372a7a 100644 --- a/src/main/java/com/nbclass/activity/service/CaseTypeService.java +++ b/src/main/java/com/nbclass/activity/service/CaseTypeService.java @@ -27,20 +27,12 @@ public interface CaseTypeService { */ List getDictionariesType(); - /** - * 案例搜索框 - * @param dictItemId 案例类型id - * @return - */ - PageInfo getSearchCase(String parameter, Integer dictItemId,Integer page, Integer pageSize); /** - * 案例库列表 - * @param page - * @param pageSize + * 案例(评分总人数、总评分) * @return */ - PageInfo getListCase(Integer page, Integer pageSize); + Content getListCase(Long contentId); /** * 获取案例标签 diff --git a/src/main/java/com/nbclass/activity/service/ElasticSearchService.java b/src/main/java/com/nbclass/activity/service/ElasticSearchService.java index 0e258f9..6bc5482 100644 --- a/src/main/java/com/nbclass/activity/service/ElasticSearchService.java +++ b/src/main/java/com/nbclass/activity/service/ElasticSearchService.java @@ -1,6 +1,7 @@ package com.nbclass.activity.service; import java.util.List; +import java.util.Map; import com.alibaba.fastjson.JSONObject; import com.nbclass.activity.model.Content; @@ -23,27 +24,27 @@ public interface ElasticSearchService { * @param ids */ public void deleteDocByIds(List ids); - + /** * 根据条件删除 * @param entity */ public void deleteDocByQuery(Content entity); - + /** * 判断一个文档是否存在 * @param id * @return */ public boolean existDoc(Long id); - + /** * 根据id查询 * @param id * @return entity */ public Content findById(Long id); - + /** * 根据条件查询列表 * @param pageNum @@ -54,7 +55,7 @@ public interface ElasticSearchService { * @param sourceIds 案例来源ID, 多个英文逗号分隔 * @return */ - public JSONObject getList(Integer pageNum, Integer pageSize, String type, String keyWord, String tagIds, String sourceIds); + public Map getList(Integer pageNum, Integer pageSize, String type, String keyWord, String tagIds, String sourceIds); } diff --git a/src/main/java/com/nbclass/activity/service/impl/CaseTypeServiceImpl.java b/src/main/java/com/nbclass/activity/service/impl/CaseTypeServiceImpl.java index c70c279..52f34cf 100644 --- a/src/main/java/com/nbclass/activity/service/impl/CaseTypeServiceImpl.java +++ b/src/main/java/com/nbclass/activity/service/impl/CaseTypeServiceImpl.java @@ -30,17 +30,8 @@ public class CaseTypeServiceImpl implements CaseTypeService { } @Override - public PageInfo getSearchCase(String parameter, Integer dictItemId,Integer page, Integer pageSize) { - PageHelper.startPage(page,pageSize); - List list = caseTypeMapper.getSearchCase(parameter,dictItemId); - return new PageInfo<>(list); - } - - @Override - public PageInfo getListCase(Integer page, Integer pageSize) { - PageHelper.startPage(page,pageSize); - List list = caseTypeMapper.getListCase(); - return new PageInfo<>(list); + public Content getListCase(Long contentId) { + return caseTypeMapper.getListCase(contentId); } @Override diff --git a/src/main/java/com/nbclass/activity/service/impl/ContentServiceImpl.java b/src/main/java/com/nbclass/activity/service/impl/ContentServiceImpl.java index 714df5b..c39b8e2 100644 --- a/src/main/java/com/nbclass/activity/service/impl/ContentServiceImpl.java +++ b/src/main/java/com/nbclass/activity/service/impl/ContentServiceImpl.java @@ -158,7 +158,7 @@ public class ContentServiceImpl implements ContentService { if(StringUtils.isNotBlank(o.getTags())){ ArrayList postTagList = CommonUtils.str2List(o.getTags()); // 查询自定义标签的dictid - Long dictId = dataDictMapper2.getDataDictID(); + Long dictId = dataDictMapper2.getDataDictIDLabels(); //根据标签名称查询标签信息 List tagList = dataDictMapper2.getDataDictTemName(postTagList); @@ -225,6 +225,7 @@ public class ContentServiceImpl implements ContentService { entity.setType(null); mapper.insertSelective(entity); updateLabelAndImages(entity); + entity.setVisibility(2); // 提交到ElasticSearch entity = findById(entity.getId()); @@ -390,6 +391,10 @@ public class ContentServiceImpl implements ContentService { } //更新案例状态(审核可能是下架重新申请的) mapper.updateContentRelease(application.getContentId(),1,2); + //更新es的状态 + Content entity=mapper.findById(application.getContentId()); + entity.setVisibility(2); + esService.merge(entity); } @Override @@ -400,10 +405,16 @@ public class ContentServiceImpl implements ContentService { @Override @Transactional public void deleteApplication(Long applicationId) { + //查询案例id + Long contentId = mapper.getContentId(applicationId); //删除案例审核申请 mapper.deleteApplication(applicationId); //删除审核人信息 mapper.deleteCheck(applicationId); + //更新es的状态 + Content entity=mapper.findById(contentId); + entity.setVisibility(2); + esService.merge(entity); } @Override @@ -438,6 +449,10 @@ public class ContentServiceImpl implements ContentService { Long contentId = mapper.getContentId(check.getApplicationId()); //更新案例状态 mapper.updateContentRelease(contentId,2,1); + //更新es的状态 + Content entity=mapper.findById(contentId); + entity.setVisibility(1); + esService.merge(entity); }else { //审核驳回 application.setStatus(3); @@ -467,6 +482,10 @@ public class ContentServiceImpl implements ContentService { mapper.deleteCheck(application.getId()); //案例表状态修改为已下线 mapper.updateContentRelease(contentId,4,2); + //更新es的状态 + Content entity=mapper.findById(contentId); + entity.setVisibility(2); + esService.merge(entity); } @Override diff --git a/src/main/java/com/nbclass/activity/service/impl/DataDictServiceImpl.java b/src/main/java/com/nbclass/activity/service/impl/DataDictServiceImpl.java index aae6a6b..23aa1b5 100644 --- a/src/main/java/com/nbclass/activity/service/impl/DataDictServiceImpl.java +++ b/src/main/java/com/nbclass/activity/service/impl/DataDictServiceImpl.java @@ -54,10 +54,18 @@ public class DataDictServiceImpl implements DataDictService { if(cnt!=null && cnt>0) { throw new ParameterException("请先删除子项再删除字典!"); } - Long dataDictID = mapper.getDataDictID(); + List dataDictID = mapper.getDataDictID(); for (Long id : ids) { if(dataDictID.equals(id)) throw new ParameterException("该字典不可删除!"); } + List tids = dataDictItemMapper.getContentDict(); + for (Long id : ids) { + for (Long tid : tids) { + if(id.equals(tid)){ + throw new ParameterException("该字典已被案例引用!"); + } + } + } mapper.deleteByIds(ids); } diff --git a/src/main/java/com/nbclass/activity/service/impl/ElasticSearchServiceImpl.java b/src/main/java/com/nbclass/activity/service/impl/ElasticSearchServiceImpl.java index 10e78ae..79fdd58 100644 --- a/src/main/java/com/nbclass/activity/service/impl/ElasticSearchServiceImpl.java +++ b/src/main/java/com/nbclass/activity/service/impl/ElasticSearchServiceImpl.java @@ -1,9 +1,7 @@ package com.nbclass.activity.service.impl; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; +import java.util.*; import javax.annotation.Resource; @@ -259,9 +257,9 @@ public class ElasticSearchServiceImpl implements ElasticSearchService { } @Override - public JSONObject getList(Integer pageNum, Integer pageSize, String type, String keyWord, String tagIds, String sourceIds) { + public Map getList(Integer pageNum, Integer pageSize, String type, String keyWord, String tagIds, String sourceIds) { // 封装Map参数返回 - JSONObject result = new JSONObject(); + Map result = new HashMap<>(); try { // 选择标签或来源过滤时,从数据库查询记录 /*if(StringUtils.isNotBlank(tagIds) || StringUtils.isNotBlank(sourceIds)) { @@ -280,7 +278,8 @@ public class ElasticSearchServiceImpl implements ElasticSearchService { } BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); - if(StringUtils.isNotBlank(type)) { // 案例类型 + boolQueryBuilder.must(QueryBuilders.termQuery("visibility", 1)); + /*if(StringUtils.isNotBlank(type)) { // 案例类型 boolQueryBuilder.must(QueryBuilders.termQuery("type", type)); if (StringUtils.isNoneBlank(keyWord)){ BoolQueryBuilder keywordQuery = QueryBuilders.boolQuery(); @@ -300,20 +299,29 @@ public class ElasticSearchServiceImpl implements ElasticSearchService { boolQueryBuilder.should(QueryBuilders.matchQuery("content_text", keyWord)); boolQueryBuilder.minimumShouldMatch(1); // 至少一个should条件满足 } - } + }*/ + if (StringUtils.isNoneBlank(keyWord)){ + BoolQueryBuilder keywordQuery = QueryBuilders.boolQuery(); + keywordQuery.should(QueryBuilders.matchQuery("title", keyWord)); + keywordQuery.should(QueryBuilders.matchQuery("desct", keyWord)); + //keywordQuery.should(QueryBuilders.matchQuery("fromName", keyWord)); + keywordQuery.should(QueryBuilders.matchQuery("tags", keyWord)); + keywordQuery.should(QueryBuilders.matchQuery("content_text", keyWord)); + boolQueryBuilder.must(keywordQuery); + } //选择标签或来源过滤 if(StringUtils.isNotBlank(tagIds)){ List tagIdList = Arrays.asList(tagIds.split(",")); for(String tagId:tagIdList) { - boolQueryBuilder.must(QueryBuilders.termQuery("tagList.id", tagId)); + boolQueryBuilder.must(QueryBuilders.termQuery("tagList.tid", tagId)); } } - if(StringUtils.isNotBlank(sourceIds)){ + /*if(StringUtils.isNotBlank(sourceIds)){ List sourIdList = Arrays.asList(sourceIds.split(",")); for(String sourId:sourIdList) { boolQueryBuilder.must(QueryBuilders.termQuery("fromid", sourId)); } - } + }*/ searchSourceBuilder.query(boolQueryBuilder); diff --git a/src/main/java/com/nbclass/config/DateConverter.java b/src/main/java/com/nbclass/config/DateConverter.java index ec30ec2..e74f315 100644 --- a/src/main/java/com/nbclass/config/DateConverter.java +++ b/src/main/java/com/nbclass/config/DateConverter.java @@ -12,7 +12,9 @@ public class DateConverter implements Converter { @Override public Date convert(String source) { try { - return sdf.parse(source); + if(!source.equals("")){ + return sdf.parse(source); + } } catch (ParseException e) { e.printStackTrace(); } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 57711a9..fbea729 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -34,7 +34,7 @@ spring: enabled: true # 开启 Elasticsearch仓库(默认值:true) client: reactive: - endpoints: 172.24.133.129:9200 + endpoints: 39.108.110.167:9200 connection-timeout: 5000 socket-timeout: 5000 diff --git a/src/main/resources/mapper/activity/CaseTypeMapper.xml b/src/main/resources/mapper/activity/CaseTypeMapper.xml index 09a5be8..8d167e7 100644 --- a/src/main/resources/mapper/activity/CaseTypeMapper.xml +++ b/src/main/resources/mapper/activity/CaseTypeMapper.xml @@ -11,10 +11,10 @@ - + @@ -36,7 +36,7 @@ select id,name from data_dict - SELECT - c.id, - c.title, - c.praiseno, - c.listicon, - c.comments, COUNT(s.content_id) as userTotal, IFNULL(SUM(s.score),0) AS TotalScore FROM content c LEFT JOIN scoring_table s ON c.id = s.content_id WHERE - c.RELEASE = 2 + c.RELEASE = 2 and c.id = #{contentId} ORDER BY c.createtime DESC @@ -100,4 +95,4 @@ ts.cid = #{contentId} - \ No newline at end of file + diff --git a/src/main/resources/mapper/activity/ContentMapper.xml b/src/main/resources/mapper/activity/ContentMapper.xml index 019c954..35ecf1f 100644 --- a/src/main/resources/mapper/activity/ContentMapper.xml +++ b/src/main/resources/mapper/activity/ContentMapper.xml @@ -128,6 +128,24 @@ and c.label_feedback > 0 + + and DATE_FORMAT(c.createtime, '%Y-%m-%d')>= DATE_FORMAT(#{createtime}, '%Y-%m-%d') + + + and DATE_FORMAT(c.createtime, '%Y-%m-%d') <= DATE_FORMAT(#{createtimeSection}, '%Y-%m-%d') + + + and DATE_FORMAT(c.updatetime, '%Y-%m-%d')>= DATE_FORMAT(#{updatetime}, '%Y-%m-%d') + + + and DATE_FORMAT(c.updatetime, '%Y-%m-%d') <= DATE_FORMAT(#{updatetimeSection}, '%Y-%m-%d') + + + and DATE_FORMAT(c.online_time, '%Y-%m-%d')>= DATE_FORMAT(#{onlineTime}, '%Y-%m-%d') + + + and DATE_FORMAT(c.online_time, '%Y-%m-%d') <= DATE_FORMAT(#{onlineTimeSection}, '%Y-%m-%d') + and item.id in diff --git a/src/main/resources/mapper/activity/DataDictItemMapper.xml b/src/main/resources/mapper/activity/DataDictItemMapper.xml index 68da645..687a08f 100644 --- a/src/main/resources/mapper/activity/DataDictItemMapper.xml +++ b/src/main/resources/mapper/activity/DataDictItemMapper.xml @@ -45,4 +45,12 @@ where item.name like concat('%',#{name},'%') + + diff --git a/src/main/resources/mapper/activity/DataDictMapper.xml b/src/main/resources/mapper/activity/DataDictMapper.xml index bd0a250..85e900b 100644 --- a/src/main/resources/mapper/activity/DataDictMapper.xml +++ b/src/main/resources/mapper/activity/DataDictMapper.xml @@ -13,24 +13,24 @@ - + - + - delete from data_dict where id in + delete from data_dict where id in #{item} - + - + - + - + INSERT ignore INTO data_dict_item(dictid, `value`, `name`) VALUES (#{dictid}, #{value}, #{name} ) - - \ No newline at end of file + + + + diff --git a/src/main/resources/templates/content/application.html b/src/main/resources/templates/content/application.html index ce58d72..21ec885 100644 --- a/src/main/resources/templates/content/application.html +++ b/src/main/resources/templates/content/application.html @@ -76,6 +76,73 @@ +
+ + +
+ + + + +
+
+ +
+ + +
+ + + + +
+
+ + +
+ + +
+ + + + +
+
+ +
+ + +
+ + + + +
+
+ +
+ + +
+ + + + +
+
+ +
+ + +
+ + + + +
+
+
@@ -147,7 +214,6 @@ {field: 'labelFeedback', title: '索引标签反馈次数', align : "center", width: "50"}, {field: 'purposeCase', title: '案例用途', align : "center", width: "60", formatter:function(value,row, index){ for(var i = 0; i < row.tagList.length;i++){ - console.log(row.tagList[i].id+row.tagList[i].tagName) if(row.tagList[i].id === 19){ return row.tagList[i].tagName; } @@ -156,7 +222,6 @@ }}, {field: 'formCreative', title: '创意形式', align : "center", width: "60", formatter:function(value,row, index){ for(var i = 0; i < row.tagList.length;i++){ - console.log(row.tagList[i].id+row.tagList[i].tagName) if(row.tagList[i].id === 20){ return row.tagList[i].tagName; } @@ -200,7 +265,14 @@ {field: 'createtime', title: '创建时间', align : "center", width: "50"}, {field: 'updatetime', title: '修改时间', align : "center", width: "50"}, {field: 'onlineTime', title: '上线时间', align : "center", width: "50"}, - {field: 'position', title: '关联部门', align : "center", width: "50"}, + {field: 'position', title: '关联部门', align : "center", width: "50", formatter:function(value,row, index){ + for(var i = 0; i < row.tagList.length;i++){ + if(row.tagList[i].id === 26){ + return row.tagList[i].tagName; + } + } + return ""; + }}, {field: 'userName', title: '创建者', align : "center", width: "50"}, /* {field: 'title', title: '标题', align : "left", width: "25%", formatter: function(value, row, index) { if(value!=null && $.trim(value)!='' && value.length>25){ @@ -256,6 +328,12 @@ status: $("#status").val(), quantity: $("#count").val(), type:$("#typeCase").val(), + createtime:$("#createTime").find("input").val(), + createtimeSection:$("#createTimeSection").find("input").val(), + updatetime:$("#updateTime").find("input").val(), + updatetimeSection:$("#updateTimeSection").find("input").val(), + onlineTime:$("#onlineTime").find("input").val(), + onlineTimeSection:$("#onlineTimeSection").find("input").val(), tagLists: "" +$("#brandCompany").val()+"," @@ -360,29 +438,22 @@ function getDropDownBox(){ //初始化下拉框 $.getJSON("/cases/console/datadict/getDropDownBox",function (data){ - console.log(data) $.each(data.data, function(i, item){ if(item.dictId === 18 ){ - console.log(item.dictId) $("#typeCase").append("\n"); }else if(item.dictId === 19 ){ - console.log(item.dictId) $("#purposeCase").append("\n"); }else if(item.dictId === 20 ){ - console.log(item.dictId) $("#formCreative").append("\n"); }else if(item.dictId === 21 ){ - console.log(item.dictId) $("#eventsFestival").append("\n"); }else if(item.dictId === 23 ){ - console.log(item.dictId) $("#brandCompany").append("\n"); }else if(item.dictId === 24 ){ - console.log(item.dictId) $("#advertisingAgency").append("\n"); }else if(item.dictId === 25){ $("#tags").append("\n"); @@ -453,5 +524,14 @@ }, 2); } + $('.date').datetimepicker({ + language: 'zh-CN',//显示中文 + format: 'yyyy-mm-dd',//显示格式 + minView: "month",//设置只显示到月份 + initialDate: new Date(),//初始化当前日期 + autoclose: true,//选中自动关闭 + todayBtn: true//显示今日按钮 + }) + diff --git a/src/main/resources/templates/content/edit2.html b/src/main/resources/templates/content/edit2.html index 47a0372..a6d6854 100644 --- a/src/main/resources/templates/content/edit2.html +++ b/src/main/resources/templates/content/edit2.html @@ -36,6 +36,7 @@
@@ -535,25 +536,37 @@ var caseType = [[${caseType}]]; // 提交保存 $("#btn_save").on('click', function () { if($("#contentType26").val() === null){ - layer.msg('关联部门不能为空!'); + alert('关联部门不能为空!'); + return; } if($("#contentType18").val() === null){ - layer.msg('案例类型不能为空!'); + alert('案例类型不能为空!'); + return; } if($("#contentType19").val() === null){ - layer.msg('案例用途不能为空!'); + alert('案例用途不能为空!'); + return; } if($("#contentType20").val() === null){ - layer.msg('创意形式不能为空!'); + alert('创意形式不能为空!'); + return; } if($("#contentType21").val() === null){ - layer.msg('节日事件不能为空!'); + alert('节日事件不能为空!'); + return; } if($("#contentType23").val() === null){ - layer.msg('品牌公司不能为空!'); + alert('品牌公司不能为空!'); + return; } if($("#contentType24").val() === null){ - layer.msg('广告公司不能为空!'); + alert('广告公司不能为空!'); + return; + } + console.log($("#tagNames").val()) + if($("#tagNames").val() === ''){ + alert('标签不能为空!'); + return; } // editor.sync(); // 同步editor数据 if(caseType == 'design' || caseType == 'video' || caseType == 'h5'){ @@ -566,7 +579,7 @@ var caseType = [[${caseType}]]; // 替换所有的换行符和所有所有的空格 textValue = textValue.trim().replace(/\r\n/g, "").replace(/\n/g, "").replace(/\s/g,""); $('#content_text').val(textValue); - + if (doValidForm(newsForm)) { // $('#type').removeAttr('disabled'); // disabled的表单form.serialize取不到值 Core.mask("#btn_save"); diff --git a/src/main/resources/templates/content/list2.html b/src/main/resources/templates/content/list2.html index e6a4be5..4107689 100644 --- a/src/main/resources/templates/content/list2.html +++ b/src/main/resources/templates/content/list2.html @@ -77,6 +77,73 @@
+
+ + +
+ + + + +
+
+ +
+ + +
+ + + + +
+
+ + +
+ + +
+ + + + +
+
+ +
+ + +
+ + + + +
+
+ +
+ + +
+ + + + +
+
+ +
+ + +
+ + + + +
+
+
@@ -247,7 +314,7 @@ let seeHtml= ""; let delHtml = ""; if(row.status === 5 || row.status === 4){ - if($("#name").val() !== 'admin'){ + /*if($("#name").val() !== 'admin'){ submitHtml = '提交'; editHtml = ' 修改'; delHtml = ' 删除'; @@ -255,25 +322,31 @@ //这里的1标记为查看状态 seeHtml = '查看'; delHtml = ' 删除'; - } + }*/ + submitHtml = '提交'; + editHtml = ' 修改'; + delHtml = ' 删除'; }else if(row.status === 1){ - if($("#name").val() !== 'admin'){ + /*if($("#name").val() !== 'admin'){ submitHtml = '撤回'; - } + }*/ //这里的1标记为查看状态 seeHtml = '查看'; delHtml = ' 删除'; + submitHtml = '撤回'; }else if(row.status === 2 || row.status === 3){ - if($("#name").val() !== 'admin'){ + /*if($("#name").val() !== 'admin'){ submitHtml = '更新'; - } + }*/ + submitHtml = '更新'; seeHtml = '查看'; delHtml = ' 删除'; } if(row.status === 2){ - if($("#name").val() !== 'admin'){ + /*if($("#name").val() !== 'admin'){ offlineHtml = '下线'; - } + }*/ + offlineHtml = '下线'; seeHtml = '查看'; delHtml = ' 删除'; } @@ -304,6 +377,12 @@ status: $("#status").val(), quantity: $("#count").val(), type:$("#typeCase").val(), + createtime:$("#createTime").find("input").val(), + createtimeSection:$("#createTimeSection").find("input").val(), + updatetime:$("#updateTime").find("input").val(), + updatetimeSection:$("#updateTimeSection").find("input").val(), + onlineTime:$("#onlineTime").find("input").val(), + onlineTimeSection:$("#onlineTimeSection").find("input").val(), tagLists: "" +$("#brandCompany").val()+"," @@ -400,6 +479,12 @@ $("#case_number").val(""); $("#title").val(""); $(".form-control").find("option:selected").attr("selected",false); + $("#createTime").find("input").val(""); + $("#createTimeSection").find("input").val(""); + $("#updateTime").find("input").val(""); + $("#updateTimeSection").find("input").val(""); + $("#onlineTime").find("input").val(""); + $("#onlineTimeSection").find("input").val(""); }); }); @@ -498,4 +583,17 @@ }, 2); } + $('.date').datetimepicker({ + language: 'zh-CN',//显示中文 + format: 'yyyy-mm-dd',//显示格式 + minView: "month",//设置只显示到月份 + initialDate: new Date(),//初始化当前日期 + autoclose: true,//选中自动关闭 + todayBtn: true//显示今日按钮 + }) + + + + + diff --git a/src/main/resources/templates/index/index.html b/src/main/resources/templates/index/index.html index d710a38..7eba8da 100644 --- a/src/main/resources/templates/index/index.html +++ b/src/main/resources/templates/index/index.html @@ -7,6 +7,7 @@ + @@ -23,6 +24,8 @@ + +