Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
farming
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郑云飞
farming
Commits
151019ec
Commit
151019ec
authored
May 19, 2023
by
郑云飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定时任务 拼团失败退款 完成
parent
327439c0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
337 additions
and
78 deletions
+337
-78
src/main/java/com/yunniu/farming/app/WxController.java
+15
-0
src/main/java/com/yunniu/farming/webadmin/controller/GroupAreaController.java
+1
-1
src/main/java/com/yunniu/farming/webadmin/controller/GroupBuyController.java
+28
-3
src/main/java/com/yunniu/farming/webadmin/controller/GroupOrderController.java
+1
-1
src/main/java/com/yunniu/farming/webadmin/controller/TaskJob.java
+40
-0
src/main/java/com/yunniu/farming/webadmin/dao/GroupBuyProductDao.java
+3
-0
src/main/java/com/yunniu/farming/webadmin/dao/GroupOrderDao.java
+7
-0
src/main/java/com/yunniu/farming/webadmin/dao/OrderMainDao.java
+2
-0
src/main/java/com/yunniu/farming/webadmin/model/GroupBuy.java
+12
-0
src/main/java/com/yunniu/farming/webadmin/model/Product.java
+3
-1
src/main/java/com/yunniu/farming/webadmin/service/WxService.java
+1
-0
src/main/java/com/yunniu/farming/webadmin/service/impl/GroupBuyServiceimpl.java
+17
-19
src/main/java/com/yunniu/farming/webadmin/service/impl/GroupOrderServiceImpl.java
+16
-0
src/main/java/com/yunniu/farming/webadmin/service/impl/WxServiceImpl.java
+57
-2
src/main/resources/mappings/GroupBuyProductMapper.xml
+22
-7
src/main/resources/mappings/GroupOrderMapper.xml
+21
-0
src/main/resources/mappings/OrderMainMapper.xml
+6
-0
src/main/resources/templates/groupArea/list.html
+0
-1
src/main/resources/templates/groupBuy/addOrEdit.html
+85
-40
src/main/resources/templates/groupBuy/list.html
+0
-1
src/main/resources/templates/user/list.html
+0
-2
No files found.
src/main/java/com/yunniu/farming/app/WxController.java
View file @
151019ec
...
...
@@ -80,6 +80,21 @@ public class WxController {
return
"ok"
;
}
/**
* 微信退款
*
* @param request
* @return
*/
@RequestMapping
(
value
=
"/wxPay"
,
method
=
RequestMethod
.
POST
)
public
Result
wxRefund
(
Integer
userId
,
Integer
orderId
,
HttpServletRequest
request
)
{
try
{
return
wxService
.
wxRefund
(
userId
,
orderId
,
request
);
}
catch
(
Exception
e
)
{
return
new
Result
(
103
);
}
}
// @RequestMapping(value = "/asd", method = {RequestMethod.POST, RequestMethod.GET})
...
...
src/main/java/com/yunniu/farming/webadmin/controller/GroupAreaController.java
View file @
151019ec
...
...
@@ -43,7 +43,7 @@ public class GroupAreaController {
GroupArea
area
=
groupAreaService
.
findById
(
areaId
);
model
.
addAttribute
(
"obj"
,
area
);
}
return
"
/
groupArea/addOrEdit"
;
return
"groupArea/addOrEdit"
;
}
/**
...
...
src/main/java/com/yunniu/farming/webadmin/controller/GroupBuyController.java
View file @
151019ec
...
...
@@ -3,9 +3,10 @@ package com.yunniu.farming.webadmin.controller;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.core.toolkit.ObjectUtils
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yunniu.farming.common.plugin.PageInfo
;
import
com.yunniu.farming.result.Result
;
import
com.yunniu.farming.util.COSUtil
;
import
com.yunniu.farming.util.FileUtil
;
import
com.yunniu.farming.webadmin.model.GroupArea
;
import
com.yunniu.farming.webadmin.model.GroupBuy
;
import
com.yunniu.farming.webadmin.model.Product
;
...
...
@@ -15,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -55,7 +57,7 @@ public class GroupBuyController {
}
List
<
GroupArea
>
areas
=
groupAreaService
.
findList
();
model
.
addAttribute
(
"areaList"
,
areas
);
return
"
/
groupBuy/addOrEdit"
;
return
"groupBuy/addOrEdit"
;
}
/**
...
...
@@ -127,6 +129,9 @@ public class GroupBuyController {
if
(
ObjectUtils
.
isEmpty
(
item
.
getGroupSize
())){
return
Result
.
error
(
"最低起送人数不能为空"
);
}
if
(
StringUtils
.
isEmpty
(
item
.
getGroupBuyPic
())){
return
Result
.
error
(
"图片不能为空"
);
}
if
(
CollectionUtils
.
isEmpty
(
item
.
getAreaIdList
())){
return
Result
.
error
(
"配送小区不能为空"
);
}
...
...
@@ -188,5 +193,25 @@ public class GroupBuyController {
return
Result
.
success
(
rmap
);
}
@RequestMapping
(
value
=
"uploads"
)
@ResponseBody
public
Map
<
String
,
Object
>
uploads
(
@RequestParam
(
value
=
"upfile"
,
required
=
false
)
MultipartFile
upfile
)
throws
Exception
{
Map
<
String
,
Object
>
rs
=
new
HashMap
<
String
,
Object
>();
try
{
if
(!
upfile
.
isEmpty
())
{
String
path
=
FileUtil
.
saveFile
(
upfile
,
"group"
);
String
url
=
COSUtil
.
uploadFileByPath
(
path
);
rs
.
put
(
"state"
,
"SUCCESS"
);
// UEDITOR的规则:不为SUCCESS则显示state的内容
rs
.
put
(
"url"
,
url
);
// 能访问到你如今图片的路径
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
rs
.
put
(
"state"
,
e
.
getMessage
());
rs
.
put
(
"url"
,
""
);
rs
.
put
(
"title"
,
""
);
rs
.
put
(
"original"
,
""
);
}
return
rs
;
}
}
src/main/java/com/yunniu/farming/webadmin/controller/GroupOrderController.java
View file @
151019ec
...
...
@@ -50,7 +50,7 @@ public class GroupOrderController {
GroupOrder
order
=
groupOrderService
.
findById
(
id
);
model
.
addAttribute
(
"obj"
,
order
);
}
return
"
/
groupOrder/detail"
;
return
"groupOrder/detail"
;
}
@RequestMapping
(
value
=
"/findPageList"
,
method
=
RequestMethod
.
POST
)
...
...
src/main/java/com/yunniu/farming/webadmin/controller/TaskJob.java
View file @
151019ec
...
...
@@ -3,12 +3,20 @@ package com.yunniu.farming.webadmin.controller;
import
cn.hutool.core.lang.WeightRandom
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.yunniu.farming.util.DateTools
;
import
com.yunniu.farming.webadmin.dao.CustomerDao
;
import
com.yunniu.farming.webadmin.dao.GroupOrderDao
;
import
com.yunniu.farming.webadmin.dao.OrderMainDao
;
import
com.yunniu.farming.webadmin.model.Customer
;
import
com.yunniu.farming.webadmin.model.GroupOrder
;
import
com.yunniu.farming.webadmin.model.OrderMain
;
import
com.yunniu.farming.webadmin.service.WxService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
...
...
@@ -20,6 +28,12 @@ public class TaskJob {
@Autowired
private
CustomerDao
customerDao
;
@Autowired
private
GroupOrderDao
groupOrderDao
;
@Autowired
private
OrderMainDao
orderMainDao
;
@Autowired
private
WxService
wxService
;
//定时任务
@Scheduled
(
cron
=
"0 0 0 * * ? "
)
// 每天凌晨零点零分零秒
...
...
@@ -47,6 +61,32 @@ public class TaskJob {
}
}
/**
* 定时修改团购订单状态
*/
@Scheduled
(
cron
=
"59 59 23 * * ? "
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
successGroup
()
throws
Exception
{
// 查询待成团并到期的团购订单
List
<
GroupOrder
>
orders
=
groupOrderDao
.
getList
();
orders
.
forEach
(
order
->
{
// 查询已支付成功订单
List
<
OrderMain
>
orderMains
=
orderMainDao
.
selectByGroupOrderId
(
order
.
getId
());
// 订单数小于成团数 拼团失败 进行退款
if
(
order
.
getGroupSize
()
<
orderMains
.
size
()){
order
.
setGroupStatus
(
"4"
);
// 循环退款
orderMains
.
forEach
(
orderMain
->
{
try
{
wxService
.
wxRefund
(
orderMain
.
getCustomerid
(),
orderMain
.
getId
(),
null
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
});
}
});
}
//改变会员用户状态
public
void
updateUserVipStatus
(
Customer
user
){
...
...
src/main/java/com/yunniu/farming/webadmin/dao/GroupBuyProductDao.java
View file @
151019ec
...
...
@@ -2,6 +2,7 @@ package com.yunniu.farming.webadmin.dao;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yunniu.farming.webadmin.model.GroupBuyProduct
;
import
com.yunniu.farming.webadmin.model.Product
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -15,4 +16,6 @@ import java.util.List;
@Mapper
public
interface
GroupBuyProductDao
extends
BaseMapper
<
GroupBuyProduct
>
{
int
insertBath
(
@Param
(
"products"
)
List
<
GroupBuyProduct
>
products
,
@Param
(
"id"
)
Long
id
);
List
<
Product
>
getList
(
Long
id
);
}
src/main/java/com/yunniu/farming/webadmin/dao/GroupOrderDao.java
View file @
151019ec
package
com
.
yunniu
.
farming
.
webadmin
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yunniu.farming.webadmin.model.GroupBuy
;
import
com.yunniu.farming.webadmin.model.GroupOrder
;
import
org.apache.ibatis.annotations.Mapper
;
...
...
@@ -17,4 +18,10 @@ public interface GroupOrderDao extends BaseMapper<GroupOrder> {
List
<
GroupOrder
>
findPageList
(
GroupOrder
item
);
GroupOrder
detailById
(
Long
id
);
List
<
GroupOrder
>
getList
();
GroupBuy
getGroupBuy
(
Long
groupOrderId
);
int
updateStatus
(
Long
groupOrderId
);
}
src/main/java/com/yunniu/farming/webadmin/dao/OrderMainDao.java
View file @
151019ec
...
...
@@ -18,4 +18,6 @@ public interface OrderMainDao extends BaseMapper<OrderMain> {
Double
countOrderMoney
(
OrderMain
orderMain
);
List
<
OrderMain
>
getPageListByGroupOrderId
(
OrderMain
item
);
List
<
OrderMain
>
selectByGroupOrderId
(
Long
id
);
}
src/main/java/com/yunniu/farming/webadmin/model/GroupBuy.java
View file @
151019ec
...
...
@@ -50,6 +50,8 @@ public class GroupBuy {
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
startTime
;
@TableField
(
exist
=
false
)
private
String
startDate
;
/**
* 拼团结束时间
...
...
@@ -57,6 +59,9 @@ public class GroupBuy {
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
endTime
;
@TableField
(
exist
=
false
)
private
String
endDate
;
/**
* 团购状态:1 待发布,2待生效,3已生效,4已结束,5已删除
...
...
@@ -125,6 +130,9 @@ public class GroupBuy {
private
List
<
GroupBuyProduct
>
products
;
@TableField
(
exist
=
false
)
private
String
productList
;
@TableField
(
exist
=
false
)
private
List
<
GroupArea
>
areas
;
@TableField
(
exist
=
false
)
...
...
@@ -139,4 +147,8 @@ public class GroupBuy {
@TableField
(
exist
=
false
)
private
String
startAndEndTime
;
@TableField
(
exist
=
false
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
private
String
[]
goodsImgArr
;
}
src/main/java/com/yunniu/farming/webadmin/model/Product.java
View file @
151019ec
...
...
@@ -91,5 +91,6 @@ public class Product {
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
private
Date
ddef10
;
@TableField
(
exist
=
false
)
private
BigDecimal
productPrice
;
}
\ No newline at end of file
src/main/java/com/yunniu/farming/webadmin/service/WxService.java
View file @
151019ec
...
...
@@ -15,4 +15,5 @@ public interface WxService {
void
notify
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
,
JDOMException
;
Result
wxRefund
(
Integer
userId
,
Integer
orderId
,
HttpServletRequest
request
)
throws
Exception
;
}
src/main/java/com/yunniu/farming/webadmin/service/impl/GroupBuyServiceimpl.java
View file @
151019ec
...
...
@@ -19,7 +19,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @author zyf
...
...
@@ -60,24 +64,16 @@ public class GroupBuyServiceimpl implements GroupBuyService {
public
Result
addOrEdit
(
GroupBuy
item
)
{
// 判断是否为新增
if
(
ObjectUtils
.
isEmpty
(
item
.
getId
()))
{
String
imgArr
=
item
.
getGroupBuyPic
();
String
pics
=
""
;
if
(
StringUtils
.
isNotEmpty
(
imgArr
))
{
if
(
imgArr
.
startsWith
(
"data:image"
))
{
String
suffix
=
imgArr
.
substring
(
imgArr
.
indexOf
(
"/"
)
+
1
,
imgArr
.
indexOf
(
";"
));
String
realpath
=
FileUtil
.
BasePath
+
"/group/"
+
UUIDUtils
.
getUUID
()
+
"."
+
suffix
;
String
url
=
COSUtil
.
uploadFileByPath
(
realpath
);
pics
=
url
;
}
}
if
(
""
.
equals
(
pics
))
{
return
Result
.
error
(
"图片不能为空!"
);
}
item
.
setGroupBuyPic
(
pics
);
// 设置小区id集合的值
item
.
setAreaIds
(
JSON
.
toJSONString
(
item
.
getAreaIdList
()));
item
.
setGroupStatus
(
3
);
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
item
.
getEndTime
());
cal
.
set
(
Calendar
.
HOUR_OF_DAY
,
23
);
//时
cal
.
set
(
Calendar
.
MINUTE
,
59
);
//分
cal
.
set
(
Calendar
.
SECOND
,
59
);
//秒
cal
.
set
(
Calendar
.
MILLISECOND
,
0
);
//毫秒
item
.
setEndTime
(
cal
.
getTime
());
// 保存活动基础信息
this
.
mapper
.
insert
(
item
);
// 判断活动商品是否有值
...
...
@@ -103,11 +99,12 @@ public class GroupBuyServiceimpl implements GroupBuyService {
public
GroupBuy
findById
(
Long
id
)
{
// 团购基础信息
GroupBuy
groupBuy
=
this
.
mapper
.
selectById
(
id
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
groupBuy
.
setStartDate
(
formatter
.
format
(
groupBuy
.
getStartTime
()));
groupBuy
.
setEndDate
(
formatter
.
format
(
groupBuy
.
getEndTime
()));
// 团购商品
List
<
GroupBuyProduct
>
products
=
groupBuyProductDao
.
selectList
(
Wrappers
.<
GroupBuyProduct
>
lambdaQuery
()
.
eq
(
GroupBuyProduct:
:
getGroupBuyId
,
id
)
.
eq
(
GroupBuyProduct:
:
getStatus
,
0
));
groupBuy
.
setProducts
(
products
);
List
<
Product
>
products
=
groupBuyProductDao
.
getList
(
id
);
groupBuy
.
setProductList
(
JSON
.
toJSONString
(
products
));
// 团购小区
String
areaIds
=
groupBuy
.
getAreaIds
();
if
(
StringUtils
.
isNotEmpty
(
areaIds
))
{
...
...
@@ -117,6 +114,7 @@ public class GroupBuyServiceimpl implements GroupBuyService {
.
in
(
GroupArea:
:
getId
,
areaIdList
)
.
eq
(
GroupArea:
:
getAreaStatus
,
0
));
groupBuy
.
setAreas
(
groupAreas
);
groupBuy
.
setAreaIdList
(
areaIdList
);
}
}
return
groupBuy
;
...
...
src/main/java/com/yunniu/farming/webadmin/service/impl/GroupOrderServiceImpl.java
View file @
151019ec
...
...
@@ -127,4 +127,20 @@ public class GroupOrderServiceImpl implements GroupOrderService {
public
List
<
OrderSub
>
productList
(
OrderSub
item
)
{
return
orderSubDao
.
getPageListByOrderMianId
(
item
);
}
/**
* 支付成功后判断团购订单是否成团
* @param curOrder
*/
public
void
isSuccess
(
OrderMain
curOrder
)
{
GroupBuy
groupBuy
=
orderDao
.
getGroupBuy
(
curOrder
.
getGroupOrderId
());
Long
count
=
orderMainDao
.
selectCount
(
Wrappers
.<
OrderMain
>
lambdaQuery
()
.
eq
(
OrderMain:
:
getGroupOrderId
,
curOrder
.
getGroupOrderId
())
.
eq
(
OrderMain:
:
getIpaystatus
,
1
)
.
isNull
(
OrderMain:
:
getIrefundstatus
));
if
(
groupBuy
.
getGroupSize
()
<=
count
)
{
orderDao
.
updateStatus
(
curOrder
.
getGroupOrderId
());
}
}
}
src/main/java/com/yunniu/farming/webadmin/service/impl/WxServiceImpl.java
View file @
151019ec
...
...
@@ -7,12 +7,14 @@ import com.yunniu.farming.util.StringHelper;
import
com.yunniu.farming.util.UrlUtil
;
import
com.yunniu.farming.webadmin.dao.*
;
import
com.yunniu.farming.webadmin.model.*
;
import
com.yunniu.farming.webadmin.service.GroupOrderService
;
import
com.yunniu.farming.webadmin.service.WxService
;
import
com.yunniu.farming.util.UUIDUtils
;
import
com.yunniu.farming.wx.WxConfigUtil
;
import
com.yunniu.farming.wx.WxUtil
;
import
com.yunniu.farming.wx.XMLUtil
;
import
org.jdom.JDOMException
;
import
org.osgi.framework.ServiceException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -38,6 +40,9 @@ public class WxServiceImpl implements WxService {
@Autowired
private
IntegralrecDao
integralrecDao
;
@Autowired
private
GroupOrderServiceImpl
groupOrderService
;
// @Autowired
...
...
@@ -207,7 +212,56 @@ public class WxServiceImpl implements WxService {
out
.
close
();
}
/**
* 退款
* @param userId
* @param orderId
* @param request
* @return
*/
@Override
public
Result
wxRefund
(
Integer
userId
,
Integer
orderId
,
HttpServletRequest
request
)
throws
Exception
{
OrderMain
order
=
orderMainDao
.
selectByPrimaryKey
(
orderId
);
if
(
order
==
null
||
!
order
.
getCustomerid
().
equals
(
userId
))
{
return
new
Result
(
102
);
}
order
.
setSdef1
(
"R"
+
StringHelper
.
getOrderno
());
// 退款单号
order
.
setSrefundreason
(
"拼团失败"
);
// 退款理由
order
.
setIrefundstatus
(
0
);
order
.
setTrefundtime
(
new
Date
());
orderMainDao
.
updateById
(
order
);
double
tradeMoney
=
order
.
getDactmoney
();
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"###################"
);
SortedMap
<
Object
,
Object
>
parameters
=
new
TreeMap
<
Object
,
Object
>();
parameters
.
put
(
"appid"
,
WxConfigUtil
.
APPID
);
// 应用APPID
parameters
.
put
(
"mch_id"
,
WxConfigUtil
.
MCH_ID
);
// 微信支付分配的商户号
parameters
.
put
(
"nonce_str"
,
WxUtil
.
generateNonceStr
());
// 随机字符串,不长于32位
parameters
.
put
(
"sign_type"
,
WxConfigUtil
.
MD5
);
// 签名类型
parameters
.
put
(
"out_trade_no"
,
order
.
getSorderno
());
// 商户订单号
parameters
.
put
(
"refund_fee_type"
,
"CNY"
);
// 默认人民币:CNY
parameters
.
put
(
"total_fee"
,
decimalFormat
.
format
(
tradeMoney
*
100
));
// 订单总金额
parameters
.
put
(
"refund_fee"
,
decimalFormat
.
format
(
tradeMoney
*
100
));
// 订单总金额
//parameters.put("profit_sharing", "Y");
// 用户端实际ip
parameters
.
put
(
"notify_url"
,
WxConfigUtil
.
notify_url
);
// 接收微信支付异步通知回调地址
System
.
out
.
println
(
"sign====="
+
parameters
);
// 设置签名
String
sign
=
WxUtil
.
createSignMD5
(
parameters
);
System
.
out
.
println
(
"sign====="
+
sign
);
parameters
.
put
(
"sign"
,
sign
);
// 封装请求参数结束
String
requestXML
=
WxUtil
.
getRequestXml
(
parameters
);
System
.
out
.
println
(
requestXML
);
// 调用统一下单接口
String
result
=
WxUtil
.
httpsRequest
(
WxConfigUtil
.
REFUND_ORDER_URL
,
"POST"
,
requestXML
);
System
.
out
.
println
(
result
);
Map
<
String
,
String
>
map
=
XMLUtil
.
doXMLParse
(
result
);
if
(!
"SUCCESS"
.
equals
(
map
.
get
(
"result_code"
))){
throw
new
ServiceException
(
"退款失败:"
+
map
.
get
(
"return_msg"
));
}
return
new
Result
();
}
/**
...
...
@@ -224,9 +278,10 @@ public class WxServiceImpl implements WxService {
//购买商品订单
if
(
curOrder
.
getItype
()
!=
null
&&
curOrder
.
getItype
()
==
OrderMain
.
ITYPE_TAKE
){
this
.
oderMainServiceImpl
.
handleCommProuctOrder
(
curOrder
);
}
else
if
(
curOrder
.
getItype
()
!=
null
&&
curOrder
.
getItype
()
==
OrderMain
.
ITYPE_GROUP
){
this
.
oderMainServiceImpl
.
handleCommProuctOrder
(
curOrder
);
this
.
groupOrderService
.
isSuccess
(
curOrder
);
}
}
...
...
src/main/resources/mappings/GroupBuyProductMapper.xml
View file @
151019ec
<?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=
"com.yunniu.farming.webadmin.dao.GroupBuyProductDao"
>
<insert
id=
"insertBath"
>
insert into group_buy_product
(group_buy_id, product_id, product_name,
product_sduction, product_price,
`status`, create_by)
product_sduction, product_price,
`status`, create_by)
values
<foreach
collection=
"products"
index=
"index"
item=
"item"
separator=
","
>
(
#{id,jdbcType=BIGINT}, #{item.productId}, #{item.productName},
#{item.productSduction}, #{item.productPrice}, 0, #{item.createBy}
)
<foreach
collection=
"products"
index=
"index"
item=
"item"
separator=
","
>
(#{id,jdbcType=BIGINT}, #{item.productId}, #{item.productName},
#{item.productSduction}, #{item.productPrice}, 0, #{item.createBy})
</foreach>
</insert>
<select
id=
"getList"
resultType=
"com.yunniu.farming.webadmin.model.Product"
>
select gbp.product_price,
p.id,
p.sshortpic,
p.sname,
p.sduction,
p.sunit,
p.doldprice,
p.dsaleprice,
dc.sname as catalogName
from group_buy_product gbp
left join product p on gbp.product_id = p.id
left join doc_catalog dc on p.catalogid = dc.id
where gbp.group_buy_id = #{id,jdbcType=BIGINT}
and gbp.status = 0
</select>
</mapper>
\ No newline at end of file
src/main/resources/mappings/GroupOrderMapper.xml
View file @
151019ec
...
...
@@ -44,4 +44,24 @@
left join order_main om on go.id = om.group_order_id and om.ipaystatus = 1
where go.id = #{id,jdbcType=BIGINT}
</select>
<select
id=
"getList"
resultType=
"com.yunniu.farming.webadmin.model.GroupOrder"
>
select go.*,
gb.group_size
from group_order go
left join group_buy gb on go.group_buy_id = gb.id
where go.group_status = 0
and gb.end_time
<
= now()
</select>
<select
id=
"getGroupBuy"
resultType=
"com.yunniu.farming.webadmin.model.GroupBuy"
>
select gb.*
from group_order go
left join group_buy gb on go.group_buy_id = gb.id
where go.id = #{groupOrderId,jdbcType=BIGINT}
</select>
<update
id=
"updateStatus"
>
update group_order set group_status = 1 where id = #{groupOrderId,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
src/main/resources/mappings/OrderMainMapper.xml
View file @
151019ec
...
...
@@ -312,4 +312,10 @@
left join customer c on om.customerid = c.id
where om.group_order_id = #{id,jdbcType=BIGINT}
</select>
<select
id=
"selectByGroupOrderId"
resultMap=
"BaseResultMap"
>
select *
from order_main
where group_order_id = #{id,jdbcType=BIGINT} and ipaystatus = 1
</select>
</mapper>
src/main/resources/templates/groupArea/list.html
View file @
151019ec
...
...
@@ -194,7 +194,6 @@
//监听行工具事件
table
.
on
(
'tool(tableId)'
,
function
(
obj
)
{
var
data
=
obj
.
data
;
//console.log(obj)
if
(
obj
.
event
===
'del'
)
{
layer
.
confirm
(
'删除后无法撤销,确定继续吗?'
,
function
(
index
)
{
$
.
ajax
({
...
...
src/main/resources/templates/groupBuy/addOrEdit.html
View file @
151019ec
This diff is collapsed.
Click to expand it.
src/main/resources/templates/groupBuy/list.html
View file @
151019ec
...
...
@@ -259,7 +259,6 @@
//监听行工具事件
table
.
on
(
'tool(tableId)'
,
function
(
obj
)
{
var
data
=
obj
.
data
;
//console.log(obj)
if
(
obj
.
event
===
'del'
)
{
layer
.
confirm
(
'删除后无法撤销,确定继续吗?'
,
function
(
index
)
{
$
.
ajax
({
...
...
src/main/resources/templates/user/list.html
View file @
151019ec
...
...
@@ -106,7 +106,6 @@
form
.
on
(
'submit(The-search)'
,
function
(
data
)
{
field
=
data
.
field
;
//执行重载
// console.log(field)
table
.
reload
(
'tableId'
,
{
where
:
field
,
page
:
{
...
...
@@ -230,7 +229,6 @@
var
data
=
obj
.
data
;
var
id
=
data
.
userId
;
var
name
=
data
.
userName
;
//console.log(obj)
//启用
if
(
obj
.
event
===
'distributor'
)
{
layer
.
confirm
(
'确定更改'
+
name
+
'状态吗?'
,
function
(
index
)
{
...
...
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