Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
customer-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SuperHive
back-end
customer-service
Commits
f846009e
Commit
f846009e
authored
Apr 17, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建货主功能模块目录
parent
e973d377
Changes
68
Show whitespace changes
Inline
Side-by-side
Showing
68 changed files
with
1908 additions
and
35 deletions
+1908
-35
pom.xml
pom.xml
+9
-0
CustomerApplication.java
...in/java/com/esv/freight/customer/CustomerApplication.java
+1
-1
DbDeletedEnum.java
...ava/com/esv/freight/customer/common/em/DbDeletedEnum.java
+1
-1
EException.java
...com/esv/freight/customer/common/exception/EException.java
+1
-1
LogbackFilter.java
...com/esv/freight/customer/common/filter/LogbackFilter.java
+2
-2
RestLogFilter.java
...com/esv/freight/customer/common/filter/RestLogFilter.java
+3
-3
RestExceptionHandler.java
...freight/customer/common/handler/RestExceptionHandler.java
+4
-4
ECode.java
.../java/com/esv/freight/customer/common/response/ECode.java
+1
-1
EResponse.java
...a/com/esv/freight/customer/common/response/EResponse.java
+1
-1
AESSecretUtils.java
.../com/esv/freight/customer/common/util/AESSecretUtils.java
+1
-1
DateUtils.java
.../java/com/esv/freight/customer/common/util/DateUtils.java
+1
-1
FeignUtils.java
...java/com/esv/freight/customer/common/util/FeignUtils.java
+36
-0
ReqUtils.java
...n/java/com/esv/freight/customer/common/util/ReqUtils.java
+20
-1
ValidatorDelete.java
...ght/customer/common/validator/groups/ValidatorDelete.java
+1
-1
ValidatorDetail.java
...ght/customer/common/validator/groups/ValidatorDetail.java
+1
-1
ValidatorInsert.java
...ght/customer/common/validator/groups/ValidatorInsert.java
+1
-1
ValidatorList.java
...eight/customer/common/validator/groups/ValidatorList.java
+1
-1
ValidatorUpdate.java
...ght/customer/common/validator/groups/ValidatorUpdate.java
+1
-1
PageResultVO.java
...java/com/esv/freight/customer/common/vo/PageResultVO.java
+1
-1
RestRequestWrapper.java
...v/freight/customer/common/wrapper/RestRequestWrapper.java
+1
-1
RestResponseWrapper.java
.../freight/customer/common/wrapper/RestResponseWrapper.java
+1
-1
FeignConfigure.java
.../java/com/esv/freight/customer/config/FeignConfigure.java
+40
-0
JacksonConfig.java
...n/java/com/esv/freight/customer/config/JacksonConfig.java
+1
-1
LogFilterConfig.java
...java/com/esv/freight/customer/config/LogFilterConfig.java
+3
-3
DataPermHandler.java
.../esv/freight/customer/config/mybatis/DataPermHandler.java
+107
-0
DataPermParser.java
...m/esv/freight/customer/config/mybatis/DataPermParser.java
+133
-0
EsvMetaObjectHandler.java
...freight/customer/config/mybatis/EsvMetaObjectHandler.java
+54
-0
MybatisPlusConfig.java
...sv/freight/customer/config/mybatis/MybatisPlusConfig.java
+45
-0
FeignBaseService.java
...java/com/esv/freight/customer/feign/FeignBaseService.java
+21
-0
GoodsOwnerConstants.java
...eight/customer/module/goodsowner/GoodsOwnerConstants.java
+20
-0
GoodsOwnerController.java
...er/module/goodsowner/controller/GoodsOwnerController.java
+66
-0
AccountDao.java
...sv/freight/customer/module/goodsowner/dao/AccountDao.java
+17
-0
AuditHistoryDao.java
...eight/customer/module/goodsowner/dao/AuditHistoryDao.java
+17
-0
DeliveryAddressDao.java
...ht/customer/module/goodsowner/dao/DeliveryAddressDao.java
+17
-0
InfoDao.java
...m/esv/freight/customer/module/goodsowner/dao/InfoDao.java
+17
-0
ReceiveAddressDao.java
...ght/customer/module/goodsowner/dao/ReceiveAddressDao.java
+17
-0
RegularlyRouteDao.java
...ght/customer/module/goodsowner/dao/RegularlyRouteDao.java
+17
-0
AccountEntity.java
...ight/customer/module/goodsowner/entity/AccountEntity.java
+93
-0
AuditHistoryEntity.java
...customer/module/goodsowner/entity/AuditHistoryEntity.java
+48
-0
DeliveryAddressEntity.java
...tomer/module/goodsowner/entity/DeliveryAddressEntity.java
+105
-0
InfoEntity.java
...freight/customer/module/goodsowner/entity/InfoEntity.java
+108
-0
ReceiveAddressEntity.java
...stomer/module/goodsowner/entity/ReceiveAddressEntity.java
+105
-0
RegularlyRouteEntity.java
...stomer/module/goodsowner/entity/RegularlyRouteEntity.java
+72
-0
AccountInfoForm.java
...ight/customer/module/goodsowner/form/AccountInfoForm.java
+145
-0
AccountService.java
...ht/customer/module/goodsowner/service/AccountService.java
+37
-0
AuditHistoryService.java
...stomer/module/goodsowner/service/AuditHistoryService.java
+16
-0
DeliveryAddressService.java
...mer/module/goodsowner/service/DeliveryAddressService.java
+16
-0
InfoService.java
...eight/customer/module/goodsowner/service/InfoService.java
+16
-0
ReceiveAddressService.java
...omer/module/goodsowner/service/ReceiveAddressService.java
+16
-0
RegularlyRouteService.java
...omer/module/goodsowner/service/RegularlyRouteService.java
+16
-0
AccountServiceImpl.java
...er/module/goodsowner/service/impl/AccountServiceImpl.java
+72
-0
AuditHistoryServiceImpl.java
...dule/goodsowner/service/impl/AuditHistoryServiceImpl.java
+13
-0
DeliveryAddressServiceImpl.java
...e/goodsowner/service/impl/DeliveryAddressServiceImpl.java
+13
-0
InfoServiceImpl.java
...tomer/module/goodsowner/service/impl/InfoServiceImpl.java
+13
-0
ReceiveAddressServiceImpl.java
...le/goodsowner/service/impl/ReceiveAddressServiceImpl.java
+13
-0
RegularlyRouteServiceImpl.java
...le/goodsowner/service/impl/RegularlyRouteServiceImpl.java
+13
-0
TestController.java
...eight/customer/module/test/controller/TestController.java
+2
-2
application-dev.yml
src/main/resources/application-dev.yml
+5
-1
application-test.yml
src/main/resources/application-test.yml
+4
-0
bootstrap.yml
src/main/resources/bootstrap.yml
+2
-2
AccountDao.xml
src/main/resources/mapper/goodsowner/AccountDao.xml
+26
-0
AuditHistoryDao.xml
src/main/resources/mapper/goodsowner/AuditHistoryDao.xml
+17
-0
DeliveryAddressDao.xml
src/main/resources/mapper/goodsowner/DeliveryAddressDao.xml
+30
-0
InfoDao.xml
src/main/resources/mapper/goodsowner/InfoDao.xml
+32
-0
ReceiveAddressDao.xml
src/main/resources/mapper/goodsowner/ReceiveAddressDao.xml
+30
-0
RegularlyRouteDao.xml
src/main/resources/mapper/goodsowner/RegularlyRouteDao.xml
+22
-0
BaseTestController.java
...est/java/com/esv/freight/customer/BaseTestController.java
+15
-1
GoodsOwnerControllerTest.java
...odule/goodsowner/controller/GoodsOwnerControllerTest.java
+112
-0
No files found.
pom.xml
View file @
f846009e
...
...
@@ -65,6 +65,10 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-openfeign
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
...
...
@@ -102,6 +106,11 @@
<artifactId>
druid-spring-boot-starter
</artifactId>
<version>
${alibaba-druid.version}
</version>
</dependency>
<dependency>
<groupId>
com.esv.platform
</groupId>
<artifactId>
gateway-common
</artifactId>
<version>
1.0.0-SNAPSHOT
</version>
</dependency>
</dependencies>
<dependencyManagement>
...
...
src/main/java/com/esv/freight/
notice
/CustomerApplication.java
→
src/main/java/com/esv/freight/
customer
/CustomerApplication.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
;
package
com
.
esv
.
freight
.
customer
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
...
...
src/main/java/com/esv/freight/
notice
/common/em/DbDeletedEnum.java
→
src/main/java/com/esv/freight/
customer
/common/em/DbDeletedEnum.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
em
;
package
com
.
esv
.
freight
.
customer
.
common
.
em
;
/**
* @description: DB记录是否删除标识
...
...
src/main/java/com/esv/freight/
notice
/common/exception/EException.java
→
src/main/java/com/esv/freight/
customer
/common/exception/EException.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
exception
;
package
com
.
esv
.
freight
.
customer
.
common
.
exception
;
/**
* @description: 自定义业务异常
...
...
src/main/java/com/esv/freight/
notice
/common/filter/LogbackFilter.java
→
src/main/java/com/esv/freight/
customer
/common/filter/LogbackFilter.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
filter
;
package
com
.
esv
.
freight
.
customer
.
common
.
filter
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -30,7 +30,7 @@ public class LogbackFilter implements Filter {
public
void
doFilter
(
ServletRequest
servletRequest
,
ServletResponse
servletResponse
,
FilterChain
filterChain
)
throws
IOException
,
ServletException
{
// 获取来自上游服务的传参traceId
HttpServletRequest
httpServletRequest
=
(
HttpServletRequest
)
servletRequest
;
String
traceId
=
httpServletRequest
.
getHeader
(
"
trace_
id"
);
String
traceId
=
httpServletRequest
.
getHeader
(
"
gateway_trace
id"
);
boolean
bInsertMDC
=
setMDC
(
traceId
);
try
{
filterChain
.
doFilter
(
servletRequest
,
servletResponse
);
...
...
src/main/java/com/esv/freight/
notice
/common/filter/RestLogFilter.java
→
src/main/java/com/esv/freight/
customer
/common/filter/RestLogFilter.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
filter
;
package
com
.
esv
.
freight
.
customer
.
common
.
filter
;
import
com.esv.freight.
notice
.common.wrapper.RestRequestWrapper
;
import
com.esv.freight.
notice
.common.wrapper.RestResponseWrapper
;
import
com.esv.freight.
customer
.common.wrapper.RestRequestWrapper
;
import
com.esv.freight.
customer
.common.wrapper.RestResponseWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
...
...
src/main/java/com/esv/freight/
notice
/common/handler/RestExceptionHandler.java
→
src/main/java/com/esv/freight/
customer
/common/handler/RestExceptionHandler.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
handler
;
package
com
.
esv
.
freight
.
customer
.
common
.
handler
;
import
com.esv.freight.
notice
.common.exception.EException
;
import
com.esv.freight.
notice
.common.response.ECode
;
import
com.esv.freight.
notice
.common.response.EResponse
;
import
com.esv.freight.
customer
.common.exception.EException
;
import
com.esv.freight.
customer
.common.response.ECode
;
import
com.esv.freight.
customer
.common.response.EResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.context.support.DefaultMessageSourceResolvable
;
import
org.springframework.http.converter.HttpMessageNotReadableException
;
...
...
src/main/java/com/esv/freight/
notice
/common/response/ECode.java
→
src/main/java/com/esv/freight/
customer
/common/response/ECode.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
response
;
package
com
.
esv
.
freight
.
customer
.
common
.
response
;
/**
* @description: 系统响应码
...
...
src/main/java/com/esv/freight/
notice
/common/response/EResponse.java
→
src/main/java/com/esv/freight/
customer
/common/response/EResponse.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
response
;
package
com
.
esv
.
freight
.
customer
.
common
.
response
;
import
java.io.Serializable
;
...
...
src/main/java/com/esv/freight/
notice
/common/util/AESSecretUtils.java
→
src/main/java/com/esv/freight/
customer
/common/util/AESSecretUtils.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
util
;
package
com
.
esv
.
freight
.
customer
.
common
.
util
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.ArrayUtils
;
...
...
src/main/java/com/esv/freight/
notice
/common/util/DateUtils.java
→
src/main/java/com/esv/freight/
customer
/common/util/DateUtils.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
util
;
package
com
.
esv
.
freight
.
customer
.
common
.
util
;
import
org.apache.commons.lang3.StringUtils
;
import
org.joda.time.DateTime
;
...
...
src/main/java/com/esv/freight/customer/common/util/FeignUtils.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
common
.
util
;
import
com.alibaba.fastjson.JSONObject
;
import
com.esv.freight.customer.common.exception.EException
;
import
com.esv.freight.customer.common.response.ECode
;
import
lombok.extern.slf4j.Slf4j
;
/**
* @description: Feign工具类
* @project: freight-customer-service
* @name: com.esv.freight.customer.common.util.FeignUtils
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/17 18:05
* @version:1.0
*/
@Slf4j
public
class
FeignUtils
{
/**
* description 获取Feign调用结果数据
* param [resultJson]
* return com.alibaba.fastjson.JSONObject
* author Administrator
* createTime 2020/04/17 18:12
**/
public
static
JSONObject
getFeignResultData
(
JSONObject
resultJson
)
throws
EException
{
log
.
info
(
resultJson
.
toJSONString
());
if
(
ECode
.
SUCCESS
.
code
()
!=
resultJson
.
getIntValue
(
"code"
))
{
throw
new
EException
(
resultJson
.
getIntValue
(
"code"
),
resultJson
.
getString
(
"message"
));
}
else
{
return
resultJson
.
getJSONObject
(
"data"
);
}
}
}
src/main/java/com/esv/freight/
notice
/common/util/ReqUtils.java
→
src/main/java/com/esv/freight/
customer
/common/util/ReqUtils.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
util
;
package
com
.
esv
.
freight
.
customer
.
common
.
util
;
import
com.alibaba.fastjson.JSONObject
;
import
com.esv.freight.customer.common.exception.EException
;
import
com.esv.freight.customer.common.response.ECode
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
...
...
@@ -39,4 +43,19 @@ public class ReqUtils {
return
ip
;
}
/**
* description 校验参数不能为空:key存在、value存在且不为空字符串
* param [reqJson, params]
* return void
* author Administrator
* createTime 2020/04/17 17:23
**/
public
static
void
checkParamsNotBlank
(
JSONObject
reqJson
,
String
[]
params
)
throws
EException
{
for
(
int
i
=
0
;
i
<
params
.
length
;
i
++)
{
if
(
StringUtils
.
isBlank
(
reqJson
.
getString
(
params
[
i
])))
{
throw
new
EException
(
ECode
.
PARAM_ERROR
.
code
(),
"参数"
+
params
[
i
]+
"不能为空"
);
}
}
}
}
src/main/java/com/esv/freight/
notice
/common/validator/groups/ValidatorDelete.java
→
src/main/java/com/esv/freight/
customer
/common/validator/groups/ValidatorDelete.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
validator
.
groups
;
package
com
.
esv
.
freight
.
customer
.
common
.
validator
.
groups
;
import
javax.validation.groups.Default
;
...
...
src/main/java/com/esv/freight/
notice
/common/validator/groups/ValidatorDetail.java
→
src/main/java/com/esv/freight/
customer
/common/validator/groups/ValidatorDetail.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
validator
.
groups
;
package
com
.
esv
.
freight
.
customer
.
common
.
validator
.
groups
;
import
javax.validation.groups.Default
;
...
...
src/main/java/com/esv/freight/
notice
/common/validator/groups/ValidatorInsert.java
→
src/main/java/com/esv/freight/
customer
/common/validator/groups/ValidatorInsert.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
validator
.
groups
;
package
com
.
esv
.
freight
.
customer
.
common
.
validator
.
groups
;
import
javax.validation.groups.Default
;
...
...
src/main/java/com/esv/freight/
notice
/common/validator/groups/ValidatorList.java
→
src/main/java/com/esv/freight/
customer
/common/validator/groups/ValidatorList.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
validator
.
groups
;
package
com
.
esv
.
freight
.
customer
.
common
.
validator
.
groups
;
import
javax.validation.groups.Default
;
...
...
src/main/java/com/esv/freight/
notice
/common/validator/groups/ValidatorUpdate.java
→
src/main/java/com/esv/freight/
customer
/common/validator/groups/ValidatorUpdate.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
validator
.
groups
;
package
com
.
esv
.
freight
.
customer
.
common
.
validator
.
groups
;
import
javax.validation.groups.Default
;
...
...
src/main/java/com/esv/freight/
notice
/common/vo/PageResultVO.java
→
src/main/java/com/esv/freight/
customer
/common/vo/PageResultVO.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
vo
;
package
com
.
esv
.
freight
.
customer
.
common
.
vo
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
lombok.Data
;
...
...
src/main/java/com/esv/freight/
notice
/common/wrapper/RestRequestWrapper.java
→
src/main/java/com/esv/freight/
customer
/common/wrapper/RestRequestWrapper.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
wrapper
;
package
com
.
esv
.
freight
.
customer
.
common
.
wrapper
;
import
javax.servlet.ReadListener
;
import
javax.servlet.ServletInputStream
;
...
...
src/main/java/com/esv/freight/
notice
/common/wrapper/RestResponseWrapper.java
→
src/main/java/com/esv/freight/
customer
/common/wrapper/RestResponseWrapper.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
common
.
wrapper
;
package
com
.
esv
.
freight
.
customer
.
common
.
wrapper
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
...
...
src/main/java/com/esv/freight/customer/config/FeignConfigure.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
config
;
import
feign.RequestInterceptor
;
import
org.slf4j.MDC
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.client.RestTemplate
;
/**
* @description: Feign接口配置
* @project: freight-customer-service
* @name: com.esv.freight.customer.config.FeignConfigure
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/17 18:00
* @version:1.0
*/
@EnableFeignClients
(
basePackages
=
"com.esv.freight.customer.feign"
)
@Configuration
public
class
FeignConfigure
{
@Value
(
"${spring.application.name}"
)
private
String
applicationName
;
@Bean
public
RestTemplate
restTemplate
()
{
return
new
RestTemplate
();
}
@Bean
public
RequestInterceptor
requestInterceptor
()
{
RequestInterceptor
requestInterceptor
=
((
requestTemplate
->
{
requestTemplate
.
header
(
"trace_id"
,
MDC
.
get
(
"traceId"
));
requestTemplate
.
header
(
"application_name"
,
applicationName
);
}));
return
requestInterceptor
;
}
}
src/main/java/com/esv/freight/
notice
/config/JacksonConfig.java
→
src/main/java/com/esv/freight/
customer
/config/JacksonConfig.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
config
;
package
com
.
esv
.
freight
.
customer
.
config
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
...
...
src/main/java/com/esv/freight/
notice
/config/LogFilterConfig.java
→
src/main/java/com/esv/freight/
customer
/config/LogFilterConfig.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
config
;
package
com
.
esv
.
freight
.
customer
.
config
;
import
com.esv.freight.
notice
.common.filter.LogbackFilter
;
import
com.esv.freight.
notice
.common.filter.RestLogFilter
;
import
com.esv.freight.
customer
.common.filter.LogbackFilter
;
import
com.esv.freight.
customer
.common.filter.RestLogFilter
;
import
org.springframework.boot.web.servlet.FilterRegistrationBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
src/main/java/com/esv/freight/customer/config/mybatis/DataPermHandler.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
config
.
mybatis
;
import
com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler
;
import
com.esv.freight.customer.common.util.ReqUtils
;
import
com.esv.gateway.common.DataPermsType
;
import
com.esv.gateway.common.GatewayHeaders
;
import
net.sf.jsqlparser.expression.Expression
;
import
net.sf.jsqlparser.expression.LongValue
;
import
net.sf.jsqlparser.expression.operators.relational.ExpressionList
;
import
net.sf.jsqlparser.expression.operators.relational.InExpression
;
import
net.sf.jsqlparser.schema.Column
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* @description:
* @project: freight-notice-service
* @name: com.esv.freight.customer.config.mybatis.DataPermHandler
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/17 13:35
* @version:1.0
*/
public
class
DataPermHandler
implements
TenantHandler
{
/**
* 不需要数据权限查询的表
**/
private
final
List
<
String
>
filterTableNames
=
Arrays
.
asList
(
"goods_owner_info"
,
"goods_owner_audit_history"
,
"goods_owner_delivery_address"
,
"goods_owner_receive_address"
,
"goods_owner_regularly_route"
);
@Override
public
Expression
getTenantId
(
boolean
where
)
{
String
dataPerm
=
ReqUtils
.
getRequestHeader
(
GatewayHeaders
.
DATA_PERM
);
//这里只是演示切换单个tenantId和多个tenantId
final
boolean
multipleTenantIds
=
DataPermsType
.
DATA_PERM_DEPARTMENT
.
equals
(
dataPerm
);
//具体场景,可以根据情况来拼接
if
(
where
&&
multipleTenantIds
)
{
//演示如何实现tenant_id in (1,2)
return
multipleTenantIdCondition
();
}
else
{
return
singleTenantIdCondition
();
}
}
// 获取tenantId
private
Expression
singleTenantIdCondition
()
{
String
tenantId
=
ReqUtils
.
getRequestHeader
(
GatewayHeaders
.
TENANT_ID
);
return
new
LongValue
(
tenantId
);
}
// 获取departmentId
private
Expression
multipleTenantIdCondition
()
{
String
departmentChildren
=
ReqUtils
.
getRequestHeader
(
GatewayHeaders
.
DEPARTMENT_CHILDREN
);
final
InExpression
inExpression
=
new
InExpression
();
inExpression
.
setLeftExpression
(
new
Column
(
getTenantIdColumn
()));
final
ExpressionList
itemsList
=
new
ExpressionList
();
final
List
<
Expression
>
inValues
=
new
ArrayList
<>();
for
(
String
departmentId
:
departmentChildren
.
split
(
","
))
{
inValues
.
add
(
new
LongValue
(
departmentId
));
}
itemsList
.
setExpressions
(
inValues
);
inExpression
.
setRightItemsList
(
itemsList
);
return
inExpression
;
}
@Override
public
String
getTenantIdColumn
()
{
String
dataPerm
=
ReqUtils
.
getRequestHeader
(
GatewayHeaders
.
DATA_PERM
);
//这里只是演示切换单个tenantId和多个tenantId
final
boolean
multipleTenantIds
=
DataPermsType
.
DATA_PERM_DEPARTMENT
.
equals
(
dataPerm
);
if
(
multipleTenantIds
)
{
return
"department_id"
;
}
return
"tenant_id"
;
}
/**
* description 判断是否过滤表
* param [tableName]
* return boolean
* author chenfm
* createTime 2020/4/8 9:31
**/
@Override
public
boolean
doTableFilter
(
String
tableName
)
{
// 只有查询时添加条件
if
(
tableName
.
endsWith
(
"|select"
))
{
tableName
=
tableName
.
replace
(
"|select"
,
""
);
}
else
{
return
true
;
}
if
(
filterTableNames
.
contains
(
tableName
))
{
return
true
;
}
// 全局数据权限不加入条件
String
dataPerm
=
ReqUtils
.
getRequestHeader
(
GatewayHeaders
.
DATA_PERM
);
if
(
DataPermsType
.
DATA_PERM_ALL
.
equals
(
dataPerm
))
{
return
true
;
}
return
false
;
}
}
src/main/java/com/esv/freight/customer/config/mybatis/DataPermParser.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
config
.
mybatis
;
import
com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser
;
import
lombok.extern.slf4j.Slf4j
;
import
net.sf.jsqlparser.expression.BinaryExpression
;
import
net.sf.jsqlparser.expression.Expression
;
import
net.sf.jsqlparser.expression.Parenthesis
;
import
net.sf.jsqlparser.expression.operators.conditional.AndExpression
;
import
net.sf.jsqlparser.expression.operators.conditional.OrExpression
;
import
net.sf.jsqlparser.expression.operators.relational.*
;
import
net.sf.jsqlparser.schema.Column
;
import
net.sf.jsqlparser.schema.Table
;
import
net.sf.jsqlparser.statement.select.*
;
import
java.util.List
;
/**
* @description:
* @project: freight-notice-service
* @name: com.esv.freight.customer.config.mybatis.DataPermParser
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/17 13:34
* @version:1.0
*/
@Slf4j
public
class
DataPermParser
extends
TenantSqlParser
{
/**
* 目前仅支持:in, between, >, <, =, !=等比较操作,处理多租户的字段加上表别名
*
* @param expression
* @param table
* @return
*/
protected
Expression
processTableAlias
(
Expression
expression
,
Table
table
)
{
String
tableAliasName
;
if
(
table
.
getAlias
()
==
null
)
{
tableAliasName
=
table
.
getName
();
}
else
{
tableAliasName
=
table
.
getAlias
().
getName
();
}
if
(
expression
instanceof
InExpression
)
{
InExpression
in
=
(
InExpression
)
expression
;
if
(
in
.
getLeftExpression
()
instanceof
Column
)
{
setTableAliasNameForColumn
((
Column
)
in
.
getLeftExpression
(),
tableAliasName
);
}
}
else
if
(
expression
instanceof
BinaryExpression
)
{
BinaryExpression
compare
=
(
BinaryExpression
)
expression
;
if
(
compare
.
getLeftExpression
()
instanceof
Column
)
{
setTableAliasNameForColumn
((
Column
)
compare
.
getLeftExpression
(),
tableAliasName
);
}
else
if
(
compare
.
getRightExpression
()
instanceof
Column
)
{
setTableAliasNameForColumn
((
Column
)
compare
.
getRightExpression
(),
tableAliasName
);
}
}
else
if
(
expression
instanceof
Between
)
{
Between
between
=
(
Between
)
expression
;
if
(
between
.
getLeftExpression
()
instanceof
Column
)
{
setTableAliasNameForColumn
((
Column
)
between
.
getLeftExpression
(),
tableAliasName
);
}
}
return
expression
;
}
private
void
setTableAliasNameForColumn
(
Column
column
,
String
tableAliasName
)
{
column
.
setColumnName
(
tableAliasName
+
"."
+
column
.
getColumnName
());
}
/**
* 默认是按 tenant_id=1 按等于条件追加
*
* @param currentExpression 现有的条件:比如你原来的sql查询条件
* @param table
* @return
*/
@Override
protected
Expression
builderExpression
(
Expression
currentExpression
,
Table
table
)
{
final
Expression
tenantExpression
=
this
.
getTenantHandler
().
getTenantId
(
true
);
Expression
appendExpression
;
if
(!(
tenantExpression
instanceof
SupportsOldOracleJoinSyntax
))
{
appendExpression
=
new
EqualsTo
();
((
EqualsTo
)
appendExpression
).
setLeftExpression
(
this
.
getAliasColumn
(
table
));
((
EqualsTo
)
appendExpression
).
setRightExpression
(
tenantExpression
);
}
else
{
appendExpression
=
processTableAlias
(
tenantExpression
,
table
);
}
if
(
currentExpression
==
null
)
{
return
appendExpression
;
}
if
(
currentExpression
instanceof
BinaryExpression
)
{
BinaryExpression
binaryExpression
=
(
BinaryExpression
)
currentExpression
;
if
(
binaryExpression
.
getLeftExpression
()
instanceof
FromItem
)
{
processFromItem
((
FromItem
)
binaryExpression
.
getLeftExpression
());
}
if
(
binaryExpression
.
getRightExpression
()
instanceof
FromItem
)
{
processFromItem
((
FromItem
)
binaryExpression
.
getRightExpression
());
}
}
else
if
(
currentExpression
instanceof
InExpression
)
{
InExpression
inExp
=
(
InExpression
)
currentExpression
;
ItemsList
rightItems
=
inExp
.
getRightItemsList
();
if
(
rightItems
instanceof
SubSelect
)
{
processSelectBody
(((
SubSelect
)
rightItems
).
getSelectBody
());
}
}
if
(
currentExpression
instanceof
OrExpression
)
{
return
new
AndExpression
(
new
Parenthesis
(
currentExpression
),
appendExpression
);
}
else
{
return
new
AndExpression
(
currentExpression
,
appendExpression
);
}
}
@Override
protected
void
processPlainSelect
(
PlainSelect
plainSelect
,
boolean
addColumn
)
{
FromItem
fromItem
=
plainSelect
.
getFromItem
();
if
(
fromItem
instanceof
Table
)
{
Table
fromTable
=
(
Table
)
fromItem
;
if
(!
this
.
getTenantHandler
().
doTableFilter
(
fromTable
.
getName
()
+
"|select"
))
{
plainSelect
.
setWhere
(
builderExpression
(
plainSelect
.
getWhere
(),
fromTable
));
if
(
addColumn
)
{
plainSelect
.
getSelectItems
().
add
(
new
SelectExpressionItem
(
new
Column
(
this
.
getTenantHandler
().
getTenantIdColumn
())));
}
}
}
else
{
processFromItem
(
fromItem
);
}
List
<
Join
>
joins
=
plainSelect
.
getJoins
();
if
(
joins
!=
null
&&
joins
.
size
()
>
0
)
{
joins
.
forEach
(
j
->
{
processJoin
(
j
);
processFromItem
(
j
.
getRightItem
());
});
}
}
}
src/main/java/com/esv/freight/customer/config/mybatis/EsvMetaObjectHandler.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
config
.
mybatis
;
import
com.baomidou.mybatisplus.core.handlers.MetaObjectHandler
;
import
com.esv.freight.customer.common.util.ReqUtils
;
import
com.esv.gateway.common.GatewayHeaders
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ibatis.reflection.MetaObject
;
import
org.springframework.stereotype.Component
;
import
java.util.Date
;
/**
* @description:
* @project: freight-notice-service
* @name: com.esv.freight.customer.config.mybatis.EsvMetaObjectHandler
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/17 13:31
* @version:1.0
*/
@Slf4j
@Component
public
class
EsvMetaObjectHandler
implements
MetaObjectHandler
{
@Override
public
void
insertFill
(
MetaObject
metaObject
)
{
if
(
metaObject
.
hasSetter
(
"createUser"
))
{
String
userAccount
=
ReqUtils
.
getRequestHeader
(
GatewayHeaders
.
USER_ACCOUNT
);
this
.
setFieldValByName
(
"createUser"
,
userAccount
,
metaObject
);
}
if
(
metaObject
.
hasSetter
(
"createTime"
))
{
this
.
setFieldValByName
(
"createTime"
,
new
Date
(),
metaObject
);
}
if
(
metaObject
.
hasSetter
(
"tenantId"
)
&&
metaObject
.
getValue
(
"tenantId"
)
==
null
)
{
String
tenantId
=
ReqUtils
.
getRequestHeader
(
GatewayHeaders
.
TENANT_ID
);
this
.
setFieldValByName
(
"tenantId"
,
Long
.
parseLong
(
tenantId
),
metaObject
);
}
if
(
metaObject
.
hasSetter
(
"departmentId"
)
&&
metaObject
.
getValue
(
"departmentId"
)
==
null
)
{
String
departmentId
=
ReqUtils
.
getRequestHeader
(
GatewayHeaders
.
DEPARTMENT_ID
);
this
.
setFieldValByName
(
"departmentId"
,
Long
.
parseLong
(
departmentId
),
metaObject
);
}
}
@Override
public
void
updateFill
(
MetaObject
metaObject
)
{
if
(
metaObject
.
hasSetter
(
"updateUser"
))
{
String
userAccount
=
ReqUtils
.
getRequestHeader
(
GatewayHeaders
.
USER_ACCOUNT
);
this
.
setFieldValByName
(
"updateUser"
,
userAccount
,
metaObject
);
}
if
(
metaObject
.
hasSetter
(
"updateTime"
))
{
this
.
setFieldValByName
(
"updateTime"
,
new
Date
(),
metaObject
);
}
}
}
src/main/java/com/esv/freight/customer/config/mybatis/MybatisPlusConfig.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
config
.
mybatis
;
import
com.baomidou.mybatisplus.core.parser.ISqlParser
;
import
com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @description:
* @project: freight-notice-service
* @name: com.esv.freight.customer.config.mybatis.MybatisPlusConfig
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/17 13:30
* @version:1.0
*/
@Configuration
@MapperScan
({
"com.esv.freight.customer.*.*.dao"
})
public
class
MybatisPlusConfig
{
/**
* description 多租户分页插件
* param []
* return com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor
* author Administrator
* createTime 2020/04/17 14:56
**/
@Bean
public
PaginationInterceptor
paginationInterceptor
()
{
PaginationInterceptor
paginationInterceptor
=
new
PaginationInterceptor
();
List
<
ISqlParser
>
sqlParserList
=
new
ArrayList
<>();
TenantSqlParser
tenantSqlParser
=
new
DataPermParser
();
tenantSqlParser
.
setTenantHandler
(
new
DataPermHandler
());
sqlParserList
.
add
(
tenantSqlParser
);
paginationInterceptor
.
setSqlParserList
(
sqlParserList
);
return
paginationInterceptor
;
}
}
src/main/java/com/esv/freight/customer/feign/FeignBaseService.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
feign
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.feign.FeignBaseService
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/17 17:56
* @version:1.0
*/
@FeignClient
(
value
=
"freight-base-service"
)
public
interface
FeignBaseService
{
@PostMapping
(
value
=
"/base/batchId/generate"
)
JSONObject
getBatchId
(
JSONObject
bodyJson
);
}
src/main/java/com/esv/freight/customer/module/goodsowner/GoodsOwnerConstants.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.goodsowner.GoodsOwnerConstants
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/17 17:27
* @version:1.0
*/
public
class
GoodsOwnerConstants
{
/**
* 货主类型:1-个人、2-企业
**/
public
static
final
String
OWNER_TYPE_PERSONAL
=
"1"
;
public
static
final
String
OWNER_TYPE_COMPANY
=
"2"
;
}
src/main/java/com/esv/freight/customer/module/goodsowner/controller/GoodsOwnerController.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.esv.freight.customer.common.exception.EException
;
import
com.esv.freight.customer.common.response.EResponse
;
import
com.esv.freight.customer.common.util.ReqUtils
;
import
com.esv.freight.customer.common.validator.groups.ValidatorInsert
;
import
com.esv.freight.customer.module.goodsowner.GoodsOwnerConstants
;
import
com.esv.freight.customer.module.goodsowner.form.AccountInfoForm
;
import
com.esv.freight.customer.module.goodsowner.service.AccountService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.goodsowner.controller.GoodsOwnerController
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/17 14:33
* @version:1.0
*/
@Slf4j
@RestController
@RequestMapping
(
"/goodsowner/account"
)
@Validated
public
class
GoodsOwnerController
{
private
AccountService
accountService
;
@Autowired
public
GoodsOwnerController
(
AccountService
accountService
)
{
this
.
accountService
=
accountService
;
}
@PostMapping
(
"/list"
)
public
EResponse
getAccountList
()
{
String
account
=
"test"
;
return
EResponse
.
ok
(
accountService
.
getAccountRecordByAccount
(
account
));
}
/**
* description 平台用户创建帐号
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/04/17 17:39
**/
@PostMapping
(
"/add"
)
public
EResponse
createAccountByManage
(
@RequestBody
@Validated
(
ValidatorInsert
.
class
)
AccountInfoForm
form
)
throws
EException
{
/****************************** 参数校验 ******************************/
// 货主为企业
if
(
GoodsOwnerConstants
.
OWNER_TYPE_COMPANY
.
equals
(
form
.
getOwnerType
()))
{
String
[]
notBlankParams
=
new
String
[]
{
"ownerFullName"
,
"uniCreditCode"
,
"creditCopyUrl"
,
"legalPerson"
};
ReqUtils
.
checkParamsNotBlank
(
JSONObject
.
parseObject
(
form
.
toString
()),
notBlankParams
);
}
/****************************** 参数校验 ******************************/
return
EResponse
.
ok
(
accountService
.
createAccountByManager
(
form
));
}
}
src/main/java/com/esv/freight/customer/module/goodsowner/dao/AccountDao.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
dao
;
import
com.esv.freight.customer.module.goodsowner.entity.AccountEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 货主基础信息表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
@Mapper
public
interface
AccountDao
extends
BaseMapper
<
AccountEntity
>
{
}
src/main/java/com/esv/freight/customer/module/goodsowner/dao/AuditHistoryDao.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
dao
;
import
com.esv.freight.customer.module.goodsowner.entity.AuditHistoryEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 货主审核历史表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
@Mapper
public
interface
AuditHistoryDao
extends
BaseMapper
<
AuditHistoryEntity
>
{
}
src/main/java/com/esv/freight/customer/module/goodsowner/dao/DeliveryAddressDao.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
dao
;
import
com.esv.freight.customer.module.goodsowner.entity.DeliveryAddressEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 货主发货地址表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
@Mapper
public
interface
DeliveryAddressDao
extends
BaseMapper
<
DeliveryAddressEntity
>
{
}
src/main/java/com/esv/freight/customer/module/goodsowner/dao/InfoDao.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
dao
;
import
com.esv.freight.customer.module.goodsowner.entity.InfoEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 货主信息表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
@Mapper
public
interface
InfoDao
extends
BaseMapper
<
InfoEntity
>
{
}
src/main/java/com/esv/freight/customer/module/goodsowner/dao/ReceiveAddressDao.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
dao
;
import
com.esv.freight.customer.module.goodsowner.entity.ReceiveAddressEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 货主收货地址表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
@Mapper
public
interface
ReceiveAddressDao
extends
BaseMapper
<
ReceiveAddressEntity
>
{
}
src/main/java/com/esv/freight/customer/module/goodsowner/dao/RegularlyRouteDao.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
dao
;
import
com.esv.freight.customer.module.goodsowner.entity.RegularlyRouteEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 货主常跑线路表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
@Mapper
public
interface
RegularlyRouteDao
extends
BaseMapper
<
RegularlyRouteEntity
>
{
}
src/main/java/com/esv/freight/customer/module/goodsowner/entity/AccountEntity.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
entity
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 货主基础信息表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
@Data
@TableName
(
"goods_owner_account"
)
public
class
AccountEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@TableId
private
Long
id
;
/**
* 租户ID
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Long
tenantId
;
/**
* 部门ID
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Long
departmentId
;
/**
* 登录帐号,货主手机号
*/
private
String
account
;
/**
* 帐号密码
*/
private
String
password
;
/**
* 密码加盐
*/
private
String
salt
;
/**
* 创建来源:1-平台创建、2-自行注册
*/
private
String
sourceType
;
/**
* 帐号状态:1-正常、2-停用
*/
private
String
accountStatus
;
/**
* 审核状态:1-未审核、2-审核通过,3-审核不通过
APP自行注册需要平台审核
*/
private
String
auditStatus
;
/**
* 上报状态:字典表
*/
private
Integer
uploadStatus
;
/**
* 上报时间
*/
private
Date
uploadTime
;
/**
* 创建者
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
String
createUser
;
/**
* 修改者
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
String
updateUser
;
/**
* 创建时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
createTime
;
/**
* 修改时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
updateTime
;
}
src/main/java/com/esv/freight/customer/module/goodsowner/entity/AuditHistoryEntity.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
/**
* 货主审核历史表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
@Data
@TableName
(
"goods_owner_audit_history"
)
public
class
AuditHistoryEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@TableId
private
Long
id
;
/**
* 货主帐号ID
*/
private
Long
accountId
;
/**
* 审核状态:字典表
*/
private
Integer
auditStatus
;
/**
* 备注
*/
private
String
remark
;
/**
* 操作者
*/
private
String
operateUser
;
/**
* 操作时间
*/
private
Date
operateTime
;
}
src/main/java/com/esv/freight/customer/module/goodsowner/entity/DeliveryAddressEntity.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
entity
;
import
com.baomidou.mybatisplus.annotation.*
;
import
java.math.BigDecimal
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
/**
* 货主发货地址表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
@Data
@TableName
(
"goods_owner_delivery_address"
)
public
class
DeliveryAddressEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@TableId
private
Long
id
;
/**
* 货主ID
*/
private
Long
ownerId
;
/**
* 地址编码
*/
private
String
addressNumber
;
/**
* 地址名称
*/
private
String
addressName
;
/**
* 省份代码
*/
private
String
provinceCode
;
/**
* 市代码
*/
private
String
cityCode
;
/**
* 区县代码
*/
private
String
districtCode
;
/**
* 详细地址
*/
private
String
detailAddress
;
/**
* 发货人
*/
private
String
deliverer
;
/**
* 发货人电话
*/
private
String
delivererPhone
;
/**
* 发货人座机
*/
private
String
delivererTelephone
;
/**
* 经度
*/
private
BigDecimal
lon
;
/**
* 纬度
*/
private
BigDecimal
lat
;
/**
* 是否默认发货地址:0-非默认,1-默认
*/
private
Boolean
defaultAddress
;
/**
* 0-未删除,1-已删除
*/
@TableLogic
private
Boolean
deleted
;
/**
* 创建者
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
String
createUser
;
/**
* 修改者
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
String
updateUser
;
/**
* 创建时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
createTime
;
/**
* 修改时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
updateTime
;
}
src/main/java/com/esv/freight/customer/module/goodsowner/entity/InfoEntity.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
/**
* 货主信息表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
@Data
@TableName
(
"goods_owner_info"
)
public
class
InfoEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@TableId
private
Long
id
;
/**
* 货主帐号ID
*/
private
Long
accountId
;
/**
* 货主类型:1-个人、2-企业
*/
private
String
ownerType
;
/**
* 客户编码
*/
private
String
ownerNumber
;
/**
* 客户名称
*/
private
String
ownerFullName
;
/**
* 客户简称
*/
private
String
ownerBriefName
;
/**
* 统一社会信用代码
*/
private
String
uniCreditCode
;
/**
* 营业期限
*/
private
String
creditExpireDate
;
/**
* 营业执照正本ULR
*/
private
String
creditOriginalUrl
;
/**
* 营业执照副本ULR
*/
private
String
creditCopyUrl
;
/**
* 企业法人姓名
*/
private
String
legalPerson
;
/**
* 企业法人手机号
*/
private
String
legalPhone
;
/**
* 省份代码
*/
private
String
provinceCode
;
/**
* 市代码
*/
private
String
cityCode
;
/**
* 区县代码
*/
private
String
districtCode
;
/**
* 详细地址
*/
private
String
detailAddress
;
/**
* (个人或企业)联系人
*/
private
String
contactor
;
/**
* (个人或企业)身份证号码
*/
private
String
idCard
;
/**
* (个人或企业)身份证有效期
*/
private
String
idCardExpireDate
;
/**
* 身份证正面图片URL
*/
private
String
idCardFrontUrl
;
/**
* 身份证背面图片URL
*/
private
String
idCardBackUrl
;
}
src/main/java/com/esv/freight/customer/module/goodsowner/entity/ReceiveAddressEntity.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
entity
;
import
com.baomidou.mybatisplus.annotation.*
;
import
java.math.BigDecimal
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
/**
* 货主收货地址表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
@Data
@TableName
(
"goods_owner_receive_address"
)
public
class
ReceiveAddressEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@TableId
private
Long
id
;
/**
* 货主ID
*/
private
Long
ownerId
;
/**
* 地址编码
*/
private
String
addressNumber
;
/**
* 地址名称
*/
private
String
addressName
;
/**
* 省份代码
*/
private
String
provinceCode
;
/**
* 市代码
*/
private
String
cityCode
;
/**
* 区县代码
*/
private
String
districtCode
;
/**
* 详细地址
*/
private
String
detailAddress
;
/**
* 收货人
*/
private
String
receiver
;
/**
* 收货人电话
*/
private
String
receiverPhone
;
/**
* 收货人座机
*/
private
String
receiverTelephone
;
/**
* 经度
*/
private
BigDecimal
lon
;
/**
* 纬度
*/
private
BigDecimal
lat
;
/**
* 是否默认发货地址:0-非默认,1-默认
*/
private
Boolean
defaultAddress
;
/**
* 0-未删除,1-已删除
*/
@TableLogic
private
Boolean
deleted
;
/**
* 创建者
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
String
createUser
;
/**
* 修改者
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
String
updateUser
;
/**
* 创建时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
createTime
;
/**
* 修改时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
updateTime
;
}
src/main/java/com/esv/freight/customer/module/goodsowner/entity/RegularlyRouteEntity.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
entity
;
import
com.baomidou.mybatisplus.annotation.*
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
/**
* 货主常跑线路表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
@Data
@TableName
(
"goods_owner_regularly_route"
)
public
class
RegularlyRouteEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@TableId
private
Long
id
;
/**
* 货主ID
*/
private
Long
ownerId
;
/**
* 线路编码
*/
private
String
routeNumber
;
/**
* 线路名称
*/
private
String
routeName
;
/**
* 发货地址ID
*/
private
Long
deliveryId
;
/**
* 收货地址ID
*/
private
Long
receiveId
;
/**
* 0-未删除,1-已删除
*/
@TableLogic
private
Boolean
deleted
;
/**
* 创建者
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
String
createUser
;
/**
* 修改者
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
String
updateUser
;
/**
* 创建时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
createTime
;
/**
* 修改时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
updateTime
;
}
src/main/java/com/esv/freight/customer/module/goodsowner/form/AccountInfoForm.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
form
;
import
com.esv.freight.customer.common.validator.groups.ValidatorInsert
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.Pattern
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.goodsowner.form.AccountInfoForm
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/17 16:11
* @version:1.0
*/
@Data
public
class
AccountInfoForm
{
private
Long
id
;
/**
* (个人或企业联系人手机号)帐号
*/
@Length
(
min
=
11
,
max
=
11
,
message
=
"参数account长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数account不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
account
;
/**
* 帐号密码
*/
@Length
(
min
=
32
,
max
=
32
,
message
=
"参数password长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数password不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
password
;
/**
* 货主类型:1-个人、2-企业
*/
@Pattern
(
regexp
=
"[12]"
,
message
=
"参数ownerType不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数ownerType不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
ownerType
;
/**
* 客户编码
*/
private
String
ownerNumber
;
/**
* 客户名称
*/
@Length
(
max
=
50
,
message
=
"参数ownerFullName长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
ownerFullName
;
/**
* 客户简称
*/
@Length
(
max
=
50
,
message
=
"参数ownerBriefName长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
ownerBriefName
;
/**
* 统一社会信用代码
*/
@Length
(
max
=
20
,
message
=
"参数uniCreditCode长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
uniCreditCode
;
/**
* 营业期限
*/
@Length
(
max
=
50
,
message
=
"参数creditExpireDate长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
creditExpireDate
;
/**
* 营业执照正本ULR
*/
@Length
(
max
=
200
,
message
=
"参数creditOriginalUrl长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
creditOriginalUrl
;
/**
* 营业执照副本ULR
*/
@Length
(
max
=
200
,
message
=
"参数creditCopyUrl长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
creditCopyUrl
;
/**
* 企业法人姓名
*/
@Length
(
max
=
20
,
message
=
"参数legalPerson长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
legalPerson
;
/**
* 企业法人手机号
*/
@Length
(
max
=
20
,
message
=
"参数legalPhone长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
legalPhone
;
/**
* 省份代码
*/
@Length
(
min
=
6
,
max
=
6
,
message
=
"参数provinceCode长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数provinceCode不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
provinceCode
;
/**
* 市代码
*/
@Length
(
min
=
6
,
max
=
6
,
message
=
"参数cityCode长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数cityCode不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
cityCode
;
/**
* 区县代码
*/
@Length
(
min
=
6
,
max
=
6
,
message
=
"参数districtCode长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数districtCode不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
districtCode
;
/**
* 详细地址
*/
@Length
(
max
=
100
,
message
=
"参数detailAddress长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数detailAddress不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
detailAddress
;
/**
* (个人或企业)联系人
*/
@Length
(
max
=
20
,
message
=
"参数contactor长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数contactor不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
contactor
;
/**
* (个人或企业)身份证号码
*/
@Length
(
min
=
18
,
max
=
18
,
message
=
"参数idCard长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数idCard不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
idCard
;
/**
* (个人或企业)身份证有效期
*/
@Length
(
max
=
50
,
message
=
"参数idCardExpireDate长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
idCardExpireDate
;
/**
* 身份证正面图片URL
*/
@Length
(
max
=
200
,
message
=
"参数idCardFrontUrl长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数idCardFrontUrl不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
idCardFrontUrl
;
/**
* 身份证背面图片URL
*/
@Length
(
max
=
200
,
message
=
"参数idCardBackUrl长度不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotBlank
(
message
=
"参数idCardBackUrl不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
idCardBackUrl
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/java/com/esv/freight/customer/module/goodsowner/service/AccountService.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.goodsowner.entity.AccountEntity
;
import
com.esv.freight.customer.module.goodsowner.form.AccountInfoForm
;
import
java.util.List
;
/**
* 货主基础信息表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
public
interface
AccountService
extends
IService
<
AccountEntity
>
{
/**
* description 通过帐号查询帐号记录
* param [account]
* return com.esv.freight.customer.module.goodsowner.entity.AccountEntity
* author Administrator
* createTime 2020/04/17 15:46
**/
AccountEntity
getAccountRecordByAccount
(
String
account
);
/**
* description 通过管理平台创建帐号
* param [form]
* return int
* author Administrator
* createTime 2020/04/17 16:05
**/
int
createAccountByManager
(
AccountInfoForm
form
);
}
src/main/java/com/esv/freight/customer/module/goodsowner/service/AuditHistoryService.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.goodsowner.entity.AuditHistoryEntity
;
/**
* 货主审核历史表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
public
interface
AuditHistoryService
extends
IService
<
AuditHistoryEntity
>
{
}
src/main/java/com/esv/freight/customer/module/goodsowner/service/DeliveryAddressService.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.goodsowner.entity.DeliveryAddressEntity
;
/**
* 货主发货地址表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
public
interface
DeliveryAddressService
extends
IService
<
DeliveryAddressEntity
>
{
}
src/main/java/com/esv/freight/customer/module/goodsowner/service/InfoService.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.goodsowner.entity.InfoEntity
;
/**
* 货主信息表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
public
interface
InfoService
extends
IService
<
InfoEntity
>
{
}
src/main/java/com/esv/freight/customer/module/goodsowner/service/ReceiveAddressService.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.goodsowner.entity.ReceiveAddressEntity
;
/**
* 货主收货地址表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
public
interface
ReceiveAddressService
extends
IService
<
ReceiveAddressEntity
>
{
}
src/main/java/com/esv/freight/customer/module/goodsowner/service/RegularlyRouteService.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.goodsowner.entity.RegularlyRouteEntity
;
/**
* 货主常跑线路表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-17 13:54:57
*/
public
interface
RegularlyRouteService
extends
IService
<
RegularlyRouteEntity
>
{
}
src/main/java/com/esv/freight/customer/module/goodsowner/service/impl/AccountServiceImpl.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.esv.freight.customer.common.exception.EException
;
import
com.esv.freight.customer.common.util.FeignUtils
;
import
com.esv.freight.customer.feign.FeignBaseService
;
import
com.esv.freight.customer.module.goodsowner.dao.AccountDao
;
import
com.esv.freight.customer.module.goodsowner.entity.AccountEntity
;
import
com.esv.freight.customer.module.goodsowner.entity.InfoEntity
;
import
com.esv.freight.customer.module.goodsowner.form.AccountInfoForm
;
import
com.esv.freight.customer.module.goodsowner.service.AccountService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
@Service
(
"accountService"
)
public
class
AccountServiceImpl
extends
ServiceImpl
<
AccountDao
,
AccountEntity
>
implements
AccountService
{
private
FeignBaseService
feignBaseService
;
@Autowired
public
AccountServiceImpl
(
FeignBaseService
feignBaseService
)
{
this
.
feignBaseService
=
feignBaseService
;
}
@Override
public
AccountEntity
getAccountRecordByAccount
(
String
account
)
{
AccountEntity
queryEntity
=
new
AccountEntity
();
queryEntity
.
setAccount
(
account
);
QueryWrapper
<
AccountEntity
>
queryWrapper
=
new
QueryWrapper
<>(
queryEntity
);
return
this
.
baseMapper
.
selectOne
(
queryWrapper
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
int
createAccountByManager
(
AccountInfoForm
form
)
{
// 1.判断帐号是否已存在
AccountEntity
accountEntity
=
this
.
getAccountRecordByAccount
(
form
.
getAccount
());
if
(
null
!=
accountEntity
)
{
throw
new
EException
(
1001
,
"帐号已存在"
);
}
else
{
accountEntity
=
new
AccountEntity
();
}
// 2.获取客户编码
JSONObject
batchIdReqJson
=
new
JSONObject
();
batchIdReqJson
.
put
(
"prefix"
,
"HZ"
);
batchIdReqJson
.
put
(
"formatter"
,
"yyyyMMdd"
);
batchIdReqJson
.
put
(
"length"
,
13
);
JSONObject
batchIdResJson
;
try
{
batchIdResJson
=
FeignUtils
.
getFeignResultData
(
feignBaseService
.
getBatchId
(
batchIdReqJson
));
}
catch
(
Exception
e
)
{
log
.
error
(
"调用[基础服务]生成客户编号失败"
);
throw
new
EException
(
"生成客户编号时发生错误"
);
}
String
ownerNumber
=
batchIdResJson
.
getString
(
"batchId"
);
// 3.新增帐号
// 4.新增帐号信息
InfoEntity
infoEntity
=
new
InfoEntity
();
infoEntity
.
setOwnerNumber
(
ownerNumber
);
// 5.新增帐号审核记录
return
0
;
}
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/module/goodsowner/service/impl/AuditHistoryServiceImpl.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.esv.freight.customer.module.goodsowner.dao.AuditHistoryDao
;
import
com.esv.freight.customer.module.goodsowner.entity.AuditHistoryEntity
;
import
com.esv.freight.customer.module.goodsowner.service.AuditHistoryService
;
import
org.springframework.stereotype.Service
;
@Service
(
"auditHistoryService"
)
public
class
AuditHistoryServiceImpl
extends
ServiceImpl
<
AuditHistoryDao
,
AuditHistoryEntity
>
implements
AuditHistoryService
{
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/module/goodsowner/service/impl/DeliveryAddressServiceImpl.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.esv.freight.customer.module.goodsowner.dao.DeliveryAddressDao
;
import
com.esv.freight.customer.module.goodsowner.entity.DeliveryAddressEntity
;
import
com.esv.freight.customer.module.goodsowner.service.DeliveryAddressService
;
import
org.springframework.stereotype.Service
;
@Service
(
"deliveryAddressService"
)
public
class
DeliveryAddressServiceImpl
extends
ServiceImpl
<
DeliveryAddressDao
,
DeliveryAddressEntity
>
implements
DeliveryAddressService
{
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/module/goodsowner/service/impl/InfoServiceImpl.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.esv.freight.customer.module.goodsowner.dao.InfoDao
;
import
com.esv.freight.customer.module.goodsowner.entity.InfoEntity
;
import
com.esv.freight.customer.module.goodsowner.service.InfoService
;
import
org.springframework.stereotype.Service
;
@Service
(
"infoService"
)
public
class
InfoServiceImpl
extends
ServiceImpl
<
InfoDao
,
InfoEntity
>
implements
InfoService
{
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/module/goodsowner/service/impl/ReceiveAddressServiceImpl.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.esv.freight.customer.module.goodsowner.dao.ReceiveAddressDao
;
import
com.esv.freight.customer.module.goodsowner.entity.ReceiveAddressEntity
;
import
com.esv.freight.customer.module.goodsowner.service.ReceiveAddressService
;
import
org.springframework.stereotype.Service
;
@Service
(
"receiveAddressService"
)
public
class
ReceiveAddressServiceImpl
extends
ServiceImpl
<
ReceiveAddressDao
,
ReceiveAddressEntity
>
implements
ReceiveAddressService
{
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/module/goodsowner/service/impl/RegularlyRouteServiceImpl.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.esv.freight.customer.module.goodsowner.dao.RegularlyRouteDao
;
import
com.esv.freight.customer.module.goodsowner.entity.RegularlyRouteEntity
;
import
com.esv.freight.customer.module.goodsowner.service.RegularlyRouteService
;
import
org.springframework.stereotype.Service
;
@Service
(
"regularlyRouteService"
)
public
class
RegularlyRouteServiceImpl
extends
ServiceImpl
<
RegularlyRouteDao
,
RegularlyRouteEntity
>
implements
RegularlyRouteService
{
}
\ No newline at end of file
src/main/java/com/esv/freight/
notice
/module/test/controller/TestController.java
→
src/main/java/com/esv/freight/
customer
/module/test/controller/TestController.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
.
module
.
test
.
controller
;
package
com
.
esv
.
freight
.
customer
.
module
.
test
.
controller
;
import
com.esv.freight.
notice
.common.response.EResponse
;
import
com.esv.freight.
customer
.common.response.EResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
src/main/resources/application-dev.yml
View file @
f846009e
...
...
@@ -41,3 +41,7 @@ mybatis-plus:
id-type
:
AUTO
logic-delete-value
:
1
logic-not-delete-value
:
0
ribbon
:
eager-load
:
enabled
:
true
clients
:
freight-base-service
\ No newline at end of file
src/main/resources/application-test.yml
View file @
f846009e
...
...
@@ -41,3 +41,7 @@ mybatis-plus:
id-type
:
AUTO
logic-delete-value
:
1
logic-not-delete-value
:
0
ribbon
:
eager-load
:
enabled
:
true
clients
:
freight-base-service
\ No newline at end of file
src/main/resources/bootstrap.yml
View file @
f846009e
...
...
@@ -3,8 +3,8 @@ server:
servlet
:
context-path
:
/customer
nacos
:
url
:
localhost
:8848
namespace
:
548b506d-8d19-4d54-9715-bb0ac3a655b2
url
:
192.168.31.248
:8848
namespace
:
aad5aa26-5351-4e7a-a65e-ecb332f3c52c
group
:
FREIGHT_GROUP
spring
:
application
:
...
...
src/main/resources/mapper/goodsowner/AccountDao.xml
0 → 100644
View file @
f846009e
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.esv.freight.customer.module.goodsowner.dao.AccountDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.esv.freight.customer.module.goodsowner.entity.AccountEntity"
id=
"accountMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"tenantId"
column=
"tenant_id"
/>
<result
property=
"departmentId"
column=
"department_id"
/>
<result
property=
"account"
column=
"account"
/>
<result
property=
"password"
column=
"password"
/>
<result
property=
"salt"
column=
"salt"
/>
<result
property=
"sourceType"
column=
"source_type"
/>
<result
property=
"accountStatus"
column=
"account_status"
/>
<result
property=
"auditStatus"
column=
"audit_status"
/>
<result
property=
"uploadStatus"
column=
"upload_status"
/>
<result
property=
"uploadTime"
column=
"upload_time"
/>
<result
property=
"createUser"
column=
"create_user"
/>
<result
property=
"updateUser"
column=
"update_user"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
</mapper>
\ No newline at end of file
src/main/resources/mapper/goodsowner/AuditHistoryDao.xml
0 → 100644
View file @
f846009e
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.esv.freight.customer.module.goodsowner.dao.AuditHistoryDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.esv.freight.customer.module.goodsowner.entity.AuditHistoryEntity"
id=
"auditHistoryMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"accountId"
column=
"account_id"
/>
<result
property=
"auditStatus"
column=
"audit_status"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"operateUser"
column=
"operate_user"
/>
<result
property=
"operateTime"
column=
"operate_time"
/>
</resultMap>
</mapper>
\ No newline at end of file
src/main/resources/mapper/goodsowner/DeliveryAddressDao.xml
0 → 100644
View file @
f846009e
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.esv.freight.customer.module.goodsowner.dao.DeliveryAddressDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.esv.freight.customer.module.goodsowner.entity.DeliveryAddressEntity"
id=
"deliveryAddressMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"ownerId"
column=
"owner_id"
/>
<result
property=
"addressNumber"
column=
"address_number"
/>
<result
property=
"addressName"
column=
"address_name"
/>
<result
property=
"provinceCode"
column=
"province_code"
/>
<result
property=
"cityCode"
column=
"city_code"
/>
<result
property=
"districtCode"
column=
"district_code"
/>
<result
property=
"detailAddress"
column=
"detail_address"
/>
<result
property=
"deliverer"
column=
"deliverer"
/>
<result
property=
"delivererPhone"
column=
"deliverer_phone"
/>
<result
property=
"delivererTelephone"
column=
"deliverer_telephone"
/>
<result
property=
"lon"
column=
"lon"
/>
<result
property=
"lat"
column=
"lat"
/>
<result
property=
"defaultAddress"
column=
"default_address"
/>
<result
property=
"deleted"
column=
"deleted"
/>
<result
property=
"createUser"
column=
"create_user"
/>
<result
property=
"updateUser"
column=
"update_user"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
</mapper>
\ No newline at end of file
src/main/resources/mapper/goodsowner/InfoDao.xml
0 → 100644
View file @
f846009e
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.esv.freight.customer.module.goodsowner.dao.InfoDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.esv.freight.customer.module.goodsowner.entity.InfoEntity"
id=
"infoMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"accountId"
column=
"account_id"
/>
<result
property=
"ownerType"
column=
"owner_type"
/>
<result
property=
"ownerNumber"
column=
"owner_number"
/>
<result
property=
"ownerFullName"
column=
"owner_full_name"
/>
<result
property=
"ownerBriefName"
column=
"owner_brief_name"
/>
<result
property=
"uniCreditCode"
column=
"uni_credit_code"
/>
<result
property=
"creditExpireDate"
column=
"credit_expire_date"
/>
<result
property=
"creditOriginalUrl"
column=
"credit_original_url"
/>
<result
property=
"creditCopyUrl"
column=
"credit_copy_url"
/>
<result
property=
"legalPerson"
column=
"legal_person"
/>
<result
property=
"legalPhone"
column=
"legal_phone"
/>
<result
property=
"provinceCode"
column=
"province_code"
/>
<result
property=
"cityCode"
column=
"city_code"
/>
<result
property=
"districtCode"
column=
"district_code"
/>
<result
property=
"detailAddress"
column=
"detail_address"
/>
<result
property=
"contactor"
column=
"contactor"
/>
<result
property=
"idCard"
column=
"id_card"
/>
<result
property=
"idCardExpireDate"
column=
"id_card_expire_date"
/>
<result
property=
"idCardFrontUrl"
column=
"id_card_front_url"
/>
<result
property=
"idCardBackUrl"
column=
"id_card_back_url"
/>
</resultMap>
</mapper>
\ No newline at end of file
src/main/resources/mapper/goodsowner/ReceiveAddressDao.xml
0 → 100644
View file @
f846009e
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.esv.freight.customer.module.goodsowner.dao.ReceiveAddressDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.esv.freight.customer.module.goodsowner.entity.ReceiveAddressEntity"
id=
"receiveAddressMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"ownerId"
column=
"owner_id"
/>
<result
property=
"addressNumber"
column=
"address_number"
/>
<result
property=
"addressName"
column=
"address_name"
/>
<result
property=
"provinceCode"
column=
"province_code"
/>
<result
property=
"cityCode"
column=
"city_code"
/>
<result
property=
"districtCode"
column=
"district_code"
/>
<result
property=
"detailAddress"
column=
"detail_address"
/>
<result
property=
"receiver"
column=
"receiver"
/>
<result
property=
"receiverPhone"
column=
"receiver_phone"
/>
<result
property=
"receiverTelephone"
column=
"receiver_telephone"
/>
<result
property=
"lon"
column=
"lon"
/>
<result
property=
"lat"
column=
"lat"
/>
<result
property=
"defaultAddress"
column=
"default_address"
/>
<result
property=
"deleted"
column=
"deleted"
/>
<result
property=
"createUser"
column=
"create_user"
/>
<result
property=
"updateUser"
column=
"update_user"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
</mapper>
\ No newline at end of file
src/main/resources/mapper/goodsowner/RegularlyRouteDao.xml
0 → 100644
View file @
f846009e
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.esv.freight.customer.module.goodsowner.dao.RegularlyRouteDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.esv.freight.customer.module.goodsowner.entity.RegularlyRouteEntity"
id=
"regularlyRouteMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"ownerId"
column=
"owner_id"
/>
<result
property=
"routeNumber"
column=
"route_number"
/>
<result
property=
"routeName"
column=
"route_name"
/>
<result
property=
"deliveryId"
column=
"delivery_id"
/>
<result
property=
"receiveId"
column=
"receive_id"
/>
<result
property=
"deleted"
column=
"deleted"
/>
<result
property=
"createUser"
column=
"create_user"
/>
<result
property=
"updateUser"
column=
"update_user"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
</mapper>
\ No newline at end of file
src/test/java/com/esv/freight/
notice
/BaseTestController.java
→
src/test/java/com/esv/freight/
customer
/BaseTestController.java
View file @
f846009e
package
com
.
esv
.
freight
.
notice
;
package
com
.
esv
.
freight
.
customer
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.test.web.servlet.setup.MockMvcBuilders
;
import
org.springframework.web.context.WebApplicationContext
;
...
...
@@ -38,4 +39,17 @@ public class BaseTestController {
log
.
info
(
"=================================== Test End ==================================="
);
}
public
HttpHeaders
getDefaultHttpHeaders
()
{
HttpHeaders
httpHeaders
=
new
HttpHeaders
();
httpHeaders
.
add
(
"gateway_traceid"
,
String
.
valueOf
(
System
.
currentTimeMillis
()));
httpHeaders
.
add
(
"esv_system"
,
"cc"
);
httpHeaders
.
add
(
"esv_data_perm"
,
"1"
);
httpHeaders
.
add
(
"esv_tenant"
,
"1"
);
httpHeaders
.
add
(
"esv_department"
,
"1"
);
httpHeaders
.
add
(
"esv_department_children"
,
"1,2,3"
);
httpHeaders
.
add
(
"esv_user"
,
"1"
);
httpHeaders
.
add
(
"esv_account"
,
"admin"
);
return
httpHeaders
;
}
}
src/test/java/com/esv/freight/customer/module/goodsowner/controller/GoodsOwnerControllerTest.java
0 → 100644
View file @
f846009e
package
com
.
esv
.
freight
.
customer
.
module
.
goodsowner
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.esv.freight.customer.BaseTestController
;
import
com.esv.freight.customer.common.response.ECode
;
import
com.esv.freight.customer.module.goodsowner.GoodsOwnerConstants
;
import
com.esv.freight.customer.module.goodsowner.form.AccountInfoForm
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Assert
;
import
org.junit.FixMethodOrder
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.MethodSorters
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.http.MediaType
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.web.servlet.MvcResult
;
import
org.springframework.test.web.servlet.request.MockMvcRequestBuilders
;
import
org.springframework.test.web.servlet.result.MockMvcResultHandlers
;
import
org.springframework.test.web.servlet.result.MockMvcResultMatchers
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.goodsowner.controller.GoodsOwnerControllerTest
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/17 14:37
* @version:1.0
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
@Slf4j
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
public
class
GoodsOwnerControllerTest
extends
BaseTestController
{
@Test
public
void
a1_createAccountByManager_personal_success_test
()
throws
Exception
{
String
url
=
"/goodsowner/account/add"
;
// 构造数据
JSONObject
reqJson
=
new
JSONObject
();
AccountInfoForm
form
=
new
AccountInfoForm
();
form
.
setAccount
(
"18524431581"
);
form
.
setPassword
(
"e28bec3e2feb42598b8cf1a1d3b11f4a"
);
form
.
setOwnerType
(
GoodsOwnerConstants
.
OWNER_TYPE_PERSONAL
);
form
.
setContactor
(
"黄朝斌"
);
form
.
setIdCard
(
"360721198712031234"
);
form
.
setIdCardExpireDate
(
"2030/12/31"
);
form
.
setProvinceCode
(
"210000"
);
form
.
setCityCode
(
"210100"
);
form
.
setDistrictCode
(
"210102"
);
form
.
setDetailAddress
(
"双园路"
);
form
.
setIdCardFrontUrl
(
"http://127.0.0.1/001.jpg"
);
form
.
setIdCardBackUrl
(
"http://127.0.0.1/002.jpg"
);
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSONString
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
String
responseStr
=
mvcResult
.
getResponse
().
getContentAsString
();
log
.
info
(
responseStr
);
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
ECode
.
SUCCESS
.
code
(),
result
.
getIntValue
(
"code"
));
}
@Test
public
void
a1_createAccountByManager_company_success_test
()
throws
Exception
{
String
url
=
"/goodsowner/account/add"
;
// 构造数据
JSONObject
reqJson
=
new
JSONObject
();
AccountInfoForm
form
=
new
AccountInfoForm
();
form
.
setAccount
(
"18524431582"
);
form
.
setPassword
(
"e28bec3e2feb42598b8cf1a1d3b11f4a"
);
form
.
setOwnerType
(
GoodsOwnerConstants
.
OWNER_TYPE_COMPANY
);
form
.
setContactor
(
"黄朝斌"
);
form
.
setIdCard
(
"360721198712031234"
);
form
.
setIdCardExpireDate
(
"2030/12/31"
);
form
.
setProvinceCode
(
"210000"
);
form
.
setCityCode
(
"210100"
);
form
.
setDistrictCode
(
"210102"
);
form
.
setDetailAddress
(
"双园路"
);
form
.
setIdCardFrontUrl
(
"http://127.0.0.1/001.jpg"
);
form
.
setIdCardBackUrl
(
"http://127.0.0.1/002.jpg"
);
form
.
setOwnerFullName
(
"黄朝斌测试有限公司"
);
form
.
setUniCreditCode
(
"123456789"
);
form
.
setCreditCopyUrl
(
"http://127.0.0.1/003.jpg"
);
form
.
setLegalPerson
(
"黄卓越"
);
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSONString
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
String
responseStr
=
mvcResult
.
getResponse
().
getContentAsString
();
log
.
info
(
responseStr
);
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
ECode
.
SUCCESS
.
code
(),
result
.
getIntValue
(
"code"
));
}
}
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