Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1-office-web-sit
Overview
Overview
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
吴迪
gs1-office-web-sit
Commits
93acf01f
Commit
93acf01f
authored
Dec 10, 2021
by
wangtian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增条咨询中心→物流→条形码生成功能
parent
7e3274e6
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
845 additions
and
0 deletions
+845
-0
pom.xml
pom.xml
+35
-0
BarcodeController.java
...o/office/modules/manage/controller/BarcodeController.java
+231
-0
BarcodeGenerationController.java
...odules/manage/controller/BarcodeGenerationController.java
+63
-0
ProductController.java
...o/office/modules/manage/controller/ProductController.java
+3
-0
UserFunctionBindingController.java
...ules/manage/controller/UserFunctionBindingController.java
+7
-0
QRcodeDao.java
src/main/java/io/office/modules/manage/dao/QRcodeDao.java
+13
-0
GS1CodeListEntity.java
...va/io/office/modules/manage/entity/GS1CodeListEntity.java
+68
-0
BarcodeGenerationService.java
...fice/modules/manage/service/BarcodeGenerationService.java
+22
-0
BarcodeGenerationServiceImpl.java
...les/manage/service/impl/BarcodeGenerationServiceImpl.java
+41
-0
CheckAICodeUtil.java
.../java/io/office/modules/manage/utils/CheckAICodeUtil.java
+59
-0
CheckAIVo.java
...n/java/io/office/modules/manage/vo/request/CheckAIVo.java
+27
-0
MANIFEST.MF
...s/lib/barcode4j-light-2.2.0-SNAPSHOT/META-INF/MANIFEST.MF
+5
-0
pom.properties
...INF/maven/net.sf.barcode4j/barcode4j-light/pom.properties
+7
-0
pom.xml
...T/META-INF/maven/net.sf.barcode4j/barcode4j-light/pom.xml
+39
-0
org.krysalis.barcode4j.BarcodeGenerator
...META-INF/services/org.krysalis.barcode4j.BarcodeGenerator
+16
-0
EAN128AIs.properties
.../org/krysalis/barcode4j/impl/code128/EAN128AIs.properties
+126
-0
usps-4bc-bar-to-character-table.csv
...code4j/impl/fourstate/usps-4bc-bar-to-character-table.csv
+65
-0
OCR-B 10 BT.ttf
...SHOT/org/krysalis/barcode4j/output/java2d/OCR-B 10 BT.ttf
+0
-0
QRcodeDao.xml
src/main/resources/mapper/manage/QRcodeDao.xml
+18
-0
No files found.
pom.xml
View file @
93acf01f
...
...
@@ -272,6 +272,41 @@
<version>
1.4.7
</version>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang3
</artifactId>
<version>
3.5
</version>
</dependency>
<dependency>
<groupId>
code
</groupId>
<artifactId>
code
</artifactId>
<version>
1.1
</version>
<scope>
system
</scope>
<systemPath>
${project.basedir}/src/main/resources/lib/code.jar
</systemPath>
</dependency>
<dependency>
<groupId>
barcode4j-2.2.0-SNAPSHOT
</groupId>
<artifactId>
barcode4j-2.2.0-SNAPSHOT
</artifactId>
<version>
1.1
</version>
<scope>
system
</scope>
<systemPath>
${project.basedir}/src/main/resources/lib/barcode4j-2.2.0-SNAPSHOT.jar
</systemPath>
</dependency>
<dependency>
<groupId>
barcode4j-light-2.2.0-SNAPSHOT
</groupId>
<artifactId>
barcode4j-light-2.2.0-SNAPSHOT
</artifactId>
<version>
1.1
</version>
<scope>
system
</scope>
<systemPath>
${project.basedir}/src/main/resources/lib/barcode4j-light-2.2.0-SNAPSHOT.jar
</systemPath>
</dependency>
<dependency>
<groupId>
barcode4j-spi-2.2.0-SNAPSHOT
</groupId>
<artifactId>
barcode4j-spi-2.2.0-SNAPSHOT
</artifactId>
<version>
1.1
</version>
<scope>
system
</scope>
<systemPath>
${project.basedir}/src/main/resources/lib/barcode4j-spi-2.2.0-SNAPSHOT.jar
</systemPath>
</dependency>
</dependencies>
<build>
...
...
src/main/java/io/office/modules/manage/controller/BarcodeController.java
0 → 100644
View file @
93acf01f
package
io
.
office
.
modules
.
manage
.
controller
;
import
com.github.mbhk.barcode4j.Configuration
;
import
io.office.modules.app.annotation.Login
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.krysalis.barcode4j.BarcodeException
;
import
org.krysalis.barcode4j.BarcodeGenerator
;
import
org.krysalis.barcode4j.BarcodeUtil
;
import
org.krysalis.barcode4j.output.Orientation
;
import
org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider
;
import
org.krysalis.barcode4j.output.eps.EPSCanvasProvider
;
import
org.krysalis.barcode4j.output.svg.SVGCanvasProvider
;
import
org.krysalis.barcode4j.tools.MimeTypes
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.xml.transform.*
;
import
java.awt.image.BufferedImage
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
/**
* 生成一维码方法
*
* @author zyf
* @email
* @date 2021-12-09 15:22:24
*/
@RestController
@RequestMapping
(
"barcode"
)
public
class
BarcodeController
{
private
final
Log
logger
=
LogFactory
.
getLog
(
getClass
());
public
Log
getLogger
()
{
return
logger
;
}
/** Parameter name for the message */
public
static
final
String
BARCODE_MSG
=
"msg"
;
/** Parameter name for the barcode type */
public
static
final
String
BARCODE_TYPE
=
"type"
;
/** Parameter name for the barcode height */
public
static
final
String
BARCODE_HEIGHT
=
"height"
;
/** Parameter name for the module width */
public
static
final
String
BARCODE_MODULE_WIDTH
=
"mw"
;
/** Parameter name for the wide factor */
public
static
final
String
BARCODE_WIDE_FACTOR
=
"wf"
;
/** Parameter name for the quiet zone */
public
static
final
String
BARCODE_QUIET_ZONE
=
"qz"
;
/** Parameter name for the human-readable placement */
public
static
final
String
BARCODE_HUMAN_READABLE_POS
=
"hrp"
;
/** Parameter name for the output format */
public
static
final
String
BARCODE_FORMAT
=
"fmt"
;
/** Parameter name for the image resolution (for bitmaps) */
public
static
final
String
BARCODE_IMAGE_RESOLUTION
=
"res"
;
/** Parameter name for the grayscale or b/w image (for bitmaps) */
public
static
final
String
BARCODE_IMAGE_GRAYSCALE
=
"gray"
;
/** Parameter name for the font size of the human readable display */
public
static
final
String
BARCODE_HUMAN_READABLE_SIZE
=
"hrsize"
;
/** Parameter name for the font name of the human readable display */
public
static
final
String
BARCODE_HUMAN_READABLE_FONT
=
"hrfont"
;
/** Parameter name for the pattern to format the human readable message */
public
static
final
String
BARCODE_HUMAN_READABLE_PATTERN
=
"hrpattern"
;
private
static
final
String
ERROR_WHILE_GENERATING_BARCODE
=
"Error while generating barcode"
;
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
BarcodeController
.
class
.
getName
());
@Login
@GetMapping
(
value
=
"/api/gensvg"
)
public
void
getBarcode
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
try
{
System
.
out
.
println
(
"barcode................"
);
final
String
format
=
determineFormat
(
request
);
final
Orientation
orientation
=
Orientation
.
ZERO
;
final
Configuration
cfg
=
buildCfg
(
request
);
String
msg
=
request
.
getParameter
(
BARCODE_MSG
);
if
(
msg
==
null
)
{
msg
=
"0123456789"
;
}
String
type
=
request
.
getParameter
(
BARCODE_TYPE
);
if
(
type
==
null
||
type
.
trim
().
isEmpty
())
{
type
=
"code128"
;
}
final
BarcodeUtil
util
=
BarcodeUtil
.
getInstance
();
final
BarcodeGenerator
gen
=
util
.
createBarcodeGenerator
(
cfg
);
final
ByteArrayOutputStream
bout
=
new
ByteArrayOutputStream
(
4096
);
try
{
if
(
format
.
equals
(
MimeTypes
.
MIME_SVG
))
{
// Create Barcode and render it to SVG
final
SVGCanvasProvider
svg
=
new
SVGCanvasProvider
(
true
,
orientation
);
gen
.
generateBarcode
(
svg
,
msg
);
final
org
.
w3c
.
dom
.
DocumentFragment
frag
=
svg
.
getDOMFragment
();
// Serialize SVG barcode
final
TransformerFactory
factory
=
TransformerFactory
.
newInstance
();
final
Transformer
trans
=
factory
.
newTransformer
();
final
Source
src
=
new
javax
.
xml
.
transform
.
dom
.
DOMSource
(
frag
);
final
Result
res
=
new
javax
.
xml
.
transform
.
stream
.
StreamResult
(
bout
);
trans
.
transform
(
src
,
res
);
}
else
if
(
format
.
equals
(
MimeTypes
.
MIME_EPS
))
{
final
EPSCanvasProvider
eps
=
new
EPSCanvasProvider
(
bout
,
orientation
);
gen
.
generateBarcode
(
eps
,
msg
);
eps
.
finish
();
}
else
{
final
String
resText
=
request
.
getParameter
(
BARCODE_IMAGE_RESOLUTION
);
int
resolution
=
300
;
// dpi
if
(
resText
!=
null
)
{
resolution
=
Integer
.
parseInt
(
resText
);
}
if
(
resolution
>
2400
)
{
throw
new
IllegalArgumentException
(
"Resolutions above 2400dpi are not allowed"
);
}
if
(
resolution
<
10
)
{
throw
new
IllegalArgumentException
(
"Minimum resolution must be 10dpi"
);
}
final
String
gray
=
request
.
getParameter
(
BARCODE_IMAGE_GRAYSCALE
);
final
BitmapCanvasProvider
bitmap
=
"true"
.
equalsIgnoreCase
(
gray
)
?
new
BitmapCanvasProvider
(
bout
,
format
,
resolution
,
BufferedImage
.
TYPE_BYTE_GRAY
,
true
,
orientation
)
:
new
BitmapCanvasProvider
(
bout
,
format
,
resolution
,
BufferedImage
.
TYPE_BYTE_BINARY
,
false
,
orientation
);
gen
.
generateBarcode
(
bitmap
,
msg
);
bitmap
.
finish
();
}
}
finally
{
bout
.
close
();
}
response
.
setContentType
(
format
);
response
.
setContentLength
(
bout
.
size
());
response
.
getOutputStream
().
write
(
bout
.
toByteArray
());
response
.
getOutputStream
().
flush
();
}
catch
(
BarcodeException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
ERROR_WHILE_GENERATING_BARCODE
,
e
);
throw
new
ServletException
(
e
);
}
catch
(
TransformerException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
ERROR_WHILE_GENERATING_BARCODE
,
e
);
throw
new
ServletException
(
e
);
}
catch
(
IOException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
ERROR_WHILE_GENERATING_BARCODE
,
e
);
throw
new
ServletException
(
e
);
}
catch
(
IllegalArgumentException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
ERROR_WHILE_GENERATING_BARCODE
,
e
);
throw
new
ServletException
(
e
);
}
}
/**
* Check the request for the desired output format.
*
* @param request
* the request to use
* @return MIME type of the desired output format.
*/
protected
String
determineFormat
(
HttpServletRequest
request
)
{
String
format
=
request
.
getParameter
(
BARCODE_FORMAT
);
format
=
MimeTypes
.
expandFormat
(
format
);
if
(
format
==
null
)
{
format
=
MimeTypes
.
MIME_SVG
;
}
return
format
;
}
/**
* Build an Configuration object from the request.
*
* @param request
* the request to use
* @return the newly built COnfiguration object
*
*/
protected
Configuration
buildCfg
(
HttpServletRequest
request
)
{
// Get type
String
type
=
request
.
getParameter
(
BARCODE_TYPE
);
if
(
type
==
null
||
type
.
trim
().
isEmpty
())
{
type
=
"code128"
;
}
final
Configuration
cfg
=
new
Configuration
(
type
);
// Get additional attributes
final
String
height
=
request
.
getParameter
(
BARCODE_HEIGHT
);
final
String
moduleWidth
=
request
.
getParameter
(
BARCODE_MODULE_WIDTH
);
final
String
wideFactor
=
request
.
getParameter
(
BARCODE_WIDE_FACTOR
);
if
(
height
!=
null
)
cfg
.
addChild
(
new
Configuration
(
"height"
,
height
));
if
(
moduleWidth
!=
null
)
cfg
.
addChild
(
new
Configuration
(
"module-width"
,
moduleWidth
));
if
(
wideFactor
!=
null
)
cfg
.
addChild
(
new
Configuration
(
"wide-factor"
,
wideFactor
));
final
String
quietZone
=
request
.
getParameter
(
BARCODE_QUIET_ZONE
);
if
(
quietZone
!=
null
)
{
final
Configuration
quietCfg
=
new
Configuration
(
"quiet-zone"
,
quietZone
);
quietCfg
.
setAttribute
(
"enabled"
,
quietZone
.
startsWith
(
"disable"
)
?
"false"
:
"true"
);
cfg
.
addChild
(
quietCfg
);
}
// creating human readable configuration according to the new Barcode
// Element Mappings
// where the human-readable has children for font name, font size,
// placement and
// custom pattern.
final
String
barcodePattern
=
request
.
getParameter
(
BARCODE_HUMAN_READABLE_PATTERN
);
final
String
readableSize
=
request
.
getParameter
(
BARCODE_HUMAN_READABLE_SIZE
);
final
String
readableFont
=
request
.
getParameter
(
BARCODE_HUMAN_READABLE_FONT
);
final
String
readablePos
=
request
.
getParameter
(
BARCODE_HUMAN_READABLE_POS
);
if
(!(
barcodePattern
==
null
&&
readableSize
==
null
&&
readableFont
==
null
&&
readablePos
==
null
))
{
final
Configuration
attr
=
new
Configuration
(
"human-readable"
);
if
(
barcodePattern
!=
null
)
attr
.
addChild
(
new
Configuration
(
"pattern"
,
barcodePattern
));
if
(
readableSize
!=
null
)
attr
.
addChild
(
new
Configuration
(
"font-size"
,
readableSize
));
if
(
readableFont
!=
null
)
attr
.
addChild
(
new
Configuration
(
"font-name"
,
readableFont
));
if
(
readablePos
!=
null
)
attr
.
addChild
(
new
Configuration
(
"placement"
,
readablePos
));
cfg
.
addChild
(
attr
);
}
return
cfg
;
}
}
src/main/java/io/office/modules/manage/controller/BarcodeGenerationController.java
0 → 100644
View file @
93acf01f
package
io
.
office
.
modules
.
manage
.
controller
;
import
io.office.common.utils.R
;
import
io.office.modules.app.annotation.Login
;
import
io.office.modules.manage.entity.GS1CodeListEntity
;
import
io.office.modules.manage.service.BarcodeGenerationService
;
import
io.office.modules.manage.utils.CheckAICodeUtil
;
import
io.office.modules.manage.vo.request.CheckAIVo
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
java.util.List
;
import
java.util.Map
;
/**
* ${条码生成}
*
* @author zyf
* @email
* @date 2021-12-09 15:26:10
*/
@RestController
@RequestMapping
(
"/barcodegeneration"
)
public
class
BarcodeGenerationController
{
@Autowired
private
BarcodeGenerationService
barcodeGenerationService
;
/**
* 条码生成
* @param param 条码内容
* @return pictureUrl 获取条形码地址
*/
@Login
@PostMapping
(
"/api/createQRcode"
)
public
R
createQRcode
(
@RequestBody
Map
<
String
,
String
>
param
)
{
String
url
=
this
.
barcodeGenerationService
.
createPicture
(
param
.
get
(
"content"
));
return
R
.
ok
().
put
(
"pictureUrl"
,
url
);
}
@Login
@ApiOperation
(
value
=
"SSCC方式获取GS1 AI标识符列表"
,
response
=
GS1CodeListEntity
.
class
)
@PostMapping
(
"/api/getGS1CodeListSSCC"
)
public
R
getGS1CodeListSSCC
()
{
List
<
GS1CodeListEntity
>
ais
=
barcodeGenerationService
.
getGS1CodeListSSCC
();
return
R
.
ok
().
put
(
"ais"
,
ais
);
}
@Login
@ApiOperation
(
value
=
"GRAI方式获取GS1 AI标识符"
,
response
=
GS1CodeListEntity
.
class
)
@PostMapping
(
"/api/getGS1CodeListGRAI"
)
public
R
getGS1CodeListGRAI
()
{
GS1CodeListEntity
ai
=
barcodeGenerationService
.
getGS1CodeListGRAI
();
return
R
.
ok
().
put
(
"ai"
,
ai
);
}
@Login
@ApiOperation
(
value
=
"校验GS1 AI标识符"
)
@PostMapping
(
"/api/checkGS1Code"
)
public
R
checkGS1Code
(
@ApiParam
(
required
=
true
)
@Valid
@RequestBody
CheckAIVo
body
)
{
String
result
=
CheckAICodeUtil
.
ckeckCode
(
body
.
getCode
(),
body
.
getContent
());
return
R
.
ok
().
put
(
"result"
,
result
);
}
}
src/main/java/io/office/modules/manage/controller/ProductController.java
View file @
93acf01f
...
...
@@ -5,6 +5,8 @@ import java.util.List;
import
java.util.Map
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.office.common.utils.RedisKeys
;
import
io.office.modules.app.annotation.Login
;
import
io.office.modules.manage.entity.NewsEntity
;
import
io.office.modules.sys.controller.AbstractController
;
import
io.swagger.models.auth.In
;
...
...
@@ -119,6 +121,7 @@ public class ProductController extends AbstractController {
* @param param:分页参数
* @return
*/
@Login
@RequestMapping
(
"/api/findPage"
)
// @RequiresPermissions("manage:product:findPage")
public
R
findPage
(
@RequestBody
Map
<
String
,
String
>
param
){
...
...
src/main/java/io/office/modules/manage/controller/UserFunctionBindingController.java
View file @
93acf01f
...
...
@@ -5,6 +5,7 @@ import java.util.Arrays;
import
java.util.List
;
import
java.util.Map
;
import
io.office.modules.app.annotation.Login
;
import
io.office.modules.sys.controller.AbstractController
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -38,6 +39,7 @@ public class UserFunctionBindingController extends AbstractController {
/**
* 查询
*/
@Login
@RequestMapping
(
"/api/find"
)
public
R
find
(){
Integer
id
=
getUserId
().
intValue
();
...
...
@@ -50,6 +52,7 @@ public class UserFunctionBindingController extends AbstractController {
/**
* 修改
*/
@Login
@RequestMapping
(
"/api/update"
)
// @RequiresPermissions("manage:userfunctionbinding:update")
public
R
update
(
@RequestBody
Integer
[]
functionids
){
...
...
@@ -63,6 +66,7 @@ public class UserFunctionBindingController extends AbstractController {
/**
* 保存
*/
@Login
@RequestMapping
(
"/api/save"
)
// @RequiresPermissions("manage:userfunctionbinding:save")
public
R
save
(
@RequestBody
Integer
[]
functionids
){
...
...
@@ -78,6 +82,7 @@ public class UserFunctionBindingController extends AbstractController {
/**
* 列表
*/
@Login
@RequestMapping
(
"/api/list"
)
// @RequiresPermissions("manage:userfunctionbinding:list")
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
...
...
@@ -88,6 +93,7 @@ public class UserFunctionBindingController extends AbstractController {
/**
* 信息
*/
@Login
@RequestMapping
(
"/api/info/{id}"
)
// @RequiresPermissions("manage:userfunctionbinding:info")
public
R
info
(
@PathVariable
(
"id"
)
Integer
id
){
...
...
@@ -98,6 +104,7 @@ public class UserFunctionBindingController extends AbstractController {
/**
* 删除
*/
@Login
@RequestMapping
(
"/delete"
)
// @RequiresPermissions("manage:userfunctionbinding:delete")
public
R
delete
(
@RequestBody
Integer
[]
ids
){
...
...
src/main/java/io/office/modules/manage/dao/QRcodeDao.java
0 → 100644
View file @
93acf01f
package
io
.
office
.
modules
.
manage
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
io.office.modules.manage.entity.GS1CodeListEntity
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
@Mapper
public
interface
QRcodeDao
extends
BaseMapper
<
GS1CodeListEntity
>
{
List
<
GS1CodeListEntity
>
getGS1CodeList
();
GS1CodeListEntity
getGS1ByMark
();
}
src/main/java/io/office/modules/manage/entity/GS1CodeListEntity.java
0 → 100644
View file @
93acf01f
package
io
.
office
.
modules
.
manage
.
entity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
/**
* Created by naihe on 2019/9/16.
*/
@Setter
@Getter
@ApiModel
(
value
=
"GS1CodeList"
)
public
class
GS1CodeListEntity
{
@ApiModelProperty
(
value
=
"标识符ID"
)
public
String
id
;
@ApiModelProperty
(
value
=
"AI标识符名称"
)
public
String
codeName
;
@ApiModelProperty
(
value
=
"AI标识符编号"
)
public
String
codeValue
;
/** 是否可变长度(0 不可变 1 可变) */
@ApiModelProperty
(
value
=
"是否可变长度(0 不可变 1 可变)"
)
private
Integer
isVariable
;
//
/** 最后一位是否是校验位(0 否 1是) */
@ApiModelProperty
(
value
=
"最后一位是否是校验位(0 否 1是)"
)
private
Integer
isCheck
;
/** 最小长度 */
@ApiModelProperty
(
value
=
"最小长度"
)
private
Integer
minLength
;
/** 最大长度 */
@ApiModelProperty
(
value
=
"用户允许输入的最大长度"
)
private
Integer
maxLength
;
/** 是否是日期(0 否 1是) */
@ApiModelProperty
(
value
=
"是否是日期(0 否 1是)"
)
private
Integer
isDate
;
/** 是否包含小数位(0 不包含 1 包含) */
@ApiModelProperty
(
value
=
"是否包含小数位(0 不包含 1 包含)"
)
private
Integer
isDecimal
;
/** 是否全是数字(0 否 1 是) */
@ApiModelProperty
(
value
=
"是否全是数字(0 否 1 是)"
)
private
Integer
isNum
;
/** 格式 */
@ApiModelProperty
(
value
=
"格式"
)
private
String
format
;
/** 是否需要特殊符号 */
@ApiModelProperty
(
value
=
"是否需要特殊符号(0:否 1:是)"
)
private
Integer
isFnc1
;
/** 数据名称 */
@ApiModelProperty
(
value
=
"数据名称"
)
private
String
dataName
;
/** 输入提示 */
@ApiModelProperty
(
value
=
"输入提示"
)
private
String
prompt
;
}
src/main/java/io/office/modules/manage/service/BarcodeGenerationService.java
0 → 100644
View file @
93acf01f
package
io
.
office
.
modules
.
manage
.
service
;
import
io.office.modules.manage.entity.GS1CodeListEntity
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* ${comments}
*
* @author zyf
* @email
* @date 2021-12-09 15:26:10
*/
@Service
public
interface
BarcodeGenerationService
{
String
createPicture
(
String
content
);
List
<
GS1CodeListEntity
>
getGS1CodeListSSCC
();
GS1CodeListEntity
getGS1CodeListGRAI
();
}
src/main/java/io/office/modules/manage/service/impl/BarcodeGenerationServiceImpl.java
0 → 100644
View file @
93acf01f
package
io
.
office
.
modules
.
manage
.
service
.
impl
;
import
io.office.common.exception.RRException
;
import
io.office.modules.manage.dao.QRcodeDao
;
import
io.office.modules.manage.entity.GS1CodeListEntity
;
import
io.office.modules.manage.service.BarcodeGenerationService
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Service
(
"barcodegenerationservice"
)
public
class
BarcodeGenerationServiceImpl
implements
BarcodeGenerationService
{
@Autowired
private
QRcodeDao
qRcodeDao
;
private
final
Log
logger
=
LogFactory
.
getLog
(
getClass
());
public
static
final
String
prefix_host
=
"http://localhost:9091/office/"
;
public
static
final
String
prefix_url
=
"barcodegeneration/api/gensvg?type="
;
@Override
public
String
createPicture
(
String
content
)
{
String
url
=
""
;
if
(
content
.
length
()
>
50
)
{
throw
new
RRException
(
"最大50位!"
);
}
url
=
prefix_host
+
prefix_url
+
"ean128&msg="
+
content
+
"&fmt=png&hrsize=5pt&hrfont=song&qz=0.6cm&wf=1&mw=0.17mm&height=1cm"
;
return
url
;
}
@Override
public
List
<
GS1CodeListEntity
>
getGS1CodeListSSCC
()
{
return
this
.
qRcodeDao
.
getGS1CodeList
();
}
@Override
public
GS1CodeListEntity
getGS1CodeListGRAI
()
{
return
this
.
qRcodeDao
.
getGS1ByMark
();
}
}
src/main/java/io/office/modules/manage/utils/CheckAICodeUtil.java
0 → 100644
View file @
93acf01f
package
io
.
office
.
modules
.
manage
.
utils
;
import
io.office.common.exception.RRException
;
import
org.apache.commons.lang3.ArrayUtils
;
/**
* Created by naihe on 2019/10/21.
*/
public
class
CheckAICodeUtil
{
public
static
String
ckeckCode
(
String
ai
,
String
code
){
String
substring
=
ai
.
substring
(
0
,
2
);
Integer
intCode
=
Integer
.
valueOf
(
substring
);
if
(
intCode
<
10
){
if
(
intCode
==
0
){
if
(
code
.
length
()
!=
17
)
throw
new
RRException
(
"AI 为00 的信息需要填充17位数字"
);
return
antoFixCheckCode
(
code
);
}
else
if
(
intCode
==
1
){
if
(
code
.
length
()
!=
13
)
throw
new
RRException
(
"AI 为01 的信息需要填充13位数字"
);
return
antoFixCheckCode
(
code
);
}
else
if
(
intCode
==
2
){
if
(
code
.
length
()
!=
13
)
throw
new
RRException
(
"AI 为02 的信息需要填充13位数字"
);
return
antoFixCheckCode
(
code
);
}
}
return
code
;
}
//00 01
//返回一位校验码
private
static
String
antoFixCheckCode
(
String
gtinNo
){
//gtinNo = "0690123456789";
int
sum
=
0
;
char
[]
charArray
=
gtinNo
.
toCharArray
();
ArrayUtils
.
reverse
(
charArray
);
for
(
int
i
=
0
;
i
<
charArray
.
length
;
i
++){
char
n
=
charArray
[
i
];
int
num
=
Integer
.
parseInt
(
n
+
""
);
if
(
i
%
2
!=
0
){
sum
+=
num
;
}
else
{
sum
+=
num
*
3
;
}
}
int
ss
=
(
int
)
Math
.
ceil
(
sum
/
10
)*
10
;
if
(
ss
<
sum
){
ss
+=
10
;
}
int
checkCode
=
ss
-
sum
;
return
checkCode
+
""
;
}
public
static
void
main
(
String
[]
args
)
{
String
s
=
"0045848885699885554"
;
String
s1
=
"2121384585698"
;
System
.
out
.
println
(
antoFixCheckCode
(
s1
));
}
}
src/main/java/io/office/modules/manage/vo/request/CheckAIVo.java
0 → 100644
View file @
93acf01f
package
io
.
office
.
modules
.
manage
.
vo
.
request
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.hibernate.validator.constraints.NotBlank
;
import
java.io.Serializable
;
/**
* Created by naihe on 2019/9/7.
*/
@Setter
@Getter
@ApiModel
(
value
=
"CheckAIIO"
)
public
class
CheckAIVo
implements
Serializable
{
@NotBlank
(
message
=
"AI标识符不能为空!!!"
)
@ApiModelProperty
(
value
=
"AI标识符"
)
public
String
code
;
@NotBlank
(
message
=
"输入的内容不能为空!!!"
)
@ApiModelProperty
(
value
=
"输入的内容"
)
public
String
content
;
}
src/main/resources/lib/barcode4j-light-2.2.0-SNAPSHOT/META-INF/MANIFEST.MF
0 → 100644
View file @
93acf01f
Manifest-Version: 1.0
Built-By: wangll
Build-Jdk: 1.8.0_111
Created-By: Maven Integration for Eclipse
src/main/resources/lib/barcode4j-light-2.2.0-SNAPSHOT/META-INF/maven/net.sf.barcode4j/barcode4j-light/pom.properties
0 → 100644
View file @
93acf01f
#Generated by Maven Integration for Eclipse
#Tue Jun 16 15:30:10 CST 2020
version
=
2.2.0-SNAPSHOT
groupId
=
net.sf.barcode4j
m2e.projectName
=
barcode4j-light
m2e.projectLocation
=
D
\:\\\u
5F00
\u
53D1
\u
5DE5
\u5177\\
java64
\\
barcode4j-develop
\\
barcode4j-light
artifactId
=
barcode4j-light
src/main/resources/lib/barcode4j-light-2.2.0-SNAPSHOT/META-INF/maven/net.sf.barcode4j/barcode4j-light/pom.xml
0 → 100644
View file @
93acf01f
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
net.sf.barcode4j
</groupId>
<artifactId>
barcode4j-parent
</artifactId>
<version>
2.2.0-SNAPSHOT
</version>
</parent>
<artifactId>
barcode4j-light
</artifactId>
<packaging>
jar
</packaging>
<name>
barcode4j-light
</name>
<dependencies>
<dependency>
<groupId>
${project.groupId}
</groupId>
<artifactId>
barcode4j-spi
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
</dependency>
<!-- <dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
</dependency> -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
src/main/resources/lib/barcode4j-light-2.2.0-SNAPSHOT/META-INF/services/org.krysalis.barcode4j.BarcodeGenerator
0 → 100644
View file @
93acf01f
org.krysalis.barcode4j.impl.codabar.CodabarBean
org.krysalis.barcode4j.impl.code39.Code39Bean
org.krysalis.barcode4j.impl.code128.Code128Bean
org.krysalis.barcode4j.impl.code128.EAN128Bean
org.krysalis.barcode4j.impl.int2of5.Interleaved2Of5Bean
org.krysalis.barcode4j.impl.int2of5.ITF14Bean
org.krysalis.barcode4j.impl.upcean.EAN13Bean
org.krysalis.barcode4j.impl.upcean.EAN8Bean
org.krysalis.barcode4j.impl.upcean.UPCABean
org.krysalis.barcode4j.impl.upcean.UPCEBean
org.krysalis.barcode4j.impl.postnet.POSTNETBean
org.krysalis.barcode4j.impl.fourstate.RoyalMailCBCBean
org.krysalis.barcode4j.impl.fourstate.USPSIntelligentMailBean
org.krysalis.barcode4j.impl.pdf417.PDF417Bean
org.krysalis.barcode4j.impl.datamatrix.DataMatrixBean
org.krysalis.barcode4j.impl.qr.QRCodeBean
src/main/resources/lib/barcode4j-light-2.2.0-SNAPSHOT/org/krysalis/barcode4j/impl/code128/EAN128AIs.properties
0 → 100644
View file @
93acf01f
00
=
n17+cd
01
=
n13+cd
02
=
n13+cd
10
=
an1-20
11
=
d6
13
=
d6
15
=
d6
17
=
d6
20
=
n2
21
=
an-20
22
=
an-29
23x
=
e
230
=
n1
231
=
n10
232
=
n19
240
=
an-30
241
=
an-30
250
=
an-30
251
=
an-30
252
=
n2
30
=
n-8
310x
=
n6
311x
=
n6
312x
=
n6
313x
=
n6
314x
=
n6
315x
=
n6
316x
=
n6
32xx
=
n6
330x
=
n6
331x
=
n6
332x
=
n6
333x
=
n6
334x
=
n6
335x
=
n6
336x
=
n6
337x
=
n6
34xx
=
n6
350x
=
n6
351x
=
n6
352x
=
n6
353x
=
n6
354x
=
n6
355x
=
n6
356x
=
n6
36xx
=
n6
37
=
n-8
390x
=
n-15
391x
=
n4-18
392x
=
n-15
393x
=
n4-18
400
=
an-30
401
=
an-30
402
=
n17
403
=
an-30
# 410=n12+cd
# 411=n12+cd
# 412=n12+cd
# 413=n12+cd
# 414=n12+cd
# 415=n12+cd
410
=
n13
411
=
n13
412
=
n13
413
=
n13
414
=
n13
415
=
n13
420
=
an-9
#???420=an-20
#############################
#421=an4-12
421
=
n3+an1-9
##############
422
=
n3
8001
=
n14
8002
=
an-20
#############################
#8003=an15-30
8003
=
n13+cd+an1-16
##############
8004
=
an-30
8005
=
n6
#############################
#8006=n18
8006
=
n13+cd+n2+n2
##############
8007
=
an-30
8008
=
n9-12
8018
=
n18
8020
=
an-25
#?Typo??8020=an25
8100
=
n6
8101
=
n10
8102
=
n2
9x
=
an-30
#############################
#91=n2+n9+n2-8+cd0
#420=n5
##############
7001
=
n13
7002
=
an-30
7003
=
n10
7004
=
n-4
7005
=
an12
7006
=
n6
7007
=
d6
7008
=
an-3
7009
=
an-10
7010
=
an-2
7020
=
an-20
7021
=
an-20
7022
=
an-20
7023
=
an-30
703s
=
an4-30
710
=
an-20
711
=
an-20
712
=
an-20
713
=
an-20
714
=
an-20
242
=
n1-6
243
=
an1-20
253
=
an14-30
254
=
an1-20
255
=
n14-25
src/main/resources/lib/barcode4j-light-2.2.0-SNAPSHOT/org/krysalis/barcode4j/impl/fourstate/usps-4bc-bar-to-character-table.csv
0 → 100644
View file @
93acf01f
1;H;2;E;3
2;B;10;A;0
3;J;12;C;8
4;F;5;G;11
5;I;9;D;1
6;A;1;F;12
7;C;5;B;8
8;E;4;J;11
9;G;3;I;10
10;D;9;H;6
11;F;11;B;4
12;I;5;C;12
13;J;10;A;2
14;H;1;G;7
15;D;6;E;9
16;A;3;I;6
17;G;4;C;7
18;B;1;J;9
19;H;10;F;2
20;E;0;D;8
21;G;2;A;4
22;I;11;B;0
23;J;8;D;12
24;C;6;H;7
25;F;1;E;10
26;B;12;G;9
27;H;3;I;0
28;F;8;J;7
29;E;6;C;10
30;D;4;A;5
31;I;4;F;7
32;H;11;B;9
33;G;0;J;6
34;A;6;E;8
35;C;1;D;2
36;F;9;I;12
37;E;11;G;1
38;J;5;H;4
39;D;3;B;2
40;A;7;C;0
41;B;3;E;1
42;G;10;D;5
43;I;7;J;4
44;C;11;F;6
45;A;8;H;12
46;E;2;I;1
47;F;10;D;0
48;J;3;A;9
49;G;5;C;4
50;H;8;B;7
51;F;0;E;5
52;C;3;A;10
53;G;12;J;2
54;D;11;B;6
55;I;8;H;9
56;F;4;A;11
57;B;5;C;2
58;J;1;E;12
59;I;3;G;6
60;H;0;D;7
61;E;7;H;5
62;A;12;B;11
63;C;9;J;0
64;G;8;F;3
65;D;10;I;2
src/main/resources/lib/barcode4j-light-2.2.0-SNAPSHOT/org/krysalis/barcode4j/output/java2d/OCR-B 10 BT.ttf
0 → 100644
View file @
93acf01f
File added
src/main/resources/mapper/manage/QRcodeDao.xml
0 → 100644
View file @
93acf01f
<?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=
"io.office.modules.manage.dao.QRcodeDao"
>
<select
id=
"getGS1CodeList"
resultType=
"io.office.modules.manage.entity.GS1CodeListEntity"
>
SELECT id, CONCAT(mark,'(',meaning,')') as codeName,mark codeValue, is_variable isVariable, min_length minLength, enable_max_length maxLength,
is_decimal isDecimal,is_check isCheck, is_num isNum, format, is_fnc1 isFnc1, data_name dataName ,is_date isDate, prompt
FROM gs1_standard
</select>
<select
id=
"getGS1ByMark"
resultType=
"io.office.modules.manage.entity.GS1CodeListEntity"
>
SELECT id, CONCAT(mark,'(',meaning,')') as codeName,mark codeValue, is_variable isVariable, min_length minLength, enable_max_length maxLength,
is_decimal isDecimal,is_check isCheck, is_num isNum, format, is_fnc1 isFnc1, data_name dataName ,is_date isDate, prompt
FROM gs1_standard where mark='8003'
</select>
</mapper>
\ No newline at end of file
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