Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wios
概览
Overview
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
苗卫卫
wios
Commits
266729b1
提交
266729b1
authored
11月 07, 2023
作者:
“chaining”
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
墙盒申请
父级
92ac644e
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
473 行增加
和
2 行删除
+473
-2
lib/dop-sdk-0.0.1-SNAPSHOT.jar
+0
-0
pom.xml
+7
-0
src/main/java/com/starcharge/wios/Import/v2/ImportControllerV2.java
+67
-0
src/main/java/com/starcharge/wios/client/DepponClient.java
+25
-0
src/main/java/com/starcharge/wios/client/DopInterceptor.java
+74
-0
src/main/java/com/starcharge/wios/controller/WallboxApplyController.java
+0
-0
src/main/java/com/starcharge/wios/convert/WallboxApplyConvert.java
+30
-0
src/main/java/com/starcharge/wios/service/SupplierService.java
+7
-2
src/main/java/com/starcharge/wios/service/WallboxApplyService.java
+263
-0
没有找到文件。
lib/dop-sdk-0.0.1-SNAPSHOT.jar
0 → 100644
查看文件 @
266729b1
File added
pom.xml
查看文件 @
266729b1
...
@@ -290,6 +290,13 @@
...
@@ -290,6 +290,13 @@
<artifactId>
commons-httpclient
</artifactId>
<artifactId>
commons-httpclient
</artifactId>
<version>
3.1
</version>
<version>
3.1
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.deppon.com
</groupId>
<artifactId>
dop-sdk
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<scope>
system
</scope>
<systemPath>
${project.basedir}/lib/dop-sdk-0.0.1-SNAPSHOT.jar
</systemPath>
</dependency>
</dependencies>
</dependencies>
<dependencyManagement>
<dependencyManagement>
...
...
src/main/java/com/starcharge/wios/Import/v2/ImportControllerV2.java
0 → 100644
查看文件 @
266729b1
package
com
.
starcharge
.
wios
.
Import
.
v2
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.ihidea.component.api.v2.BaseResponse
;
import
com.starcharge.wios.dao.OrderDao
;
import
com.starcharge.wios.dao.entity.Order
;
import
com.starcharge.wios.service.WallboxApplyService
;
import
com.starcharge.wios.utils.ExcelUtils
;
import
com.starcharge.wios.validation.CreateEntityGroup
;
import
com.starcharge.wios.vo.WallboxApplyExcelVO
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.validation.ConstraintViolation
;
import
javax.validation.Validator
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
@RestController
public
class
ImportControllerV2
{
@Autowired
private
Validator
validator
;
@Autowired
private
WallboxApplyService
wallboxApplyService
;
@Autowired
private
OrderDao
orderDao
;
@PostMapping
(
"/wallbox-apply/import"
)
@ApiOperation
(
"导入墙盒申请"
)
public
BaseResponse
<
List
<
WallboxApplyExcelVO
>>
importExcel
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
)
throws
Exception
{
List
<
WallboxApplyExcelVO
>
list
=
ExcelUtils
.
read
(
file
,
WallboxApplyExcelVO
.
class
);
for
(
WallboxApplyExcelVO
vo
:
list
)
{
Set
<
ConstraintViolation
<
WallboxApplyExcelVO
>>
violations
=
validator
.
validate
(
vo
,
CreateEntityGroup
.
class
);
if
(!
violations
.
isEmpty
())
{
String
errorMessage
=
violations
.
stream
()
.
map
(
ConstraintViolation:
:
getMessage
)
.
collect
(
Collectors
.
joining
(
";"
));
vo
.
setErrorMessage
(
errorMessage
);
}
if
(
StringUtils
.
isNotBlank
(
vo
.
getOrderId
())){
Order
order
=
orderDao
.
selectById
(
vo
.
getOrderId
());
if
(
ObjectUtil
.
isNull
(
order
))
{
vo
.
setErrorMessage
(
"不存在安装订单号"
);
}
if
(
ObjectUtil
.
isNotNull
(
order
))
{
vo
.
setWallboxModel
(
order
.
getWallboxModel
());
}
if
(
ObjectUtil
.
isNotNull
(
wallboxApplyService
.
selectWallboxDetail
(
vo
.
getOrderId
())))
{
vo
.
setErrorMessage
(
"重复订单申请"
);
}
}
}
return
new
BaseResponse
<>(
list
);
}
}
src/main/java/com/starcharge/wios/client/DepponClient.java
0 → 100644
查看文件 @
266729b1
package
com
.
starcharge
.
wios
.
client
;
import
com.dtflys.forest.annotation.BaseRequest
;
import
com.dtflys.forest.annotation.Body
;
import
com.dtflys.forest.annotation.Post
;
/**
* <p>
* 德邦物流clinet,注意入参使用Map或者对象实体
* <p>
*
* @author <a href="mail to: ning.chai@foxmail.com" rel="nofollow">chaining</a>
*/
@BaseRequest
(
baseURL
=
"http://dpsanbox.deppon.com/sandbox-web/standard-order/"
,
interceptor
=
DopInterceptor
.
class
)
public
interface
DepponClient
{
/**
* 新标准轨迹查询
* http://dop.deppon.com/#/wantAccess/myApiConfig
* @param {"mailNo":"7503587254"}
* @return 字符串
*/
@Post
(
"newTraceQuery.action"
)
String
newTraceQuery
(
@Body
(
"params"
)
String
params
);
}
src/main/java/com/starcharge/wios/client/DopInterceptor.java
0 → 100644
查看文件 @
266729b1
package
com
.
starcharge
.
wios
.
client
;
import
com.deppon.dop.module.sdk.shared.util.SecurityUtil
;
import
com.dtflys.forest.exceptions.ForestRuntimeException
;
import
com.dtflys.forest.http.ForestRequest
;
import
com.dtflys.forest.http.ForestResponse
;
import
com.dtflys.forest.interceptor.Interceptor
;
import
com.dtflys.forest.reflection.ForestMethod
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.codec.digest.DigestUtils
;
/**
* <p>
* 德邦物流请求拦截器,实现自动注入companyCode、digest、timestamp参数
* <p>
*
* @author <a href="mail to: ning.chai@foxmail.com" rel="nofollow">chaining</a>
*/
public
class
DopInterceptor
<
T
>
implements
Interceptor
<
T
>
{
private
final
String
companyCode
=
"EWBXRCHSZX"
;
private
final
String
appkey
=
"fe38a755ce4f7629717342e441cdedff"
;
/**
* 该方法在被调用时,检测token是否过期,并在beforeExecute前被调用
* @Param request Forest请求对象
* @Param args 方法被调用时传入的参数数组
*/
@Override
public
void
onInvokeMethod
(
ForestRequest
request
,
ForestMethod
method
,
Object
[]
args
)
{
}
@Override
public
boolean
beforeExecute
(
ForestRequest
request
)
{
request
.
addHeader
(
"Content-Type"
,
"application/x-www-form-urlencoded;charset=utf-8"
);
String
params
=
request
.
getBody
().
get
(
0
).
toString
();
// String timestamp=System.currentTimeMillis()+"";
String
timestamp
=
"1697877426621"
;
//params+appkey+timestamp,,,ZDU0NzYzZWJkODRhZjBlZjcyYjEwZDYxYTNlNzRkNWQ=
String
digest
=
SecurityUtil
.
getStandardDigest
(
params
+
appkey
+
timestamp
);
request
.
addBody
(
"companyCode"
,
companyCode
);
request
.
addBody
(
"digest"
,
digest
);
request
.
addBody
(
"timestamp"
,
timestamp
);
return
true
;
// 继续执行请求返回true
}
/**
* 该方法在请求成功响应时被调用
*/
@Override
public
void
onSuccess
(
T
data
,
ForestRequest
req
,
ForestResponse
res
)
{
}
/**
* 该方法在请求发送失败时被调用
*/
@Override
public
void
onError
(
ForestRuntimeException
ex
,
ForestRequest
req
,
ForestResponse
res
)
{
// 执行发送请求失败后处理的代码
int
status
=
res
.
getStatusCode
();
// 获取请求响应状态码
String
content
=
res
.
getContent
();
}
/**
* 该方法在请求发送之后被调用
*/
@Override
public
void
afterExecute
(
ForestRequest
req
,
ForestResponse
res
)
{
}
private
String
getDigest
(
String
plainText
)
{
return
Base64
.
encodeBase64String
(
DigestUtils
.
md5Hex
(
plainText
).
getBytes
());
}
}
src/main/java/com/starcharge/wios/controller/WallboxApplyController.java
0 → 100644
查看文件 @
266729b1
差异被折叠。
点击展开。
src/main/java/com/starcharge/wios/convert/WallboxApplyConvert.java
0 → 100644
查看文件 @
266729b1
package
com
.
starcharge
.
wios
.
convert
;
import
com.starcharge.wios.dao.entity.WallboxApply
;
import
com.starcharge.wios.vo.WallboxApplyInstallInfoVO
;
import
com.starcharge.wios.vo.WallboxApplyInstallListVO
;
import
com.starcharge.wios.vo.WallboxApplyReqVO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
/**
* <p>
* description
* <p>
*
* @author <a href="mail to: ning.chai@foxmail.com" rel="nofollow">chaining</a>
*/
@Mapper
public
interface
WallboxApplyConvert
{
WallboxApplyConvert
INSTANCE
=
Mappers
.
getMapper
(
WallboxApplyConvert
.
class
);
WallboxApply
convert
(
WallboxApplyReqVO
bean
);
WallboxApplyInstallInfoVO
convert2Info
(
WallboxApply
bean
);
WallboxApplyInstallListVO
convert
(
WallboxApply
bean
);
List
<
WallboxApplyInstallListVO
>
convertList
(
List
<
WallboxApply
>
bean
);
}
src/main/java/com/starcharge/wios/service/SupplierService.java
查看文件 @
266729b1
...
@@ -126,8 +126,9 @@ public class SupplierService {
...
@@ -126,8 +126,9 @@ public class SupplierService {
public
List
<
SupplierVo
>
getList
(
SupplierBo
condition
)
{
public
List
<
SupplierVo
>
getList
(
SupplierBo
condition
)
{
SessionInfo
sessionInfo
=
tokenService
.
getUser
();
SessionInfo
sessionInfo
=
tokenService
.
getUser
();
if
(
sessionInfo
!=
null
&&
!
StringUtils
.
isEmpty
(
sessionInfo
.
getAttribute
().
get
(
"installSupplierId"
)))
if
(
sessionInfo
!=
null
&&
!
StringUtils
.
isEmpty
(
sessionInfo
.
getAttribute
().
get
(
"installSupplierId"
)))
{
condition
.
setId
(
sessionInfo
.
getAttribute
().
get
(
"installSupplierId"
));
condition
.
setId
(
sessionInfo
.
getAttribute
().
get
(
"installSupplierId"
));
}
if
(
condition
.
getServiceRegionId
()
!=
null
)
{
if
(
condition
.
getServiceRegionId
()
!=
null
)
{
Region
region
=
regionDao
.
selectById
(
condition
.
getServiceRegionId
());
Region
region
=
regionDao
.
selectById
(
condition
.
getServiceRegionId
());
List
<
String
>
regionIdList
=
Arrays
.
asList
(
region
.
getIdTree
().
split
(
"_"
));
List
<
String
>
regionIdList
=
Arrays
.
asList
(
region
.
getIdTree
().
split
(
"_"
));
...
@@ -137,7 +138,11 @@ public class SupplierService {
...
@@ -137,7 +138,11 @@ public class SupplierService {
}
}
return
supplierDao
.
getList
(
condition
);
return
supplierDao
.
getList
(
condition
);
}
}
public
Supplier
getById
(
Integer
id
){
return
supplierDao
.
selectById
(
id
);
}
public
void
update
(
int
id
,
SupplierBo
supplierBo
)
{
public
void
update
(
int
id
,
SupplierBo
supplierBo
)
{
supplierDao
.
update
(
id
,
supplierBo
);
supplierDao
.
update
(
id
,
supplierBo
);
}
}
...
...
src/main/java/com/starcharge/wios/service/WallboxApplyService.java
0 → 100644
查看文件 @
266729b1
package
com
.
starcharge
.
wios
.
service
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.ihidea.core.support.exception.ServiceException
;
import
com.ihidea.core.support.session.SessionInfo
;
import
com.starcharge.wios.auth.service.TokenService
;
import
com.starcharge.wios.dao.OrderDao
;
import
com.starcharge.wios.dao.OrderInstallDao
;
import
com.starcharge.wios.dao.SupplierDao
;
import
com.starcharge.wios.dao.SupplierStaffDao
;
import
com.starcharge.wios.dao.entity.Order
;
import
com.starcharge.wios.dao.entity.OrderInstall
;
import
com.starcharge.wios.dao.entity.SupplierStaff
;
import
com.starcharge.wios.dao.entity.WallboxApply
;
import
com.starcharge.wios.dao.mappers.WallboxApplyMapper
;
import
com.starcharge.wios.dto.WallboxApplyBatchCheckDTO
;
import
com.starcharge.wios.dto.WallboxApplyCheckDTO
;
import
com.starcharge.wios.dto.WallboxApplyDetailQueryDTO
;
import
com.starcharge.wios.vo.WallboxApplyCheckVO
;
import
com.starcharge.wios.vo.WallboxApplyDetailVO
;
import
com.starcharge.wios.vo.WallboxApplyInstallInfoVO
;
import
com.starcharge.wios.vo.WallboxApplyInstallListVO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* <p>
* description
* <p>
*
* @author <a href="mail to: ning.chai@foxmail.com" rel="nofollow">chaining</a>
*/
@Service
public
class
WallboxApplyService
{
@Autowired
private
WallboxApplyMapper
wallboxApplyMapper
;
@Autowired
private
OrderDao
orderDao
;
@Autowired
private
OrderInstallDao
orderInstallDao
;
@Autowired
private
TokenService
tokenService
;
@Autowired
private
SupplierDao
supplierDao
;
@Autowired
private
SupplierStaffDao
supplierStaffDao
;
private
final
Integer
CHECK_STATUS_REJECT
=
2
;
/**
* 查询墙盒申请
*
* @param id 墙盒申请主键
* @return 墙盒申请
*/
public
WallboxApplyInstallInfoVO
selectWallboxApplyById
(
Long
id
)
{
return
wallboxApplyMapper
.
selectWallboxApplyById
(
id
);
}
/**
* 墙盒详情(墙盒状态)
*
* @param orderId 订单id
* @return 墙盒申请
*/
public
WallboxApplyDetailVO
selectWallboxDetail
(
String
orderId
)
{
SessionInfo
loginUser
=
tokenService
.
getUser
();
String
userId
=
loginUser
.
getUserId
();
List
<
SupplierStaff
>
supplier
=
supplierStaffDao
.
selectByAccountId
(
Integer
.
valueOf
(
userId
));
WallboxApplyDetailQueryDTO
query
=
new
WallboxApplyDetailQueryDTO
();
query
.
setOrderId
(
orderId
);
query
.
setSupplierId
(
supplier
.
stream
().
findFirst
().
get
().
getSupplierId
().
toString
());
return
wallboxApplyMapper
.
selectWallboxDetail
(
query
);
}
/**
* 查询墙盒申请列表
*
* @param WallboxApply 墙盒申请
* @return 墙盒申请
*/
public
List
<
WallboxApply
>
selectWallboxApplyList
(
WallboxApply
WallboxApply
)
{
return
wallboxApplyMapper
.
selectWallboxApplyList
(
WallboxApply
);
}
/**
* 根据订单表查询墙盒申请列表
*
* @param WallboxApply 墙盒申请
* @return 墙盒申请
*/
public
List
<
WallboxApplyInstallListVO
>
selectWallboxApplyListFromOrder
(
WallboxApply
WallboxApply
)
{
List
<
WallboxApplyInstallListVO
>
list
=
wallboxApplyMapper
.
selectWallboxApplyListFromOrder
(
WallboxApply
);
list
.
stream
().
map
(
l
->{
return
l
;
});
return
list
;
}
public
WallboxApply
calculateTimeRemaining
(
WallboxApply
wallboxApply
)
{
return
wallboxApply
;
}
/**
* 新增墙盒申请
*
* @param req 墙盒申请
* @return 结果
*/
public
int
insertWallboxApply
(
WallboxApply
req
)
{
//判断是否可以新增
//validateApplyExists(req.getOrderId());
WallboxApply
condition
=
new
WallboxApply
();
condition
.
setOrderId
(
req
.
getOrderId
());
condition
.
setCheckStatus
(
1L
);
List
<
WallboxApply
>
retList
=
wallboxApplyMapper
.
selectWallboxApplyList
(
condition
);
if
(
CollectionUtils
.
isNotEmpty
(
retList
)){
throw
new
ServiceException
(
"存在已审核通过的安装单,无法重复申请"
);
}
condition
.
setSupplierId
(
req
.
getSupplierId
());
List
<
WallboxApply
>
retList2
=
wallboxApplyMapper
.
selectWallboxApplyList
(
condition
);
if
(
CollectionUtils
.
isNotEmpty
(
retList2
)){
throw
new
ServiceException
(
"该订单已申请"
);
}
//补全相关信息
Order
order
=
orderDao
.
selectById
(
req
.
getOrderId
());
req
.
setRegionId
(
order
.
getRegionId
());
String
wallboxModel
=
order
.
getWallboxModel
();
if
(
StrUtil
.
isBlank
(
wallboxModel
))
{
throw
new
ServiceException
(
"订单数据异常,缺失墙盒信息,请联系系统管理员"
);
}
req
.
setWallboxItemId
(
order
.
getWallboxModel
());
req
.
setWallboxModel
(
order
.
getWallboxModel
()
==
null
?
""
:
order
.
getWallboxModel
());
req
.
setOutOrderId
(
order
.
getOutOrderId
());
req
.
setInstallReserveTime
(
order
.
getInstallReserveTime
());
req
.
setAddress
(
order
.
getAddress
());
req
.
setTrackingNumber
(
order
.
getShipno
());
req
.
setInstallProcess
(
Integer
.
toUnsignedLong
(
order
.
getStatus
()));
req
.
setInstallStatus
(
Integer
.
toString
(
order
.
getStatus
()));
req
.
setOutOrderId
(
order
.
getOutOrderId
());
return
wallboxApplyMapper
.
insertWallboxApply
(
req
);
}
/**
* 新增墙盒申请
*
* @param orderId 订单号
* @return 结果
*/
public
int
insertWallboxApply
(
int
orderId
)
{
//判断订单状态
// orderInstallDao.selectByOrderId()
return
0
;
}
/**
* 修改墙盒申请
*
* @return 结果
*/
public
int
updateWallboxApply
(
WallboxApply
wallboxApply
)
{
WallboxApply
record
=
wallboxApplyMapper
.
selectWallboxApplyByOrderId
(
wallboxApply
.
getOutOrderId
());
// if (!CHECK_STATUS_REJECT.equals(record.getCheckStatus())) {
// throw new ServiceException("非驳回状态订单无法修改信息!");
// }
wallboxApply
.
setCheckTime
(
new
Date
());
return
wallboxApplyMapper
.
updateWallboxApply
(
wallboxApply
);
}
/**
* 审核
* @param req
* @return
*/
public
int
checkWallboxApply
(
WallboxApplyCheckVO
req
){
WallboxApply
cond
=
new
WallboxApply
();
cond
.
setOrderId
(
req
.
getOrderId
());
List
<
WallboxApply
>
list
=
wallboxApplyMapper
.
selectWallboxApplyList
(
cond
);
List
<
WallboxApply
>
filteredList
=
list
.
stream
()
.
filter
(
l
->
l
.
getCheckStatus
()
==
2
)
.
collect
(
Collectors
.
toList
());
if
(!
filteredList
.
isEmpty
())
{
throw
new
ServiceException
(
"同订单已审核"
);
}
WallboxApply
update
=
new
WallboxApply
();
update
.
setId
(
req
.
getId
());
update
.
setOrderId
(
req
.
getOrderId
());
update
.
setCheckStatus
(
req
.
getCheckStatus
());
update
.
setCheckRemarks
(
req
.
getCheckRemarks
());
update
.
setCheckTime
(
new
Date
());
update
.
setCheckAccount
(
tokenService
.
getUser
().
getUserId
());
return
wallboxApplyMapper
.
updateWallboxApply
(
update
);
}
/**
* 批量审核
*/
public
WallboxApplyBatchCheckDTO
checkBatch
(
WallboxApplyBatchCheckDTO
req
)
{
List
<
WallboxApplyCheckDTO
>
checkList
=
req
.
getCheckList
();
List
<
WallboxApply
>
toUpdateList
=
new
ArrayList
<>();
boolean
allowedUpdate
=
true
;
for
(
WallboxApplyCheckDTO
wallboxApply
:
checkList
)
{
WallboxApply
cond
=
new
WallboxApply
();
cond
.
setOrderId
(
wallboxApply
.
getOrderId
());
List
<
WallboxApply
>
list
=
wallboxApplyMapper
.
selectWallboxApplyList
(
cond
);
List
<
WallboxApply
>
filteredList
=
list
.
stream
()
.
filter
(
l
->
l
.
getCheckStatus
()
==
2
)
.
collect
(
Collectors
.
toList
());
if
(!
filteredList
.
isEmpty
())
{
wallboxApply
.
setDataStatus
(
"0"
);
wallboxApply
.
setErrorMessage
(
"该订单已审核通过"
);
allowedUpdate
=
false
;
}
if
(
allowedUpdate
){
WallboxApply
update
=
new
WallboxApply
();
update
.
setId
(
wallboxApply
.
getId
());
update
.
setCheckStatus
(
req
.
getCheckStatus
());
update
.
setCheckRemarks
(
req
.
getCheckRemarks
());
update
.
setCheckAccount
(
tokenService
.
getUser
().
getUserId
());
toUpdateList
.
add
(
update
);
}
}
if
(
allowedUpdate
){
// 批量更新操作
toUpdateList
.
forEach
(
l
->
wallboxApplyMapper
.
updateWallboxApply
(
l
));
}
return
req
;
}
void
validateApplyExists
(
String
id
)
{
OrderInstall
orderInstall
=
orderInstallDao
.
selectByOrderId
(
id
);
if
(
ObjectUtil
.
isNull
(
orderInstall
))
{
throw
new
ServiceException
(
"不存在安装单号"
);
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论