Commit 50825124 authored by 付培阳's avatar 付培阳

救援站信息业务接口修改

parent c99c159f
......@@ -63,4 +63,7 @@ public class RescueStationDto extends BaseEntity {
@ApiModelProperty(value = "所属单位id")
private Long affiliatedUnitId;
@ApiModelProperty(value = "经纬度")
private String longitudeLatitude;
}
package com.yeejoin.amos.boot.module.tzs.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
......@@ -7,6 +8,10 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* @author tb
......@@ -21,22 +26,26 @@ public class RescueStation extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "名称不能为空")
@ApiModelProperty(value = "应急救援机构名称")
private String name;
@ApiModelProperty(value = "省份")
private String province;
@NotNull(message = "地市不能为空")
@ApiModelProperty(value = "地市")
private String city;
@NotNull(message = "区县不能为空")
@ApiModelProperty(value = "区县")
private String district;
@NotNull(message = "区域代码不能为空")
@ApiModelProperty(value = "区域代码")
private String regionCode;
@NotNull(message = "地址不能为空")
@ApiModelProperty(value = "地址(详细地址,包括道路、门牌号码)")
private String address;
......@@ -64,4 +73,7 @@ public class RescueStation extends BaseEntity {
@ApiModelProperty(value = "所属单位id")
private Long affiliatedUnitId;
@ApiModelProperty(value = "经纬度")
private String longitudeLatitude;
}
package com.yeejoin.amos.boot.module.tzs.api.vo;
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;
/**
* @title: RescueStationNameVo
* @Author fpy
* @Date: 2021/6/10 19:10
* @Version 1.0
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("cb_maintenance_unit")
@ApiModel(value = "MaintenanceUnitNameVo", description = "MaintenanceUnitNameVo")
public class MaintenanceUnitNameVo extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "维护保养单位id")
private int sequence_nbr;
@ApiModelProperty(value = "维护保养单位名称")
private String unitName;
}
\ No newline at end of file
......@@ -64,4 +64,7 @@ public class RescueStationVo extends BaseEntity {
@ApiModelProperty(value = "所属单位id")
private Long affiliatedUnitId;
@ApiModelProperty(value = "经纬度")
private String longitudeLatitude;
}
......@@ -101,7 +101,7 @@ public class ElevatorController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ResponseModel<ElevatorVo> selectById(@PathVariable Long id) {
Elevator elevator = iElevatorService.getById(id);
ElevatorVo elevatorVo = BeanDtoVoUtils.convertElevatorToVo(elevator);
ElevatorVo elevatorVo = BeanDtoVoUtils.convertElevatorToVo(elevator,false);
return ResponseHelper.buildResponse(elevatorVo);
}
......
......@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.tzs.api.entity.MaintenanceUnit;
import com.yeejoin.amos.boot.module.tzs.api.service.IMaintenanceUnitService;
import com.yeejoin.amos.boot.module.tzs.api.vo.MaintenanceUnitNameVo;
import com.yeejoin.amos.boot.module.tzs.api.vo.MaintenanceUnitVo;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import io.swagger.annotations.Api;
......@@ -22,6 +23,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Arrays;
import java.util.Map;
/**
......@@ -94,7 +96,7 @@ public class MaintenanceUnitController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ResponseModel<MaintenanceUnitVo> selectById(@PathVariable Long id) {
MaintenanceUnit maintenanceUnit = iMaintenanceUnitService.getById(id);
MaintenanceUnitVo maintenanceUnitVo = BeanDtoVoUtils.convertMaintenanceUnitToVo(maintenanceUnit);
MaintenanceUnitVo maintenanceUnitVo = BeanDtoVoUtils.convertMaintenanceUnitToVo(maintenanceUnit, false);
return ResponseHelper.buildResponse(maintenanceUnitVo);
}
......@@ -199,5 +201,26 @@ public class MaintenanceUnitController extends BaseController {
IPage<MaintenanceUnitVo> maintenanceUnitVoIPage = BeanDtoVoUtils.maintenanceUnitIPageVo(page);
return ResponseHelper.buildResponse(maintenanceUnitVoIPage);
}
/**
* 根据名称查询维保单位列表
*
* @param unitName 维保单位名称
* @return 返回结果
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/query_maintenance_unit_name_list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据名称查询维保单位列表", notes = "根据名称查询维保单位列表")
public ResponseModel<IPage<MaintenanceUnitNameVo>> queryMaintenanceUnitListWithName(@PathVariable(required =
false) String unitName) {
QueryWrapper<MaintenanceUnit> maintenanceUnitQueryWrapper = new QueryWrapper<>();
maintenanceUnitQueryWrapper.select("distinct sequence_nbr,unit_name").like(StringUtils.isNotEmpty(unitName),
"unit_name", unitName);
Page<MaintenanceUnit> pageBean = new Page<>(0, Long.MAX_VALUE);
IPage<MaintenanceUnit> page = iMaintenanceUnitService.page(pageBean, maintenanceUnitQueryWrapper);
IPage<MaintenanceUnitNameVo> maintenanceUnitVoIPage = BeanDtoVoUtils.iPageVoStream(page,
MaintenanceUnitNameVo.class);
return ResponseHelper.buildResponse(maintenanceUnitVoIPage);
}
}
......@@ -40,7 +40,7 @@ import java.util.Arrays;
@Api(tags = "使用单位Api")
@RequestMapping(value = "/tzs/use-unit")
public class UseUnitController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(ElevatorController.class);
private final Logger logger = LoggerFactory.getLogger(UseUnitController.class);
@Autowired
IUseUnitService iUseUnitService;
......
......@@ -119,10 +119,11 @@ public class BeanDtoVoUtils {
/**
* 将电梯实体类转换为Vo
*
* @param source 实体类
* @param source 实体类
* @param isBatch 是否批量
* @return Vo类
*/
public static ElevatorVo convertElevatorToVo(Elevator source) {
public static ElevatorVo convertElevatorToVo(Elevator source, boolean isBatch) {
// 判断source是否为空
if (source == null) {
return null;
......@@ -138,8 +139,9 @@ public class BeanDtoVoUtils {
String[] photoList = photos.split(",");
target.setImg(Arrays.stream(photoList).map(ElevatorVo.Img::new).collect(Collectors.toList()));
}
// 根据数据字典设置值
getElevatorDictionaryByDictCode();
if (!isBatch) {
getElevatorDictionaryByDictCode();
}
List<DictionarieValueModel> categoryValue =
elevatorCategory.stream().filter(e -> e.getDictDataKey().equals(source.getCategory())).collect(Collectors.toList());
target.setCategory(categoryValue.isEmpty() ? "" : categoryValue.get(0).getDictDataValue());
......@@ -172,9 +174,14 @@ public class BeanDtoVoUtils {
* @return 转换后的Vo
*/
public static IPage<ElevatorVo> elevatorIPageVo(IPage<Elevator> page) {
try {
getElevatorDictionaryByDictCode();
} catch (Exception e) {
return null;
}
return page.convert(item -> {
try {
return convertElevatorToVo(item);
return convertElevatorToVo(item, true);
} catch (Exception e) {
return null;
}
......@@ -184,10 +191,11 @@ public class BeanDtoVoUtils {
/**
* 将MaintenanceUnit转换为Vo
*
* @param source 源对象
* @param source 源对象
* @param isBatch 是否批量
* @return 转换后的Vo
*/
public static MaintenanceUnitVo convertMaintenanceUnitToVo(MaintenanceUnit source) {
public static MaintenanceUnitVo convertMaintenanceUnitToVo(MaintenanceUnit source, boolean isBatch) {
// 判断source是否为空
if (source == null) {
return null;
......@@ -199,7 +207,9 @@ public class BeanDtoVoUtils {
BeanUtils.copyProperties(source, target);
// 返回新对象
// 根据数据字典设置值
getMaintenanceUnitDictionaryByDictCode();
if (!isBatch) {
getMaintenanceUnitDictionaryByDictCode();
}
List<DictionarieValueModel> qualificationLevelValue =
qualificationLevel.stream().filter(e -> e.getDictDataKey().equals(source.getQualificationLevel())).collect(Collectors.toList());
target.setQualificationLevel(qualificationLevelValue.isEmpty() ? "" :
......@@ -217,9 +227,14 @@ public class BeanDtoVoUtils {
* @return 转换后的分页对象
*/
public static IPage<MaintenanceUnitVo> maintenanceUnitIPageVo(IPage<MaintenanceUnit> page) {
try {
getMaintenanceUnitDictionaryByDictCode();
} catch (Exception e) {
return null;
}
return page.convert(item -> {
try {
return convertMaintenanceUnitToVo(item);
return convertMaintenanceUnitToVo(item, true);
} catch (Exception e) {
return null;
}
......
spring.application.name=SPECIAL-EQUIPMENT
server.port=10000
spring.profiles.active=dev
server.servlet.context-path=/specialEquipment
\ No newline at end of file
server.servlet.context-path=/specialEquipment
spring.jackson.date-format=YYYY-MM-DD HH:mm:ss
\ No newline at end of file
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