|
|
|
|
@ -7,9 +7,14 @@ import com.hisense.hiatmp.model.common.HighDangerBase; |
|
|
|
|
import com.hisense.hiatmp.model.common.Operator; |
|
|
|
|
import com.hisense.hiatmp.model.common.ServerResponse; |
|
|
|
|
import com.hisense.hiatmp.model.common.VO.TricycleListVO; |
|
|
|
|
import com.hisense.hiatmp.model.common.VO.TricycleWarningDetailVO; |
|
|
|
|
import com.hisense.hiatmp.model.common.VO.TricycleWarningListVO; |
|
|
|
|
import com.hisense.hiatmp.model.common.VO.TricycleWarningResultsVO; |
|
|
|
|
import com.hisense.hiatmp.model.common.enums.HandleEnum; |
|
|
|
|
import com.hisense.hiatmp.model.common.enums.RoleEnum; |
|
|
|
|
import com.hisense.hiatmp.model.dmr.EnumType; |
|
|
|
|
import com.hisense.hiatmp.server_api.mapper.ConfigMapper; |
|
|
|
|
import com.hisense.hiatmp.server_api.model.StreetCommunity; |
|
|
|
|
import com.hisense.hiatmp.server_api.service.OperatorService; |
|
|
|
|
import com.hisense.hiatmp.server_api.service.TricycleService; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
@ -18,8 +23,10 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.text.ParseException; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
* @ClassName TricycleController |
|
|
|
|
@ -40,7 +47,10 @@ public class TricycleController { |
|
|
|
|
@Autowired |
|
|
|
|
private OperatorService operatorService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ConfigMapper configMapper; |
|
|
|
|
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
|
|
@GetMapping("getTricycleList") |
|
|
|
|
@ApiOperation("获取信息登记列表") |
|
|
|
|
@ -71,7 +81,15 @@ public class TricycleController { |
|
|
|
|
} else { |
|
|
|
|
return ServerResponse.error("当前用户无权限"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (Objects.equals(operatorById.getNlevel(), "2")) { |
|
|
|
|
roleFlag = 3; |
|
|
|
|
// 取部门的前六位
|
|
|
|
|
// cdepartmentid = cdepartmentid.substring(0, Math.min(cdepartmentid.length(), 6));
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// PageHelper.startPage(pageNum, pageSize);
|
|
|
|
|
log.info("/getTricycleList(【三轮车】获取信息登记列表))mapper入参:{},{},{},{}", roleFlag,cdepartmentid,status,search); |
|
|
|
|
List<TricycleListVO> tricycleList = tricycleService.getTricycleList(roleFlag,cdepartmentid,status,search); |
|
|
|
|
// PageInfo<TricycleListVO> pageInfo = new PageInfo<>(tricycleList);
|
|
|
|
|
log.info("/getTricycleList(【三轮车】获取信息登记列表))接口数据返回,调用ip: {}, 出参:{}", request.getRemoteAddr(), tricycleList); |
|
|
|
|
@ -90,7 +108,7 @@ public class TricycleController { |
|
|
|
|
int affect = tricycleService.saveTricycleInfo(tricycleInfo); |
|
|
|
|
if(affect > 0 ){ |
|
|
|
|
log.info("/saveTricycleInfo(【三轮车】保存登记数据))接口数据返回,调用ip: {}, 出参:{}", request.getRemoteAddr(), tricycleInfo); |
|
|
|
|
return ServerResponse.ok("登记信息数据提交成功"); |
|
|
|
|
return ServerResponse.ok("登记信息数据提交成功",tricycleInfo); |
|
|
|
|
}else{ |
|
|
|
|
return ServerResponse.error("新增/保存数据失败"); |
|
|
|
|
} |
|
|
|
|
@ -139,18 +157,19 @@ public class TricycleController { |
|
|
|
|
* 获取预警处理列表 |
|
|
|
|
* @param request |
|
|
|
|
* @param nuserId |
|
|
|
|
* @param distributionStatus |
|
|
|
|
* @param completeStatus |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/getTricycleWarningList") |
|
|
|
|
@ApiOperation(value = "获取预警处理列表") |
|
|
|
|
public ServerResponse<?> getTricycleWarningList(HttpServletRequest request, |
|
|
|
|
@RequestParam String nuserId, |
|
|
|
|
@RequestParam String distributionStatus, // 分配状态
|
|
|
|
|
@RequestParam String completeStatus // 完成状态
|
|
|
|
|
@RequestParam(defaultValue = "1") Integer pageNum, |
|
|
|
|
@RequestParam(defaultValue = "10") Integer pageSize, |
|
|
|
|
// @RequestParam String distributionStatus, // 分配状态
|
|
|
|
|
@RequestParam String status, // 数据状态 0 待处理 1 已分配 2 已完成
|
|
|
|
|
@RequestParam(defaultValue = "") String search // 模糊查询
|
|
|
|
|
){ |
|
|
|
|
log.info("/getTricycleWarningList(【三轮车】获取预警处理列表)接口被调用, 调用ip: {},入参:{}", request.getRemoteAddr(),nuserId); |
|
|
|
|
log.info("/getTricycleWarningList(【三轮车】获取预警处理列表)接口被调用, 调用ip: {},入参:{}", request.getRemoteAddr(),nuserId,search); |
|
|
|
|
int roleFlag = 0; |
|
|
|
|
|
|
|
|
|
// 权限判断
|
|
|
|
|
@ -159,9 +178,10 @@ public class TricycleController { |
|
|
|
|
List<String> roleById = operatorService.getRoleById(nuserId); |
|
|
|
|
if (!roleById.isEmpty()) { |
|
|
|
|
for (String role : roleById){ |
|
|
|
|
// 村干部权限
|
|
|
|
|
if(RoleEnum.VILLAGE_CADRE.getName().equals(role)){ |
|
|
|
|
roleFlag = 1; |
|
|
|
|
break; |
|
|
|
|
// 中队权限
|
|
|
|
|
}else if(RoleEnum.TRICYCLE_SQUADRON_POLICE_OFFICERS.getName().equals(role)){ |
|
|
|
|
roleFlag = 2; |
|
|
|
|
break; |
|
|
|
|
@ -170,10 +190,113 @@ public class TricycleController { |
|
|
|
|
} else { |
|
|
|
|
return ServerResponse.error("当前用户无权限"); |
|
|
|
|
} |
|
|
|
|
// 中队民警展示 未分配 未完成 状态的数据
|
|
|
|
|
List<TricycleWarningListVO> tricycleWarningListList = tricycleService.getTricycleWarningList(roleFlag,distributionStatus,completeStatus); |
|
|
|
|
|
|
|
|
|
// 分页展示
|
|
|
|
|
PageHelper.startPage(pageNum, pageSize); |
|
|
|
|
/* |
|
|
|
|
中队民警【待处理】展示 【未分配 未完成】 状态的数据 |
|
|
|
|
农三轮村干部【待处理】展示 【已分配 未完成】 状态的数据 |
|
|
|
|
*/ |
|
|
|
|
List<TricycleWarningListVO> tricycleWarningListList = tricycleService.getTricycleWarningList(cdepartmentid,roleFlag,status,search); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tricycleWarningListList.forEach(item -> { |
|
|
|
|
// 使用预留字段 ctime 接收 createtime 格式化的时间(Date->String)
|
|
|
|
|
item.setWarningTimeFormat(dateFormat.format(item.getWarningTime())); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// for (int i = 0; i < tricycleWarningListList.size(); i++) {
|
|
|
|
|
// tricycleWarningListList.get(i).getWarningTime();
|
|
|
|
|
// }
|
|
|
|
|
PageInfo<TricycleWarningListVO> pageInfo = new PageInfo<>(tricycleWarningListList); |
|
|
|
|
|
|
|
|
|
log.info("/getTricycleWarningList(【三轮车】获取预警处理列表)接口数据返回,调用ip: {}, 出参:{}", request.getRemoteAddr(), tricycleWarningListList); |
|
|
|
|
return ServerResponse.ok(tricycleWarningListList); |
|
|
|
|
return ServerResponse.ok(pageInfo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("/getSquadronVillageList") |
|
|
|
|
@ApiOperation(value = "获取中队绑定村庄列表") |
|
|
|
|
public ServerResponse<?> getSquadronVillageList(@RequestParam String nuserId){ |
|
|
|
|
|
|
|
|
|
List<StreetCommunity> streetCommunityBySquadron = configMapper.getStreetCommunityBySquadron(nuserId); |
|
|
|
|
|
|
|
|
|
return ServerResponse.ok(streetCommunityBySquadron); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("/getWarningDetails") |
|
|
|
|
@ApiOperation(value = "预警处理/分配操作详情页") |
|
|
|
|
public ServerResponse<?> getWarningDetails(@RequestParam String warningId){ |
|
|
|
|
|
|
|
|
|
List<TricycleWarningDetailVO> warningDetails = tricycleService.getWarningDetails(warningId); |
|
|
|
|
|
|
|
|
|
warningDetails.forEach(item ->{ |
|
|
|
|
// 格式化时间
|
|
|
|
|
item.setWarningTimeFormat(dateFormat.format(item.getWarningTime())); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return ServerResponse.ok(warningDetails); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("/submitDistributionStatus") |
|
|
|
|
@ApiOperation(value = "中队民警提交预警分配状态") |
|
|
|
|
public ServerResponse<?> submitDistributionStatus(@RequestParam String warningId, @RequestParam String sqCode){ |
|
|
|
|
|
|
|
|
|
int affectRows = tricycleService.submitDistributionStatus(warningId, sqCode); |
|
|
|
|
if(affectRows > 0){ |
|
|
|
|
// 变更分配状态为已分配
|
|
|
|
|
tricycleService.updateWarningDistributionStatus("1", warningId); |
|
|
|
|
return ServerResponse.ok("提交分配状态成功"); |
|
|
|
|
}else{ |
|
|
|
|
return ServerResponse.error("提交分配状态失败"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@PostMapping("/saveTricycleWarningHandle") |
|
|
|
|
@ApiOperation(value = "提交预警处理内容") |
|
|
|
|
public ServerResponse<?> saveTricycleWarningHandle(@RequestBody TricycleWarningResultsVO resultsVO){ |
|
|
|
|
|
|
|
|
|
int affectRows = tricycleService.saveTricycleWarningHandle(resultsVO); |
|
|
|
|
if(affectRows > 0){ |
|
|
|
|
// 更新数据处理状态为已处理
|
|
|
|
|
tricycleService.updateWarningStatus("1", resultsVO.getWarningId()); |
|
|
|
|
return ServerResponse.ok("提交预警处理数据成功"); |
|
|
|
|
}else{ |
|
|
|
|
return ServerResponse.error("提交预警处理数据失败"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("/getHandleTypeEnum") |
|
|
|
|
@ApiOperation(value = "处理类型字典") |
|
|
|
|
public ServerResponse<?> getHandleTypeEnum(@RequestParam String nuserId){ |
|
|
|
|
int roleFlag = 0; |
|
|
|
|
|
|
|
|
|
List<String> handleType = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
// 权限判断
|
|
|
|
|
List<String> roleById = operatorService.getRoleById(nuserId); |
|
|
|
|
if (!roleById.isEmpty()) { |
|
|
|
|
for (String role : roleById){ |
|
|
|
|
// 村干部权限
|
|
|
|
|
if(RoleEnum.VILLAGE_CADRE.getName().equals(role)){ |
|
|
|
|
roleFlag = 1; |
|
|
|
|
// 中队权限
|
|
|
|
|
}else if(RoleEnum.TRICYCLE_SQUADRON_POLICE_OFFICERS.getName().equals(role)){ |
|
|
|
|
roleFlag = 2; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
return ServerResponse.error("当前用户无权限"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(roleFlag == 1){ |
|
|
|
|
handleType.add(HandleEnum.PUBLICITY_AND_EDUCATION.getName()); |
|
|
|
|
} else if (roleFlag == 2) { |
|
|
|
|
handleType.add(HandleEnum.PUBLICITY_AND_EDUCATION.getName()); |
|
|
|
|
handleType.add(HandleEnum.ILLEGAL_PUNISHMENT.getName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ServerResponse.ok(handleType); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |