法规月报填写--带入标准信息

This commit is contained in:
zhn
2022-07-11 17:30:48 +08:00
parent a4ef7232f3
commit e6270bf4f8
3 changed files with 105 additions and 4 deletions
@@ -9,6 +9,7 @@ import com.jero.modules.report.service.ILawsMonthlyReportWriteEOService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
@@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
@@ -27,9 +29,10 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
/**
* @Description: 月报填写
* @Author: jero-boot
* @Date: 2022-07-02
@@ -184,4 +187,14 @@ public class LawsMonthlyReportWriteEOController extends JeroController<LawsMonth
return lawsMonthlyReportWriteEOService.exportMonthlyReport(lawsMonthlyReportWriteEO);
}
@ApiOperation(value="带入标准信息--分页", notes="带入标准信息--分页")
@PostMapping(value = "/queryPageDocument")
@ResponseBody
public JSONObject queryPageDocument(@RequestBody Map<String,Object> parameter) {
IPage infoPage = lawsMonthlyReportWriteEOService.queryPageDocument(parameter);
Result<IPage> ok = Result.OK(infoPage);
JSONObject jsonResult = JSONObject.fromObject(ok);
return jsonResult;
}
}
@@ -7,6 +7,7 @@ import org.springframework.http.ResponseEntity;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
* @Description: 月报填写
@@ -77,4 +78,6 @@ public interface ILawsMonthlyReportWriteEOService extends IService<LawsMonthlyRe
HttpServletRequest req);
ResponseEntity<byte[]> exportMonthlyReport(LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO);
IPage queryPageDocument(Map<String, Object> parameter);
}
@@ -6,7 +6,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.constant.enums.ModuleEnum;
import com.jero.common.system.query.QueryGenerator;
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
import com.jero.modules.document.enums.FieldTypeEnum;
import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper;
import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl;
import com.jero.modules.report.entity.LawsMonthlyReportTitleTemplateEO;
import com.jero.modules.report.entity.LawsMonthlyReportWriteEO;
import com.jero.modules.report.entity.NewOpinionTemplateEO;
@@ -20,7 +26,9 @@ import com.jero.modules.report.service.INewOpinionTemplateEOService;
import com.jero.modules.report.service.INewStandardTemplateEOService;
import com.jero.modules.report.util.WordUtil;
import com.jero.modules.system.entity.SysCategory;
import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import com.jero.modules.system.util.StringUtils;
import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
@@ -37,6 +45,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -58,6 +67,14 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
private SysCategoryServiceImpl sysCategoryService;
@Value(value = "${jero.path.upload}")
private String uploadpath;
@Autowired
private OnlCgformFieldServiceImpl onlCgformFieldService;
@Autowired
private BussDocumentLibraryEOServiceImpl bussDocumentLibraryEOService;
@Autowired
private BussDocumentLibraryEOMapper bussDocumentLibraryEOMapper;
@Autowired
private SysDictItemServiceImpl sysDictItemServiceImpl;
/**
* 保存
*
@@ -344,6 +361,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
return null;
}
/**
*
* @param path
@@ -377,8 +395,75 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
} catch (IOException e) {
log.error("文件创建异常,异常信息为:" + e.getMessage());
}
}
@Override
public IPage queryPageDocument(Map<String, Object> parameter) {
String cut = (String) parameter.get("cut");//中英文切换标识
//文档库字段
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue());
//需要查询的字段
List<String> fieldListQuery = new ArrayList<>();
fieldListQuery.add("serial_number");
fieldListQuery.add("title");
fieldListQuery.add("title_en");
fieldListQuery.add("state");
fieldListQuery.add("region");
fieldListQuery.add("technology_territory");
fieldListQuery.add("xin1_che1_xing2_shi2_shi1_ri4_qi1");
fieldListQuery.add("implement_time");
fieldListQuery.add("corresponding_standard");
fieldListQuery.add("shi4_yong4_che1_xing2");
fieldListQuery.add("shi4_yong4_fan4_wei2");
List<String> fieldListNew = new ArrayList<>();
fieldListNew.add("id");
//转时间格式
for (String field : fieldListQuery) {
String fieldTemp = null;
if ("xin1_che1_xing2_shi2_shi1_ri4_qi1".equals(field) || "implement_time".equals(field)) {
String fieldNew = "date_format(" + field + ", '%Y-%m-%d')";
fieldTemp = "case when " + fieldNew + " is null then \"\" else " + fieldNew + " end " + field;
fieldListNew.add(fieldTemp);
} else {
fieldTemp = "case when " + field + " is null then \"\" else " + field + " end " + field;
fieldListNew.add(fieldTemp);
}
}
//封装查询条件
String condition = bussDocumentLibraryEOService.getConditionStr(parameter);
int pageNo = Integer.parseInt(parameter.get("pageNo").toString());
int pageSize = Integer.parseInt(parameter.get("pageSize").toString());
IPage page = new Page(pageNo, pageSize);
IPage infoPage = bussDocumentLibraryEOMapper.getInfoPage(page, " " + StringUtils.join(fieldListNew, ","), condition);
//树形数据字典
List<SysCategory> categoryList = sysCategoryService.list();
//过滤出树形字段
List<OnlCgformField> treeFieldList = fieldList.stream()
.filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType()))
.collect(Collectors.toList());
List<Map> records = infoPage.getRecords();
//数据字典
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
//下拉选处理数据字典
for (Map record : records) {
Map<String, Object> record1 = (Map) record;
record1.put("state_dict",record1.get("state"));//状态
record1.put("technology_territory_dict",record1.get("technology_territory"));//相关领域
record1.put("shi4_yong4_fan4_wei2_dict",record1.get("shi4_yong4_fan4_wei2"));//适用范围
record1.put("shi4_yong4_che1_xing2_dict",record1.get("shi4_yong4_che1_xing2"));//适用车型
for (Map.Entry<String, Object> entry : record1.entrySet()) {
//下拉选处理数据字典
bussDocumentLibraryEOService.dictItem(sysDictItems, entry, cut, fieldList,null);
bussDocumentLibraryEOService.treeDictItem(categoryList, entry, treeFieldList, cut,null);
}
}
return infoPage;
}
}