IntelligentRecognition/ah-jjsp-service/.svn/pristine/b5/b5a4f40c22c4b418fa3117d7938...

304 lines
9.7 KiB
Plaintext
Raw Normal View History

2024-05-24 16:09:40 +08:00
package com.sercurityControl.proteam.controller;
import com.securityControl.common.core.web.controller.BaseController;
import com.securityControl.common.core.web.domain.AjaxResult;
import com.securityControl.common.core.web.page.TableDataInfo;
import com.securityControl.common.log.annotation.Log;
import com.securityControl.common.log.enums.BusinessType;
import com.securityControl.common.log.enums.OperationType;
import com.sercurityControl.proteam.domain.EarlyEntity;
import com.sercurityControl.proteam.domain.vo.UserHandleVo;
import com.sercurityControl.proteam.service.EarlyService;
import com.sercurityControl.proteam.util.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author bonus
* @data 2022/12/8 9:39
* @description 班组
*/
@Api(tags = "班组信息")
@Slf4j
@RestController
@RequestMapping("/pot/early")
public class EarlyController extends BaseController {
@Autowired
private EarlyService service;
/**
* 今日无施工
*
* @param entity 实体类
* @return 集合
*/
@ApiOperation(value = "获取数量")
@PostMapping("/getEarlyNum")
@Log(title = "预警管理", menu = "预警管理->获取数量", businessType = BusinessType.QUERY, details = "获取数量", grade = OperationType.QUERY_BUSINESS)
public AjaxResult getEarlyNum(EarlyEntity entity) {
return service.getEarlyNum(entity);
}
/**
* 今日无施工
*
* @param entity 实体类
* @return 集合
*/
@ApiOperation(value = "今日无施工")
@PostMapping("/getNoWorkByDay")
@Log(title = "预警管理", menu = "预警管理->今日无施工", businessType = BusinessType.QUERY, details = "今日无施工", grade = OperationType.QUERY_BUSINESS)
public TableDataInfo getNoWorkByDay(EarlyEntity entity) {
startPage();
try {
return getDataTable(service.getNoWorkByDay(entity));
} catch (Exception e) {
log.error(e.toString(),e);
return getDataTable(new ArrayList<>());
}
}
/**
* 新进班组
*
* @param entity 实体类
* @return 集合
*/
@ApiOperation(value = "新进班组")
@PostMapping("/getNewTeam")
@Log(title = "预警管理", menu = "预警管理->新进班组", businessType = BusinessType.QUERY, details = "新进班组", grade = OperationType.QUERY_BUSINESS)
public TableDataInfo getNewTeam(EarlyEntity entity) {
startPage();
try {
return getDataTable(service.getNewTeam(entity));
} catch (Exception e) {
log.error(e.toString(),e);
return getDataTable(new ArrayList<>());
}
}
/**
* 七日无施工
*
* @param entity 实体类
* @return 集合
*/
@ApiOperation(value = "七日无施工")
@PostMapping("/getNoWorkBySeven")
@Log(title = "预警管理", menu = "预警管理->七日无施工", businessType = BusinessType.QUERY, details = "新进班组", grade = OperationType.QUERY_BUSINESS)
public TableDataInfo getNoWorkBySeven(EarlyEntity entity) {
startPage();
try {
return getDataTable(service.getNoWorkBySeven(entity));
} catch (Exception e) {
log.error(e.toString(),e);
return getDataTable(new ArrayList<>());
}
}
/**
* 重点关注
*
* @param entity 实体类
* @return 集合
*/
@ApiOperation(value = "重点关注")
@PostMapping("/getFocusWork")
@Log(title = "预警管理", menu = "预警管理->重点关注", businessType = BusinessType.QUERY, details = "新进班组", grade = OperationType.QUERY_BUSINESS)
public TableDataInfo getFocusWork(EarlyEntity entity) {
startPage();
try {
return getDataTable(service.getFocusWork(entity));
} catch (Exception e) {
log.error(e.toString(),e);
return getDataTable(new ArrayList<>());
}
}
/**
* 作业类型,工序变化
*
* @param entity 实体类
* @return 集合
*/
@ApiOperation(value = "作业类型,工序变化")
@PostMapping("/getTeamByWork")
@Log(title = "预警管理", menu = "预警管理->重点关注", businessType = BusinessType.QUERY, details = "新进班组", grade = OperationType.QUERY_BUSINESS)
public TableDataInfo getTeamByWork(EarlyEntity entity) {
startPage();
try {
return getDataTable(service.getTeamByWork(entity));
} catch (Exception e) {
log.error(e.toString(),e);
return getDataTable(new ArrayList<>());
}
}
/**
* 作业类型,工序变化
*
* @param entity 实体类
* @return 集合
*/
@ApiOperation(value = "作业类型,工序变化")
@PostMapping("/getTeamByJob")
@Log(title = "预警管理", menu = "预警管理->重点关注", businessType = BusinessType.QUERY, details = "新进班组", grade = OperationType.QUERY_BUSINESS)
public TableDataInfo getTeamByJob(EarlyEntity entity) {
startPage();
try {
return getDataTable(service.getTeamByJob(entity));
} catch (Exception e) {
log.error(e.toString(),e);
return getDataTable(new ArrayList<>());
}
}
/**
* 球机异常
*
* @param entity 实体类
* @return 集合
*/
@ApiOperation(value = "球机异常")
@PostMapping("/getBallByUnusual")
@Log(title = "预警管理", menu = "预警管理->球机异常", businessType = BusinessType.QUERY, details = "新进班组", grade = OperationType.QUERY_BUSINESS)
public TableDataInfo getBallByUnusual(EarlyEntity entity) {
startPage();
try {
return getDataTable(service.getBallByUnusual(entity));
} catch (Exception e) {
log.error(e.toString(),e);
return getDataTable(new ArrayList<>());
}
}
/**
* 球机异常
*
* @param entity 实体类
* @return 集合
*/
@ApiOperation(value = "球机异常")
@GetMapping("/exportToExcel")
@Log(title = "预警管理", menu = "预警管理->球机异常", businessType = BusinessType.QUERY, details = "新进班组", grade = OperationType.QUERY_BUSINESS)
public void exportToExcel(HttpServletResponse response, EarlyEntity entity) {
try {
Workbook workbook = service.exportToExcel(entity);
String fileName = "结果表.xlsx";
OutputStream output = response.getOutputStream();
fileName = URLEncoder.encode(fileName, "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ";" + "filename*=utf-8''" + fileName);
workbook.write(output);
output.close();
} catch (Exception e) {
log.error(e.toString(),e);
e.printStackTrace();
}
}
/**
* 球机异常
*
* @param entity 实体类
* @return 集合
*/
@ApiOperation(value = "人数变化大")
@PostMapping("/getTeamByPer")
@Log(title = "预警管理", menu = "预警管理->人数变化大", businessType = BusinessType.QUERY, details = "人数变化大", grade = OperationType.QUERY_BUSINESS)
public TableDataInfo getTeamByPer(EarlyEntity entity) {
startPage();
try {
return getDataTable(service.getTeamByPer(entity));
} catch (Exception e) {
log.error(e.toString(),e);
return getDataTable(new ArrayList<>());
}
}
/**
* 获取当日预警全部信息
* @param entity
* @return
*/
@PostMapping("/getTodayWarnInfo")
public AjaxResult getTodayWarnInfo(EarlyEntity entity) {
try {
Map<String,Object> map=service.getTodayWarnInfo(entity);
return AjaxResult.success(map);
} catch (Exception e) {
log.error(e.toString(),e);
}
return AjaxResult.success(new ArrayList<>());
}
/**
* @return com.securityControl.common.core.web.page.TableDataInfo
* @author cw chen
* @description 球机信号
* @Param entity
* @date 2023-03-28 16:09
*/
@ApiOperation(value = "球机信号")
@PostMapping("/getBallSignal")
@Log(title = "预警管理", menu = "预警管理->球机信号", businessType = BusinessType.QUERY, details = "球机信号", grade = OperationType.QUERY_BUSINESS)
public TableDataInfo getBallSignal(EarlyEntity entity) {
startPage();
try {
return getDataTable(service.getBallSignal(entity));
} catch (Exception e) {
return getDataTable(new ArrayList<>());
}
}
/**
* 修改班组人员忽略状态
*
* @param entity 条件
* @return json
*/
@ApiOperation(value = "球机信号")
@PostMapping("/updateFzrData")
public AjaxResult updateFzrData(EarlyEntity entity) {
return service.updateFzrData(entity);
}
/**
* 添加告警处置功能
* @return
*/
@PostMapping("/addUserHandel")
public AjaxResult addUserHandel(UserHandleVo userHandleVo){
return service.addUserHandel(userHandleVo);
}
}