package com.sercurityControl.proteam.controller; import com.alibaba.fastjson.JSON; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.securityControl.common.core.utils.aes.Aes; import com.securityControl.common.core.utils.aes.StringHelper; import com.securityControl.common.core.utils.poi.ExcelUtil; 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.vo.DeviceTypeVo; import com.sercurityControl.proteam.domain.vo.DeviceVo; import com.sercurityControl.proteam.domain.vo.ReturnCodeEntity; import com.sercurityControl.proteam.service.DeviceService; import com.sercurityControl.proteam.service.DeviceTypeService; 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.util.HashMap; import java.util.List; import java.util.Map; /** * 设备类型管理控制层 */ @RestController @RequestMapping("/dev/type/") public class DeviceTypeController { @Autowired private DeviceTypeService service; /** * 查询s设备类型列表 * * @param deviceTypeVo * @return */ @PostMapping("getTypeList") @Log(title = "设备类型管理", menu = "设备管理->设备类型管理", businessType = BusinessType.QUERY, details = "设备类型列表", grade = OperationType.QUERY_BUSINESS) public List getTypeList(DeviceTypeVo deviceTypeVo) { List list = service.getTypeList(deviceTypeVo); Map map = new HashMap(16); map.put("code", 200); map.put("msg", "获取成功"); map.put("data", list); return list; } /** * 获取p节点下拉选 * * @param params * @return */ @PostMapping("getPType") public List getPTypeSelected(String params) { try { // String param = Aes.aesDecrypt(params);//解密 if (StringHelper.isNotEmpty(params)) { List list = service.getPTypeSelected(params); return list; } } catch (Exception e) { // log.error(e.toString(),e); } return null; } /** * 新增设备类型 * * @param * @return */ @PostMapping("addDeviceType") @Log(title = "设备类型管理", menu = "设备管理->设备类型管理", businessType = BusinessType.INSERT, details = "新增设备类型", grade = OperationType.ADD_BUSINESS) public ReturnCodeEntity addDeviceType(DeviceTypeVo typeVo) { ReturnCodeEntity entity = new ReturnCodeEntity(); try { // String josn = Aes.aesDecrypt(params); // DeviceTypeVo typeVo = JSON.parseObject(josn, DeviceTypeVo.class);//把json字符串转为实体类 entity = service.addDeviceType(typeVo); } catch (Exception e) { entity.setCode("202"); entity.setMsg("解析异常,请联系管理员"); } return entity; } @PostMapping("updateDeviceType") @Log(title = "设备类型管理", menu = "设备管理->设备类型管理", businessType = BusinessType.UPDATE, details = "修改设备类型", grade = OperationType.UPDATE_BUSINESS) public ReturnCodeEntity updateDeviceType(DeviceTypeVo typeVo) { ReturnCodeEntity entity = new ReturnCodeEntity(); try { // String josn = Aes.aesDecrypt(params); // DeviceTypeVo typeVo = JSON.parseObject(josn, DeviceTypeVo.class);//把json字符串转为实体类 entity = service.updateDeviceType(typeVo); } catch (Exception e) { entity.setCode("202"); entity.setMsg("解析异常,请联系管理员"); } return entity; } /** * 查看详情 * * @param params * @return */ @PostMapping("getDeviceTypeDetail") @Log(title = "设备类型管理", menu = "设备管理->设备类型管理", businessType = BusinessType.QUERY, details = "查看设备类型", grade = OperationType.QUERY_BUSINESS) public DeviceTypeVo getDeviceDetail(String params) { DeviceTypeVo deviceTypeVo = null; try { // String keyId = Aes.aesDecrypt(params); deviceTypeVo = service.getDeviceTypeDetail(params); return deviceTypeVo; } catch (Exception e) { // log.error(e.toString(),e); } return deviceTypeVo; } /** * 删除设备类型 * * @param params * @return */ @PostMapping("deleteType") @Log(title = "设备类型管理", menu = "设备管理->设备类型管理", businessType = BusinessType.DELETE, details = "删除设备类型", grade = OperationType.DELETE_BUSINESS) public ReturnCodeEntity deleteType(String params) { ReturnCodeEntity entity = new ReturnCodeEntity(); try { // String keyId = Aes.aesDecrypt(params); entity = service.deleteType(params); } catch (Exception e) { entity.setCode("202"); entity.setMsg("解析异常,请联系管理员"); } return entity; } }