Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
87c53d7d
Commit
87c53d7d
authored
Dec 04, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量创建打印的二维码,透明的小程序二维码
parent
d48d7902
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
9 deletions
+67
-9
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemTagQrCodeDao.java
...ao/src/main/java/com/wwdz/ch/db/dao/ItemTagQrCodeDao.java
+5
-1
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/ItemTagQrCodeRequestDto.java
...a/com/wwdz/ch/db/dto/request/ItemTagQrCodeRequestDto.java
+1
-1
ch-dao/src/main/java/com/wwdz/ch/db/impl/ItemTagQrCodeDaoImpl.java
...c/main/java/com/wwdz/ch/db/impl/ItemTagQrCodeDaoImpl.java
+18
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemTagQrCodeServiceImpl.java
...in/java/com/wwdz/ch/wx/impl/ItemTagQrCodeServiceImpl.java
+38
-4
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/ItemTagQrCodeService.java
...ain/java/com/wwdz/ch/wx/service/ItemTagQrCodeService.java
+2
-0
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/WxPayServiceTest.java
...pi/src/test/java/com/wwdz/ch/wx/api/WxPayServiceTest.java
+3
-3
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemTagQrCodeDao.java
View file @
87c53d7d
package
com.wwdz.ch.db.dao
;
package
com.wwdz.ch.db.dao
;
import
com.wwdz.ch.db.domain.ItemTagQrCode
;
import
com.wwdz.ch.db.domain.ItemTagQrCode
;
import
com.wwdz.ch.db.dto.request.ItemTagQrCodeRequestDto
;
import
java.util.List
;
public
interface
ItemTagQrCodeDao
{
public
interface
ItemTagQrCodeDao
{
...
@@ -11,10 +14,11 @@ public interface ItemTagQrCodeDao {
...
@@ -11,10 +14,11 @@ public interface ItemTagQrCodeDao {
*/
*/
long
insert
(
ItemTagQrCode
itemTagQrCode
);
long
insert
(
ItemTagQrCode
itemTagQrCode
);
boolean
update
(
ItemTagQrCode
itemTagQrCode
);
boolean
update
(
ItemTagQrCode
itemTagQrCode
);
boolean
updateByPrimaryKey
(
ItemTagQrCode
itemTagQrCode
);
boolean
updateByPrimaryKey
(
ItemTagQrCode
itemTagQrCode
);
ItemTagQrCode
findByCode
(
String
code
);
ItemTagQrCode
findByCode
(
String
code
);
List
<
ItemTagQrCode
>
findByPage
(
ItemTagQrCodeRequestDto
dto
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/ItemTagQrCodeRequestDto.java
View file @
87c53d7d
...
@@ -7,7 +7,7 @@ import java.util.Date;
...
@@ -7,7 +7,7 @@ import java.util.Date;
import
java.util.List
;
import
java.util.List
;
@Data
@Data
public
class
ItemTagQrCodeRequestDto
implements
Entity
{
public
class
ItemTagQrCodeRequestDto
extends
BaseRequestDto
implements
Entity
{
private
Long
userId
;
private
Long
userId
;
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/ItemTagQrCodeDaoImpl.java
View file @
87c53d7d
package
com.wwdz.ch.db.impl
;
package
com.wwdz.ch.db.impl
;
import
com.github.pagehelper.PageHelper
;
import
com.wwdz.ch.db.dao.ItemTagQrCodeDao
;
import
com.wwdz.ch.db.dao.ItemTagQrCodeDao
;
import
com.wwdz.ch.db.domain.ItemTagQrCode
;
import
com.wwdz.ch.db.domain.ItemTagQrCode
;
import
com.wwdz.ch.db.domain.ItemTagQrCodeExample
;
import
com.wwdz.ch.db.domain.ItemTagQrCodeExample
;
import
com.wwdz.ch.db.dto.request.ItemTagQrCodeRequestDto
;
import
com.wwdz.ch.db.mapper.ItemTagQrCodeMapper
;
import
com.wwdz.ch.db.mapper.ItemTagQrCodeMapper
;
import
com.xxdxxs.db.component.JdbcHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
@Repository
public
class
ItemTagQrCodeDaoImpl
implements
ItemTagQrCodeDao
{
public
class
ItemTagQrCodeDaoImpl
implements
ItemTagQrCodeDao
{
...
@@ -40,4 +45,17 @@ public class ItemTagQrCodeDaoImpl implements ItemTagQrCodeDao {
...
@@ -40,4 +45,17 @@ public class ItemTagQrCodeDaoImpl implements ItemTagQrCodeDao {
criteria
.
andCodeEqualTo
(
code
);
criteria
.
andCodeEqualTo
(
code
);
return
itemTagQrCodeMapper
.
selectOneByExample
(
example
);
return
itemTagQrCodeMapper
.
selectOneByExample
(
example
);
}
}
@Override
public
List
<
ItemTagQrCode
>
findByPage
(
ItemTagQrCodeRequestDto
dto
)
{
ItemTagQrCodeExample
example
=
new
ItemTagQrCodeExample
();
ItemTagQrCodeExample
.
Criteria
criteria
=
example
.
createCriteria
();
JdbcHelper
.
ifPresent
(
dto
.
getCode
(),
criteria
::
andCodeEqualTo
);
JdbcHelper
.
ifPresent
(
dto
.
getCategoryId
(),
criteria
::
andCategoryIdEqualTo
);
JdbcHelper
.
ifPresent
(
dto
.
getId
(),
criteria
::
andIdGreaterThanOrEqualTo
);
example
.
setOrderByClause
(
"id ASC"
);
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getLimit
());
return
itemTagQrCodeMapper
.
selectByExample
(
example
);
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemTagQrCodeServiceImpl.java
View file @
87c53d7d
...
@@ -10,6 +10,7 @@ import com.wwdz.ch.core.entity.SupplierItemVo;
...
@@ -10,6 +10,7 @@ import com.wwdz.ch.core.entity.SupplierItemVo;
import
com.wwdz.ch.core.storage.QiniuStorage
;
import
com.wwdz.ch.core.storage.QiniuStorage
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.*
;
import
com.wwdz.ch.core.util.*
;
import
com.wwdz.ch.core.util.UUID
;
import
com.wwdz.ch.db.dao.CategoryDao
;
import
com.wwdz.ch.db.dao.CategoryDao
;
import
com.wwdz.ch.db.dao.ItemTagQrCodeDao
;
import
com.wwdz.ch.db.dao.ItemTagQrCodeDao
;
import
com.wwdz.ch.db.dao.distribution.SupplierItemDao
;
import
com.wwdz.ch.db.dao.distribution.SupplierItemDao
;
...
@@ -31,12 +32,15 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -31,12 +32,15 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.net.URL
;
import
java.util.HashMap
;
import
java.nio.file.Files
;
import
java.util.Map
;
import
java.nio.file.Path
;
import
java.util.Objects
;
import
java.nio.file.Paths
;
import
java.nio.file.StandardCopyOption
;
import
java.util.*
;
import
java.util.stream.IntStream
;
import
java.util.stream.IntStream
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
...
@@ -174,4 +178,34 @@ public class ItemTagQrCodeServiceImpl implements ItemTagQrCodeService {
...
@@ -174,4 +178,34 @@ public class ItemTagQrCodeServiceImpl implements ItemTagQrCodeService {
}
}
return
Result
.
failed
();
return
Result
.
failed
();
}
}
@Override
public
Result
downloadQRCode
(
ItemTagQrCodeRequestDto
dto
)
{
try
{
List
<
ItemTagQrCode
>
itemTagQrCodeList
=
itemTagQrCodeDao
.
findByPage
(
dto
);
String
destinationFolder
=
"/Users/xxdxxs/Desktop/"
+
dto
.
getCategoryName
();
int
i
=
1
;
for
(
ItemTagQrCode
itemTagQrCode
:
itemTagQrCodeList
)
{
String
imageUrl
=
itemTagQrCode
.
getQrCode
();
String
fileName
=
itemTagQrCode
.
getCategoryName
()
+
i
+
"."
+
MediaTypeEnum
.
IMAGE_PNG
.
getExt
();
downloadImage
(
imageUrl
,
destinationFolder
,
fileName
);
i
++;
}
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"下载上传的标签二维码{}"
,
e
);
}
return
Result
.
failed
();
}
public
static
void
downloadImage
(
String
imageUrl
,
String
destinationFolder
,
String
fileName
)
throws
IOException
{
URL
url
=
new
URL
(
imageUrl
);
try
(
InputStream
in
=
url
.
openStream
())
{
Path
destinationPath
=
Paths
.
get
(
destinationFolder
,
fileName
);
Files
.
copy
(
in
,
destinationPath
,
StandardCopyOption
.
REPLACE_EXISTING
);
}
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/ItemTagQrCodeService.java
View file @
87c53d7d
...
@@ -27,4 +27,6 @@ public interface ItemTagQrCodeService {
...
@@ -27,4 +27,6 @@ public interface ItemTagQrCodeService {
* @return
* @return
*/
*/
Result
bindItem
(
ItemTagQrCodeRequestDto
dto
);
Result
bindItem
(
ItemTagQrCodeRequestDto
dto
);
Result
downloadQRCode
(
ItemTagQrCodeRequestDto
dto
);
}
}
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/WxPayServiceTest.java
View file @
87c53d7d
...
@@ -89,12 +89,12 @@ public class WxPayServiceTest {
...
@@ -89,12 +89,12 @@ public class WxPayServiceTest {
@Test
@Test
public
void
refund
()
{
public
void
refund
()
{
List
<
String
>
list
=
Arrays
.
asList
(
"DA2411
192041343155076
"
);
List
<
String
>
list
=
Arrays
.
asList
(
"DA2411
291619274673652
"
);
list
.
forEach
(
orderId
->{
list
.
forEach
(
orderId
->{
DistributionOrderRequestDto
dto
=
new
DistributionOrderRequestDto
();
DistributionOrderRequestDto
dto
=
new
DistributionOrderRequestDto
();
dto
.
setDistributionOrderId
(
orderId
);
dto
.
setDistributionOrderId
(
orderId
);
dto
.
setAmount
(
"
24.9
"
);
dto
.
setAmount
(
"
94.8
"
);
dto
.
setRefundPrice
(
"
24.9
"
);
dto
.
setRefundPrice
(
"
94.8
"
);
Result
result
=
wxPayServiceApi
.
refund
(
dto
);
Result
result
=
wxPayServiceApi
.
refund
(
dto
);
logger
.
info
(
"申请微信支付退款:{}"
,
result
);
logger
.
info
(
"申请微信支付退款:{}"
,
result
);
});
});
...
...
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