|
|
@@ -3,18 +3,17 @@ package com.goafanti.common.controller;
|
|
|
import com.goafanti.admin.service.AdminService;
|
|
|
import com.goafanti.admin.service.AttachmentService;
|
|
|
import com.goafanti.common.bo.Error;
|
|
|
-import com.goafanti.common.bo.OutUser;
|
|
|
-import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
-import com.goafanti.common.dao.TOrderMidMapper;
|
|
|
import com.goafanti.common.enums.UserType;
|
|
|
import com.goafanti.common.model.User;
|
|
|
import com.goafanti.common.service.DistrictGlossoryService;
|
|
|
import com.goafanti.common.service.IndustryCategoryService;
|
|
|
+import com.goafanti.common.service.PovertyService;
|
|
|
import com.goafanti.common.utils.*;
|
|
|
import com.goafanti.common.utils.excel.FileUtils;
|
|
|
import com.goafanti.common.utils.excel.NewExcelUtil;
|
|
|
+import com.goafanti.core.mybatis.JDBCIdGenerator;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
import com.goafanti.core.websocket.SystemWebSocketHandler;
|
|
|
import com.goafanti.expenseAccount.service.ExpenseAccountService;
|
|
|
@@ -95,6 +94,9 @@ public class PublicController extends CertifyApiController {
|
|
|
@Value(value = "${patentTemplate}")
|
|
|
private String patentTemplate = null;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private JDBCIdGenerator jdbcIdGenerator;
|
|
|
+
|
|
|
@Resource(name = "passwordUtil")
|
|
|
private PasswordUtil passwordUtil;
|
|
|
|
|
|
@@ -774,15 +776,167 @@ public class PublicController extends CertifyApiController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询贫困信息
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/selectPoverty")
|
|
|
+ public Result selectPoverty(@RequestParam(value = "file", required = false) MultipartFile file) {
|
|
|
+ Result res=new Result();
|
|
|
+ //判断文件是否存在
|
|
|
+ if(null == file){
|
|
|
+ res.getError().add(buildError("文件不存在!","文件不存在!"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ String fileName = file.getOriginalFilename();
|
|
|
+ if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) {
|
|
|
+ res.getError().add(buildError("格式不正确","格式不正确"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ String id = jdbcIdGenerator.generateId().toString();
|
|
|
+ res.data(povertyService.selectPoverty(file,id));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询贫困信息
|
|
|
+ * @param id 贫困信息编号
|
|
|
+ * @param type 0=所有 ,1=只看有效数据
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/selectPovertyById/export")
|
|
|
+ public Result selectPovertyByIdExport(String id,Integer type) {
|
|
|
+ Map<String,Object> o = povertyService.selectPoverty(null, id);
|
|
|
+ if (type==null)type=0;
|
|
|
+ List<OutPoverty> resList=new ArrayList<>();
|
|
|
+ if (type==1){
|
|
|
+ List<OutPoverty> list = (List<OutPoverty>) o.get("list");
|
|
|
+ for (OutPoverty outPoverty : list) {
|
|
|
+ if (com.goafanti.common.utils.StringUtils.isNotEmpty(outPoverty.getId())){
|
|
|
+ resList.add(outPoverty);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }else {
|
|
|
+ resList = (List<OutPoverty>) o.get("list");
|
|
|
+ }
|
|
|
+ NewExcelUtil<OutPoverty> newExcelUtil=new NewExcelUtil<>(OutPoverty.class);
|
|
|
+ return newExcelUtil.exportExcel(resList,"广西贫困信息表",uploadPath);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("/selectPovertyById")
|
|
|
+ public Result selectPovertyById(String id,Integer type) {
|
|
|
+ Result res=new Result();
|
|
|
+ Map<String,Object> o = povertyService.selectPoverty(null, id);
|
|
|
+ if (type==null)type=0;
|
|
|
+ if (type==1){
|
|
|
+ List<OutPoverty> list = (List<OutPoverty>) o.get("list");
|
|
|
+ List<OutPoverty> resList=new ArrayList<>();
|
|
|
+ for (OutPoverty outPoverty : list) {
|
|
|
+ if (com.goafanti.common.utils.StringUtils.isNotEmpty(outPoverty.getId())){
|
|
|
+ resList.add(outPoverty);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ o.remove("list");
|
|
|
+ o.put("list",resList);
|
|
|
+ }
|
|
|
+ res.data(o);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量导入回款模版
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/downloadPovertyTemplate", method = RequestMethod.GET)
|
|
|
+ public void downloadTemplate(HttpServletResponse response) {
|
|
|
+ Result res = new Result();
|
|
|
+ StringBuffer url= new StringBuffer(uploadPath);
|
|
|
+ url=url.append("/tmp").append("/poverty_template.xls");
|
|
|
+ try {
|
|
|
+ response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
|
|
+ FileUtils.setAttachmentResponseHeader(response, url.toString(),"poverty导入模版.xls");
|
|
|
+ FileUtils.writeBytes(url.toString(), response.getOutputStream());
|
|
|
+ }
|
|
|
+ catch (Exception e) {
|
|
|
+ LoggerUtils.error(PublicController.class,"下载文件失败", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
- * 旧数据处理
|
|
|
+ * 查询贫困信息
|
|
|
* @return
|
|
|
*/
|
|
|
- @RequestMapping("/pushStatistics")
|
|
|
- public Result pushStatistics() {
|
|
|
+ @RequestMapping("/selectFlag")
|
|
|
+ public Result selectFlag(@RequestParam(value = "file", required = false) MultipartFile file) {
|
|
|
Result res=new Result();
|
|
|
- res.data(adminService.pushStatistics());
|
|
|
+ //判断文件是否存在
|
|
|
+ if(null == file){
|
|
|
+ res.getError().add(buildError("文件不存在!","文件不存在!"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ String fileName = file.getOriginalFilename();
|
|
|
+ if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) {
|
|
|
+ res.getError().add(buildError("格式不正确","格式不正确"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ String id = jdbcIdGenerator.generateId().toString();
|
|
|
+ Map<String, Object> map = povertyService.selectFlag(file, id);
|
|
|
+ List<OutPovertyFlag> falseList = (List<OutPovertyFlag>) map.get("falseList");
|
|
|
+ List<OutPovertyFlag> list = (List<OutPovertyFlag>) map.get("trueList");
|
|
|
+ list.addAll(falseList);
|
|
|
+ map.put("list",list);
|
|
|
+ map.remove("falseList");
|
|
|
+ map.remove("trueList");
|
|
|
+ res.data(map);
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询贫困信息
|
|
|
+ * @param id 贫困信息编号
|
|
|
+ * @param type 0=所有 ,1=只看有效数据
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/selectPovertyFlagById")
|
|
|
+ public Result selectPovertyFlagById(String id,Integer type) {
|
|
|
+ Result res =new Result();
|
|
|
+ Map<String,Object> map = povertyService.selectFlag(null, id);
|
|
|
+ if (type==null)type=0;
|
|
|
+ List<OutPovertyFlag> resList=new ArrayList<>();
|
|
|
+ if (type==1){
|
|
|
+ map.put("list",map.get("trueList"));
|
|
|
+ }else {
|
|
|
+ map.put("list",map.get("falseList"));
|
|
|
+ }
|
|
|
+ map.remove("trueList");
|
|
|
+ map.remove("falseList");
|
|
|
+ return res.data(map);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 查询贫困信息
|
|
|
+ * @param id 贫困信息编号
|
|
|
+ * @param type 0=所有 ,1=只看有效数据
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/selectPovertyFlagById/export")
|
|
|
+ public Result selectPovertyFlagByIdExport(String id,Integer type) {
|
|
|
+ Map<String,Object> map = povertyService.selectFlag(null, id);
|
|
|
+ if (type==null)type=0;
|
|
|
+ List<OutPovertyFlag> resList=new ArrayList<>();
|
|
|
+ if (type==1){
|
|
|
+ map.put("list",map.get("trueList"));
|
|
|
+
|
|
|
+ }else {
|
|
|
+ map.put("list",map.get("falseList"));
|
|
|
+ }
|
|
|
+ map.remove("trueList");
|
|
|
+ map.remove("falseList");
|
|
|
+ NewExcelUtil<OutPovertyFlag> newExcelUtil=new NewExcelUtil<>(OutPovertyFlag.class);
|
|
|
+ return newExcelUtil.exportExcel(resList,"全国贫困信息表",uploadPath);
|
|
|
+ }
|
|
|
+
|
|
|
}
|