1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- package com.fdkankan.manage.controller;
- import cn.dev33.satoken.stp.StpUtil;
- import com.fdkankan.manage.common.ResultCode;
- import com.fdkankan.manage.common.ResultData;
- import com.fdkankan.manage.entity.AgentAudit;
- import com.fdkankan.manage.entity.Camera;
- import com.fdkankan.manage.entity.RtkInfo;
- import com.fdkankan.manage.exception.BusinessException;
- import com.fdkankan.manage.service.IAgentAuditService;
- import com.fdkankan.manage.service.ICameraService;
- import com.fdkankan.manage.service.IRtkInfoService;
- import com.fdkankan.manage.vo.request.AgentAuditListParam;
- import com.fdkankan.manage.vo.request.RtkInfoParam;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- /**
- * 经销商申请管理
- * @author
- * @since 2022-09-21
- */
- @RestController
- @RequestMapping("/service/manage/rtkInfo")
- public class RtkInfoController {
- @Autowired
- IRtkInfoService rtkInfoService;
- @Autowired
- ICameraService cameraService;
- @PostMapping("/list")
- public ResultData list(@RequestBody RtkInfoParam param){
- return ResultData.ok(rtkInfoService.pageList(param));
- }
- @PostMapping("/saveOrEdit")
- public ResultData saveOrEdit(@RequestBody RtkInfo rtkInfo){
- if(rtkInfo.getId() == null){
- rtkInfo.setCreateUserId(Long.valueOf((String)StpUtil.getLoginId()));
- }else {
- rtkInfo.setUpdateUserId(Long.valueOf((String)StpUtil.getLoginId()));
- }
- if(rtkInfo.getRtkType() == null || StringUtils.isBlank(rtkInfo.getCameraSnCode())){
- throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
- }
- if(rtkInfo.getRtkType() == 0){
- rtkInfo.setIpAddr(null);
- rtkInfo.setMountPoint(null);
- rtkInfo.setPort(null);
- rtkInfo.setUserName(null);
- rtkInfo.setPassword(null);
- rtkInfo.setOperator(null);
- }
- Camera camera = cameraService.getBySnCode(rtkInfo.getCameraSnCode());
- if(camera == null){
- throw new BusinessException(ResultCode.CAMERA_NOT_EXIST);
- }
- rtkInfoService.saveOrEdit(rtkInfo);
- return ResultData.ok();
- }
- @PostMapping("/del")
- public ResultData del(@RequestBody RtkInfo rtkInfo){
- rtkInfoService.del(rtkInfo);
- return ResultData.ok();
- }
- }
|