Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
e0a91e5c
Commit
e0a91e5c
authored
Jul 22, 2025
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(amos-boot): 优化日期处理和移除未使用的常量类
- 在 BaseRelationEntity 类中添加 @JSONField 注解以格式化日期字段 - 删除未使用的 Constant 类 - 新增 DateUtils 工具类,提供丰富的日期处理方法
parent
16623b7e
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
991 additions
and
1310 deletions
+991
-1310
BaseRelationEntity.java
...ejoin/amos/boot/biz/common/entity/BaseRelationEntity.java
+2
-0
GoLangHeaderUtils.java
...eejoin/amos/api/householdapi/Utils/GoLangHeaderUtils.java
+0
-81
HouseholdPvUtils.java
...yeejoin/amos/api/householdapi/Utils/HouseholdPvUtils.java
+0
-276
Constant.java
.../com/yeejoin/amos/api/householdapi/constant/Constant.java
+0
-7
HouseholdPvApiController.java
...api/householdapi/controller/HouseholdPvApiController.java
+0
-116
HouseholdPvProducerInfoController.java
...holdapi/controller/HouseholdPvProducerInfoController.java
+0
-116
HouseholdTestController.java
.../api/householdapi/controller/HouseholdTestController.java
+0
-50
HouseholdPvApiDto.java
...n/amos/api/householdapi/face/model/HouseholdPvApiDto.java
+0
-86
HouseholdPvProducerInfoDto.java
...i/householdapi/face/model/HouseholdPvProducerInfoDto.java
+0
-51
HouseholdPvApiMapper.java
...s/api/householdapi/face/orm/dao/HouseholdPvApiMapper.java
+0
-14
HouseholdPvProducerInfoMapper.java
...seholdapi/face/orm/dao/HouseholdPvProducerInfoMapper.java
+0
-15
HouseholdPvApi.java
...amos/api/householdapi/face/orm/entity/HouseholdPvApi.java
+0
-105
HouseholdPvProducerInfo.java
...householdapi/face/orm/entity/HouseholdPvProducerInfo.java
+0
-85
IHouseholdPvApiService.java
...api/householdapi/face/service/IHouseholdPvApiService.java
+0
-12
IHouseholdPvCommonService.java
.../householdapi/face/service/IHouseholdPvCommonService.java
+0
-9
IHouseholdPvProducerInfoService.java
...holdapi/face/service/IHouseholdPvProducerInfoService.java
+0
-12
HouseholdPvApiServiceImpl.java
...eholdapi/face/service/impl/HouseholdPvApiServiceImpl.java
+0
-34
HouseholdPvProducerInfoServiceImpl.java
...face/service/impl/HouseholdPvProducerInfoServiceImpl.java
+0
-44
DockingData.java
...c/main/java/com/yeejoin/amos/dockingData/DockingData.java
+0
-195
TzsUserPermission.java
...amos/boot/module/common/api/entity/TzsUserPermission.java
+3
-0
DateUtils.java
.../yeejoin/amos/boot/module/common/api/utils/DateUtils.java
+980
-0
SafetyProblemTracingMapper.xml
.../src/main/resources/mapper/SafetyProblemTracingMapper.xml
+1
-1
TzsUserInfoVo.java
...oin/amos/boot/module/statistics/api/vo/TzsUserInfoVo.java
+2
-1
JGDPStatisticsServiceImpl.java
...statistcs/biz/service/impl/JGDPStatisticsServiceImpl.java
+1
-0
UserBizByTCMServiceImpl.java
...e/statistcs/biz/service/impl/UserBizByTCMServiceImpl.java
+2
-0
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/entity/BaseRelationEntity.java
View file @
e0a91e5c
package
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
entity
;
package
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
entity
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableField
;
...
@@ -23,6 +24,7 @@ public class BaseRelationEntity implements Serializable{
...
@@ -23,6 +24,7 @@ public class BaseRelationEntity implements Serializable{
protected
Long
sequenceNbr
;
protected
Long
sequenceNbr
;
@TableField
(
value
=
"rec_date"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
@TableField
(
value
=
"rec_date"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
@JSONField
(
format
=
"yyyy-MM-dd"
)
protected
Date
recDate
;
protected
Date
recDate
;
@TableField
(
value
=
"rec_user_id"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
@TableField
(
value
=
"rec_user_id"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
...
...
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/GoLangHeaderUtils.java
deleted
100644 → 0
View file @
16623b7e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
Utils
;
import
org.apache.commons.codec.binary.Base64
;
import
javax.crypto.Mac
;
import
javax.crypto.SecretKey
;
import
javax.crypto.spec.SecretKeySpec
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
//锦浪云 header处理类
public
class
GoLangHeaderUtils
{
// public static void main(String[] args) {
// try {
// String key = "";
// String keySecret = "";
// Map<String,Object> map = new HashMap();
// map.put("pageNo",1);
// map.put("pageSize",10);
// String body = JSON.toJSONString(map);
// String ContentMd5 = getDigest(body);
// String Date = getGMTTime();
// String path = "/v1/api/userStationList";
// String param = "POST" + "\n" + ContentMd5 + "\n" + "application/json" + "\n" + Date + "\n" + path;
// String sign = HmacSHA1Encrypt(param, keySecret);
// String url = "url" + path ;
// OkHttpClient client = new OkHttpClient();
// MediaType xmlType = MediaType.parse("application/json;charset=UTF-8");
// okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(xmlType,body);
// okhttp3.Request request = new okhttp3.Request.Builder()
// .url(url)
// .addHeader("Content-type", "application/json;charset=UTF-8")
// .addHeader("Authorization","API "+key+":"+sign)
// .addHeader("Content-MD5",ContentMd5)
// .addHeader("Date",Date)
// .post(requestBody)
// .build();
// Response response = client.newCall(request).execute();
// String string = response.body().string();
// System.out.println(string);
//
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
public
static
String
HmacSHA1Encrypt
(
String
encryptText
,
String
KeySecret
)
throws
Exception
{
byte
[]
data
=
KeySecret
.
getBytes
(
"UTF-8"
);
SecretKey
secretKey
=
new
SecretKeySpec
(
data
,
"HmacSHA1"
);
Mac
mac
=
Mac
.
getInstance
(
"HmacSHA1"
);
mac
.
init
(
secretKey
);
byte
[]
text
=
encryptText
.
getBytes
(
"UTF-8"
);
byte
[]
result
=
mac
.
doFinal
(
text
);
return
Base64
.
encodeBase64String
(
result
);
}
public
static
String
getGMTTime
(){
Calendar
cd
=
Calendar
.
getInstance
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"EEE, d MMM yyyy HH:mm:ss 'GMT'"
,
Locale
.
US
);
sdf
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"GMT"
));
String
str
=
sdf
.
format
(
cd
.
getTime
());
return
str
;
}
//获取header中的 Content-MD5
public
static
String
getDigest
(
String
test
)
{
String
result
=
""
;
try
{
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
md
.
update
(
test
.
getBytes
());
byte
[]
b
=
md
.
digest
();
result
=
java
.
util
.
Base64
.
getEncoder
().
encodeToString
(
b
);
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/HouseholdPvUtils.java
deleted
100644 → 0
View file @
16623b7e
//package com.yeejoin.amos.api.householdapi.Utils;
//
//import cn.hutool.Hutool;
//import cn.hutool.core.util.ObjectUtil;
//import cn.hutool.http.HttpUtil;
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.qiniu.util.Json;
//import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvApiDto;
//import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvProducerInfoDto;
//import com.yeejoin.amos.api.householdapi.face.orm.entity.HouseholdPvProducerInfo;
//import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvApiServiceImpl;
//import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl;
//import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
//import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
//import io.swagger.annotations.ApiModelProperty;
//import io.swagger.models.auth.In;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import org.typroject.tyboot.component.cache.Redis;
//
//import java.util.*;
//
//@Component
//public class HouseholdPvUtils {
// @Autowired
// private HouseholdPvProducerInfoServiceImpl householdPvProducerInfoServiceImpl;
// @Autowired
// private HouseholdPvApiServiceImpl householdPvApiServiceImpl;
//
// @Autowired
// InfluxDbConnection influxDbConnection;
//
// private final static String API_REDIS_PREFIX = "HOUSEHOLD_API_CACHE_" +
// "";
//
// /**
// * @param code 厂商code
// * @return HashMap<String, Object> 发送请求前的准备 准备header信息
// * @deprecated 根据厂商编码获取厂商的hearer
// */
// public HashMap<String, Object> getHeaderByProducerCode(String code) {
// HashMap<String, Object> hashMap = new HashMap<>();
// HashMap<String, String> hashMaphead = new HashMap<>();
// HouseholdPvProducerInfo householdPvProducerInfo = this.householdPvProducerInfoServiceImpl.queryForHouseholdPvProducerInfoByCode(code);
// String url = householdPvProducerInfo.getProdcerUrl() + householdPvProducerInfo.getTokenUrl();
// hashMap.put("apiurl", householdPvProducerInfo.getProdcerUrl());
// if (PVProducerInfoEnum.GDW.getCode().equals(code)) {
// HashMap<String, String> map = new HashMap<>();
// map.put("account", householdPvProducerInfo.getProdcerAccount());
// map.put("pwd", householdPvProducerInfo.getProdcerPassword());
// String body = JSON.toJSONString(map);
// String response = HttpUtil.createPost(url).body(body).execute().body();
// JSONObject jsonObject = JSON.parseObject(response);
// if (jsonObject.get("data") != null) {
// JSONObject jsonObject1 = (JSONObject) jsonObject.get("data");
// hashMaphead.put("token", (String) jsonObject1.get("token"));
// hashMap.put("header", hashMaphead);
// }
// } else if (PVProducerInfoEnum.SH.getCode().equals(code)) {
// HashMap<String, Object> map = new HashMap<>();
// map.put("accountName", householdPvProducerInfo.getProdcerAccount());
// map.put("appId", householdPvProducerInfo.getProdcerAppid());
// map.put("appSecret", householdPvProducerInfo.getProdcerAppsecret());
// map.put("corporationId", householdPvProducerInfo.getCorporationId());
// map.put("accountType", 2);
// String body = JSON.toJSONString(map);
// String response = HttpUtil.createPost(url).body(body).execute().body();
// JSONObject jsonObject = JSON.parseObject(response);
// hashMaphead.put("Authorization", (String) jsonObject.get("data"));
// hashMap.put("header", hashMaphead);
// } else if (PVProducerInfoEnum.JLY.getCode().equals(code)) {
// hashMaphead.put("Content-type", "application/json;charset=UTF-8");
// hashMaphead.put("Authorization", "API " + householdPvProducerInfo.getProdcerAppid());
// hashMaphead.put("Content-MD5", null);
// hashMaphead.put("Date", GoLangHeaderUtils.getGMTTime());
// hashMap.put("header", hashMaphead);
// hashMap.put("appsecret", householdPvProducerInfo.getProdcerAppsecret());
// }
// return hashMap;
// }
//
// /**
// * @param seq apiId 数据库中维护的的apiId
// * @return String 请求返回的response字符串
// */
// public String gerResponseByAPiID(Long seq) {
// List cacheParams = new ArrayList();
// String respone = "";
// String params = "";
// JSONArray jsonArray = null;
// HouseholdPvApiDto householdPvApiDto = this.householdPvApiServiceImpl.queryBySeq(seq);
// HashMap<String, Object> producerInfo = this.getHeaderByProducerCode(householdPvApiDto.getProducerId());
// String baseurl = (String) producerInfo.get("apiurl");
// HashMap<String, String> headMap = (HashMap<String, String>) producerInfo.get("header");
// String orginalAuthorization = headMap.get("Authorization") + ":";
// String url = baseurl + householdPvApiDto.getApiUrl();
// String appsecret = (String) producerInfo.get("appsecret");
// if (ObjectUtil.isNotEmpty(householdPvApiDto.getDependecyApiId())) {
// String RedisKey = API_REDIS_PREFIX + householdPvApiDto.getDependecyApiId();
// cacheParams = Redis.getRedisTemplate().opsForList().range(RedisKey, 0, -1);
// if (cacheParams.size() > 0) {
// for (int i = 0; i < cacheParams.size(); i++) {
// JSONObject jsonObject = JSON.parseObject(householdPvApiDto.getParamInfo());
// if (ObjectUtil.isNotEmpty(householdPvApiDto.getDependApiParamKey())) {
// jsonObject.put(householdPvApiDto.getDependApiParamKey(), cacheParams.get(i));
// }
// params = jsonObject.toJSONString();
// if (PVProducerInfoEnum.JLY.getCode().equals(householdPvApiDto.getProducerId())) {
// JLYHeaderMapHandler(params, householdPvApiDto, headMap, orginalAuthorization, appsecret, (String) cacheParams.get(i));
// }
// try {
// Thread.sleep(500);
// respone = sendRequest(householdPvApiDto.getRequestMethod(), url, params, headMap);
// jsonArray = handlerResponseByResultResolverule(householdPvApiDto.getResultResolveRule(), respone);
// handleResponseAndCacheData(String.valueOf(seq), householdPvApiDto.getCacheField(), jsonArray, householdPvApiDto.getMeasurement());
// } catch (Exception e) {
// e.printStackTrace();
// } finally {
// continue;
// }
// }
// }
// } else {
// if (PVProducerInfoEnum.JLY.getCode().equals(householdPvApiDto.getProducerId())) {
// JLYHeaderMapHandler(params, householdPvApiDto, headMap, orginalAuthorization, appsecret, null);
// }
// respone = sendRequest(householdPvApiDto.getRequestMethod(), url, householdPvApiDto.getParamInfo(), headMap);
// jsonArray = handlerResponseByResultResolverule(householdPvApiDto.getResultResolveRule(), respone);
// handleResponseAndCacheData(String.valueOf(seq), householdPvApiDto.getCacheField(), jsonArray, householdPvApiDto.getMeasurement());
// if (ObjectUtil.isNotEmpty(householdPvApiDto.getIsPage())) {
// Integer size = getPagesize(householdPvApiDto.getPagesizeResolveRule(), respone);
// for (int i = 1; i < size; i++) {
// JSONObject jsonObject = JSON.parseObject(householdPvApiDto.getParamInfo());
// if (ObjectUtil.isNotEmpty(householdPvApiDto.getPageField())) {
// jsonObject.put(householdPvApiDto.getPageField(), i + 1);
// }
// params = jsonObject.toJSONString();
// if (PVProducerInfoEnum.JLY.getCode().equals(householdPvApiDto.getProducerId())) {
// JLYHeaderMapHandler(params, householdPvApiDto, headMap, orginalAuthorization, appsecret, null);
// }
// respone = sendRequest(householdPvApiDto.getRequestMethod(), url, householdPvApiDto.getParamInfo(), headMap);
// jsonArray = handlerResponseByResultResolverule(householdPvApiDto.getResultResolveRule(), respone);
// handleResponseAndCacheData(String.valueOf(seq), householdPvApiDto.getCacheField(), jsonArray, householdPvApiDto.getMeasurement());
// }
// }
//
// }
// return respone;
// }
//
// /**
// * @param resultResovle 请求返回的解析规则 来源与数据库
// * @param response 请求返回的字符串
// * @return 解析后的数据
// */
// public JSONArray handlerResponseByResultResolverule(String resultResovle, String response) {
// JSONObject jsonObject = JSONObject.parseObject(response);
// JSONArray jsonArray = new JSONArray();
// if (ObjectUtil.isNotEmpty(resultResovle)) {
// String[] rules = resultResovle.split(",");
// if (rules.length > 0) {
// for (int i = 0; i < rules.length; i++) {
// try {
// jsonObject = (JSONObject) jsonObject.get(rules[i]);
// if (jsonObject == null) {
// jsonArray = (JSONArray) jsonObject.get(rules[i]);
// }
// } catch (Exception exception) {
// jsonArray = (JSONArray) jsonObject.get(rules[i]);
// }
// }
// }
// if (jsonArray.size() == 0) {
// jsonArray.add(jsonObject);
// }
// }
// return jsonArray;
// }
//
// /**
// * @param seq apiID
// * @param cacheField 要缓存的字段
// * @param jsonArray 处理后的数据请求
// * @param measurement 要在influxdb中存储的数
// * @describe 该方法用于缓存需要缓存的字段 且将需要入库的数据进行入库
// */
// public void handleResponseAndCacheData(String seq, String cacheField, JSONArray jsonArray, String measurement) {
// String apiID = API_REDIS_PREFIX + seq;
// List list = new ArrayList();
// List saveList = new ArrayList();
// if (jsonArray.size() > 0) {
// for (Object o : jsonArray) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Set<String> keys = maps1.keySet();
// keys.forEach((key) -> {
// maps1.put(key, maps1.get(key).toString());
// });
// if (cacheField != null) {
// list.add(maps1.get(cacheField));
// }
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// if (measurement != null) {
// influxDbConnection.insert(measurement, maps2, maps1);
// }
//
// }
// }
// if (cacheField != null) {
// saveList = Redis.getRedisTemplate().opsForList().range(apiID, 0, -1);
// if (saveList.size() == 0) {
// Redis.getRedisTemplate().opsForList().leftPushAll(apiID, list);
// }
// saveList = Redis.getRedisTemplate().opsForList().range(apiID, 0, -1);
// if (saveList.size() != list.size()) {
// Redis.getRedisTemplate().delete(apiID);
// Redis.getRedisTemplate().opsForList().leftPushAll(apiID, list);
// }
// }
// }
//
// public String sendRequest(String requestMethod, String url, String params, HashMap<String, String> headMap) {
// String respone = "";
// if (requestMethod.equals("POST")) {
// respone = HttpUtil.createPost(url).headerMap(headMap, false).
// body(params).execute().body();
// }
// if (requestMethod.equals("GET")) {
// respone = HttpUtil.createGet(url).headerMap(headMap, true).
// body(params).execute().body();
// }
// return respone;
// }
//
// /***
// *
// * @param params 参数字符窜
// * @param householdPvApiDto apidto
// * @param headMap header头
// * @param orginalAuthorization 原始的orginalAuthorization
// * @param appsecret appsecret
// * @param cacheParams 缓存的参数值
// * @desc 锦浪云请求参数及head头处理
// */
// public void JLYHeaderMapHandler(String params, HouseholdPvApiDto householdPvApiDto, HashMap<String, String> headMap, String orginalAuthorization, String appsecret, String cacheParams) {
// if (PVProducerInfoEnum.JLY.getCode().equals(householdPvApiDto.getProducerId())) {
// String contentMD5 = GoLangHeaderUtils.getDigest(params);
// headMap.put("Date", GoLangHeaderUtils.getGMTTime());
// String param = "POST" + "\n" + contentMD5 + "\n" + "application/json" + "\n" + headMap.get("Date") + "\n" + householdPvApiDto.getApiUrl();
// String sign = "";
// try {
// sign = GoLangHeaderUtils.HmacSHA1Encrypt(param, appsecret);
// } catch (Exception e) {
// throw new RuntimeException(e);
// }
// headMap.put("Content-MD5", contentMD5);
// headMap.put("Authorization", orginalAuthorization + sign);
// }
// }
//
// public Integer getPagesize(String pageSizeResovle, String response) {
// Integer pageSize = 0;
// String[] rules = pageSizeResovle.split(",");
// JSONObject jsonObject = JSONObject.parseObject(response);
// if (rules.length > 0) {
// for (int i = 0; i < rules.length - 1; i++) {
// jsonObject = (JSONObject) jsonObject.get(rules[i]);
// }
// }
// pageSize = (Integer) jsonObject.get(rules[rules.length - 1]);
// return pageSize;
// }
//}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/constant/Constant.java
deleted
100644 → 0
View file @
16623b7e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
constant
;
public
class
Constant
{
public
static
final
String
TOKEN_PREFIX
=
"OPENAPI_"
;
public
static
final
String
SECRETKEY
=
"tzs"
;
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/controller/HouseholdPvApiController.java
deleted
100644 → 0
View file @
16623b7e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
controller
;
import
com.yeejoin.amos.api.householdapi.face.model.HouseholdPvApiDto
;
import
com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvApiServiceImpl
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
/**
* 户用光伏-厂商API haders
*
* @author system_generator
* @date 2023-06-07
*/
@RestController
@Api
(
tags
=
"户用光伏-厂商API hadersApi"
)
@RequestMapping
(
value
=
"/household-pv-api"
)
public
class
HouseholdPvApiController
{
@Autowired
HouseholdPvApiServiceImpl
householdPvApiServiceImpl
;
/**
* 新增户用光伏-厂商API haders
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增户用光伏-厂商API haders"
,
notes
=
"新增户用光伏-厂商API haders"
)
public
ResponseModel
<
HouseholdPvApiDto
>
save
(
@RequestBody
HouseholdPvApiDto
model
)
{
model
=
householdPvApiServiceImpl
.
createWithModel
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新户用光伏-厂商API haders"
,
notes
=
"根据sequenceNbr更新户用光伏-厂商API haders"
)
public
ResponseModel
<
HouseholdPvApiDto
>
updateBySequenceNbrHouseholdPvApi
(
@RequestBody
HouseholdPvApiDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
model
.
setSequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(
householdPvApiServiceImpl
.
updateWithModel
(
model
));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除户用光伏-厂商API haders"
,
notes
=
"根据sequenceNbr删除户用光伏-厂商API haders"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
){
return
ResponseHelper
.
buildResponse
(
householdPvApiServiceImpl
.
removeById
(
sequenceNbr
));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个户用光伏-厂商API haders"
,
notes
=
"根据sequenceNbr查询单个户用光伏-厂商API haders"
)
public
ResponseModel
<
HouseholdPvApiDto
>
selectOne
(
@PathVariable
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
householdPvApiServiceImpl
.
queryBySeq
(
sequenceNbr
));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"户用光伏-厂商API haders分页查询"
,
notes
=
"户用光伏-厂商API haders分页查询"
)
public
ResponseModel
<
Page
<
HouseholdPvApiDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
Page
<
HouseholdPvApiDto
>
page
=
new
Page
<
HouseholdPvApiDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
householdPvApiServiceImpl
.
queryForHouseholdPvApiPage
(
page
));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"户用光伏-厂商API haders列表全部数据查询"
,
notes
=
"户用光伏-厂商API haders列表全部数据查询"
)
@GetMapping
(
value
=
"/list"
)
public
ResponseModel
<
List
<
HouseholdPvApiDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
householdPvApiServiceImpl
.
queryForHouseholdPvApiList
());
}
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/controller/HouseholdPvProducerInfoController.java
deleted
100644 → 0
View file @
16623b7e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
controller
;
import
com.yeejoin.amos.api.householdapi.face.model.HouseholdPvProducerInfoDto
;
import
com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
/**
* 户用光伏-厂商信息表
*
* @author system_generator
* @date 2023-06-07
*/
@RestController
@Api
(
tags
=
"户用光伏-厂商信息表Api"
)
@RequestMapping
(
value
=
"/household-pv-producer-info"
)
public
class
HouseholdPvProducerInfoController
{
@Autowired
HouseholdPvProducerInfoServiceImpl
householdPvProducerInfoServiceImpl
;
/**
* 新增户用光伏-厂商信息表
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增户用光伏-厂商信息表"
,
notes
=
"新增户用光伏-厂商信息表"
)
public
ResponseModel
<
HouseholdPvProducerInfoDto
>
save
(
@RequestBody
HouseholdPvProducerInfoDto
model
)
{
model
=
householdPvProducerInfoServiceImpl
.
createWithModel
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新户用光伏-厂商信息表"
,
notes
=
"根据sequenceNbr更新户用光伏-厂商信息表"
)
public
ResponseModel
<
HouseholdPvProducerInfoDto
>
updateBySequenceNbrHouseholdPvProducerInfo
(
@RequestBody
HouseholdPvProducerInfoDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
model
.
setSequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(
householdPvProducerInfoServiceImpl
.
updateWithModel
(
model
));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除户用光伏-厂商信息表"
,
notes
=
"根据sequenceNbr删除户用光伏-厂商信息表"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
){
return
ResponseHelper
.
buildResponse
(
householdPvProducerInfoServiceImpl
.
removeById
(
sequenceNbr
));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个户用光伏-厂商信息表"
,
notes
=
"根据sequenceNbr查询单个户用光伏-厂商信息表"
)
public
ResponseModel
<
HouseholdPvProducerInfoDto
>
selectOne
(
@PathVariable
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
householdPvProducerInfoServiceImpl
.
queryBySeq
(
sequenceNbr
));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"户用光伏-厂商信息表分页查询"
,
notes
=
"户用光伏-厂商信息表分页查询"
)
public
ResponseModel
<
Page
<
HouseholdPvProducerInfoDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
Page
<
HouseholdPvProducerInfoDto
>
page
=
new
Page
<
HouseholdPvProducerInfoDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
householdPvProducerInfoServiceImpl
.
queryForHouseholdPvProducerInfoPage
(
page
));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"户用光伏-厂商信息表列表全部数据查询"
,
notes
=
"户用光伏-厂商信息表列表全部数据查询"
)
@GetMapping
(
value
=
"/list"
)
public
ResponseModel
<
List
<
HouseholdPvProducerInfoDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
householdPvProducerInfoServiceImpl
.
queryForHouseholdPvProducerInfoList
());
}
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/controller/HouseholdTestController.java
deleted
100644 → 0
View file @
16623b7e
//package com.yeejoin.amos.api.householdapi.controller;
//
//import cn.hutool.http.HttpUtil;
//import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
//import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvApiDto;
//import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvProducerInfoDto;
//import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvApiServiceImpl;
//import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl;
//import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
//import fastjson.JSON;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import org.typroject.tyboot.core.foundation.enumeration.UserType;
//import org.typroject.tyboot.core.restful.doc.TycloudOperation;
//
//import java.io.IOException;
//import java.util.HashMap;
//import java.util.Map;
//
//
///**
// * 户用光伏-厂商API haders
// *
// * @author system_generator
// * @date 2023-06-07
// */
//@RestController
//@Api(tags = "测试")
//@RequestMapping(value = "/household-pv-api-test1")
//public class HouseholdTestController {
// @Autowired
// private HouseholdPvUtils householdPvUtils;
//
//
// /**
// * 新增户用光伏-厂商API haders
// *
// * @return
// */
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @PostMapping(value = "/gdwdemo")
// @ApiOperation(httpMethod = "get", value = "固德威示例", notes = "固德威示例")
// public String save(Long seq) throws IOException {
// return householdPvUtils.gerResponseByAPiID(seq);
// }
//}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/face/model/HouseholdPvApiDto.java
deleted
100644 → 0
View file @
16623b7e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
model
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
org.typroject.tyboot.core.rdbms.model.BaseModel
;
import
java.util.Date
;
/**
* 户用光伏-厂商API haders
*
* @author system_generator
* @date 2023-06-07
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"HouseholdPvApiDto"
,
description
=
"户用光伏-厂商API haders"
)
public
class
HouseholdPvApiDto
extends
BaseModel
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"厂商id"
)
private
String
producerId
;
@ApiModelProperty
(
value
=
"api名称"
)
private
String
apiName
;
@ApiModelProperty
(
value
=
"请求方式 GET或者POST"
)
private
String
requestMethod
;
@ApiModelProperty
(
value
=
"api地址"
)
private
String
apiUrl
;
@ApiModelProperty
(
value
=
"api描述"
)
private
String
apiDescption
;
@ApiModelProperty
(
value
=
"参数信息"
)
private
String
paramInfo
;
/**
* 依赖的apiId
*/
@ApiModelProperty
(
value
=
"依赖的apiId"
)
private
String
dependecyApiId
;
/**
* 缓存的属性
*/
@ApiModelProperty
(
value
=
"缓存的属性"
)
private
String
cacheField
;
/**
* 依赖的api属性
*/
@ApiModelProperty
(
value
=
"依赖的api属性"
)
private
String
dependApiParamKey
;
/**
* result解析结果
*/
@ApiModelProperty
(
value
=
"result解析结果"
)
private
String
resultResolveRule
;
/**
* 是否分页
*/
@ApiModelProperty
(
value
=
"是否分页"
)
private
Integer
isPage
;
/**
* 时序库中的表名
*/
@ApiModelProperty
(
value
=
"时序库表名"
)
private
String
measurement
;
/**
* 页数解析规则
*/
@ApiModelProperty
(
value
=
"pagesize_resolve_rule"
)
private
String
pagesizeResolveRule
;
/**
* 页码对应的请求中的字段
*/
@ApiModelProperty
(
value
=
"page_field"
)
private
String
pageField
;
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/face/model/HouseholdPvProducerInfoDto.java
deleted
100644 → 0
View file @
16623b7e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
org.typroject.tyboot.core.rdbms.model.BaseModel
;
import
java.util.Date
;
/**
* 户用光伏-厂商信息表
*
* @author system_generator
* @date 2023-06-07
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"HouseholdPvProducerInfoDto"
,
description
=
"户用光伏-厂商信息表"
)
public
class
HouseholdPvProducerInfoDto
extends
BaseModel
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"厂商名称"
)
private
String
prodcerName
;
@ApiModelProperty
(
value
=
"厂商账号"
)
private
String
prodcerAccount
;
@ApiModelProperty
(
value
=
"厂商密码"
)
private
String
prodcerPassword
;
@ApiModelProperty
(
value
=
"厂商appID"
)
private
String
prodcerAppid
;
@ApiModelProperty
(
value
=
"厂商appSecret"
)
private
String
prodcerAppsecret
;
@ApiModelProperty
(
value
=
"厂商url"
)
private
String
prodcerUrl
;
@ApiModelProperty
(
value
=
"公司id"
)
private
String
corporationId
;
@ApiModelProperty
(
value
=
"公共header信息"
)
private
String
headerInfo
;
@ApiModelProperty
(
value
=
"厂商code"
)
private
String
code
;
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/face/orm/dao/HouseholdPvApiMapper.java
deleted
100644 → 0
View file @
16623b7e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
orm
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.api.householdapi.face.orm.entity.HouseholdPvApi
;
/**
* 户用光伏-厂商API haders Mapper 接口
*
* @author system_generator
* @date 2023-06-07
*/
public
interface
HouseholdPvApiMapper
extends
BaseMapper
<
HouseholdPvApi
>
{
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/face/orm/dao/HouseholdPvProducerInfoMapper.java
deleted
100644 → 0
View file @
16623b7e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
orm
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.api.householdapi.face.orm.entity.HouseholdPvProducerInfo
;
/**
* 户用光伏-厂商信息表 Mapper 接口
*
* @author system_generator
* @date 2023-06-07
*/
public
interface
HouseholdPvProducerInfoMapper
extends
BaseMapper
<
HouseholdPvProducerInfo
>
{
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/face/orm/entity/HouseholdPvApi.java
deleted
100644 → 0
View file @
16623b7e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
orm
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity
;
import
java.util.Date
;
/**
* 户用光伏-厂商API haders
*
* @author system_generator
* @date 2023-06-07
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"household_pv_api"
)
public
class
HouseholdPvApi
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 厂商id
*/
@TableField
(
"producer_id"
)
private
String
producerId
;
/**
* api名称
*/
@TableField
(
"api_name"
)
private
String
apiName
;
/**
* 请求方式 GET或者POST
*/
@TableField
(
"request_method"
)
private
String
requestMethod
;
/**
* api地址
*/
@TableField
(
"api_url"
)
private
String
apiUrl
;
/**
* api描述
*/
@TableField
(
"api_descption"
)
private
String
apiDescption
;
/**
* 参数信息
*/
@TableField
(
"param_info"
)
private
String
paramInfo
;
/**
* 依赖的apiId
*/
@TableField
(
"dependecy_api_id"
)
private
String
dependecyApiId
;
/**
* 缓存的属性
*/
@TableField
(
"cache_field"
)
private
String
cacheField
;
/**
* 依赖的api属性
*/
@TableField
(
"depend_api_param_key"
)
private
String
dependApiParamKey
;
/**
* result解析结果
*/
@TableField
(
"result_resolve_rule"
)
private
String
resultResolveRule
;
/**
* 是否分页
*/
@TableField
(
"is_page"
)
private
Integer
isPage
;
/**
* 时序库中存储的表名
*/
@TableField
(
"measurement"
)
private
String
measurement
;
/**
* 页数解析规则
*/
@TableField
(
"pagesize_resolve_rule"
)
private
String
pagesizeResolveRule
;
/**
* 页码对应的请求中的字段
*/
@TableField
(
"page_field"
)
private
String
pageField
;
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/face/orm/entity/HouseholdPvProducerInfo.java
deleted
100644 → 0
View file @
16623b7e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
orm
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity
;
import
java.util.Date
;
/**
* 户用光伏-厂商信息表
*
* @author system_generator
* @date 2023-06-07
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"household_pv_producer_info"
)
public
class
HouseholdPvProducerInfo
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 厂商名称
*/
@TableField
(
"prodcer_name"
)
private
String
prodcerName
;
/**
* 厂商账号
*/
@TableField
(
"prodcer_account"
)
private
String
prodcerAccount
;
/**
* 厂商密码
*/
@TableField
(
"prodcer_password"
)
private
String
prodcerPassword
;
/**
* 厂商appID
*/
@TableField
(
"prodcer_appid"
)
private
String
prodcerAppid
;
/**
* 厂商appSecret
*/
@TableField
(
"prodcer_appsecret"
)
private
String
prodcerAppsecret
;
/**
* 厂商url
*/
@TableField
(
"prodcer_url"
)
private
String
prodcerUrl
;
/**
* 公司id
*/
@TableField
(
"corporationId"
)
private
String
corporationId
;
/**
* 公共header信息
*/
@TableField
(
"header_info"
)
private
String
headerInfo
;
/**
* 公共header信息
*/
@TableField
(
"code"
)
private
String
code
;
/**
* token_url
*/
@TableField
(
"token_url"
)
private
String
tokenUrl
;
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/IHouseholdPvApiService.java
deleted
100644 → 0
View file @
16623b7e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
service
;
/**
* 户用光伏-厂商API haders接口类
*
* @author system_generator
* @date 2023-06-07
*/
public
interface
IHouseholdPvApiService
{
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/IHouseholdPvCommonService.java
deleted
100644 → 0
View file @
16623b7e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
service
;
public
interface
IHouseholdPvCommonService
{
public
void
getRequestHeader
();
public
void
getRequestParams
();
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/IHouseholdPvProducerInfoService.java
deleted
100644 → 0
View file @
16623b7e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
service
;
/**
* 户用光伏-厂商信息表接口类
*
* @author system_generator
* @date 2023-06-07
*/
public
interface
IHouseholdPvProducerInfoService
{
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/HouseholdPvApiServiceImpl.java
deleted
100644 → 0
View file @
16623b7e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
service
.
impl
;
import
com.yeejoin.amos.api.householdapi.face.model.HouseholdPvApiDto
;
import
com.yeejoin.amos.api.householdapi.face.orm.dao.HouseholdPvApiMapper
;
import
com.yeejoin.amos.api.householdapi.face.orm.entity.HouseholdPvApi
;
import
com.yeejoin.amos.api.householdapi.face.service.IHouseholdPvApiService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.util.List
;
/**
* 户用光伏-厂商API haders服务实现类
*
* @author system_generator
* @date 2023-06-07
*/
@Service
public
class
HouseholdPvApiServiceImpl
extends
BaseService
<
HouseholdPvApiDto
,
HouseholdPvApi
,
HouseholdPvApiMapper
>
implements
IHouseholdPvApiService
{
/**
* 分页查询
*/
public
Page
<
HouseholdPvApiDto
>
queryForHouseholdPvApiPage
(
Page
<
HouseholdPvApiDto
>
page
)
{
return
this
.
queryForPage
(
page
,
null
,
false
);
}
/**
* 列表查询 示例
*/
public
List
<
HouseholdPvApiDto
>
queryForHouseholdPvApiList
()
{
return
this
.
queryForList
(
""
,
false
);
}
}
\ No newline at end of file
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/HouseholdPvProducerInfoServiceImpl.java
deleted
100644 → 0
View file @
16623b7e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.api.householdapi.face.model.HouseholdPvProducerInfoDto
;
import
com.yeejoin.amos.api.householdapi.face.orm.dao.HouseholdPvProducerInfoMapper
;
import
com.yeejoin.amos.api.householdapi.face.orm.entity.HouseholdPvProducerInfo
;
import
com.yeejoin.amos.api.householdapi.face.service.IHouseholdPvProducerInfoService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.util.List
;
/**
* 户用光伏-厂商信息表服务实现类
*
* @author system_generator
* @date 2023-06-07
*/
@Service
public
class
HouseholdPvProducerInfoServiceImpl
extends
BaseService
<
HouseholdPvProducerInfoDto
,
HouseholdPvProducerInfo
,
HouseholdPvProducerInfoMapper
>
implements
IHouseholdPvProducerInfoService
{
/**
* 分页查询
*/
public
Page
<
HouseholdPvProducerInfoDto
>
queryForHouseholdPvProducerInfoPage
(
Page
<
HouseholdPvProducerInfoDto
>
page
)
{
return
this
.
queryForPage
(
page
,
null
,
false
);
}
/**
* 列表查询 示例
*/
public
List
<
HouseholdPvProducerInfoDto
>
queryForHouseholdPvProducerInfoList
()
{
return
this
.
queryForList
(
""
,
false
);
}
public
HouseholdPvProducerInfo
queryForHouseholdPvProducerInfoByCode
(
String
code
)
{
return
this
.
baseMapper
.
selectOne
(
new
QueryWrapper
<
HouseholdPvProducerInfo
>().
eq
(
"code"
,
code
));
}
}
\ No newline at end of file
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/dockingData/DockingData.java
deleted
100644 → 0
View file @
16623b7e
//package com.yeejoin.amos.dockingData;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
//import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
//import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
//import org.jetbrains.annotations.TestOnly;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.actuate.influx.InfluxDbHealthIndicator;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//import java.util.HashMap;
//import java.util.LinkedHashMap;
//import java.util.Map;
//import java.util.UUID;
//import java.util.zip.Inflater;
//
///**
// * @description:
// * @author: tw
// * @createDate: 2023/6/16
// */
//@Component
//public class DockingData {
//
//
// @Autowired
// InfluxDbConnection influxDbConnection;
// @Autowired
// HouseholdPvUtils householdPvUtils;
// //初始化执行
// @PostConstruct
// public void init(){
// this.getDate();
// }
//
//
// //每二十分钟执行一次
// @Scheduled(cron = "0 0/20 * * * ?")
// public void fixedRate() {
// this.getDate();
// }
//
// //请求获取数据
// public void getDate(){
//
//
// //首航
// String data1=householdPvUtils.gerResponseByAPiID(1000000002L);
// JSONObject json= JSON.parseObject(data1);
//
// if((Boolean)json.get("success")){
// JSONArray obj= json.get("stationList") !=null?(JSONArray)json.get("stationList"):null;
// if (obj!=null) {
// for (Object o : obj) {
// Map<String,Object> maps1 = (Map<String,Object>)o;
// Map<String,String> maps2=new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("SH_DZ",maps2,maps1);
// }
// }
// }
//
// String data2=householdPvUtils.gerResponseByAPiID(1000000003L);
// JSONObject json2= JSON.parseObject(data2);
// if((Boolean)json2.get("success")) {
// JSONArray obj2 = json.get("deviceList") != null ? (JSONArray) json2.get("deviceList") : null;
// if (obj2!=null) {
// for (Object o : obj2) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("SH_ZB", maps2, maps1);
// }
// }
// }
//
// //固德威
// String data3 = householdPvUtils.gerResponseByAPiID(1000000006L);
//
// JSONObject json3= JSON.parseObject(data3);
// if(Integer.valueOf(json3.get("code").toString())==0) {
// JSONObject obj3 = json3.get("data") != null ? (JSONObject)json3.get("data") : null;
// if (obj3!=null&&obj3.get("list")!=null) {
//
// JSONArray ob = obj3.get("list") != null ? (JSONArray) obj3.get("list") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("GD_DZ", maps2, maps1);
// }
// }
// }
//
// String data4 = householdPvUtils.gerResponseByAPiID(1000000007L);
//
// JSONObject json4= JSON.parseObject(data4);
// if(Integer.valueOf(json4.get("code").toString())==0) {
// JSONObject obj4 = json4.get("data") != null ? (JSONObject)json4.get("data") : null;
// if (obj4!=null&&obj4.get("list")!=null) {
//
// JSONArray ob = obj4.get("list") != null ? (JSONArray) obj4.get("list") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("GD_ZT", maps2, maps1);
// }
// }
// }
//
// String data5 = householdPvUtils.gerResponseByAPiID(1000000008L);
//
// JSONObject json5= JSON.parseObject(data5);
// if(Integer.valueOf(json5.get("code").toString())==0) {
// JSONObject obj5 = json5.get("data") != null ? (JSONObject)json5.get("data") : null;
// if (obj5!=null&&obj5.get("list")!=null) {
//
// JSONArray ob = obj5.get("list") != null ? (JSONArray) obj5.get("list") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("GD_GJ", maps2, maps1);
// }
// }
// }
//
//
// String data6 = householdPvUtils.gerResponseByAPiID(1686897906789L);
//
// JSONObject json6= JSON.parseObject(data6);
// if(Integer.valueOf(json6.get("code").toString())==0) {
// JSONObject obj6 = json6.get("data") != null ? (JSONObject)json6.get("data") : null;
// if (obj6!=null&&obj6.get("page")!=null) {
//
// JSONArray ob = ((JSONObject)obj6.get("page")).get("records")!= null ? (JSONArray) ((JSONObject)obj6.get("page")).get("records") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("JL_CZ", maps2, maps1);
// }
// }
// }
// String data7 = householdPvUtils.gerResponseByAPiID(1686900771946L);
// JSONObject json7= JSON.parseObject(data7);
// if(Integer.valueOf(json7.get("code").toString())==0) {
// JSONObject obj7 = json7.get("data") != null ? (JSONObject)json7.get("data") : null;
// if (obj7!=null&&obj7.get("page")!=null) {
//
// JSONArray ob = ((JSONObject)obj7.get("page")).get("records")!= null ? (JSONArray) ((JSONObject)obj7.get("page")).get("records") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
//
// maps1.put("etotal1",maps1.get("etotal1").toString());
// maps1.put("etoday1",maps1.get("etoday1").toString());
// influxDbConnection.insert("JL_NBQ", maps2, maps1);
// }
// }
// }
// String data8 = householdPvUtils.gerResponseByAPiID(1686900972965L);
// JSONObject json8= JSON.parseObject(data8);
// if(Integer.valueOf(json8.get("code").toString())==0) {
// JSONObject obj8 = json8.get("data") != null ? (JSONObject)json8.get("data") : null;
// if (obj8!=null&&obj8.get("records")!=null) {
//
// JSONArray ob = obj8.get("records")!= null ? (JSONArray)obj8.get("records") : null;
//
// for (Object o : ob) {
// Map<String, Object> maps1 = (Map<String, Object>) o;
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
// influxDbConnection.insert("JL_GJ", maps2, maps1);
// }
// }
// }
// }
//
//
//
//}
amos-boot-system-tzs/amos-boot-module-common/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/entity/TzsUserPermission.java
View file @
e0a91e5c
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
entity
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
entity
;
import
com.alibaba.fastjson.annotation.JSONField
;
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.BaseRelationEntity
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseRelationEntity
;
...
@@ -57,6 +58,7 @@ public class TzsUserPermission extends BaseRelationEntity {
...
@@ -57,6 +58,7 @@ public class TzsUserPermission extends BaseRelationEntity {
* 有效期至
* 有效期至
*/
*/
@TableField
(
"expiry_date"
)
@TableField
(
"expiry_date"
)
@JSONField
(
format
=
"yyyy-MM-dd"
)
private
Date
expiryDate
;
private
Date
expiryDate
;
/**
/**
...
@@ -69,6 +71,7 @@ public class TzsUserPermission extends BaseRelationEntity {
...
@@ -69,6 +71,7 @@ public class TzsUserPermission extends BaseRelationEntity {
* 发证日期
* 发证日期
*/
*/
@TableField
(
"issue_date"
)
@TableField
(
"issue_date"
)
@JSONField
(
format
=
"yyyy-MM-dd"
)
private
Date
issueDate
;
private
Date
issueDate
;
/**
/**
...
...
amos-boot-system-tzs/amos-boot-module-common/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/utils/DateUtils.java
0 → 100644
View file @
e0a91e5c
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
utils
;
import
org.apache.commons.lang3.StringUtils
;
import
java.text.ParseException
;
import
java.text.ParsePosition
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.util.*
;
/**
* @description: 时间工具类
* @author: DELL
* @create: 2021-05-26
**/
public
class
DateUtils
{
public
static
final
String
DATE_TIME_PATTERN
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
final
String
MINUTE_PATTERN
=
"yyyy-MM-dd HH:mm"
;
public
static
final
String
DATE_HOUR_PATTERN
=
"yyyy-MM-dd HH"
;
public
static
final
String
HOUR_PATTERN
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
final
String
DATE_PATTERN
=
"yyyy-MM-dd"
;
public
static
final
String
MONTH_PATTERN
=
"yyyy-MM"
;
public
static
final
String
YEAR_PATTERN
=
"yyyy"
;
public
static
final
String
MINUTE_ONLY_PATTERN
=
"mm"
;
public
static
final
String
HOUR_ONLY_PATTERN
=
"HH"
;
public
static
final
String
DATE_PATTERN_NUM
=
"yyyyMMdd"
;
public
static
final
String
DATE_PATTERN_MM
=
"yyyyMM"
;
public
static
final
String
CHN_DATE_PATTERN_YEAR
=
"yyyy年"
;
public
static
final
String
CHN_DATE_PATTERN_MONTH
=
"MM月"
;
public
static
final
String
CHN_DATE_PATTERN
=
"yyyy年MM月dd日"
;
/**
* 获取 当前年、半年、季度、月、日、小时 开始结束时间
*/
private
static
final
SimpleDateFormat
shortSdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
private
static
final
SimpleDateFormat
longHourSdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH"
);
private
static
final
SimpleDateFormat
longSdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
private
static
final
Calendar
calendar
=
Calendar
.
getInstance
();
private
static
final
SimpleDateFormat
shortDateNew
=
new
SimpleDateFormat
(
"yyyy/M/d"
);
/**
* 获取时分秒
*/
private
static
final
SimpleDateFormat
timeSdf
=
new
SimpleDateFormat
(
"HH:mm:ss"
);
/**
* 获取当前时间
*
* @return 当前日期时间
*/
public
static
Date
getDateNow
()
{
return
new
Date
();
}
/**
* 获取当前时间
*
* @return 当前日期时间
*/
public
static
String
getDateNowString
()
{
return
convertDateToString
(
getDateNow
(),
DATE_TIME_PATTERN
);
}
public
static
String
date2LongStr
(
Date
dateDate
)
{
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
dateString
=
formatter
.
format
(
dateDate
);
return
dateString
;
}
public
static
String
longStrDate
(
Date
date
)
{
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
formattedDate
=
formatter
.
format
(
date
);
return
formattedDate
;
}
/**
* 获取现在日期字符串
*
* @return返回字符串格式 yyyy-MM-dd
*/
public
static
String
getDateNowShortStr
()
{
Date
currentTime
=
new
Date
();
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
DATE_PATTERN
);
String
dateString
=
formatter
.
format
(
currentTime
);
return
dateString
;
}
/**
* 将日期转换为字符串
*
* @param date 日期
* @param format 字符串格式
* @return 日期字符串
*/
public
static
String
convertDateToString
(
Date
date
,
String
format
)
{
SimpleDateFormat
df
=
null
;
String
returnValue
=
""
;
if
(
null
!=
date
)
{
df
=
new
SimpleDateFormat
(
format
);
returnValue
=
df
.
format
(
date
);
}
return
returnValue
;
}
/**
* 获取当前时间任意
*
* @return
*/
public
static
String
get
(
int
field
)
{
return
String
.
valueOf
(
getCalendar
().
get
(
field
));
}
/**
* 当前日历,这里用中国时间表示
*
* @return 以当地时区表示的系统当前日历
*/
public
static
Calendar
getCalendar
()
{
return
Calendar
.
getInstance
();
}
/**
* 日期相加减天数
*
* @param date 如果为Null,则为当前时间
* @param days 加减天数
* @param includeTime 是否包括时分秒,true表示包含
* @return
* @throws ParseException
*/
public
static
Date
dateAdd
(
Date
date
,
int
days
,
boolean
includeTime
)
throws
ParseException
{
if
(
date
==
null
)
{
date
=
new
Date
();
}
if
(!
includeTime
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
DateUtils
.
DATE_PATTERN
);
date
=
sdf
.
parse
(
sdf
.
format
(
date
));
}
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
date
);
cal
.
add
(
Calendar
.
DATE
,
days
);
return
cal
.
getTime
();
}
/**
* 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm:ss
*
* @param strDate
* @return
*/
public
static
Date
longStr2Date
(
String
strDate
)
{
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
ParsePosition
pos
=
new
ParsePosition
(
0
);
Date
strtodate
=
formatter
.
parse
(
strDate
,
pos
);
return
strtodate
;
}
public
static
Date
longStrDate
(
String
strDate
)
{
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
ParsePosition
pos
=
new
ParsePosition
(
0
);
Date
strtodate
=
formatter
.
parse
(
strDate
,
pos
);
return
strtodate
;
}
/**
* 时间格式化成字符串
*
* @param date Date
* @param pattern StrUtils.DATE_TIME_PATTERN || StrUtils.DATE_PATTERN, 如果为空,则为yyyy-MM-dd
* @return
* @throws ParseException
*/
public
static
String
dateFormat
(
Date
date
,
String
pattern
)
throws
ParseException
{
if
(
StringUtils
.
isEmpty
(
pattern
))
{
pattern
=
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
DateUtils
.
DATE_PATTERN
;
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
pattern
);
return
sdf
.
format
(
date
);
}
/**
* 暂时不操作原生截取做下转换
*
* @param str
* @return
* @throws ParseException
*/
public
static
String
dateToString
(
String
str
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
parse
=
null
;
String
content
=
null
;
try
{
parse
=
sdf
.
parse
(
str
);
content
=
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
DateUtils
.
dateFormat
(
parse
,
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
DateUtils
.
DATE_PATTERN
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
content
;
}
/*
* 将时间戳转换为时间
*/
public
static
String
stampToDate
(
Long
s
,
String
format
)
{
String
res
;
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
format
);
Date
date
=
new
Date
(
s
);
res
=
simpleDateFormat
.
format
(
date
);
return
res
;
}
/**
* 获取某年某月的第一天日期
*
* @param date
* @param format
* @return
*/
public
static
Date
getStartMonthDate
(
String
date
,
String
format
)
{
if
(
date
==
null
||
date
.
length
()
<
6
||
format
==
null
)
{
return
null
;
}
int
year
=
Integer
.
parseInt
(
date
.
substring
(
0
,
4
));
int
month
=
Integer
.
parseInt
(
date
.
substring
(
5
,
7
));
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
set
(
year
,
month
-
1
,
1
);
return
calendar
.
getTime
();
}
/**
* 获取某年某月的最后一天日期
*
* @param date
* @param format
* @return
*/
public
static
Date
getEndMonthDate
(
String
date
,
String
format
)
{
if
(
date
==
null
||
date
.
length
()
<
6
||
format
==
null
)
{
return
null
;
}
int
year
=
Integer
.
parseInt
(
date
.
substring
(
0
,
4
));
int
month
=
Integer
.
parseInt
(
date
.
substring
(
5
,
7
));
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
set
(
year
,
month
-
1
,
1
);
int
day
=
calendar
.
getActualMaximum
(
5
);
calendar
.
set
(
year
,
month
-
1
,
day
);
return
calendar
.
getTime
();
}
/**
* 字符串解析成时间对象
*
* @param dateTimeString String
* @param pattern StrUtils.DATE_TIME_PATTERN || StrUtils.DATE_PATTERN,如果为空,则为yyyy-MM-dd
* @return
* @throws ParseException
*/
public
static
Date
dateParse
(
String
dateTimeString
,
String
pattern
)
throws
ParseException
{
if
(
StringUtils
.
isEmpty
(
pattern
))
{
pattern
=
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
DateUtils
.
DATE_PATTERN
;
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
pattern
);
return
sdf
.
parse
(
dateTimeString
);
}
/**
* 字符串解析成时间对象
*
* @param dateTimeString String
* @param pattern StrUtils.DATE_TIME_PATTERN || StrUtils.DATE_PATTERN,如果为空,则为yyyy-MM-dd
* @return
* @throws ParseException
*/
public
static
Date
dateParseWithPattern
(
String
dateTimeString
)
throws
ParseException
{
List
<
String
>
dateFormats
=
Arrays
.
asList
(
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
DateUtils
.
DATE_TIME_PATTERN
,
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
DateUtils
.
DATE_PATTERN
);
for
(
String
format:
dateFormats
){
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
format
);
try
{
return
sdf
.
parse
(
dateTimeString
);
}
catch
(
ParseException
e
)
{
//intentionally empty
}
}
return
null
;
}
/**
* 将日期时间格式成只有日期的字符串(可以直接使用dateFormat,Pattern为Null进行格式化)
*
* @param dateTime Date
* @return
* @throws ParseException
*/
public
static
String
dateTimeToDateString
(
Date
dateTime
)
throws
ParseException
{
String
dateTimeString
=
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
DateUtils
.
dateFormat
(
dateTime
,
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
DateUtils
.
DATE_TIME_PATTERN
);
return
dateTimeString
.
substring
(
0
,
10
);
}
/**
* 当时、分、秒为00:00:00时,将日期时间格式成只有日期的字符串,
* 当时、分、秒不为00:00:00时,直接返回
*
* @param dateTime Date
* @return
* @throws ParseException
*/
public
static
String
dateTimeToDateStringIfTimeEndZero
(
Date
dateTime
)
throws
ParseException
{
String
dateTimeString
=
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
DateUtils
.
dateFormat
(
dateTime
,
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
DateUtils
.
DATE_TIME_PATTERN
);
if
(
dateTimeString
.
endsWith
(
"00:00:00"
))
{
return
dateTimeString
.
substring
(
0
,
10
);
}
else
{
return
dateTimeString
;
}
}
/**
* 将日期时间格式成日期对象,和dateParse互用
*
* @param dateTime Date
* @return Date
* @throws ParseException
*/
public
static
Date
dateTimeToDate
(
Date
dateTime
)
throws
ParseException
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
dateTime
);
cal
.
set
(
Calendar
.
HOUR_OF_DAY
,
0
);
cal
.
set
(
Calendar
.
MINUTE
,
0
);
cal
.
set
(
Calendar
.
SECOND
,
0
);
cal
.
set
(
Calendar
.
MILLISECOND
,
0
);
return
cal
.
getTime
();
}
/**
* 时间加减小时
*
* @param startDate 要处理的时间,Null则为当前时间
* @param hours 加减的小时
* @return Date
*/
public
static
Date
dateAddHours
(
Date
startDate
,
int
hours
)
{
if
(
startDate
==
null
)
{
startDate
=
new
Date
();
}
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
startDate
);
c
.
set
(
Calendar
.
HOUR
,
c
.
get
(
Calendar
.
HOUR
)
+
hours
);
return
c
.
getTime
();
}
/**
* 时间加减分钟
*
* @param startDate 要处理的时间,Null则为当前时间
* @param minutes 加减的分钟
* @return
*/
public
static
Date
dateAddMinutes
(
Date
startDate
,
int
minutes
)
{
if
(
startDate
==
null
)
{
startDate
=
new
Date
();
}
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
startDate
);
c
.
set
(
Calendar
.
MINUTE
,
c
.
get
(
Calendar
.
MINUTE
)
+
minutes
);
return
c
.
getTime
();
}
/**
* 时间加减秒数
*
* @param startDate 要处理的时间,Null则为当前时间
* @param
* @return
*/
public
static
Date
dateAddSeconds
(
Date
startDate
,
int
seconds
)
{
if
(
startDate
==
null
)
{
startDate
=
new
Date
();
}
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
startDate
);
c
.
set
(
Calendar
.
SECOND
,
c
.
get
(
Calendar
.
SECOND
)
+
seconds
);
return
c
.
getTime
();
}
/**
* 时间加减天数
*
* @param startDate 要处理的时间,Null则为当前时间
* @param days 加减的天数
* @return Date
*/
public
static
Date
dateAddDays
(
Date
startDate
,
int
days
)
{
if
(
startDate
==
null
)
{
startDate
=
new
Date
();
}
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
startDate
);
c
.
set
(
Calendar
.
DATE
,
c
.
get
(
Calendar
.
DATE
)
+
days
);
return
c
.
getTime
();
}
/**
* 时间加减月数
*
* @param startDate 要处理的时间,Null则为当前时间
* @param months 加减的月数
* @return Date
*/
public
static
Date
dateAddMonths
(
Date
startDate
,
int
months
)
{
if
(
startDate
==
null
)
{
startDate
=
new
Date
();
}
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
startDate
);
c
.
set
(
Calendar
.
MONTH
,
c
.
get
(
Calendar
.
MONTH
)
+
months
);
return
c
.
getTime
();
}
/**
* 时间加减年数
*
* @param startDate 要处理的时间,Null则为当前时间
* @param years 加减的年数
* @return Date
*/
public
static
Date
dateAddYears
(
Date
startDate
,
int
years
)
{
if
(
startDate
==
null
)
{
startDate
=
new
Date
();
}
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
startDate
);
c
.
set
(
Calendar
.
YEAR
,
c
.
get
(
Calendar
.
YEAR
)
+
years
);
return
c
.
getTime
();
}
/**
* 时间比较(如果myDate>compareDate返回1,<返回-1,相等返回0)
*
* @param myDate 时间
* @param compareDate 要比较的时间
* @return int
*/
public
static
int
dateCompare
(
Date
myDate
,
Date
compareDate
)
{
Calendar
myCal
=
Calendar
.
getInstance
();
Calendar
compareCal
=
Calendar
.
getInstance
();
myCal
.
setTime
(
myDate
);
compareCal
.
setTime
(
compareDate
);
return
myCal
.
compareTo
(
compareCal
);
}
/**
* 获取两个时间中最小的一个时间
*
* @param date
* @param compareDate
* @return
*/
public
static
Date
dateMin
(
Date
date
,
Date
compareDate
)
{
if
(
date
==
null
)
{
return
compareDate
;
}
if
(
compareDate
==
null
)
{
return
date
;
}
if
(
1
==
dateCompare
(
date
,
compareDate
))
{
return
compareDate
;
}
else
if
(-
1
==
dateCompare
(
date
,
compareDate
))
{
return
date
;
}
return
date
;
}
/**
* 获取两个时间中最大的一个时间
*
* @param date
* @param compareDate
* @return
*/
public
static
Date
dateMax
(
Date
date
,
Date
compareDate
)
{
if
(
date
==
null
)
{
return
compareDate
;
}
if
(
compareDate
==
null
)
{
return
date
;
}
if
(
1
==
dateCompare
(
date
,
compareDate
))
{
return
date
;
}
else
if
(-
1
==
dateCompare
(
date
,
compareDate
))
{
return
compareDate
;
}
return
date
;
}
/**
* 获取两个日期(不含时分秒)相差的天数,不包含今天
*
* @param startDate
* @param endDate
* @return
* @throws ParseException
*/
public
static
int
dateBetween
(
Date
startDate
,
Date
endDate
)
throws
ParseException
{
Date
dateStart
=
dateParse
(
dateFormat
(
startDate
,
DATE_PATTERN
),
DATE_PATTERN
);
Date
dateEnd
=
dateParse
(
dateFormat
(
endDate
,
DATE_PATTERN
),
DATE_PATTERN
);
return
(
int
)
((
dateEnd
.
getTime
()
-
dateStart
.
getTime
())
/
1000
/
60
/
60
/
24
);
}
/**
* 获取两个日期(不含时分秒)相差的天数,包含今天
*
* @param startDate
* @param endDate
* @return
* @throws ParseException
*/
public
static
int
dateBetweenIncludeToday
(
Date
startDate
,
Date
endDate
)
throws
ParseException
{
return
dateBetween
(
startDate
,
endDate
)
+
1
;
}
/**
* 获取日期时间的年份,如2017-02-13,返回2017
*
* @param date
* @return
*/
public
static
int
getYear
(
Date
date
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
date
);
return
cal
.
get
(
Calendar
.
YEAR
);
}
/**
* 获取日期时间的月份,如2017年2月13日,返回2
*
* @param date
* @return
*/
public
static
int
getMonth
(
Date
date
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
date
);
return
cal
.
get
(
Calendar
.
MONTH
)
+
1
;
}
/**
* 获取日期时间的第几天(即返回日期的dd),如2017-02-13,返回13
*
* @param date
* @return
*/
public
static
int
getDate
(
Date
date
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
date
);
return
cal
.
get
(
Calendar
.
DATE
);
}
/**
* 获取日期时间当月的总天数,如2017-02-13,返回28
*
* @param date
* @return
*/
public
static
int
getDaysOfMonth
(
Date
date
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
date
);
return
cal
.
getActualMaximum
(
Calendar
.
DATE
);
}
/**
* 获取日期时间当年的总天数,如2017-02-13,返回2017年的总天数
*
* @param date
* @return
*/
public
static
int
getDaysOfYear
(
Date
date
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
date
);
return
cal
.
getActualMaximum
(
Calendar
.
DAY_OF_YEAR
);
}
/**
* 根据时间获取当月最大的日期
* <li>2017-02-13,返回2017-02-28</li>
* <li>2016-02-13,返回2016-02-29</li>
* <li>2016-01-11,返回2016-01-31</li>
*
* @param date Date
* @return
* @throws Exception
*/
public
static
Date
maxDateOfMonth
(
Date
date
)
throws
Exception
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
date
);
int
value
=
cal
.
getActualMaximum
(
Calendar
.
DATE
);
return
dateParse
(
dateFormat
(
date
,
MONTH_PATTERN
)
+
"-"
+
value
,
null
);
}
/**
* 根据时间获取当月最小的日期,也就是返回当月的1号日期对象
*
* @param date Date
* @return
* @throws Exception
*/
public
static
Date
minDateOfMonth
(
Date
date
)
throws
Exception
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
date
);
int
value
=
cal
.
getActualMinimum
(
Calendar
.
DATE
);
return
dateParse
(
dateFormat
(
date
,
MONTH_PATTERN
)
+
"-"
+
value
,
null
);
}
/**
* 根据年月返回第一天
*
* @param yearParam
* @param monthParam
* @return
*/
public
static
Date
getFirstDayByMonth
(
int
yearParam
,
int
monthParam
)
{
Calendar
c
=
Calendar
.
getInstance
(
Locale
.
CHINA
);
c
.
set
(
yearParam
,
monthParam
-
1
,
1
);
try
{
Date
date
=
shortSdf
.
parse
(
shortSdf
.
format
(
c
.
getTime
())
+
" 00:00:00"
);
return
date
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
* 获取某月的日期List
*
* @param yearParam
* @param monthParam
* @return
*/
public
static
List
<
String
>
getDayByMonth
(
int
yearParam
,
int
monthParam
)
{
List
list
=
new
ArrayList
();
Calendar
aCalendar
=
Calendar
.
getInstance
(
Locale
.
CHINA
);
aCalendar
.
set
(
yearParam
,
monthParam
-
1
,
1
);
int
year
=
aCalendar
.
get
(
Calendar
.
YEAR
);
//年份
int
month
=
aCalendar
.
get
(
Calendar
.
MONTH
)
+
1
;
//月份
int
day
=
aCalendar
.
getActualMaximum
(
Calendar
.
DATE
);
for
(
int
i
=
1
;
i
<=
day
;
i
++)
{
list
.
add
(
year
+
"/"
+
month
+
"/"
+
i
);
}
return
list
;
}
/**
* 当前月的结束时间,即2012-01-31 23:59:59
*
* @return
*/
public
static
Date
getCurrentMonthEndTime
(
Date
date
)
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
Date
now
=
null
;
c
.
set
(
Calendar
.
DATE
,
1
);
c
.
add
(
Calendar
.
MONTH
,
1
);
c
.
add
(
Calendar
.
DATE
,
-
1
);
try
{
now
=
longSdf
.
parse
(
shortSdf
.
format
(
c
.
getTime
())
+
" 23:59:59"
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
now
;
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
System
.
out
.
println
(
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
DateUtils
.
convertDateToString
(
new
Date
(),
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
DateUtils
.
CHN_DATE_PATTERN
));
/*System.out.println(dateTimeToDate(new Date()));
System.out.println(dateParse("2017-02-04 14:58:20", null));
System.out.println(dateTimeToDateStringIfTimeEndZero(new Date()));
System.out.println(dateTimeToDateStringIfTimeEndZero(dateTimeToDate(new Date())));*/
//System.out.println(dateBetween(dateParse("2017-01-30", null), dateParse("2017-02-01", null)));
//System.out.println(dateBetweenIncludeToday(dateParse("2017-01-30", null), dateParse("2017-02-01", null)));
// System.out.println(getDate(dateParse("2017-01-17", null)));
//System.out.println(getDate(dateParse("2017-01-17", null)));
/*
System.out.println(getDaysOfMonth(dateParse("2017-02-01", null)));
System.out.println(getDaysOfYear(dateParse("2017-01-30", null)));*/
//System.out.println(dateFormat(dateAddMonths(dateParse("2017-02-07", StrUtils.MONTH_PATTERN), -12), StrUtils
// .MONTH_PATTERN));
/*System.out.println(dateFormat(maxDateOfMonth(dateParse("2016-02", "yyyy-MM")), null));
System.out.println(dateFormat(minDateOfMonth(dateParse("2016-03-31", null)), null));*/
// System.out.println(dateFormat(new Date(), CHN_DATE_PATTERN_YEAR));
// System.out.println(dateFormat(new Date(), CHN_DATE_PATTERN_MONTH));
// System.out.println(getWeekOfYear(new Date()));
// System.out.println(getQuarterStr(getMonth(dateParse("2021-5-11", null))));
// System.out.println(getWeekBeginDate(dateParse("2021-10-11", null)));
// System.out.println(getWeekEndDate(dateParse("2021-10-11", null)));
// System.out.println(secondsToTimeStr(3600));
// System.out.println(getTimeString(dateParse("2023-09-07 16:15:15", DATE_TIME_PATTERN), dateParse("2023-09-06 " +
// "16:15:15", DATE_TIME_PATTERN)));
long
diff
=
dateParse
(
"2022-09-07 16:16:16"
,
DATE_TIME_PATTERN
).
getTime
()
-
dateParse
(
"2023-09-06 10:15:15"
,
DATE_TIME_PATTERN
).
getTime
();
System
.
out
.
println
(
diff
/
1000
);
System
.
out
.
println
(
secondsToTimeStr
((
int
)
diff
/
1000
));
}
/**
* 当前日期毫秒.xls
*
* @return
*/
public
static
String
formatName
()
{
Calendar
calen
=
Calendar
.
getInstance
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMddhhmmss"
);
String
name
=
sdf
.
format
(
calen
.
getTime
());
return
name
;
}
/**
* 获取某月的日期List
*
* @param dateStr
* @return
*/
public
static
List
<
Date
>
getDayByMonth
(
String
dateStr
)
{
List
<
Date
>
list
=
new
ArrayList
();
Date
date
=
null
;
try
{
date
=
shortSdf
.
parse
(
dateStr
);
calendar
.
setTime
(
date
);
int
month
=
calendar
.
get
(
Calendar
.
MONTH
)
+
1
;
//月份
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
//年份
int
day
=
calendar
.
getActualMaximum
(
Calendar
.
DATE
);
for
(
int
i
=
1
;
i
<=
day
;
i
++)
{
String
source
=
year
+
"-"
+
month
+
"-"
+
i
;
list
.
add
(
shortSdf
.
parse
(
source
));
}
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
list
;
}
/**
* 判断一个时间是否在一个时间段内
*
* @param nowTime 当前时间
* @param beginTime 开始时间
* @param endTime 结束时间
*/
public
static
boolean
belongCalendar
(
Date
nowTime
,
Date
beginTime
,
Date
endTime
)
{
Calendar
date
=
Calendar
.
getInstance
();
date
.
setTime
(
nowTime
);
Calendar
begin
=
Calendar
.
getInstance
();
begin
.
setTime
(
beginTime
);
Calendar
end
=
Calendar
.
getInstance
();
end
.
setTime
(
endTime
);
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
;
}
/**
* 根据两个日期返回相差的时分秒
*
* @param newTime 靠后时间
* @param oldTime 靠前时间
* @return
*/
public
static
String
getTimeString
(
Date
newTime
,
Date
oldTime
)
{
Long
newTimes
=
newTime
.
getTime
();
Long
oldTimes
=
oldTime
.
getTime
();
// 不改时间会多加八个小时
timeSdf
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"GMT+00:00"
));
return
timeSdf
.
format
(
newTimes
-
oldTimes
);
}
/**
* 根据两个日期返回相差的时分秒
*
* @param newTime 靠后时间
* @param oldTime 靠前时间
* @return
*/
public
static
String
getTimeDiffString
(
Date
newTime
,
Date
oldTime
)
{
Long
newTimes
=
newTime
.
getTime
();
Long
oldTimes
=
oldTime
.
getTime
();
long
diff
=
newTimes
-
oldTimes
;
return
secondsToTimeStr
((
int
)
diff
/
1000
);
}
/**
* 获取现在日期字符串时间戳格式
*
* @return返回字符串格式 yyyyMMdd
*/
public
static
String
getDateNowShortNumber
()
{
Date
currentTime
=
new
Date
();
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
DATE_PATTERN_NUM
);
String
dateString
=
formatter
.
format
(
currentTime
);
return
dateString
;
}
/**
* 获取一年的第几周
*
* @param date
* @return
*/
public
static
int
getWeekOfYear
(
Date
date
)
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
int
week_of_year
=
c
.
get
(
Calendar
.
WEEK_OF_YEAR
);
return
week_of_year
;
}
/**
* 通过月份计算季度
*
* @param month
* @return
*/
public
static
int
getQuarter
(
int
month
)
{
if
(
month
<
1
||
month
>
12
)
{
throw
new
IllegalArgumentException
(
"month is invalid."
);
}
return
(
month
-
1
)
/
3
+
1
;
}
/**
* 通过月份计算季度
*
* @param month
* @return
*/
public
static
String
getQuarterStr
(
int
month
)
{
if
(
month
<
1
||
month
>
12
)
{
throw
new
IllegalArgumentException
(
"month is invalid."
);
}
return
(
month
-
1
)
/
3
+
1
+
""
;
}
/**
* 获得本天的开始时间,即2012-01-01 00:00:00
*
* @return
*/
public
static
Date
getCurrentDayStartTime
(
Date
date
)
{
try
{
date
=
shortSdf
.
parse
(
shortSdf
.
format
(
date
)
+
" 00:00:00"
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
date
;
}
/**
* 获得本天的结束时间,即2012-01-01 23:59:59
*
* @return
*/
public
static
Date
getCurrentDayEndTime
(
Date
date
)
{
try
{
date
=
longSdf
.
parse
(
shortSdf
.
format
(
date
)
+
" 23:59:59"
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
date
;
}
/**
* 获取指定时间所在周的第一天日期
*
* @param date
* @return
*/
public
static
int
getWeekBeginDate
(
Date
date
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setFirstDayOfWeek
(
Calendar
.
MONDAY
);
calendar
.
setTime
(
date
);
calendar
.
set
(
Calendar
.
DAY_OF_WEEK
,
Calendar
.
MONDAY
);
System
.
out
.
println
(
calendar
.
getTime
());
return
getDate
(
calendar
.
getTime
());
}
public
static
Date
beginDateOfWeek
(
Date
date
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setFirstDayOfWeek
(
Calendar
.
MONDAY
);
calendar
.
setTime
(
date
);
calendar
.
set
(
Calendar
.
DAY_OF_WEEK
,
Calendar
.
MONDAY
);
return
calendar
.
getTime
();
}
public
static
Date
endDateOfWeek
(
Date
date
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setFirstDayOfWeek
(
Calendar
.
MONDAY
);
calendar
.
setTime
(
date
);
calendar
.
set
(
Calendar
.
DAY_OF_WEEK
,
Calendar
.
SUNDAY
);
return
calendar
.
getTime
();
}
/**
* 获取指定时间所在周的最后一天日期
*
* @param date
* @return
*/
public
static
int
getWeekEndDate
(
Date
date
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setFirstDayOfWeek
(
Calendar
.
MONDAY
);
calendar
.
setTime
(
date
);
calendar
.
set
(
Calendar
.
DAY_OF_WEEK
,
Calendar
.
SUNDAY
);
System
.
out
.
println
(
calendar
.
getTime
());
return
getDate
(
calendar
.
getTime
());
}
public
static
Date
getBeginDateOfMonth
(
Date
date
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
date
);
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
calendar
.
getActualMinimum
(
Calendar
.
DAY_OF_MONTH
));
return
calendar
.
getTime
();
}
/**
* 将秒数转换为时分秒格式
*
* @param times
* @return
*/
public
static
String
secondsToTimeStr
(
int
times
)
{
if
(
times
<=
0
)
{
return
"00:00:00"
;
}
int
h
=
times
/
3600
;
int
m
=
(
times
-
h
*
3600
)
/
60
;
int
s
=
times
-
h
*
3600
-
m
*
60
;
String
time
=
"%02d:%02d:%02d"
;
time
=
String
.
format
(
time
,
h
,
m
,
s
);
return
time
;
}
public
static
Date
getTargetEndTime
(
Date
target
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
target
);
calendar
.
set
(
Calendar
.
HOUR_OF_DAY
,
23
);
calendar
.
set
(
Calendar
.
MINUTE
,
59
);
calendar
.
set
(
Calendar
.
SECOND
,
59
);
Date
end
=
calendar
.
getTime
();
return
end
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/SafetyProblemTracingMapper.xml
View file @
e0a91e5c
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
and spt.principal_unit like CONCAT('%', #{problemModel.principalUnit}, '%')
and spt.principal_unit like CONCAT('%', #{problemModel.principalUnit}, '%')
</if>
</if>
<if
test=
"problemModel.principalUnitType != null and problemModel.principalUnitType != ''"
>
<if
test=
"problemModel.principalUnitType != null and problemModel.principalUnitType != ''"
>
and spt.principal_unit_type
=
like CONCAT('%', #{problemModel.principalUnitType}, '%')
and spt.principal_unit_type like CONCAT('%', #{problemModel.principalUnitType}, '%')
</if>
</if>
<if
test=
"problemModel.hiddenDangersLevel != null and problemModel.hiddenDangersLevel != ''"
>
<if
test=
"problemModel.hiddenDangersLevel != null and problemModel.hiddenDangersLevel != ''"
>
and spt.problem_status_code = #{problemModel.hiddenDangersLevel}
and spt.problem_status_code = #{problemModel.hiddenDangersLevel}
...
...
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/src/main/java/com/yeejoin/amos/boot/module/statistics/api/vo/TzsUserInfoVo.java
View file @
e0a91e5c
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistics
.
api
.
vo
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistics
.
api
.
vo
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -59,7 +60,7 @@ public class TzsUserInfoVo {
...
@@ -59,7 +60,7 @@ public class TzsUserInfoVo {
* 出生日期
* 出生日期
*/
*/
@TableField
(
"birthday"
)
@TableField
(
"birthday"
)
private
Date
birthday
;
private
String
birthday
;
/**
/**
* 学历
* 学历
...
...
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/service/impl/JGDPStatisticsServiceImpl.java
View file @
e0a91e5c
...
@@ -22,6 +22,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
...
@@ -22,6 +22,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
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.dto.LegendDataDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.LegendDataDto
;
import
com.yeejoin.amos.boot.module.common.api.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.common.api.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum
;
import
com.yeejoin.amos.boot.module.common.api.enums.*
;
import
com.yeejoin.amos.boot.module.common.api.enums.*
;
import
com.yeejoin.amos.boot.module.jg.api.dto.EquipBizCountDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.EquipBizCountDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.FourColorCountDataDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.FourColorCountDataDto
;
...
...
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/service/impl/UserBizByTCMServiceImpl.java
View file @
e0a91e5c
...
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
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.module.common.api.entity.TzsUserPermission
;
import
com.yeejoin.amos.boot.module.common.api.entity.TzsUserPermission
;
import
com.yeejoin.amos.boot.module.common.api.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.statistics.api.entity.TzsUserInfo
;
import
com.yeejoin.amos.boot.module.statistics.api.entity.TzsUserInfo
;
import
com.yeejoin.amos.boot.module.statistics.api.mapper.UserInfoMapper
;
import
com.yeejoin.amos.boot.module.statistics.api.mapper.UserInfoMapper
;
import
com.yeejoin.amos.boot.module.statistics.api.mapper.UserPermissionMapper
;
import
com.yeejoin.amos.boot.module.statistics.api.mapper.UserPermissionMapper
;
...
@@ -83,6 +84,7 @@ public class UserBizByTCMServiceImpl {
...
@@ -83,6 +84,7 @@ public class UserBizByTCMServiceImpl {
tzsUserInfoVo
.
setProfile
(
ObjectUtils
.
isEmpty
(
tzsUserInfo
.
getProfile
())
?
null
:
JSON
.
parseArray
(
tzsUserInfo
.
getProfile
()));
tzsUserInfoVo
.
setProfile
(
ObjectUtils
.
isEmpty
(
tzsUserInfo
.
getProfile
())
?
null
:
JSON
.
parseArray
(
tzsUserInfo
.
getProfile
()));
tzsUserInfoVo
.
setAppointDoc
(
ObjectUtils
.
isEmpty
(
tzsUserInfo
.
getAppointDoc
())
?
null
:
JSON
.
parseArray
(
tzsUserInfo
.
getAppointDoc
()));
tzsUserInfoVo
.
setAppointDoc
(
ObjectUtils
.
isEmpty
(
tzsUserInfo
.
getAppointDoc
())
?
null
:
JSON
.
parseArray
(
tzsUserInfo
.
getAppointDoc
()));
tzsUserInfoVo
.
setOtherAccessories
(
ObjectUtils
.
isEmpty
(
tzsUserInfo
.
getOtherAccessories
())
?
null
:
JSON
.
parseArray
(
tzsUserInfo
.
getOtherAccessories
()));
tzsUserInfoVo
.
setOtherAccessories
(
ObjectUtils
.
isEmpty
(
tzsUserInfo
.
getOtherAccessories
())
?
null
:
JSON
.
parseArray
(
tzsUserInfo
.
getOtherAccessories
()));
tzsUserInfoVo
.
setBirthday
(
tzsUserInfo
.
getBirthday
()
!=
null
?
DateUtils
.
longStrDate
(
tzsUserInfo
.
getBirthday
()):
null
);
String
companyType
=
getUnitType
();
String
companyType
=
getUnitType
();
tzsUserInfoVo
.
setCompanyType
(
companyType
.
contains
(
"个人主体"
)
?
"individual"
:
"no-individual"
);
tzsUserInfoVo
.
setCompanyType
(
companyType
.
contains
(
"个人主体"
)
?
"individual"
:
"no-individual"
);
Map
<
String
,
Object
>
userInfoMap
=
BeanUtil
.
beanToMap
(
tzsUserInfoVo
);
Map
<
String
,
Object
>
userInfoMap
=
BeanUtil
.
beanToMap
(
tzsUserInfoVo
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment