Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Fedex
/
iClear-api
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
zelong.shao
2023-08-10 15:14:20 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e97cca0d42520deb237c4f4b8767a2dd7085e129
e97cca0d
1 parent
0df1efa3
C类限制类品名校验修改与应用一致
2023年8月10日15:14:06 szl
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
183 additions
and
24 deletions
src/main/java/com/erry/iclear/dateInterface/dto/HsCodeAndDescriptionDto.java
src/main/java/com/erry/iclear/dateInterface/entity/HsCodeAndDescription.java
src/main/java/com/erry/iclear/dateInterface/repository/HsCodeAndDescriptionRepository.java
src/main/java/com/erry/iclear/dateInterface/service/HsCodeService.java
src/main/java/com/erry/iclear/dateInterface/dto/HsCodeAndDescriptionDto.java
0 → 100644
View file @
e97cca0
package
com
.
erry
.
iclear
.
dateInterface
.
dto
;
import
com.erry.iclear.dateInterface.entity.HsCodeAndDescription
;
import
com.erry.iclear.dateInterface.entity.SysUser
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
HsCodeAndDescriptionDto
{
private
Long
id
;
private
String
a
;
private
String
b
;
/***
* 类型
* 1表示hsCode清单
* 2表示品名品名清单
*/
private
int
type
;
//用户
private
SysUser
sysUser
;
private
Date
createTime
;
private
String
errorMsg
;
private
String
rowNum
;
public
HsCodeAndDescriptionDto
()
{
}
public
HsCodeAndDescriptionDto
(
HsCodeAndDescription
hsCodeAndDescription
)
{
this
.
setId
(
hsCodeAndDescription
.
getId
());
this
.
setA
(
hsCodeAndDescription
.
getA
());
this
.
setB
(
hsCodeAndDescription
.
getB
());
this
.
setType
(
hsCodeAndDescription
.
getType
());
this
.
setSysUser
(
hsCodeAndDescription
.
getSysUser
());
this
.
setCreateTime
(
hsCodeAndDescription
.
getCreateTime
());
}
}
\ No newline at end of file
src/main/java/com/erry/iclear/dateInterface/entity/HsCodeAndDescription.java
0 → 100644
View file @
e97cca0
package
com
.
erry
.
iclear
.
dateInterface
.
entity
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.Data
;
import
javax.persistence.*
;
import
java.util.Date
;
@Entity
@Table
(
name
=
"T_AU_HSCODE_DESCRIPTION"
)
@Data
public
class
HsCodeAndDescription
{
private
static
final
long
serialVersionUID
=
1L
;
@Id
@GeneratedValue
@Column
(
name
=
"ID"
)
private
Long
id
;
@Column
(
name
=
"A"
)
private
String
a
;
@Column
(
name
=
"B"
)
private
String
b
;
/***
* 类型
* 1表示hsCode清单
* 2表示品名品名清单
*/
@Column
(
name
=
"TYPE"
)
private
int
type
;
//用户
@JsonIgnore
@ManyToOne
(
targetEntity
=
SysUser
.
class
)
@JoinColumn
(
name
=
"USER_ID"
)
private
SysUser
sysUser
;
//创建时间
@Column
(
name
=
"CREATETIME"
)
private
Date
createTime
;
}
src/main/java/com/erry/iclear/dateInterface/repository/HsCodeAndDescriptionRepository.java
0 → 100644
View file @
e97cca0
package
com
.
erry
.
iclear
.
dateInterface
.
repository
;
import
com.erry.iclear.dateInterface.entity.HsCodeAndDescription
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
interface
HsCodeAndDescriptionRepository
extends
JpaSpecificationExecutor
<
HsCodeAndDescription
>,
JpaRepository
<
HsCodeAndDescription
,
Long
>
{
@Query
(
nativeQuery
=
true
,
value
=
"select * from T_AU_HSCODE_DESCRIPTION where TYPE = ?1 "
)
public
List
<
HsCodeAndDescription
>
selectAndType
(
int
type
);
}
src/main/java/com/erry/iclear/dateInterface/service/HsCodeService.java
View file @
e97cca0
package
com
.
erry
.
iclear
.
dateInterface
.
service
;
import
com.erry.iclear.dateInterface.enums.ErrorCodeEnum
;
import
com.erry.iclear.dateInterface.api.request.HsCodeParam
;
import
com.erry.iclear.dateInterface.api.response.ResultHsCode
;
import
com.erry.iclear.dateInterface.common.Constant
;
import
com.erry.iclear.dateInterface.dto.HsCodeAndDescriptionDto
;
import
com.erry.iclear.dateInterface.entity.HsCode
;
import
com.erry.iclear.dateInterface.entity.HsCodeAndDescription
;
import
com.erry.iclear.dateInterface.enums.ErrorCodeEnum
;
import
com.erry.iclear.dateInterface.repository.DictionaryEntriesRepository
;
import
com.erry.iclear.dateInterface.repository.HsCodeAndDescriptionRepository
;
import
com.erry.iclear.dateInterface.repository.HsCodeRepository
;
import
com.erry.iclear.dateInterface.util.StringUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.math.BigDecimal
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* hscode service
...
...
@@ -27,6 +34,8 @@ public class HsCodeService {
HsCodeRepository
hsCodeRepository
;
@Autowired
DictionaryEntriesRepository
dicEntriesRepository
;
@Autowired
HsCodeAndDescriptionRepository
hsCodeAndDescriptionRepository
;
/**
* 根据hscode编码查询对应的hscode
...
...
@@ -168,29 +177,73 @@ public class HsCodeService {
* 2023年2月24日17:29:49
*/
public
void
setHscodeSupervise
(
List
<
HsCode
>
hsCodeList
){
List
<
Long
>
hsCodeIds
=
new
ArrayList
<>();
Map
<
String
,
Object
>
hscodeMap
=
this
.
getHscodeSupervise
();
StringBuffer
shsql
=
new
StringBuffer
(
"'"
);
if
(
hscodeMap
!=
null
&&
hscodeMap
.
size
()>
0
){
for
(
Map
.
Entry
hscodeEntry
:
hscodeMap
.
entrySet
()){
HsCode
hsCode
=
(
HsCode
)
hscodeEntry
.
getValue
();
hsCodeIds
.
add
(
hsCode
.
getId
());
}
for
(
HsCode
hsCode
:
hsCodeList
)
{
Map
<
String
,
Object
>
hscodeMap
=
new
HashMap
<>();
hscodeMap
.
put
(
"success"
,
false
);
Map
hsCodeAndDescription1
=
new
HashMap
();
List
<
HsCodeAndDescription
>
hsCodeAndDescriptionList
=
hsCodeAndDescriptionRepository
.
selectAndType
(
1
);
if
(
hsCodeAndDescriptionList
.
size
()
>
0
)
{
for
(
HsCodeAndDescription
hsCodeAndDescription
:
hsCodeAndDescriptionList
)
{
HsCodeAndDescriptionDto
hsCodeAndDescriptionDto
=
new
HsCodeAndDescriptionDto
(
hsCodeAndDescription
);
hsCodeAndDescription1
.
put
(
hsCodeAndDescriptionDto
.
getB
(),
hsCodeAndDescriptionDto
);
}
}
Boolean
isTrue
=
false
;
if
(
hsCode
!=
null
){
if
(
hsCodeAndDescription1
.
size
()>
0
){
String
fieldValue
=
getSubHscode
(
hsCode
.
getSkuCode
());
if
(
hsCodeAndDescription1
.
size
()>
0
&&
!
StringUtil
.
isEmptyWithTrim
(
fieldValue
)){
//hsCodeAndDescription1.get(fieldValue);
if
(
hsCodeAndDescription1
.
get
(
fieldValue
)
!=
null
){
isTrue
=
true
;
}
}
}
List
<
String
>
dictionaryEntriesList
=
dicEntriesRepository
.
findDicEntByCodeList
(
Constant
.
supervise_condition
,
1
);
if
(
dictionaryEntriesList
!=
null
&&
dictionaryEntriesList
.
size
()
>
0
){
for
(
String
str
:
dictionaryEntriesList
){
if
(!
StringUtil
.
isEmptyWithTrim
(
hsCode
.
getMonitorCondition
())
||
hsCode
.
getOutRate
()
!=
null
){
if
(
hsCode
.
getMonitorCondition
().
indexOf
(
str
)
>
-
1
||
hsCode
.
getOutRate
().
compareTo
(
BigDecimal
.
valueOf
(
0
))
>
0
){
isTrue
=
true
;
}
}
}
}
if
(
isTrue
){
hsCode
.
setRestrictedC
(
1
);
}
else
{
hsCode
.
setRestrictedC
(
0
);
}
if
(
hsCode
.
getId
()==
null
){
hsCode
.
setRestrictedC
(
null
);
}
}
}
hsCodeList
.
forEach
(
hsCode
->{
//判断该hscode是否只能申报D类
if
(
hsCodeIds
.
contains
(
hsCode
.
getId
())){
//d类
hsCode
.
setRestrictedC
(
1
);
}
else
{
//C类
hsCode
.
setRestrictedC
(
0
);
}
//如果ID为空,则设置为空
if
(
hsCode
.
getId
()
==
null
){
hsCode
.
setRestrictedC
(
null
);
}
});
// List<Long> hsCodeIds = new ArrayList<>();
// Map<String,Object> hscodeMap = this.getHscodeSupervise();
// StringBuffer shsql = new StringBuffer("'");
// if (hscodeMap !=null && hscodeMap.size()>0){
// for (Map.Entry hscodeEntry :hscodeMap.entrySet()){
// HsCode hsCode = (HsCode) hscodeEntry.getValue();
// hsCodeIds.add(hsCode.getId());
// }
// }
// hsCodeList.forEach(hsCode->{
// //判断该hscode是否只能申报D类
// if(hsCodeIds.contains(hsCode.getId())){
// //d类
// hsCode.setRestrictedC(1);
// }else{
// //C类
// hsCode.setRestrictedC(0);
// }
// //如果ID为空,则设置为空
// if(hsCode.getId() == null){
// hsCode.setRestrictedC(null);
// }
// });
}
/**
...
...
Please
register
or
login
to post a comment