孙永军 2 år sedan
förälder
incheckning
73f922613a

+ 55 - 0
src/main/java/com/sxtvs/open/api/clue/controller/ClueController.java

@@ -0,0 +1,55 @@
+package com.sxtvs.open.api.clue.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.sxtvs.open.api.clue.dto.ClueDTO;
+import com.sxtvs.open.api.clue.dto.VerifyDTO;
+import com.sxtvs.open.api.clue.entity.Clue;
+import com.sxtvs.open.api.clue.entity.ClueReply;
+import com.sxtvs.open.api.clue.service.impl.ClueReplyServiceImpl;
+import com.sxtvs.open.api.clue.service.impl.ClueServiceImpl;
+import jakarta.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author syj
+ * @since 2023-03-20
+ */
+@RestController
+@RequestMapping("/clue")
+public class ClueController {
+
+    @Resource
+    private ClueServiceImpl clueService;
+
+    @Resource
+    private ClueReplyServiceImpl clueReplyService;
+
+    @RequestMapping("list")
+    public IPage<Clue> ls(@RequestBody ClueDTO clueDTO){
+        return clueService.cluePage(clueDTO);
+    }
+
+    @RequestMapping("store")
+    public void store(@RequestBody Clue clue){
+        clueService.store(clue);
+    }
+
+    @RequestMapping("verify")
+    public void verify(@Validated @RequestBody VerifyDTO verifyDTO){
+        clueService.verify(verifyDTO);
+    }
+
+    @RequestMapping("reply")
+    public void reply(@RequestBody ClueReply clueReply){
+        clueReplyService.reply(clueReply);
+    }
+}

+ 18 - 0
src/main/java/com/sxtvs/open/api/clue/controller/ClueReplyController.java

@@ -0,0 +1,18 @@
+package com.sxtvs.open.api.clue.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author syj
+ * @since 2023-03-20
+ */
+@RestController
+@RequestMapping("/clue/reply")
+public class ClueReplyController {
+
+}

+ 18 - 0
src/main/java/com/sxtvs/open/api/clue/dto/ClueDTO.java

@@ -0,0 +1,18 @@
+package com.sxtvs.open.api.clue.dto;
+
+import lombok.Data;
+
+import java.time.LocalDate;
+
+@Data
+public class ClueDTO {
+    private LocalDate start;
+
+    private LocalDate end;
+
+    private String Title;
+
+    private Integer page = 1;
+
+    private Integer size = 20;
+}

+ 16 - 0
src/main/java/com/sxtvs/open/api/clue/dto/VerifyDTO.java

@@ -0,0 +1,16 @@
+package com.sxtvs.open.api.clue.dto;
+
+import jakarta.validation.constraints.Max;
+import jakarta.validation.constraints.Min;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+@Data
+public class VerifyDTO {
+    @NotNull
+    private Long id;
+
+    @Max(value = 1, message = "status最大为1")
+    @Min(value = -1, message = "status最小为-1")
+    private Integer status;
+}

+ 185 - 0
src/main/java/com/sxtvs/open/api/clue/entity/Clue.java

@@ -0,0 +1,185 @@
+package com.sxtvs.open.api.clue.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author syj
+ * @since 2023-03-20
+ */
+@Getter
+@Setter
+public class Clue implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 线索id
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    private Long siteId;
+
+    private Long catalogId;
+
+    private String catalogInnerCode;
+
+    private String branchInnerCode;
+
+    /**
+     * 线索归属:1-都市快报,2-第一热点新闻
+     */
+    private Integer ascription;
+
+    /**
+     * 线索标题
+     */
+    private String title;
+
+    /**
+     * 线索描述
+     */
+    private String summary;
+
+    /**
+     * 线索内容
+     */
+    private String content;
+
+    /**
+     * 工单时间
+     */
+    private LocalDateTime originTime;
+
+    /**
+     * 推送时间
+     */
+    private LocalDateTime addTime;
+
+    /**
+     * 0:待审核 1:审核通过  -1:审核未通过 
+     */
+    private Integer status;
+
+    /**
+     * 线索来源:1-热线电话,2-微信公众号
+     */
+    private Integer source;
+
+    /**
+     * 是否回复
+     */
+    private Integer replyFlag;
+
+    /**
+     * 回复时间
+     */
+    private LocalDateTime replyTime;
+
+    private String userId;
+
+    /**
+     * 线索提供人
+     */
+    private String author;
+
+    private String phone;
+
+    private String address;
+
+    /**
+     * 爆料人姓名
+     */
+    private String nickname;
+
+    private String email;
+
+    private String videoId;
+
+    /**
+     * 播放地址
+     */
+    private String video;
+
+    private String videoType;
+
+    private String audio;
+
+    /**
+     * 图片
+     */
+    private String image;
+
+    private String topFlag;
+
+    private String type;
+
+    private LocalDateTime topDate;
+
+    private String commentFlag;
+
+    private Long orderFlag;
+
+    private String keyword;
+
+    private String tag;
+
+    private Long hitCount;
+
+    private LocalDateTime publishDate;
+
+    private String logo;
+
+    private String modifyUser;
+
+    private LocalDateTime modifyTime;
+
+    private String isCheck;
+
+    /**
+     * cutv爆料标题
+     */
+    private String rcontent;
+
+    /**
+     * 1:上地图 0或者其他下地图
+     */
+    private String isUpMap;
+
+    /**
+     * 虚拟点击量
+     */
+    private Long virtualHitCount;
+
+    /**
+     * 虚拟点击量基数
+     */
+    private Long cardinalNumber;
+
+    /**
+     * 经度
+     */
+    private BigDecimal longitude;
+
+    /**
+     * 纬度
+     */
+    private BigDecimal latitude;
+
+    private LocalDateTime createTime;
+
+    /**
+     * 0无效,1有效
+     */
+    private Byte validity;
+}

+ 68 - 0
src/main/java/com/sxtvs/open/api/clue/entity/ClueReply.java

@@ -0,0 +1,68 @@
+package com.sxtvs.open.api.clue.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author syj
+ * @since 2023-03-20
+ */
+@Getter
+@Setter
+@TableName("clue_reply")
+public class ClueReply implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 关联线索id
+     */
+    private Long clueId;
+
+    /**
+     * 内容
+     */
+    private String content;
+
+    /**
+     * 回复时间
+     */
+    private LocalDateTime replyTime;
+
+    /**
+     * 修改时间
+     */
+    private LocalDateTime modifyTime;
+
+    /**
+     * 操作人
+     */
+    private Long userId;
+
+    /**
+     * 操作人名字
+     */
+    private String userName;
+
+    /**
+     * 回复模板id
+     */
+    private Integer templateId;
+
+    /**
+     * 状态:1-正常,-1-删除
+     */
+    private Integer status;
+}

+ 16 - 0
src/main/java/com/sxtvs/open/api/clue/mapper/ClueMapper.java

@@ -0,0 +1,16 @@
+package com.sxtvs.open.api.clue.mapper;
+
+import com.sxtvs.open.api.clue.entity.Clue;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author syj
+ * @since 2023-03-20
+ */
+public interface ClueMapper extends BaseMapper<Clue> {
+
+}

+ 16 - 0
src/main/java/com/sxtvs/open/api/clue/mapper/ClueReplyMapper.java

@@ -0,0 +1,16 @@
+package com.sxtvs.open.api.clue.mapper;
+
+import com.sxtvs.open.api.clue.entity.ClueReply;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author syj
+ * @since 2023-03-20
+ */
+public interface ClueReplyMapper extends BaseMapper<ClueReply> {
+
+}

+ 16 - 0
src/main/java/com/sxtvs/open/api/clue/service/IClueReplyService.java

@@ -0,0 +1,16 @@
+package com.sxtvs.open.api.clue.service;
+
+import com.sxtvs.open.api.clue.entity.ClueReply;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author syj
+ * @since 2023-03-20
+ */
+public interface IClueReplyService extends IService<ClueReply> {
+
+}

+ 16 - 0
src/main/java/com/sxtvs/open/api/clue/service/IClueService.java

@@ -0,0 +1,16 @@
+package com.sxtvs.open.api.clue.service;
+
+import com.sxtvs.open.api.clue.entity.Clue;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author syj
+ * @since 2023-03-20
+ */
+public interface IClueService extends IService<Clue> {
+
+}

+ 39 - 0
src/main/java/com/sxtvs/open/api/clue/service/impl/ClueReplyServiceImpl.java

@@ -0,0 +1,39 @@
+package com.sxtvs.open.api.clue.service.impl;
+
+import com.sxtvs.open.api.clue.entity.Clue;
+import com.sxtvs.open.api.clue.entity.ClueReply;
+import com.sxtvs.open.api.clue.mapper.ClueReplyMapper;
+import com.sxtvs.open.api.clue.service.IClueReplyService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import jakarta.annotation.Resource;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author syj
+ * @since 2023-03-20
+ */
+@Service
+public class ClueReplyServiceImpl extends ServiceImpl<ClueReplyMapper, ClueReply> implements IClueReplyService {
+
+    @Resource
+    private ClueServiceImpl clueService;
+
+    @Transactional
+    public void reply(ClueReply clueReply){
+        Clue clue = clueService.getById(clueReply.getClueId());
+        clue.setReplyFlag(1);
+        clue.setReplyTime(LocalDateTime.now());
+        clueService.updateById(clue);
+        clueReply.setId(null);
+        clueReply.setReplyTime(LocalDateTime.now());
+        clueReply.setModifyTime(LocalDateTime.now());
+        save(clueReply);
+    }
+}

+ 58 - 0
src/main/java/com/sxtvs/open/api/clue/service/impl/ClueServiceImpl.java

@@ -0,0 +1,58 @@
+package com.sxtvs.open.api.clue.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.sxtvs.open.api.clue.dto.ClueDTO;
+import com.sxtvs.open.api.clue.dto.VerifyDTO;
+import com.sxtvs.open.api.clue.entity.Clue;
+import com.sxtvs.open.api.clue.mapper.ClueMapper;
+import com.sxtvs.open.api.clue.service.IClueService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.sxtvs.open.core.advice.BizException;
+import org.apache.http.util.TextUtils;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author syj
+ * @since 2023-03-20
+ */
+@Service
+public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements IClueService {
+
+    public IPage<Clue> cluePage(ClueDTO clueDTO){
+
+        LambdaQueryWrapper<Clue> wrapper = Wrappers.lambdaQuery();
+
+        return baseMapper.selectPage(new Page<>(clueDTO.getPage(), clueDTO.getSize()), wrapper.ge(clueDTO.getStart() != null, Clue::getAddTime, clueDTO.getStart())
+                .le(clueDTO.getEnd() != null, Clue::getAddTime, clueDTO.getEnd())
+                .like(!TextUtils.isEmpty(clueDTO.getTitle()), Clue::getTitle, "%" + clueDTO.getTitle() + "%")
+                .orderByDesc(Clue::getId)
+        );
+    }
+
+    public void store(Clue clue){
+        clue.setId(null);
+        clue.setAddTime(LocalDateTime.now());
+        clue.setCreateTime(LocalDateTime.now());
+        clue.setModifyTime(LocalDateTime.now());
+        save(clue);
+    }
+
+    public void verify(VerifyDTO verifyDTO){
+        Clue clue = getById(verifyDTO.getId());
+        if(clue.getStatus() != 0){
+            throw new BizException(40001, "该条数据已审核");
+        }
+        clue.setStatus(verifyDTO.getStatus());
+        updateById(clue);
+    }
+}

+ 17 - 0
src/main/java/com/sxtvs/open/core/conf/MybatisConf.java

@@ -0,0 +1,17 @@
+package com.sxtvs.open.core.conf;
+
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class MybatisConf {
+    @Bean
+    public MybatisPlusInterceptor mybatisPlusInterceptor() {
+        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
+        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
+        return interceptor;
+    }
+}

+ 71 - 1
src/test/data-service.http

@@ -64,4 +64,74 @@ Authorization: 518180cdebf3630ab4ba0e88aa75d984
 GET http://localhost/oauth/bilibili/callback?code=059d2204ec734392a62bee0d038b60d3&state=0xn_I3jPqVjpqV_mJdGPv
 
 ###
-GET http://localhost/oauth/weixin/code/v1
+GET http://localhost/oauth/weixin/code/v1
+
+
+### 聚合
+POST http://localhost/new-media/agg
+Content-Type: application/json;charset=UTF-8
+
+{
+  "platform": "B站",
+  "start": "2023-02-28",
+  "end": "2023-03-27"
+}
+
+
+### 清单
+POST http://localhost/new-media/list
+Content-Type: application/json;charset=UTF-8
+
+{
+  "platform": "微博",
+  "start": "2022-11-28",
+  "end": "2022-11-29"
+}
+
+
+### 报料列表
+POST http://localhost/clue/list
+Content-Type: application/json
+
+{
+"start": "2023-03-01",
+  "end": "2023-03-15",
+  "title": "政府"
+}
+
+### 审核
+POST http://localhost/clue/verify
+Content-Type: application/json
+
+{
+"id": 7612258,
+  "status": 1
+}
+
+### 爆料
+POST http://localhost/clue/store
+Content-Type: application/json
+
+{
+  "siteId": 3,
+  "ascription": 1,
+  "title": "哈哈哈",
+  "summary": "哈哈哈",
+  "content": "哈哈哈",
+  "source": 1,
+  "author": "17699999998",
+  "phone": "17699999998",
+  "address": "华山之巅"
+
+}
+
+
+### 回复
+POST http://localhost/clue/reply
+Content-Type: application/json
+
+{
+  "clueId": 7613888,
+  "content": "哈哈哈哈哈哈哈",
+  "userName": "鹅鹅鹅"
+}