资源标签

master
yqy 3 years ago
parent 4e248c5324
commit 35ab0068cf

@ -0,0 +1,13 @@
package com.baiye.model.vo;
import lombok.Data;
@Data
public class ResSourceLabel {
private String sourceLabel;
private String name;
private Long clueId;
}

@ -5,6 +5,7 @@ import com.baiye.http.ResponseCode;
import com.baiye.model.dto.ClueDto;
import com.baiye.model.dto.ClueQueryCriteria;
import com.baiye.model.dto.DistributeResponseDTO;
import com.baiye.model.vo.ResSourceLabel;
import com.baiye.module.entity.Clue;
import com.baiye.module.entity.ClueMiddle;
import com.baiye.module.service.ClueService;
@ -117,4 +118,10 @@ public class ClueController {
public void exportClueList(HttpServletResponse response, ClueQueryCriteria clueQueryCriteria) {
clueService.exportClueList(response, clueQueryCriteria);
}
@ApiOperation("查询资源标签")
@PostMapping("/findSourceLabel")
public ResponseEntity<List<ResSourceLabel>> findSourceLabel(@RequestBody List<Long> clueIds) {
return new ResponseEntity<>(clueService.findSourceLabel(clueIds), HttpStatus.OK);
}
}

@ -4,6 +4,7 @@ import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.baiye.model.dto.ClueDto;
import com.baiye.model.dto.ClueQueryCriteria;
import com.baiye.model.vo.ResSourceLabel;
import com.baiye.util.AESUtils;
import org.apache.commons.lang.StringUtils;
import org.hibernate.query.internal.NativeQueryImpl;
@ -155,4 +156,29 @@ public class ClueJpa {
}
return clueDtoList;
}
public List<ResSourceLabel> findSourceLabel(List<Long> clueIds){
StringBuilder sql = new StringBuilder();
sql.append("select tcm.source_label sourceLabel, clue_id as clueId,tc.name as name from tb_clue_middle tcm LEFT JOIN tb_clue tc on tcm.clue_id = tc.id where 1=1 ");
if (clueIds != null && clueIds.size() >0) {
sql.append("AND tcm.clue_id IN (:clueIds) ");
}
Query query = entityManager.createNativeQuery(sql.toString());
if (clueIds != null && clueIds.size() >0) {
query.setParameter("clueIds", clueIds);
}
query.unwrap(NativeQueryImpl.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
List resultList = query.getResultList();
List<ResSourceLabel> list = new ArrayList<>();
for (Object obj : resultList) {
Map row = (Map) obj;
ResSourceLabel resSourceLabel = new ResSourceLabel();
resSourceLabel.setSourceLabel((String) row.get("sourceLabel"));
resSourceLabel.setName((String) row.get("name"));
BigInteger clueId = (BigInteger) row.get("clueId");
resSourceLabel.setClueId(clueId.longValue());
list.add(resSourceLabel);
}
return list;
}
}

@ -3,6 +3,7 @@ package com.baiye.module.service;
import com.baiye.model.dto.ClueDto;
import com.baiye.model.dto.ClueQueryCriteria;
import com.baiye.model.dto.DistributeResponseDTO;
import com.baiye.model.vo.ResSourceLabel;
import com.baiye.module.entity.Clue;
import com.baiye.module.entity.ClueMiddle;
import com.baiye.module.entity.ClueRecord;
@ -122,4 +123,11 @@ public interface ClueService {
* @return
*/
Clue queryDetails(Long clueId);
/**
*
* @param clueIds
* @return
*/
List<ResSourceLabel> findSourceLabel(List<Long> clueIds);
}

@ -7,6 +7,7 @@ import com.baiye.constant.DefaultNumberConstants;
import com.baiye.exception.BadRequestException;
import com.baiye.feign.OrganizeClient;
import com.baiye.model.dto.*;
import com.baiye.model.vo.ResSourceLabel;
import com.baiye.module.dao.ClueJpa;
import com.baiye.module.dao.ClueMiddleRepository;
import com.baiye.module.dao.ClueRecordRepository;
@ -269,4 +270,9 @@ public class ClueServiceImpl implements ClueService {
public Clue queryDetails(Long clueId) {
return clueRepository.findById(clueId).orElseGet(Clue::new);
}
@Override
public List<ResSourceLabel> findSourceLabel(List<Long> clueIds) {
return clueJpa.findSourceLabel(clueIds);
}
}

@ -275,7 +275,7 @@ public class UploadFileServiceImpl implements UploadFileService {
* (3)
* @throws Exception
*/
@Scheduled(cron = "0 0 3 * * ? *")
@Scheduled(cron = "0 0 3 * * ? ")
public void compress() throws Exception {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
DateTime date = DateUtil.yesterday();
@ -284,6 +284,7 @@ public class UploadFileServiceImpl implements UploadFileService {
if (directory){
FileZipUtil.zipFile(new File(path),"zip");
}
log.info("-----------------------------压缩文件夹开始时间{}-----------------------------", DateUtil.now());
}
/**

Loading…
Cancel
Save