Commit a62b8c59 authored by 陈浩's avatar 陈浩

Merge branch 'chenhao' into 'developer'

Chenhao See merge request !5
parents f9e89e3f 091776e9
package com.yeejoin.amos.boot.biz.common.controller; package com.yeejoin.amos.boot.biz.common.controller;
import java.util.*; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -15,11 +21,12 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType; ...@@ -15,11 +21,12 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.Menu; import com.yeejoin.amos.boot.biz.common.utils.Menu;
...@@ -28,10 +35,10 @@ import com.yeejoin.amos.boot.biz.common.utils.NameUtils; ...@@ -28,10 +35,10 @@ import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser; import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
/** /**
* 数据字典 * 数据字典
* *
...@@ -43,232 +50,235 @@ import io.swagger.annotations.ApiOperation; ...@@ -43,232 +50,235 @@ import io.swagger.annotations.ApiOperation;
@RequestMapping(value = "/data-dictionary") @RequestMapping(value = "/data-dictionary")
public class DataDictionaryController extends BaseController { public class DataDictionaryController extends BaseController {
@Autowired @Autowired
DataDictionaryServiceImpl iDataDictionaryService; DataDictionaryServiceImpl iDataDictionaryService;
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
@Value("${redis.cache.failure.time}")
private long time;
/** @Value("${redis.cache.failure.time}")
* 新增数据字典 private long time;
*
* @return @Autowired
*/ DataDictionaryMapper dataDictionaryMapper;
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增数据字典", notes = "新增数据字典")
public boolean saveDataDictionary(HttpServletRequest request, @RequestBody DataDictionary dataDictionary) {
return iDataDictionaryService.save(dataDictionary);
}
/** /**
* 根据id删除 * 新增数据字典
* *
* @param id * @return
* @return */
*/ @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) @RequestMapping(value = "/save", method = RequestMethod.POST)
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE) @ApiOperation(httpMethod = "POST", value = "新增数据字典", notes = "新增数据字典")
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除") public boolean saveDataDictionary(HttpServletRequest request, @RequestBody DataDictionary dataDictionary) {
public boolean deleteById(HttpServletRequest request, @PathVariable Long id) { return iDataDictionaryService.save(dataDictionary);
return iDataDictionaryService.removeById(id); }
}
/**
* 根据id删除
*
* @param id
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean deleteById(HttpServletRequest request, @PathVariable Long id) {
return iDataDictionaryService.removeById(id);
}
/** /**
* 修改数据字典 * 修改数据字典
* *
* @return * @return
*/ */
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/updateById", method = RequestMethod.PUT) @RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改数据字典", notes = "修改数据字典") @ApiOperation(httpMethod = "PUT", value = "修改数据字典", notes = "修改数据字典")
public boolean updateByIdDataDictionary(HttpServletRequest request, @RequestBody DataDictionary dataDictionary) { public boolean updateByIdDataDictionary(HttpServletRequest request, @RequestBody DataDictionary dataDictionary) {
return iDataDictionaryService.updateById(dataDictionary); return iDataDictionaryService.updateById(dataDictionary);
} }
/**
* 根据id查询
*
* @param id
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public DataDictionary selectById(HttpServletRequest request, @PathVariable Long id) {
return iDataDictionaryService.getById(id);
}
/** /**
* 根据id查询 * 列表分页查询
* *
* @param id * @return
* @return */
*/ @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) @RequestMapping(value = "/list", method = RequestMethod.GET)
@RequestMapping(value = "/{id}", method = RequestMethod.GET) @ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询") public IPage<DataDictionary> listPage(String pageNum, String pageSize, DataDictionary dataDictionary) {
public DataDictionary selectById(HttpServletRequest request, @PathVariable Long id) {
return iDataDictionaryService.getById(id);
}
Page<DataDictionary> pageBean;
QueryWrapper<DataDictionary> dataDictionaryQueryWrapper = new QueryWrapper<>();
Class<? extends DataDictionary> aClass = dataDictionary.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(dataDictionary);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(dataDictionary);
dataDictionaryQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(dataDictionary);
dataDictionaryQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(dataDictionary);
dataDictionaryQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(dataDictionary);
dataDictionaryQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
throw new RuntimeException("系统异常");
}
});
IPage<DataDictionary> page;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iDataDictionaryService.page(pageBean, dataDictionaryQueryWrapper);
return page;
}
/** @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
* 列表分页查询 @RequestMapping(value = "/gwmcDataDictionary/{type}", method = RequestMethod.GET)
* @ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典", notes = "根据字典类型查询字典")
* @return public ResponseModel<Object> gwmcDataDictionary(@PathVariable String type) throws Exception {
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public IPage<DataDictionary> listPage(String pageNum, String pageSize, DataDictionary dataDictionary) {
Page<DataDictionary> pageBean; QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
QueryWrapper<DataDictionary> dataDictionaryQueryWrapper = new QueryWrapper<>(); queryWrapper.eq("type", type);
Class<? extends DataDictionary> aClass = dataDictionary.getClass(); queryWrapper.orderByAsc("sort_num");
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(dataDictionary);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(dataDictionary);
dataDictionaryQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(dataDictionary);
dataDictionaryQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(dataDictionary);
dataDictionaryQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(dataDictionary);
dataDictionaryQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
throw new RuntimeException("系统异常");
}
});
IPage<DataDictionary> page;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iDataDictionaryService.page(pageBean, dataDictionaryQueryWrapper);
return page;
}
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
@RequestMapping(value = "/gwmcDataDictionary/{type}", method = RequestMethod.GET) Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典", notes = "根据字典类型查询字典") return ResponseHelper.buildResponse(obj);
public ResponseModel<Object> gwmcDataDictionary(@PathVariable String type) throws Exception { } else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
return ResponseHelper.buildResponse(menus);
}
}
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>(); @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
queryWrapper.eq("type", type); @RequestMapping(value = "/dataDictionary", method = RequestMethod.GET)
queryWrapper.orderByAsc("sort_num"); @ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典2", notes = "根据字典类型查询字典2")
public ResponseModel<Object> getDictionary(@RequestParam String type) throws Exception {
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) { QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type); queryWrapper.eq("type", type);
return ResponseHelper.buildResponse(obj); queryWrapper.orderByAsc("sort_num");
} else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
, "getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
return ResponseHelper.buildResponse(menus);
}
}
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
@RequestMapping(value = "/dataDictionary", method = RequestMethod.GET) Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典2", notes = "根据字典类型查询字典2") return ResponseHelper.buildResponse(obj);
public ResponseModel<Object> getDictionary(@RequestParam String type) throws Exception { } else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
return ResponseHelper.buildResponse(menus);
}
}
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>(); @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
queryWrapper.eq("type", type); @RequestMapping(value = "/gwmcDataDictionary/FireChemical/{type}", method = RequestMethod.GET)
queryWrapper.orderByAsc("sort_num"); @ApiOperation(httpMethod = "GET", value = "根据字典类型查询危险品字典", notes = "根据字典类型查询危险品字典")
public ResponseModel<Object> gwmcDataDictionaryFireChemical(@PathVariable String type) throws Exception {
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) { QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type); queryWrapper.eq("type", type);
return ResponseHelper.buildResponse(obj); queryWrapper.orderByAsc("sort_num");
} else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
, "getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
return ResponseHelper.buildResponse(menus);
}
}
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
@RequestMapping(value = "/gwmcDataDictionary/FireChemical/{type}", method = RequestMethod.GET) Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询危险品字典", notes = "根据字典类型查询危险品字典") return ResponseHelper.buildResponse(obj);
public ResponseModel<Object> gwmcDataDictionaryFireChemical(@PathVariable String type) throws Exception { } else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0,
"getName", "getParent", null);
MenuFrom Me = new MenuFrom("-1", "-1", "-1", "危化品库", "危化品库", "危化品库", "-1", null);
Me.setIsLeaf(false);
Me.setChildren(menus);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(Me), time);
return ResponseHelper.buildResponse(Me);
}
}
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>(); @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
queryWrapper.eq("type", type); @RequestMapping(value = "/form/list", method = RequestMethod.GET)
queryWrapper.orderByAsc("sort_num"); @ApiOperation(httpMethod = "GET", value = "根据表态类型多个code查询表单数据项", notes = "根据表态类型多个code查询表单数据项")
public ResponseModel<Object> selectFormdListItem(HttpServletRequest request, String types) {
HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
try {
String[] typest = types.split(",");
for (String type : typest) {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE_XIN + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE_XIN + type);
objectObjectHashMap.put(type, obj);
} else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<MenuFrom> menus = null;
menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE_XIN + type, JSON.toJSON(menus), time);
objectObjectHashMap.put(type, menus);
}
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
return ResponseHelper.buildResponse(objectObjectHashMap);
}
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) { @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type); @RequestMapping(value = "/dataDictionaryTree", method = RequestMethod.GET)
return ResponseHelper.buildResponse(obj); @ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典树", notes = "根据字典类型查询字典树")
} else { public ResponseModel<Object> getDictionaryTree(@RequestParam String type, @RequestParam String rootName)
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper); throws Exception {
List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0,
"getName", "getParent", null);
MenuFrom Me = new MenuFrom("-1", "-1", "-1", "危化品库", "危化品库", "危化品库", "-1", null);
Me.setIsLeaf(false);
Me.setChildren(menus);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(Me), time);
return ResponseHelper.buildResponse(Me);
}
}
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/form/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据表态类型多个code查询表单数据项", notes = "根据表态类型多个code查询表单数据项")
public ResponseModel<Object> selectFormdListItem(HttpServletRequest request, String types) {
HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
try {
String[] typest = types.split(",");
for (String type : typest) {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE_XIN + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE_XIN + type);
objectObjectHashMap.put(type, obj);
} else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<MenuFrom> menus = null;
menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE_XIN + type, JSON.toJSON(menus), time);
objectObjectHashMap.put(type, menus);
}
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
return ResponseHelper.buildResponse(objectObjectHashMap);
}
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/dataDictionaryTree", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典树", notes = "根据字典类型查询字典树")
public ResponseModel<Object> getDictionaryTree(@RequestParam String type, @RequestParam String rootName) throws Exception {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
, "getParent", null);
// 创建根节点
Menu menu = new Menu(-1L, rootName, -1L, menus, 0);
List<Menu> menuList = new ArrayList<>();
// 挂在主节点
menuList.add(menu);
return ResponseHelper.buildResponse(menuList);
}
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
Collection<DataDictionary> list = null;
if ("YJLDDW".equals(type)) {
list = dataDictionaryMapper.getNoInLinkUnit();
} else {
list = iDataDictionaryService.list(queryWrapper);
}
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", "getParent",
null);
// 创建根节点
Menu menu = new Menu(-1L, rootName, -1L, menus, 0);
List<Menu> menuList = new ArrayList<>();
// 挂在主节点
menuList.add(menu);
return ResponseHelper.buildResponse(menuList);
}
} }
...@@ -17,4 +17,9 @@ public interface DataDictionaryMapper extends BaseMapper<DataDictionary> { ...@@ -17,4 +17,9 @@ public interface DataDictionaryMapper extends BaseMapper<DataDictionary> {
* @return * @return
*/ */
public List<DataDictionary> getDataDictionaryListAndCount(); public List<DataDictionary> getDataDictionaryListAndCount();
/**
* 获取包含联动单位的联动单位树信息
* @return
*/
public List<DataDictionary> getNoInLinkUnit();
} }
...@@ -23,4 +23,26 @@ GROUP BY ...@@ -23,4 +23,26 @@ GROUP BY
</select> </select>
<select id ="getNoInLinkUnit" resultType="com.yeejoin.amos.boot.biz.common.entity.DataDictionary">
SELECT
cbb.*
FROM
cb_data_dictionary cbb
LEFT JOIN (
SELECT
emergency_linkage_unit_code,
COUNT(1) count
FROM
cb_linkage_unit
GROUP BY
emergency_linkage_unit_code
) elink ON elink.emergency_linkage_unit_code = cbb.`code`
WHERE
cbb.type = 'YJLDDW'
AND elink.count IS NOT NULL
</select>
</mapper> </mapper>
...@@ -38,4 +38,7 @@ public class CompanyDto { ...@@ -38,4 +38,7 @@ public class CompanyDto {
@ApiModelProperty(value = "单位名称") @ApiModelProperty(value = "单位名称")
private String name; private String name;
@ApiModelProperty(value = "重点部位数量")
private int keySiteNum;
} }
...@@ -220,8 +220,12 @@ ...@@ -220,8 +220,12 @@
a.companyMaleEmployees, a.companyMaleEmployees,
a.companyFemaleEmployees, a.companyFemaleEmployees,
a.managementType, a.managementType,
Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) AS distance Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) AS distance,
FROM important_companys a case when cks_d.count is null then 0 else cks_d.count end as keySiteNum
FROM important_companys a left join (
SELECT cks.belong_id ,count(cks.belong_id) count from cb_key_site cks GROUP BY cks.belong_id
)cks_d
on a.id=cks_d.belong_id
where a.longitude is not null and a.latitude is not null where a.longitude is not null and a.latitude is not null
<if test='par.distance!=null'> <if test='par.distance!=null'>
and Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) &lt;= and Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) &lt;=
......
...@@ -359,6 +359,12 @@ public class MaintenanceCompanyServiceImpl ...@@ -359,6 +359,12 @@ public class MaintenanceCompanyServiceImpl
filedParamsMap.put("status", paramsMap.get("status").toString()); filedParamsMap.put("status", paramsMap.get("status").toString());
} }
mainTableList = this.checkMaintenanceCompanyList(wrapper, paramsMap); mainTableList = this.checkMaintenanceCompanyList(wrapper, paramsMap);
/*BUG 2503 人员头像存在附件中,获取附件信息返回前端 start*/
for (MaintenanceCompany m:mainTableList
) {
m.setAttachments(sourceFileService.getAttachments(m.getSequenceNbr()));
}
/* *BUG 2503 end*/
List<Long> instanceIds = Lists.transform(mainTableList, MaintenanceCompany::getInstanceId); List<Long> instanceIds = Lists.transform(mainTableList, MaintenanceCompany::getInstanceId);
filedParamsMap.put("instanceIds", Joiner.on(",").join(instanceIds)); filedParamsMap.put("instanceIds", Joiner.on(",").join(instanceIds));
break; break;
...@@ -388,6 +394,7 @@ public class MaintenanceCompanyServiceImpl ...@@ -388,6 +394,7 @@ public class MaintenanceCompanyServiceImpl
if (!ObjectUtils.isEmpty(detail)) { if (!ObjectUtils.isEmpty(detail)) {
r.putAll(Bean.BeantoMap(detail)); r.putAll(Bean.BeantoMap(detail));
} }
}); });
return page; return page;
} }
......
...@@ -154,5 +154,11 @@ ...@@ -154,5 +154,11 @@
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="chenhao" id="2021-08-31-chenhao-1">
<comment>modify table cb_firefighters_thought add one columns</comment>
<sql>
ALTER TABLE `cb_firefighters_thought` modify talking_time datetime COMMENT '谈话时间';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
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