提交 306331f2 作者: 谭志磊

style: 车辆字典类型来访信息注释、代码修改,excel工具类代码格式优化

上级 038eaa6b
......@@ -27,7 +27,7 @@ public class CarParam {
@Pattern(regexp = RegEx.CARNUM, message = "车牌号码格式不正确")
String carNum;
@ApiModelProperty(value = "车辆类型", example = "轿车")
@ApiModelProperty(value = "车辆类型", example = "1")
String carType;
@ApiModelProperty(value = "司机名称", example = "张三", required = true)
......
......@@ -71,7 +71,7 @@ public interface CarService {
* @param carParam CarParam
* @return 车辆来访信息分页数据
*/
Result<PageVo<CarVo>> PageCarInfo(CarQueryParam carParam, PageParam param);
Result<PageVo<CarVo>> pageCarInfo(CarQueryParam carParam, PageParam param);
/**
* 导出excel
......
......@@ -52,7 +52,7 @@ public class CarServiceImpl implements CarService {
}
Car car = Car
.builder()
.labelCardStatus("未发卡")
.labelCardStatus("1")
.carNum(carParam.getCarNum())
.carType(carParam.getCarType())
.driverMobile(carParam.getDriverMobile())
......@@ -101,7 +101,7 @@ public class CarServiceImpl implements CarService {
return Result.no(Status.NOT_FOUND);
}
Car car = optional.get();
car.setLabelCardStatus("已收卡");
car.setLabelCardStatus("3");
car.setCardRecTime(LocalDateTime.now());
Car carReuslt = carRepository.saveAndFlush(car);
return Result.ok(carReuslt.getId());
......@@ -114,7 +114,7 @@ public class CarServiceImpl implements CarService {
return Result.no(Status.NOT_FOUND);
}
Car car = optional.get();
car.setLabelCardStatus("使用中");
car.setLabelCardStatus("2");
car.setCardSendTime(LocalDateTime.now());
car.setLabelCard(labelCard);
Car carReuslt = carRepository.saveAndFlush(car);
......@@ -130,7 +130,7 @@ public class CarServiceImpl implements CarService {
//正在使用中的信息无法删除
Car entity = optional.get();
if (entity.getLabelCardStatus().equals("使用中")) {
if ("使用中".equals(entity.getLabelCardStatus())) {
return Result.no(Status.BAD_REQUEST, "标签卡使用中,信息无法删除");
}
carRepository.delete(entity);
......@@ -151,7 +151,7 @@ public class CarServiceImpl implements CarService {
}
@Override
public Result<PageVo<CarVo>> PageCarInfo(CarQueryParam carParam, PageParam param) {
public Result<PageVo<CarVo>> pageCarInfo(CarQueryParam carParam, PageParam param) {
Page<Car> all = carRepository.findAll(condition(carParam), PageParam.toPageable(param));
List<CarVo> data = all
.get()
......
......@@ -36,8 +36,9 @@ public interface DictService {
/**
* 从缓存中获取字典
* @param dictType
* @return
*
* @param dictType 字典类型
* @return 字典数据集合
*/
Result<ArrayList<Dict>> selectDict(String dictType);
......@@ -84,7 +85,7 @@ public interface DictService {
/**
* 是否该类型字典已有该字典值
*
* @param dictType String
* @param dictType String
* @param dictValue String
* @return 是否存在
*/
......
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.service.dict;
import com.yiring.app.param.dict.DictTypeParam;
import com.yiring.app.param.dict.DictTypeQueryParam;
import com.yiring.common.core.Result;
import com.yiring.common.dict.DictType;
import com.yiring.common.param.IdParam;
import com.yiring.common.param.PageParam;
import com.yiring.common.vo.PageVo;
/**
* @author tzl
* 2022/4/14 14:10
*/
public interface DictTypeService {
/**
* 根据条件分页查询字典类型
*
* @param dictTypeQueryParam DictTypeQueryParam
* @return 字典类型分页信息
*/
Result<PageVo<DictType>> pageDictTypeInfo(DictTypeQueryParam dictTypeQueryParam, PageParam param);
Result<DictType> getDictTypeInfo(Long id);
Result<String> delecteById(Long id);
Result<String> saveDictTypeInfo(DictTypeParam dictTypeParam);
Result<String> updateDictTypeInfo(DictTypeParam dictTypeParam, IdParam idParam);
boolean has(String param);
// /**
// * 根据条件分页查询字典类型
// *
// * @param dictTypeQueryParam DictTypeQueryParam
// * @return 字典类型分页信息
// */
// Result<PageVo<DictType>> pageDictTypeInfo(DictTypeQueryParam dictTypeQueryParam, PageParam param);
//
// Result<DictType> getDictTypeInfo(Long id);
//
// Result<String> delecteById(Long id);
//
// Result<String> saveDictTypeInfo(DictTypeParam dictTypeParam);
//
// Result<String> updateDictTypeInfo(DictTypeParam dictTypeParam, IdParam idParam);
//
// boolean has(String param);
}
......@@ -79,9 +79,9 @@ public class CarController {
}
@ApiOperation(value = "查看车辆来访信息(分页)")
@GetMapping("PageCarInfo")
public Result<PageVo<CarVo>> PageCarInfo(@Valid CarQueryParam carParam, @Valid PageParam param) {
return carService.PageCarInfo(carParam, param);
@GetMapping("pageCarInfo")
public Result<PageVo<CarVo>> pageCarInfo(@Valid CarQueryParam carParam, @Valid PageParam param) {
return carService.pageCarInfo(carParam, param);
}
@ApiOperation(value = "导出车辆来访信息")
......
......@@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
/**
* 字典数据控制器
*
* @author tzl
* 2022/4/13 17:10
*/
......
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.web.dict;
import com.yiring.app.param.dict.DictTypeParam;
import com.yiring.app.param.dict.DictTypeQueryParam;
import com.yiring.app.service.dict.DictTypeService;
import com.yiring.common.core.Result;
import com.yiring.common.dict.DictType;
import com.yiring.common.param.IdParam;
import com.yiring.common.param.PageParam;
import com.yiring.common.vo.PageVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import javax.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 字典类型控制器
*
* @author tzl
* 2022/4/14 15:14
*/
@Slf4j
@Validated
@Api(tags = "DictType")
@RestController
@RequestMapping("/DictType/")
public class DictTypeController {
@Resource
DictTypeService dictTypeService;
@ApiOperation(value = "新增字典类型信息")
@PostMapping("saveDictTypeInfo")
public Result<String> saveDictTypeInfo(@Valid DictTypeParam dictTypeParam) {
return dictTypeService.saveDictTypeInfo(dictTypeParam);
}
@ApiOperation(value = "修改字典类型信息")
@PostMapping("updateDictTypeInfo")
public Result<String> updateDictTypeInfo(@Valid DictTypeParam dictTypeParam, @Valid IdParam idParam) {
return dictTypeService.updateDictTypeInfo(dictTypeParam, idParam);
}
@ApiOperation(value = "删除字典类型信息")
@PostMapping("delecteById")
public Result<String> delecteById(@Valid IdParam idParam) {
return dictTypeService.delecteById(idParam.getId());
}
@ApiOperation(value = "查看字典类型信息(分页)")
@GetMapping("pageDictTypeInfo")
public Result<PageVo<DictType>> pageDictInfo(@Valid DictTypeQueryParam queryParam, @Valid PageParam param) {
return dictTypeService.pageDictTypeInfo(queryParam, param);
}
@ApiOperation(value = "查看字典类型信息详情")
@GetMapping("getDictTypeInfo")
public Result<DictType> getDictTypeInfo(@Valid IdParam idParam) {
return dictTypeService.getDictTypeInfo(idParam.getId());
}
//
// @Resource
// DictTypeService dictTypeService;
//
// @ApiOperation(value = "新增字典类型信息")
// @PostMapping("saveDictTypeInfo")
// public Result<String> saveDictTypeInfo(@Valid DictTypeParam dictTypeParam) {
// return dictTypeService.saveDictTypeInfo(dictTypeParam);
// }
//
// @ApiOperation(value = "修改字典类型信息")
// @PostMapping("updateDictTypeInfo")
// public Result<String> updateDictTypeInfo(@Valid DictTypeParam dictTypeParam, @Valid IdParam idParam) {
// return dictTypeService.updateDictTypeInfo(dictTypeParam, idParam);
// }
//
// @ApiOperation(value = "删除字典类型信息")
// @PostMapping("delecteById")
// public Result<String> delecteById(@Valid IdParam idParam) {
// return dictTypeService.delecteById(idParam.getId());
// }
//
// @ApiOperation(value = "查看字典类型信息(分页)")
// @GetMapping("pageDictTypeInfo")
// public Result<PageVo<DictType>> pageDictInfo(@Valid DictTypeQueryParam queryParam, @Valid PageParam param) {
// return dictTypeService.pageDictTypeInfo(queryParam, param);
// }
//
// @ApiOperation(value = "查看字典类型信息详情")
// @GetMapping("getDictTypeInfo")
// public Result<DictType> getDictTypeInfo(@Valid IdParam idParam) {
// return dictTypeService.getDictTypeInfo(idParam.getId());
// }
}
......@@ -12,7 +12,6 @@ import com.yiring.common.util.date.DateUtils;
import com.yiring.common.util.file.FileTypeUtils;
import com.yiring.common.util.file.ImageUtils;
import com.yiring.common.util.reflect.ReflectUtils;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
......@@ -362,10 +361,10 @@ public class ExcelUtils<T> {
public void exportExcel(HttpServletResponse response) {
try {
writeSheet();
// wb.write(response.getOutputStream());
FileOutputStream fos = new FileOutputStream("D:/a.xls");
wb.write(fos);
fos.close();
wb.write(response.getOutputStream());
// FileOutputStream fos = new FileOutputStream("D:/a.xls");
// wb.write(fos);
// fos.close();
} catch (Exception e) {
log.error("导出Excel异常{}", e.getMessage());
} finally {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论