Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
c54143e2
提交
c54143e2
authored
3月 05, 2020
作者:
孙洁清
浏览文件
操作
浏览文件
下载
差异文件
关键技术接口根据name查询功能
上级
a28b7470
5a4236c7
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
266 行增加
和
81 行删除
+266
-81
InspectController.java
...n/java/com/zjty/inspect/controller/InspectController.java
+16
-6
ReportController.java
...in/java/com/zjty/inspect/controller/ReportController.java
+37
-0
ReportDao.java
src/main/java/com/zjty/inspect/dao/ReportDao.java
+7
-0
RuleDao.java
src/main/java/com/zjty/inspect/dao/RuleDao.java
+7
-0
TechnologyDao.java
src/main/java/com/zjty/inspect/dao/TechnologyDao.java
+7
-0
CoefficientModel.java
src/main/java/com/zjty/inspect/entity/CoefficientModel.java
+1
-1
InspectParameter.java
src/main/java/com/zjty/inspect/entity/InspectParameter.java
+10
-5
Page.java
src/main/java/com/zjty/inspect/entity/Page.java
+37
-0
Report.java
src/main/java/com/zjty/inspect/entity/Report.java
+3
-36
ReportManage.java
src/main/java/com/zjty/inspect/entity/ReportManage.java
+14
-0
Technology.java
src/main/java/com/zjty/inspect/entity/Technology.java
+2
-1
Inspector.java
src/main/java/com/zjty/inspect/inspect/Inspector.java
+23
-15
ParameterService.java
src/main/java/com/zjty/inspect/service/ParameterService.java
+1
-1
ReportService.java
src/main/java/com/zjty/inspect/service/ReportService.java
+8
-4
InspectServiceImpl.java
...ava/com/zjty/inspect/service/impl/InspectServiceImpl.java
+11
-3
ReportServiceImpl.java
...java/com/zjty/inspect/service/impl/ReportServiceImpl.java
+35
-7
BudgetUitl.java
src/main/java/com/zjty/inspect/utils/BudgetUitl.java
+7
-2
RandomUtil.java
src/main/java/com/zjty/inspect/utils/RandomUtil.java
+40
-0
没有找到文件。
src/main/java/com/zjty/inspect/controller/InspectController.java
浏览文件 @
c54143e2
package
com
.
zjty
.
inspect
.
controller
;
import
com.zjty.inspect.dao.TechnologyDao
;
import
com.zjty.inspect.entity.InspectParameter
;
import
com.zjty.inspect.entity.ReportVo
;
import
com.zjty.inspect.entity.Technology
;
import
com.zjty.inspect.entity.Warn
;
import
com.zjty.inspect.entity.*
;
import
com.zjty.inspect.service.InspectService
;
import
com.zjty.inspect.service.ParameterService
;
import
com.zjty.inspect.service.ReportService
;
import
com.zjty.inspect.service.TechnologyService
;
import
com.zjty.inspect.utils.*
;
import
freemarker.template.TemplateException
;
...
...
@@ -39,6 +38,11 @@ public class InspectController {
@Autowired
private
TechnologyService
technologyService
;
@Autowired
private
ParameterService
parameterService
;
@Autowired
private
ReportService
reportService
;
/**
* 上传代码进行评估
* @param years 系统开发时间
...
...
@@ -82,7 +86,7 @@ public class InspectController {
int
support
=
technologyService
.
findAllTechnologyNotSupport
();
reportVo
.
setTechnologiesRepair
(
support
);
reportVo
.
setId
(
TimeUtil
.
getNowDate
());
reportVo
.
setId
(
RandomUtil
.
getRandom
());
reportVo
.
setUploadType
(
"文件上传"
);
reportVo
.
setFileName
(
file
.
getName
());
reportVo
.
setProjectName
(
projectName
);
...
...
@@ -113,7 +117,13 @@ public class InspectController {
}
catch
(
TemplateException
e
)
{
e
.
printStackTrace
();
}
Report
report
=
new
Report
();
String
random
=
RandomUtil
.
getRandom
();
report
.
setId
(
RandomUtil
.
getRandom
());
report
.
setHtmlAddress
(
reportVo
.
getHtmlAddress
());
reportService
.
saveReport
(
report
);
inspectParameter
.
setReportId
(
random
);
parameterService
.
saveParameter
(
inspectParameter
);
return
ResponseEntity
.
ok
(
inspect
);
}
...
...
src/main/java/com/zjty/inspect/controller/ReportController.java
0 → 100644
浏览文件 @
c54143e2
package
com
.
zjty
.
inspect
.
controller
;
import
com.zjty.inspect.service.ReportService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author Mcj
* @date 2020-03-05 19:22
*/
@RestController
@RequestMapping
(
"/report"
)
@Api
(
value
=
"报告管理页面接口"
,
description
=
"报告管理页面接口,提供页面的增、删、改、查"
)
public
class
ReportController
{
@Autowired
private
ReportService
reportService
;
@GetMapping
(
"/page/{page}"
)
@ApiOperation
(
"根据页码获取数据"
)
public
ResponseEntity
getReportByPage
(
@PathVariable
int
page
){
return
ResponseEntity
.
ok
(
reportService
.
findReportByPage
(
page
));
}
@GetMapping
(
"/id/{id}"
)
@ApiOperation
(
"根据id获取数据"
)
public
ResponseEntity
getReportById
(
@PathVariable
String
id
){
return
ResponseEntity
.
ok
(
reportService
.
findReportById
(
id
));
}
}
src/main/java/com/zjty/inspect/dao/ReportDao.java
0 → 100644
浏览文件 @
c54143e2
package
com
.
zjty
.
inspect
.
dao
;
import
com.zjty.inspect.entity.Report
;
import
org.springframework.data.jpa.repository.JpaRepository
;
public
interface
ReportDao
extends
JpaRepository
<
Report
,
String
>
{
}
src/main/java/com/zjty/inspect/dao/RuleDao.java
浏览文件 @
c54143e2
...
...
@@ -26,4 +26,11 @@ public interface RuleDao extends JpaRepository<Rule,String>,JpaSpecificationExec
List
<
Rule
>
findAllByTargetLike
(
String
target
);
Rule
findByTarget
(
String
target
);
/**
* 根据技术id查询规则
* @param ids 技术id
* @return
*/
List
<
Rule
>
findAllByTechnologyIdIn
(
List
<
String
>
ids
);
}
src/main/java/com/zjty/inspect/dao/TechnologyDao.java
浏览文件 @
c54143e2
...
...
@@ -41,4 +41,11 @@ public interface TechnologyDao extends JpaRepository<Technology,String>, JpaSpec
* @return
*/
int
countAllBySupportIsNot
(
Integer
support
);
/**
* 查询前端或者后端依赖技术
* @param backOrFront
* @return
*/
List
<
Technology
>
findAllByBackorfrontEquals
(
String
backOrFront
);
}
src/main/java/com/zjty/inspect/entity/CoefficientModel.java
浏览文件 @
c54143e2
...
...
@@ -46,7 +46,7 @@ public class CoefficientModel {
private
Integer
scale
;
public
Double
countCoefficient
(
Integer
data
)
{
if
(
data
==
null
||
data
==
0
){
if
(
data
==
null
){
return
1
D
;
}
if
(
data
<
min
){
...
...
src/main/java/com/zjty/inspect/entity/InspectParameter.java
浏览文件 @
c54143e2
...
...
@@ -56,6 +56,11 @@ public class InspectParameter {
* 代码量
*/
private
Integer
codeSize
;
/**
* 内容
*/
private
Integer
content
;
/**
* 架构
*/
...
...
@@ -97,11 +102,6 @@ public class InspectParameter {
*/
private
String
reportAddress
;
/**
* 预算报告地址
*/
private
String
budgetAddress
;
/**
* git上传地址
*/
...
...
@@ -128,4 +128,9 @@ public class InspectParameter {
* 方式
*/
private
Integer
recastMethod
;
/**
* 报告id
*/
private
String
reportId
;
}
src/main/java/com/zjty/inspect/entity/Page.java
0 → 100644
浏览文件 @
c54143e2
package
com
.
zjty
.
inspect
.
entity
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author Mcj
* @date 2020-03-05 19:24
*/
public
class
Page
<
T
>
{
private
int
totalPage
;
private
int
totalElement
;
private
List
<
T
>
objects
=
new
ArrayList
<
T
>();
public
void
add
(
T
t
){
objects
.
add
(
t
);
}
public
void
addAll
(
List
<
T
>
t
){
objects
.
addAll
(
t
);
}
public
void
setTotalPage
(
int
totalPage
)
{
this
.
totalPage
=
totalPage
;
}
public
void
setTotalElement
(
int
totalElement
)
{
this
.
totalElement
=
totalElement
;
}
public
int
getTotalPage
()
{
return
totalPage
;
}
public
int
getTotalElement
()
{
return
totalElement
;
}
}
src/main/java/com/zjty/inspect/entity/Report.java
浏览文件 @
c54143e2
...
...
@@ -13,45 +13,19 @@ import java.sql.Timestamp;
* 报告
* @author mcj
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
Report
{
/**
* git源代码地址
*/
private
String
gitAddress
;
/**
* 架构,整合型还是分离型,根据jsp数量决定
*/
private
String
framework
;
/**
* 代码管理方式,
*/
private
String
manager
;
/**
* 语言
*/
private
String
language
;
@Id
private
String
id
;
/**
* 生成报告存储地址
*/
private
String
htmlAddress
;
/**
* 适配方式
* 1:适配
* 2:重构
*/
@Column
(
length
=
5
)
private
Integer
recastMethod
;
//前端适配预算
//代码重构预算
//代码修改预算
...
...
@@ -69,11 +43,4 @@ public class Report {
@Column
(
name
=
"update_time"
,
columnDefinition
=
"TIMESTAMP DEFAULT CURRENT_TIMESTAMP"
,
insertable
=
false
)
@Generated
(
GenerationTime
.
ALWAYS
)
private
Timestamp
updateDate
;
public
enum
DependenceManagement
{
MAVEN
,
GRADLE
,
ANT
}
public
enum
Language
{
JAVA
,
PYTHON
,
CPP
,
JSP
,
ASP
,
ONLYVIEW
,
UNKNOW
,
JAVASCRIPT
,
GO
,
VUE
,
HTML
}
}
src/main/java/com/zjty/inspect/entity/ReportManage.java
0 → 100644
浏览文件 @
c54143e2
package
com
.
zjty
.
inspect
.
entity
;
import
lombok.Data
;
/**
* @author Mcj
* @date 2020-03-05 19:49
*/
@Data
public
class
ReportManage
{
Report
report
;
InspectParameter
inspectParameter
;
}
src/main/java/com/zjty/inspect/entity/Technology.java
浏览文件 @
c54143e2
...
...
@@ -50,7 +50,8 @@ public class Technology {
* 1:前端技术
* 2:后端技术
*/
private
Integer
backOrFront
=
2
;
@Column
(
name
=
"back_or_front"
)
private
Integer
backorfront
=
2
;
/**
* 数据创建时间
*/
...
...
src/main/java/com/zjty/inspect/inspect/Inspector.java
浏览文件 @
c54143e2
...
...
@@ -57,7 +57,7 @@ public class Inspector {
* key:mysql-connect : *
* mysql-connect:*
* mysql-connect:.java
*
*
<p>
* value:随意
*/
private
HashMap
<
String
,
Rule
>
ruleMap
=
new
HashMap
<>();
...
...
@@ -132,18 +132,15 @@ public class Inspector {
* @return 报告
*/
public
ReportVo
inspect
()
{
ruleSuffixFileMap
=
new
HashMap
<>();
ruleSuffixFileMap
=
new
HashMap
<>();
ruleSuffixMap
=
new
HashMap
<>();
warns
.
clear
();
rules
.
clear
();
//查询技术,构造支持与非支持技术对象
findExistTechnology
();
//统计项目组成文件构成
statisticsLanguage
();
this
.
ruleList
=
ruleDao
.
findAll
();
//统计项目组成文件构成
//统计配置文件地址
statisticsConfigFile
();
//查询所有规则
ruleTransform
();
try
{
//以下为计算文件名称匹配正则表达式
FileSystem
aDefault
=
FileSystems
.
getDefault
();
...
...
@@ -179,7 +176,7 @@ public class Inspector {
//通过正则表达式匹配.java类型后缀文件,并+1
if
(
entry
.
getValue
().
matches
(
file
))
{
long
length
=
file
.
toFile
().
length
();
codeSize
+=
length
/
1024
;
codeSize
+=
length
/
1024
;
languageMatchMap
.
get
(
entry
.
getKey
()).
plus
();
}
}
...
...
@@ -228,7 +225,7 @@ public class Inspector {
pomDependency
.
setSupport
(
1
);
}
else
{
//为普通用户上传,依赖需要检查是否支持。
int
i
=
valiWarn
(
ruleList
,
file
,
patten
,
0
);
int
i
=
valiWarn
(
ruleList
,
file
,
patten
,
0
);
//如果值为0则代表是有不支持技术到匹配
pomDependency
.
setSupport
(
i
);
}
...
...
@@ -263,6 +260,11 @@ public class Inspector {
public
ReportVo
analysis
()
{
DependencyVo
dependencyVo
=
new
DependencyVo
();
setReportLanguageAndFrame
();
//查询技术,构造支持与非支持技术对象
findExistTechnology
();
//查询所有规则
ruleTransform
(
report
.
getRecastMethod
());
//解析配置文件集合
for
(
Map
.
Entry
<
String
,
List
<
Path
>>
entry
:
configFileTypePathsMapping
.
entrySet
())
{
switch
(
entry
.
getKey
())
{
...
...
@@ -367,7 +369,7 @@ public class Inspector {
if
(
entry
.
getValue
().
getNumber
()
>
maxnum
)
{
most
=
suffixLanguageMapping
.
get
(
entry
.
getKey
()).
name
();
Language
language
=
Language
.
valueOf
(
most
);
mostStatus
=
language
.
getStatus
();
mostStatus
=
language
.
getStatus
();
maxnum
=
entry
.
getValue
().
getNumber
();
}
}
...
...
@@ -386,8 +388,14 @@ public class Inspector {
/**
* rule所需要数据装配
*/
private
void
ruleTransform
()
{
this
.
ruleList
=
ruleDao
.
findAll
();
private
void
ruleTransform
(
int
i
)
{
if
(
i
==
1
){
List
<
Technology
>
front
=
technologyDao
.
findAllByBackorfrontEquals
(
"1"
);
List
<
String
>
ids
=
front
.
stream
().
map
(
Technology:
:
getId
).
collect
(
Collectors
.
toList
());
this
.
ruleList
=
ruleDao
.
findAllByTechnologyIdIn
(
ids
);
}
else
{
this
.
ruleList
=
ruleDao
.
findAll
();
}
Set
<
String
>
id
=
ruleList
.
stream
().
map
(
Rule:
:
getTechnologyId
).
collect
(
Collectors
.
toSet
());
List
<
Technology
>
technologies
=
technologyDao
.
findAllByIdIn
(
new
ArrayList
<>(
id
));
for
(
Technology
technology
:
technologies
)
{
...
...
@@ -401,10 +409,10 @@ public class Inspector {
}
//根据后缀名进行规则收集
for
(
Rule
rule
:
ruleList
)
{
if
(!
ruleSuffixMap
.
containsKey
(
rule
.
getSuffix
()))
{
if
(!
ruleSuffixMap
.
containsKey
(
rule
.
getSuffix
()))
{
ruleSuffixMap
.
put
(
rule
.
getSuffix
(),
new
ArrayList
<>());
ruleSuffixMap
.
get
(
rule
.
getSuffix
()).
add
(
rule
);
}
else
{
}
else
{
ruleSuffixMap
.
get
(
rule
.
getSuffix
()).
add
(
rule
);
}
}
...
...
@@ -522,7 +530,7 @@ public class Inspector {
}
else
if
(
technologyHashMap
.
get
(
rule
.
getTechnologyId
()).
getSupport
()
==
3
)
{
warns
.
add
(
warn
);
supportStatus
=
3
;
}
else
if
(
technologyHashMap
.
get
(
rule
.
getTechnologyId
()).
getSupport
()
==
1
)
{
}
else
if
(
technologyHashMap
.
get
(
rule
.
getTechnologyId
()).
getSupport
()
==
1
)
{
warns
.
add
(
warn
);
supportStatus
=
1
;
}
...
...
src/main/java/com/zjty/inspect/service/ParameterService.java
浏览文件 @
c54143e2
...
...
@@ -16,7 +16,7 @@ public interface ParameterService {
public
void
saveParameter
(
InspectParameter
inspectParameter
);
/**
*
保存
参数
*
根据id获取
参数
* @param id id
*/
public
InspectParameter
getParameterById
(
String
id
);
...
...
src/main/java/com/zjty/inspect/service/ReportService.java
浏览文件 @
c54143e2
package
com
.
zjty
.
inspect
.
service
;
import
com.zjty.inspect.entity.ReportVo
;
import
org.springframework.data.domain.Page
;
import
java.util.List
;
import
com.zjty.inspect.entity.Page
;
import
com.zjty.inspect.entity.Report
;
import
com.zjty.inspect.entity.ReportManage
;
public
interface
ReportService
{
public
Page
findReportByPage
(
int
page
);
public
ReportManage
findReportById
(
String
id
);
void
saveReport
(
Report
report
);
}
src/main/java/com/zjty/inspect/service/impl/InspectServiceImpl.java
浏览文件 @
c54143e2
package
com
.
zjty
.
inspect
.
service
.
impl
;
import
com.zjty.inspect.dao.ReportDao
;
import
com.zjty.inspect.entity.InspectParameter
;
import
com.zjty.inspect.entity.Report
;
import
com.zjty.inspect.entity.ReportVo
;
import
com.zjty.inspect.enums.Language
;
import
com.zjty.inspect.service.InspectService
;
import
com.zjty.inspect.inspect.Inspector
;
import
com.zjty.inspect.service.ParameterService
;
import
com.zjty.inspect.utils.RandomUtil
;
import
freemarker.cache.StringTemplateLoader
;
import
freemarker.template.Configuration
;
import
freemarker.template.Template
;
...
...
@@ -27,6 +30,12 @@ public class InspectServiceImpl implements InspectService {
@Autowired
Inspector
inspector
;
@Autowired
private
ReportDao
reportDao
;
@Autowired
private
ParameterService
parameterService
;
@Transactional
@Override
public
ReportVo
inspect
(
ReportVo
reportVo
,
InspectParameter
inspectParameter
)
{
...
...
@@ -46,11 +55,10 @@ public class InspectServiceImpl implements InspectService {
inspector
.
setReport
(
reportVo
);
//需要重构
inspector
.
setSuffixLanguageMapping
(
suffixLanguageMapping
);
ReportVo
report
=
inspector
.
inspect
();
ReportVo
reportVoReturn
=
inspector
.
inspect
();
return
report
;
return
report
VoReturn
;
}
//执行静态化
...
...
src/main/java/com/zjty/inspect/service/impl/ReportServiceImpl.java
浏览文件 @
c54143e2
package
com
.
zjty
.
inspect
.
service
.
impl
;
import
com.zjty.inspect.dao.ReportDao
;
import
com.zjty.inspect.dao.TechnologyDao
;
import
com.zjty.inspect.entity.*
;
import
com.zjty.inspect.service.ParameterService
;
import
com.zjty.inspect.service.ReportService
;
import
com.zjty.inspect.utils.RedisUtil
;
import
freemarker.cache.StringTemplateLoader
;
import
freemarker.template.Configuration
;
import
freemarker.template.Template
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.ui.freemarker.FreeMarkerTemplateUtils
;
import
java.util.Map
;
import
java.util.Optional
;
/**
* @author Mcj
...
...
@@ -24,14 +27,12 @@ public class ReportServiceImpl implements ReportService {
@Autowired
private
TechnologyDao
technologyDao
;
@Autowired
private
RedisUtil
redisUtil
;
public
ReportVo
set
(
Report
report
){
@Autowired
private
ParameterService
parameterService
;
return
new
ReportVo
();
}
@Autowired
private
ReportDao
reportDao
;
//执行静态化
private
String
generateHtml
(
String
templateContent
,
Map
model
){
...
...
@@ -56,4 +57,31 @@ public class ReportServiceImpl implements ReportService {
}
@Override
public
Page
findReportByPage
(
int
page
)
{
PageRequest
of
=
PageRequest
.
of
(
page
-
1
,
10
);
org
.
springframework
.
data
.
domain
.
Page
<
Report
>
all
=
reportDao
.
findAll
(
of
);
Page
<
Report
>
reportPage
=
new
Page
<>();
reportPage
.
setTotalElement
((
int
)
all
.
getTotalElements
());
reportPage
.
setTotalPage
(
all
.
getTotalPages
());
reportPage
.
addAll
(
all
.
getContent
());
return
reportPage
;
}
@Override
public
ReportManage
findReportById
(
String
id
)
{
Optional
<
Report
>
report
=
reportDao
.
findById
(
id
);
ReportManage
reportManage
=
new
ReportManage
();
if
(
report
.
isPresent
()){
reportManage
.
setReport
(
report
.
get
());
InspectParameter
inspectParameter
=
parameterService
.
getParameterById
(
report
.
get
().
getId
());
reportManage
.
setInspectParameter
(
inspectParameter
);
}
return
reportManage
;
}
@Override
public
void
saveReport
(
Report
report
)
{
reportDao
.
save
(
report
);
}
}
src/main/java/com/zjty/inspect/utils/BudgetUitl.java
浏览文件 @
c54143e2
...
...
@@ -32,9 +32,10 @@ public class BudgetUitl {
public
BudgetVo
getBudget
(
Integer
fund
,
ReportVo
report
,
InspectParameter
inspectParameter
){
BudgetVo
budgetVo
=
new
BudgetVo
();
// TODO: 2020-03-05 查询年复利率
// TODO: 2020-03-05 查询年复利率
,查询修改,适配和重构占比
inspectParameter
.
setMoneyRate
(
1.04
);
//代码重构比
double
refactorProportion
=
0
D
;
//代码修改比
...
...
@@ -42,7 +43,6 @@ public class BudgetUitl {
if
(
report
.
getRecastMethod
()==
1
){
inspectParameter
.
setProportion
(
0.6
);
}
else
{
// TODO: 2020-03-05 查询config表0.3或者0.15
inspectParameter
.
setProportion
(
0.3
);
}
int
scale
;
...
...
@@ -72,6 +72,7 @@ public class BudgetUitl {
strings
.
add
(
"模块数"
);
strings
.
add
(
"数据库表"
);
strings
.
add
(
"代码量"
);
strings
.
add
(
"内容"
);
double
coefficient
=
1
;
List
<
CoefficientModel
>
nameIn
=
coefficientModelDao
.
findAllByNameIn
(
strings
);
List
<
CoefficientModel
>
collect
=
nameIn
.
stream
().
filter
(
a
->
a
.
getScale
()
==
scale
).
collect
(
Collectors
.
toList
());
...
...
@@ -111,6 +112,10 @@ public class BudgetUitl {
Double
value
=
model
.
countCoefficient
(
inspectParameter
.
getCodeSize
());
coefficientModelVo
.
setValue
(
value
);
coefficient
*=
value
;
}
else
if
(
"内容"
.
equals
(
model
.
getName
())){
Double
value
=
model
.
countCoefficient
(
inspectParameter
.
getContent
());
coefficientModelVo
.
setValue
(
value
);
coefficient
*=
value
;
}
budgetVo
.
getCoefficientModelVos
().
add
(
coefficientModelVo
);
}
...
...
src/main/java/com/zjty/inspect/utils/RandomUtil.java
0 → 100644
浏览文件 @
c54143e2
package
com
.
zjty
.
inspect
.
utils
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.Stack
;
/**
* @author Mcj
* @date 2020-03-05 19:20
*/
public
class
RandomUtil
{
public
synchronized
static
String
getRandom
()
{
String
digths
=
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
;
int
base
=
digths
.
length
();
long
now
=
System
.
currentTimeMillis
();
try
{
Thread
.
sleep
(
1
);}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();}
StringBuffer
str
=
new
StringBuffer
(
""
);
Stack
<
Character
>
s
=
new
Stack
<
Character
>();
while
(
now
!=
0
){
s
.
push
(
digths
.
charAt
((
int
)(
now
%
base
)));
now
/=
base
;
}
while
(!
s
.
isEmpty
()){
str
.
append
(
s
.
pop
());
}
StringBuilder
stringBuilder
=
new
StringBuilder
();
LocalDateTime
date
=
LocalDateTime
.
now
();
String
[]
split
=
UUIDUtil
.
getUUID
().
split
(
"-"
);
stringBuilder
.
append
(
date
.
getYear
())
.
append
(
date
.
getMonth
())
.
append
(
date
.
getDayOfMonth
())
.
append
(
date
.
getHour
()
)
.
append
(
date
.
getMinute
())
.
append
(
date
.
getSecond
())
.
append
(
split
[
0
]);
return
stringBuilder
.
toString
();
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论