Skip to content

Commit 7c7ccad

Browse files
authored
[improvement](chat) fix checkstyle error in CollectService (#439)
1 parent 02b9dc6 commit 7c7ccad

5 files changed

Lines changed: 24 additions & 30 deletions

File tree

semantic/model/src/main/java/com/tencent/supersonic/semantic/model/application/CollectServiceImpl.java

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,21 @@
55
import com.tencent.supersonic.semantic.model.domain.CollectService;
66
import com.tencent.supersonic.semantic.model.domain.dataobject.CollectDO;
77
import com.tencent.supersonic.semantic.model.infrastructure.mapper.CollectMapper;
8+
import java.util.List;
9+
import javax.annotation.Resource;
810
import lombok.extern.slf4j.Slf4j;
9-
import org.apache.commons.lang.StringUtils;
11+
import org.apache.commons.lang3.StringUtils;
1012
import org.springframework.stereotype.Service;
1113

12-
import javax.annotation.Resource;
13-
import java.util.List;
14-
1514

1615
@Slf4j
1716
@Service
1817
public class CollectServiceImpl implements CollectService {
1918

20-
21-
19+
public static final String type = "metric";
2220
@Resource
2321
private CollectMapper collectMapper;
2422

25-
26-
String type = "metric";
27-
28-
2923
@Override
3024
public Boolean createCollectionIndicators(User user, Long id) {
3125
CollectDO collectDO = new CollectDO();
@@ -39,18 +33,18 @@ public Boolean createCollectionIndicators(User user, Long id) {
3933
@Override
4034
public Boolean deleteCollectionIndicators(User user, Long id) {
4135
QueryWrapper<CollectDO> collectDOQueryWrapper = new QueryWrapper<>();
42-
collectDOQueryWrapper.lambda().eq(CollectDO::getUsername,user.getName());
43-
collectDOQueryWrapper.lambda().eq(CollectDO::getCollectId,id);
44-
collectDOQueryWrapper.lambda().eq(CollectDO::getType,type);
36+
collectDOQueryWrapper.lambda().eq(CollectDO::getUsername, user.getName());
37+
collectDOQueryWrapper.lambda().eq(CollectDO::getCollectId, id);
38+
collectDOQueryWrapper.lambda().eq(CollectDO::getType, type);
4539
collectMapper.delete(collectDOQueryWrapper);
4640
return true;
4741
}
4842

4943
@Override
50-
public List<CollectDO> getCollectList(String username) {
44+
public List<CollectDO> getCollectList(String username) {
5145
QueryWrapper<CollectDO> queryWrapper = new QueryWrapper<>();
52-
if (!StringUtils.isEmpty(username)){
53-
queryWrapper.lambda().eq(CollectDO::getUsername,username);
46+
if (!StringUtils.isEmpty(username)) {
47+
queryWrapper.lambda().eq(CollectDO::getUsername, username);
5448
}
5549
return collectMapper.selectList(queryWrapper);
5650
}

semantic/model/src/main/java/com/tencent/supersonic/semantic/model/application/MetricServiceImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ public class MetricServiceImpl implements MetricService {
6565
private ApplicationEventPublisher eventPublisher;
6666

6767
public MetricServiceImpl(MetricRepository metricRepository,
68-
ModelService modelService,
69-
DomainService domainService,
70-
ChatGptHelper chatGptHelper,
71-
CollectService collectService,
72-
ApplicationEventPublisher eventPublisher) {
68+
ModelService modelService,
69+
DomainService domainService,
70+
ChatGptHelper chatGptHelper,
71+
CollectService collectService,
72+
ApplicationEventPublisher eventPublisher) {
7373
this.domainService = domainService;
7474
this.metricRepository = metricRepository;
7575
this.modelService = modelService;
@@ -185,7 +185,7 @@ public PageInfo<MetricResp> queryMetric(PageMetricReq pageMetricReq, User user)
185185
BeanUtils.copyProperties(metricDOPageInfo, pageInfo);
186186
List<CollectDO> collectList = collectService.getCollectList(user.getName());
187187
List<Long> collect = collectList.stream().map(CollectDO::getCollectId).collect(Collectors.toList());
188-
List<MetricResp> metricResps = convertList(metricDOPageInfo.getList(),collect);
188+
List<MetricResp> metricResps = convertList(metricDOPageInfo.getList(), collect);
189189
fillAdminRes(metricResps, user);
190190
pageInfo.setList(metricResps);
191191
return pageInfo;

semantic/model/src/main/java/com/tencent/supersonic/semantic/model/domain/CollectService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public interface CollectService {
1414

1515
Boolean createCollectionIndicators(User user, Long id);
1616

17-
Boolean deleteCollectionIndicators(User user,Long id);
17+
Boolean deleteCollectionIndicators(User user, Long id);
1818

1919
List<CollectDO> getCollectList(String username);
2020

semantic/model/src/main/java/com/tencent/supersonic/semantic/model/domain/utils/MetricConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ public static MetricResp convert2MetricResp(MetricDO metricDO, Map<Long, ModelRe
6666
metricResp.setModelName(modelResp.getName());
6767
metricResp.setDomainId(modelResp.getDomainId());
6868
}
69-
if (collect != null && collect.contains(metricDO.getId())){
69+
if (collect != null && collect.contains(metricDO.getId())) {
7070
metricResp.setIsCollect(true);
71-
}else {
71+
} else {
7272
metricResp.setIsCollect(false);
7373
}
7474
metricResp.setTag(metricDO.getTags());

semantic/model/src/main/java/com/tencent/supersonic/semantic/model/rest/CollectController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ public CollectController(CollectService collectService) {
3030

3131
@PostMapping("/createCollectionIndicators")
3232
public boolean createCollectionIndicators(@RequestBody CollectDO collectDO,
33-
HttpServletRequest request,
34-
HttpServletResponse response) {
33+
HttpServletRequest request,
34+
HttpServletResponse response) {
3535
User user = UserHolder.findUser(request, response);
3636
return collectService.createCollectionIndicators(user, collectDO.getId());
3737
}
3838

3939

4040
@DeleteMapping("/deleteCollectionIndicators/{id}")
4141
public boolean deleteCollectionIndicators(@PathVariable Long id,
42-
HttpServletRequest request,
43-
HttpServletResponse response) {
42+
HttpServletRequest request,
43+
HttpServletResponse response) {
4444
User user = UserHolder.findUser(request, response);
45-
return collectService.deleteCollectionIndicators(user,id);
45+
return collectService.deleteCollectionIndicators(user, id);
4646
}
4747

4848
}

0 commit comments

Comments
 (0)