Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
warehouse
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
胡懿
warehouse
Commits
922bab91
Commit
922bab91
authored
Feb 28, 2023
by
zhanglt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
盘盈入库生成删掉二维码接口
parent
22ebfc25
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
1 deletion
+71
-1
ProfitWarehousingService.java
...e/profitwarehousing/service/ProfitWarehousingService.java
+33
-1
ProfitWarehousingController.java
...se/profitwarehousing/web/ProfitWarehousingController.java
+23
-0
BuildQcUtil.java
...om/jeeplus/modules/warehouse/qrcode/util/BuildQcUtil.java
+15
-0
No files found.
src/main/java/com/jeeplus/modules/warehouse/profitwarehousing/service/ProfitWarehousingService.java
View file @
922bab91
...
...
@@ -10,6 +10,7 @@ import java.util.ArrayList;
import
java.util.List
;
import
com.jeeplus.common.config.Global
;
import
com.jeeplus.common.utils.io.FileUtil
;
import
com.jeeplus.modules.warehouse.code.util.CodeUtil
;
import
com.jeeplus.modules.warehouse.code.util.StaticNumSeq
;
import
com.jeeplus.modules.warehouse.goods.entity.GoodsInfo
;
...
...
@@ -92,7 +93,7 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe
qrCode
.
setState
(
"0"
);
qrCode
.
preInsert
();
try
{
BuildQcUtil
.
buildQr
(
qrCode
,
qrImgPath
+
"/"
+
numSeq
+
".png"
,
qrImgPath
+
"/"
+
numSeq
+
".png"
);
// 生成图片
BuildQcUtil
.
buildQr
One
(
qrCode
,
qrImgPath
+
"/"
+
numSeq
+
".png"
,
qrImgPath
+
"/"
+
numSeq
+
".png"
);
// 生成图片
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -103,6 +104,37 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe
profitWarehousingInfoMapper
.
insert
(
profitWarehousingInfo
);
return
profitWarehousingInfo
;
}
/**
* 清除二维码
* @param infoId
*/
@Transactional
(
readOnly
=
false
)
public
void
cleanQr
(
String
infoId
)
{
ProfitWarehousingInfo
profitWarehousingInfo
=
profitWarehousingInfoMapper
.
get
(
infoId
);
QrCode
qrCode
=
qrCodeMapper
.
get
(
profitWarehousingInfo
.
getQrCode
().
getId
());
if
(
StringUtils
.
isNotBlank
(
qrCode
.
getUrl
()))
{
try
{
String
url
=
qrCode
.
getUrl
();
if
(
null
!=
url
&&
url
.
contains
(
"image"
))
{
String
photo
=
url
.
split
(
"image/"
)[
1
];
File
file
=
new
File
(
Global
.
getAttachmentDir
()
+
"image/"
+
photo
);
if
(
file
.
exists
())
{
FileUtil
.
deleteFile
(
new
File
(
Global
.
getAttachmentDir
()
+
"image/"
+
photo
));
}
else
{
logger
.
info
(
"二维码路径不存在,执行删除"
);
}
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
qrCodeMapper
.
delete
(
qrCode
);
// 删除二维码
profitWarehousingInfo
.
setQrCode
(
new
QrCode
());
profitWarehousingInfo
.
preUpdate
();
profitWarehousingInfoMapper
.
update
(
profitWarehousingInfo
);
}
@Transactional
(
readOnly
=
false
)
public
void
save
(
ProfitWarehousing
profitWarehousing
)
{
super
.
save
(
profitWarehousing
);
...
...
src/main/java/com/jeeplus/modules/warehouse/profitwarehousing/web/ProfitWarehousingController.java
View file @
922bab91
...
...
@@ -269,6 +269,29 @@ public class ProfitWarehousingController extends BaseController {
j
.
setMsg
(
"生成二维码成功"
);
return
j
;
}
/**
* 清除二维码
* @param goodsInfoId
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping
(
value
=
"cleanQr"
)
public
AjaxJson
cleanQr
(
String
profitWarehousingInfoId
)
throws
Exception
{
AjaxJson
j
=
new
AjaxJson
();
//新增或编辑表单保存
ProfitWarehousingInfo
profitWarehousingInfo1
=
profitWarehousingInfoMapper
.
get
(
profitWarehousingInfoId
);
if
(
profitWarehousingInfo1
.
getQrCode
()
==
null
){
j
.
setSuccess
(
false
);
j
.
setMsg
(
"二维码不存在"
);
return
j
;
}
profitWarehousingService
.
cleanQr
(
profitWarehousingInfoId
);
//保存
j
.
setSuccess
(
true
);
j
.
setMsg
(
"清除二维码成功"
);
return
j
;
}
/**
* 盘盈入库明细,入台账
*/
...
...
src/main/java/com/jeeplus/modules/warehouse/qrcode/util/BuildQcUtil.java
View file @
922bab91
...
...
@@ -35,4 +35,19 @@ public class BuildQcUtil {
}
FileUtil
.
deleteFile
(
file
);
}
public
static
void
buildQrOne
(
QrCode
qrCode
,
String
qrImgPath
,
String
imgPath
)
throws
IOException
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"code"
,
qrCode
.
getId
());
TwoDimensionCode
.
encoderQRCode
(
JSON
.
toJSONString
(
map
),
qrImgPath
,
"png"
,
6
);
File
file
=
new
File
(
qrImgPath
);
try
{
BufferedImage
image
=
DrawQrcodeUtil
.
createAssetImageNew
(
file
,
qrCode
);
DrawQrcodeUtil
drawQrcodeUtil
=
new
DrawQrcodeUtil
();
drawQrcodeUtil
.
writeImage
(
image
,
imgPath
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
FileUtil
.
deleteFile
(
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