Commit 98ac3988 authored by tangwei's avatar tangwei

迁移数据字典

parent e5ff4e0e
package com.yeejoin.amos.boot.biz.common.controller;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
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.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
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.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
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.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 数据字典
*
* @author tb
* @date 2021-06-07
*/
@RestController
@Api(tags = "数据字典Api")
@RequestMapping(value = "/data-dictionary")
public class DataDictionaryController extends BaseController {
@Autowired
DataDictionaryServiceImpl iDataDictionaryService;
@Autowired
RedisUtils redisUtils;
@Value("${redis.cache.failure.time}")
private long time;
/**
* 新增数据字典
*
* @return
*/
@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
*/
@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
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改数据字典", notes = "修改数据字典")
public boolean updateByIdDataDictionary(HttpServletRequest request, @RequestBody DataDictionary 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);
}
/**
* 列表分页查询
*
* @return
*/
@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> 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 = "根据字典类型查询字典")
public ResponseModel<Object> gwmcDataDictionary(@PathVariable String type) throws Exception {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
return ResponseHelper.buildResponse(obj);
} 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)
@RequestMapping(value = "/dataDictionary", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典2", notes = "根据字典类型查询字典2")
public ResponseModel<Object> getDictionary(@RequestParam String type) throws Exception {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
return ResponseHelper.buildResponse(obj);
} 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)
@RequestMapping(value = "/gwmcDataDictionary/FireChemical/{type}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询危险品字典", notes = "根据字典类型查询危险品字典")
public ResponseModel<Object> gwmcDataDictionaryFireChemical(@PathVariable String type) throws Exception {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
return ResponseHelper.buildResponse(obj);
} 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);
}
}
@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);
}
}
package com.yeejoin.amos.boot.biz.common.dao.mapper; //package com.yeejoin.amos.boot.biz.common.dao.mapper;
//
import org.apache.ibatis.annotations.Mapper; //import org.apache.ibatis.annotations.Mapper;
//
/** ///**
* MyBatis BaseMapper // * MyBatis BaseMapper
* @author DELL // * @author DELL
*/ // */
@Mapper //@Mapper
public interface BaseMapper { //public interface BaseMapper {
} //}
package com.yeejoin.amos.boot.biz.common.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
/**
* 数据字典 Mapper 接口
*
* @author tb
* @date 2021-06-07
*/
public interface DataDictionaryMapper extends BaseMapper<DataDictionary> {
}
package com.yeejoin.amos.boot.biz.common.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 数据字典
*
* @author tb
* @date 2021-06-07
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="DataDictionaryDto", description="数据字典")
public class DataDictionaryDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "code")
private String code;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "类型")
private String type;
@ApiModelProperty(value = "父级")
private Long parent;
@ApiModelProperty(value = "操作人名称")
private String recUserName;
}
package com.yeejoin.amos.boot.biz.common.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 数据字典
*
* @author tb
* @date 2021-06-07
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("cb_data_dictionary")
@ApiModel(value="DataDictionary对象", description="数据字典")
public class DataDictionary extends BaseEntity {
/**
*
*/
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "code")
private String code;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "类型")
private String type;
@ApiModelProperty(value = "父级")
private Long parent;
//新加排序字段
@ApiModelProperty(value = "排序字段")
private int sortNum;
}
package com.yeejoin.amos.boot.biz.common.service;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import java.util.List;
/**
* 数据字典 服务类
*
* @author tb
* @date 2021-06-07
*/
public interface IDataDictionaryService {
Object getFireChemical(String type) throws Exception;
Object gwmcDataDictionary(String type) throws Exception;
List<MenuFrom> getGWMCDataDictionary(String type) throws Exception;
}
package com.yeejoin.amos.boot.biz.common.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.biz.common.dto.DataDictionaryDto;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.IDataDictionaryService;
import com.yeejoin.amos.boot.biz.common.utils.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import java.util.Collection;
import java.util.List;
/**
* 数据字典 服务实现类
*
* @author tb
* @date 2021-06-07
*/
@Service
public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, DataDictionary, DataDictionaryMapper> implements IDataDictionaryService {
@Autowired
RedisUtils redisUtils;
@Value("${redis.cache.failure.time}")
private long time;
@Override
public Object getFireChemical(String type) throws Exception {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
return obj;
} else {
Collection<DataDictionary> list = this.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 Me;
}
}
@Override
public Object gwmcDataDictionary(String type) throws Exception {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
return obj;
} else {
Collection<DataDictionary> list = this.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 menus;
}
}
public List<MenuFrom> getGWMCDataDictionary(String type) throws Exception {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
Collection<DataDictionary> list = this.list(queryWrapper);
List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
, "getParent", null);
return menus;
}
}
package com.yeejoin.amos.boot.module.common.api.dto; //package com.yeejoin.amos.boot.module.common.api.dto;
//
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; //import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel; //import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; //import io.swagger.annotations.ApiModelProperty;
import lombok.Data; //import lombok.Data;
import lombok.EqualsAndHashCode; //import lombok.EqualsAndHashCode;
/** ///**
* 数据字典 //* 数据字典
* //*
* @author tb //* @author tb
* @date 2021-06-07 //* @date 2021-06-07
*/ //*/
@Data //@Data
@EqualsAndHashCode(callSuper = true) //@EqualsAndHashCode(callSuper = true)
@ApiModel(value="DataDictionaryDto", description="数据字典") //@ApiModel(value="DataDictionaryDto", description="数据字典")
public class DataDictionaryDto extends BaseDto { //public class DataDictionaryDto extends BaseDto {
private static final long serialVersionUID = 1L; // private static final long serialVersionUID = 1L;
//
//
@ApiModelProperty(value = "code") // @ApiModelProperty(value = "code")
private String code; // private String code;
//
@ApiModelProperty(value = "名称") // @ApiModelProperty(value = "名称")
private String name; // private String name;
//
@ApiModelProperty(value = "类型") // @ApiModelProperty(value = "类型")
private String type; // private String type;
//
@ApiModelProperty(value = "父级") // @ApiModelProperty(value = "父级")
private Long parent; // private Long parent;
//
@ApiModelProperty(value = "操作人名称") // @ApiModelProperty(value = "操作人名称")
private String recUserName; // private String recUserName;
//
} //}
package com.yeejoin.amos.boot.module.common.api.entity; //package com.yeejoin.amos.boot.module.common.api.entity;
//
import com.baomidou.mybatisplus.annotation.TableName; //import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; //import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; //import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; //import io.swagger.annotations.ApiModelProperty;
import lombok.Data; //import lombok.Data;
import lombok.EqualsAndHashCode; //import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; //import lombok.experimental.Accessors;
/** ///**
* 数据字典 //* 数据字典
* //*
* @author tb //* @author tb
* @date 2021-06-07 //* @date 2021-06-07
*/ //*/
@Data //@Data
@EqualsAndHashCode(callSuper = true) //@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true) //@Accessors(chain = true)
@TableName("cb_data_dictionary") //@TableName("cb_data_dictionary")
@ApiModel(value="DataDictionary对象", description="数据字典") //@ApiModel(value="DataDictionary对象", description="数据字典")
public class DataDictionary extends BaseEntity { //public class DataDictionary extends BaseEntity {
/** // /**
* // *
*/ // */
private static final long serialVersionUID = 1L; // private static final long serialVersionUID = 1L;
//
@ApiModelProperty(value = "code") // @ApiModelProperty(value = "code")
private String code; // private String code;
//
@ApiModelProperty(value = "名称") // @ApiModelProperty(value = "名称")
private String name; // private String name;
//
@ApiModelProperty(value = "类型") // @ApiModelProperty(value = "类型")
private String type; // private String type;
//
@ApiModelProperty(value = "父级") // @ApiModelProperty(value = "父级")
private Long parent; // private Long parent;
//
//新加排序字段 // //新加排序字段
@ApiModelProperty(value = "排序字段") // @ApiModelProperty(value = "排序字段")
private int sortNum; // private int sortNum;
//
} //}
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.common.api.feign; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.common.api.feign;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.component.feign.config.InnerInvokException; import com.yeejoin.amos.component.feign.config.InnerInvokException;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
...@@ -17,7 +18,7 @@ import java.util.Map; ...@@ -17,7 +18,7 @@ import java.util.Map;
* *
* @author Dell * @author Dell
*/ */
@FeignClient(name = "AMOS-EQUIPMANAGE", path = "equip", configuration = {MultipartSupportConfig.class}) @FeignClient(name = "AMOS-EQUIPMANAGE-122", path = "equip", configuration = {MultipartSupportConfig.class})
public interface EquipFeignClient { public interface EquipFeignClient {
/** /**
...@@ -114,4 +115,11 @@ public interface EquipFeignClient { ...@@ -114,4 +115,11 @@ public interface EquipFeignClient {
**/ **/
@RequestMapping(value = "/car/getTeamCarList", method = RequestMethod.GET) @RequestMapping(value = "/car/getTeamCarList", method = RequestMethod.GET)
ResponseModel<List<Map<String, Object>>> getTeamCarList(@RequestParam Double longitude, @RequestParam Double latitude); ResponseModel<List<Map<String, Object>>> getTeamCarList(@RequestParam Double longitude, @RequestParam Double latitude);
/**
* 车辆信息详情
**/
@RequestMapping(value = "/car/getCarDetailById/{id}", method = RequestMethod.GET)
ResponseModel<Map<String, Object>> getCarDetailById(@PathVariable Long id);
} }
package com.yeejoin.amos.boot.module.common.api.mapper; //package com.yeejoin.amos.boot.module.common.api.mapper;
//
import com.baomidou.mybatisplus.core.mapper.BaseMapper; //import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary; //import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary;
//
/** ///**
* 数据字典 Mapper 接口 //* 数据字典 Mapper 接口
* //*
* @author tb //* @author tb
* @date 2021-06-07 //* @date 2021-06-07
*/ //*/
public interface DataDictionaryMapper extends BaseMapper<DataDictionary> { //public interface DataDictionaryMapper extends BaseMapper<DataDictionary> {
//
} //}
package com.yeejoin.amos.boot.module.common.api.service; //package com.yeejoin.amos.boot.module.common.api.service;
//
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom; //import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
//
import java.util.List; //import java.util.List;
//
/** ///**
* 数据字典 服务类 // * 数据字典 服务类
* // *
* @author tb // * @author tb
* @date 2021-06-07 // * @date 2021-06-07
*/ // */
public interface IDataDictionaryService { //public interface IDataDictionaryService {
//
//
Object getFireChemical(String type) throws Exception; // Object getFireChemical(String type) throws Exception;
//
Object gwmcDataDictionary(String type) throws Exception; // Object gwmcDataDictionary(String type) throws Exception;
//
List<MenuFrom> getGWMCDataDictionary(String type) throws Exception; // List<MenuFrom> getGWMCDataDictionary(String type) throws Exception;
} //}
package com.yeejoin.amos.boot.module.jcs.api.dto;
import lombok.Data;
@Data
public class AircraftListTreeDto {
private String id;
private String name;
}
package com.yeejoin.amos.boot.module.jcs.api.mapper; package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftListTreeDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft; import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/** /**
...@@ -10,5 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -10,5 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @date 2021-06-29 * @date 2021-06-29
*/ */
public interface AircraftMapper extends BaseMapper<Aircraft> { public interface AircraftMapper extends BaseMapper<Aircraft> {
List<AircraftListTreeDto> getAircraft();
} }
package com.yeejoin.amos.boot.module.jcs.api.service; package com.yeejoin.amos.boot.module.jcs.api.service;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftListTreeDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft; import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
/** /**
...@@ -13,4 +17,7 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft; ...@@ -13,4 +17,7 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
public interface IAircraftService { public interface IAircraftService {
AircraftDto queryByAircraftSeq(String agencyCode, Long seq); AircraftDto queryByAircraftSeq(String agencyCode, Long seq);
Aircraft queryByaircraftModel(String seq); Aircraft queryByaircraftModel(String seq);
List<AircraftListTreeDto> getAircraft();
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jcs.api.mapper.AircraftMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jcs.api.mapper.AircraftMapper">
<select id="getAircraft" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.AircraftListTreeDto">
select jc_aircraft.aircraft_model id,jc_aircraft.aircraft_model name
from jc_aircraft where is_delete=0
</select>
</mapper> </mapper>
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
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.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.service.IDataDictionaryService;
import com.yeejoin.amos.boot.biz.common.utils.WordConverterUtils; import com.yeejoin.amos.boot.biz.common.utils.WordConverterUtils;
import com.yeejoin.amos.boot.module.command.api.dao.SeismometeorologyDtoDao; import com.yeejoin.amos.boot.module.command.api.dao.SeismometeorologyDtoDao;
import com.yeejoin.amos.boot.module.command.api.dto.SeismometeorologyDto; import com.yeejoin.amos.boot.module.command.api.dto.SeismometeorologyDto;
...@@ -785,11 +786,18 @@ public class CommandController extends BaseController { ...@@ -785,11 +786,18 @@ public class CommandController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "车辆资源", notes = "车辆资源") @ApiOperation(httpMethod = "GET", value = "车辆资源", notes = "车辆资源")
public ResponseModel<List<Map<String,Object>>> getTeamCarList(RequestData par) { public ResponseModel<List<Map<String,Object>>> getTeamCarList(RequestData par) {
List<Map<String,Object>> list= equipFeignClient.getTeamCarList(par.getLongitude(),par.getLatitude()).getResult(); ResponseModel<List<Map<String, Object>>> date= equipFeignClient.getTeamCarList(par.getLongitude(),par.getLatitude());
return ResponseHelper.buildResponse(list); return ResponseHelper.buildResponse(date!=null?date.getResult():null);
} }
@TycloudOperation( needAuth = true, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/fireCar")
@ApiOperation(httpMethod = "GET", value = "车辆资源详情", notes = "车辆资源详情")
public ResponseModel<Map<String,Object>> getCarDetailById(Long id ) {
ResponseModel<Map<String, Object>> date= equipFeignClient.getCarDetailById(id);
return ResponseHelper.buildResponse(date!=null?date.getResult():null);
}
......
package com.yeejoin.amos.boot.module.common.biz.controller; //package com.yeejoin.amos.boot.module.common.biz.controller;
//
import java.util.*; //import java.util.*;
//
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;
import org.springframework.web.bind.annotation.PathVariable; //import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; //import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; //import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; //import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; //import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; //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.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.Menu; //import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom; //import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils; //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 com.yeejoin.amos.boot.module.common.api.entity.DataDictionary; //import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DataDictionaryServiceImpl; //import com.yeejoin.amos.boot.module.common.biz.service.impl.DataDictionaryServiceImpl;
//
import io.swagger.annotations.Api; //import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; //import io.swagger.annotations.ApiOperation;
//
//
/** ///**
* 数据字典 // * 数据字典
* // *
* @author tb // * @author tb
* @date 2021-06-07 // * @date 2021-06-07
*/ // */
@RestController //@RestController
@Api(tags = "数据字典Api") //@Api(tags = "数据字典Api")
@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}") // @Value("${redis.cache.failure.time}")
private long time; // private long time;
//
/** // /**
* 新增数据字典 // * 新增数据字典
* // *
* @return // * @return
*/ // */
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/save", method = RequestMethod.POST) // @RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增数据字典", notes = "新增数据字典") // @ApiOperation(httpMethod = "POST", value = "新增数据字典", notes = "新增数据字典")
public boolean saveDataDictionary(HttpServletRequest request, @RequestBody DataDictionary dataDictionary) { // public boolean saveDataDictionary(HttpServletRequest request, @RequestBody DataDictionary dataDictionary) {
return iDataDictionaryService.save(dataDictionary); // return iDataDictionaryService.save(dataDictionary);
} // }
//
/** // /**
* 根据id删除 // * 根据id删除
* // *
* @param id // * @param id
* @return // * @return
*/ // */
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE) // @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除") // @ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean deleteById(HttpServletRequest request, @PathVariable Long id) { // public boolean deleteById(HttpServletRequest request, @PathVariable Long id) {
return iDataDictionaryService.removeById(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查询 // * 根据id查询
* // *
* @param id // * @param id
* @return // * @return
*/ // */
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.GET) // @RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询") // @ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public DataDictionary selectById(HttpServletRequest request, @PathVariable Long id) { // public DataDictionary selectById(HttpServletRequest request, @PathVariable Long id) {
return iDataDictionaryService.getById(id); // return iDataDictionaryService.getById(id);
} // }
//
//
/** // /**
* 列表分页查询 // * 列表分页查询
* // *
* @return // * @return
*/ // */
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/list", method = RequestMethod.GET) // @RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询") // @ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public IPage<DataDictionary> listPage(String pageNum, String pageSize, DataDictionary dataDictionary) { // public IPage<DataDictionary> listPage(String pageNum, String pageSize, DataDictionary dataDictionary) {
//
Page<DataDictionary> pageBean; // Page<DataDictionary> pageBean;
QueryWrapper<DataDictionary> dataDictionaryQueryWrapper = new QueryWrapper<>(); // QueryWrapper<DataDictionary> dataDictionaryQueryWrapper = new QueryWrapper<>();
Class<? extends DataDictionary> aClass = dataDictionary.getClass(); // Class<? extends DataDictionary> aClass = dataDictionary.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> { // Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try { // try {
field.setAccessible(true); // field.setAccessible(true);
Object o = field.get(dataDictionary); // Object o = field.get(dataDictionary);
if (o != null) { // if (o != null) {
Class<?> type = field.getType(); // Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName()); // String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) { // if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(dataDictionary); // Integer fileValue = (Integer) field.get(dataDictionary);
dataDictionaryQueryWrapper.eq(name, fileValue); // dataDictionaryQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) { // } else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(dataDictionary); // Long fileValue = (Long) field.get(dataDictionary);
dataDictionaryQueryWrapper.eq(name, fileValue); // dataDictionaryQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) { // } else if (type.equals(String.class)) {
String fileValue = (String) field.get(dataDictionary); // String fileValue = (String) field.get(dataDictionary);
dataDictionaryQueryWrapper.eq(name, fileValue); // dataDictionaryQueryWrapper.eq(name, fileValue);
} else { // } else {
String fileValue = (String) field.get(dataDictionary); // String fileValue = (String) field.get(dataDictionary);
dataDictionaryQueryWrapper.eq(name, fileValue); // dataDictionaryQueryWrapper.eq(name, fileValue);
} // }
} // }
} catch (Exception e) { // } catch (Exception e) {
throw new RuntimeException("系统异常"); // throw new RuntimeException("系统异常");
} // }
}); // });
IPage<DataDictionary> page; // IPage<DataDictionary> page;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) { // if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE); // pageBean = new Page<>(0, Long.MAX_VALUE);
} else { // } else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize)); // pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
} // }
page = iDataDictionaryService.page(pageBean, dataDictionaryQueryWrapper); // page = iDataDictionaryService.page(pageBean, dataDictionaryQueryWrapper);
return page; // return page;
} // }
//
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/gwmcDataDictionary/{type}", method = RequestMethod.GET) // @RequestMapping(value = "/gwmcDataDictionary/{type}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典", notes = "根据字典类型查询字典") // @ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典", notes = "根据字典类型查询字典")
public ResponseModel<Object> gwmcDataDictionary(@PathVariable String type) throws Exception { // public ResponseModel<Object> gwmcDataDictionary(@PathVariable String type) throws Exception {
//
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>(); // QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type); // queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num"); // queryWrapper.orderByAsc("sort_num");
//
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) { // if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type); // Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
return ResponseHelper.buildResponse(obj); // return ResponseHelper.buildResponse(obj);
} else { // } else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper); // Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName" // List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
, "getParent", null); // , "getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time); // redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
return ResponseHelper.buildResponse(menus); // return ResponseHelper.buildResponse(menus);
} // }
} // }
//
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/dataDictionary", method = RequestMethod.GET) // @RequestMapping(value = "/dataDictionary", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典2", notes = "根据字典类型查询字典2") // @ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典2", notes = "根据字典类型查询字典2")
public ResponseModel<Object> getDictionary(@RequestParam String type) throws Exception { // public ResponseModel<Object> getDictionary(@RequestParam String type) throws Exception {
//
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>(); // QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type); // queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num"); // queryWrapper.orderByAsc("sort_num");
//
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) { // if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type); // Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
return ResponseHelper.buildResponse(obj); // return ResponseHelper.buildResponse(obj);
} else { // } else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper); // Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName" // List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
, "getParent", null); // , "getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time); // redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
return ResponseHelper.buildResponse(menus); // return ResponseHelper.buildResponse(menus);
} // }
} // }
//
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/gwmcDataDictionary/FireChemical/{type}", method = RequestMethod.GET) // @RequestMapping(value = "/gwmcDataDictionary/FireChemical/{type}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询危险品字典", notes = "根据字典类型查询危险品字典") // @ApiOperation(httpMethod = "GET", value = "根据字典类型查询危险品字典", notes = "根据字典类型查询危险品字典")
public ResponseModel<Object> gwmcDataDictionaryFireChemical(@PathVariable String type) throws Exception { // public ResponseModel<Object> gwmcDataDictionaryFireChemical(@PathVariable String type) throws Exception {
//
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>(); // QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type); // queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num"); // queryWrapper.orderByAsc("sort_num");
//
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) { // if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type); // Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
return ResponseHelper.buildResponse(obj); // return ResponseHelper.buildResponse(obj);
} else { // } else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper); // Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, // List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0,
"getName", "getParent", null); // "getName", "getParent", null);
MenuFrom Me = new MenuFrom("-1", "-1", "-1", "危化品库", "危化品库", "危化品库", "-1", null); // MenuFrom Me = new MenuFrom("-1", "-1", "-1", "危化品库", "危化品库", "危化品库", "-1", null);
Me.setIsLeaf(false); // Me.setIsLeaf(false);
Me.setChildren(menus); // Me.setChildren(menus);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(Me), time); // redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(Me), time);
return ResponseHelper.buildResponse(Me); // return ResponseHelper.buildResponse(Me);
} // }
} // }
//
//
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/form/list", method = RequestMethod.GET) // @RequestMapping(value = "/form/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据表态类型多个code查询表单数据项", notes = "根据表态类型多个code查询表单数据项") // @ApiOperation(httpMethod = "GET", value = "根据表态类型多个code查询表单数据项", notes = "根据表态类型多个code查询表单数据项")
public ResponseModel<Object> selectFormdListItem(HttpServletRequest request, String types) { // public ResponseModel<Object> selectFormdListItem(HttpServletRequest request, String types) {
HashMap<Object, Object> objectObjectHashMap = new HashMap<>(); // HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
try { // try {
String[] typest = types.split(","); // String[] typest = types.split(",");
for (String type : typest) { // for (String type : typest) {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>(); // QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type); // queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num"); // queryWrapper.orderByAsc("sort_num");
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE_XIN + type)) { // if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE_XIN + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE_XIN + type); // Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE_XIN + type);
objectObjectHashMap.put(type, obj); // objectObjectHashMap.put(type, obj);
} else { // } else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper); // Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<MenuFrom> menus = null; // List<MenuFrom> menus = null;
menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", // menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", null); // "getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE_XIN + type, JSON.toJSON(menus), time); // redisUtils.set(RedisKey.DATA_DICTIONARY_CODE_XIN + type, JSON.toJSON(menus), time);
objectObjectHashMap.put(type, menus); // objectObjectHashMap.put(type, menus);
} // }
} // }
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
throw new RuntimeException("系统异常!"); // throw new RuntimeException("系统异常!");
} // }
return ResponseHelper.buildResponse(objectObjectHashMap); // return ResponseHelper.buildResponse(objectObjectHashMap);
} // }
//
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/dataDictionaryTree", method = RequestMethod.GET) // @RequestMapping(value = "/dataDictionaryTree", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典树", notes = "根据字典类型查询字典树") // @ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典树", notes = "根据字典类型查询字典树")
public ResponseModel<Object> getDictionaryTree(@RequestParam String type, @RequestParam String rootName) throws Exception { // public ResponseModel<Object> getDictionaryTree(@RequestParam String type, @RequestParam String rootName) throws Exception {
//
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>(); // QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type); // queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num"); // queryWrapper.orderByAsc("sort_num");
//
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper); // Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName" // List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
, "getParent", null); // , "getParent", null);
// 创建根节点 // // 创建根节点
Menu menu = new Menu(-1L, rootName, -1L, menus, 0); // Menu menu = new Menu(-1L, rootName, -1L, menus, 0);
List<Menu> menuList = new ArrayList<>(); // List<Menu> menuList = new ArrayList<>();
// 挂在主节点 // // 挂在主节点
menuList.add(menu); // menuList.add(menu);
return ResponseHelper.buildResponse(menuList); // return ResponseHelper.buildResponse(menuList);
} // }
//
//
} //}
//
...@@ -4,31 +4,23 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -4,31 +4,23 @@ 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.controller.BaseController;
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.utils.Menu; import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
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 com.yeejoin.amos.boot.module.common.api.dto.ExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireChemicalDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireExpertsDto; import com.yeejoin.amos.boot.module.common.api.dto.FireExpertsDto;
import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.common.api.entity.FireExperts; import com.yeejoin.amos.boot.module.common.api.entity.FireExperts;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireExpertsServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.FireExpertsServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.utils.BeanDtoVoUtils; import com.yeejoin.amos.boot.module.common.biz.utils.BeanDtoVoUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean;
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 javax.servlet.http.HttpServletResponse;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
......
package com.yeejoin.amos.boot.module.common.biz.service.impl; //package com.yeejoin.amos.boot.module.common.biz.service.impl;
//
//
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.yeejoin.amos.boot.biz.common.utils.*; //import com.yeejoin.amos.boot.biz.common.utils.*;
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;
import org.springframework.stereotype.Service; //import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService; //import org.typroject.tyboot.core.rdbms.service.BaseService;
//
import com.yeejoin.amos.boot.module.common.api.dto.DataDictionaryDto; //import com.yeejoin.amos.boot.module.common.api.dto.DataDictionaryDto;
import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary; //import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.common.api.mapper.DataDictionaryMapper; //import com.yeejoin.amos.boot.module.common.api.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDataDictionaryService; //import com.yeejoin.amos.boot.module.common.api.service.IDataDictionaryService;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; //import org.typroject.tyboot.core.restful.utils.ResponseHelper;
//
import java.util.Collection; //import java.util.Collection;
import java.util.List; //import java.util.List;
//
/** ///**
* 数据字典 服务实现类 // * 数据字典 服务实现类
* // *
* @author tb // * @author tb
* @date 2021-06-07 // * @date 2021-06-07
*/ // */
@Service //@Service
public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, DataDictionary, DataDictionaryMapper> implements IDataDictionaryService { //public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, DataDictionary, DataDictionaryMapper> implements IDataDictionaryService {
@Autowired // @Autowired
RedisUtils redisUtils; // RedisUtils redisUtils;
//
@Value("${redis.cache.failure.time}") // @Value("${redis.cache.failure.time}")
private long time; // private long time;
//
//
@Override // @Override
public Object getFireChemical(String type) throws Exception { // public Object getFireChemical(String type) throws Exception {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>(); // QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type); // queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num"); // queryWrapper.orderByAsc("sort_num");
//
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) { // if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type); // Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
return obj; // return obj;
} else { // } else {
Collection<DataDictionary> list = this.list(queryWrapper); // Collection<DataDictionary> list = this.list(queryWrapper);
List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, // List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0,
"getName", "getParent", null); // "getName", "getParent", null);
MenuFrom Me = new MenuFrom("-1", "-1", "-1", "危化品库", "危化品库", "危化品库", "-1", null); // MenuFrom Me = new MenuFrom("-1", "-1", "-1", "危化品库", "危化品库", "危化品库", "-1", null);
Me.setIsLeaf(false); // Me.setIsLeaf(false);
Me.setChildren(menus); // Me.setChildren(menus);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(Me), time); // redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(Me), time);
return Me; // return Me;
} // }
} // }
//
@Override // @Override
public Object gwmcDataDictionary(String type) throws Exception { // public Object gwmcDataDictionary(String type) throws Exception {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>(); // QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type); // queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num"); // queryWrapper.orderByAsc("sort_num");
//
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) { // if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type); // Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE + type);
return obj; // return obj;
} else { // } else {
Collection<DataDictionary> list = this.list(queryWrapper); // Collection<DataDictionary> list = this.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName" // List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
, "getParent", null); // , "getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time); // redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
return menus; // return menus;
} // }
} // }
//
public List<MenuFrom> getGWMCDataDictionary(String type) throws Exception { // public List<MenuFrom> getGWMCDataDictionary(String type) throws Exception {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>(); // QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type); // queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num"); // queryWrapper.orderByAsc("sort_num");
//
Collection<DataDictionary> list = this.list(queryWrapper); // Collection<DataDictionary> list = this.list(queryWrapper);
List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, "getName" // List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
, "getParent", null); // , "getParent", null);
return menus; // return menus;
//
} // }
} //}
...@@ -19,12 +19,13 @@ import com.alibaba.fastjson.JSONArray; ...@@ -19,12 +19,13 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.common.api.dto.DynamicFormColumnDto; import com.yeejoin.amos.boot.module.common.api.dto.DynamicFormColumnDto;
import com.yeejoin.amos.boot.module.common.api.dto.DynamicFormInitDto; import com.yeejoin.amos.boot.module.common.api.dto.DynamicFormInitDto;
import com.yeejoin.amos.boot.module.common.api.dto.DynamicFormInstanceDto; import com.yeejoin.amos.boot.module.common.api.dto.DynamicFormInstanceDto;
import com.yeejoin.amos.boot.module.common.api.dto.SelectItem; import com.yeejoin.amos.boot.module.common.api.dto.SelectItem;
import com.yeejoin.amos.boot.module.common.api.dto.SelectItems; import com.yeejoin.amos.boot.module.common.api.dto.SelectItems;
import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn; import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn;
import com.yeejoin.amos.boot.module.common.api.mapper.DynamicFormColumnMapper; import com.yeejoin.amos.boot.module.common.api.mapper.DynamicFormColumnMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDynamicFormColumnService; import com.yeejoin.amos.boot.module.common.api.service.IDynamicFormColumnService;
......
...@@ -15,10 +15,11 @@ import org.typroject.tyboot.core.rdbms.annotation.Operator; ...@@ -15,10 +15,11 @@ import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.utils.Menu; import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser; import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto; import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.common.api.entity.Firefighters; import com.yeejoin.amos.boot.module.common.api.entity.Firefighters;
import com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper; import com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFirefightersService; import com.yeejoin.amos.boot.module.common.api.service.IFirefightersService;
......
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom; import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.module.common.api.entity.RescueEquipment; import com.yeejoin.amos.boot.module.common.api.entity.RescueEquipment;
import com.yeejoin.amos.boot.module.common.api.entity.SpecialPositionStaff; import com.yeejoin.amos.boot.module.common.api.entity.SpecialPositionStaff;
......
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom; import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.module.common.api.entity.SpecialPositionStaff; import com.yeejoin.amos.boot.module.common.api.entity.SpecialPositionStaff;
import com.yeejoin.amos.boot.module.common.api.mapper.SpecialPositionStaffMapper; import com.yeejoin.amos.boot.module.common.api.mapper.SpecialPositionStaffMapper;
......
...@@ -5,12 +5,15 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController; ...@@ -5,12 +5,15 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto; import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil; import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftListTreeDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft; import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AircraftServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AircraftServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.DataSourcesImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.DataSourcesImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -25,7 +28,9 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -25,7 +28,9 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
...@@ -129,4 +134,61 @@ public class AircraftController extends BaseController { ...@@ -129,4 +134,61 @@ public class AircraftController extends BaseController {
return ResponseHelper.buildResponse(aircraftServiceImpl.queryForAircraftPage(page, false, aircraftModel, return ResponseHelper.buildResponse(aircraftServiceImpl.queryForAircraftPage(page, false, aircraftModel,
engineTypeCode, fuelTypeCode)); engineTypeCode, fuelTypeCode));
} }
/**
*
*
* @param 获取航空器型号列表
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getAircraft")
@ApiOperation(httpMethod = "GET", value = "获取航空器型号列表", notes = "获取航空器型号列表")
public ResponseModel<List<AircraftListTreeDto>> getAircraft() {
return ResponseHelper.buildResponse(aircraftServiceImpl.getAircraft());
}
/**
*
* 获取24小时内的航班号
*
* **/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getAircraftNum")
@ApiOperation(httpMethod = "GET", value = "获取24小时内的航班号", notes = "获取24小时内的航班号")
public ResponseModel<List<Map<String, Object>>> getAircraftNum() {
List<Map<String, Object>> list= new ArrayList<>();
Map<String, Object> map=new HashedMap();
Map<String, Object> map1=new HashedMap();
map.put("id", "1");map.put("name", "测试");
map1.put("id", "12");map1.put("name", "测试2");
list.add(map1);
list.add(map);
return ResponseHelper.buildResponse(list);
}
/**
*
* 通过航班号,查询最新的航班信息
*
* **/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getAircraftDetails/{num}")
@ApiOperation(httpMethod = "GET", value = "通过航班号,查询最新的航班信息", notes = "通过航班号,查询最新的航班信息")
public ResponseModel<Map<String, Object>> getAircraftDetails(@PathVariable String num) {
Map<String, Object> map1=new HashedMap();
map1.put("aircraftModel", "型号1");
map1.put("landingTime", new Date());
map1.put("fuelQuantity", "12");
map1.put("passengerCapacity", "测试2");
return ResponseHelper.buildResponse(map1);
}
} }
...@@ -19,8 +19,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -19,8 +19,8 @@ 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.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils; import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedSMSDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedSMSDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.SchedulingReportingDto; import com.yeejoin.amos.boot.module.jcs.api.dto.SchedulingReportingDto;
......
...@@ -6,6 +6,7 @@ import java.util.List; ...@@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.exception.BaseException; import org.typroject.tyboot.core.foundation.exception.BaseException;
...@@ -20,6 +21,7 @@ import org.typroject.tyboot.core.restful.exception.instance.DataNotFound; ...@@ -20,6 +21,7 @@ import org.typroject.tyboot.core.restful.exception.instance.DataNotFound;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftListTreeDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.KeyValueLabel; import com.yeejoin.amos.boot.module.jcs.api.dto.KeyValueLabel;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft; import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
...@@ -40,6 +42,9 @@ import com.yeejoin.amos.feign.systemctl.model.FileInfoModel; ...@@ -40,6 +42,9 @@ import com.yeejoin.amos.feign.systemctl.model.FileInfoModel;
@Service @Service
public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, AircraftMapper> implements IAircraftService { public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, AircraftMapper> implements IAircraftService {
@Autowired
AircraftMapper aircraftMapper;
/** /**
* <pre> * <pre>
* 保存 * 保存
...@@ -254,4 +259,10 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc ...@@ -254,4 +259,10 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
Aircraft aircraft = this.getOne(queryWrapper); Aircraft aircraft = this.getOne(queryWrapper);
return aircraft; return aircraft;
} }
@Override
public List<AircraftListTreeDto> getAircraft() {
return aircraftMapper.getAircraft();
}
} }
...@@ -12,8 +12,8 @@ import org.springframework.stereotype.Service; ...@@ -12,8 +12,8 @@ import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary; import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertFormDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertFormDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertFormInitDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertFormInitDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertListvalue; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertListvalue;
......
...@@ -4,13 +4,13 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,13 +4,13 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
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.utils.EnumsUtils; import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils;
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.module.common.api.dto.FormValue; import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient; import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
......
...@@ -26,18 +26,18 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -26,18 +26,18 @@ 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.google.common.collect.Lists; import com.google.common.collect.Lists;
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.utils.MenuFrom; import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto; import com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamListDto; import com.yeejoin.amos.boot.module.common.api.dto.FireTeamListDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto; import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto; import com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto; import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.common.api.entity.MaintenanceCompany; import com.yeejoin.amos.boot.module.common.api.entity.MaintenanceCompany;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.enums.ExcelSelectData; import com.yeejoin.amos.boot.module.common.api.enums.ExcelSelectData;
import com.yeejoin.amos.boot.module.common.api.excel.DataSources; import com.yeejoin.amos.boot.module.common.api.excel.DataSources;
import com.yeejoin.amos.boot.module.common.api.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService; import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService;
import com.yeejoin.amos.boot.module.common.api.service.IMaintenanceCompanyService; import com.yeejoin.amos.boot.module.common.api.service.IMaintenanceCompanyService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl;
......
...@@ -39,7 +39,8 @@ import java.net.UnknownHostException; ...@@ -39,7 +39,8 @@ import java.net.UnknownHostException;
"org.typroject.tyboot.face.*.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*",
"org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.core.auth.face.orm.dao*",
"org.typroject.tyboot.component.*.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*",
"com.yeejoin.amos.boot.module.*.api.mapper"}) "com.yeejoin.amos.boot.module.*.api.mapper",
"com.yeejoin.amos.boot.biz.common.dao.mapper" })
@ComponentScan(basePackages = { "org.typroject", "com.yeejoin.amos" }) @ComponentScan(basePackages = { "org.typroject", "com.yeejoin.amos" })
public class AmosJcsApplication public class AmosJcsApplication
{ {
......
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