优化代码

This commit is contained in:
DESKTOP-G8BCEP0\HP 2021-08-06 16:39:16 +08:00
parent 2573b03aea
commit aa5b920dd9
2 changed files with 8 additions and 8 deletions

View File

@ -115,11 +115,11 @@ public class FirePointServiceImpl implements FirePointService {
@Override
public List<FirePointEntity> selectTodayFirePoint(String countyCode) {
String addTime = DateTimeUtil.dateToString(LocalDate.now());
if(countyCode.substring(2).equals("0000")){
if("0000".equals(countyCode.substring(2))){
List<CityEntity> byProCode = cityDao.findByProCode(countyCode);
String proName = byProCode.get(0).getProName();
return firePointDao.selectTodayFirePoint(addTime,proName);
}else if(countyCode.substring(4).equals("00") && !countyCode.substring(2).equals("0000")){
}else if("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))){
List<CityEntity> byCityCode = cityDao.findByCityCode(countyCode);
String cityName = byCityCode.get(0).getCityName();
return firePointDao.selectTodayFirePoint(addTime,cityName);
@ -190,18 +190,18 @@ public class FirePointServiceImpl implements FirePointService {
String tokenUserName = TokenUtil.getTokenUserName(token);
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
FirePointEntity byFireCode = firePointDao.findByFireCode(fireCode);
if (byFireCode.getFireType().equals("3") || byFireCode.getFireType().equals("-1")) {
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 (fireType.equals("1")) {
if ("1".equals(fireType)) {
FirePointEntity byFireCode1 = firePointDao.findByFireCode(fireCode);
// 预警
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,byFireCode1,locale);
} else if (fireType.equals("2")){
} else if ("2".equals(fireType)){
FirePointEntity byFireCode3 = firePointDao.findByFireCode(fireCode);
// 核查
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,byFireCode3,locale);
@ -318,11 +318,11 @@ public class FirePointServiceImpl implements FirePointService {
// 当前时间减7
LocalDateTime localDateTime1 = localDateTime.minusDays(31);
String startTime = DateTimeUtil.dateTimeToString(localDateTime1);
if(countyCode.substring(2).equals("0000")){
if("0000".equals(countyCode.substring(2))){
List<CityEntity> byProCode = cityDao.findByProCode(countyCode);
String proName = byProCode.get(0).getProName();
return query.selectFirePointByMonth(proName,startTime,endTime);
}else if(countyCode.substring(4).equals("00") && !countyCode.substring(2).equals("0000")){
}else if("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))){
List<CityEntity> byCityCode = cityDao.findByCityCode(countyCode);
String cityName = byCityCode.get(0).getCityName();
return query.selectFirePointByMonthCity(cityName,startTime,endTime);

View File

@ -50,7 +50,7 @@ public class ForestRangerServiceImpl implements ForestRangerService {
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
String tokenUserName = TokenUtil.getTokenUserName(token);
if(countyCode.substring(2).equals("0000")){
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);