删除无用代码
This commit is contained in:
parent
9a7ff8d67e
commit
f312e74eee
@ -62,7 +62,6 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.antMatchers(HttpMethod.GET, "/weather/cityName").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/weather/cityId").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/selectFirePointByCode").permitAll()
|
||||
.antMatchers(HttpMethod.POST, "/updateTypeByFireCode").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/api/user/verificationCode").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/api/user/selectAgentOrgList").permitAll()//获取代理组织列表
|
||||
.antMatchers(HttpMethod.POST, "/uploadFileMore").permitAll()
|
||||
|
@ -1,57 +0,0 @@
|
||||
package com.xkrs.controller;
|
||||
|
||||
import com.xkrs.service.FireAndRangerService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author xkrs
|
||||
*/
|
||||
@RestController
|
||||
public class FireAndRangerController {
|
||||
|
||||
@Resource
|
||||
private FireAndRangerService fireAndRangerService;
|
||||
|
||||
/**
|
||||
* 将火点分配给某个人
|
||||
*
|
||||
* @param map
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addFireAndRanger")
|
||||
public String addFireAndRanger(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) throws UnsupportedEncodingException {
|
||||
String rangerName = (String) map.get("rangerName");
|
||||
String fireCode = (String) map.get("fireCode");
|
||||
String handler = (String) map.get("handler");
|
||||
String verifier = (String) map.get("verifier");
|
||||
return fireAndRangerService.addFireAndRanger(rangerName, fireCode, handler, verifier, token);
|
||||
}
|
||||
|
||||
/**
|
||||
* 护林员查看自己的火点任务
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/selectFireInformation")
|
||||
public String selectFireInformation(@RequestHeader(value = "Authorization") String token) {
|
||||
return fireAndRangerService.selectFireInformation(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据火点编码查询核查信息
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findFireAndRanger")
|
||||
public String findFireAndRangerByFireCode(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) throws Exception {
|
||||
String fireCode = (String) map.get("fireCode");
|
||||
return fireAndRangerService.findFireAndRangerByFireCode(fireCode, token);
|
||||
}
|
||||
}
|
@ -11,7 +11,6 @@ import com.xkrs.model.entity.SysUserEntity;
|
||||
import com.xkrs.model.qo.AuditFireTypeQo;
|
||||
import com.xkrs.model.qo.FirePointQo;
|
||||
import com.xkrs.model.qo.ShanDongFirePointVerifyStateQo;
|
||||
import com.xkrs.model.vo.AppTaskBodyVo;
|
||||
import com.xkrs.service.FirePointService;
|
||||
import com.xkrs.service.StreetService;
|
||||
import com.xkrs.utils.FirePointQueryHelper;
|
||||
@ -20,14 +19,12 @@ 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.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.transaction.Transactional;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -193,16 +190,6 @@ public class FirePointController {
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointList, locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新火点的街道编号数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/updateFirePointStreetCode")
|
||||
public String updateFirePointStreetCode() {
|
||||
return firePointService.updateFirePointStreetCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试
|
||||
*
|
||||
@ -258,45 +245,6 @@ public class FirePointController {
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, firePointList, locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据火点编码修改火点状态
|
||||
*
|
||||
* @param map
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updateTypeByFireCode")
|
||||
public String updateTypeByFireCode(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
|
||||
String fireCode = (String) map.get("fireCode");
|
||||
String fireType = (String) map.get("fireType");
|
||||
return firePointService.updateTypeByFireCode(fireCode, fireType, token);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交核查任务
|
||||
*/
|
||||
@PostMapping("/insertAppTask")
|
||||
public String insertAppTask(@RequestParam("files") MultipartFile[] files, AppTaskBodyVo appTaskBodyVo) throws IOException {
|
||||
if ("".equals(appTaskBodyVo.getFireCode()) || appTaskBodyVo.getFireCode() == null) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "火点编码不能为空", locale);
|
||||
}
|
||||
if ("".equals(appTaskBodyVo.getTaskInformation()) || appTaskBodyVo.getTaskInformation() == null) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "任务描述不能为空", locale);
|
||||
}
|
||||
if (files == null || files.length == 0) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "图片不能为空", locale);
|
||||
}
|
||||
return firePointService.insertAppTask(files, appTaskBodyVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询核查的任务信息
|
||||
*/
|
||||
@GetMapping("/selectAppTask")
|
||||
public String selectAppTask(@RequestParam("fireCode") String fireCode) throws Exception {
|
||||
return firePointService.selectAppTask(fireCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询近一周的火点信息
|
||||
*/
|
||||
@ -374,27 +322,4 @@ public class FirePointController {
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byFireCode, locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据火点编码添加火点前后的图片
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@Transactional(rollbackOn = Exception.class)
|
||||
@PostMapping("/updateBeforeFireAndAfterFireImage")
|
||||
public String updateBeforeFireAndAfterFireImage(@RequestBody Map map) {
|
||||
String fireCode = (String) map.get("fireCode");
|
||||
String beforeFireImage = (String) map.get("beforeFireImage");
|
||||
String afterFireImage = (String) map.get("afterFireImage");
|
||||
if (fireCode == null || "".equals(fireCode)) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "火点编码不能为空!", locale);
|
||||
}
|
||||
FirePointEntity byFireCode = firePointDao.findByFireCode(fireCode);
|
||||
if (byFireCode == null) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "火点编码错误!", locale);
|
||||
}
|
||||
firePointDao.updateBeforeFireAndAfterFireImage(fireCode, beforeFireImage, afterFireImage);
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加图片成功!", locale);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,55 +0,0 @@
|
||||
package com.xkrs.controller;
|
||||
|
||||
import com.xkrs.service.ForestRangerService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author xkrs
|
||||
*/
|
||||
@RestController
|
||||
public class ForestRangerController {
|
||||
|
||||
@Resource
|
||||
private ForestRangerService forestRangerService;
|
||||
|
||||
/**
|
||||
* 根据区县编码查询相关护林员的信息
|
||||
*
|
||||
* @param rangerCountyCode
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findByRangerCountyCode")
|
||||
public String findByRangerCountyCode(@RequestParam("rangerCountyCode") String rangerCountyCode, @RequestHeader(value = "Authorization") String token) {
|
||||
return forestRangerService.findByRangerCountyCode(rangerCountyCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据区县编码查询该区县所有护林员的信息
|
||||
*
|
||||
* @param countyCode
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findAllByRangerCountyCode")
|
||||
public String findAllByRangerCountyCode(@RequestParam("countyCode") String countyCode, @RequestHeader(value = "Authorization") String token) {
|
||||
return forestRangerService.findAllByRangerCountyCode(countyCode, token);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号修改护林员的位置
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updateLatAndLonByPhone")
|
||||
public String updateLatAndLonByPhone(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
|
||||
String rangerLatitude = (String) map.get("rangerLatitude");
|
||||
String rangerLongitude = (String) map.get("rangerLongitude");
|
||||
String rangerPhone = (String) map.get("rangerPhone");
|
||||
return forestRangerService.updateLatAndLonByPhone(rangerLatitude, rangerLongitude, rangerPhone);
|
||||
}
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
package com.xkrs.dao;
|
||||
|
||||
import com.xkrs.model.entity.FireAndRanger;
|
||||
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 FireAndRangerDao extends JpaRepository<FireAndRanger,Long>, JpaSpecificationExecutor<FireAndRanger> {
|
||||
|
||||
/**
|
||||
* 根据火点编码查询信息
|
||||
* @param fireCode
|
||||
* @return
|
||||
*/
|
||||
FireAndRanger findByFireCode(String fireCode);
|
||||
|
||||
/**
|
||||
* 根据护林员手机号查询
|
||||
* @param rangerName
|
||||
* @param progressType
|
||||
* @return
|
||||
*/
|
||||
FireAndRanger findByRangerNameAndProgressType(String rangerName, String progressType);
|
||||
|
||||
/**
|
||||
* 根据火点编码删除火点信息
|
||||
* @param fireCode
|
||||
* @return
|
||||
*/
|
||||
FireAndRanger deleteByFireCode(String fireCode);
|
||||
|
||||
/**
|
||||
* 根据火点编码修改结束时间
|
||||
* @param fireCode
|
||||
* @param endTime
|
||||
*/
|
||||
@Modifying(clearAutomatically=true)
|
||||
@Query(value = "update fire_and_ranger set end_time = ?2 where fire_code = ?1",nativeQuery = true)
|
||||
void updateEndTimeByFireCode(String fireCode, String endTime);
|
||||
|
||||
/**
|
||||
* 根据火点编码修改进程状态
|
||||
* @param fireCode
|
||||
* @param endTime
|
||||
*/
|
||||
@Modifying(clearAutomatically=true)
|
||||
@Query(value = "update fire_and_ranger set progress_type = ?2 where fire_code = ?1",nativeQuery = true)
|
||||
void updateProgressTypeByFireCode(String fireCode, String endTime);
|
||||
}
|
@ -7,13 +7,9 @@ import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author XinYi Song
|
||||
*/
|
||||
@Component
|
||||
public interface FirePointDao extends JpaRepository<FirePointEntity, Long>, JpaSpecificationExecutor<FirePointEntity> {
|
||||
|
||||
@ -25,13 +21,6 @@ public interface FirePointDao extends JpaRepository<FirePointEntity, Long>, JpaS
|
||||
@Query(value = "SELECT * FROM fire_point 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<FirePointEntity> findDuplicatedData(double longitude, double latitude, String streetCode, String satelliteTime, String satelliteType, String landType);
|
||||
|
||||
/**
|
||||
* 根据火点编码修改火点状态
|
||||
*/
|
||||
@Modifying(clearAutomatically = true)
|
||||
@Query(value = "UPDATE fire_point SET fire_type = ?2 WHERE fire_code = ?1", nativeQuery = true)
|
||||
void updateFireTypeByFireCode(String fireCode, String fireType);
|
||||
|
||||
/**
|
||||
* 根据火点编码修改审核火点状态
|
||||
*/
|
||||
@ -51,26 +40,6 @@ public interface FirePointDao extends JpaRepository<FirePointEntity, Long>, JpaS
|
||||
@Query(value = "select ci.city_name cityname,count(fp.id) from street ci left join fire_point fp on fp.county_code like concat('%',ci.city_code,'%') AND fp.satellite_time BETWEEN ?1 AND ?2 group by ci.city_name", nativeQuery = true)
|
||||
List<Map<String, Object>> selectNumByArea(String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 根据火点编码,修改火点前后图片路径
|
||||
*/
|
||||
@Modifying(clearAutomatically = true)
|
||||
@Query(value = "update fire_point set before_fire_image = ?2,after_fire_image = ?3 where fire_code = ?1", nativeQuery = true)
|
||||
void updateBeforeFireAndAfterFireImage(String fireCode, String beforeFireImage, String afterFireImage);
|
||||
|
||||
/**
|
||||
* 查询街道编码异常的火点
|
||||
*/
|
||||
// @Query(value = "SELECT * FROM fire_point WHERE length(street_code) != 9", nativeQuery = true)
|
||||
// update fire_point set street_name = (SELECT street_name from street WHERE fire_point.street_code = street.street_code) WHERE fire_point.street_name ISNULL
|
||||
@Query(value = "SELECT * FROM fire_point WHERE street_code ISNULL", nativeQuery = true)
|
||||
List<FirePointEntity> selectAbnormalStreetCode();
|
||||
|
||||
@Transactional(rollbackOn = Exception.class)
|
||||
@Modifying(clearAutomatically = true)
|
||||
@Query(value = "UPDATE fire_point SET street_code = ?2 WHERE id = ?1", nativeQuery = true)
|
||||
void updateStreetCodeById(Integer id, String streetCode);
|
||||
|
||||
@Query(value = "select a.really_name 姓名, a.county_name 所在市, a.telephone 手机号, a.vip_level vip, b.satellite_time 扫描时间, " + "round(cast(b.longitude as numeric) ,6) 经度, round(cast(b.latitude as numeric) ,6) 纬度, b.fire_point_address 详细地址 from sys_user a left join fire_point b on " + "case when left(a.county_code, 4) = '0000' then left(b.county_code, 4) = left(a.county_code, 4) " + "when left(a.county_code, 2) = '00' then left(b.county_code, 2) = left(a.county_code, 2) " + "else left(b.county_code, 2) = left(a.county_code, 2) end where a.vip_level > 0 and satellite_time > ?1", nativeQuery = true)
|
||||
List<Map<String, String>> downloadFirePointByVip(String yesterday);
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
package com.xkrs.dao;
|
||||
|
||||
import com.xkrs.model.entity.FireTask;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @author xkrs
|
||||
*/
|
||||
public interface FireTaskDao extends JpaRepository<FireTask,Long>, JpaSpecificationExecutor<FireTask> {
|
||||
|
||||
/**
|
||||
* 根据火点编码查询该条任务
|
||||
* @param fireCode
|
||||
* @return
|
||||
*/
|
||||
FireTask findByTaskFireCode(String fireCode);
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package com.xkrs.dao;
|
||||
|
||||
import com.xkrs.model.entity.FireTaskPhoto;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xkrs
|
||||
*/
|
||||
public interface FireTaskPhotoDao extends JpaRepository<FireTaskPhoto,Long>, JpaSpecificationExecutor<FireTaskPhoto> {
|
||||
|
||||
/**
|
||||
* 根据火点编码查询图片
|
||||
* @param fireCode
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "select task_photo from fire_task_photo where photo_fire_code = :fireCode",nativeQuery = true)
|
||||
List<Object[]> findPhotoPath(String fireCode);
|
||||
|
||||
/**
|
||||
* 通过火点编码查询图片的信息
|
||||
* @param fireCode
|
||||
* @return
|
||||
*/
|
||||
List<FireTaskPhoto> findAllByPhotoFireCode(String fireCode);
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package com.xkrs.dao;
|
||||
|
||||
import com.xkrs.model.entity.ForestRanger;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @author xkrs
|
||||
*/
|
||||
public interface ForestRangerDao extends JpaRepository<ForestRanger,Long>, JpaSpecificationExecutor<ForestRanger> {
|
||||
|
||||
/**
|
||||
* 根据市区县编码查询护林员的信息
|
||||
* @param rangerCountyCode
|
||||
* @return
|
||||
*/
|
||||
ForestRanger findByRangerCountyCode(String rangerCountyCode);
|
||||
|
||||
/**
|
||||
* 根据手机号对护林员的位置进行修改
|
||||
* @param rangerLatitude
|
||||
* @param rangerLongitude
|
||||
* @param rangerPhone
|
||||
*/
|
||||
@Modifying(clearAutomatically=true)
|
||||
@Query(value = "update forest_ranger set ranger_latitude = ?1,ranger_longitude = ?2 where ranger_phone = ?3",nativeQuery = true)
|
||||
void updateLatAndLonByPhone(String rangerLatitude,String rangerLongitude,String rangerPhone);
|
||||
|
||||
/**
|
||||
* 根据手机号修改护林员的状态值
|
||||
* @param rangerPhone
|
||||
* @param rangerType
|
||||
*/
|
||||
@Modifying(clearAutomatically=true)
|
||||
@Query(value = "update forest_ranger set ranger_type = ?2 where ranger_phone = ?1",nativeQuery = true)
|
||||
void updateRangerTypeByPhone(String rangerPhone,String rangerType);
|
||||
|
||||
/**
|
||||
* 根据手机号查询护林员的信息
|
||||
* @param rangerPhone
|
||||
* @return
|
||||
*/
|
||||
ForestRanger findByRangerPhone(String rangerPhone);
|
||||
|
||||
/**
|
||||
* 根据区县编码查询该区县护林员的信息
|
||||
* @param rangerCountyCode
|
||||
* @return
|
||||
*/
|
||||
List<ForestRanger> findAllByRangerCountyCode(String rangerCountyCode);
|
||||
|
||||
/**
|
||||
* 根据区县编码模糊查询护林员的信息
|
||||
* @param rangerCountyCode
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "select * from forest_ranger where ranger_county_code like CONCAT('%',:rangerCountyCode,'%')",nativeQuery = true)
|
||||
List<ForestRanger> findAllsByRangerCountyCode(String rangerCountyCode);
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package com.xkrs.service;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* @author xkrs
|
||||
*/
|
||||
public interface FireAndRangerService {
|
||||
|
||||
/**
|
||||
* 将火点分配给护林员
|
||||
* @param token
|
||||
* @param rangerName
|
||||
* @param fireCode
|
||||
* @param handler
|
||||
* @param verifier
|
||||
* @return
|
||||
*/
|
||||
String addFireAndRanger(String rangerName, String fireCode, String handler, String verifier, String token) throws UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* 护林员查看自己的火点任务
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
String selectFireInformation(String token);
|
||||
|
||||
/**
|
||||
* 根据火点编码查询处理的信息
|
||||
* @param fireCode
|
||||
* @return
|
||||
*/
|
||||
String findFireAndRangerByFireCode(String fireCode, String token) throws Exception;
|
||||
}
|
@ -2,12 +2,9 @@ package com.xkrs.service;
|
||||
|
||||
import com.xkrs.model.entity.FirePointEntity;
|
||||
import com.xkrs.model.qo.FirePointQo;
|
||||
import com.xkrs.model.vo.AppTaskBodyVo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -39,36 +36,6 @@ public interface FirePointService {
|
||||
*/
|
||||
List<FirePointEntity> selectTodayFirePoint(String countyCode);
|
||||
|
||||
/**
|
||||
* 根据火点编码修改火点的状态(预警)
|
||||
*
|
||||
* @param fireCode
|
||||
* @param fireType
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
String updateTypeByFireCode(String fireCode, String fireType, String token);
|
||||
|
||||
/**
|
||||
* 提交核查任务信息
|
||||
*
|
||||
* @param files
|
||||
* @param appTaskBodyVo
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
String insertAppTask(MultipartFile[] files, AppTaskBodyVo appTaskBodyVo) throws IOException;
|
||||
|
||||
/**
|
||||
* 根据火点编码查询任务信息
|
||||
*
|
||||
* @param fireCode
|
||||
* @param
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
String selectAppTask(String fireCode) throws Exception;
|
||||
|
||||
/**
|
||||
* 查询近一周天的火点信息
|
||||
*
|
||||
@ -104,13 +71,6 @@ public interface FirePointService {
|
||||
*/
|
||||
String selectFirePointNumWeek();
|
||||
|
||||
/**
|
||||
* 更新火点的街道编号数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String updateFirePointStreetCode();
|
||||
|
||||
/**
|
||||
* 根据火点编号更新审核状态
|
||||
* 操作1:将火点编号对应的火点从山东火点表转存到火点表
|
||||
|
@ -1,31 +0,0 @@
|
||||
package com.xkrs.service;
|
||||
|
||||
/**
|
||||
* @author xkrs
|
||||
*/
|
||||
public interface ForestRangerService {
|
||||
|
||||
/**
|
||||
* 根据区县编码查询护林员的信息
|
||||
* @param rangerCountyCode
|
||||
* @return
|
||||
*/
|
||||
String findByRangerCountyCode(String rangerCountyCode);
|
||||
|
||||
/**
|
||||
* 根据区县编码查询该区县所有护林员的信息
|
||||
* @param countyCode
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
String findAllByRangerCountyCode(String countyCode, String token);
|
||||
|
||||
/**
|
||||
* 根据手机号修改用户位置
|
||||
* @param rangerLatitude
|
||||
* @param rangerLongitude
|
||||
* @param rangerPhone
|
||||
* @return
|
||||
*/
|
||||
String updateLatAndLonByPhone(String rangerLatitude,String rangerLongitude,String rangerPhone);
|
||||
}
|
@ -1,174 +0,0 @@
|
||||
package com.xkrs.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||
import com.xkrs.common.tool.TokenUtil;
|
||||
import com.xkrs.dao.*;
|
||||
import com.xkrs.model.entity.*;
|
||||
import com.xkrs.model.vo.AppPhotoVo;
|
||||
import com.xkrs.model.vo.AppTaskBodyVo;
|
||||
import com.xkrs.service.FireAndRangerService;
|
||||
import com.xkrs.utils.DateTimeUtil;
|
||||
import com.xkrs.utils.ObjectToBeanUtils;
|
||||
import com.xkrs.utils.RestTemplateUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cglib.beans.BeanCopier;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||
|
||||
/**
|
||||
* @author xkrs
|
||||
*/
|
||||
@Service
|
||||
public class FireAndRangerServiceImpl implements FireAndRangerService {
|
||||
|
||||
public static Logger log = LoggerFactory.getLogger(FireAndRangerServiceImpl.class);
|
||||
|
||||
@Resource
|
||||
private FireAndRangerDao fireAndRangerDao;
|
||||
|
||||
@Resource
|
||||
private SysUserDao sysUserDao;
|
||||
|
||||
@Resource
|
||||
private FirePointDao firePointDao;
|
||||
|
||||
@Resource
|
||||
private ForestRangerDao forestRangerDao;
|
||||
|
||||
@Resource
|
||||
private RestTemplateUtil restTemplateUtil;
|
||||
|
||||
@Resource
|
||||
private FireTaskDao fireTaskDao;
|
||||
|
||||
@Resource
|
||||
private FireTaskPhotoDao fireTaskPhotoDao;
|
||||
|
||||
/**
|
||||
* 将火点分配给护林员
|
||||
* @param rangerName
|
||||
* @param fireCode
|
||||
* @return
|
||||
*/
|
||||
@Transactional(rollbackOn = Exception.class)
|
||||
@Override
|
||||
public String addFireAndRanger(String rangerName, String fireCode, String handler, String verifier, String token) throws UnsupportedEncodingException {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||
FireAndRanger byFireCode = fireAndRangerDao.findByFireCode(fireCode);
|
||||
if(byFireCode != null){
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"该火点已经分配,请勿重复操作",locale);
|
||||
}
|
||||
FirePointEntity byFireCode1 = firePointDao.findByFireCode(fireCode);
|
||||
// 给app端推送的消息内容
|
||||
|
||||
Map<String,Object> map = new HashMap(3);
|
||||
map.put("latitude",byFireCode1.getLatitude());
|
||||
map.put("longitude",byFireCode1.getLongitude());
|
||||
map.put("detailedAddress",byFireCode1.getFirePointAddress());
|
||||
String content = JSON.toJSONString(map);
|
||||
String ss = URLEncoder.encode(content,"utf-8");
|
||||
|
||||
String url = "https://api.xmpush.xiaomi.com/v3/message/alias?title=收到消息&description=请"+verifier+"去核查该火点信息&payload="+ss+"&restricted_package_name=com.xkrs.fieldverification¬ify_id=2&extra.notify_effect=2&extra.intent_uri=fieldverify://xkrs.com&alias="+rangerName+"&extra.notify_foreground=0&extra.channel_id=mipush";
|
||||
|
||||
String time = DateTimeUtil.dateTimeToString(LocalDateTime.now());
|
||||
FireAndRanger fireAndRanger = new FireAndRanger();
|
||||
fireAndRanger.setRangerName(rangerName);
|
||||
fireAndRanger.setFireCode(fireCode);
|
||||
fireAndRanger.setHandlerTime(time);
|
||||
fireAndRanger.setHandler(handler);
|
||||
fireAndRanger.setVerifier(verifier);
|
||||
fireAndRanger.setProgressType("1");
|
||||
|
||||
// 将火点分配给该护林员后,将护林员状态修改为1 表示正在执行火点任务
|
||||
forestRangerDao.updateRangerTypeByPhone(rangerName,"1");
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
httpHeaders.add("Authorization","key=QW+6vVbWptJHscqD7zuM5w==");
|
||||
log.info("-----------已向app发送消息");
|
||||
restTemplateUtil.doPostMessageToApp(url, httpHeaders, jsonObject);
|
||||
|
||||
FireAndRanger save = fireAndRangerDao.save(fireAndRanger);
|
||||
if(save == null){
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"操作失败",locale);
|
||||
}
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"操作成功",locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* 护林员查看自己的火点任务
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String selectFireInformation(String token) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
||||
ForestRanger byRangerPhone = forestRangerDao.findByRangerPhone(sysUserEntity.getUserName());
|
||||
if(byRangerPhone.getRangerType().equals("1")){
|
||||
FireAndRanger byRangerName = fireAndRangerDao.findByRangerNameAndProgressType(sysUserEntity.getUserName(),"1");
|
||||
if(byRangerName == null){
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有任何任务",locale);
|
||||
}
|
||||
FirePointEntity byFireCode = firePointDao.findByFireCode(byRangerName.getFireCode());
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,byFireCode,locale);
|
||||
}else {
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有任何任务",locale);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据火点编码查询核查的信息
|
||||
* @param fireCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String findFireAndRangerByFireCode(String fireCode, String token) throws Exception {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||
FireAndRanger byFireCode = fireAndRangerDao.findByFireCode(fireCode);
|
||||
if(byFireCode == null){
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有该火点的核查信息",locale);
|
||||
}
|
||||
Map map = new HashMap(3);
|
||||
map.put("fire",byFireCode);
|
||||
FireTask byTaskFireCode = fireTaskDao.findByTaskFireCode(fireCode);
|
||||
if(byTaskFireCode == null){
|
||||
map.put("task",null);
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,map,locale);
|
||||
}else {
|
||||
AppTaskBodyVo appTaskBodyVo = new AppTaskBodyVo();
|
||||
// 做映射,返回vo类对象
|
||||
BeanCopier beanCopier = BeanCopier.create(FireTask.class, AppTaskBodyVo.class, false);
|
||||
beanCopier.copy(byTaskFireCode,appTaskBodyVo,null);
|
||||
|
||||
List<Object[]> photoPath = fireTaskPhotoDao.findPhotoPath(fireCode);
|
||||
List<AppPhotoVo> appPhotoVos = ObjectToBeanUtils.objectToBean(photoPath, AppPhotoVo.class);
|
||||
appTaskBodyVo.setTaskFirePhoto(appPhotoVos);
|
||||
map.put("task",appTaskBodyVo);
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,map,locale);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,9 @@
|
||||
package com.xkrs.service.impl;
|
||||
|
||||
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||
import com.xkrs.common.tool.TokenUtil;
|
||||
import com.xkrs.dao.*;
|
||||
import com.xkrs.model.entity.*;
|
||||
import com.xkrs.model.qo.FirePointQo;
|
||||
import com.xkrs.model.vo.AppPhotoVo;
|
||||
import com.xkrs.model.vo.AppTaskBodyVo;
|
||||
import com.xkrs.model.vo.GaoDeIgGeocodeVo;
|
||||
import com.xkrs.service.FirePointService;
|
||||
import com.xkrs.service.GlobalConfigService;
|
||||
@ -17,10 +14,8 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cglib.beans.BeanCopier;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -62,18 +57,6 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
@Resource
|
||||
private SysUserDao sysUserDao;
|
||||
|
||||
@Resource
|
||||
private FireAndRangerDao fireAndRangerDao;
|
||||
|
||||
@Resource
|
||||
private ForestRangerDao forestRangerDao;
|
||||
|
||||
@Resource
|
||||
private FireTaskDao fireTaskDao;
|
||||
|
||||
@Resource
|
||||
private FireTaskPhotoDao fireTaskPhotoDao;
|
||||
|
||||
@Resource
|
||||
private StreetDao streetDao;
|
||||
|
||||
@ -547,119 +530,6 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
return firePointEntities;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据火点编码修改火点的状态(预警)
|
||||
*
|
||||
* @param fireCode
|
||||
* @param fireType
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
@Transactional(rollbackOn = Exception.class)
|
||||
@Override
|
||||
public String updateTypeByFireCode(String fireCode, String fireType, String token) {
|
||||
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
||||
FirePointEntity byFireCode = firePointDao.findByFireCode(fireCode);
|
||||
if ("3".equals(byFireCode.getFireType()) || "-1".equals(byFireCode.getFireType())) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "该火点已经结案,请勿进行有关状态操作", locale);
|
||||
}
|
||||
if (fireType.equals(byFireCode.getFireType())) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "您正处于当前的状态,请勿进行该操作", locale);
|
||||
}
|
||||
firePointDao.updateFireTypeByFireCode(fireCode, fireType);
|
||||
if ("1".equals(fireType)) {
|
||||
FirePointEntity byFireCode1 = firePointDao.findByFireCode(fireCode);
|
||||
// 预警
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byFireCode1, locale);
|
||||
} else if ("2".equals(fireType)) {
|
||||
FirePointEntity byFireCode3 = firePointDao.findByFireCode(fireCode);
|
||||
// 核查
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byFireCode3, locale);
|
||||
} else {
|
||||
String rangerType = "0";
|
||||
FireAndRanger byFireCode1 = fireAndRangerDao.findByFireCode(fireCode);
|
||||
if (byFireCode1 == null) {
|
||||
FirePointEntity byFireCode4 = firePointDao.findByFireCode(fireCode);
|
||||
String time = dateTimeToString(LocalDateTime.now());
|
||||
FireAndRanger fireAndRanger = new FireAndRanger();
|
||||
fireAndRanger.setFireCode(fireCode);
|
||||
// 由于测试阶段先用用户账号代替,后期换成getReallyName(用户真实姓名)
|
||||
fireAndRanger.setHandler(sysUserEntity.getReallyName());
|
||||
fireAndRanger.setEndTime(time);
|
||||
fireAndRangerDao.save(fireAndRanger);
|
||||
// 结案
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byFireCode4, locale);
|
||||
}
|
||||
// 火点结案,将护林员的状态修改为0 表示该护林员没有在执行任务,处于空闲状态
|
||||
forestRangerDao.updateRangerTypeByPhone(byFireCode1.getRangerName(), rangerType);
|
||||
String time = dateTimeToString(LocalDateTime.now());
|
||||
fireAndRangerDao.updateEndTimeByFireCode(fireCode, time);
|
||||
fireAndRangerDao.updateProgressTypeByFireCode(fireCode, "0");
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "结案", locale);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交核查任务
|
||||
*
|
||||
* @param files
|
||||
* @param appTaskBodyVo
|
||||
* @return
|
||||
*/
|
||||
@Transactional(rollbackOn = Exception.class)
|
||||
@Override
|
||||
public String insertAppTask(MultipartFile[] files, AppTaskBodyVo appTaskBodyVo) throws IOException {
|
||||
FirePointEntity byFireCode = firePointDao.findByFireCode(appTaskBodyVo.getFireCode());
|
||||
if (byFireCode == null) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "火点编码错误,请重新输入", locale);
|
||||
}
|
||||
FireTask byTaskFireCode = fireTaskDao.findByTaskFireCode(appTaskBodyVo.getFireCode());
|
||||
if (byTaskFireCode != null) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "该火点的任务已经提交,请勿重复提交", locale);
|
||||
}
|
||||
String s = dateTimeToString(LocalDateTime.now());
|
||||
FireTask fireTask = new FireTask();
|
||||
fireTask.setTaskFireCode(appTaskBodyVo.getFireCode());
|
||||
fireTask.setTaskInformation(appTaskBodyVo.getTaskInformation());
|
||||
fireTask.setTaskTime(s);
|
||||
FireTask save = fireTaskDao.save(fireTask);
|
||||
if (save == null) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "任务提交失败", locale);
|
||||
}
|
||||
List<FireTaskPhoto> fireTaskPhotos = PhotoUtil.uploadImage(files, appTaskBodyVo.getFireCode());
|
||||
List<FireTaskPhoto> fireTaskPhotos1 = fireTaskPhotoDao.saveAll(fireTaskPhotos);
|
||||
if (fireTaskPhotos1 == null || fireTaskPhotos1.size() == 0) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "图片上传失败,任务提交失败", locale);
|
||||
}
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "任务提交成功", locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据火点编码查询任务信息
|
||||
*
|
||||
* @param fireCode
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public String selectAppTask(String fireCode) throws Exception {
|
||||
FireTask byTaskFireCode = fireTaskDao.findByTaskFireCode(fireCode);
|
||||
if (byTaskFireCode == null) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该火点的任务信息", locale);
|
||||
}
|
||||
AppTaskBodyVo appTaskBodyVo = new AppTaskBodyVo();
|
||||
// 做映射,返回vo类对象
|
||||
BeanCopier beanCopier = BeanCopier.create(FireTask.class, AppTaskBodyVo.class, false);
|
||||
beanCopier.copy(byTaskFireCode, appTaskBodyVo, null);
|
||||
|
||||
List<Object[]> photoPath = fireTaskPhotoDao.findPhotoPath(fireCode);
|
||||
List<AppPhotoVo> appPhotoVos = ObjectToBeanUtils.objectToBean(photoPath, AppPhotoVo.class);
|
||||
appTaskBodyVo.setTaskFirePhoto(appPhotoVos);
|
||||
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, appTaskBodyVo, locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询近一个月的火点数量
|
||||
*
|
||||
@ -735,55 +605,4 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, map, locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新火点的街道编号数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String updateFirePointStreetCode() {
|
||||
System.out.println("开始格式化街道编号");
|
||||
List<FirePointEntity> firePointEntityList = firePointDao.selectAbnormalStreetCode();
|
||||
long startTimeMillis = System.currentTimeMillis();
|
||||
int listSize = firePointEntityList.size();
|
||||
for (int i = 0; i < listSize; i++) {
|
||||
try {
|
||||
FirePointEntity firePointEntity = firePointEntityList.get(i);
|
||||
List<String> locationList = new ArrayList<>();
|
||||
locationList.add(firePointEntity.getLongitude() + "," + firePointEntity.getLatitude());
|
||||
GaoDeIgGeocodeVo geocode = GaoDeApiUtil.geocode(locationList);
|
||||
String townCode = geocode.getRegeocodes().get(0).getAddressComponent().get(0).getTowncode();
|
||||
if (townCode.length() > 9) {
|
||||
townCode = townCode.substring(0, 9);
|
||||
}
|
||||
firePointDao.updateStreetCodeById(firePointEntity.getId(), townCode);
|
||||
if (i % 10 == 0) {
|
||||
long spendTimeMillis = System.currentTimeMillis() - startTimeMillis;
|
||||
double remainTimeMillis = (listSize - i) * spendTimeMillis * 1D / i;
|
||||
System.out.println("已完成(" + i + "/" + listSize + "),用时" + formatDuring(spendTimeMillis) + ",剩余" + formatDuring((long) remainTimeMillis));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("街道编号格式化出现错误:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "街道编号格式化完毕", locale);
|
||||
}
|
||||
|
||||
public static String formatDuring(long mss) {
|
||||
long days = mss / (1000 * 60 * 60 * 24);
|
||||
long hours = (mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60);
|
||||
long minutes = (mss % (1000 * 60 * 60)) / (1000 * 60);
|
||||
long seconds = (mss % (1000 * 60)) / 1000;
|
||||
if (days <= 0 && hours <= 0 && minutes <= 0) {
|
||||
return seconds + " 秒 ";
|
||||
}
|
||||
if (days <= 0 && hours <= 0) {
|
||||
return minutes + " 分钟 " + seconds + " 秒 ";
|
||||
}
|
||||
if (days <= 0) {
|
||||
return hours + " 小时 " + minutes + " 分钟 " + seconds + " 秒 ";
|
||||
}
|
||||
return days + " 天 " + hours + " 小时 " + minutes + " 分钟 " + seconds + " 秒 ";
|
||||
}
|
||||
}
|
||||
|
@ -1,83 +0,0 @@
|
||||
package com.xkrs.service.impl;
|
||||
|
||||
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||
import com.xkrs.common.tool.TokenUtil;
|
||||
import com.xkrs.dao.ForestRangerDao;
|
||||
import com.xkrs.model.entity.ForestRanger;
|
||||
import com.xkrs.service.ForestRangerService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author xkrs
|
||||
*/
|
||||
@Service
|
||||
public class ForestRangerServiceImpl implements ForestRangerService {
|
||||
|
||||
@Resource
|
||||
private ForestRangerDao forestRangerDao;
|
||||
|
||||
/**
|
||||
* 根据曲线编码查询护林员的信息
|
||||
* @param rangerCountyCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String findByRangerCountyCode(String rangerCountyCode) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
ForestRanger byRangerCountyCode = forestRangerDao.findByRangerCountyCode(rangerCountyCode);
|
||||
if(byRangerCountyCode == null){
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"该区县暂时还没有相关护林员的信息",locale);
|
||||
}
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,byRangerCountyCode,locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据区县编码查询该区县所有护林员的信息
|
||||
* @param countyCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String findAllByRangerCountyCode(String countyCode, String token) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||
if("0000".equals(countyCode.substring(2))){
|
||||
List<ForestRanger> allsByRangerCountyCode = forestRangerDao.findAllsByRangerCountyCode(countyCode.substring(0,2));
|
||||
if(allsByRangerCountyCode == null || allsByRangerCountyCode.size() == 0){
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没该省护林员的信息",locale);
|
||||
}
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,allsByRangerCountyCode,locale);
|
||||
}else {
|
||||
List<ForestRanger> allByRangerCountyCode = forestRangerDao.findAllsByRangerCountyCode(countyCode.substring(0,4));
|
||||
if(allByRangerCountyCode == null || allByRangerCountyCode.size() == 0){
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没该市护林员的信息",locale);
|
||||
}
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,allByRangerCountyCode,locale);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号修改护林员的位置信息
|
||||
* @param rangerLatitude
|
||||
* @param rangerLongitude
|
||||
* @param rangerPhone
|
||||
* @return
|
||||
*/
|
||||
@Transactional(rollbackOn = Exception.class)
|
||||
@Override
|
||||
public String updateLatAndLonByPhone(String rangerLatitude, String rangerLongitude, String rangerPhone) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
forestRangerDao.updateLatAndLonByPhone(rangerLatitude,rangerLongitude,rangerPhone);
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"操作成功",locale);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user