|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.inspect.access.base.model.RuleCollectionModel; |
|
|
|
import com.inspect.access.base.model.RuleModel; |
|
|
|
import com.inspect.base.core.constant.Constants; |
|
|
|
import com.inspect.base.core.domain.Response; |
|
|
|
import com.inspect.base.core.exception.ServiceException; |
|
|
|
import com.inspect.base.core.sftp.SftpClient; |
|
|
|
@ -51,10 +52,7 @@ import com.inspect.system.base.domain.SysDictData; |
|
|
|
|
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.sql.SQLIntegrityConstraintViolationException; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
@ -235,7 +233,12 @@ public class PatrolPresetPosController extends BaseController { |
|
|
|
@GetMapping({"issue"}) |
|
|
|
public AjaxResult issue(PresetAccessModel presetAccessModel) throws Exception { |
|
|
|
presetAccessModel.setCommand(PresetControlEnum.SET); |
|
|
|
String presetIndex = this.controlPresetAdd(presetAccessModel); |
|
|
|
String presetIndex = null; |
|
|
|
try { |
|
|
|
presetIndex = this.controlPresetAdd(presetAccessModel); |
|
|
|
} catch (ServiceException e) { |
|
|
|
return AjaxResult.error(e.getMessage()); |
|
|
|
} |
|
|
|
if (null != presetIndex) { |
|
|
|
presetAccessModel.setPreset(presetIndex); |
|
|
|
presetAccessModel.setPresetCode(presetIndex); |
|
|
|
@ -303,7 +306,7 @@ public class PatrolPresetPosController extends BaseController { |
|
|
|
HttpClientUtils.get(this.deviceUrl + AccessApiConstant.PRESET_POINT_CONTROL, params); |
|
|
|
} |
|
|
|
|
|
|
|
private String controlPresetAdd(PresetAccessModel presetAccessModel) throws Exception { |
|
|
|
private String controlPresetAdd(PresetAccessModel presetAccessModel) throws ServiceException { |
|
|
|
String presetIndex = null; |
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
jsonObject.put("code", presetAccessModel.getCode()); |
|
|
|
@ -313,6 +316,10 @@ public class PatrolPresetPosController extends BaseController { |
|
|
|
jsonObject.put("channelCode", presetAccessModel.getChannelCode()); |
|
|
|
Response presetIndexRet = this.ivsFeignService.preset(jsonObject); |
|
|
|
JSONObject ivsPresetInfo = (JSONObject) JSONObject.toJSON(presetIndexRet); |
|
|
|
logger.info("ivsPresetInfo:{}", ivsPresetInfo.toString()); |
|
|
|
if (!Objects.equals(ivsPresetInfo.getInteger("code"), Constants.SUCCESS)) { |
|
|
|
throw new ServiceException(ivsPresetInfo.getString("msg")); |
|
|
|
} |
|
|
|
JSONObject resultJson = (JSONObject) ivsPresetInfo.get("data"); |
|
|
|
if (null != resultJson) { |
|
|
|
presetIndex = resultJson.getInteger("presetIndex") == null ? null : String.valueOf(resultJson.getInteger("presetIndex")); |
|
|
|
|