Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
haungxing 2 months ago
parent
commit
bb5ff08aff
  1. 64
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/QuestionAnswerCommentController.java
  2. 52
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java
  3. 11
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/QuestionAnswerCommentMapper.java
  4. 26
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/QuestionAnswerCommentService.java
  5. 95
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java
  6. 33
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/vo/AnswerCommentRequest.java
  7. 23
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/vo/AnswerPraiseRequest.java
  8. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java
  9. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationVideoTypeMapper.java
  10. 33
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationVideoTypeMapper.xml
  11. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java
  12. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java

64
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/QuestionAnswerCommentController.java

@ -0,0 +1,64 @@
package com.hnac.gglm.bigmodel.maintenance.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.gglm.bigmodel.maintenance.entity.QuestionAnswerCommentEntity;
import com.hnac.gglm.bigmodel.maintenance.service.QuestionAnswerCommentService;
import com.hnac.gglm.bigmodel.maintenance.vo.AnswerCommentRequest;
import com.hnac.gglm.bigmodel.maintenance.vo.AnswerPraiseRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Author: ypj
* @Date: 2024/9/21 13:27
*/
@RestController
@Slf4j
@RequestMapping("/question/")
@AllArgsConstructor
@Api(value = "问题评论管理", tags = "问题评论管理")
public class QuestionAnswerCommentController {
private final QuestionAnswerCommentService questionAnswerCommentService;
@PostMapping("/comment")
@ApiOperation(value = "评论")
@ApiOperationSupport(order = 1)
public R comment(@RequestBody AnswerCommentRequest req) {
return R.status(questionAnswerCommentService.comment(req));
}
@PostMapping("/praise")
@ApiOperation(value = "点赞")
@ApiOperationSupport(order = 2)
public R praise(@RequestBody AnswerPraiseRequest req) {
return R.status(questionAnswerCommentService.praise(req));
}
@PostMapping("/resetPraise")
@ApiOperation(value = "取消点赞")
@ApiOperationSupport(order = 3)
public R<Boolean> resetPraise(@RequestBody AnswerPraiseRequest req) {
return R.status(questionAnswerCommentService.resetPraise(req));
}
@GetMapping("/listByQuestionId")
@ApiOperation(value = "根据问题id获取评论列表")
@ApiOperationSupport(order = 4)
public R<List<QuestionAnswerCommentEntity>> listByQuestionId(@RequestParam @ApiParam("问题id") String questionId) {
return R.data(questionAnswerCommentService.listByQuestionId(questionId));
}
@GetMapping("/praiseCount")
@ApiOperation(value = "点赞数")
@ApiOperationSupport(order = 5)
public R<Long> praiseCount(String questionId) {
return R.data(questionAnswerCommentService.praiseCount(questionId));
}
}

52
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java

@ -0,0 +1,52 @@
package com.hnac.gglm.bigmodel.maintenance.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springframework.data.annotation.Transient;
import java.io.Serializable;
/**
* @Author: ypj
* @Date: 2024/9/21 11:07
*/
@Data
@TableName("question_answer_comment")
@ApiModel
public class QuestionAnswerCommentEntity extends TenantEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("对话id")
@TableField("chat_id")
private String chatId;
@ApiModelProperty("问题id")
@TableField("question_id")
private String questionId;
@ApiModelProperty("用户id")
@TableField("user_id")
private Long userId;
@ApiModelProperty("用户账号")
@TableField(exist = false)
private String userAccount;
@ApiModelProperty("用户名")
@TableField(exist = false)
private String userName;
@ApiModelProperty("点赞")
@TableField("praise")
private Integer praise;
@ApiModelProperty("评论内容")
@TableField("content")
private String content;
}

11
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/QuestionAnswerCommentMapper.java

@ -0,0 +1,11 @@
package com.hnac.gglm.bigmodel.maintenance.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.gglm.bigmodel.maintenance.entity.QuestionAnswerCommentEntity;
/**
* @Author: ypj
* @Date: 2024/9/21 13:31
*/
public interface QuestionAnswerCommentMapper extends BaseMapper<QuestionAnswerCommentEntity> {
}

26
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/QuestionAnswerCommentService.java

@ -0,0 +1,26 @@
package com.hnac.gglm.bigmodel.maintenance.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.gglm.bigmodel.maintenance.entity.QuestionAnswerCommentEntity;
import com.hnac.gglm.bigmodel.maintenance.vo.AnswerCommentRequest;
import com.hnac.gglm.bigmodel.maintenance.vo.AnswerPraiseRequest;
import java.util.List;
/**
* @Author: ypj
* @Date: 2024/9/21 13:29
*/
public interface QuestionAnswerCommentService extends IService<QuestionAnswerCommentEntity> {
QuestionAnswerCommentEntity getComment(Long userId, String questionId);
Boolean comment(AnswerCommentRequest req);
Boolean praise(AnswerPraiseRequest req);
List<QuestionAnswerCommentEntity> listByQuestionId(String questionId);
Long praiseCount(String questionId);
Boolean resetPraise(AnswerPraiseRequest req);
}

95
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java

@ -0,0 +1,95 @@
package com.hnac.gglm.bigmodel.maintenance.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.gglm.bigmodel.maintenance.entity.QuestionAnswerCommentEntity;
import com.hnac.gglm.bigmodel.maintenance.mapper.QuestionAnswerCommentMapper;
import com.hnac.gglm.bigmodel.maintenance.service.QuestionAnswerCommentService;
import com.hnac.gglm.bigmodel.maintenance.vo.AnswerCommentRequest;
import com.hnac.gglm.bigmodel.maintenance.vo.AnswerPraiseRequest;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author: ypj
* @Date: 2024/9/21 13:32
*/
@Service
@Slf4j
@AllArgsConstructor
@DS("hznlm")
public class QuestionAnswerCommentServiceImpl extends ServiceImpl<QuestionAnswerCommentMapper, QuestionAnswerCommentEntity> implements QuestionAnswerCommentService {
private final IUserClient userClient;
@Override
public QuestionAnswerCommentEntity getComment(Long userId, String questionId) {
LambdaQueryWrapper<QuestionAnswerCommentEntity> queryWrapper = Wrappers.<QuestionAnswerCommentEntity>lambdaQuery()
.eq(QuestionAnswerCommentEntity::getQuestionId, questionId)
.eq(QuestionAnswerCommentEntity::getUserId, userId).last("limit 1");
return this.getOne(queryWrapper);
}
@Override
public Boolean comment(AnswerCommentRequest req) {
QuestionAnswerCommentEntity entity = getComment(AuthUtil.getUserId(),
req.getQuestionId());
if (ObjectUtil.isEmpty(entity)) {
entity = req.toEntity();
}
return this.saveOrUpdate(entity);
}
@Override
public Boolean praise(AnswerPraiseRequest req) {
QuestionAnswerCommentEntity entity = getComment(AuthUtil.getUserId(),
req.getQuestionId());
if (ObjectUtil.isNotEmpty(entity)) {
entity.setPraise(req.getPraise());
return this.updateById(entity);
}
return Boolean.FALSE;
}
@Override
public List<QuestionAnswerCommentEntity> listByQuestionId(String questionId) {
List<QuestionAnswerCommentEntity> list = this.list(Wrappers.<QuestionAnswerCommentEntity>lambdaQuery()
.eq(QuestionAnswerCommentEntity::getQuestionId, questionId)
.orderByAsc(QuestionAnswerCommentEntity::getCreateTime));
list.forEach(item -> {
R<User> user = userClient.userInfoById(item.getUserId());
if (user.isSuccess() && user.getData() != null) {
item.setUserName(user.getData().getName());
item.setUserAccount(user.getData().getAccount());
}
});
return list;
}
@Override
public Long praiseCount(String questionId) {
return this.count(Wrappers.<QuestionAnswerCommentEntity>lambdaQuery()
.eq(QuestionAnswerCommentEntity::getQuestionId, questionId)
.eq(QuestionAnswerCommentEntity::getPraise, 1));
}
@Override
public Boolean resetPraise(AnswerPraiseRequest req) {
QuestionAnswerCommentEntity entity = getComment(AuthUtil.getUserId(),
req.getQuestionId());
if (ObjectUtil.isNotEmpty(entity)) {
entity.setPraise(0);
return this.updateById(entity);
}
return Boolean.FALSE;
}
}

33
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/vo/AnswerCommentRequest.java

@ -0,0 +1,33 @@
package com.hnac.gglm.bigmodel.maintenance.vo;
import com.hnac.gglm.bigmodel.maintenance.entity.QuestionAnswerCommentEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.secure.utils.AuthUtil;
/**
* @Author: ypj
* @Date: 2024/9/21 13:38
*/
@Data
@ApiModel(value = "评论请求")
public class AnswerCommentRequest {
@ApiModelProperty(value = "对话id")
private String chartId;
@ApiModelProperty(value = "问题id")
private String questionId;
@ApiModelProperty(value = "评论内容")
private String content;
public QuestionAnswerCommentEntity toEntity() {
QuestionAnswerCommentEntity entity = new QuestionAnswerCommentEntity();
entity.setChatId(chartId);
entity.setQuestionId(questionId);
entity.setContent(content);
entity.setUserId(AuthUtil.getUserId());
return entity;
}
}

23
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/vo/AnswerPraiseRequest.java

@ -0,0 +1,23 @@
package com.hnac.gglm.bigmodel.maintenance.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author: ypj
* @Date: 2024/9/21 13:49
*/
@Data
@ApiModel(value = "点赞请求")
public class AnswerPraiseRequest {
@ApiModelProperty(value = "对话id")
private String chartId;
@ApiModelProperty(value = "问题id")
private String questionId;
@ApiModelProperty(value = "点赞,0取消点赞,1点赞")
private Integer praise;
}

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java

@ -386,4 +386,11 @@ public class StationVideoTypeController extends BladeController {
public R<List<StationVideoTypeEntity>> getVideoByPointCodes(@RequestParam @ApiParam("视频设备编号") String pointCodes) { public R<List<StationVideoTypeEntity>> getVideoByPointCodes(@RequestParam @ApiParam("视频设备编号") String pointCodes) {
return R.data(stationVideoTypeService.getVideoByPointCodes(pointCodes)); return R.data(stationVideoTypeService.getVideoByPointCodes(pointCodes));
} }
@GetMapping ("/listAll")
@ApiOperationSupport(order = 200)
@ApiOperation(value = "获取所有站点视频")
public R<List<StationVideoTypeVO>> listAll() {
return R.data(stationVideoTypeService.listAll());
}
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationVideoTypeMapper.java

@ -44,4 +44,6 @@ public interface StationVideoTypeMapper extends UserDataScopeBaseMapper<StationV
*/ */
@UserDataAuth @UserDataAuth
List<StationEntity> getAgencyStationsByVideo(@Param("type") String type); List<StationEntity> getAgencyStationsByVideo(@Param("type") String type);
List<StationVideoTypeVO> listAll();
} }

33
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationVideoTypeMapper.xml

@ -71,4 +71,37 @@
</where> </where>
order by hs.sort order by hs.sort
</select> </select>
<select id="listAll" resultType="com.hnac.hzims.operational.station.vo.StationVideoTypeVO">
SELECT
hsvt.id,
hsvt.name,
hsvt.station_id,
hsvt.dept_id,
hsvt.is_hikvideo,
hsvt.address,
hsvt.type,
hsvt.live_source_address,
hsvt.point_code,
hsvt.tenant_id,
hsvt.create_time,
hsvt.update_time,
hsvt.create_user,
hsvt.update_user,
hsvt.is_deleted,
hsvt.status,
hsvt.create_dept,
hsvt.video_host,
hsvt.app_key,
hsvt.app_secret,
hsvt.sort,
hsvt.video_type,
hsvt.platform_id,
hs.`name` AS stationName
FROM `hzims_station_video_type` hsvt
LEFT JOIN hzims_station hs ON hsvt.station_id = hs.`code`
WHERE
hsvt.is_deleted = 0
AND hs.is_deleted = 0
</select>
</mapper> </mapper>

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java

@ -79,4 +79,7 @@ public interface IStationVideoTypeService extends IService<StationVideoTypeEntit
List<HikVideoAreaTreeVO> getHikVideoAreaTree(Long platformId); List<HikVideoAreaTreeVO> getHikVideoAreaTree(Long platformId);
List<StationVideoTypeEntity> getVideoByPointCodes(String pointCodes); List<StationVideoTypeEntity> getVideoByPointCodes(String pointCodes);
List<StationVideoTypeVO> listAll();
} }

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java

@ -366,4 +366,9 @@ public class StationVideoTypeServiceImpl extends ServiceImpl<StationVideoTypeMap
LambdaQueryWrapper<StationVideoTypeEntity> qw = Wrappers.<StationVideoTypeEntity>lambdaQuery().in(StationVideoTypeEntity::getPointCode, pointCodeList); LambdaQueryWrapper<StationVideoTypeEntity> qw = Wrappers.<StationVideoTypeEntity>lambdaQuery().in(StationVideoTypeEntity::getPointCode, pointCodeList);
return this.list(qw); return this.list(qw);
} }
@Override
public List<StationVideoTypeVO> listAll() {
return baseMapper.listAll();
}
} }

Loading…
Cancel
Save