zhanghua
2022-09-28 5a6af9762dfb9e3ed75422303a795b2bb8c21885
市平台接口
13个文件已修改
6个文件已添加
298 ■■■■■ 已修改文件
pom.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/PlatformApplication.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/caseHandler/BaseCaseController.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/caseHandler/ViolationsController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/entity/caseHandler/BaseCase.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/mapper/dict/DataDictionaryMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/remote/dto/EventAddParamDto.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/remote/dto/EventAddResponseDto.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/remote/dto/EventProcessParamDto.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/remote/dto/EventProcessResponseDto.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/remote/dto/ResultResponseDto.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/remote/service/CityPlatformService.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/service/caseHandler/IBaseCaseService.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/service/dict/IDataDictionaryService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/service/dict/impl/DataDictionaryServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/resources/application-dev.yml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/resources/application-pro.yml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/resources/mapper/dict/DataDictionaryMapper.xml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml
@@ -180,6 +180,12 @@
        <artifactId>fastjson</artifactId>
        <version>1.2.73</version>
    </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-openfeign</artifactId>
            <version>2.2.7.RELEASE</version>
        </dependency>
    </dependencies>
</project>
ycl-platform/src/main/java/com/ycl/PlatformApplication.java
@@ -3,6 +3,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
@@ -19,6 +20,7 @@
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
@EnableAsync(proxyTargetClass = true)
@EnableScheduling
@EnableFeignClients
@EnableTransactionManagement(proxyTargetClass = true)
@SpringBootApplication
public class PlatformApplication {
ycl-platform/src/main/java/com/ycl/controller/caseHandler/BaseCaseController.java
@@ -1,10 +1,16 @@
package com.ycl.controller.caseHandler;
import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ycl.api.CommonResult;
import com.ycl.controller.BaseController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ycl.entity.caseHandler.BaseCase;
import com.ycl.service.caseHandler.IBaseCaseService;
import com.ycl.vo.ViolationSettingVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
@@ -19,4 +25,21 @@
@RequestMapping("/base-case")
public class BaseCaseController extends BaseController {
    private IBaseCaseService baseCaseService;
    @Autowired
    public void setBaseCaseService(IBaseCaseService baseCaseService) {
        this.baseCaseService = baseCaseService;
    }
    @ApiOperation(value = "上传市平台")
    @PostMapping("/upload-event")
    public CommonResult uploadEvent(@RequestParam Integer caseId) {
        String msg = baseCaseService.uploadEvent(caseId);
        if (StringUtils.isEmpty(msg)) {
            return CommonResult.success(null);
        } else {
            return CommonResult.failed(msg);
        }
    }
}
ycl-platform/src/main/java/com/ycl/controller/caseHandler/ViolationsController.java
@@ -6,6 +6,7 @@
import com.ycl.controller.BaseController;
import com.ycl.entity.dict.DataDictionary;
import com.ycl.service.dict.IDataDictionaryService;
import com.ycl.vo.ViolationSettingVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,7 +38,7 @@
    public CommonResult searchIllegalBuilding(@RequestParam Integer size,
                                              @RequestParam Integer current,
                                              @RequestParam(required = false) String keyWord) {
        Page<DataDictionary> dataDictionaryPage = new Page<>();
        Page<ViolationSettingVO> dataDictionaryPage = new Page<>();
        dataDictionaryPage.setSize(size);
        dataDictionaryPage.setCurrent(current);
        return CommonResult.success(iDataDictionaryService.listViolations(dataDictionaryPage,keyWord));
ycl-platform/src/main/java/com/ycl/entity/caseHandler/BaseCase.java
@@ -130,5 +130,11 @@
    @TableField("create_time")
    private LocalDateTime createTime;
    /**
     * 市平台编码
     */
    @TableField("task_code")
    private String taskCode;
}
ycl-platform/src/main/java/com/ycl/mapper/dict/DataDictionaryMapper.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ycl.entity.dict.DataDictionary;
import com.ycl.vo.ViolationSettingVO;
/**
 * <p>
@@ -16,5 +17,5 @@
    Page<DataDictionary> listDataDictionaryPage(Page<DataDictionary> dataDictionaryPage, String keyWord);
    Page<DataDictionary> listViolationPage(Page<DataDictionary> dataDictionaryPage, String keyWord);
    Page<ViolationSettingVO> listViolationPage(Page<ViolationSettingVO> dataDictionaryPage, String keyWord);
}
ycl-platform/src/main/java/com/ycl/remote/dto/EventAddParamDto.java
New file
@@ -0,0 +1,23 @@
package com.ycl.remote.dto;
import lombok.Builder;
import lombok.Data;
/**
 * EventAddParamDto 事件上报参数
 *
 * @author: AI
 * @date:  2022-09-28 16:00
 * @version V1.0
**/
@Data
@Builder
public class EventAddParamDto {
    private String y84;
    private String x84;
    private Integer source;
    private String address;
    private String eventDesc;
    private String eventSign;
    private String medias;
}
ycl-platform/src/main/java/com/ycl/remote/dto/EventAddResponseDto.java
New file
@@ -0,0 +1,15 @@
package com.ycl.remote.dto;
import lombok.Data;
/**
 * EventAddParamDto 事件上报结果返回
 *
 * @version V1.0
 * @author: AI
 * @date: 2022-09-28 16:00
 **/
@Data
public class EventAddResponseDto {
    private String taskcode;
}
ycl-platform/src/main/java/com/ycl/remote/dto/EventProcessParamDto.java
New file
@@ -0,0 +1,18 @@
package com.ycl.remote.dto;
import lombok.Builder;
import lombok.Data;
/**
 * EventProcessParamDto 进度查询参数
 *
 * @author: AI
 * @date:  2022-09-28 16:00
 * @version V1.0
**/
@Data
@Builder
public class EventProcessParamDto {
    private String taskcode;
    private String eventSign;
}
ycl-platform/src/main/java/com/ycl/remote/dto/EventProcessResponseDto.java
New file
@@ -0,0 +1,17 @@
package com.ycl.remote.dto;
/**
 * EventProcessResponseDto 案件详情
 *
 * @version V1.0
 * @author: AI
 * @date: 2022-09-28 16:03
 **/
public class EventProcessResponseDto {
    private String taskcode;
    private String statusName;
    private String dealTime;
    private String dealMsg;
    private String[] hcczImages;
}
ycl-platform/src/main/java/com/ycl/remote/dto/ResultResponseDto.java
New file
@@ -0,0 +1,17 @@
package com.ycl.remote.dto;
import lombok.Data;
/**
 * ResultDto 返回结果
 *
 * @version V1.0
 * @author: AI
 * @date: 2022-09-28 16:00
 **/
@Data
public class ResultResponseDto<T> {
    private String msg;
    private Integer code;
    private T result;
}
ycl-platform/src/main/java/com/ycl/remote/service/CityPlatformService.java
New file
@@ -0,0 +1,41 @@
package com.ycl.remote.service;
import com.ycl.remote.dto.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * CityPlatformService 市平台对接服务
 *
 * @version V1.0
 * @author: AI
 * @date: 2022-09-28 15:40
 **/
@FeignClient(url = "http://10.53.139.176:81/api", name = "cityApi")
public interface CityPlatformService {
    /**
     * 事件上报
     *
     * @param paramDto
     * @return com.ycl.remote.dto.ResultResponseDto<com.ycl.remote.dto.EventAddResponseDto>
     * @author AI
     * @date 2022-09-28 16:12
     */
    @PostMapping("/unauthorized/external/event/add")
    ResultResponseDto<EventAddResponseDto> addEvent(EventAddParamDto paramDto);
    /**
     * 事件详情
     *
     * @param paramDto
     * @return com.ycl.remote.dto.ResultResponseDto<com.ycl.remote.dto.EventProcessResponseDto>
     * @author AI
     * @date 2022-09-28 16:12
     */
    @PostMapping("/unauthorized/external/event/process")
    ResultResponseDto<EventProcessResponseDto> getEventProcess(EventProcessParamDto paramDto);
}
ycl-platform/src/main/java/com/ycl/service/caseHandler/IBaseCaseService.java
@@ -12,5 +12,23 @@
 * @since 2022-09-24
 */
public interface IBaseCaseService extends IService<BaseCase> {
    /**
     * 上传市平台
     *
     * @param caseId
     * @return String
     * @author AI
     * @date 2022-09-28 16:52
     */
    String uploadEvent(Integer caseId);
    /**
     * 同步案件进度
     *
     * @param caseId
     * @return java.lang.String
     * @author AI
     * @date 2022-09-28 17:45
     */
    String processEvent(Integer caseId);
}
ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java
@@ -1,9 +1,17 @@
package com.ycl.service.caseHandler.impl;
import com.ycl.entity.caseHandler.BaseCase;
import com.ycl.entity.caseHandler.Violations;
import com.ycl.entity.video.VideoAlarmReport;
import com.ycl.mapper.caseHandler.BaseCaseMapper;
import com.ycl.remote.dto.*;
import com.ycl.remote.service.CityPlatformService;
import com.ycl.service.caseHandler.IBaseCaseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.service.caseHandler.IViolationsService;
import com.ycl.service.video.IVideoAlarmReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
/**
@@ -17,4 +25,66 @@
@Service
public class BaseCaseServiceImpl extends ServiceImpl<BaseCaseMapper, BaseCase> implements IBaseCaseService {
    private CityPlatformService cityPlatformService;
    private IViolationsService violationsService;
    private IVideoAlarmReportService videoAlarmReportService;
    @Value("${fdfs.fileUrl}")
    private String fileUrl;
    @Autowired
    public void setCityPlatformService(CityPlatformService cityPlatformService) {
        this.cityPlatformService = cityPlatformService;
    }
    @Autowired
    public void setViolationsService(IViolationsService violationsService) {
        this.violationsService = violationsService;
    }
    @Autowired
    public void setVideoAlarmReportService(IVideoAlarmReportService videoAlarmReportService) {
        this.videoAlarmReportService = videoAlarmReportService;
    }
    @Override
    public String uploadEvent(Integer caseId) {
        BaseCase baseCase = this.getById(caseId);
        Violations violations = violationsService.getById(caseId);
        String medias = "";
        String eventDesc = "";
        if (violations != null) {
            eventDesc = violations.getDescription();
            VideoAlarmReport videoAlarmReport = videoAlarmReportService.getById(violations.getVideoAlarmReportId());
            if (videoAlarmReport != null) {
                StringBuilder stringBuilder = new StringBuilder().append("[{'mediaURL':'").append(fileUrl).append(videoAlarmReport.getPicData()).append("'}]");
                medias = stringBuilder.toString();
            }
        }
        EventAddParamDto dto = EventAddParamDto.builder().y84(baseCase.getLatitude().toString()).x84(baseCase.getLongitude().toString())
                .source(11).address(baseCase.getSite()).eventDesc(eventDesc).eventSign(baseCase.getCode()).medias(medias).build();
        ResultResponseDto<EventAddResponseDto> result = cityPlatformService.addEvent(dto);
        if (result.getCode() == 0) {
            EventAddResponseDto responseDto = result.getResult();
            baseCase.setTaskCode(responseDto.getTaskcode());
            this.updateById(baseCase);
            return null;
        } else {
            return result.getMsg();
        }
    }
    @Override
    public String processEvent(Integer caseId) {
        BaseCase baseCase = this.getById(caseId);
        EventProcessParamDto paramDto = EventProcessParamDto.builder().eventSign(baseCase.getCode()).taskcode(baseCase.getTaskCode()).build();
        ResultResponseDto<EventProcessResponseDto> responseDto = cityPlatformService.getEventProcess(paramDto);
        if (responseDto.getCode() == 0) {
            EventProcessResponseDto eventProcessResponseDto = responseDto.getResult();
            /*********** 未处理市平台返回数据 ***************/
            return null;
        } else {
            return responseDto.getMsg();
        }
    }
}
ycl-platform/src/main/java/com/ycl/service/dict/IDataDictionaryService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ycl.entity.dict.DataDictionary;
import com.ycl.vo.ViolationSettingVO;
import java.util.List;
@@ -30,5 +31,5 @@
    Page listIllegalBuildingSettings(Page<DataDictionary> dataDictionaryPage, String keyWork);
    Page listViolations(Page<DataDictionary> dataDictionaryPage, String keyWord);
    Page listViolations(Page<ViolationSettingVO> dataDictionaryPage, String keyWord);
}
ycl-platform/src/main/java/com/ycl/service/dict/impl/DataDictionaryServiceImpl.java
@@ -11,6 +11,7 @@
import com.ycl.service.redis.RedisService;
import com.ycl.utils.common.LiveTimeMillisecond;
import com.ycl.utils.redis.RedisKey;
import com.ycl.vo.ViolationSettingVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@@ -61,8 +62,9 @@
    }
    @Override
    public Page listViolations(Page<DataDictionary> dataDictionaryPage, String keyWord) {
        Page<DataDictionary> dataDictionaryPageList = dataDictionaryMapper.listViolationPage(dataDictionaryPage,keyWord);
    public Page listViolations(Page<ViolationSettingVO> dataDictionaryPage, String keyWord) {
        dataDictionaryPage.setOptimizeCountSql(false);
        Page<ViolationSettingVO> dataDictionaryPageList = dataDictionaryMapper.listViolationPage(dataDictionaryPage,keyWord);
        return dataDictionaryPageList;
    }
}
ycl-platform/src/main/resources/application-dev.yml
@@ -7,6 +7,7 @@
    compression: true
fdfs:
  fileUrl: http://140.143.152.226:8410/
  groupName: sczhzf
  soTimeout: 1500
  connectTimeout: 600
ycl-platform/src/main/resources/application-pro.yml
@@ -7,6 +7,7 @@
    compression: true
fdfs:
  fileUrl: http://140.143.152.226:8410/
  groupName: sczhzf
  soTimeout: 1500
  connectTimeout: 600
ycl-platform/src/main/resources/mapper/dict/DataDictionaryMapper.xml
@@ -53,19 +53,24 @@
        d2.`name` AS typeFirst,
        d3.`name` AS typeSecond,
        d4.`name` AS typeThird
        FROM
        `ums_data_dictionary` AS d1
        JOIN ums_data_dictionary AS d2 ON d1.parent_id = d2.id
        JOIN ums_data_dictionary AS d3 ON d2.parent_id = d3.id
        JOIN ums_data_dictionary AS d4 ON d3.parent_id = d4.id
        FROM `ums_data_dictionary` AS d1
        LEFT JOIN ums_data_dictionary AS d2 ON d1.id = d2.parent_id
        LEFT JOIN ums_data_dictionary AS d3 ON d2.id = d3.parent_id
        LEFT JOIN ums_data_dictionary AS d4 ON d3.id = d4.parent_id
        <where>
            d1.`level` = '4'
            d1.parent_id = 0
            AND d1.type_code = '01'
            <if test="keyWord !=null and keyWord !=''">
                AND d1.`name` LIKE  '%${keyWord}%'
                AND (d1.`name` LIKE  '%${keyWord}%'
                or d2.`name` LIKE  '%${keyWord}%'
                or d3.`name` LIKE  '%${keyWord}%'
                or d4.`name` LIKE  '%${keyWord}%'
                )
            </if>
        </where>
        ORDER BY d1.parent_id,d2.parent_id,d3.parent_id,d4.parent_id
    </select>
</mapper>