Commit 6eecb3b4 authored by 赵啸非's avatar 赵啸非

添加事项备注字段

parent 74b648f9
......@@ -8,6 +8,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.framework.config.InterceptorConfig;
......@@ -73,6 +74,8 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
private MatterChargesService matterChargesService;
@Autowired
private MatterChannelService matterChannelService;
@Autowired
private ICacheService cacheService;
public MatterController() {
super.setModuleDesc("基础事项");
......@@ -314,30 +317,35 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
@GetMapping(value = "genMatterTxt")
@UnAuth
public Rest<Object> genMatterTxt(@RequestParam(value = "areaCode",defaultValue = "") String areaCode
, @RequestParam(value = "genFilePath",defaultValue = "/home/txt") String genFilePath) {
public Rest<Object> 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)){
if (ObjectUtils.isEmpty(areaCode)) {
throw new AppException("区域编码不能为空!");
}
MatterQuery query = new MatterQuery();
query.setAreaCode(areaCode);
query.setGenFilePath(genFilePath);
new Thread(()->{
this.service.genMatterTXT(query, getContext());
}).start();
BaseAreaQuery baseAreaQuery = new BaseAreaQuery();
baseAreaQuery.setAreaCode(areaCode);
BaseAreaEntity baseAreaEntity = baseAreaService.selectOne(baseAreaQuery);
String path = genFilePath+ baseAreaEntity.getName() + ".txt";
String path = genFilePath + baseAreaEntity.getName() + ".txt";
boolean setnx = cacheService.setnx("genMatterTxt:" + areaCode, "1", 60 * 20);
if (!setnx) {
throw new AppException(baseAreaEntity.getName() + ".txt 正在生成中,请稍后查看文件!");
}
new Thread(() -> {
Rest<Void> voidRest = this.service.genMatterTXT(query, getContext());
cacheService.del("genMatterTxt:" + areaCode);
}).start();
model.put(MESSAGE_INFO, "异步生成文件中,请稍后查看文件!,文件地址:"+path);
model.put(MESSAGE_INFO, "异步生成文件中,请稍后查看文件!,文件地址:" + path);
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
......
......@@ -39,6 +39,12 @@ Content-Type: application/json
{"areaCode": "510903000000", "genFilePath": "E:/home/csv/"}
###生成txt
GET {{baseUrl}}/matter/genMatterTxt?areaCode=511124000000&genFilePath=E:/home/txt/
Content-Type: application/json
###生成文本1
POST {{baseUrl}}/matter/genMatterMarkdown
Content-Type: application/json
......
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