Commit 26274cdf authored by tangwei's avatar tangwei

修改扫描bug

parent b66d539b
//package com.yeejoin.amos.boot.module.common.biz.utils;
//
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.yeejoin.amos.boot.module.common.api.dto.FireExpertsDto;
//import com.yeejoin.amos.boot.module.common.api.entity.FireExperts;
//import org.springframework.beans.BeanUtils;
//import org.springframework.stereotype.Component;
//
//import java.time.LocalDate;
//import java.util.Calendar;
//import java.util.Date;
//
///**
// * @title: 实体类 Dto,Vo,entity 转换工具类
// * @Author fpy
// * @Date: 2021/6/3 13:53
// */
//@Component
//public class BeanDtoVoUtils {
//
// /**
// * Dot ,Vo ,Entity 相互转换
// *
// * @param source 原数据
// * @param targetClass 目标类
// * @param <T> 泛型类
// * @return 转换返回值
// */
// public static <T> T convert(Object source, Class<T> targetClass) {
// // 判断source是否为空
// if (source == null) {
// return null;
// }
// // 判断targetClass是否为空
// if (targetClass == null) {
// return null;
// }
// try {
// // 创建新的对象实例
// T target = targetClass.newInstance();
// // 把原对象数据拷贝到新对象
// BeanUtils.copyProperties(source, target);
// // 返回新对象
// return target;
// } catch (Exception e) {
// e.printStackTrace();
// return null;
// }
// }
//
// /**
// * Dot ,Vo ,Entity 相互转换
// *
// * @param source 原数据
// * @return 转换返回值
// */
// public static FireExpertsDto convertFireExperts(FireExperts source) {
// // 判断source是否为空
// if (source == null) {
// return null;
// }
// try {
// // 创建新的对象实例
// FireExpertsDto target = FireExpertsDto.class.newInstance();
// // 把原对象数据拷贝到新对象
// BeanUtils.copyProperties(source, target);
// // 计算年龄
// int age = getAge(source.getBirthdayTime());
// target.setAge(age);
// // 返回新对象
// return target;
// } catch (Exception e) {
// e.printStackTrace();
// return null;
// }
// }
//
// /**
// * IPage<Entity> 分页对象转 Page<Dto>
// *
// * @param page 原分页对象
// * @param v 目标vo类
// * @param <E> 泛型类
// * @param <V> 泛型类
// * @return 转换后的分页对象
// */
// public static <E, V> IPage<V> iPageDtoStream(IPage<E> page, Class<V> v) {
// return page.convert(item -> {
// try {
// return convert(item, v);
// } catch (Exception e) {
// return null;
// }
// });
// }
//
// /**
// * IPage<Entity> 分页对象转 Page<Dto>
// *
// * @param page 原分页对象
// * @return 转换后的分页对象
// */
// public static IPage<FireExpertsDto> iPageDtoStreamFireExperts(IPage<FireExperts> page) {
// return page.convert(item -> {
// try {
// return convertFireExperts(item);
// } catch (Exception e) {
// return null;
// }
// });
// }
//
// //由出生日期获得年龄
// public static int getAge(Date birthDay) {
// if (birthDay == null) {
// return 0;
// }
// LocalDate now = LocalDate.now();
// Calendar cal = Calendar.getInstance();
// cal.setTime(birthDay);
// int yearBirth = cal.get(Calendar.YEAR);
// int monthBirth = cal.get(Calendar.MONTH) + 1;
// int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH);
//
// LocalDate birth = LocalDate.of(yearBirth, monthBirth, dayOfMonthBirth);
// if (birth.isAfter(now)) {
// return 0;
// }
// int age = birth.until(now).getYears();
// return age;
// }
//
//}
\ No newline at end of file
......@@ -5,55 +5,66 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
public class CommonResponseUtil
{
public static ResponseModel success()
private static final String FAILURE="FAILURE";
public static ResponseModel<Object> success()
{
ResponseModel res = new ResponseModel();
ResponseModel<Object> res = new ResponseModel<Object>();
res.setDevMessage("SUCCESS");
res.setStatus(HttpStatus.OK.value());
return res;
}
public static ResponseModel success(Object obj)
public static ResponseModel<Object> success(Object obj)
{
ResponseModel res = new ResponseModel();
ResponseModel<Object> res = new ResponseModel<Object>();
res.setResult(obj);
res.setDevMessage("SUCCESS");
res.setStatus(HttpStatus.OK.value());
return res;
}
public static ResponseModel success(Object obj, String message)
public static ResponseModel<Object> success(Object obj, String message)
{
ResponseModel res = new ResponseModel();
ResponseModel<Object> res = new ResponseModel<Object>();
res.setResult(obj);
res.setDevMessage(message);
res.setStatus(HttpStatus.OK.value());
return res;
}
public static ResponseModel failure()
public static ResponseModel<Object> failure()
{
ResponseModel res = new ResponseModel();
res.setDevMessage("FAILURE");
ResponseModel<Object> res = new ResponseModel<Object>();
res.setDevMessage(FAILURE);
res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return res;
}
public static ResponseModel failure(String message)
public static ResponseModel<Object> failure(String message)
{
ResponseModel res = new ResponseModel();
res.setDevMessage("FAILURE");
ResponseModel<Object> res = new ResponseModel<Object>();
res.setDevMessage(FAILURE);
res.setMessage(message);
res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return res;
}
public static ResponseModel failure(Object obj, String message)
public static ResponseModel<Object> failure(Object obj, String message)
{
ResponseModel res = new ResponseModel();
ResponseModel<Object> res = new ResponseModel<Object>();
res.setResult(obj);
res.setDevMessage("FAILURE");
res.setDevMessage(FAILURE);
res.setMessage(message);
res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return res;
}
private CommonResponseUtil() {
}
}
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