Commit 41492635 authored by 赵啸非's avatar 赵啸非

Merge branch 'master' into reg

# Conflicts:
#	device-manager/src/main/java/com/mortals/xhx/base/framework/interceptor/AuthTokenServiceImpl.java
parents b6abc1ed d3b25345
package com.mortals.xhx.feign;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.pdu.DeviceReq;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* 设备 Feign接口
*
* @author zxfei
* @date 2023-02-25
*/
@FeignClient(name = "info-publish-manager", path = "/infopublish", fallbackFactory = InfoDeviceFeignFallbackFactory.class)
public interface IInfoPublishDeviceFeign extends IFeign {
/**
* 设备回调
*
* @param deviceReq
* @return
*/
@PostMapping(value = "/api/device/callback")
Rest<String> deviceCall(@RequestBody DeviceReq deviceReq);
}
@Slf4j
@Component
class InfoDeviceFeignFallbackFactory implements FallbackFactory<IInfoPublishDeviceFeign> {
@Override
public IInfoPublishDeviceFeign create(Throwable t) {
return new IInfoPublishDeviceFeign() {
@Override
public Rest<String> deviceCall(DeviceReq deviceReq) {
return Rest.fail();
}
};
}
}
......@@ -53,6 +53,9 @@
],
// 表单校验
rules: {
productId: [
{required: true,message: "请选择产品", trigger: "blur" },
],
imageResolution: [
{required: true,message: "请输入分辨率", trigger: "blur" },
{max: 256,message: "最多只能录入256个字符",trigger: "blur",},
......
......@@ -191,6 +191,9 @@ export default {
rules: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
url: [
{required: true, message: '地址不能为空', trigger: 'blur'}
]
},
};
},
......
......@@ -89,6 +89,9 @@ export default {
rules: {
name: [
{ required: true, message: '请输入名称', trigger: 'blur' },
],
url: [
{required: true, message: '地址不能为空', trigger: 'blur'}
]
},
}
......
......@@ -202,7 +202,7 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
public void verifyToken(IUser user) {
long expireTime = user.getExpireTime();
long currentTime = System.currentTimeMillis();
if (expireTime - currentTime <= SECOND_MINUTE_TEN * 1000) {
if (expireTime - currentTime <= SECOND_MINUTE_TEN*1000) {
log.info("不足十分钟,刷新过期时间");
refreshToken(user);
}
......
......@@ -151,7 +151,7 @@ public class MessageServiceImpl implements MessageService{
Map<String, String> header = new HashMap<>();
header.put(HEADER_CONTENT_TYPE, "application/json");
log.info("\n thirdPartyUrl=>{} \n reqbody=>{} \n type=>{}", sendUrl, JSON.toJSONString(deviceReqApiReq, SerializerFeature.WriteMapNullValue), DeviceMethodEnum.getByValue(deviceReq.getDeviceStatus()).getDesc());
resp = HttpUtil.doPost(sendUrl, header, JSON.toJSONString(deviceReqApiReq, SerializerFeature.WriteMapNullValue));
resp = HttpUtil.doPost(sendUrl, header, JSON.toJSONString(deviceReqApiReq, SerializerFeature.WriteMapNullValue),"UTF-8", 10000);
return JSON.parseObject(resp, ApiResp.class);
} catch (Exception e) {
log.error("异常:", e);
......
......@@ -256,12 +256,12 @@ public class DeviceApiController {
SendThirdPartyTask sendThirdPartyTask = new SendThirdPartyTask(deviceEntity, productEntity, platformEntity, deviceService);
sendTaskThreadPool.execute(sendThirdPartyTask);
} catch (AppException e) {
log.error("接收数据失败", e);
//log.error("接收数据失败", e);
rsp.setCode(e.getCode());
rsp.setMsg(e.getMessage());
return JSON.toJSONString(rsp);
} catch (Exception e) {
log.error("接收数据失败", e);
log.error("接收数据异常", e);
rsp.setCode(ApiRespCodeEnum.FAILED.getValue());
rsp.setMsg(e.getMessage());
return JSON.toJSONString(rsp);
......@@ -799,6 +799,7 @@ public class DeviceApiController {
* @return
*/
@PostMapping("receive")
@UnAuth
public String receive(HttpServletRequest request, @RequestBody DeviceReq req) {
log.info("【设备接收】【请求体】--> " + JSONObject.toJSONString(req));
ApiResp<String> rsp = new ApiResp<>();
......
......@@ -30,7 +30,7 @@ public class AlarmSmsSendController extends BaseCRUDJsonBodyMappingController<Al
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "sendStatus", paramService.getParamBySecondOrganize("AlarmSmsSend","sendStatus"));
this.addDict(model, "sendStatus", paramService.getParamBySecondOrganize("AlarmSmsSend","sendStatus"));
super.init(model, context);
}
......
......@@ -27,8 +27,6 @@ public class DeviceVo extends BaseEntityLong {
private String platformCode;
/**
* 是否通知第三方
*/
......
......@@ -60,6 +60,7 @@ public class DeviceAlarmInfoServiceImpl extends AbstractCRUDServiceImpl<DeviceAl
if (rest.getCode() == YesNoEnum.NO.getValue()) {
return Rest.fail("获取站点列表异常!");
}
if(ObjectUtils.isEmpty(rest.getData())) return Rest.fail("站点列表数据为空!");
Map<Long, SitePdu> siteMap = rest.getData().stream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
Map<Long, FirmEntity> FirmMap = firmService.findToMap(new FirmEntity(), context);
......
......@@ -23,6 +23,7 @@ import com.mortals.xhx.common.pdu.DeviceReq;
import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.feign.IFillDeviceFeign;
import com.mortals.xhx.feign.IInfoPublishDeviceFeign;
import com.mortals.xhx.feign.IOfficeDeviceFeign;
import com.mortals.xhx.feign.ISampleDeviceFeign;
import com.mortals.xhx.feign.site.ISiteFeign;
......@@ -92,6 +93,9 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
@Autowired
private IFillDeviceFeign fillDeviceFeign;
@Autowired
private IInfoPublishDeviceFeign infoPublishDeviceFeign;
@Value("${thirdPartyPath:/inter/device/deviceIn}")
private String thirdPartyPath;
......@@ -391,6 +395,14 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
Rest<String> sampleRest = sampleDeviceFeign.deviceCall(deviceReq);
log.info("sample resp ==>{}", JSON.toJSONString(sampleRest));
}
if ("xxgk".equals(platformEntity.getPlatformSn())) {
deviceReq.setReceiveMethod(update.getValue());
//调用样表系统系统
Rest<String> sampleRest = infoPublishDeviceFeign.deviceCall(deviceReq);
log.info("info publish resp ==>{}", JSON.toJSONString(sampleRest));
}
if ("tdxt".equals(platformEntity.getPlatformSn())) {
deviceReq.setReceiveMethod(update.getValue());
//调用样表系统系统
......
......@@ -64,6 +64,9 @@ spring:
exceptiontranslation:
enabled: false
datasource:
druid:
connect-timeout: 30000
socket-timeout: 60000
type: com.alibaba.druid.pool.DruidDataSource
#driver-class-name: com.p6spy.engine.spy.P6SpyDriver
driver-class-name: com.mysql.cj.jdbc.Driver
......
package com.mortals.httpclient;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @author: zxfei
......@@ -18,5 +26,61 @@ public class Test {
// byte[] result = clipher.doFinal(plainText.getBytes());
// System.out.println(Base64.encodeBase64URLSafeString(result));
String sql = "";
ArrayList<Map<String, String>> deviceList = new ArrayList<>();
HashMap<String, String> map = new HashMap<>();
map.put("排队机", "C0-FB-F9-CD-3B-A4");
deviceList.add(map);
map = new HashMap<>();
map.put("评价器", "0c-cf-89-09-d1-c8");
deviceList.add(map);
map = new HashMap<>();
map.put("集中显示屏", "5E-93-5B-4B-94-67");
deviceList.add(map);
map = new HashMap<>();
map.put("呼叫器", "0c-cf-89-42-8e-b8");
deviceList.add(map);
map = new HashMap<>();
map.put("呼叫器", "a0-9f-10-5a-aa-44");
deviceList.add(map);
map = new HashMap<>();
map.put("窗口屏", "18-9F-BC-EE-E0-87");
deviceList.add(map);
map = new HashMap<>();
map.put("会议室电子门牌", "2A-9A-30-3A-BD-C6");
deviceList.add(map);
map = new HashMap<>();
map.put("电子门牌", "42-72-FF-54-87-8D");
deviceList.add(map);
map = new HashMap<>();
map.put("信息发布屏", "30-1F-9A-62-5E-D7");
deviceList.add(map);
for (int i = 0; i < 300; i++) {
int randomDeviceInt = RandomUtil.randomInt(0, deviceList.size());
Map<String, String> deviceMap = deviceList.get(randomDeviceInt);
deviceMap.entrySet().stream().forEach(item -> {
String format = String.format("【设备】当前%s设备,编码%s离线,请注意!", item.getKey(), item.getValue());
String dateStr = DateUtil.formatDateTime(RandomUtil.randomDate(DateUtil.offsetDay(new Date(),-4), DateField.HOUR, 1, 100).toJdkDate());
String insertsql = String.format("INSERT INTO `mortals_xhx_alarm_sms_send`(`id`, `mobile`, `receiver`, `sendMess`, `sendStatus`, `sendTime`, `siteId`, `createTime`, `updateUserId`, `updateTime`) VALUES (null, '13808095770', '文浩臣', '%s', 2, '%s', 1, '%s', NULL, NULL);", format, dateStr, dateStr);
System.out.println(insertsql);
});
}
}
}
......@@ -14,14 +14,14 @@ client.global.set("authToken", JSON.parse(response.body).data.token);
%}
###设备统计列表
POST {{baseUrl}}/device/stat/list
POST {{baseUrl}}/device/stat/interlist
Content-Type: application/json
{
"page":1,
"size":10,
"siteId": 1,
"selected": 4
"selected": 1
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment