|
|
@ -12,10 +12,7 @@ import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
|
import com.epmet.plugin.commons.redis.RedisKeys; |
|
|
|
import com.epmet.plugin.power.config.DhCloudProperties; |
|
|
|
import com.epmet.plugin.power.dto.visit.DhTokenDTO; |
|
|
|
import com.epmet.plugin.power.dto.visit.form.DhAuthFormDTO; |
|
|
|
import com.epmet.plugin.power.dto.visit.form.DhPersonCardFormDTO; |
|
|
|
import com.epmet.plugin.power.dto.visit.form.DhPersonFormDTO; |
|
|
|
import com.epmet.plugin.power.dto.visit.form.DhPersonImgFormDTO; |
|
|
|
import com.epmet.plugin.power.dto.visit.form.*; |
|
|
|
import com.epmet.plugin.power.dto.visit.result.DhChannelResultDTO; |
|
|
|
import net.coobird.thumbnailator.Thumbnails; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -133,7 +130,7 @@ public class DhDeviceUtil { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询部门列表 |
|
|
|
* 新增部门 |
|
|
|
* |
|
|
|
* @param |
|
|
|
* @return java.lang.String |
|
|
@ -146,8 +143,11 @@ public class DhDeviceUtil { |
|
|
|
url = url + urlParam; |
|
|
|
|
|
|
|
Map<String, String> paramsMap = new HashMap<>(4); |
|
|
|
DhDeptFormDTO dto = new DhDeptFormDTO(); |
|
|
|
dto.setName("访客部门"); |
|
|
|
dto.setParentId(1L); |
|
|
|
|
|
|
|
String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, StringUtils.EMPTY, paramsMap).getData(); |
|
|
|
String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); |
|
|
|
|
|
|
|
if (null == data) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询部门列表失败"); |
|
|
@ -162,11 +162,15 @@ public class DhDeviceUtil { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询部门列表失败"); |
|
|
|
} |
|
|
|
Object registerResult = result.getData(); |
|
|
|
JSONArray jsonArray = JSON.parseArray(registerResult.toString()); |
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(0); |
|
|
|
JSONObject jsonObject = JSON.parseObject(registerResult.toString()); |
|
|
|
if (null != jsonObject) { |
|
|
|
return Long.parseLong(jsonObject.get("deptId").toString()); |
|
|
|
return Long.parseLong(jsonObject.toString()); |
|
|
|
} |
|
|
|
// JSONArray jsonArray = JSON.parseArray(registerResult.toString());
|
|
|
|
// JSONObject jsonObject = jsonArray.getJSONObject(0);
|
|
|
|
// if (null != jsonObject) {
|
|
|
|
// return Long.parseLong(jsonObject.get("deptId").toString());
|
|
|
|
// }
|
|
|
|
return 0L; |
|
|
|
} |
|
|
|
|
|
|
@ -184,8 +188,13 @@ public class DhDeviceUtil { |
|
|
|
url = url + urlParam; |
|
|
|
|
|
|
|
Map<String, String> paramsMap = new HashMap<>(4); |
|
|
|
DhIdentityFormDTO dto = new DhIdentityFormDTO(); |
|
|
|
dto.setName("访客"); |
|
|
|
dto.setSubsidyAmount(0D); |
|
|
|
dto.setIsCashRecharge(1); |
|
|
|
dto.setIsMachineRecharge(1); |
|
|
|
|
|
|
|
String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, StringUtils.EMPTY, paramsMap).getData(); |
|
|
|
String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); |
|
|
|
|
|
|
|
if (null == data) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取身份列表失败"); |
|
|
@ -209,21 +218,25 @@ public class DhDeviceUtil { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询开门计划 |
|
|
|
* 新增开门计划 |
|
|
|
* |
|
|
|
* @param |
|
|
|
* @return java.lang.String |
|
|
|
* @author zhy |
|
|
|
* @date 2022/5/23 11:04 |
|
|
|
*/ |
|
|
|
public String getPlan() { |
|
|
|
public Long getPlan() { |
|
|
|
String url = dhCloudProperties.getUrl().concat(GET_DOOR_PLAN); |
|
|
|
String urlParam = getDhUrlParams(); |
|
|
|
url = url + urlParam; |
|
|
|
|
|
|
|
Map<String, String> paramsMap = new HashMap<>(4); |
|
|
|
DhPlanFormDTO dto = new DhPlanFormDTO(); |
|
|
|
dto.setDetail("{\\\"monday\\\":[\\\"00:00-23:59\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\"],\\\"tuesday\\\":[\\\"00:00-23:59\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\"],\\\"wednesday\\\":[\\\"00:00-23:59\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\"],\\\"thursday\\\":[\\\"00:00-23:59\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\"],\\\"friday\\\":[\\\"00:00-23:59\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\"],\\\"saturday\\\":[\\\"00:00-23:59\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\"],\\\"sunday\\\":[\\\"00:00-23:59\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\",\\\"00:00-00:00\\\"]}"); |
|
|
|
dto.setName("访客计划"); |
|
|
|
dto.setType(1); |
|
|
|
|
|
|
|
String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, StringUtils.EMPTY, paramsMap).getData(); |
|
|
|
String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); |
|
|
|
|
|
|
|
if (null == data) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询开门计划失败"); |
|
|
@ -238,12 +251,16 @@ public class DhDeviceUtil { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询开门计划失败"); |
|
|
|
} |
|
|
|
Object registerResult = result.getData(); |
|
|
|
JSONArray jsonArray = JSON.parseArray(registerResult.toString()); |
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(0); |
|
|
|
JSONObject jsonObject = JSON.parseObject(registerResult.toString()); |
|
|
|
if (null != jsonObject) { |
|
|
|
return jsonObject.get("id").toString(); |
|
|
|
return Long.parseLong(jsonObject.toString()); |
|
|
|
} |
|
|
|
return ""; |
|
|
|
// JSONArray jsonArray = JSON.parseArray(registerResult.toString());
|
|
|
|
// JSONObject jsonObject = jsonArray.getJSONObject(0);
|
|
|
|
// if (null != jsonObject) {
|
|
|
|
// return jsonObject.get("id").toString();
|
|
|
|
// }
|
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -260,8 +277,11 @@ public class DhDeviceUtil { |
|
|
|
url = url + urlParam; |
|
|
|
|
|
|
|
Map<String, String> paramsMap = new HashMap<>(4); |
|
|
|
DhChannelFormDTO dto = new DhChannelFormDTO(); |
|
|
|
dto.setPageSize(1000); |
|
|
|
dto.setPageSize(1); |
|
|
|
|
|
|
|
String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, StringUtils.EMPTY, paramsMap).getData(); |
|
|
|
String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); |
|
|
|
|
|
|
|
if (null == data) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询通道列表失败"); |
|
|
@ -449,7 +469,7 @@ public class DhDeviceUtil { |
|
|
|
public String addPersonAuth(DhPersonFormDTO dto, String imgUrl) { |
|
|
|
String personCard = addPersonCard(dto); |
|
|
|
List<DhChannelResultDTO> channel = getChannel(); |
|
|
|
String plan = getPlan(); |
|
|
|
Long plan = getPlan(); |
|
|
|
|
|
|
|
if (StringUtils.isBlank(personCard)) { |
|
|
|
return "开卡失败"; |
|
|
@ -459,7 +479,7 @@ public class DhDeviceUtil { |
|
|
|
if (channel.isEmpty()) { |
|
|
|
return "获取通道失败"; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(plan)) { |
|
|
|
if (plan == null) { |
|
|
|
return "获取开门计划失败"; |
|
|
|
} |
|
|
|
DhAuthFormDTO authFormDTO = new DhAuthFormDTO(); |
|
|
@ -468,7 +488,7 @@ public class DhDeviceUtil { |
|
|
|
url = url + urlParam; |
|
|
|
|
|
|
|
authFormDTO.setCardNumber(personCard); |
|
|
|
authFormDTO.setTimeQuantumId(plan); |
|
|
|
authFormDTO.setTimeQuantumId(plan.toString()); |
|
|
|
authFormDTO.setCardPrivilegeDetails(channel); |
|
|
|
|
|
|
|
Map<String, String> paramsMap = new HashMap<>(4); |
|
|
|