法规预警
This commit is contained in:
+24
-1
@@ -3574,8 +3574,9 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
|
||||
|
||||
@NotNull
|
||||
private String getConditionStr(Map<String, Object> parameter) {
|
||||
public String getConditionStr(Map<String, Object> parameter) {
|
||||
String cut = (String) parameter.get("cut");
|
||||
String flag = String.valueOf(parameter.get("flag"));
|
||||
//查询条件
|
||||
StringBuilder conditionSb = new StringBuilder("where 1 = 1");
|
||||
|
||||
@@ -3640,6 +3641,28 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
|
||||
}
|
||||
|
||||
//处理法规预警模块预警时间查询条件 flag = 0(新车实施日期), flag = 1(在产车实施日期)
|
||||
String warnTime = (String) parameter.get("WarnTime");
|
||||
if(StringUtils.isNotBlank(warnTime)){
|
||||
if("0".equals(flag)){
|
||||
//日期(区分单日期还时间范围)
|
||||
if (warnTime.contains(",")) {
|
||||
conditionSb.append(" and " + "date_format(" + "xin1_che1_xing2_shi2_shi1_ri4_qi1" + ",'%Y-%m-%d') >= '" + warnTime.split(",")[0] + "'"
|
||||
+ " and " + "date_format(" + "xin1_che1_xing2_shi2_shi1_ri4_qi1" + ",'%Y-%m-%d') <= '" + warnTime.split(",")[1] + "'");
|
||||
} else {
|
||||
conditionSb.append(" and " + "date_format(" + "xin1_che1_xing2_shi2_shi1_ri4_qi1" + ",'%Y-%m-%d') = '" + warnTime + "'");
|
||||
}
|
||||
}else{
|
||||
//日期(区分单日期还时间范围)
|
||||
if (warnTime.contains(",")) {
|
||||
conditionSb.append(" and " + "date_format(" + "implement_time" + ",'%Y-%m-%d') >= '" + warnTime.split(",")[0] + "'"
|
||||
+ " and " + "date_format(" + "implement_time" + ",'%Y-%m-%d') <= '" + warnTime.split(",")[1] + "'");
|
||||
} else {
|
||||
conditionSb.append(" and " + "date_format(" + "implement_time" + ",'%Y-%m-%d') = '" + warnTime + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//高级搜索 queryConditionVOList List<QueryConditionVO>
|
||||
if(ObjectUtils.isNotEmpty(parameter.get("queryConditionVOList"))){
|
||||
String queryConditionVOListStr = (String) parameter.get("queryConditionVOList");
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.jero.modules.warn.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.modules.warn.service.LawsWarnService;
|
||||
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.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description
|
||||
* @date 2022/6/20 11:54
|
||||
* @auth zhn
|
||||
*/
|
||||
@Api(tags="法规预警")
|
||||
@RestController
|
||||
@RequestMapping("/LawsWarn")
|
||||
@Slf4j
|
||||
public class LawsWarnController {
|
||||
|
||||
@Autowired
|
||||
private LawsWarnService lawsWarnService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="分页查询", notes="分页查询")
|
||||
@PostMapping(value = "/queryPageInfo")
|
||||
@ResponseBody
|
||||
// @RequiresPermissions("document:queryPageInfo")
|
||||
public JSONObject queryPageInfo(@RequestBody Map<String,Object> parameter) {
|
||||
IPage infoPage = lawsWarnService.getInfoPage(parameter);
|
||||
Result<IPage> ok = Result.OK(infoPage);
|
||||
JSONObject jsonResult = JSONObject.fromObject(ok);
|
||||
return jsonResult;
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
package com.jero.modules.warn.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.constant.enums.ModuleEnum;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
||||
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
||||
import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper;
|
||||
import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @description
|
||||
* @date 2022/6/20 11:55
|
||||
* @auth zhn
|
||||
*/
|
||||
@Service
|
||||
public class LawsWarnService {
|
||||
@Autowired
|
||||
private BussDocumentLibraryEOServiceImpl bussDocumentLibraryEOService;
|
||||
@Autowired
|
||||
private BussDocumentLibraryEOMapper bussDocumentLibraryEOMapper;
|
||||
@Autowired
|
||||
private SysCategoryServiceImpl sysCategoryService;
|
||||
@Autowired
|
||||
private SysDictItemServiceImpl sysDictItemServiceImpl;
|
||||
@Autowired
|
||||
private OnlCgformFieldServiceImpl onlCgformFieldService;
|
||||
|
||||
public IPage getInfoPage(Map<String, Object> parameter) {
|
||||
String cut = (String) parameter.get("cut");//中英文切换标识
|
||||
List<OnlCgformField> onlCgformFieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue());
|
||||
//查询的字段
|
||||
String fieldQuery = "id,serial_number,title,title_en,state,region,technology_territory,xin1_che1_xing2_shi2_shi1_ri4_qi1,implement_time";
|
||||
List<String> fieldList = Arrays.asList(fieldQuery.split(","));
|
||||
|
||||
List<String> fieldListNew = new ArrayList<>();
|
||||
for (String field : fieldList) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
parameter.remove("warnTime");
|
||||
//封装查询条件(包含高级搜索)
|
||||
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<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
|
||||
List<OnlCgformField> onlCgformFieldListTemp = onlCgformFieldList.stream().filter(e -> fieldList.contains(e.getDbFieldName())).collect(Collectors.toList());
|
||||
List<Map> records = infoPage.getRecords();
|
||||
for (Map record : records) {
|
||||
//处理标题
|
||||
if(CutEnum.EN.getValue().equals(cut)){
|
||||
record.put("title",record.get("title_en"));
|
||||
}
|
||||
Map<String, Object> record1 = (Map) record;
|
||||
List<OnlCgformField> treeFieldList = new ArrayList<>();
|
||||
OnlCgformField onlCgformField = new OnlCgformField();
|
||||
onlCgformField.setDbFieldName("technology_territory");
|
||||
treeFieldList.add(onlCgformField);
|
||||
for (Map.Entry<String, Object> entry : record1.entrySet()) {
|
||||
//下拉选处理数据字典
|
||||
bussDocumentLibraryEOService.dictItem(sysDictItems, entry, cut, onlCgformFieldListTemp,null);
|
||||
bussDocumentLibraryEOService.treeDictItem(categoryList, entry, treeFieldList, cut,null);
|
||||
}
|
||||
}
|
||||
return infoPage;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user