Commit 7f7d0d5a authored by 赵啸非's avatar 赵啸非

添加批量激活设备

parent 64515fa9
...@@ -275,13 +275,12 @@ export default { ...@@ -275,13 +275,12 @@ export default {
}, },
onSubmit() { onSubmit() {
let { path, query } = this.$route; let { path, query } = this.$route;
let data = this.decode(this.form); let data = this.decode(this.form);
this.$router.push({ this.$router.push({
path: path, path: path,
query: Object.assign({}, query, data), query: Object.assign({}, query, data),
}); });
this.decodetwo(this.form)
}, },
// 解析url字符串,去除query字段 // 解析url字符串,去除query字段
encode(data, formTemp) { encode(data, formTemp) {
...@@ -290,7 +289,6 @@ export default { ...@@ -290,7 +289,6 @@ export default {
if (/^query\./.test(item)) { if (/^query\./.test(item)) {
let val = data[item]; let val = data[item];
let key = item.replace(/^query\./, ""); let key = item.replace(/^query\./, "");
this.search.forEach((obj) => { this.search.forEach((obj) => {
if ( if (
obj.name === key && obj.name === key &&
...@@ -340,6 +338,33 @@ export default { ...@@ -340,6 +338,33 @@ export default {
}); });
return newData; return newData;
}, },
decodetwo(data) {
Object.keys(data).forEach((item) => {
let val = data[item];
this.search.forEach((obj) => {
if (
obj.name === item &&
obj.fuzzy === true &&
val &&
val.length > 0
) {
//支持模糊查询,收尾增加百分号
val = val.trim();
if (val.charAt(0) == "%") {
val = val.slice(1);
}
if (val.charAt(val.length - 1) == "%") {
val = val + "%";
}
}
});
newData[item] = this.decodeVal(val);
});
return newData;
},
decodeVal(val) { decodeVal(val) {
let valType = type(val); let valType = type(val);
if (["Number", "Boolean"].indexOf(valType) > -1) { if (["Number", "Boolean"].indexOf(valType) > -1) {
......
...@@ -61,6 +61,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -61,6 +61,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.net.URL; import java.net.URL;
...@@ -141,6 +144,13 @@ public class DeviceApiController { ...@@ -141,6 +144,13 @@ public class DeviceApiController {
@PostMapping("register") @PostMapping("register")
public String register(@RequestBody DeviceReq req) { public String register(@RequestBody DeviceReq req) {
log.info("【设备注册】【请求体】--> " + JSONObject.toJSONString(req)); log.info("【设备注册】【请求体】--> " + JSONObject.toJSONString(req));
RequestAttributes requstAttr = RequestContextHolder.getRequestAttributes();
HttpServletRequest request = ((ServletRequestAttributes) requstAttr).getRequest();
log.info("request uri:{},request url:{}",request.getRequestURI(),request.getRequestURL());
//ServletUtil.
//ServletUtil.getClientIP()
ApiResp<DeviceResp> rsp = new ApiResp<>(); ApiResp<DeviceResp> rsp = new ApiResp<>();
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue()); rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
DeviceResp deviceResp = new DeviceResp(); DeviceResp deviceResp = new DeviceResp();
......
...@@ -23,8 +23,9 @@ ...@@ -23,8 +23,9 @@
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 文件保存策略--> <!-- 文件保存策略-->
<fileNamePattern>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-info.log.%d{yyyyMMdd}</fileNamePattern> <fileNamePattern>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-info.log.%d{yyyyMMdd}</fileNamePattern>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<MaxHistory>7</MaxHistory> <MaxHistory>15</MaxHistory>
</rollingPolicy> </rollingPolicy>
</appender> </appender>
<!-- 异常文件输出策略--> <!-- 异常文件输出策略-->
......
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