Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
shop-Mall
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
licc
shop-Mall
Commits
beb38615
Commit
beb38615
authored
May 08, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增获取产品信息接口
parent
d166f071
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
149 additions
and
30 deletions
+149
-30
LastAccountMapper.java
.../src/main/java/cn/wisenergy/mapper/LastAccountMapper.java
+3
-0
ProductDto.java
...odel/src/main/java/cn/wisenergy/model/dto/ProductDto.java
+87
-0
AntiFakeManger.java
...ain/java/cn/wisenergy/service/Manager/AntiFakeManger.java
+1
-1
AntiFakeService.java
...c/main/java/cn/wisenergy/service/app/AntiFakeService.java
+9
-1
AntiFakeServiceImpl.java
...va/cn/wisenergy/service/app/impl/AntiFakeServiceImpl.java
+31
-23
AntiFakeController.java
...isenergy/web/admin/controller/app/AntiFakeController.java
+18
-5
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/LastAccountMapper.java
View file @
beb38615
...
...
@@ -4,6 +4,9 @@ import cn.wisenergy.model.app.LastMonthAccount;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* @author 86187
*/
public
interface
LastAccountMapper
extends
BaseMapper
<
LastMonthAccount
>
{
/**
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/dto/ProductDto.java
0 → 100644
View file @
beb38615
package
cn
.
wisenergy
.
model
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author 86187
*/
@Data
@ApiModel
(
"ProductDto"
)
public
class
ProductDto
{
/**
* 品牌
*/
@ApiModelProperty
(
value
=
"品牌"
,
name
=
"brand"
)
private
String
brand
;
/**
* 规格
*/
@ApiModelProperty
(
value
=
"规格"
,
name
=
"specification"
)
private
String
specification
;
/**
* 品牌名
*/
@ApiModelProperty
(
value
=
"品牌名"
,
name
=
"brandName"
)
private
String
brandName
;
/**
* 原产国
*/
@ApiModelProperty
(
value
=
"原产国"
,
name
=
"productCountry"
)
private
String
productCountry
;
/**
* 有效时间
*/
@ApiModelProperty
(
value
=
"有效时间"
,
name
=
"validTime"
)
private
Date
validTime
;
/**
* 生产日期 yyyy-MM-dd
*/
@ApiModelProperty
(
value
=
"生产日期 yyyy-MM-dd"
,
name
=
"produceTime"
)
private
String
produceTime
;
/**
* 企业名称
*/
@ApiModelProperty
(
value
=
"企业名称"
,
name
=
"companyName"
)
private
String
companyName
;
/**
* 企业地址
*/
@ApiModelProperty
(
value
=
"企业地址"
,
name
=
"companyAddress"
)
private
String
companyAddress
;
/**
* 企业网址
*/
@ApiModelProperty
(
value
=
"企业网址"
,
name
=
"companyUrl"
)
private
String
companyUrl
;
/**
* 货运单号
*/
@ApiModelProperty
(
value
=
"货运单号"
,
name
=
"trackingNumber"
)
private
String
trackingNumber
;
/**
* 物流轨迹查询平台
*/
@ApiModelProperty
(
value
=
"物流轨迹查询平台"
,
name
=
"logisticsUrl"
)
private
String
logisticsUrl
;
/**
* 海关进境货物备案编号
*/
@ApiModelProperty
(
value
=
"海关进境货物备案编号"
,
name
=
"recordNumber"
)
private
String
recordNumber
;
}
wisenergy-service/src/main/java/cn/wisenergy/service/Manager/AntiFakeManger.java
View file @
beb38615
...
...
@@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.util.
List
;
import
java.util.
*
;
/**
* @author 86187
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/AntiFakeService.java
View file @
beb38615
...
...
@@ -2,8 +2,10 @@ package cn.wisenergy.service.app;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.app.AntiFake
;
import
cn.wisenergy.model.app.ProductInfo
;
import
cn.wisenergy.model.dto.AntiFakeQuery
;
import
cn.wisenergy.model.dto.CreateCodeVo
;
import
cn.wisenergy.model.dto.ProductDto
;
import
com.github.pagehelper.PageInfo
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -55,5 +57,11 @@ public interface AntiFakeService {
*/
R
<
Boolean
>
report
(
String
batchNumber
,
HttpServletResponse
response
);
void
exportReceivable
(
String
str
,
HttpServletResponse
response
);
/**
* 获取产品信息
* @param shaValue 防伪码
* @return 产品信息
*/
R
<
ProductDto
>
getProductInfo
(
String
shaValue
);
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AntiFakeServiceImpl.java
View file @
beb38615
...
...
@@ -5,16 +5,16 @@ import cn.wisenergy.common.utils.DateUtil;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.common.utils.StringUtil
;
import
cn.wisenergy.mapper.AntiFakeMapper
;
import
cn.wisenergy.mapper.ProductMapper
;
import
cn.wisenergy.model.app.AntiFake
;
import
cn.wisenergy.model.app.ProductInfo
;
import
cn.wisenergy.model.dto.AntiFakeQuery
;
import
cn.wisenergy.model.dto.CreateCodeVo
;
import
cn.wisenergy.model.dto.ProductDto
;
import
cn.wisenergy.model.vo.ReportCodeVo
;
import
cn.wisenergy.service.Manager.AntiFakeManger
;
import
cn.wisenergy.service.app.AntiFakeService
;
import
cn.wisenergy.service.util.CodeUtils
;
import
cn.wisenergy.service.util.ExcelUtils
;
import
cn.wisenergy.service.util.QRCodeUtils
;
import
com.alibaba.excel.EasyExcel
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.github.pagehelper.PageInfo
;
...
...
@@ -45,6 +45,9 @@ public class AntiFakeServiceImpl extends ServiceImpl<AntiFakeMapper, AntiFake> i
@Autowired
private
AntiFakeManger
antiFakeManger
;
@Autowired
private
ProductMapper
productMapper
;
@Override
public
R
<
Boolean
>
createCode
(
CreateCodeVo
codeVo
)
throws
ParseException
{
log
.
info
(
"AntiFakeServiceImpl[]createCode[]input.param.codeVo:"
+
codeVo
);
...
...
@@ -233,33 +236,38 @@ public class AntiFakeServiceImpl extends ServiceImpl<AntiFakeMapper, AntiFake> i
}
@Override
public
void
exportReceivable
(
String
str
,
HttpServletResponse
response
)
{
if
(
StringUtils
.
isBlank
(
str
))
{
return
;
}
//把字符转化为数字
List
<
Long
>
array
=
StringUtil
.
strToLongArray
(
str
);
if
(
CollectionUtils
.
isEmpty
(
array
))
{
return
;
public
R
<
ProductDto
>
getProductInfo
(
String
shaValue
)
{
log
.
info
(
"AntiFakeServiceImpl[]getProductInfo[]input.param.shaValue:"
+
shaValue
);
if
(
StringUtils
.
isBlank
(
shaValue
))
{
return
R
.
error
(
"入参不能为空!"
);
}
//获取防伪码
List
<
AntiFake
>
result
=
antiFakeMapper
.
getProductNos
(
array
);
if
(
CollectionUtils
.
isEmpty
(
result
))
{
return
;
//获取二维码信息
ProductDto
productDto
=
new
ProductDto
();
AntiFake
antiFake
=
antiFakeMapper
.
getByShaValue
(
shaValue
);
if
(
null
!=
antiFake
&&
StringUtils
.
isNotEmpty
(
antiFake
.
getBatchNumber
()))
{
//获取产品信息
ProductInfo
productInfo
=
productMapper
.
getByBatchNumber
(
antiFake
.
getBatchNumber
());
if
(
null
!=
productInfo
)
{
productDto
.
setBrand
(
productInfo
.
getBrand
());
productDto
.
setBrandName
(
productInfo
.
getBrandName
());
productDto
.
setCompanyAddress
(
productInfo
.
getCompanyAddress
());
productDto
.
setCompanyName
(
productInfo
.
getCompanyName
());
productDto
.
setCompanyUrl
(
productInfo
.
getCompanyUrl
());
productDto
.
setLogisticsUrl
(
productInfo
.
getLogisticsUrl
());
productDto
.
setProduceTime
(
antiFake
.
getProduceTime
());
productDto
.
setProductCountry
(
productInfo
.
getProductCountry
());
productDto
.
setRecordNumber
(
productInfo
.
getRecordNumber
());
productDto
.
setSpecification
(
productInfo
.
getSpecification
());
productDto
.
setTrackingNumber
(
productInfo
.
getTrackingNumber
());
productDto
.
setValidTime
(
productInfo
.
getValidTime
());
}
}
List
<
ReportCodeVo
>
resultBo
=
new
ArrayList
<>();
for
(
AntiFake
anti
:
result
)
{
String
url
=
REQUEST_URL
+
anti
.
getShaValue
();
ReportCodeVo
reportCodeVo
=
new
ReportCodeVo
();
reportCodeVo
.
setShaValue
(
url
);
resultBo
.
add
(
reportCodeVo
);
}
ExcelUtils
.
export
(
response
,
resultBo
,
"aadfgh"
,
ReportCodeVo
.
class
);
return
R
.
ok
(
productDto
);
}
/**
* 分页处理方法
*
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/AntiFakeController.java
View file @
beb38615
...
...
@@ -2,8 +2,10 @@ package cn.wisenergy.web.admin.controller.app;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.app.AntiFake
;
import
cn.wisenergy.model.app.ProductInfo
;
import
cn.wisenergy.model.dto.AntiFakeQuery
;
import
cn.wisenergy.model.dto.CreateCodeVo
;
import
cn.wisenergy.model.dto.ProductDto
;
import
cn.wisenergy.service.app.AntiFakeService
;
import
com.github.pagehelper.PageInfo
;
import
io.swagger.annotations.Api
;
...
...
@@ -38,18 +40,18 @@ public class AntiFakeController {
@ApiOperation
(
value
=
"扫描防伪二维码"
,
notes
=
"扫描防伪二维码"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"shaValue"
,
value
=
"防伪码"
,
dataType
=
"String"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"securityCode"
,
value
=
"安全码"
,
dataType
=
"String"
,
required
=
true
)
@ApiImplicitParam
(
name
=
"shaValue"
,
value
=
"防伪码"
,
dataType
=
"String"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"securityCode"
,
value
=
"安全码"
,
dataType
=
"String"
,
required
=
true
)
})
@ApiImplicitParam
(
name
=
"shaValue"
,
value
=
"防伪码"
,
dataType
=
"String"
)
@GetMapping
(
"/admin/scanCode"
)
public
R
<
String
>
scanCode
(
String
shaValue
,
String
securityCode
)
{
log
.
info
(
"shop-mall[]AntiFakeController[]scanCode[]input.param.shaValue:"
+
shaValue
,
securityCode
);
public
R
<
String
>
scanCode
(
String
shaValue
,
String
securityCode
)
{
log
.
info
(
"shop-mall[]AntiFakeController[]scanCode[]input.param.shaValue:"
+
shaValue
,
securityCode
);
if
(
StringUtils
.
isBlank
(
shaValue
))
{
return
R
.
error
(
"入参为空!"
);
}
return
antiFakeService
.
scanCode
(
shaValue
,
securityCode
);
return
antiFakeService
.
scanCode
(
shaValue
,
securityCode
);
}
...
...
@@ -77,5 +79,16 @@ public class AntiFakeController {
return
antiFakeService
.
report
(
batchNumber
,
response
);
}
@ApiOperation
(
value
=
"获取产品信息"
,
notes
=
"获取产品信息"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"shaValue"
,
value
=
"防伪码"
,
dataType
=
"String"
,
required
=
true
)
@GetMapping
(
"admin/productInfo"
)
public
R
<
ProductDto
>
getProductInfo
(
String
shaValue
)
{
log
.
info
(
"shop-mall[]AntiFakeController[]getProductInfo[]input.param.shaValue:"
+
shaValue
);
if
(
StringUtils
.
isBlank
(
shaValue
))
{
return
R
.
error
(
"入参为空!"
);
}
return
antiFakeService
.
getProductInfo
(
shaValue
);
}
}
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