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

添加终端修改密码日志记录

parent 4ea992de
...@@ -285,27 +285,7 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe ...@@ -285,27 +285,7 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
} }
@PostMapping(value = "genMatterCsv")
@UnAuth
public Rest<Object> genMatterCsv(@RequestBody MatterQuery query) {
Rest<Object> ret = new Rest<>();
Map<String, Object> model = new HashMap<>();
Context context = this.getContext();
String busiDesc = "生成文本" + this.getModuleDesc();
int code = VALUE_RESULT_SUCCESS;
try {
this.service.genMatterCsv(query, getContext());
model.put(MESSAGE_INFO, busiDesc + "成功");
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
}
ret.setCode(code);
ret.setData(model);
ret.setMsg(model.get(MESSAGE_INFO) == null ? "" : model.remove(MESSAGE_INFO).toString());
return ret;
}
@PostMapping(value = "genMatterMarkdown") @PostMapping(value = "genMatterMarkdown")
...@@ -345,12 +325,13 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe ...@@ -345,12 +325,13 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
} }
@GetMapping(value = "genMatterTxt") @GetMapping(value = "genMatterCsv")
@UnAuth @UnAuth
public String genMatterTxt(@RequestParam(value = "areaCode", defaultValue = "") String areaCode public String genMatterCsv(@RequestParam(value = "areaCode", defaultValue = "") String areaCode
, @RequestParam(value = "genFilePath", defaultValue = "/home/txt/") String genFilePath) { , @RequestParam(value = "genFilePath", defaultValue = "/home/txt/") String genFilePath) {
Rest<Object> ret = new Rest<>(); Rest<Object> ret = new Rest<>();
Map<String, Object> model = new HashMap<>(); Map<String, Object> model = new HashMap<>();
Context context = this.getContext();
String busiDesc = "生成文本" + this.getModuleDesc(); String busiDesc = "生成文本" + this.getModuleDesc();
int code = VALUE_RESULT_SUCCESS; int code = VALUE_RESULT_SUCCESS;
try { try {
...@@ -367,21 +348,61 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe ...@@ -367,21 +348,61 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
if (ObjectUtils.isEmpty(baseAreaEntity)) { if (ObjectUtils.isEmpty(baseAreaEntity)) {
throw new AppException("区域编码不存在!" + areaCode); throw new AppException("区域编码不存在!" + areaCode);
} }
boolean setnx = cacheService.setnx("genMatterCsv:" + areaCode, "1", 60 * 20);
if (!setnx) {
return baseAreaEntity.getName() + ".csv 正在生成中,请稍后查看文件!";
}
new Thread(() -> {
this.service.genMatterCsv(query, getContext());
cacheService.del("genMatterCsv:" + areaCode);
}).start();
return "异步生成文件中,请稍后查看文件!,文件访问地址: http://192.168.0.98:11071" + genFilePath;
/*
this.service.genMatterCsv(query, getContext());
model.put(MESSAGE_INFO, busiDesc + "成功");*/
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
}
ret.setCode(code);
ret.setData(model);
ret.setMsg(model.get(MESSAGE_INFO) == null ? "" : model.remove(MESSAGE_INFO).toString());
return ret.toString();
}
// String path = genFilePath + baseAreaEntity.getName() + ".txt"; @GetMapping(value = "genMatterTxt")
@UnAuth
public String genMatterTxt(@RequestParam(value = "areaCode", defaultValue = "") String areaCode
, @RequestParam(value = "genFilePath", defaultValue = "/home/txt/") String genFilePath) {
Rest<Object> ret = new Rest<>();
Map<String, Object> model = new HashMap<>();
String busiDesc = "生成文本" + this.getModuleDesc();
int code = VALUE_RESULT_SUCCESS;
try {
if (ObjectUtils.isEmpty(areaCode)) {
throw new AppException("区域编码不能为空!");
}
MatterQuery query = new MatterQuery();
query.setAreaCode(areaCode);
query.setGenFilePath(genFilePath);
BaseAreaQuery baseAreaQuery = new BaseAreaQuery();
baseAreaQuery.setAreaCode(areaCode);
BaseAreaEntity baseAreaEntity = baseAreaService.selectOne(baseAreaQuery);
if (ObjectUtils.isEmpty(baseAreaEntity)) {
throw new AppException("区域编码不存在!" + areaCode);
}
boolean setnx = cacheService.setnx("genMatterTxt:" + areaCode, "1", 60 * 20); boolean setnx = cacheService.setnx("genMatterTxt:" + areaCode, "1", 60 * 20);
if (!setnx) { if (!setnx) {
return baseAreaEntity.getName() + ".txt 正在生成中,请稍后查看文件!"; return baseAreaEntity.getName() + ".txt 正在生成中,请稍后查看文件!";
} }
new Thread(() -> { new Thread(() -> {
Rest<Void> voidRest = this.service.genMatterTXT(query, getContext()); this.service.genMatterTXT(query, getContext());
cacheService.del("genMatterTxt:" + areaCode); cacheService.del("genMatterTxt:" + areaCode);
}).start(); }).start();
//http://192.168.0.98:11071/home/txt/
// model.put(MESSAGE_INFO, "异步生成文件中,请稍后查看文件!,文件访问地址:http://192.168.0.98:11071" + genFilePath+"/");
return "异步生成文件中,请稍后查看文件!,文件访问地址: http://192.168.0.98:11071" + genFilePath; return "异步生成文件中,请稍后查看文件!,文件访问地址: http://192.168.0.98:11071" + genFilePath;
} catch (Exception e) { } catch (Exception e) {
......
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