Merge branch 'branch_refactor' into branch_burning

# Conflicts:
#	src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java
This commit is contained in:
liuchengqian 2023-01-31 14:50:43 +08:00
commit 095f1b259f
24 changed files with 13 additions and 1513 deletions

View File

@ -4,17 +4,11 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.List;
/**
* @author XinYi Song
*/
@SpringBootApplication @SpringBootApplication
public class FirePointApplication { public class FirePointApplication {
@ -29,5 +23,5 @@ public class FirePointApplication {
restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
return restTemplate; return restTemplate;
} }
//
} }

View File

@ -1,36 +0,0 @@
package com.xkrs.common;
import com.xkrs.model.qo.SettingQo;
import com.xkrs.service.SettingService;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
/**
* 火点审核开关计划任务
*/
@Configuration
@EnableScheduling
public class StaticScheduleTask {
@Resource
private SettingService settingService;
//早上八点打开火点审核开关
@Scheduled(cron = "0 0 8 * * ?")
private void openVerifySwitch() {
SettingQo settingQo = new SettingQo();
settingQo.setSwitchState("1");
settingService.updateSwitchState(settingQo);
}
// //晚上十点关闭火点审核开关
// @Scheduled(cron = "0 0 22 * * ?")
// private void closeVerifySwitch() {
// SettingQo settingQo = new SettingQo();
// settingQo.setSwitchState("0");
// settingService.updateSwitchState(settingQo);
// }
}

View File

@ -21,10 +21,6 @@ import java.util.Map;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
import static com.xkrs.utils.FileUtil.getUploadInfo; import static com.xkrs.utils.FileUtil.getUploadInfo;
/**
* @author XinYi Song
* 文件上传
*/
@RestController @RestController
public class FileController { public class FileController {
@ -36,20 +32,20 @@ public class FileController {
/** /**
* 上传多张图片 * 上传多张图片
*
* @param files * @param files
* @return * @return
*/ */
@PostMapping("/uploadFileMore") @PostMapping("/uploadFileMore")
public String uploadFileMore(MultipartFile[] files) throws Exception { public String uploadFileMore(MultipartFile[] files) throws Exception {
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
if (null == files || files.length == 0){ if (null == files || files.length == 0) {
return outputEncapsulationObject(PromptMessageEnum.PARAM_NULL, "result or fileType is null", locale); return outputEncapsulationObject(PromptMessageEnum.PARAM_NULL, "result or fileType is null", locale);
} }
List list = new ArrayList(); List list = new ArrayList();
for (MultipartFile file : for (MultipartFile file : files) {
files) {
boolean m = FileUtil.checkFileSize(file.getSize(), 100, "M"); boolean m = FileUtil.checkFileSize(file.getSize(), 100, "M");
if(m == false){ if (m == false) {
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "图片大小不能超过100M", locale); return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "图片大小不能超过100M", locale);
} }
File file1 = fileFastDfs.multipartFileToFile(file); File file1 = fileFastDfs.multipartFileToFile(file);
@ -72,17 +68,18 @@ public class FileController {
/** /**
* 上传单张图片 * 上传单张图片
*
* @param file * @param file
* @return * @return
*/ */
@PostMapping("/uploadFile") @PostMapping("/uploadFile")
public String uploadFile(MultipartFile file) throws Exception { public String uploadFile(MultipartFile file) throws Exception {
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
if (null == file){ if (null == file) {
return outputEncapsulationObject(PromptMessageEnum.PARAM_NULL, "result or fileType is null", locale); return outputEncapsulationObject(PromptMessageEnum.PARAM_NULL, "result or fileType is null", locale);
} }
boolean m = FileUtil.checkFileSize(file.getSize(), 100, "M"); boolean m = FileUtil.checkFileSize(file.getSize(), 100, "M");
if(m == false){ if (m == false) {
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "图片大小不能超过100M", locale); return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "图片大小不能超过100M", locale);
} }
File file1 = fileFastDfs.multipartFileToFile(file); File file1 = fileFastDfs.multipartFileToFile(file);
@ -104,13 +101,14 @@ public class FileController {
/** /**
* 查询火点图片路径 * 查询火点图片路径
*
* @return * @return
*/ */
@GetMapping("/findPath") @GetMapping("/findPath")
public String findPath(){ public String findPath() {
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
List<Map<String, String>> path = filePathDao.findPath(); List<Map<String, String>> path = filePathDao.findPath();
if(path == null || path.size() == 0){ if (path == null || path.size() == 0) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "还未上传任何图片信息!", locale); return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "还未上传任何图片信息!", locale);
} }
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, path, locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, path, locale);

View File

@ -3,14 +3,11 @@ package com.xkrs.controller;
import com.xkrs.common.encapsulation.PromptMessageEnum; import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.common.tool.TokenUtil; import com.xkrs.common.tool.TokenUtil;
import com.xkrs.dao.FirePointDao; import com.xkrs.dao.FirePointDao;
import com.xkrs.dao.ShanDongFirePointDao;
import com.xkrs.dao.SysUserDao; import com.xkrs.dao.SysUserDao;
import com.xkrs.model.entity.FirePointEntity; import com.xkrs.model.entity.FirePointEntity;
import com.xkrs.model.entity.ShanDongFirePointEntity;
import com.xkrs.model.entity.SysUserEntity; import com.xkrs.model.entity.SysUserEntity;
import com.xkrs.model.qo.AuditFireTypeQo; import com.xkrs.model.qo.AuditFireTypeQo;
import com.xkrs.model.qo.FirePointQo; import com.xkrs.model.qo.FirePointQo;
import com.xkrs.model.qo.ShanDongFirePointVerifyStateQo;
import com.xkrs.service.FirePointService; import com.xkrs.service.FirePointService;
import com.xkrs.service.StreetService; import com.xkrs.service.StreetService;
import com.xkrs.service.impl.FirePointServiceImpl; import com.xkrs.service.impl.FirePointServiceImpl;
@ -19,12 +16,9 @@ import org.apache.hc.core5.util.TextUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.persistence.criteria.Predicate;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.transaction.Transactional; import javax.transaction.Transactional;
@ -51,9 +45,6 @@ public class FirePointController {
@Resource @Resource
private FirePointDao firePointDao; private FirePointDao firePointDao;
@Resource
private ShanDongFirePointDao shanDongFirePointDao;
@Resource @Resource
private StreetService streetService; private StreetService streetService;
@ -98,32 +89,6 @@ public class FirePointController {
} }
} }
/**
* 查询山东临时火点表
*
* @return
*/
@GetMapping("/queryshandongfirepointlist")
public String queryShanDongFirePointList() {
List<ShanDongFirePointEntity> shanDongFirePointList = shanDongFirePointDao.findAll(Sort.by(Sort.Direction.DESC, "satelliteTime"));
if (shanDongFirePointList.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有火点数据", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, shanDongFirePointList, locale);
}
/**
* 将山东临时火点表中的火点根据火点编号更新审核状态
* 操作1如果verifyState==1将火点编号对应的火点从山东火点表转存到火点表
* 操作2将山东火点表中的这个火点的审核状态更新
*/
@PostMapping("/updateverifystatebyfirecode")
public String updateVerifyStateByFireCode(@RequestBody ShanDongFirePointVerifyStateQo shanDongFirePointVerifyStateQo) {
String fireCode = shanDongFirePointVerifyStateQo.getFireCode();
String verifyState = shanDongFirePointVerifyStateQo.getVerifyState();
return firePointService.updateVerifyStateByFireCode(fireCode, verifyState);
}
/** /**
* 在全国火点表中根据火点编码修改审核火点状态 * 在全国火点表中根据火点编码修改审核火点状态
*/ */
@ -140,26 +105,6 @@ public class FirePointController {
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale);
} }
@GetMapping("/queryshandongfirepointbytime")
public String queryShanDongFirePointByTime(@RequestParam(required = false, value = "startTime") String startTime, @RequestParam(required = false, value = "endTime") String endTime) {
Specification<ShanDongFirePointEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
List<Predicate> list = new ArrayList<>();
if (startTime != null && !"".equals(startTime)) {
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime));
}
if (endTime != null && !"".equals(endTime)) {
list.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), endTime));
}
Predicate[] predicates = new Predicate[list.size()];
return criteriaBuilder.and(list.toArray(predicates));
};
List<ShanDongFirePointEntity> shanDongFirePointList = shanDongFirePointDao.findAll(specification, Sort.by(Sort.Direction.DESC, "satelliteTime"));
if (shanDongFirePointList.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有火点数据", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, shanDongFirePointList, locale);
}
@RequestMapping(value = "/download/vipuserfirepoint", method = RequestMethod.GET) @RequestMapping(value = "/download/vipuserfirepoint", method = RequestMethod.GET)
public String downloadVipUserFirePoint(HttpServletResponse response, HttpServletRequest request) { public String downloadVipUserFirePoint(HttpServletResponse response, HttpServletRequest request) {
return firePointService.downloadVipUserFilePoint(request, response); return firePointService.downloadVipUserFilePoint(request, response);

View File

@ -1,37 +0,0 @@
package com.xkrs.controller;
import com.xkrs.model.qo.SettingQo;
import com.xkrs.service.SettingService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 设置审核开关状态
*/
@RestController
public class SettingController {
@Resource
private SettingService settingService;
/**
* 更新审核开关状态
*/
@PostMapping("/updateswitchstate")
public String updateSwitchState(@RequestBody SettingQo settingQo) {
return settingService.updateSwitchState(settingQo);
}
/**
* 查询审核开关状态
*/
@GetMapping("/queryswitchstate")
public String querySwitchState() {
return settingService.querySwitchState();
}
}

View File

@ -1,20 +0,0 @@
package com.xkrs.dao;
import com.xkrs.model.entity.SettingEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;
/**
* @author xkrs
*/
@Component
public interface SettingDao extends JpaRepository<SettingEntity, Long>, JpaSpecificationExecutor<SettingEntity> {
@Modifying(clearAutomatically = true)
@Query(value = "UPDATE setting SET switch_state = ?2 where id = ?1", nativeQuery = true)
void updateSwitchStateById(Long id, String switchState);
}

View File

@ -1,33 +0,0 @@
package com.xkrs.dao;
import com.xkrs.model.entity.ShanDongFirePointEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public interface ShanDongFirePointDao extends JpaRepository<ShanDongFirePointEntity, Long>, JpaSpecificationExecutor<ShanDongFirePointEntity> {
/**
* 根据火点编码查询火点信息
*
* @param fireCode
* @return
*/
ShanDongFirePointEntity findByFireCode(String fireCode);
@Query(value = "SELECT * FROM fire_point_shandong WHERE longitude = ?1 AND latitude = ?2 AND street_code = ?3 AND satellite_time = ?4 AND satellite_type = ?5 AND land_type = ?6", nativeQuery = true)
List<ShanDongFirePointEntity> findDuplicatedData(double longitude, double latitude, String streetCode, String satelliteTime, String satelliteType, String landType);
/**
* 在山东临时火点表中根据火点编码修改审核状态
*/
@Modifying(clearAutomatically = true)
@Query(value = "UPDATE fire_point_shandong SET verify_state = ?2 WHERE fire_code = ?1", nativeQuery = true)
void updateVerifyStateByFireCode(String fireCode, String verifyState);
}

View File

@ -1,151 +0,0 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* 护林员和火点中间表
* @author xkrs
*/
@Entity
@Table(name="fire_and_ranger")
public class FireAndRanger {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "fire_and_ranger_seq_gen")
@SequenceGenerator(name = "fire_and_ranger_seq_gen", sequenceName = "fire_and_ranger_id_seq",allocationSize = 1)
private Integer id;
/**
* 护林员的账号手机号作为和火点的标识
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String rangerName;
/**
* 火点编码
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String fireCode;
/**
* 处理人
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String handler;
/**
* 核查人
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String verifier;
/**
* 处理时间(核查时间)
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String handlerTime;
/**
* 结束时间
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String endTime;
@Column(length = 32, columnDefinition = "varchar(32)")
private String progressType;
public FireAndRanger() {
}
public FireAndRanger(Integer id, String rangerName, String fireCode, String handler, String verifier, String handlerTime, String endTime, String progressType) {
this.id = id;
this.rangerName = rangerName;
this.fireCode = fireCode;
this.handler = handler;
this.verifier = verifier;
this.handlerTime = handlerTime;
this.endTime = endTime;
this.progressType = progressType;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getRangerName() {
return rangerName;
}
public void setRangerName(String rangerName) {
this.rangerName = rangerName;
}
public String getFireCode() {
return fireCode;
}
public void setFireCode(String fireCode) {
this.fireCode = fireCode;
}
public String getHandler() {
return handler;
}
public void setHandler(String handler) {
this.handler = handler;
}
public String getVerifier() {
return verifier;
}
public void setVerifier(String verifier) {
this.verifier = verifier;
}
public String getHandlerTime() {
return handlerTime;
}
public void setHandlerTime(String handlerTime) {
this.handlerTime = handlerTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getProgressType() {
return progressType;
}
public void setProgressType(String progressType) {
this.progressType = progressType;
}
@Override
public String toString() {
return "FireAndRanger{" +
"id=" + id +
", rangerName='" + rangerName + '\'' +
", fireCode='" + fireCode + '\'' +
", handler='" + handler + '\'' +
", verifier='" + verifier + '\'' +
", handlerTime='" + handlerTime + '\'' +
", endTime='" + endTime + '\'' +
", progressType='" + progressType + '\'' +
'}';
}
}

View File

@ -1,288 +0,0 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* @author XinYi Song
*/
@Entity
@Table(name="fire")
public class FirePoint {
/**
* 指定主键建立自增序列主键值取自序列
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "fire_seq_gen")
@SequenceGenerator(name = "fire_seq_gen", sequenceName = "fire_id_seq",allocationSize = 1)
private Integer id;
/**
* 火点编码
*/
@Column( length = 32,unique = true,columnDefinition = "varchar(32)")
private String fireCode;
/**
* 经度
*/
private double longitude;
/**
* 纬度
*/
private double latitude;
/**
* 省市区的编码
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String countyCode;
/**
* 省市区的名称
*/
@Column( columnDefinition = "varchar(64)")
private String countyName;
/**
* 卫星监测的时间
*/
private String satelliteTime;
/**
* 卫星的类型
*/
@Column( columnDefinition = "varchar(64)")
private String satelliteType;
/**
* 植被类型
*/
@Column( columnDefinition = "varchar(64)")
private String landType;
/**
* 添加的时间
*/
private String addTime;
/**
* 置信度
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String confidence;
/**
* 详细地址
*/
private String firePointAddress;
/**
* 火点状态 0 发现 1预警 2核查 -1,3结案
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String fireType;
/**
* 当前火点的图片
*/
private String fireImage;
/**
* 卫星影像图片
*/
private String satelliteImage;
/**
* 火点前的图片
*/
private String beforeFireImage;
/**
* 火点后的图片
*/
private String afterFireImage;
public FirePoint() {
}
public FirePoint(Integer id, String fireCode, double longitude, double latitude, String countyCode, String countyName, String satelliteTime, String satelliteType, String landType, String addTime, String confidence, String firePointAddress, String fireType, String fireImage, String satelliteImage, String beforeFireImage, String afterFireImage) {
this.id = id;
this.fireCode = fireCode;
this.longitude = longitude;
this.latitude = latitude;
this.countyCode = countyCode;
this.countyName = countyName;
this.satelliteTime = satelliteTime;
this.satelliteType = satelliteType;
this.landType = landType;
this.addTime = addTime;
this.confidence = confidence;
this.firePointAddress = firePointAddress;
this.fireType = fireType;
this.fireImage = fireImage;
this.satelliteImage = satelliteImage;
this.beforeFireImage = beforeFireImage;
this.afterFireImage = afterFireImage;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFireCode() {
return fireCode;
}
public void setFireCode(String fireCode) {
this.fireCode = fireCode;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public String getCountyCode() {
return countyCode;
}
public void setCountyCode(String countyCode) {
this.countyCode = countyCode;
}
public String getCountyName() {
return countyName;
}
public void setCountyName(String countyName) {
this.countyName = countyName;
}
public String getSatelliteTime() {
return satelliteTime;
}
public void setSatelliteTime(String satelliteTime) {
this.satelliteTime = satelliteTime;
}
public String getSatelliteType() {
return satelliteType;
}
public void setSatelliteType(String satelliteType) {
this.satelliteType = satelliteType;
}
public String getLandType() {
return landType;
}
public void setLandType(String landType) {
this.landType = landType;
}
public String getAddTime() {
return addTime;
}
public void setAddTime(String addTime) {
this.addTime = addTime;
}
public String getConfidence() {
return confidence;
}
public void setConfidence(String confidence) {
this.confidence = confidence;
}
public String getFirePointAddress() {
return firePointAddress;
}
public void setFirePointAddress(String firePointAddress) {
this.firePointAddress = firePointAddress;
}
public String getFireType() {
return fireType;
}
public void setFireType(String fireType) {
this.fireType = fireType;
}
public String getFireImage() {
return fireImage;
}
public void setFireImage(String fireImage) {
this.fireImage = fireImage;
}
public String getSatelliteImage() {
return satelliteImage;
}
public void setSatelliteImage(String satelliteImage) {
this.satelliteImage = satelliteImage;
}
public String getBeforeFireImage() {
return beforeFireImage;
}
public void setBeforeFireImage(String beforeFireImage) {
this.beforeFireImage = beforeFireImage;
}
public String getAfterFireImage() {
return afterFireImage;
}
public void setAfterFireImage(String afterFireImage) {
this.afterFireImage = afterFireImage;
}
@Override
public String toString() {
return "FirePoint{" +
"id=" + id +
", fireCode='" + fireCode + '\'' +
", longitude=" + longitude +
", latitude=" + latitude +
", countyCode='" + countyCode + '\'' +
", countyName='" + countyName + '\'' +
", satelliteTime='" + satelliteTime + '\'' +
", satelliteType='" + satelliteType + '\'' +
", landType='" + landType + '\'' +
", addTime='" + addTime + '\'' +
", confidence='" + confidence + '\'' +
", firePointAddress='" + firePointAddress + '\'' +
", fireType='" + fireType + '\'' +
", fireImage='" + fireImage + '\'' +
", satelliteImage='" + satelliteImage + '\'' +
", beforeFireImage='" + beforeFireImage + '\'' +
", afterFireImage='" + afterFireImage + '\'' +
'}';
}
}

View File

@ -1,91 +0,0 @@
package com.xkrs.model.entity;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author xkrs
* 任务表
*/
@Entity
@Table(name = "fire_task")
public class FireTask implements Serializable {
/**
* id 主键
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "fire_task_seq_gen")
@SequenceGenerator(name = "fire_task_seq_gen", sequenceName = "fire_task_id_seq",allocationSize = 1)
private Integer id;
/**
* 火点编码
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String taskFireCode;
/**
* 任务描述
*/
@Column(length = 2000, columnDefinition = "varchar(2000)")
private String taskInformation;
/**
* 提交任务的时间
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String taskTime;
public FireTask() {
}
public FireTask(Integer id, String taskFireCode, String taskInformation, String taskTime) {
this.id = id;
this.taskFireCode = taskFireCode;
this.taskInformation = taskInformation;
this.taskTime = taskTime;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTaskFireCode() {
return taskFireCode;
}
public void setTaskFireCode(String taskFireCode) {
this.taskFireCode = taskFireCode;
}
public String getTaskInformation() {
return taskInformation;
}
public void setTaskInformation(String taskInformation) {
this.taskInformation = taskInformation;
}
public String getTaskTime() {
return taskTime;
}
public void setTaskTime(String taskTime) {
this.taskTime = taskTime;
}
@Override
public String toString() {
return "FireTask{" +
"id=" + id +
", taskFireCode='" + taskFireCode + '\'' +
", taskInformation='" + taskInformation + '\'' +
", taskTime='" + taskTime + '\'' +
'}';
}
}

View File

@ -1,74 +0,0 @@
package com.xkrs.model.entity;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author xkrs
* 任务和图片中间表
*/
@Entity
@Table(name = "fire_task_photo")
public class FireTaskPhoto implements Serializable {
/**
* id 主键
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY, generator = "fire_task_photo_seq_gen")
@SequenceGenerator(name = "fire_task_photo_seq_gen", sequenceName = "fire_task_photo_id_seq",allocationSize = 1)
private Integer id;
/**
* 火点编码
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String photoFireCode;
/**
* 任务图片链接
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String taskPhoto;
public FireTaskPhoto() {
}
public FireTaskPhoto(Integer id, String photoFireCode, String taskPhoto) {
this.id = id;
this.photoFireCode = photoFireCode;
this.taskPhoto = taskPhoto;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPhotoFireCode() {
return photoFireCode;
}
public void setPhotoFireCode(String photoFireCode) {
this.photoFireCode = photoFireCode;
}
public String getTaskPhoto() {
return taskPhoto;
}
public void setTaskPhoto(String taskPhoto) {
this.taskPhoto = taskPhoto;
}
@Override
public String toString() {
return "FireTaskPhoto{" +
"id=" + id +
", photoFireCode='" + photoFireCode + '\'' +
", taskPhoto='" + taskPhoto + '\'' +
'}';
}
}

View File

@ -1,155 +0,0 @@
package com.xkrs.model.entity;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author xkrs
* 护林员信息
*/
@Entity
@Table(name = "forest_ranger")
public class ForestRanger implements Serializable {
/**
* 主键
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "forest_ranger_seq_gen")
@SequenceGenerator(name = "forest_ranger_seq_gen", sequenceName = "forest_ranger_id_seq",allocationSize = 1)
private Integer id;
/**
* 护林员的姓名
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String rangerName;
/**
* 护林员的电话
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String rangerPhone;
/**
* 纬度
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String rangerLatitude;
/**
* 经度
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String rangerLongitude;
/**
* 护林员所在市区县
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String rangerCountyName;
/**
* 市区县的编码
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String rangerCountyCode;
/**
* 护林员的状态0空闲 1正在执行任务
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String rangerType;
public ForestRanger() {
}
public ForestRanger(Integer id, String rangerName, String rangerPhone, String rangerLatitude, String rangerLongitude, String rangerCountyName, String rangerCountyCode, String rangerType) {
this.id = id;
this.rangerName = rangerName;
this.rangerPhone = rangerPhone;
this.rangerLatitude = rangerLatitude;
this.rangerLongitude = rangerLongitude;
this.rangerCountyName = rangerCountyName;
this.rangerCountyCode = rangerCountyCode;
this.rangerType = rangerType;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getRangerName() {
return rangerName;
}
public void setRangerName(String rangerName) {
this.rangerName = rangerName;
}
public String getRangerPhone() {
return rangerPhone;
}
public void setRangerPhone(String rangerPhone) {
this.rangerPhone = rangerPhone;
}
public String getRangerLatitude() {
return rangerLatitude;
}
public void setRangerLatitude(String rangerLatitude) {
this.rangerLatitude = rangerLatitude;
}
public String getRangerLongitude() {
return rangerLongitude;
}
public void setRangerLongitude(String rangerLongitude) {
this.rangerLongitude = rangerLongitude;
}
public String getRangerCountyName() {
return rangerCountyName;
}
public void setRangerCountyName(String rangerCountyName) {
this.rangerCountyName = rangerCountyName;
}
public String getRangerCountyCode() {
return rangerCountyCode;
}
public void setRangerCountyCode(String rangerCountyCode) {
this.rangerCountyCode = rangerCountyCode;
}
public String getRangerType() {
return rangerType;
}
public void setRangerType(String rangerType) {
this.rangerType = rangerType;
}
@Override
public String toString() {
return "XkRsForestRanger{" +
"id=" + id +
", rangerName='" + rangerName + '\'' +
", rangerPhone='" + rangerPhone + '\'' +
", rangerLatitude='" + rangerLatitude + '\'' +
", rangerLongitude='" + rangerLongitude + '\'' +
", rangerCountyName='" + rangerCountyName + '\'' +
", rangerCountyCode='" + rangerCountyCode + '\'' +
", rangerType='" + rangerType + '\'' +
'}';
}
}

View File

@ -1,50 +0,0 @@
package com.xkrs.model.entity;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author xkrs
*/
@Entity
@Table(name = "setting")
public class SettingEntity implements Serializable {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "setting_seq_gen")
@SequenceGenerator(name = "setting_seq_gen", sequenceName = "setting_id_seq", allocationSize = 1)
private Long id;
/**
* 01
*/
@Column(length = 64, columnDefinition = "varchar(64)")
private String switchState;
public SettingEntity() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getSwitchState() {
return switchState;
}
public void setSwitchState(String switchState) {
this.switchState = switchState;
}
@Override
public String toString() {
return "SettingEntity{" + "id=" + id + ", switchState='" + switchState + '\'' + '}';
}
}

View File

@ -1,292 +0,0 @@
package com.xkrs.model.entity;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author XinYi Song
*/
@Entity
@Table(name = "fire_point_shandong")
public class ShanDongFirePointEntity implements Serializable {
/**
* 指定主键建立自增序列主键值取自序列
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "fire_point_shandong_seq_gen")
@SequenceGenerator(name = "fire_point_shandong_seq_gen", sequenceName = "fire_point_shandong_id_seq", allocationSize = 1)
private Integer id;
/**
* 火点编码
*/
@Column(length = 32, unique = true, columnDefinition = "varchar(32)")
private String fireCode;
/**
* 经度
*/
private double longitude;
/**
* 纬度
*/
private double latitude;
/**
* 省市区的编码
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String countyCode;
/**
* 省市区的名称
*/
@Column(columnDefinition = "varchar(64)")
private String countyName;
/**
* 卫星监测的时间
*/
private String satelliteTime;
/**
* 卫星的类型
*/
@Column(columnDefinition = "varchar(64)")
private String satelliteType;
/**
* 植被类型
*/
@Column(columnDefinition = "varchar(64)")
private String landType;
/**
* 添加的时间
*/
private String addTime;
/**
* 置信度
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String confidence;
/**
* 详细地址
*/
private String firePointAddress;
/**
* 火点状态 0 发现 1预警 2核查 -1,3结案
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String fireType;
/**
* 当前火点的图片
*/
private String fireImage;
/**
* 卫星影像图片
*/
private String satelliteImage;
/**
* 火点前的图片
*/
private String beforeFireImage;
/**
* 火点后的图片
*/
private String afterFireImage;
/**
* 街道编码
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String streetCode;
@Column(length = 65, columnDefinition = "varchar(85)")
private String streetName;
/**
* 0未审核
* 1审核通过
* 2审核不通过
*/
@Column(length = 65, columnDefinition = "varchar(85)")
private String verifyState;
public ShanDongFirePointEntity() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFireCode() {
return fireCode;
}
public void setFireCode(String fireCode) {
this.fireCode = fireCode;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public String getCountyCode() {
return countyCode;
}
public void setCountyCode(String countyCode) {
this.countyCode = countyCode;
}
public String getCountyName() {
return countyName;
}
public void setCountyName(String countyName) {
this.countyName = countyName;
}
public String getSatelliteTime() {
return satelliteTime;
}
public void setSatelliteTime(String satelliteTime) {
this.satelliteTime = satelliteTime;
}
public String getSatelliteType() {
return satelliteType;
}
public void setSatelliteType(String satelliteType) {
this.satelliteType = satelliteType;
}
public String getLandType() {
return landType;
}
public void setLandType(String landType) {
this.landType = landType;
}
public String getAddTime() {
return addTime;
}
public void setAddTime(String addTime) {
this.addTime = addTime;
}
public String getConfidence() {
return confidence;
}
public void setConfidence(String confidence) {
this.confidence = confidence;
}
public String getFirePointAddress() {
return firePointAddress;
}
public void setFirePointAddress(String firePointAddress) {
this.firePointAddress = firePointAddress;
}
public String getFireType() {
return fireType;
}
public void setFireType(String fireType) {
this.fireType = fireType;
}
public String getFireImage() {
return fireImage;
}
public void setFireImage(String fireImage) {
this.fireImage = fireImage;
}
public String getSatelliteImage() {
return satelliteImage;
}
public void setSatelliteImage(String satelliteImage) {
this.satelliteImage = satelliteImage;
}
public String getBeforeFireImage() {
return beforeFireImage;
}
public void setBeforeFireImage(String beforeFireImage) {
this.beforeFireImage = beforeFireImage;
}
public String getAfterFireImage() {
return afterFireImage;
}
public void setAfterFireImage(String afterFireImage) {
this.afterFireImage = afterFireImage;
}
public String getStreetCode() {
return streetCode;
}
public void setStreetCode(String streetCode) {
this.streetCode = streetCode;
}
public String getStreetName() {
return streetName;
}
public void setStreetName(String streetName) {
this.streetName = streetName;
}
public String getVerifyState() {
return verifyState;
}
public void setVerifyState(String verifyState) {
this.verifyState = verifyState;
}
@Override
public String toString() {
return "ShanDongFirePointEntity{" + "id=" + id + ", fireCode='" + fireCode + '\'' + ", longitude=" + longitude + ", latitude=" + latitude + ", countyCode='" + countyCode + '\'' + ", countyName='" + countyName + '\'' + ", satelliteTime='" + satelliteTime + '\'' + ", satelliteType='" + satelliteType + '\'' + ", landType='" + landType + '\'' + ", addTime='" + addTime + '\'' + ", confidence='" + confidence + '\'' + ", firePointAddress='" + firePointAddress + '\'' + ", fireType='" + fireType + '\'' + ", fireImage='" + fireImage + '\'' + ", satelliteImage='" + satelliteImage + '\'' + ", beforeFireImage='" + beforeFireImage + '\'' + ", afterFireImage='" + afterFireImage + '\'' + ", streetCode='" + streetCode + '\'' + ", streetName='" + streetName + '\'' + ", verifyState='" + verifyState + '\'' + '}';
}
}

View File

@ -1,27 +0,0 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.SettingQoUpdate;
import javax.validation.constraints.NotNull;
public class SettingQo {
@NotNull(message = "{Setting.switchState.blank}", groups = {SettingQoUpdate.class})
private String switchState;
public SettingQo() {
}
public String getSwitchState() {
return switchState;
}
public void setSwitchState(String switchState) {
this.switchState = switchState;
}
@Override
public String toString() {
return "SettingQo{" + "switchState='" + switchState + '\'' + '}';
}
}

View File

@ -1,38 +0,0 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.ShanDongFirePointVerifyStateQoUpdate;
import javax.validation.constraints.NotNull;
public class ShanDongFirePointVerifyStateQo {
@NotNull(message = "{FirePoint.fireCode.blank}", groups = {ShanDongFirePointVerifyStateQoUpdate.class})
private String fireCode;
@NotNull(message = "{FirePoint.verifyState.blank}", groups = {ShanDongFirePointVerifyStateQoUpdate.class})
private String verifyState;
public ShanDongFirePointVerifyStateQo() {
}
public String getFireCode() {
return fireCode;
}
public void setFireCode(String fireCode) {
this.fireCode = fireCode;
}
public String getVerifyState() {
return verifyState;
}
public void setVerifyState(String verifyState) {
this.verifyState = verifyState;
}
@Override
public String toString() {
return "ShanDongFirePointVerifyStateQo{" + "fireCode='" + fireCode + '\'' + ", verifyState='" + verifyState + '\'' + '}';
}
}

View File

@ -9,11 +9,6 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
/**
* SysUserQo
*
* @author tajochen
*/
public class SysUserQo { public class SysUserQo {
@NotNull(message = "{SysUser.id.blank}", groups = {SysUserQoUpdate.class}) @NotNull(message = "{SysUser.id.blank}", groups = {SysUserQoUpdate.class})

View File

@ -1,4 +0,0 @@
package com.xkrs.model.validation;
public interface SettingQoUpdate {
}

View File

@ -1,4 +0,0 @@
package com.xkrs.model.validation;
public interface ShanDongFirePointVerifyStateQoUpdate {
}

View File

@ -63,13 +63,6 @@ public interface FirePointService {
*/ */
String selectFirePointNumWeek(); String selectFirePointNumWeek();
/**
* 根据火点编号更新审核状态
* 操作1将火点编号对应的火点从山东火点表转存到火点表
* 操作2将山东火点表中的这个火点的审核状态更新
*/
String updateVerifyStateByFireCode(String fireCode, String verifyState);
/** /**
* download vip user's fire point * download vip user's fire point
* *

View File

@ -1,18 +0,0 @@
package com.xkrs.service;
import com.xkrs.model.qo.SettingQo;
import org.springframework.web.bind.annotation.RequestBody;
public interface SettingService {
/**
* 更新审核开关状态
*/
String updateSwitchState(@RequestBody SettingQo settingQo);
/**
* 查询审核开关状态
*/
String querySwitchState();
}

View File

@ -22,7 +22,6 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.transaction.Transactional;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -50,12 +49,6 @@ public class FirePointServiceImpl implements FirePointService {
@Resource @Resource
private FirePointDao firePointDao; private FirePointDao firePointDao;
@Resource
private SettingDao settingDao;
@Resource
private ShanDongFirePointDao shanDongFirePointDao;
@Resource @Resource
private SysUserDao sysUserDao; private SysUserDao sysUserDao;
@ -203,47 +196,6 @@ public class FirePointServiceImpl implements FirePointService {
firePointEntity.setStreetName(addressComponent.getTownship()); firePointEntity.setStreetName(addressComponent.getTownship());
} }
/**
* 根据火点编号更新审核状态
* 操作1将火点编号对应的火点从山东火点表转存到火点表
* 操作2将山东火点表中的这个火点的审核状态更新
*/
@Transactional(rollbackOn = Exception.class)
@Override
public String updateVerifyStateByFireCode(String fireCode, String verifyState) {
if ((!"0".equals(verifyState)) && (!"1".equals(verifyState)) && (!"2".equals(verifyState))) {
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL, "审核失败,审核状态参数错误", locale);
}
ShanDongFirePointEntity existShanDongFirePoint = shanDongFirePointDao.findByFireCode(fireCode);
//山东火点表找不到这个火点返回失败
if (existShanDongFirePoint == null) {
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "审核失败,没有指定的火点编号", locale);
}
if ("0".equals(existShanDongFirePoint.getVerifyState()) || "2".equals(existShanDongFirePoint.getVerifyState())) {
if ("0".equals(verifyState)) {
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "审核失败,审核状态不能被设置为未审核", locale);
}
if ("1".equals(verifyState)) {
//火点表能找到这个火点返回失败
FirePointEntity existFirePoint = firePointDao.findByFireCode(fireCode);
if (existFirePoint != null) {
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "修改失败,火点库已存在指定的火点编号", locale);
}
//操作1将火点编号对应的火点从山东火点表转存到火点表
FirePointEntity firePoint = getFirePointByShanDongFirePoint(existShanDongFirePoint);
log.info("-------转存新火点");
firePointDao.save(firePoint);
//发送消息通知
sendBroadcast(firePoint);
}
//操作2将山东火点表中的这个火点的审核状态更新
shanDongFirePointDao.updateVerifyStateByFireCode(fireCode, verifyState);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale);
}
//0或者2可以被审核为1未审核和未通过可以被审核为通过已经通过了的就不能再处理了
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "审核失败,火点不能被重复审核", locale);
}
private void sendBroadcast(FirePointEntity firePointEntity) { private void sendBroadcast(FirePointEntity firePointEntity) {
//发送微信群聊消息 //发送微信群聊消息
sendWeChatGroupMessage(firePointEntity); sendWeChatGroupMessage(firePointEntity);

View File

@ -1,61 +0,0 @@
package com.xkrs.service.impl;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.dao.SettingDao;
import com.xkrs.model.entity.SettingEntity;
import com.xkrs.model.qo.SettingQo;
import com.xkrs.service.SettingService;
import org.apache.http.util.TextUtils;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.util.List;
import java.util.Locale;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@Service
public class SettingServiceImpl implements SettingService {
@Resource
private SettingDao settingDao;
/**
* 更新审核开关状态
*/
@Transactional(rollbackOn = Exception.class)
@Override
public String updateSwitchState(SettingQo settingQo) {
Locale locale = LocaleContextHolder.getLocale();
if (TextUtils.isEmpty(settingQo.getSwitchState())) {
return outputEncapsulationObject(PromptMessageEnum.PARAM_NULL, "switchState参数不能为空", locale);
}
List<SettingEntity> settingEntityList = settingDao.findAll();
if (settingEntityList.isEmpty()) {
SettingEntity settingEntity = new SettingEntity();
settingEntity.setSwitchState(settingQo.getSwitchState());
settingDao.save(settingEntity);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale);
}
for (SettingEntity settingEntity : settingEntityList) {
settingDao.updateSwitchStateById(settingEntity.getId(), settingQo.getSwitchState());
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale);
}
/**
* 查询审核开关状态
*/
@Override
public String querySwitchState() {
Locale locale = LocaleContextHolder.getLocale();
List<SettingEntity> settingEntityList = settingDao.findAll();
if (settingEntityList.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有状态信息", locale);
}
SettingEntity settingEntity = settingEntityList.get(0);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, settingEntity.getSwitchState(), locale);
}
}

View File

@ -95,9 +95,11 @@ public class FileFastDfs {
final String fail = "fail"; final String fail = "fail";
if (null != node) { if (null != node) {
if (fail.equals(node.path(STATUS).asText())) { if (fail.equals(node.path(STATUS).asText())) {
file1.delete();
return null; return null;
} }
} }
file1.delete();
return result; return result;
} }