129 lines
4.7 KiB
Plaintext
129 lines
4.7 KiB
Plaintext
|
|
package com.sercurityControl.proteam.dutyTask.controller;
|
||
|
|
|
||
|
|
import com.github.pagehelper.PageHelper;
|
||
|
|
import com.github.pagehelper.PageInfo;
|
||
|
|
import com.securityControl.common.core.utils.StringUtils;
|
||
|
|
import com.securityControl.common.core.utils.aes.DateTimeHelper;
|
||
|
|
import com.securityControl.common.core.utils.aes.StringHelper;
|
||
|
|
import com.securityControl.common.core.web.domain.AjaxResult;
|
||
|
|
import com.securityControl.common.log.annotation.Log;
|
||
|
|
import com.securityControl.common.log.enums.BusinessType;
|
||
|
|
import com.securityControl.common.security.utils.SecurityUtils;
|
||
|
|
import com.sercurityControl.proteam.domain.ty.MqImageVo;
|
||
|
|
import com.sercurityControl.proteam.domain.vo.DeviceVo;
|
||
|
|
import com.sercurityControl.proteam.dutyTask.domain.VoiWarnEntity;
|
||
|
|
import com.sercurityControl.proteam.dutyTask.service.VoiPhotoLibraryService;
|
||
|
|
import lombok.Data;
|
||
|
|
import lombok.extern.slf4j.Slf4j;
|
||
|
|
import org.slf4j.Logger;
|
||
|
|
import org.slf4j.LoggerFactory;
|
||
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
|
||
|
|
import javax.annotation.Resource;
|
||
|
|
import java.text.SimpleDateFormat;
|
||
|
|
import java.util.*;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 违章照片库-控制层
|
||
|
|
*/
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/pot/voiPhotoLibrary/")
|
||
|
|
@Slf4j
|
||
|
|
public class VoiPhotoLibraryController {
|
||
|
|
|
||
|
|
Logger logger = LoggerFactory.getLogger(VoiPhotoLibraryController.class);
|
||
|
|
|
||
|
|
@Resource(name = "VoiPhotoLibraryService")
|
||
|
|
private VoiPhotoLibraryService service;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return java.util.Map<java.lang.String, java.lang.Object>
|
||
|
|
* @author cw chen
|
||
|
|
* @description 违章库照片
|
||
|
|
* @Param params
|
||
|
|
* @Param page
|
||
|
|
* @Param limit
|
||
|
|
* @date 2022-12-26 14:10
|
||
|
|
*/
|
||
|
|
@PostMapping(value = "getVoiPhotoLibraryList")
|
||
|
|
@Log(title = "违章库照片", menu = "违章照片库", businessType = BusinessType.QUERY, details = "违章库照片列表")
|
||
|
|
public Map<String, Object> getVoiPhotoLibraryList(VoiWarnEntity entity) {
|
||
|
|
if (StringHelper.isEmpty(entity.getCreateTime())){
|
||
|
|
entity.setStartTime(DateTimeHelper.getNowDay());
|
||
|
|
entity.setEndTime(DateTimeHelper.getNowDay());
|
||
|
|
}else{
|
||
|
|
String[] dateArr = entity.getCreateTime().split(" - ");
|
||
|
|
entity.setStartTime(dateArr[0]);
|
||
|
|
entity.setEndTime(dateArr[1]);
|
||
|
|
}
|
||
|
|
|
||
|
|
Map<String, Object> map = new HashMap<String, Object>(6);
|
||
|
|
try {
|
||
|
|
PageInfo<MqImageVo> pageInfo = service.getWzList(entity);
|
||
|
|
map.put("code", 200);
|
||
|
|
map.put("msg", "获取数据成功");
|
||
|
|
map.put("count", pageInfo.getTotal());
|
||
|
|
map.put("curr", Integer.parseInt(entity.getPage()));
|
||
|
|
map.put("limit", Integer.parseInt(entity.getLimit()));
|
||
|
|
map.put("data", pageInfo.getList());
|
||
|
|
} catch (Exception e) {
|
||
|
|
map.put("code", 500);
|
||
|
|
map.put("msg", "获取数据失败");
|
||
|
|
map.put("count", 0);
|
||
|
|
map.put("curr", Integer.parseInt(entity.getPage()));
|
||
|
|
map.put("limit", Integer.parseInt(entity.getLimit()));
|
||
|
|
map.put("data", null);
|
||
|
|
logger.error("数据获取失败", e);
|
||
|
|
}
|
||
|
|
return map;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return com.securityControl.common.core.web.domain.AjaxResult
|
||
|
|
* @author cw chen
|
||
|
|
* @description 确认违章库照片
|
||
|
|
* @Param params
|
||
|
|
* @date 2022-12-26 18:22
|
||
|
|
*/
|
||
|
|
@PostMapping(value = "confirmVoiImg")
|
||
|
|
@Log(title = "违章库照片", menu = "违章照片库", businessType = BusinessType.QUERY, details = "违章照片确认")
|
||
|
|
public AjaxResult confirmVoiImg(VoiWarnEntity entity) {
|
||
|
|
String code="200";
|
||
|
|
try {
|
||
|
|
entity.setIsTime(DateTimeHelper.getNowTime());
|
||
|
|
entity.setUserId(SecurityUtils.getUserId() + "");
|
||
|
|
String msg=service.confirmVoiImg(entity);
|
||
|
|
if(code.equals(msg)){
|
||
|
|
return AjaxResult.success("success");
|
||
|
|
}
|
||
|
|
return AjaxResult.error(msg);
|
||
|
|
|
||
|
|
} catch (Exception e) {
|
||
|
|
logger.error("更新失败", e);
|
||
|
|
return AjaxResult.error("服务异常,请稍后重试");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
@PostMapping(value = "deleteImage")
|
||
|
|
public AjaxResult deleteImage(VoiWarnEntity entity) {
|
||
|
|
try{
|
||
|
|
service.deleteImage(entity);
|
||
|
|
return AjaxResult.success("删除成功");
|
||
|
|
}catch (Exception e){
|
||
|
|
return AjaxResult.error("删除失败");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
@PostMapping(value = "deleteTicket")
|
||
|
|
public AjaxResult deleteTicket(VoiWarnEntity entity) {
|
||
|
|
try{
|
||
|
|
service.deleteTicket(entity);
|
||
|
|
return AjaxResult.success("删除成功");
|
||
|
|
}catch (Exception e){
|
||
|
|
return AjaxResult.error("删除失败");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|