Commit e0ed948c authored by tianbo's avatar tianbo

整理pom文件,优化代码

parent 03350ab1
...@@ -5,6 +5,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -5,6 +5,7 @@ import org.apache.commons.lang3.StringUtils;
import java.text.ParseException; import java.text.ParseException;
import java.text.ParsePosition; import java.text.ParsePosition;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*; import java.util.*;
/** /**
...@@ -663,4 +664,27 @@ public class DateUtils { ...@@ -663,4 +664,27 @@ public class DateUtils {
return date.after(begin) && date.before(end); return date.after(begin) && date.before(end);
} }
/**
* 由出生日期获得年龄
*
* @param birthDay 出生日期
*/
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;
}
} }
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.module.common.api.entity.SourceFile; import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.omg.CORBA.PRIVATE_MEMBER;
/** /**
* 联动单位 * 联动单位
* *
......
package com.yeejoin.amos.boot.module.common.api.entity; package com.yeejoin.amos.boot.module.common.api.entity;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
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 com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto; import java.util.List;
import io.swagger.annotations.ApiModelProperty; import java.util.Map;
/** /**
......
...@@ -4,7 +4,6 @@ import java.util.List; ...@@ -4,7 +4,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.MaintenancePersonExcleDto; import com.yeejoin.amos.boot.module.common.api.dto.MaintenancePersonExcleDto;
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.entity.DynamicFormInstance; import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
......
...@@ -16,6 +16,12 @@ ...@@ -16,6 +16,12 @@
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>4.0.9.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-common-api</artifactId> <artifactId>amos-boot-module-common-api</artifactId>
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
......
...@@ -15,22 +15,5 @@ ...@@ -15,22 +15,5 @@
<artifactId>amos-boot-module-common-api</artifactId> <artifactId>amos-boot-module-common-api</artifactId>
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-jcs-api</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<!-- <dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-maintenance-biz</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency> -->
<!-- <dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-patrol-biz</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>-->
</dependencies> </dependencies>
</project> </project>
...@@ -6,22 +6,35 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -6,22 +6,35 @@ 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.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
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.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.FireExpertsDto; import com.yeejoin.amos.boot.module.common.api.dto.FireExpertsDto;
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.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 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.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
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.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 java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -100,7 +113,7 @@ public class FireExpertsController extends BaseController { ...@@ -100,7 +113,7 @@ public class FireExpertsController extends BaseController {
public ResponseModel<FireExpertsDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<FireExpertsDto> selectOne(@PathVariable Long sequenceNbr) {
FireExpertsDto fireExpertsDto = fireExpertsServiceImpl.queryBySeq(sequenceNbr); FireExpertsDto fireExpertsDto = fireExpertsServiceImpl.queryBySeq(sequenceNbr);
Date birthdayTime = fireExpertsDto.getBirthdayTime(); Date birthdayTime = fireExpertsDto.getBirthdayTime();
int age = BeanDtoVoUtils.getAge(birthdayTime); int age = DateUtils.getAge(birthdayTime);
fireExpertsDto.setAge(age); fireExpertsDto.setAge(age);
return ResponseHelper.buildResponse(fireExpertsDto); return ResponseHelper.buildResponse(fireExpertsDto);
} }
...@@ -125,7 +138,7 @@ public class FireExpertsController extends BaseController { ...@@ -125,7 +138,7 @@ public class FireExpertsController extends BaseController {
Page<FireExpertsDto> fireExpertsDtoPage = fireExpertsServiceImpl.queryForFireExpertsPage(page, false, Page<FireExpertsDto> fireExpertsDtoPage = fireExpertsServiceImpl.queryForFireExpertsPage(page, false,
fireExpertsDto.getName(), fireExpertsDto.getExpertCode()); fireExpertsDto.getName(), fireExpertsDto.getExpertCode());
List<FireExpertsDto> fireExpertsDtoList = fireExpertsDtoPage.getRecords().stream().map(item -> { List<FireExpertsDto> fireExpertsDtoList = fireExpertsDtoPage.getRecords().stream().map(item -> {
item.setAge(BeanDtoVoUtils.getAge(item.getBirthdayTime())); item.setAge(DateUtils.getAge(item.getBirthdayTime()));
return item; return item;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
fireExpertsDtoPage.setRecords(fireExpertsDtoList); fireExpertsDtoPage.setRecords(fireExpertsDtoList);
...@@ -143,7 +156,7 @@ public class FireExpertsController extends BaseController { ...@@ -143,7 +156,7 @@ public class FireExpertsController extends BaseController {
public ResponseModel<List<FireExpertsDto>> selectForList() { public ResponseModel<List<FireExpertsDto>> selectForList() {
List<FireExpertsDto> fireExpertsDtoList = fireExpertsServiceImpl.queryForFireExpertsList(false); List<FireExpertsDto> fireExpertsDtoList = fireExpertsServiceImpl.queryForFireExpertsList(false);
fireExpertsDtoList.stream().map(item -> { fireExpertsDtoList.stream().map(item -> {
item.setAge(BeanDtoVoUtils.getAge(item.getBirthdayTime())); item.setAge(DateUtils.getAge(item.getBirthdayTime()));
return item; return item;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
......
package com.yeejoin.amos.boot.module.common.biz.controller; package com.yeejoin.amos.boot.module.common.biz.controller;
import java.util.ArrayList; import com.alibaba.fastjson.JSONArray;
import java.util.List; import com.alibaba.fastjson.JSONObject;
import java.util.Map; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import javax.servlet.http.HttpServletRequest; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.KeySiteServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import io.swagger.annotations.Api;
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.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -21,22 +29,10 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -21,22 +29,10 @@ 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.JSONArray; import javax.servlet.http.HttpServletRequest;
import com.alibaba.fastjson.JSONObject; import java.util.ArrayList;
import com.baomidou.mybatisplus.core.metadata.IPage; import java.util.List;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import java.util.Map;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.amos.boot.module.common.api.entity.KeySite;
import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.KeySiteServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/** /**
* 重点部位 * 重点部位
......
...@@ -6,7 +6,6 @@ import java.util.Map; ...@@ -6,7 +6,6 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
......
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.runtime.directive.Foreach;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Sequence; import com.baomidou.mybatisplus.core.toolkit.Sequence;
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.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto; import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto; import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteExcleDto; import com.yeejoin.amos.boot.module.common.api.dto.KeySiteExcleDto;
...@@ -40,6 +19,23 @@ import com.yeejoin.amos.boot.module.common.api.mapper.KeySiteMapper; ...@@ -40,6 +19,23 @@ import com.yeejoin.amos.boot.module.common.api.mapper.KeySiteMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper; import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService; import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
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 java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -38,6 +21,21 @@ import com.yeejoin.amos.boot.module.common.api.entity.LinkageUnit; ...@@ -38,6 +21,21 @@ import com.yeejoin.amos.boot.module.common.api.entity.LinkageUnit;
import com.yeejoin.amos.boot.module.common.api.entity.SourceFile; import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import com.yeejoin.amos.boot.module.common.api.mapper.LinkageUnitMapper; import com.yeejoin.amos.boot.module.common.api.mapper.LinkageUnitMapper;
import com.yeejoin.amos.boot.module.common.api.service.ILinkageUnitService; import com.yeejoin.amos.boot.module.common.api.service.ILinkageUnitService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 联动单位服务实现类 * 联动单位服务实现类
...@@ -260,6 +258,7 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU ...@@ -260,6 +258,7 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU
return update; return update;
} }
@Override
public List<Menu> getEmergencyLinkageUnitCodeGroupBy(String type, String rootName) { public List<Menu> getEmergencyLinkageUnitCodeGroupBy(String type, String rootName) {
List<Map<String, Object>> map = linkageUnitMapper.getEmergencyLinkageUnitCodeGroupByAndCount(); List<Map<String, Object>> map = linkageUnitMapper.getEmergencyLinkageUnitCodeGroupByAndCount();
......
package com.yeejoin.amos.boot.module.common.biz.utils; //package com.yeejoin.amos.boot.module.common.biz.utils;
//
import com.baomidou.mybatisplus.core.metadata.IPage; //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.dto.FireExpertsDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireExperts; //import com.yeejoin.amos.boot.module.common.api.entity.FireExperts;
import org.springframework.beans.BeanUtils; //import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
import java.time.LocalDate; //import java.time.LocalDate;
import java.util.Calendar; //import java.util.Calendar;
import java.util.Date; //import java.util.Date;
//
/** ///**
* @title: 实体类 Dto,Vo,entity 转换工具类 // * @title: 实体类 Dto,Vo,entity 转换工具类
* @Author fpy // * @Author fpy
* @Date: 2021/6/3 13:53 // * @Date: 2021/6/3 13:53
*/ // */
@Component //@Component
public class BeanDtoVoUtils { //public class BeanDtoVoUtils {
//
/** // /**
* Dot ,Vo ,Entity 相互转换 // * Dot ,Vo ,Entity 相互转换
* // *
* @param source 原数据 // * @param source 原数据
* @param targetClass 目标类 // * @param targetClass 目标类
* @param <T> 泛型类 // * @param <T> 泛型类
* @return 转换返回值 // * @return 转换返回值
*/ // */
public static <T> T convert(Object source, Class<T> targetClass) { // public static <T> T convert(Object source, Class<T> targetClass) {
// 判断source是否为空 // // 判断source是否为空
if (source == null) { // if (source == null) {
return null; // return null;
} // }
// 判断targetClass是否为空 // // 判断targetClass是否为空
if (targetClass == null) { // if (targetClass == null) {
return null; // return null;
} // }
try { // try {
// 创建新的对象实例 // // 创建新的对象实例
T target = targetClass.newInstance(); // T target = targetClass.newInstance();
// 把原对象数据拷贝到新对象 // // 把原对象数据拷贝到新对象
BeanUtils.copyProperties(source, target); // BeanUtils.copyProperties(source, target);
// 返回新对象 // // 返回新对象
return target; // return target;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return null; // return null;
} // }
} // }
//
/** // /**
* Dot ,Vo ,Entity 相互转换 // * Dot ,Vo ,Entity 相互转换
* // *
* @param source 原数据 // * @param source 原数据
* @return 转换返回值 // * @return 转换返回值
*/ // */
public static FireExpertsDto convertFireExperts(FireExperts source) { // public static FireExpertsDto convertFireExperts(FireExperts source) {
// 判断source是否为空 // // 判断source是否为空
if (source == null) { // if (source == null) {
return null; // return null;
} // }
try { // try {
// 创建新的对象实例 // // 创建新的对象实例
FireExpertsDto target = FireExpertsDto.class.newInstance(); // FireExpertsDto target = FireExpertsDto.class.newInstance();
// 把原对象数据拷贝到新对象 // // 把原对象数据拷贝到新对象
BeanUtils.copyProperties(source, target); // BeanUtils.copyProperties(source, target);
// 计算年龄 // // 计算年龄
int age = getAge(source.getBirthdayTime()); // int age = getAge(source.getBirthdayTime());
target.setAge(age); // target.setAge(age);
// 返回新对象 // // 返回新对象
return target; // return target;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return null; // return null;
} // }
} // }
//
/** // /**
* IPage<Entity> 分页对象转 Page<Dto> // * IPage<Entity> 分页对象转 Page<Dto>
* // *
* @param page 原分页对象 // * @param page 原分页对象
* @param v 目标vo类 // * @param v 目标vo类
* @param <E> 泛型类 // * @param <E> 泛型类
* @param <V> 泛型类 // * @param <V> 泛型类
* @return 转换后的分页对象 // * @return 转换后的分页对象
*/ // */
public static <E, V> IPage<V> iPageDtoStream(IPage<E> page, Class<V> v) { // public static <E, V> IPage<V> iPageDtoStream(IPage<E> page, Class<V> v) {
return page.convert(item -> { // return page.convert(item -> {
try { // try {
return convert(item, v); // return convert(item, v);
} catch (Exception e) { // } catch (Exception e) {
return null; // return null;
} // }
}); // });
} // }
//
/** // /**
* IPage<Entity> 分页对象转 Page<Dto> // * IPage<Entity> 分页对象转 Page<Dto>
* // *
* @param page 原分页对象 // * @param page 原分页对象
* @return 转换后的分页对象 // * @return 转换后的分页对象
*/ // */
public static IPage<FireExpertsDto> iPageDtoStreamFireExperts(IPage<FireExperts> page) { // public static IPage<FireExpertsDto> iPageDtoStreamFireExperts(IPage<FireExperts> page) {
return page.convert(item -> { // return page.convert(item -> {
try { // try {
return convertFireExperts(item); // return convertFireExperts(item);
} catch (Exception e) { // } catch (Exception e) {
return null; // return null;
} // }
}); // });
} // }
//
//由出生日期获得年龄 // //由出生日期获得年龄
public static int getAge(Date birthDay) { // public static int getAge(Date birthDay) {
if (birthDay == null) { // if (birthDay == null) {
return 0; // return 0;
} // }
LocalDate now = LocalDate.now(); // LocalDate now = LocalDate.now();
Calendar cal = Calendar.getInstance(); // Calendar cal = Calendar.getInstance();
cal.setTime(birthDay); // cal.setTime(birthDay);
int yearBirth = cal.get(Calendar.YEAR); // int yearBirth = cal.get(Calendar.YEAR);
int monthBirth = cal.get(Calendar.MONTH) + 1; // int monthBirth = cal.get(Calendar.MONTH) + 1;
int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH); // int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH);
//
LocalDate birth = LocalDate.of(yearBirth, monthBirth, dayOfMonthBirth); // LocalDate birth = LocalDate.of(yearBirth, monthBirth, dayOfMonthBirth);
if (birth.isAfter(now)) { // if (birth.isAfter(now)) {
return 0; // return 0;
} // }
int age = birth.until(now).getYears(); // int age = birth.until(now).getYears();
return age; // return age;
} // }
//
} //}
\ No newline at end of file \ No newline at end of file
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-biz-common</artifactId> <artifactId>amos-boot-module-common-biz</artifactId>
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
......
package com.yeejoin.amos.boot.module.tzs.biz.service.impl; package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService; import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto; import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto; import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator; import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
...@@ -23,8 +22,8 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest; ...@@ -23,8 +22,8 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
@Service @Service
public class ElevatorServiceImpl extends BaseService<ElevatorDto, Elevator, ElevatorMapper> implements IElevatorService { public class ElevatorServiceImpl extends BaseService<ElevatorDto, Elevator, ElevatorMapper> implements IElevatorService {
// @Autowired @Autowired
// ISourceFileService sourceFileService; SourceFileServiceImpl sourceFileService;
@Autowired @Autowired
AlertCalledServiceImpl alertCalledServiceImpl; AlertCalledServiceImpl alertCalledServiceImpl;
......
...@@ -18,4 +18,12 @@ ...@@ -18,4 +18,12 @@
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project> </project>
...@@ -40,7 +40,7 @@ import java.net.UnknownHostException; ...@@ -40,7 +40,7 @@ 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.tzs.api.mapper", "com.yeejoin.amos.boot.module.*.api.mapper",
"com.yeejoin.amos.boot.biz.common.dao.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 AmosTzsApplication { public class AmosTzsApplication {
......
...@@ -17,3 +17,7 @@ spring.datasource.hikari.pool-name=DatebookHikariCP ...@@ -17,3 +17,7 @@ spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.max-lifetime=120000 spring.datasource.hikari.max-lifetime=120000
spring.datasource.hikari.connection-timeout=30000 spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1 spring.datasource.hikari.connection-test-query=SELECT 1
iot.fegin.name=AMOS-API-IOT
equip.fegin.name=AMOS-EQUIPMANAGE
\ 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