Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
fa165dab
Commit
fa165dab
authored
Aug 06, 2018
by
eddie.woo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge
parent
b182ecef
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
109 additions
and
150 deletions
+109
-150
generator.properties
atms-api/etc/generator/generator.properties
+1
-1
SwaggerConfig.java
atms-api/src/main/java/pwc/taxtech/atms/SwaggerConfig.java
+1
-1
AuthUserHelperImpl.java
...main/java/pwc/taxtech/atms/common/AuthUserHelperImpl.java
+3
-4
ServiceException.java
...c/main/java/pwc/taxtech/atms/common/ServiceException.java
+22
-0
BeanUtil.java
.../src/main/java/pwc/taxtech/atms/common/util/BeanUtil.java
+30
-12
JettyLauncher.java
atms-api/src/test/java/pwc/taxtech/atms/JettyLauncher.java
+32
-32
JwtGneratorTest.java
.../test/java/pwc/taxtech/atms/security/JwtGneratorTest.java
+0
-5
InvoiceManageServiceImplTest.java
...xtech/atms/service/impl/InvoiceManageServiceImplTest.java
+0
-83
framework.js
atms-web/src/main/webapp/bundles/framework.js
+20
-12
yarn.lock
atms-web/src/main/webapp/yarn.lock
+0
-0
No files found.
atms-api/etc/generator/generator.properties
View file @
fa165dab
jdbc.driverClass
=
com.mysql.jdbc.Driver
jdbc.connectionURL
=
jdbc:mysql://10.157.107.89:3306/tax_
longi
?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
jdbc.connectionURL
=
jdbc:mysql://10.157.107.89:3306/tax_
admin
?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
jdbc.userId
=
root
jdbc.password
=
tax@Admin2018
atms-api/src/main/java/pwc/taxtech/atms/SwaggerConfig.java
View file @
fa165dab
...
...
@@ -25,7 +25,7 @@ public class SwaggerConfig {
@Bean
public
Docket
petApi
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
).
apiInfo
(
apiInfo
()).
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"pwc.taxtech.atms.controller
.*
"
))
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"pwc.taxtech.atms.controller"
))
.
paths
(
PathSelectors
.
regex
(
"/api/.*"
)).
build
()
.
globalOperationParameters
(
buildGlobalOperationParameters
());
...
...
atms-api/src/main/java/pwc/taxtech/atms/common/AuthUserHelperImpl.java
View file @
fa165dab
package
pwc
.
taxtech
.
atms
.
common
;
import
javax.servlet.http.HttpServletRequest
;
import
org.nutz.lang.Lang
;
import
org.nutz.lang.Strings
;
import
org.slf4j.Logger
;
...
...
@@ -14,11 +12,12 @@ import org.springframework.security.core.context.SecurityContextHolder;
import
org.springframework.security.web.authentication.WebAuthenticationDetails
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
import
pwc.taxtech.atms.dao.UserMapper
;
import
pwc.taxtech.atms.e
ntitiy.User
;
import
pwc.taxtech.atms.e
xception.ApplicationException
;
import
pwc.taxtech.atms.security.JwtUser
;
import
javax.servlet.http.HttpServletRequest
;
@Component
public
class
AuthUserHelperImpl
implements
AuditorAware
<
String
>,
AuthUserHelper
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
AuthUserHelperImpl
.
class
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/common/ServiceException.java
0 → 100644
View file @
fa165dab
package
pwc
.
taxtech
.
atms
.
common
;
public
class
ServiceException
extends
RuntimeException
{
public
ServiceException
()
{
}
public
ServiceException
(
String
message
)
{
super
(
message
);
}
public
ServiceException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
ServiceException
(
Throwable
cause
)
{
super
(
cause
);
}
public
ServiceException
(
String
message
,
Throwable
cause
,
boolean
enableSuppression
,
boolean
writableStackTrace
)
{
super
(
message
,
cause
,
enableSuppression
,
writableStackTrace
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/common/util/BeanUtil.java
View file @
fa165dab
package
pwc
.
taxtech
.
atms
.
common
.
util
;
import
com.esotericsoftware.reflectasm.FieldAccess
;
import
com.esotericsoftware.reflectasm.MethodAccess
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Component
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
java.util.ArrayList
;
import
java.util.List
;
@Component
public
class
BeanUtil
{
...
...
@@ -29,22 +32,23 @@ public class BeanUtil {
}
MethodAccess
targetMa
=
getMethodAccess
(
targetObject
.
getClass
());
FieldAccess
targetFa
=
getFieldAccess
(
targetObject
.
getClass
());
Field
[]
targetFields
=
targetFa
.
getFields
();
List
<
Field
>
targetFieldList
=
getFieldList
(
targetObject
.
getClass
());
MethodAccess
sourceMa
=
getMethodAccess
(
sourceObject
.
getClass
());
FieldAccess
sourceFa
=
getFieldAccess
(
sourceObject
.
getClass
());
for
(
Field
field
:
targetField
s
)
{
List
<
Field
>
sourceFieldList
=
getFieldList
(
sourceObject
.
getClass
());
for
(
Field
field
:
targetField
List
)
{
String
name
=
field
.
getName
();
try
{
sourceFa
.
getIndex
(
name
);
}
catch
(
Exception
e
)
{
if
(
sourceFieldList
.
stream
().
noneMatch
(
x
->
StringUtils
.
equals
(
x
.
getName
(),
name
)))
{
//不包含此属性 跳过
continue
;
}
String
upperName
=
upperCaseFirstChar
(
name
);
targetMa
.
invoke
(
targetObject
,
PREFIX_SET
+
upperName
,
sourceMa
.
invoke
(
sourceObject
,
PREFIX_GET
+
upperName
));
try
{
targetMa
.
invoke
(
targetObject
,
PREFIX_SET
+
upperName
,
sourceMa
.
invoke
(
sourceObject
,
PREFIX_GET
+
upperName
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
return
targetObject
;
}
...
...
@@ -55,8 +59,22 @@ public class BeanUtil {
}
@Cacheable
(
value
=
"reflectCache"
,
key
=
"'fa_' + #className.getName()"
)
public
FieldAccess
getFieldAccess
(
Class
className
)
{
return
FieldAccess
.
get
(
className
);
public
List
<
Field
>
getFieldList
(
Class
className
)
{
List
<
Field
>
fields
=
new
ArrayList
<>();
Class
nextClass
=
className
;
while
(
nextClass
!=
Object
.
class
)
{
Field
[]
declaredFields
=
nextClass
.
getDeclaredFields
();
for
(
int
i
=
0
,
n
=
declaredFields
.
length
;
i
<
n
;
i
++)
{
Field
field
=
declaredFields
[
i
];
// 反射所有
int
modifiers
=
field
.
getModifiers
();
if
(
Modifier
.
isStatic
(
modifiers
))
continue
;
// if (Modifier.isPrivate(modifiers)) continue;
fields
.
add
(
field
);
}
nextClass
=
nextClass
.
getSuperclass
();
}
return
fields
;
}
...
...
atms-api/src/test/java/pwc/taxtech/atms/JettyLauncher.java
View file @
fa165dab
package
pwc
.
taxtech
.
atms
;
import
org.eclipse.jetty.server.Server
;
import
org.eclipse.jetty.webapp.WebAppContext
;
import
org.eclipse.jetty.websocket.jsr356.server.ServerContainer
;
import
org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer
;
//
import org.eclipse.jetty.server.Server;
//
import org.eclipse.jetty.webapp.WebAppContext;
//
import org.eclipse.jetty.websocket.jsr356.server.ServerContainer;
//
import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer;
public
class
JettyLauncher
{
public
static
void
main
(
String
[]
args
)
{
int
port
=
8180
;
Server
server
=
new
Server
(
port
);
WebAppContext
webAppContext
=
new
WebAppContext
(
"webapp"
,
"/"
);
webAppContext
.
setDescriptor
(
"webapp/WEB-INF/web.xml"
);
webAppContext
.
setResourceBase
(
"src/main/webapp"
);
webAppContext
.
setDisplayName
(
"atms-api"
);
webAppContext
.
setClassLoader
(
Thread
.
currentThread
().
getContextClassLoader
());
webAppContext
.
setConfigurationDiscovered
(
true
);
webAppContext
.
setParentLoaderPriority
(
true
);
server
.
setHandler
(
webAppContext
);
System
.
out
.
println
(
webAppContext
.
getContextPath
());
System
.
out
.
println
(
webAppContext
.
getDescriptor
());
System
.
out
.
println
(
webAppContext
.
getResourceBase
());
System
.
out
.
println
(
webAppContext
.
getBaseResource
());
try
{
ServerContainer
wscontainer
=
WebSocketServerContainerInitializer
.
configureContext
(
webAppContext
);
// Add WebSocket endpoint to javax.websocket layer
// wscontainer.addEndpoint(MyWebSocket.class); //这行是如果需要使用websocket就加上,不需要就注释掉这行,mywebsocket是自己写的websocket服务类
server
.
start
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
System
.
out
.
println
(
"server is start, port is "
+
port
+
"............"
);
//
int port = 8180;
//
Server server = new Server(port);
//
WebAppContext webAppContext = new WebAppContext("webapp", "/");
//
//
webAppContext.setDescriptor("webapp/WEB-INF/web.xml");
//
webAppContext.setResourceBase("src/main/webapp");
//
webAppContext.setDisplayName("atms-api");
//
webAppContext.setClassLoader(Thread.currentThread().getContextClassLoader());
//
webAppContext.setConfigurationDiscovered(true);
//
webAppContext.setParentLoaderPriority(true);
//
//
//
server.setHandler(webAppContext);
//
System.out.println(webAppContext.getContextPath());
//
System.out.println(webAppContext.getDescriptor());
//
System.out.println(webAppContext.getResourceBase());
//
System.out.println(webAppContext.getBaseResource());
//
//
try {
//
ServerContainer wscontainer = WebSocketServerContainerInitializer.configureContext(webAppContext);
//
// Add WebSocket endpoint to javax.websocket layer
//
//
wscontainer.addEndpoint(MyWebSocket.class); //这行是如果需要使用websocket就加上,不需要就注释掉这行,mywebsocket是自己写的websocket服务类
//
//
server.start();
//
} catch (Exception e) {
//
e.printStackTrace();
//
}
//
System.out.println("server is start, port is " + port + "............");
}
}
atms-api/src/test/java/pwc/taxtech/atms/security/JwtGneratorTest.java
View file @
fa165dab
package
pwc
.
taxtech
.
atms
.
security
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
io.jsonwebtoken.JwtBuilder
;
import
io.jsonwebtoken.Jwts
;
import
io.jsonwebtoken.SignatureAlgorithm
;
import
org.junit.Test
;
import
org.nutz.lang.Times
;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.dto.vendor.LgItemDto
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
public
class
JwtGneratorTest
{
public
static
void
main
(
String
[]
args
)
{
...
...
atms-api/src/test/java/pwc/taxtech/atms/service/impl/InvoiceManageServiceImplTest.java
deleted
100644 → 0
View file @
b182ecef
package
pwc
.
taxtech
.
atms
.
service
.
impl
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
org.junit.Test
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.text.ParseException
;
import
pwc.taxtech.atms.CommonIT
;
import
pwc.taxtech.atms.constant.enums.EnumInputInvoiceType
;
import
pwc.taxtech.atms.constant.enums.EnumTbImportType
;
import
pwc.taxtech.atms.dto.input.InputInvoiceQueryDto
;
import
pwc.taxtech.atms.service.InvoiceManageService
;
public
class
InvoiceManageServiceImplTest
extends
CommonIT
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
InvoiceManageServiceImplTest
.
class
);
@Autowired
private
InvoiceManageService
invoiceManageService
;
@Test
public
void
testGetInputInvoiceList
()
{
InputInvoiceQueryDto
inputInvoiceQueryDto
=
new
InputInvoiceQueryDto
();
//inputInvoiceQueryDto.setBuyerBankName("aa");
//inputInvoiceQueryDto.setAmount(amount);
// inputInvoiceQueryDto.setInvoiceDate(new Date());
// inputInvoiceQueryDto.setInvoiceEntityType(1);
// inputInvoiceQueryDto.setInvoiceNumber("11");
// inputInvoiceQueryDto.setInvoiceSourceType(1);
// inputInvoiceQueryDto.setInvoiceType(1);
// inputInvoiceQueryDto.setSellerName("bb");
// inputInvoiceQueryDto.setSerialNo("sdada");
// inputInvoiceQueryDto.setStaffId("12231");
// inputInvoiceQueryDto.setStatus(1);
// inputInvoiceQueryDto.setUploadDate(new Date());
// inputInvoiceQueryDto.setUploadType(1);
// inputInvoiceQueryDto.setAmount(new BigDecimal(10));
// CamelPagingDto camelPagingDto=new CamelPagingDto();
// camelPagingDto.setPageIndex(1);
// camelPagingDto.setPageSize(10);
// inputInvoiceQueryDto.setPagingDto(camelPagingDto);
// List<InputInvoice> list=new InvoiceManageServiceImpl().getInputInvoiceList(inputInvoiceQueryDto);
}
public
static
Date
StrToDate
(
String
str
)
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
date
=
null
;
try
{
date
=
format
.
parse
(
str
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
date
;
}
public
static
void
main
(
String
[]
args
)
throws
ParseException
{
Date
date
=
new
SimpleDateFormat
(
"yyyy/MM/dd"
).
parse
(
"2018/06/04"
);
System
.
out
.
println
(
date
);
//System.out.println(StrToDate("2018/06/04"));
for
(
EnumTbImportType
e
:
EnumTbImportType
.
values
())
{
System
.
out
.
println
(
e
.
name
()+
":"
+
e
.
getCode
());
}
for
(
EnumInputInvoiceType
e
:
EnumInputInvoiceType
.
values
())
{
System
.
out
.
println
(
e
.
name
()+
":"
+
e
.
getCode
()+
":"
+
e
.
getName
());
}
}
}
atms-web/src/main/webapp/bundles/framework.js
View file @
fa165dab
...
...
@@ -4346,8 +4346,8 @@ PWC.Loader = function () {
/// <reference path="../../app.js" />
// apiInterceptor is responsible to handle the aspect of each request and response.
webservices
.
factory
(
'apiInterceptor'
,
[
'$q'
,
'loginContext'
,
'$log'
,
'$window'
,
'$injector'
,
function
(
$q
,
loginContext
,
$log
,
$window
,
$injector
)
{
webservices
.
factory
(
'apiInterceptor'
,
[
'$q'
,
'loginContext'
,
'$log'
,
'$window'
,
'$injector'
,
'$cookies'
,
function
(
$q
,
loginContext
,
$log
,
$window
,
$injector
,
$cookies
)
{
'use strict'
;
$log
.
debug
(
'apiInterceptor.ctor()...'
);
...
...
@@ -4363,7 +4363,9 @@ webservices.factory('apiInterceptor', ['$q', 'loginContext', '$log', '$window',
return
{
//token save to services for further usage
tokenType
:
tokenType
,
apiToken
:
apiToken
,
apiToken
:
function
()
{
return
apiToken
;
},
webApiHostUrl
:
webApiHostUrl
,
//for vat api
vatWebApiHostUrl
:
vatWebApiHostUrl
,
...
...
@@ -4385,14 +4387,15 @@ webservices.factory('apiInterceptor', ['$q', 'loginContext', '$log', '$window',
}
config
.
withCredentials
=
true
;
//废弃 token有效期会自动判断
// before each api call, try to ensure user account has not been expired
// otherwise, force user to login again
var
$http
=
$injector
.
get
(
'$http'
);
$http
.
get
(
loginContext
.
serverUrl
+
'/Account/CheckLoginStatus?_='
+
(
new
Date
).
valueOf
(),
{
isBusyRequest
:
tru
e
}).
success
(
function
(
data
)
{
if
(
data
===
false
)
{
redirectToLogOut
();
}
});
//
var $http = $injector.get('$http');
// $http.get(loginContext.serverUrl + '/Account/CheckLoginStatus?_=' + (new Date).valueOf(), { isBusyRequest: fals
e }).success(function (data) {
//
if (data === false) {
//
redirectToLogOut();
//
}
//
});
}
return
config
;
...
...
@@ -4409,6 +4412,11 @@ webservices.factory('apiInterceptor', ['$q', 'loginContext', '$log', '$window',
if
(
response
.
status
===
401
)
{
redirectToLogOut
();
}
var
tmpToken
=
response
.
headers
(
'refreshToken'
);
if
(
!!
tmpToken
)
{
apiToken
=
tmpToken
;
$log
.
info
(
'refresh token: '
+
apiToken
);
}
return
response
||
$q
.
when
(
response
);
},
// On response failture
...
...
@@ -4513,12 +4521,12 @@ webservices.factory('apiConfig', ['$log', 'vatSessionService',
}
cfg
.
isWebApiRequest
=
true
;
if
(
config
&&
config
.
dbName
)
{
//TODO:from is not allowed ,future should open (neo)
cfg
.
headers
=
{
'from'
:
config
.
dbName
+
'@cn.pwc.com'
};
if
(
config
&&
config
.
dbName
)
{
cfg
.
headers
=
{
'from'
:
config
.
dbName
+
'@cn.pwc.com'
};
}
else
{
if
(
vatSessionService
.
project
&&
vatSessionService
.
project
.
dbName
)
{
cfg
.
headers
=
{
'from'
:
vatSessionService
.
project
.
dbName
+
'@cn.pwc.com'
};
cfg
.
headers
=
{
'from'
:
vatSessionService
.
project
.
dbName
+
'@cn.pwc.com'
};
}
}
return
cfg
;
...
...
atms-web/src/main/webapp/yarn.lock
0 → 100644
View file @
fa165dab
This diff is collapsed.
Click to expand it.
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