Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
consume
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
竹天卫
consume
Commits
b0e41575
Commit
b0e41575
authored
Nov 26, 2020
by
mengbali153
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优惠券分类查询
parent
e5c2843d
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
269 additions
and
29 deletions
+269
-29
BaiyingApi.java
...a/cn/wise/sc/consume/business/api/baiying/BaiyingApi.java
+13
-4
CMBOneNetController.java
...onsume/business/entity/cmbnoenet/CMBOneNetController.java
+32
-10
SysCouponDetailMapper.java
...ise/sc/consume/business/mapper/SysCouponDetailMapper.java
+9
-1
SysEnterpriseMapper.java
.../wise/sc/consume/business/mapper/SysEnterpriseMapper.java
+2
-0
SysCouponDetailMapper.xml
.../sc/consume/business/mapper/xml/SysCouponDetailMapper.xml
+66
-7
SysEnterpriseMapper.xml
...se/sc/consume/business/mapper/xml/SysEnterpriseMapper.xml
+5
-0
ReceivedAppListVO.java
.../cn/wise/sc/consume/business/model/ReceivedAppListVO.java
+17
-0
ISysCouponDetailService.java
.../sc/consume/business/service/ISysCouponDetailService.java
+7
-1
CMBOneNetPayService.java
...sc/consume/business/service/impl/CMBOneNetPayService.java
+91
-4
SysCouponDetailServiceImpl.java
...ume/business/service/impl/SysCouponDetailServiceImpl.java
+27
-2
No files found.
consume-business/src/main/java/cn/wise/sc/consume/business/api/baiying/BaiyingApi.java
View file @
b0e41575
...
...
@@ -22,15 +22,24 @@ public class BaiyingApi {
//开发环境配置
private
static
String
openid
=
"19198e6d7feedda5"
;
;
private
static
String
cipher
=
"6276bcfcbd71966e"
;
;
// private static String openid = "19198e6d7feedda5"
;
// private static String cipher = "6276bcfcbd71966e"
;
//服务器地址
private
static
String
url
=
"http://116.62.180.218:8082"
;
// private static String url = "http://116.62.180.218:8082";
//生产环境配置
private
static
String
openid
=
"c395729b9fa99789"
;
private
static
String
cipher
=
"437a09f790230c43"
;
//服务器地址
private
static
String
url
=
"https://openapi.baiying365.com"
;
public
static
void
main
(
String
[]
args
)
{
// getAccessToken_2_0();
//
synRedeemCodeState();
synRedeemCodeState
();
// getRedeemCodeUseState();
}
...
...
consume-business/src/main/java/cn/wise/sc/consume/business/entity/cmbnoenet/CMBOneNetController.java
View file @
b0e41575
...
...
@@ -107,12 +107,19 @@ public class CMBOneNetController {
return
CMBOneNetPayService
.
getUserInfo
(
coridc
);
}
@ApiOperation
(
value
=
"申请发券"
)
@PostMapping
(
"/applyEnterprise"
)
public
BaseResponse
applyEnterprise
(
@RequestBody
SysEnterpriseDto
enterpriseDto
)
{
return
CMBOneNetPayService
.
applyEnterprise
(
enterpriseDto
);
}
@ApiOperation
(
value
=
"查询申请发券企业信息"
)
@GetMapping
(
"/getIssEnterprise"
)
public
BaseResponse
getIssEnterprise
(
String
coridc
)
{
return
CMBOneNetPayService
.
getIssEnterprise
(
coridc
);
}
@ApiOperation
(
value
=
"票券列表(企业列表)"
)
@GetMapping
(
"/getEnterpriseList"
)
public
BaseResponse
getEnterpriseList
(
String
usridc
)
{
...
...
@@ -143,24 +150,39 @@ public class CMBOneNetController {
@ApiOperation
(
value
=
"已领取优惠券列表"
)
@GetMapping
(
"/getReceivedList"
)
public
BaseResponse
getReceivedList
(
String
coridc
,
String
usridc
)
{
public
BaseResponse
getReceivedList
(
String
coridc
,
String
usridc
)
{
return
CMBOneNetPayService
.
getReceivedList
(
coridc
,
usridc
);
}
@ApiOperation
(
value
=
"
使用优惠券
"
)
@GetMapping
(
"/
useCoupon
"
)
public
BaseResponse
useCoupon
(
Long
couponDetailId
)
{
return
CMBOneNetPayService
.
useCoupon
(
couponDetailId
);
@ApiOperation
(
value
=
"
个人券夹
"
)
@GetMapping
(
"/
getAllReceivedList
"
)
public
BaseResponse
getAllReceivedList
(
String
usridc
)
{
return
CMBOneNetPayService
.
getAllReceivedList
(
usridc
);
}
@ApiOperation
(
value
=
"个人券夹(企业)"
)
@GetMapping
(
"/getAllReceivedListSE"
)
public
BaseResponse
getAllReceivedListSE
(
String
coridc
,
String
usridc
)
{
return
CMBOneNetPayService
.
getAllReceivedListSE
(
coridc
,
usridc
);
}
@ApiOperation
(
value
=
"失效优惠券列表"
)
@GetMapping
(
"/getOverdueList"
)
public
BaseResponse
getOverdueList
(
String
usridc
)
{
return
CMBOneNetPayService
.
getOverdueList
(
usridc
);
}
@ApiOperation
(
value
=
"失效优惠券列表(企业)"
)
@GetMapping
(
"/getOverdueListSE"
)
public
BaseResponse
getOverdueListSE
(
String
coridc
,
String
usridc
)
{
return
CMBOneNetPayService
.
getOverdueListSE
(
coridc
,
usridc
);
}
@ApiOperation
(
value
=
"使用优惠券"
)
@GetMapping
(
"/useCoupon"
)
public
BaseResponse
useCoupon
(
Long
couponDetailId
)
{
return
CMBOneNetPayService
.
useCoupon
(
couponDetailId
);
}
}
consume-business/src/main/java/cn/wise/sc/consume/business/mapper/SysCouponDetailMapper.java
View file @
b0e41575
...
...
@@ -21,7 +21,15 @@ public interface SysCouponDetailMapper extends BaseMapper<SysCouponDetail> {
@Select
(
"select count(*) from sys_coupon_detail where to_days(create_time) = to_days(now())"
)
int
createNo
();
List
<
ReceivedAppListVO
>
getReceivedList
(
@Param
(
"coridc"
)
String
coridc
,
@Param
(
"usridc"
)
String
usridc
);
List
<
ReceivedAppListVO
>
getReceivedList
(
@Param
(
"coridc"
)
String
coridc
,
@Param
(
"usridc"
)
String
usridc
);
List
<
ReceivedAppListVO
>
getAllReceivedList
(
@Param
(
"usridc"
)
String
usridc
);
List
<
ReceivedAppListVO
>
getAllReceivedListSE
(
@Param
(
"coridc"
)
String
coridc
,
@Param
(
"usridc"
)
String
usridc
);
List
<
ReceivedAppListVO
>
getOverdueList
(
@Param
(
"usridc"
)
String
usridc
);
List
<
ReceivedAppListVO
>
getOverdueListSE
(
@Param
(
"coridc"
)
String
coridc
,
@Param
(
"usridc"
)
String
usridc
);
@Select
(
"select * from sys_coupon_detail scd where scd.is_receive=0 and to_days(now()) - to_days(scd.end_date) >0"
)
List
<
SysCouponDetail
>
getVerdueList
();
...
...
consume-business/src/main/java/cn/wise/sc/consume/business/mapper/SysEnterpriseMapper.java
View file @
b0e41575
...
...
@@ -2,6 +2,7 @@ package cn.wise.sc.consume.business.mapper;
import
cn.wise.sc.consume.business.entity.SysEnterprise
;
import
cn.wise.sc.consume.business.model.EnterpriseAppListVO
;
import
cn.wise.sc.consume.business.model.SysEnterpriseDto
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -21,6 +22,7 @@ public interface SysEnterpriseMapper extends BaseMapper<SysEnterprise> {
List
<
SysEnterprise
>
getPage
(
@Param
(
"map"
)
Map
<
String
,
Object
>
map
);
SysEnterprise
getByCoridc
(
String
coridc
);
List
<
EnterpriseAppListVO
>
getEnterpriseList
(
String
usridc
);
...
...
consume-business/src/main/java/cn/wise/sc/consume/business/mapper/xml/SysCouponDetailMapper.xml
View file @
b0e41575
...
...
@@ -7,18 +7,77 @@
<!-- </update>-->
<select
id=
"getReceivedList"
resultType=
"cn.wise.sc.consume.business.model.ReceivedAppListVO"
>
select
scd.id as id, scd.coupon_code as couponCode,
sc.coupon_logo as couponLogo
from sys_coupon_detail scd
left join sys_user_coupon suc on suc.coupon_detail_id = scd.id
left join sys_coupon sc on sc.id = scd.coupon_id
left join sys_enterprise se on se.id = sc.enterprise_id
SELECT
scd.id AS id,sc.coupon_name AS couponName ,scd.coupon_code AS couponCode,
sc.coupon_logo AS couponLogo,scd.end_date AS endDate,scd.remark AS remark,
se.coridc as coridc,se.enterprise_name as coridcName,se.coupon_link as couponLink
FROM sys_coupon_detail scd
LEFT JOIN sys_user_coupon suc ON suc.coupon_detail_id = scd.id
LEFT JOIN sys_coupon sc ON sc.id = scd.coupon_id
LEFT JOIN sys_enterprise se ON se.id = sc.enterprise_id
where se.coridc = #{coridc} and sc.is_delete=1 and sc.status=1
and scd.is_delete=1 and scd.is_receive=1
and suc.user_id=#{usridc} and suc.is_use=0
</select>
<select
id=
"getAllReceivedList"
resultType=
"cn.wise.sc.consume.business.model.ReceivedAppListVO"
>
SELECT
scd.id AS id,sc.coupon_name AS couponName ,scd.coupon_code AS couponCode,
sc.coupon_logo AS couponLogo,scd.end_date AS endDate,scd.remark AS remark,
se.coridc as coridc,se.enterprise_name as coridcName,se.coupon_link as couponLink
FROM sys_coupon_detail scd
LEFT JOIN sys_user_coupon suc ON suc.coupon_detail_id = scd.id
LEFT JOIN sys_coupon sc ON sc.id = scd.coupon_id
LEFT JOIN sys_enterprise se ON se.id = sc.enterprise_id
where sc.is_delete=1 and sc.status=1
and scd.is_delete=1 and scd.is_receive=1
and suc.user_id=#{usridc} and suc.is_use=0
</select>
<select
id=
"getAllReceivedListSE"
resultType=
"cn.wise.sc.consume.business.model.ReceivedAppListVO"
>
SELECT
scd.id AS id,sc.coupon_name AS couponName ,scd.coupon_code AS couponCode,
sc.coupon_logo AS couponLogo,scd.end_date AS endDate,scd.remark AS remark,
se.coridc as coridc,se.enterprise_name as coridcName,se.coupon_link as couponLink
FROM sys_coupon_detail scd
LEFT JOIN sys_user_coupon suc ON suc.coupon_detail_id = scd.id
LEFT JOIN sys_coupon sc ON sc.id = scd.coupon_id
LEFT JOIN sys_enterprise se ON se.id = sc.enterprise_id
where se.coridc = #{coridc} and sc.is_delete=1 and sc.status=1
and scd.is_delete=1 and scd.is_receive=1
and suc.user_id=#{usridc} and suc.is_use=0
</select>
<select
id=
"getOverdueList"
resultType=
"cn.wise.sc.consume.business.model.ReceivedAppListVO"
>
SELECT
scd.id AS id,sc.coupon_name AS couponName ,scd.coupon_code AS couponCode,
sc.coupon_logo AS couponLogo,scd.end_date AS endDate,scd.remark AS remark,
se.coridc as coridc,se.enterprise_name as coridcName
FROM sys_coupon_detail scd
LEFT JOIN sys_user_coupon suc ON suc.coupon_detail_id = scd.id
LEFT JOIN sys_coupon sc ON sc.id = scd.coupon_id
LEFT JOIN sys_enterprise se ON se.id = sc.enterprise_id
where sc.is_delete=1 and sc.status=1
and scd.is_delete=1
and (scd.is_receive>1 OR suc.is_use>1)
and suc.user_id=#{usridc}
</select>
<select
id=
"getOverdueListSE"
resultType=
"cn.wise.sc.consume.business.model.ReceivedAppListVO"
>
SELECT
scd.id AS id,sc.coupon_name AS couponName ,scd.coupon_code AS couponCode,
sc.coupon_logo AS couponLogo,scd.end_date AS endDate,scd.remark AS remark,
se.coridc as coridc,se.enterprise_name as coridcName
FROM sys_coupon_detail scd
LEFT JOIN sys_user_coupon suc ON suc.coupon_detail_id = scd.id
LEFT JOIN sys_coupon sc ON sc.id = scd.coupon_id
LEFT JOIN sys_enterprise se ON se.id = sc.enterprise_id
where se.coridc = #{coridc} and sc.is_delete=1 and sc.status=1
and scd.is_delete=1
and (scd.is_receive>1 OR suc.is_use>1)
and suc.user_id=#{usridc}
</select>
<select
id=
"getByCouponId"
resultType=
"cn.wise.sc.consume.business.entity.SysCouponDetail"
>
select scd.*
...
...
consume-business/src/main/java/cn/wise/sc/consume/business/mapper/xml/SysEnterpriseMapper.xml
View file @
b0e41575
...
...
@@ -19,6 +19,11 @@
order by t.create_time desc
</select>
<select
id=
"getByCoridc"
resultType=
"cn.wise.sc.consume.business.entity.SysEnterprise"
>
select t.* from sys_enterprise t
where t.coridc = #{coridc}
</select>
<select
id=
"getEnterpriseList"
resultType=
"cn.wise.sc.consume.business.model.EnterpriseAppListVO"
>
...
...
consume-business/src/main/java/cn/wise/sc/consume/business/model/ReceivedAppListVO.java
View file @
b0e41575
...
...
@@ -3,6 +3,7 @@ package cn.wise.sc.consume.business.model;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
/**
...
...
@@ -18,11 +19,27 @@ public class ReceivedAppListVO {
private
Long
id
;
@ApiModelProperty
(
"优惠券名称"
)
private
String
couponName
;
@ApiModelProperty
(
"优惠券码"
)
private
String
couponCode
;
@ApiModelProperty
(
"优惠券logo"
)
private
String
couponLogo
;
@ApiModelProperty
(
"截止日期"
)
private
LocalDate
endDate
;
@ApiModelProperty
(
"描述"
)
private
String
remark
;
@ApiModelProperty
(
"企业id"
)
private
String
coridc
;
@ApiModelProperty
(
"企业名称"
)
private
String
coridcName
;
@ApiModelProperty
(
"优惠券链接"
)
private
String
couponLink
;
}
consume-business/src/main/java/cn/wise/sc/consume/business/service/ISysCouponDetailService.java
View file @
b0e41575
...
...
@@ -17,7 +17,13 @@ import java.util.List;
public
interface
ISysCouponDetailService
extends
IService
<
SysCouponDetail
>
{
List
<
ReceivedAppListVO
>
getReceivedList
(
String
coridc
,
String
usridc
);
List
<
ReceivedAppListVO
>
getReceivedList
(
String
coridc
,
String
usridc
);
List
<
ReceivedAppListVO
>
getAllReceivedList
(
String
usridc
);
List
<
ReceivedAppListVO
>
getAllReceivedListSE
(
String
coridc
,
String
usridc
);
List
<
ReceivedAppListVO
>
getOverdueList
(
String
usridc
);
List
<
ReceivedAppListVO
>
getOverdueListSE
(
String
coridc
,
String
usridc
);
void
beVerdue
();
}
consume-business/src/main/java/cn/wise/sc/consume/business/service/impl/CMBOneNetPayService.java
View file @
b0e41575
...
...
@@ -64,6 +64,8 @@ public class CMBOneNetPayService {
private
ISysCouponDetailService
couponDetailService
;
@Autowired
private
ISysUserCouponService
userCouponService
;
@Resource
private
SysEnterpriseMapper
sysEnterpriseMapper
;
/**
* 解析app端授权信息
...
...
@@ -152,6 +154,28 @@ public class CMBOneNetPayService {
}
}
/**
* 查询发券企业信息
*
* @param coridc 企业ID
* @return
*/
public
BaseResponse
getIssEnterprise
(
String
coridc
)
{
try
{
if
(!
StringUtils
.
isNotBlank
(
coridc
))
{
return
BaseResponse
.
error
(
"企业信息错误"
,
this
.
getClass
().
getName
());
}
SysEnterprise
byCoridc
=
sysEnterpriseMapper
.
getByCoridc
(
coridc
);
if
(
byCoridc
==
null
){
return
BaseResponse
.
ok
();
}
return
BaseResponse
.
ok
(
"成功"
,
byCoridc
);
}
catch
(
Exception
e
)
{
log
.
error
(
"企业信息异常! 参数:{}"
);
return
BaseResponse
.
error
(
e
.
getMessage
(),
this
.
getClass
().
getName
());
}
}
/**
* 企业列表 (展示审批通过的企业信息,和当前app的用户id是否已经绑定会员信息)
...
...
@@ -247,19 +271,82 @@ ISysUserCouponService iSysUserCouponService;
}
}
/**已领取优惠券列表
*
* @param coridc 企业编号
* @param usridc 企业用户id
* @return
*/
public
BaseResponse
getReceivedList
(
String
coridc
,
String
usridc
)
{
public
BaseResponse
getReceivedList
(
String
coridc
,
String
usridc
)
{
try
{
List
<
ReceivedAppListVO
>
list
=
couponDetailService
.
getReceivedList
(
coridc
,
usridc
);
return
BaseResponse
.
ok
(
list
);
}
catch
(
Exception
e
)
{
log
.
error
(
"领取优惠券异常异常! 参数:{}"
,
coridc
+
","
+
usridc
);
log
.
error
(
"领取优惠券异常异常! 参数:{}"
,
usridc
);
return
BaseResponse
.
error
(
e
.
getMessage
(),
this
.
getClass
().
getName
());
}
}
/**已领取优惠券列表
*
* @param usridc 企业用户id
* @return
*/
public
BaseResponse
getAllReceivedList
(
String
usridc
)
{
try
{
List
<
ReceivedAppListVO
>
list
=
couponDetailService
.
getAllReceivedList
(
usridc
);
Map
<
String
,
List
<
ReceivedAppListVO
>>
collect
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
arg
->
arg
.
getCoridc
()));
return
BaseResponse
.
ok
(
collect
);
}
catch
(
Exception
e
)
{
log
.
error
(
"领取优惠券异常异常! 参数:{}"
,
usridc
);
return
BaseResponse
.
error
(
e
.
getMessage
(),
this
.
getClass
().
getName
());
}
}
/**个人券夹(企业)
*
* @param usridc 企业用户id
* @return
*/
public
BaseResponse
getAllReceivedListSE
(
String
coridc
,
String
usridc
)
{
try
{
List
<
ReceivedAppListVO
>
list
=
couponDetailService
.
getAllReceivedListSE
(
coridc
,
usridc
);
// Map<String, List<ReceivedAppListVO>> collect = list.stream().collect(Collectors.groupingBy(arg -> arg.getCoridc()));
return
BaseResponse
.
ok
(
list
);
}
catch
(
Exception
e
)
{
log
.
error
(
"领取优惠券异常异常! 参数:{}"
,
usridc
);
return
BaseResponse
.
error
(
e
.
getMessage
(),
this
.
getClass
().
getName
());
}
}
/**失效优惠券列表
*
* @param usridc 企业用户id
* @return
*/
public
BaseResponse
getOverdueList
(
String
usridc
)
{
try
{
List
<
ReceivedAppListVO
>
list
=
couponDetailService
.
getOverdueList
(
usridc
);
return
BaseResponse
.
ok
(
list
);
}
catch
(
Exception
e
)
{
log
.
error
(
"失效优惠券列表异常! 参数:{}"
,
usridc
);
return
BaseResponse
.
error
(
e
.
getMessage
(),
this
.
getClass
().
getName
());
}
}
/**失效优惠券列表(企业)
*
* @param usridc 企业用户id
* @return
*/
public
BaseResponse
getOverdueListSE
(
String
coridc
,
String
usridc
)
{
try
{
List
<
ReceivedAppListVO
>
list
=
couponDetailService
.
getOverdueListSE
(
coridc
,
usridc
);
return
BaseResponse
.
ok
(
list
);
}
catch
(
Exception
e
)
{
log
.
error
(
"失效优惠券列表异常! 参数:{}"
,
usridc
);
return
BaseResponse
.
error
(
e
.
getMessage
(),
this
.
getClass
().
getName
());
}
}
...
...
consume-business/src/main/java/cn/wise/sc/consume/business/service/impl/SysCouponDetailServiceImpl.java
View file @
b0e41575
...
...
@@ -30,13 +30,38 @@ public class SysCouponDetailServiceImpl extends ServiceImpl<SysCouponDetailMappe
private
SysUserCouponMapper
userCouponMapper
;
@Override
public
List
<
ReceivedAppListVO
>
getReceivedList
(
String
coridc
,
String
usridc
)
{
public
List
<
ReceivedAppListVO
>
getReceivedList
(
String
coridc
,
String
usridc
)
{
List
<
ReceivedAppListVO
>
list
=
couponDetailMapper
.
getReceivedList
(
coridc
,
usridc
);
return
list
;
}
@Override
public
List
<
ReceivedAppListVO
>
getAllReceivedList
(
String
usridc
)
{
List
<
ReceivedAppListVO
>
list
=
couponDetailMapper
.
getAllReceivedList
(
usridc
);
return
list
;
}
@Override
public
List
<
ReceivedAppListVO
>
getAllReceivedListSE
(
String
coridc
,
String
usridc
)
{
List
<
ReceivedAppListVO
>
list
=
couponDetailMapper
.
getAllReceivedListSE
(
coridc
,
usridc
);
return
list
;
}
@Override
public
List
<
ReceivedAppListVO
>
getOverdueList
(
String
usridc
)
{
List
<
ReceivedAppListVO
>
list
=
couponDetailMapper
.
getOverdueList
(
usridc
);
return
list
;
}
@Override
public
List
<
ReceivedAppListVO
>
getOverdueListSE
(
String
coridc
,
String
usridc
)
{
List
<
ReceivedAppListVO
>
list
=
couponDetailMapper
.
getOverdueListSE
(
coridc
,
usridc
);
return
list
;
}
/**
* 筛选过期优惠券,将优惠券详情表:未领取的状态改成已过期。
* 优惠券领取表-未使用的状态改为已过期
...
...
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