Commit b3e9d1bc by 郑云飞

定时任务 拼团失败退款 完成

parent 56313839
......@@ -70,13 +70,12 @@ public class GroupBuyAppController {
totalPs = 1 + totalRs / pinfo.getPageSize();
}
pinfo.setTotalPages(totalPs);
Integer joinNumber = groupBuyService.findJoinNumber();
List<String> avatarList = groupBuyService.findavatarList();
// 4.将分页对象、结果集合 封装后返回前台
rmap.put("pageinfo", pinfo);
rmap.put("items", list);
rmap.put("joinNumber", 0);
List<String> avatarList = new ArrayList<>();
avatarList.add("https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLjFK35Wvia9lJKHoXfQuHhk0qZbvpPNxrAiaEKF7aL2k4I8kuqrdTWwliamdPHeyAA7DjAg725X2GIQ/132");
rmap.put("joinNumber", joinNumber);
rmap.put("avatarList", avatarList);
return Result.success(rmap);
}
......
......@@ -75,7 +75,7 @@ public class WxController {
public String testNotifyOk(@PathVariable Integer id){
if(id == null) return null;
this.wxServiceImpl.testNotifyOk(id);
this.wxServiceImpl.handleNotifyOk(id);
return "ok";
}
......
......@@ -53,6 +53,28 @@ public class GroupOrderController {
return "groupOrder/detail";
}
/**
* 发货
* @param id
* @return
*/
@RequestMapping(value = "/updateFwStatus",method = RequestMethod.GET)
@ResponseBody
public Result updateFwStatus(Long id) {
return Result.success(groupOrderService.sendOutGoods(id));
}
/**
* 完成
* @param id
* @return
*/
@RequestMapping(value = "/successOrder")
@ResponseBody
public Result successOrder(Long id) {
return Result.success(groupOrderService.successOrder(id));
}
@RequestMapping(value = "/findPageList", method = RequestMethod.POST)
@ResponseBody
public Result findPageList(@RequestBody GroupOrder item) {
......
......@@ -71,11 +71,11 @@ public class TaskJob {
// 查询待成团并到期的团购订单
List<GroupOrder> orders = groupOrderDao.getList();
orders.forEach(order -> {
order.setGroupStatus("4");
// 查询已支付成功订单
List<OrderMain> orderMains = orderMainDao.selectByGroupOrderId(order.getId());
// 订单数小于成团数 拼团失败 进行退款
if (order.getGroupSize() < orderMains.size()) {
order.setGroupStatus("4");
// 循环退款
orderMains.forEach(orderMain -> {
try {
......@@ -85,6 +85,7 @@ public class TaskJob {
}
});
}
groupOrderDao.updateById(order);
});
}
......
......@@ -21,4 +21,9 @@ public interface GroupBuyDao extends BaseMapper<GroupBuy> {
int activityFailure();
int updateStatus(Long id);
Integer findJoinNumber();
List<String> findavatarList();
}
package com.yunniu.farming.webadmin.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yunniu.farming.common.plugin.PageInfo;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
......@@ -28,7 +30,11 @@ public class GroupOrder {
private String groupStatus;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date successTime;
@TableField(exist = false)
private String successTimeStr;
private Date createTime;
......
......@@ -36,4 +36,8 @@ public interface GroupBuyService {
List<Product> productList(Product item);
int delById(Long id);
Integer findJoinNumber();
List<String> findavatarList();
}
......@@ -28,4 +28,8 @@ public interface GroupOrderService {
List<OrderSub> productList(OrderSub item);
boolean updateRefundStatus(String outRefundNo);
int sendOutGoods(Long id);
int successOrder(Long id);
}
......@@ -42,6 +42,8 @@ public class GroupBuyServiceimpl implements GroupBuyService {
private GroupAreaDao areaDao;
@Autowired
private ProductDao productDao;
@Autowired
private DocCatalogDao docCatalogDao;
/**
* 分页查询
......@@ -137,6 +139,8 @@ public class GroupBuyServiceimpl implements GroupBuyService {
*/
@Override
public List<Product> productList(Product item) {
DocCatalog catalog = docCatalogDao.selectOne(Wrappers.<DocCatalog>lambdaQuery().like(DocCatalog::getSname, "团购"));
item.setCatalogid(catalog.getId());
return productDao.selectByParamPageList(item);
}
......@@ -149,4 +153,15 @@ public class GroupBuyServiceimpl implements GroupBuyService {
public int delById(Long id) {
return mapper.updateStatus(id);
}
@Override
public Integer findJoinNumber() {
return mapper.findJoinNumber();
}
@Override
public List<String> findavatarList() {
return mapper.findavatarList();
}
}
......@@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Objects;
......@@ -104,6 +105,10 @@ public class GroupOrderServiceImpl implements GroupOrderService {
@Override
public GroupOrder findById(Long id) {
GroupOrder order = orderDao.detailById(id);
if (order.getSuccessTime()!= null) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
order.setSuccessTimeStr(formatter.format(order.getSuccessTime()));
}
return order;
}
......@@ -145,6 +150,30 @@ public class GroupOrderServiceImpl implements GroupOrderService {
}
/**
* 发货
* @param id
* @return
*/
@Override
public int sendOutGoods(Long id) {
GroupOrder order = orderDao.selectById(id);
order.setGroupStatus("2");
return orderDao.updateById(order);
}
/**
* 完成
* @param id
* @return
*/
@Override
public int successOrder(Long id) {
GroupOrder order = orderDao.selectById(id);
order.setGroupStatus("3");
return orderDao.updateById(order);
}
/**
* 支付成功后判断团购订单是否成团
* @param curOrder
*/
......@@ -154,6 +183,7 @@ public class GroupOrderServiceImpl implements GroupOrderService {
.eq(OrderMain::getGroupOrderId, curOrder.getGroupOrderId())
.eq(OrderMain::getIpaystatus, 1)
.isNull(OrderMain::getIrefundstatus));
if (groupBuy.getGroupSize() <= count) {
orderDao.updateStatus(curOrder.getGroupOrderId());
}
......
......@@ -92,7 +92,7 @@ public class OrderMainServiceImpl {
if (item.getId() == null) {
if (item.getItype().equals(OrderMain.ITYPE_GROUP)){
if (item.getItype() != null && item.getItype().equals(OrderMain.ITYPE_GROUP)){
GroupOrder order = orderService.addGroupOrder(item);
item.setGroupOrderId(order.getId());
}
......
......@@ -409,7 +409,7 @@ public class WxServiceImpl implements WxService {
* @param id
*/
@Transactional
protected void handleNotifyOk(Integer id) {
public void handleNotifyOk(Integer id) {
// 从数据库中将信息详情查出来
OrderMain curOrder = this.orderMainDao.selectByPrimaryKey(id);
......
......@@ -15,8 +15,10 @@ public class WxConfigUtil {
public final static String UNIFIED_ORDER_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder";
public final static String PROFIT_SHARING_URL = "https://api.mch.weixin.qq.com/secapi/pay/profitsharing";
public final static String PROFIT_SHARING_ADDRECEIVER = "https://api.mch.weixin.qq.com/pay/profitsharingaddreceiver";
public final static String notify_url = "http://1.15.43.240:8330/wx/notify"; // 订单回调接口
public final static String refund_notify_url = "http://1.15.43.240:8330/wx/wxRefundNotify"; // 订单回调接口
// public final static String notify_url = "http://1.15.43.240:8330/wx/notify"; // 订单回调接口
public final static String notify_url = "http://farming.nyinhong.com/wx/notify"; // 订单回调接口
// public final static String refund_notify_url = "http://1.15.43.240:8330/wx/wxRefundNotify"; // 订单回调接口
public final static String refund_notify_url = "http://farming.nyinhong.com/wx/wxRefundNotify"; // 订单回调接口
public final static String REFUND_ORDER_URL = "https://api.mch.weixin.qq.com/secapi/pay/refund";
public static String GET_MINICODE_URL = "https://api.weixin.qq.com/wxa/getwxacodeunlimit";
......
......@@ -12,7 +12,7 @@
<where>
group_status &lt;&gt; 5
<if test="groupBuyCode != null and groupBuyCode != ''">
and group_buy_code = #{groupBuyCode,jdbcType=VARCHAR}
and id = #{groupBuyCode,jdbcType=VARCHAR}
</if>
<if test="groupBuyTitle != null and groupBuyTitle != ''">
and group_buy_title like concat('%', #{groupBuyTitle,jdbcType=VARCHAR},'%')
......@@ -37,4 +37,12 @@
<update id="updateStatus">
update group_buy set group_status =5 where id = #{id,jdbcType=BIGINT}
</update>
<select id="findJoinNumber" resultType="java.lang.Integer">
select count(1) from order_main where group_order_id is not null
</select>
<select id="findavatarList" resultType="java.lang.String">
select c.swximgurl from order_main om left join customer c on om.customerid = c.id where group_order_id is not null limit 3
</select>
</mapper>
\ No newline at end of file
......@@ -3,12 +3,12 @@
<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)
(group_buy_id, product_pic, product_id, product_name,
product_sduction, product_price, sunit, `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})
(#{id,jdbcType=BIGINT}, #{item.productPic,jdbcType=VARCHAR}, #{item.productId}, #{item.productName},
#{item.productSduction}, #{item.productPrice},#{item.sunit,jdbcType=VARCHAR}, 0, #{item.createBy})
</foreach>
</insert>
......
......@@ -62,7 +62,7 @@
</select>
<update id="updateStatus">
update group_order set group_status = 1 where id = #{groupOrderId,jdbcType=BIGINT}
update group_order set group_status = 1, success_time = now() where id = #{groupOrderId,jdbcType=BIGINT}
</update>
<select id="getBySdef1" resultType="com.yunniu.farming.webadmin.model.OrderMain">
......
......@@ -19,6 +19,7 @@
<result column="dactmoney" property="dactmoney" jdbcType="DECIMAL"/>
<result column="dactscore" property="dactscore" jdbcType="DECIMAL"/>
<result column="ipaystatus" property="ipaystatus" jdbcType="INTEGER"/>
<result column="group_order_id" property="groupOrderId" jdbcType="INTEGER"/>
<result column="irefundstatus" property="irefundstatus" jdbcType="INTEGER"/>
<result column="tpaytime" property="tpaytime" jdbcType="TIMESTAMP"/>
<result column="trefundtime" property="trefundtime" jdbcType="TIMESTAMP"/>
......@@ -136,7 +137,8 @@
ordermain.idef7,
ordermain.ddef8,
ordermain.ddef9,
ordermain.ddef10
ordermain.ddef10,
ordermain.group_order_id
</sql>
......
......@@ -47,7 +47,8 @@
</div>
<div class="layui-input-inline">
<div class="layui-input-block">
<input type="text" class="layui-input" id="areaAddress" th:value="${obj.areaAddress}" placeholder="详细地址"
<input type="text" class="layui-input" id="areaAddress" th:value="${obj.areaAddress}"
placeholder="详细地址"
name="areaAddress" style="width: 300px">
</div>
</div>
......@@ -65,7 +66,8 @@
<div class="layui-form-item">
<label class="layui-form-label">联系电话</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" id="liaisonPhone" th:value="${obj.liaisonPhone}" placeholder="联系电话"
<input type="text" class="layui-input" id="liaisonPhone" th:value="${obj.liaisonPhone}"
placeholder="联系电话"
name="liaisonPhone" style="width: 300px">
</div>
</div>
......@@ -140,13 +142,9 @@
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
if (result.code == 0) {
layer.msg("恭喜您,提交成功", {icon: 6, time: 1000}, function () {
closeLayer();
parent.layui.table.reload('tableId');
});
if (result.code == 100) {
closeLayer();
parent.layui.table.reload('tableId');
} else {
layer.msg(result.msg, {icon: 5});
}
......@@ -155,9 +153,8 @@
}
function closeLayer() {
var index = parent.layer.getFrameIndex(window.name);
//关闭当前frame
parent.layer.close(index);
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
</script>
......
......@@ -19,6 +19,8 @@
<script type="text/javascript" th:src="@{/js/ueditor/lang/zh-cn/zh-cn.js}"></script>
<script src="http://www.jq22.com/jquery/jquery-1.7.1.js"></script>
<script src="https://cdn.staticfile.org/layui/2.5.6/layui.min.js"></script>
<!-- <link href="https://cdn.jsdelivr.net/npm/xm-select/dist/xm-select.css" rel="stylesheet">-->
<script type="text/javascript" th:src="@{/js/xm-select.js}" charset="utf-8"></script>
<style>
.layui-form-label {
......@@ -62,7 +64,7 @@
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>配送小区</label>
<div class="layui-input-inline">
<select name="areaIdList" id="areaIdList" lay-filter="areaIdList" >
<select name="areaIdList" id="areaIdList" multiple>
<option th:each="list:${areaList}" th:value="${list.id}"
th:text="${list.areaName }"></option>
</select>
......@@ -85,7 +87,7 @@
<div class="layui-upload-list">
<img class="layui-upload-img" id="previewImg">
<p id="uploadText"></p>
<span style="color: red">图片建议500*250px</span>
<span style="color: red">图片建议500*400px</span>
</div>
</div>
</div>
......@@ -164,15 +166,15 @@
}
}
layui.use('form', function() {
layui.use('form', function () {
var form = layui.form;
form.render('select');
form.render();
// 监听 select 元素的 change 事件
form.on('select(areaIdList)', function(data) {
if (selectedValues.includes(parseInt(data.value))){
form.on('select(areaIdList)', function (data) {
if (selectedValues.includes(parseInt(data.value))) {
var index = selectedValues.indexOf(parseInt(data.value));
selectedValues.splice(index, 1);
}else {
} else {
selectedValues.push(parseInt(data.value));
}
console.log(selectedValues); // 打印选中的值
......@@ -221,6 +223,7 @@
$(function () {
if (id) {
console.log("===========================", '[[${obj}]]')
console.log("===========================", '[[${areaList}]]')
showPic('[[${obj.groupBuyPic}]]');
showTable('[[${obj.productList}]]');
console.log(111111111, selectedData)
......@@ -295,6 +298,7 @@
if (obj.event === 'del') {
var oldData = table.cache["tableId"];
oldData.splice(obj.tr.data('index'), 1);
selectedData = oldData;
layer.msg("删除成功", {time: 10}, function () {
table.reload('tableId', {data: oldData});
});
......@@ -400,11 +404,11 @@
processData: false,
contentType: "application/json",
success: function (result) {
if (result.code === 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
closeLayer();
parent.layui.table.reload('tableId');
});
console.log("sdffffffffffffffffff", result);
if (result.code == 100) {
console.log("sdffffffffffffffffff", 100);
closeLayer();
parent.layui.table.reload('tableId');
} else {
layer.msg(result.msg, {icon: 5});
}
......@@ -452,9 +456,9 @@
function closeLayer() {
var index = parent.layer.getFrameIndex(window.name);
console.log("sdffffffffffffffffff");
//关闭当前frame
parent.layer.close(index);
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
......
......@@ -136,9 +136,9 @@
table.render({
elem: '#tableId'
, url: 'findPageList'
, where: {}
, where: field
, method: 'post'
,contentType: "application/json" // 内容编码, json格式
, contentType: "application/json" // 内容编码, json格式
, height: 500
, toolbar: '#toolbarUtil' //开启头部工具栏,并为其绑定左侧模板
, defaultToolbar: ['filter']
......@@ -186,7 +186,7 @@
//订单状态
var status = "";
if (d.groupStatus == 3) status = "<span class='layui-badge layui-bg-orange'>生效中</span>";
if (d.groupStatus == 4) status = "<span class='layui-badge layui-bg-orange'>已失效</span>";
if (d.groupStatus == 4) status = "<span class='layui-badge layui-bg-black'>已失效</span>";
str += ' <span>' + status + '</span>';
str += '</div>';
return str ? str : "";
......
......@@ -72,7 +72,7 @@
<label class="layui-form-label">成团时间</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" name="successTime" id="successTime"
th:value="${obj.successTime}">
th:value="${obj.successTimeStr}">
</div>
<label class="layui-form-label">小区名称</label>
<div class="layui-input-inline">
......
......@@ -274,11 +274,9 @@
param.istatus = 30;
$.ajax({
url: "updateFwStatus",
data: JSON.stringify(param),
type: "POST",
url: "updateFwStatus?id=" + id,
type: "GET",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
if (result.code == 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
......@@ -361,9 +359,8 @@
param.istatus = 90;
$.ajax({
url: "updateOkStatus",
data: JSON.stringify(param),
type: "POST",
url: "successOrder?id=" + id,
type: "GET",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment