Commit 74b648f9 authored by 赵啸非's avatar 赵啸非

添加事项备注字段

parent 1f9c15e3
...@@ -83,10 +83,10 @@ public interface MatterService extends ICRUDService<MatterEntity, Long> { ...@@ -83,10 +83,10 @@ public interface MatterService extends ICRUDService<MatterEntity, Long> {
* @param context * @param context
* @return * @return
*/ */
Rest<Void> genMatterTxt(MatterQuery matterQuery,Context context); Rest<Void> genMatterCsv(MatterQuery matterQuery, Context context);
Rest<Void> genMatterMarkdown(MatterQuery matterQuery,Context context); Rest<Void> genMatterMarkdown(MatterQuery matterQuery,Context context);
Rest<Void> genMatterCSV(MatterQuery matterQuery,Context context); Rest<Void> genMatterTXT(MatterQuery matterQuery, Context context);
} }
\ No newline at end of file
...@@ -1603,7 +1603,7 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter ...@@ -1603,7 +1603,7 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
@Override @Override
public Rest<Void> genMatterTxt(MatterQuery matterQuery, Context context) { public Rest<Void> genMatterCsv(MatterQuery matterQuery, Context context) {
List<String> strList = new ArrayList<>(); List<String> strList = new ArrayList<>();
List<MatterEntity> mattersList = this.find(matterQuery); List<MatterEntity> mattersList = this.find(matterQuery);
...@@ -1963,14 +1963,13 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter ...@@ -1963,14 +1963,13 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
@Override @Override
public Rest<Void> genMatterCSV(MatterQuery matterQuery, Context context) { public Rest<Void> genMatterTXT(MatterQuery matterQuery, Context context) {
List<String> strList = new ArrayList<>();
BaseAreaQuery baseAreaQuery = new BaseAreaQuery(); BaseAreaQuery baseAreaQuery = new BaseAreaQuery();
baseAreaQuery.setAreaCode(matterQuery.getAreaCode()); baseAreaQuery.setAreaCode(matterQuery.getAreaCode());
BaseAreaEntity baseAreaEntity = baseAreaService.selectOne(baseAreaQuery); BaseAreaEntity baseAreaEntity = baseAreaService.selectOne(baseAreaQuery);
String path = matterQuery.getGenFilePath() + baseAreaEntity.getName() + ".csv"; String path = matterQuery.getGenFilePath() + baseAreaEntity.getName() + ".txt";
FileUtil.writeUtf8String("", path); FileUtil.writeUtf8String("", path);
List<MatterEntity> mattersList = matterExtService.getWebMatterListByAreaCode(matterQuery.getAreaCode(), context).getData(); List<MatterEntity> mattersList = matterExtService.getWebMatterListByAreaCode(matterQuery.getAreaCode(), context).getData();
for (MatterEntity matterEntity : mattersList) { for (MatterEntity matterEntity : mattersList) {
......
...@@ -9,25 +9,21 @@ import com.mortals.framework.model.Context; ...@@ -9,25 +9,21 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.framework.util.DataUtil; import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.ThreadPool;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.framework.config.InterceptorConfig; import com.mortals.xhx.base.framework.config.InterceptorConfig;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.JointInfoShowEnum; import com.mortals.xhx.common.code.JointInfoShowEnum;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.base.model.BaseAreaEntity; import com.mortals.xhx.module.base.model.BaseAreaEntity;
import com.mortals.xhx.module.base.model.BaseAreaQuery;
import com.mortals.xhx.module.base.service.BaseAreaService; import com.mortals.xhx.module.base.service.BaseAreaService;
import com.mortals.xhx.module.matter.model.*; import com.mortals.xhx.module.matter.model.*;
import com.mortals.xhx.module.matter.service.*; import com.mortals.xhx.module.matter.service.*;
import com.mortals.xhx.module.site.model.SiteThemeQuery; import com.mortals.xhx.module.site.model.SiteThemeQuery;
import com.mortals.xhx.module.site.service.SiteThemeService; import com.mortals.xhx.module.site.service.SiteThemeService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -256,16 +252,16 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe ...@@ -256,16 +252,16 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
} }
@PostMapping(value = "genMatterTxt") @PostMapping(value = "genMatterCsv")
@UnAuth @UnAuth
public Rest<Object> genMatterTxt(@RequestBody MatterQuery query) { public Rest<Object> genMatterCsv(@RequestBody MatterQuery query) {
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(); Context context = this.getContext();
String busiDesc = "生成文本" + this.getModuleDesc(); String busiDesc = "生成文本" + this.getModuleDesc();
int code = VALUE_RESULT_SUCCESS; int code = VALUE_RESULT_SUCCESS;
try { try {
this.service.genMatterTxt(query, getContext()); this.service.genMatterCsv(query, getContext());
model.put(MESSAGE_INFO, busiDesc + "成功"); model.put(MESSAGE_INFO, busiDesc + "成功");
} catch (Exception e) { } catch (Exception e) {
...@@ -316,16 +312,32 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe ...@@ -316,16 +312,32 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
} }
@PostMapping(value = "genMatterCsv") @GetMapping(value = "genMatterTxt")
@UnAuth @UnAuth
public Rest<Object> genMatterCsv(@RequestBody MatterQuery query) { public Rest<Object> genMatterTxt(@RequestParam(value = "areaCode",defaultValue = "") String areaCode
, @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<>();
String busiDesc = "生成文本" + this.getModuleDesc(); String busiDesc = "生成文本" + this.getModuleDesc();
int code = VALUE_RESULT_SUCCESS; int code = VALUE_RESULT_SUCCESS;
try { try {
this.service.genMatterCSV(query, getContext()); if(!ObjectUtils.isEmpty(areaCode)){
model.put(MESSAGE_INFO, busiDesc + "成功"); 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";
model.put(MESSAGE_INFO, "异步生成文件中,请稍后查看文件!,文件地址:"+path);
} catch (Exception e) { } catch (Exception e) {
code = VALUE_RESULT_FAILURE; code = VALUE_RESULT_FAILURE;
......
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