Commit 6d3c274f by caiyt

完善需求功能及修复bug

parent b0288c32
...@@ -4,13 +4,17 @@ import com.soss.common.core.controller.BaseController; ...@@ -4,13 +4,17 @@ import com.soss.common.core.controller.BaseController;
import com.soss.common.core.domain.AjaxResult; import com.soss.common.core.domain.AjaxResult;
import com.soss.common.core.domain.model.LoginUser; import com.soss.common.core.domain.model.LoginUser;
import com.soss.common.core.page.TableDataInfo; import com.soss.common.core.page.TableDataInfo;
import com.soss.common.exception.ServiceException;
import com.soss.common.utils.StringUtils;
import com.soss.common.utils.spring.SpringUtils; import com.soss.common.utils.spring.SpringUtils;
import com.soss.framework.web.service.TokenService; import com.soss.framework.web.service.TokenService;
import com.soss.system.domain.Customer;
import com.soss.system.domain.Order; import com.soss.system.domain.Order;
import com.soss.system.domain.vo.customer.CustomerQueryVo; import com.soss.system.domain.vo.customer.CustomerQueryVo;
import com.soss.system.domain.vo.customer.CustomerResultVo; import com.soss.system.domain.vo.customer.CustomerResultVo;
import com.soss.system.service.ICustomerService; import com.soss.system.service.ICustomerService;
import com.soss.system.service.impl.CustomerServiceImpl; import com.soss.system.service.impl.CustomerServiceImpl;
import io.jsonwebtoken.lang.Assert;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
...@@ -18,6 +22,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -18,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* 用户信息Controller * 用户信息Controller
...@@ -36,11 +41,52 @@ public class CustomerController extends BaseController ...@@ -36,11 +41,52 @@ public class CustomerController extends BaseController
@GetMapping("/allow") @GetMapping("/allow")
public AjaxResult allow(HttpServletRequest request,String allow){ public AjaxResult allow(HttpServletRequest request, String allow) {
TokenService bean = SpringUtils.getBean(TokenService.class); TokenService bean = SpringUtils.getBean(TokenService.class);
LoginUser loginUser = bean.getLoginUser(request); LoginUser loginUser = bean.getLoginUser(request);
return AjaxResult.success(SpringUtils.getBean(CustomerServiceImpl.class).allow(loginUser.getOpenId(),allow)); return AjaxResult.success(SpringUtils.getBean(CustomerServiceImpl.class).allow(loginUser.getOpenId(), allow));
}
@GetMapping("/detail")
@ApiOperation("查询用户详细信息")
public AjaxResult updateCust(HttpServletRequest request) {
LoginUser loginUser = tokenService.getLoginUser(request);
if (loginUser == null) {
throw new ServiceException("请先登录");
}
Customer customer = customerService.selectCustById(loginUser.getOpenId());
return AjaxResult.success(customer);
}
@PostMapping("/update/base")
@ApiOperation("修改用户基本信息:昵称和性别")
public AjaxResult updateCust(HttpServletRequest request, @RequestBody Customer customer) {
custPmsCheck(request, customer.getId());
Assert.isTrue(!StringUtils.isEmpty(customer.getUserName()), "昵称未传递");
Assert.isTrue(customer.getUserName().length() <= 7, "昵称最多七个字");
Assert.notNull(customer.getSex(), "性别还未传递");
Assert.isNull(customer.getBirthday(), "该方法不支持修改生日");
customerService.updateCustomer(customer);
return AjaxResult.success();
}
@PostMapping("/update/birth")
@ApiOperation("修改用户生日")
public AjaxResult updateCustBirth(HttpServletRequest request, @RequestBody Customer customer) {
custPmsCheck(request, customer.getId());
Assert.notNull(customer.getBirthday(), "生日还未传递");
customerService.updateCustBirthday(customer);
return AjaxResult.success();
}
private void custPmsCheck(HttpServletRequest request, String custId) {
Assert.isTrue(!StringUtils.isEmpty(custId), "用户id未传递");
LoginUser loginUser = tokenService.getLoginUser(request);
if (loginUser == null) {
throw new ServiceException("请先登录");
}
Assert.isTrue(Objects.equals(custId, loginUser.getOpenId()), "不能修改他人信息");
} }
/** /**
...@@ -48,8 +94,7 @@ public class CustomerController extends BaseController ...@@ -48,8 +94,7 @@ public class CustomerController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:customer:list')") @PreAuthorize("@ss.hasPermi('system:customer:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(CustomerQueryVo customerQueryVo) public TableDataInfo list(CustomerQueryVo customerQueryVo) {
{
startPage(); startPage();
List<CustomerResultVo> list = customerService.selectCustomerList(customerQueryVo); List<CustomerResultVo> list = customerService.selectCustomerList(customerQueryVo);
return getDataTable(list); return getDataTable(list);
......
...@@ -83,12 +83,16 @@ public class OrderController extends BaseController { ...@@ -83,12 +83,16 @@ public class OrderController extends BaseController {
return AjaxResult.error("未授权地理位置不允许下单"); return AjaxResult.error("未授权地理位置不允许下单");
} }
if (order.getSendMsgFlag1() == null || order.getSendMsgFlag2() == null || order.getSendMsgFlag3() == null) {
return AjaxResult.error("授权发送消息权限未传递");
}
AjaxResult result = check(order); AjaxResult result = check(order);
if (HttpStatus.SUCCESS != (int) result.get(result.CODE_TAG)) { if (HttpStatus.SUCCESS != (int) result.get(result.CODE_TAG)) {
return result; return result;
} }
try { try {
orderService.checkBusinessTime(order.getShopId()); orderService.checkShopInfo(order);
if (order.getCouponId() != null) { if (order.getCouponId() != null) {
List<CouponVo> couponVos = couponUserService.listCustAvailableCoupon(loginUser.getOpenId(), order.getCouponId()); List<CouponVo> couponVos = couponUserService.listCustAvailableCoupon(loginUser.getOpenId(), order.getCouponId());
if (CollectionUtils.isEmpty(couponVos)) { if (CollectionUtils.isEmpty(couponVos)) {
...@@ -131,7 +135,7 @@ public class OrderController extends BaseController { ...@@ -131,7 +135,7 @@ public class OrderController extends BaseController {
Order order = orderService.selectOrderById(orderId); Order order = orderService.selectOrderById(orderId);
order.setOrderNo(orderService.getOrderNo(order.getSource())); order.setOrderNo(orderService.getOrderNo(order.getSource()));
orderService.updateOrder(order); orderService.updateOrder(order);
int amount = order.getAmount().movePointRight(2).intValue(); int amount = order.getPaidAmount().movePointRight(2).intValue();
Map payInfo = weixinService.pay(request, "hooloo", order.getOrderNo(), order.getUserId(), amount); Map payInfo = weixinService.pay(request, "hooloo", order.getOrderNo(), order.getUserId(), amount);
if (payInfo != null) { if (payInfo != null) {
return AjaxResult.success(payInfo); return AjaxResult.success(payInfo);
......
...@@ -6,6 +6,7 @@ import com.soss.common.core.domain.AjaxResult; ...@@ -6,6 +6,7 @@ import com.soss.common.core.domain.AjaxResult;
import com.soss.common.core.domain.model.LoginUser; import com.soss.common.core.domain.model.LoginUser;
import com.soss.common.core.page.TableDataInfo; import com.soss.common.core.page.TableDataInfo;
import com.soss.common.enums.BusinessType; import com.soss.common.enums.BusinessType;
import com.soss.common.enums.RefundState;
import com.soss.framework.web.service.TokenService; import com.soss.framework.web.service.TokenService;
import com.soss.framework.web.service.WeixinServiceImpl; import com.soss.framework.web.service.WeixinServiceImpl;
import com.soss.system.domain.Order; import com.soss.system.domain.Order;
...@@ -13,6 +14,7 @@ import com.soss.system.domain.OrderRefund; ...@@ -13,6 +14,7 @@ import com.soss.system.domain.OrderRefund;
import com.soss.system.domain.vo.OrderQuery; import com.soss.system.domain.vo.OrderQuery;
import com.soss.system.service.IOrderRefundService; import com.soss.system.service.IOrderRefundService;
import com.soss.system.service.impl.OrderServiceImpl; import com.soss.system.service.impl.OrderServiceImpl;
import io.jsonwebtoken.lang.Assert;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -66,27 +68,28 @@ public class OrderRefundController extends BaseController ...@@ -66,27 +68,28 @@ public class OrderRefundController extends BaseController
*/ */
@Log(title = "订单退款", businessType = BusinessType.INSERT) @Log(title = "订单退款", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(HttpServletRequest request, @RequestBody OrderRefund orderRefund) public AjaxResult add(HttpServletRequest request, @RequestBody OrderRefund orderRefund) {
{ Assert.notNull(orderRefund.getRefundAmount(), "退款金额还未传递");
Assert.notEmpty(orderRefund.getOrderDetailIds(), "退款订单明细ID还未传递");
LoginUser loginUser = tokenService.getLoginUser(request); LoginUser loginUser = tokenService.getLoginUser(request);
orderRefund.setCreateUserName(loginUser.getUsername()); orderRefund.setCreateUserName(loginUser.getUsername());
AjaxResult ajaxResult = orderRefundService.insertOrderRefund(orderRefund); AjaxResult ajaxResult = orderRefundService.insertOrderRefund(orderRefund);
Object obejct = ajaxResult.get(AjaxResult.DATA_TAG); Object obejct = ajaxResult.get(AjaxResult.DATA_TAG);
if(obejct!=null && obejct instanceof OrderRefund){ if (obejct instanceof OrderRefund) {
OrderRefund orderRefund1 = (OrderRefund) obejct; OrderRefund orderRefund1 = (OrderRefund) obejct;
if("0".equals(orderRefund1.getState())){ if (RefundState.PENDING.getState().equals(orderRefund1.getState())) {
int totalFee = orderRefund1.getTotalFee().movePointRight(2).intValue(); int totalFee = orderRefund1.getTotalFee().movePointRight(2).intValue();
int refundAmount = orderRefund1.getRefundAmount().movePointRight(2).intValue(); int refundAmount = orderRefund1.getRefundAmount().movePointRight(2).intValue();
weixinService.refund(orderRefund1.getOrderNo(),orderRefund1.getRefundNo(),totalFee,refundAmount); weixinService.refund(orderRefund1.getOrderNo(), orderRefund1.getRefundNo(), totalFee, refundAmount);
orderRefund1.setState("1"); orderRefund1.setState(RefundState.REFUNDING.getState());
orderRefundService.updateOrderRefund(orderRefund1); orderRefundService.updateOrderRefund(orderRefund1);
} }
} }
return ajaxResult; return ajaxResult;
} }
@PostMapping("/refund") @PostMapping("/refund")
public void refund(){ public void refund(){
Order order = orderService.selectOrderById("98"); Order order = orderService.selectOrderById("98");
......
...@@ -4,9 +4,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,9 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.soss.common.constant.Constants; import com.soss.common.constant.Constants;
import com.soss.common.core.domain.AjaxResult; import com.soss.common.core.domain.AjaxResult;
import com.soss.framework.web.service.WeixinServiceImpl; import com.soss.framework.web.service.WeixinServiceImpl;
import com.soss.system.mapper.OrderMapper;
import com.soss.system.service.impl.AppServiceImpl; import com.soss.system.service.impl.AppServiceImpl;
import com.soss.system.service.impl.OrderServiceImpl;
import com.soss.system.service.impl.OrderTakingServiceImpl; import com.soss.system.service.impl.OrderTakingServiceImpl;
import com.soss.system.utils.SendSmsUtil; import com.soss.system.utils.SendSmsUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -28,10 +26,6 @@ public class WeixinController { ...@@ -28,10 +26,6 @@ public class WeixinController {
private AppServiceImpl appService; private AppServiceImpl appService;
@Autowired @Autowired
private OrderTakingServiceImpl orderTakingService; private OrderTakingServiceImpl orderTakingService;
@Autowired
private OrderMapper orderMapper;
@Autowired
private OrderServiceImpl orderService;
//这个就是那个使用传code进来的接口 //这个就是那个使用传code进来的接口
@PostMapping("/login") @PostMapping("/login")
......
...@@ -47,7 +47,7 @@ public class CouponCategoryController extends BaseController { ...@@ -47,7 +47,7 @@ public class CouponCategoryController extends BaseController {
* 更新优惠券类别 * 更新优惠券类别
*/ */
@PreAuthorize("@ss.hasPermi('coupon:category:update')") @PreAuthorize("@ss.hasPermi('coupon:category:update')")
@Log(title = "更新优惠券类别", businessType = BusinessType.INSERT) @Log(title = "更新优惠券类别", businessType = BusinessType.UPDATE)
@PostMapping("update") @PostMapping("update")
@ApiOperation("更新优惠券类别") @ApiOperation("更新优惠券类别")
public AjaxResult update(@RequestBody CouponCategory couponCategory) { public AjaxResult update(@RequestBody CouponCategory couponCategory) {
...@@ -59,7 +59,6 @@ public class CouponCategoryController extends BaseController { ...@@ -59,7 +59,6 @@ public class CouponCategoryController extends BaseController {
* 查询优惠券类别列表 * 查询优惠券类别列表
*/ */
@PreAuthorize("@ss.hasPermi('coupon:category:list')") @PreAuthorize("@ss.hasPermi('coupon:category:list')")
@Log(title = "查询优惠券类别列表", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
@ApiOperation("查询优惠券类别列表") @ApiOperation("查询优惠券类别列表")
public TableDataInfo listCouponCategory(@RequestBody CouponCategory couponCategory) { public TableDataInfo listCouponCategory(@RequestBody CouponCategory couponCategory) {
...@@ -72,7 +71,7 @@ public class CouponCategoryController extends BaseController { ...@@ -72,7 +71,7 @@ public class CouponCategoryController extends BaseController {
* 上架优惠券类别状态 * 上架优惠券类别状态
*/ */
@PreAuthorize("@ss.hasPermi('coupon:category:online')") @PreAuthorize("@ss.hasPermi('coupon:category:online')")
@Log(title = "上架优惠券类别", businessType = BusinessType.INSERT) @Log(title = "上架优惠券类别", businessType = BusinessType.UPDATE)
@GetMapping("/online/{id}") @GetMapping("/online/{id}")
@ApiOperation("上架优惠券类别状态") @ApiOperation("上架优惠券类别状态")
public AjaxResult switchState(@PathVariable Integer id) { public AjaxResult switchState(@PathVariable Integer id) {
...@@ -84,7 +83,7 @@ public class CouponCategoryController extends BaseController { ...@@ -84,7 +83,7 @@ public class CouponCategoryController extends BaseController {
* 下架优惠券类别状态 * 下架优惠券类别状态
*/ */
@PreAuthorize("@ss.hasPermi('coupon:category:offline')") @PreAuthorize("@ss.hasPermi('coupon:category:offline')")
@Log(title = "下架优惠券类别", businessType = BusinessType.INSERT) @Log(title = "下架优惠券类别", businessType = BusinessType.UPDATE)
@GetMapping("/offline/{id}") @GetMapping("/offline/{id}")
@ApiOperation("下架优惠券类别状态") @ApiOperation("下架优惠券类别状态")
public AjaxResult offlineCouponCategory(@PathVariable Integer id) { public AjaxResult offlineCouponCategory(@PathVariable Integer id) {
...@@ -96,7 +95,7 @@ public class CouponCategoryController extends BaseController { ...@@ -96,7 +95,7 @@ public class CouponCategoryController extends BaseController {
* 删除优惠券类别状态 * 删除优惠券类别状态
*/ */
@PreAuthorize("@ss.hasPermi('coupon:category:delete')") @PreAuthorize("@ss.hasPermi('coupon:category:delete')")
@Log(title = "删除优惠券类别", businessType = BusinessType.INSERT) @Log(title = "删除优惠券类别", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@ApiOperation("删除优惠券类别状态") @ApiOperation("删除优惠券类别状态")
public AjaxResult deleteCouponCategory(@PathVariable Integer id) { public AjaxResult deleteCouponCategory(@PathVariable Integer id) {
......
...@@ -8,9 +8,11 @@ import com.soss.common.core.page.TableDataInfo; ...@@ -8,9 +8,11 @@ import com.soss.common.core.page.TableDataInfo;
import com.soss.common.enums.BusinessType; import com.soss.common.enums.BusinessType;
import com.soss.common.enums.CouponUserState; import com.soss.common.enums.CouponUserState;
import com.soss.common.enums.CouponUserType; import com.soss.common.enums.CouponUserType;
import com.soss.common.enums.MessageType;
import com.soss.system.domain.CouponUser; import com.soss.system.domain.CouponUser;
import com.soss.system.domain.vo.CouponUserVo; import com.soss.system.domain.vo.CouponUserVo;
import com.soss.system.service.ICouponUserService; import com.soss.system.service.ICouponUserService;
import com.soss.system.service.IWechatMessageService;
import io.jsonwebtoken.lang.Assert; import io.jsonwebtoken.lang.Assert;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -37,6 +39,8 @@ import java.util.List; ...@@ -37,6 +39,8 @@ import java.util.List;
public class CouponUserController extends BaseController { public class CouponUserController extends BaseController {
@Autowired @Autowired
private ICouponUserService couponUserService; private ICouponUserService couponUserService;
@Autowired
private IWechatMessageService wechatMessageService;
/** /**
* 赠送优惠券 * 赠送优惠券
...@@ -49,6 +53,7 @@ public class CouponUserController extends BaseController { ...@@ -49,6 +53,7 @@ public class CouponUserController extends BaseController {
Assert.notNull(couponUser.getCustId(), "用户ID未传递"); Assert.notNull(couponUser.getCustId(), "用户ID未传递");
Assert.notNull(couponUser.getCouponId(), "优惠券ID未传递"); Assert.notNull(couponUser.getCouponId(), "优惠券ID未传递");
couponUserService.giveUserCoupon(couponUser.getCustId(), couponUser.getCouponId()); couponUserService.giveUserCoupon(couponUser.getCustId(), couponUser.getCouponId());
wechatMessageService.insertWechatMessage(couponUser.getCustId(), 0L, MessageType.COUPON.getType(), "HOOLOO券到账通知,收到新的HOOLOO券啦,快来领取吧");
return AjaxResult.success(); return AjaxResult.success();
} }
......
...@@ -82,12 +82,12 @@ weixin: ...@@ -82,12 +82,12 @@ weixin:
secret: da8a0b08436dd3ce560be429f14e768a secret: da8a0b08436dd3ce560be429f14e768a
mchid: 1625511257 mchid: 1625511257
key: WcCsQZXavaPXQEKuTGJlGOkzzTPxTPsr key: WcCsQZXavaPXQEKuTGJlGOkzzTPxTPsr
notify-url: https://hooloo-api.gdatac.com/weixin/native/notify notify-url: https://hooloo-dev-api.gdatac.com/weixin/native/notify
trade-type: JSAPI trade-type: JSAPI
url: https://api.mch.weixin.qq.com/pay/unifiedorder url: https://api.mch.weixin.qq.com/pay/unifiedorder
query-url: https://api.mch.weixin.qq.com/pay/orderquery query-url: https://api.mch.weixin.qq.com/pay/orderquery
cert-path: classpath:apiclient_cert.p12 cert-path: classpath:apiclient_cert.p12
refund-url: https://hooloo-api.gdatac.com/weixin/refundNotify refund-url: https://hooloo-dev-api.gdatac.com/weixin/refundNotify
templateId: Fu_CPIXa0cnJ4EDdVKqFQ4T3qTxBqv8vXMU7-sQgerg templateId: Fu_CPIXa0cnJ4EDdVKqFQ4T3qTxBqv8vXMU7-sQgerg
pagePath: orderSubPackage/pages/orderInfo/index?orderId= pagePath: orderSubPackage/pages/orderInfo/index?orderId=
program: trial program: trial
......
package com.soss.common.enums;
/**
* 机器状态枚举类
*/
public enum MachineState {
INIT(0, "初始状态"),
TO_BE_INIT(1, "待初始化"),
TO_BE_BIND(2, "待绑定店铺"),
TO_BE_TEST(3, "待运营测试"),
RUNNING(4, "运行中"),
STANDBY(5, "待机中"),
SHUTDOWN(6, "关闭"),
OPERATING(7, "运维中"),
RETURN_FACTORY(8, "返厂");
private Integer state;
private String desc;
MachineState(Integer state, String desc) {
this.state = state;
this.desc = desc;
}
public Integer getState() {
return state;
}
public static String getDesc(Integer state) {
for (MachineState machineState : MachineState.values()) {
if (machineState.state.equals(state)) {
return machineState.desc;
}
}
return null;
}
}
package com.soss.common.enums;
/**
* 消息发送状态枚举类
*/
public enum MessageState {
TO_BE_SEND(0, "待发送"),
SENDING(1, "发送中"),
SUCCESS(2, "成功"),
FAILURE(3, "失败");
private Integer state;
private String desc;
MessageState(Integer state, String desc) {
this.state = state;
this.desc = desc;
}
public Integer getState() {
return state;
}
public static String getDesc(Integer state) {
for (MessageState messageState : MessageState.values()) {
if (messageState.state.equals(state)) {
return messageState.desc;
}
}
return null;
}
}
package com.soss.common.enums;
/**
* 消息类型枚举类
*/
public enum MessageType {
ORDER(1, "取餐消息"),
BONUS(2, "积分消息"),
COUPON(3, "优惠券消息");
private Integer type;
private String desc;
MessageType(Integer type, String desc) {
this.type = type;
this.desc = desc;
}
public Integer getType() {
return type;
}
public static String getDesc(Integer state) {
for (MessageType messageType : MessageType.values()) {
if (messageType.type.equals(state)) {
return messageType.desc;
}
}
return null;
}
}
package com.soss.common.enums;
/**
* 退款状态枚举类
*/
public enum RefundState {
PENDING(0, "待退款"),
REFUNDING(1, "退款中"),
SUCCESS(2, "退款成功"),
FAILURE(3, "退款失败");
private Integer state;
private String desc;
RefundState(Integer state, String desc) {
this.state = state;
this.desc = desc;
}
public Integer getState() {
return state;
}
public static String getDesc(Integer state) {
for (RefundState refundState : RefundState.values()) {
if (refundState.state.equals(state)) {
return refundState.desc;
}
}
return null;
}
}
package com.soss.framework.web.service; package com.soss.framework.web.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPath; import com.alibaba.fastjson.JSONPath;
import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse; import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult; import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
...@@ -13,13 +11,11 @@ import com.github.binarywang.wxpay.bean.result.WxPayRefundResult; ...@@ -13,13 +11,11 @@ import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderResult; import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderResult;
import com.github.binarywang.wxpay.exception.WxPayException; import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService; import com.github.binarywang.wxpay.service.WxPayService;
import com.github.wxpay.sdk.WXPayUtil; import com.github.wxpay.sdk.WXPayUtil;
import com.soss.common.core.domain.entity.SysUser; import com.soss.common.core.domain.entity.SysUser;
import com.soss.common.core.domain.model.LoginUser; import com.soss.common.core.domain.model.LoginUser;
import com.soss.common.enums.RefundState;
import com.soss.common.exception.ServiceException; import com.soss.common.exception.ServiceException;
import com.soss.common.utils.QRCodeUtil;
import com.soss.common.utils.StringUtils; import com.soss.common.utils.StringUtils;
import com.soss.common.utils.ip.IpUtils; import com.soss.common.utils.ip.IpUtils;
import com.soss.common.utils.sign.Base64; import com.soss.common.utils.sign.Base64;
...@@ -27,8 +23,7 @@ import com.soss.system.constants.OrderStatusConstant; ...@@ -27,8 +23,7 @@ import com.soss.system.constants.OrderStatusConstant;
import com.soss.system.domain.*; import com.soss.system.domain.*;
import com.soss.system.jiguang.impl.JiGuangPushServiceImpl; import com.soss.system.jiguang.impl.JiGuangPushServiceImpl;
import com.soss.system.mapper.CustomerMapper; import com.soss.system.mapper.CustomerMapper;
import com.soss.system.mapper.OrderDetailMapper;
import com.soss.system.mapper.OrderMapper;
import com.soss.system.mapper.OrderRefundMapper; import com.soss.system.mapper.OrderRefundMapper;
import com.soss.system.mapper.ShopMapper; import com.soss.system.mapper.ShopMapper;
import com.soss.system.service.IWechatMessageService; import com.soss.system.service.IWechatMessageService;
...@@ -37,25 +32,19 @@ import com.soss.system.service.impl.MachineApiServiceImpl; ...@@ -37,25 +32,19 @@ import com.soss.system.service.impl.MachineApiServiceImpl;
import com.soss.system.service.impl.OrderOperationLogServiceImpl; import com.soss.system.service.impl.OrderOperationLogServiceImpl;
import com.soss.system.service.impl.OrderServiceImpl; import com.soss.system.service.impl.OrderServiceImpl;
import com.soss.system.weixin.entity.OrderInfo; import com.soss.system.weixin.entity.OrderInfo;
import com.soss.system.weixin.entity.QueryReturnInfo; import com.soss.system.weixin.entity.QueryReturnInfo;
import com.soss.system.weixin.util.RandomStringGenerator; import com.soss.system.weixin.util.RandomStringGenerator;
import com.soss.system.weixin.util.SendMessageUtils; import com.soss.system.weixin.util.SendMessageUtils;
import com.soss.system.weixin.util.Signature; import com.soss.system.weixin.util.Signature;
import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.XStream;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.web.JsonPath;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
...@@ -63,10 +52,12 @@ import javax.crypto.Cipher; ...@@ -63,10 +52,12 @@ import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.*; import java.io.BufferedReader;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.InetAddress; import java.net.InetAddress;
import java.nio.charset.StandardCharsets;
import java.security.spec.AlgorithmParameterSpec; import java.security.spec.AlgorithmParameterSpec;
import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
...@@ -81,7 +72,7 @@ public class WeixinServiceImpl { ...@@ -81,7 +72,7 @@ public class WeixinServiceImpl {
@Autowired @Autowired
private RestTemplate restTemplate; private RestTemplate restTemplate;
@Autowired @Autowired
private StringRedisTemplate redisTemplate; private OrderDetailMapper orderDetailMapper;
@Autowired @Autowired
private CustomerMapper customerMapper; private CustomerMapper customerMapper;
@Autowired @Autowired
...@@ -137,21 +128,25 @@ public class WeixinServiceImpl { ...@@ -137,21 +128,25 @@ public class WeixinServiceImpl {
public String getSessionKeyOrOpenId(String code) { public String getSessionKeyOrOpenId(String code) {
String url = "https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code"; String url = "https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code";
String replaceUrl = url.replace("{0}", appid).replace("{1}", secret).replace("{2}", code); String replaceUrl = url.replace("{0}", appid).replace("{1}", secret).replace("{2}", code);
String res = restTemplate.getForObject(replaceUrl,String.class); String res = restTemplate.getForObject(replaceUrl, String.class);
log.info("微信返回的信息为:【{}】",res); log.info("微信返回的信息为:【{}】", res);
return res; return res;
} }
@PostConstruct @PostConstruct
public void getData(){ public void getData() {
try{ try {
File file = new File(jsonPath); /*File file = new File(jsonPath);
BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
String line = null; String line = null;
while ((line=bufferedReader.readLine())!=null){ while ((line=bufferedReader.readLine())!=null){
builder.append(line); builder.append(line);
} }
areaData = builder.toString(); areaData = builder.toString();*/
ClassPathResource resource = new ClassPathResource("province.json");
byte[] bdata = FileCopyUtils.copyToByteArray(resource.getInputStream());
areaData = new String(bdata, StandardCharsets.UTF_8);
}catch (Exception e){ }catch (Exception e){
log.error("",e); log.error("",e);
} }
...@@ -359,9 +354,6 @@ public class WeixinServiceImpl { ...@@ -359,9 +354,6 @@ public class WeixinServiceImpl {
log.error("微信支付发生异常",e); log.error("微信支付发生异常",e);
throw new ServiceException("微信支付异常"); throw new ServiceException("微信支付异常");
} }
} }
...@@ -493,23 +485,25 @@ public class WeixinServiceImpl { ...@@ -493,23 +485,25 @@ public class WeixinServiceImpl {
OrderRefund orderRefund = new OrderRefund(); OrderRefund orderRefund = new OrderRefund();
orderRefund.setRefundNo(outRefundNo); orderRefund.setRefundNo(outRefundNo);
List<OrderRefund> orderRefunds = orderRefundMapper.selectOrderRefundList(orderRefund); List<OrderRefund> orderRefunds = orderRefundMapper.selectOrderRefundList(orderRefund);
if(orderRefunds.isEmpty()){ if (orderRefunds.isEmpty()) {
log.error("找不到该退款订单:【{}】",outRefundNo); log.error("找不到该退款订单:【{}】", outRefundNo);
return WxPayNotifyResponse.fail("退款失败"); return WxPayNotifyResponse.fail("退款失败");
} }
OrderRefund orderRefund1 = orderRefunds.get(0); OrderRefund orderRefund1 = orderRefunds.get(0);
Order order = orderService.selectById(orderRefund1.getOrderId()); Order order = orderService.selectById(orderRefund1.getOrderId());
if("1".equals(orderRefund1.getState())){ if (RefundState.REFUNDING.getState().equals(orderRefund1.getState())) {
orderRefund1.setState("2"); orderRefund1.setState(RefundState.SUCCESS.getState());
orderRefundMapper.updateOrderRefund(orderRefund1); orderRefundMapper.updateOrderRefund(orderRefund1);
OrderOperationLog orderOperationLog = new OrderOperationLog(); OrderOperationLog orderOperationLog = new OrderOperationLog();
orderOperationLog.setOrderId(orderRefund1.getOrderId()); orderOperationLog.setOrderId(orderRefund1.getOrderId());
order.setState(OrderStatusConstant.refund); order.setState(OrderStatusConstant.refund);
if(orderRefund1.getRefundAmount().compareTo(order.getAmount())<0){ BigDecimal refundedAmount = orderRefundMapper.sumOrderRefundAmount(order.getId());
if (refundedAmount == null || refundedAmount.compareTo(order.getPaidAmount()) < 0) {
order.setState(OrderStatusConstant.PartialRefund); order.setState(OrderStatusConstant.PartialRefund);
} }
orderRefund1.setOrder(order); orderRefund1.setOrder(order);
orderService.updateOrder(order); orderService.updateOrder(order);
orderDetailMapper.updateRefundState(orderRefund1.getId(), new Date());
orderOperationLogService.insertOrderOperationLog(orderRefund1); orderOperationLogService.insertOrderOperationLog(orderRefund1);
return WxPayNotifyResponse.success("退款成功!"); return WxPayNotifyResponse.success("退款成功!");
} }
...@@ -525,20 +519,20 @@ public class WeixinServiceImpl { ...@@ -525,20 +519,20 @@ public class WeixinServiceImpl {
// */ // */
// return WxPayNotifyResponse.success("退款成功!"); // return WxPayNotifyResponse.success("退款成功!");
// } // }
}else{ } else {
WxPayRefundNotifyResult.ReqInfo reqInfo = wxPayRefundNotifyResult.getReqInfo(); WxPayRefundNotifyResult.ReqInfo reqInfo = wxPayRefundNotifyResult.getReqInfo();
String outRefundNo = reqInfo.getOutRefundNo(); String outRefundNo = reqInfo.getOutRefundNo();
OrderRefund orderRefund = new OrderRefund(); OrderRefund orderRefund = new OrderRefund();
orderRefund.setRefundNo(outRefundNo); orderRefund.setRefundNo(outRefundNo);
List<OrderRefund> orderRefunds = orderRefundMapper.selectOrderRefundList(orderRefund); List<OrderRefund> orderRefunds = orderRefundMapper.selectOrderRefundList(orderRefund);
if(orderRefunds.isEmpty()){ if (orderRefunds.isEmpty()) {
log.error("找不到该退款订单:【{}】",outRefundNo); log.error("找不到该退款订单:【{}】", outRefundNo);
return WxPayNotifyResponse.fail("退款失败"); return WxPayNotifyResponse.fail("退款失败");
} }
OrderRefund orderRefund1 = orderRefunds.get(0); OrderRefund orderRefund1 = orderRefunds.get(0);
Order order = orderService.selectById(orderRefund1.getOrderId()); Order order = orderService.selectById(orderRefund1.getOrderId());
if("1".equals(orderRefund1.getState())){ if (RefundState.REFUNDING.getState().equals(orderRefund1.getState())) {
orderRefund1.setState("3"); orderRefund1.setState(RefundState.FAILURE.getState());
orderRefundMapper.updateOrderRefund(orderRefund1); orderRefundMapper.updateOrderRefund(orderRefund1);
OrderOperationLog orderOperationLog = new OrderOperationLog(); OrderOperationLog orderOperationLog = new OrderOperationLog();
orderOperationLog.setOrderId(orderRefund1.getOrderId()); orderOperationLog.setOrderId(orderRefund1.getOrderId());
......
package com.soss.system.domain; package com.soss.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.soss.common.annotation.Excel; import com.soss.common.annotation.Excel;
import com.soss.common.core.domain.BaseEntity; import com.soss.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.ArrayList; import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -14,6 +16,7 @@ import java.util.List; ...@@ -14,6 +16,7 @@ import java.util.List;
* @author zxq * @author zxq
* @date 2022-05-01 * @date 2022-05-01
*/ */
@Data
public class Customer extends BaseEntity public class Customer extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -25,103 +28,37 @@ public class Customer extends BaseEntity ...@@ -25,103 +28,37 @@ public class Customer extends BaseEntity
@Excel(name = "用户名称") @Excel(name = "用户名称")
private String userName; private String userName;
/** 手机号 */ /**
* 手机号
*/
@Excel(name = "手机号") @Excel(name = "手机号")
private String phone; private String phone;
/** 头像图地址 */ /**
* 头像图地址
*/
@Excel(name = "头像图地址") @Excel(name = "头像图地址")
private String headSculpturePath; private String headSculpturePath;
/** 用户来源 */ @ApiModelProperty("性别")
@Excel(name = "用户来源") private Boolean sex;
private String soucre;
public String getAllow() { @ApiModelProperty("生日")
return allow; private Date birthday;
}
public void setAllow(String allow) { /**
this.allow = allow; * 用户来源
} */
@Excel(name = "用户来源")
private String soucre;
private List<Order> cancelOrder; private List<Order> cancelOrder;
private String allow; private String allow;
public List<Order> getCancelOrder() { private List<Order> refundOrder;
return cancelOrder;
}
public void setCancelOrder(List<Order> cancelOrder) {
this.cancelOrder = cancelOrder;
}
public List<Order> getRefundOrder() {
return refundOrder;
}
public void setRefundOrder(List<Order> refundOrder) {
this.refundOrder = refundOrder;
}
public List<Order> getNormalOrder() {
return normalOrder;
}
public void setNormalOrder(List<Order> normalOrder) {
this.normalOrder = normalOrder;
}
private List<Order> refundOrder ;
private List<Order> normalOrder; private List<Order> normalOrder;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserName()
{
return userName;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setHeadSculpturePath(String headSculpturePath)
{
this.headSculpturePath = headSculpturePath;
}
public String getHeadSculpturePath()
{
return headSculpturePath;
}
public void setSoucre(String soucre)
{
this.soucre = soucre;
}
public String getSoucre()
{
return soucre;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
package com.soss.system.domain; package com.soss.system.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.soss.common.annotation.Excel; import com.soss.common.annotation.Excel;
import com.soss.common.core.domain.BaseEntity; import com.soss.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
import java.util.List;
/** /**
* 商品分类对象 goods_category * 商品分类对象 goods_category
...@@ -15,26 +17,37 @@ import com.soss.common.core.domain.BaseEntity; ...@@ -15,26 +17,37 @@ import com.soss.common.core.domain.BaseEntity;
* @author zxq * @author zxq
* @date 2022-04-28 * @date 2022-04-28
*/ */
public class GoodsCategory extends BaseEntity @Data
{ public class GoodsCategory extends BaseEntity {
private static final long serialVersionUID = 1L; /**
* 主键
/** 主键 */ */
private String id; private String id;
/** 分类名称 */ /**
* 分类名称
*/
@Excel(name = "分类名称") @Excel(name = "分类名称")
private String name; private String name;
/** 分类备注 */ @ApiModelProperty("图标地址")
private String icon;
/**
* 分类备注
*/
@Excel(name = "分类备注") @Excel(name = "分类备注")
private String remarks; private String remarks;
/** 排序小的在前 */ /**
* 排序小的在前
*/
@Excel(name = "排序小的在前") @Excel(name = "排序小的在前")
private String turn; private String turn;
/** 状态 1 正常 2 停用 */ /**
* 状态 1 正常 2 停用
*/
@Excel(name = "状态 1 正常 2 停用") @Excel(name = "状态 1 正常 2 停用")
private String state; private String state;
...@@ -42,13 +55,6 @@ public class GoodsCategory extends BaseEntity ...@@ -42,13 +55,6 @@ public class GoodsCategory extends BaseEntity
@Excel(name = "0 正常 1 删除") @Excel(name = "0 正常 1 删除")
private String isDeleted; private String isDeleted;
public Integer getGoodsCount() {
return goodsCount;
}
public void setGoodsCount(Integer goodsCount) {
this.goodsCount = goodsCount;
}
/**商品数量**/ /**商品数量**/
private Integer goodsCount; private Integer goodsCount;
...@@ -62,102 +68,12 @@ public class GoodsCategory extends BaseEntity ...@@ -62,102 +68,12 @@ public class GoodsCategory extends BaseEntity
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt; private Date updatedAt;
public List<Goods> getGoodsList() {
return goodsList;
}
public void setGoodsList(List<Goods> goodsList) {
this.goodsList = goodsList;
}
/** 商品分类编码 */ /** 商品分类编码 */
@Excel(name = "商品分类编码") @Excel(name = "商品分类编码")
private String code; private String code;
private List<Goods> goodsList; private List<Goods> goodsList;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
public void setTurn(String turn)
{
this.turn = turn;
}
public String getTurn()
{
return turn;
}
public void setState(String state)
{
this.state = state;
}
public String getState()
{
return state;
}
public void setIsDeleted(String isDeleted)
{
this.isDeleted = isDeleted;
}
public String getIsDeleted()
{
return isDeleted;
}
public void setCreatedAt(Date createdAt)
{
this.createdAt = createdAt;
}
public Date getCreatedAt()
{
return createdAt;
}
public void setUpdatedAt(Date updatedAt)
{
this.updatedAt = updatedAt;
}
public Date getUpdatedAt()
{
return updatedAt;
}
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
...@@ -127,6 +127,15 @@ public class Order implements Serializable { ...@@ -127,6 +127,15 @@ public class Order implements Serializable {
@Excel(name = "订单状态 0 未支付取消 1 未支付 2 已支付 3 待制作 4 支付制作中 5 制作完成未取 6 取餐中 7 取餐完成 8 支付后制作前取消 9 制作中取消 10 制作完成取消 11 已退款 12 部分退款 50 其他人工干预状态") @Excel(name = "订单状态 0 未支付取消 1 未支付 2 已支付 3 待制作 4 支付制作中 5 制作完成未取 6 取餐中 7 取餐完成 8 支付后制作前取消 9 制作中取消 10 制作完成取消 11 已退款 12 部分退款 50 其他人工干预状态")
private String state; private String state;
@ApiModelProperty("用户授权发送消息1:0-未授权 1-授权")
private Boolean sendMsgFlag1;
@ApiModelProperty("用户授权发送消息2:0-未授权 1-授权")
private Boolean sendMsgFlag2;
@ApiModelProperty("用户授权发送消息3:0-未授权 1-授权")
private Boolean sendMsgFlag3;
/** /**
* 创建时间 * 创建时间
*/ */
......
...@@ -2,6 +2,7 @@ package com.soss.system.domain; ...@@ -2,6 +2,7 @@ package com.soss.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.soss.common.annotation.Excel; import com.soss.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
...@@ -110,14 +111,22 @@ public class OrderDetail implements Serializable { ...@@ -110,14 +111,22 @@ public class OrderDetail implements Serializable {
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdAt; private Date createdAt;
/** 更新时间 */ @ApiModelProperty("退款记录ID")
private Long refundId;
@ApiModelProperty("退款时间")
private Date refundTime;
/**
* 更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt; private Date updatedAt;
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("orderId", getOrderId()) .append("orderId", getOrderId())
.append("goodsId", getGoodsId()) .append("goodsId", getGoodsId())
......
package com.soss.system.domain; package com.soss.system.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.soss.common.annotation.Excel; import com.soss.common.annotation.Excel;
import com.soss.common.core.domain.BaseEntity; import com.soss.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/** /**
* 订单退款对象 order_refund * 订单退款对象 order_refund
...@@ -14,12 +18,13 @@ import com.soss.common.core.domain.BaseEntity; ...@@ -14,12 +18,13 @@ import com.soss.common.core.domain.BaseEntity;
* @author zxq * @author zxq
* @date 2022-04-28 * @date 2022-04-28
*/ */
@Data
public class OrderRefund extends BaseEntity public class OrderRefund extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 主键 */ /** 主键 */
private String id; private Long id;
/** 订单ID */ /** 订单ID */
@Excel(name = "订单ID") @Excel(name = "订单ID")
...@@ -31,140 +36,40 @@ public class OrderRefund extends BaseEntity ...@@ -31,140 +36,40 @@ public class OrderRefund extends BaseEntity
/** 订单退款状态 0 默认 1 退款中 2 退款成功 3 退款失败 */ /** 订单退款状态 0 默认 1 退款中 2 退款成功 3 退款失败 */
@Excel(name = "订单退款状态 0 默认 1 退款中 2 退款成功 3 退款失败") @Excel(name = "订单退款状态 0 默认 1 退款中 2 退款成功 3 退款失败")
private String state; private Integer state;
/** 退款原因等描述 */ /** 退款原因等描述 */
@Excel(name = "退款原因等描述") @Excel(name = "退款原因等描述")
private String desc; private String desc;
/** 创建时间 */ /**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createdAt; private Date createdAt;
private String createUserName; private String createUserName;
public String getCreateUserName() { /**
return createUserName; * 更新时间
} */
public void setCreateUserName(String createUserName) {
this.createUserName = createUserName;
}
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt; private Date updatedAt;
private Order order; private Order order;
private String refundNo; private String refundNo;
public String getRefundNo() {
return refundNo;
}
public void setRefundNo(String refundNo) {
this.refundNo = refundNo;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
private String orderNo; private String orderNo;
public BigDecimal getTotalFee() {
return totalFee;
}
public void setTotalFee(BigDecimal totalFee) {
this.totalFee = totalFee;
}
private BigDecimal totalFee; private BigDecimal totalFee;
public Order getOrder() { @ApiModelProperty("退款明细id集合")
return order; private List<Long> orderDetailIds;
}
public void setOrder(Order order) {
this.order = order;
}
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setOrderId(String orderId)
{
this.orderId = orderId;
}
public String getOrderId()
{
return orderId;
}
public void setRefundAmount(BigDecimal refundAmount)
{
this.refundAmount = refundAmount;
}
public BigDecimal getRefundAmount()
{
return refundAmount;
}
public void setState(String state)
{
this.state = state;
}
public String getState()
{
return state;
}
public void setDesc(String desc)
{
this.desc = desc;
}
public String getDesc()
{
return desc;
}
public void setCreatedAt(Date createdAt)
{
this.createdAt = createdAt;
}
public Date getCreatedAt()
{
return createdAt;
}
public void setUpdatedAt(Date updatedAt)
{
this.updatedAt = updatedAt;
}
public Date getUpdatedAt()
{
return updatedAt;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("orderId", getOrderId()) .append("orderId", getOrderId())
.append("refundAmount", getRefundAmount()) .append("refundAmount", getRefundAmount())
......
...@@ -3,6 +3,7 @@ package com.soss.system.domain; ...@@ -3,6 +3,7 @@ package com.soss.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.soss.common.annotation.Excel; import com.soss.common.annotation.Excel;
import com.soss.common.core.domain.BaseEntity; import com.soss.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
...@@ -40,35 +41,54 @@ public class Shop extends BaseEntity ...@@ -40,35 +41,54 @@ public class Shop extends BaseEntity
@Excel(name = "店铺位置纬度") @Excel(name = "店铺位置纬度")
private String lat; private String lat;
/** 店铺备注 */ /**
* 店铺备注
*/
@Excel(name = "店铺备注") @Excel(name = "店铺备注")
private String remarks; private String remarks;
/** 店铺开始营业时间 */ /**
* 店铺开始营业时间
*/
@Excel(name = "店铺开始营业时间") @Excel(name = "店铺开始营业时间")
private String startTime; private String startTime;
/** 店铺结束营业时间 */ /**
* 店铺结束营业时间
*/
@Excel(name = "店铺结束营业时间") @Excel(name = "店铺结束营业时间")
private String endTime; private String endTime;
/** 店铺地址 */ /**
* 店铺地址
*/
@Excel(name = "店铺地址") @Excel(name = "店铺地址")
private String address; private String address;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String province; private String province;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String city; private String city;
/** $column.columnComment */ /**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String zone; private String zone;
/** 店铺状态 1 正常 2 暂停营业 3 关闭 */ @ApiModelProperty("最远下单距离,单位:km")
private Double distanceLimit;
/**
* 店铺状态 1 正常 2 暂停营业 3 关闭
*/
@Excel(name = "店铺状态 1 正常 2 暂停营业 3 关闭") @Excel(name = "店铺状态 1 正常 2 暂停营业 3 关闭")
private Integer state; private Integer state;
...@@ -78,19 +98,25 @@ public class Shop extends BaseEntity ...@@ -78,19 +98,25 @@ public class Shop extends BaseEntity
private String machieStatus; private String machieStatus;
/** 创建时间 */ /**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdAt; private Date createdAt;
/** 更新时间 */ /**
* 更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt; private Date updatedAt;
private String machineCode; private String machineCode;
/** 是否默认 0否1是 */ /**
* 是否默认 0否1是
*/
@Excel(name = "是否默认 0否1是") @Excel(name = "是否默认 0否1是")
private Long isDefault; private Long isDefault;
......
package com.soss.system.domain; package com.soss.system.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.soss.common.annotation.Excel; import com.soss.common.annotation.Excel;
import com.soss.common.core.domain.BaseEntity; import com.soss.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
import java.util.List;
/** /**
* 规格对象 spec * 规格对象 spec
...@@ -15,10 +17,9 @@ import com.soss.common.core.domain.BaseEntity; ...@@ -15,10 +17,9 @@ import com.soss.common.core.domain.BaseEntity;
* @author zxq * @author zxq
* @date 2022-04-28 * @date 2022-04-28
*/ */
@Data
public class Spec extends BaseEntity public class Spec extends BaseEntity
{ {
private static final long serialVersionUID = 1L;
/** 主键 */ /** 主键 */
private long id; private long id;
...@@ -42,128 +43,37 @@ public class Spec extends BaseEntity ...@@ -42,128 +43,37 @@ public class Spec extends BaseEntity
@Excel(name = "是否必须原料 1 否 2 是") @Excel(name = "是否必须原料 1 否 2 是")
private int isNeccessary; private int isNeccessary;
/** 创建时间 */ /**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdAt; private Date createdAt;
/** 更新时间 */ /**
* 更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt; private Date updatedAt;
/**
/** 规格编码 */ * 规格编码
*/
@Excel(name = "规格编码") @Excel(name = "规格编码")
private String code; private String code;
@Override @ApiModelProperty("规格备注")
public String getRemark() {
return remark;
}
@Override
public void setRemark(String remark) {
this.remark = remark;
}
private String remark; private String remark;
private List<SpecRule> specRules; @ApiModelProperty("原料备注")
private String materialRemark;
public List<SpecRule> getSpecRules() {
return specRules;
}
public void setSpecRules(List<SpecRule> specRules) {
this.specRules = specRules;
}
public void setId(long id)
{
this.id = id;
}
public long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setState(int state)
{
this.state = state;
}
public int getState() private List<SpecRule> specRules;
{
return state;
}
public void setIsShow(Long isShow)
{
this.isShow = isShow;
}
public Long getIsShow()
{
return isShow;
}
public void setIsDeleted(int isDeleted)
{
this.isDeleted = isDeleted;
}
public int getIsDeleted()
{
return isDeleted;
}
public void setIsNeccessary(int isNeccessary)
{
this.isNeccessary = isNeccessary;
}
public int getIsNeccessary()
{
return isNeccessary;
}
public void setCreatedAt(Date createdAt)
{
this.createdAt = createdAt;
}
public Date getCreatedAt()
{
return createdAt;
}
public void setUpdatedAt(Date updatedAt)
{
this.updatedAt = updatedAt;
}
public Date getUpdatedAt()
{
return updatedAt;
}
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("name", getName()) .append("name", getName())
.append("state", getState()) .append("state", getState())
......
package com.soss.system.domain; package com.soss.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.soss.common.annotation.Excel; import com.soss.common.annotation.Excel;
import com.soss.common.core.domain.BaseEntity; import com.soss.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/** /**
* 小程序信息发送对象 wechat_message * 小程序信息发送对象 wechat_message
...@@ -13,168 +16,83 @@ import com.soss.common.core.domain.BaseEntity; ...@@ -13,168 +16,83 @@ import com.soss.common.core.domain.BaseEntity;
* @author zxq * @author zxq
* @date 2022-04-28 * @date 2022-04-28
*/ */
public class WechatMessage extends BaseEntity @Data
{ public class WechatMessage extends BaseEntity {
private static final long serialVersionUID = 1L; /**
* 主键
/** 主键 */ */
private String id; private String id;
/** 用户ID */ /**
* 用户ID
*/
@Excel(name = "用户ID") @Excel(name = "用户ID")
private String userId; private String userId;
/** 推送ID */ /**
* 推送ID
*/
@Excel(name = "推送ID") @Excel(name = "推送ID")
private String msgId; private String msgId;
/** 消息内容 */ /**
* 消息内容
*/
@Excel(name = "消息内容") @Excel(name = "消息内容")
private String message; private String message;
/** 目标跳转url */ @ApiModelProperty("跳转目标ID")
private Long targetId;
/**
* 目标跳转url
*/
@Excel(name = "目标跳转url") @Excel(name = "目标跳转url")
private String targetUrl; private String targetUrl;
/** 消息发送状态 0 待发送 1 发送中 2 成功 3 失败 */ /**
@Excel(name = "消息发送状态 0 待发送 1 发送中 2 成功 3 失败") * 消息发送状态 0 待发送 1 发送中 2 成功 3 失败
private String state; */
@ApiModelProperty("消息发送状态 0 待发送 1 发送中 2 成功 3 失败")
public String getTitle() { private Integer state;
return title;
}
public void setTitle(String title) {
this.title = title;
}
private String title; private String title;
/** 消息类型 1 取餐消息 2 积分消息 等 */ /**
@Excel(name = "消息类型 1 取餐消息 2 积分消息 等") * 消息类型 1 取餐消息 2 积分消息 等
private String type; */
@ApiModelProperty("消息类型 1 取餐消息 2 积分消息 3-优惠券消息 等")
private Integer type;
/** 消息阅读状态 1 未读 2 已读 */ /**
* 消息阅读状态 1 未读 2 已读
*/
@Excel(name = "消息阅读状态 1 未读 2 已读") @Excel(name = "消息阅读状态 1 未读 2 已读")
private String isRead; private String isRead;
/** 0 未删除 1 已删除 */ /**
* 0 未删除 1 已删除
*/
@Excel(name = "0 未删除 1 已删除") @Excel(name = "0 未删除 1 已删除")
private String isDeleted; private String isDeleted;
/** 创建时间 */ /**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdAt; private Date createdAt;
/** 更新时间 */ /**
* 更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt; private Date updatedAt;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setUserId(String userId)
{
this.userId = userId;
}
public String getUserId()
{
return userId;
}
public void setMsgId(String msgId)
{
this.msgId = msgId;
}
public String getMsgId()
{
return msgId;
}
public void setMessage(String message)
{
this.message = message;
}
public String getMessage()
{
return message;
}
public void setTargetUrl(String targetUrl)
{
this.targetUrl = targetUrl;
}
public String getTargetUrl()
{
return targetUrl;
}
public void setState(String state)
{
this.state = state;
}
public String getState()
{
return state;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setIsRead(String isRead)
{
this.isRead = isRead;
}
public String getIsRead()
{
return isRead;
}
public void setIsDeleted(String isDeleted)
{
this.isDeleted = isDeleted;
}
public String getIsDeleted()
{
return isDeleted;
}
public void setCreatedAt(Date createdAt)
{
this.createdAt = createdAt;
}
public Date getCreatedAt()
{
return createdAt;
}
public void setUpdatedAt(Date updatedAt)
{
this.updatedAt = updatedAt;
}
public Date getUpdatedAt()
{
return updatedAt;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("userId", getUserId()) .append("userId", getUserId())
.append("msgId", getMsgId()) .append("msgId", getMsgId())
......
package com.soss.system.domain.vo.orderTaking; package com.soss.system.domain.vo.orderTaking;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
@Data
public class CategoryVo implements Serializable { public class CategoryVo implements Serializable {
private Long id; private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<GoodsVo> getGoods() {
return goods;
}
public void setGoods(List<GoodsVo> goods) {
this.goods = goods;
}
private String name; private String name;
@ApiModelProperty("图标地址")
private String icon;
private List<GoodsVo> goods; private List<GoodsVo> goods;
} }
package com.soss.system.mapper; package com.soss.system.mapper;
import java.util.List;
import com.soss.system.domain.OrderDetail; import com.soss.system.domain.OrderDetail;
import java.util.Date;
import java.util.List;
/** /**
* 订单详情Mapper接口 * 订单详情Mapper接口
* *
* @author zxq * @author zxq
* @date 2022-04-28 * @date 2022-04-28
*/ */
public interface OrderDetailMapper public interface OrderDetailMapper {
{
/** /**
* 查询订单详情 * 查询订单详情
* *
...@@ -20,6 +21,14 @@ public interface OrderDetailMapper ...@@ -20,6 +21,14 @@ public interface OrderDetailMapper
public OrderDetail selectOrderDetailById(String id); public OrderDetail selectOrderDetailById(String id);
/** /**
* 根据明细id集合查询明细列表
*
* @param ids
* @return
*/
List<OrderDetail> listDetailByIds(List<Long> ids);
/**
* 查询订单详情列表 * 查询订单详情列表
* *
* @param orderDetail 订单详情 * @param orderDetail 订单详情
...@@ -58,4 +67,8 @@ public interface OrderDetailMapper ...@@ -58,4 +67,8 @@ public interface OrderDetailMapper
* @return 结果 * @return 结果
*/ */
public int deleteOrderDetailByIds(String[] ids); public int deleteOrderDetailByIds(String[] ids);
void bindRefund(Long refundId, List<Long> ids);
void updateRefundState(Long refundId, Date refundTime);
} }
package com.soss.system.mapper; package com.soss.system.mapper;
import java.util.List;
import com.soss.system.domain.OrderRefund; import com.soss.system.domain.OrderRefund;
import com.soss.system.domain.vo.OrderQuery; import com.soss.system.domain.vo.OrderQuery;
import java.math.BigDecimal;
import java.util.List;
/** /**
* 订单退款Mapper接口 * 订单退款Mapper接口
* *
* @author zxq * @author zxq
* @date 2022-04-28 * @date 2022-04-28
*/ */
public interface OrderRefundMapper public interface OrderRefundMapper {
{
/** /**
* 查询订单退款 * 查询订单退款
* *
...@@ -61,4 +62,9 @@ public interface OrderRefundMapper ...@@ -61,4 +62,9 @@ public interface OrderRefundMapper
public int deleteOrderRefundByIds(String[] ids); public int deleteOrderRefundByIds(String[] ids);
List<OrderRefund> selectList(OrderQuery orderQuery); List<OrderRefund> selectList(OrderQuery orderQuery);
/**
* 获取订单已成功退款的总额
*/
BigDecimal sumOrderRefundAmount(Long orderId);
} }
...@@ -13,12 +13,12 @@ public class CouponSchedule { ...@@ -13,12 +13,12 @@ public class CouponSchedule {
@Autowired @Autowired
private CouponUserMapper couponUserMapper; private CouponUserMapper couponUserMapper;
@Scheduled(cron = "0 0 0 * * ?") @Scheduled(cron = "0/1 * * * * ?")
private void expireCoupon() { private void expireCoupon() {
couponMapper.expireCoupon(); couponMapper.expireCoupon();
} }
@Scheduled(cron = "0 0 0 * * ?") @Scheduled(cron = "0/1 * * * * ?")
private void expireCouponUser() { private void expireCouponUser() {
couponUserMapper.expireCouponUser(); couponUserMapper.expireCouponUser();
} }
......
...@@ -16,6 +16,8 @@ import com.soss.system.domain.vo.customer.CustomerResultVo; ...@@ -16,6 +16,8 @@ import com.soss.system.domain.vo.customer.CustomerResultVo;
*/ */
public interface ICustomerService public interface ICustomerService
{ {
Customer selectCustById(String custId);
/** /**
* 查询用户信息 * 查询用户信息
* *
...@@ -49,6 +51,8 @@ public interface ICustomerService ...@@ -49,6 +51,8 @@ public interface ICustomerService
*/ */
public int updateCustomer(Customer customer); public int updateCustomer(Customer customer);
void updateCustBirthday(Customer customer);
/** /**
* 批量删除用户信息 * 批量删除用户信息
* *
......
...@@ -41,7 +41,7 @@ public interface IOrderService ...@@ -41,7 +41,7 @@ public interface IOrderService
*/ */
public AjaxResult insertOrder(LoginUser request, Order order); public AjaxResult insertOrder(LoginUser request, Order order);
void checkBusinessTime(Long shopId); void checkShopInfo(Order order);
/** /**
* 修改订单 * 修改订单
......
package com.soss.system.service; package com.soss.system.service;
import java.util.List;
import com.soss.system.domain.WechatMessage; import com.soss.system.domain.WechatMessage;
import java.util.List;
/** /**
* 小程序信息发送Service接口 * 小程序信息发送Service接口
* *
...@@ -37,11 +38,10 @@ public interface IWechatMessageService ...@@ -37,11 +38,10 @@ public interface IWechatMessageService
/** /**
* 新增小程序信息发送 * 新增小程序信息发送
*
* @param wechatMessage 小程序信息发送
* @return 结果
*/ */
public int insertWechatMessage(String openId, String message); public int insertWechatMessage(String openId, Long targetId, String message);
int insertWechatMessage(String openId, Long targetId, Integer messageType, String message);
/** /**
* 修改小程序信息发送 * 修改小程序信息发送
......
...@@ -51,14 +51,11 @@ public class AppServiceImpl { ...@@ -51,14 +51,11 @@ public class AppServiceImpl {
DecimalFormat df = new DecimalFormat("######0.0"); DecimalFormat df = new DecimalFormat("######0.0");
distance = df.format(s/1000); distance = df.format(s/1000);
return distance+"km"; return distance+"km";
}else if (s>=10000){ }else if (s>=10000){
Double aDouble = s/10000; Double aDouble = s / 1000;
return aDouble.intValue()+"km"; return aDouble.intValue()+"km";
}else{ }else{
Double aDouble =s; Double aDouble =s;
return aDouble.intValue()+"m"; return aDouble.intValue()+"m";
} }
} }
......
...@@ -85,7 +85,7 @@ public class CouponCategoryServiceImpl implements ICouponCategoryService { ...@@ -85,7 +85,7 @@ public class CouponCategoryServiceImpl implements ICouponCategoryService {
public List<CouponCategory> listCouponCategory(CouponCategory couponCategory) { public List<CouponCategory> listCouponCategory(CouponCategory couponCategory) {
List<CouponCategory> couponCategories = couponCategoryMapper.listCouponCategory(couponCategory); List<CouponCategory> couponCategories = couponCategoryMapper.listCouponCategory(couponCategory);
Map<Integer, Long> countMap; Map<Integer, Long> countMap;
if (CollectionUtils.isEmpty(couponCategories)) { if (!CollectionUtils.isEmpty(couponCategories)) {
List<Integer> categoryIds = couponCategories.stream().map(CouponCategory::getId).collect(Collectors.toList()); List<Integer> categoryIds = couponCategories.stream().map(CouponCategory::getId).collect(Collectors.toList());
List<CouponCategory> couponCategoryCountList = couponMapper.getCouponCategoryTypeStat(categoryIds); List<CouponCategory> couponCategoryCountList = couponMapper.getCouponCategoryTypeStat(categoryIds);
countMap = couponCategoryCountList.stream().collect(Collectors.toMap(CouponCategory::getId, CouponCategory::getCouponCnt)); countMap = couponCategoryCountList.stream().collect(Collectors.toMap(CouponCategory::getId, CouponCategory::getCouponCnt));
...@@ -127,6 +127,7 @@ public class CouponCategoryServiceImpl implements ICouponCategoryService { ...@@ -127,6 +127,7 @@ public class CouponCategoryServiceImpl implements ICouponCategoryService {
CouponCategory online = new CouponCategory(id, CouponState.OFFLINE.getState()); CouponCategory online = new CouponCategory(id, CouponState.OFFLINE.getState());
int updateCnt = couponCategoryMapper.updateCouponCategory(online); int updateCnt = couponCategoryMapper.updateCouponCategory(online);
Coupon coupon = new Coupon(); Coupon coupon = new Coupon();
coupon.setCategoryId(id);
List<Coupon> coupons = couponMapper.listCoupon(coupon); List<Coupon> coupons = couponMapper.listCoupon(coupon);
long unOfflineCnt = coupons.stream().filter(c -> c.getState().equals(CouponState.DEFAULT.getState()) long unOfflineCnt = coupons.stream().filter(c -> c.getState().equals(CouponState.DEFAULT.getState())
|| c.getState().equals(CouponState.ONLINE.getState())).count(); || c.getState().equals(CouponState.ONLINE.getState())).count();
......
...@@ -111,7 +111,6 @@ public class CouponServiceImpl implements ICouponService { ...@@ -111,7 +111,6 @@ public class CouponServiceImpl implements ICouponService {
if (CouponCategoryType.DEDUCTION.getType().equals(couponCategory.getType())) { if (CouponCategoryType.DEDUCTION.getType().equals(couponCategory.getType())) {
Assert.notNull(couponPo.getPriceDiscount(), "满减价还未设置"); Assert.notNull(couponPo.getPriceDiscount(), "满减价还未设置");
Assert.notNull(couponPo.getPriceLimit(), "价格门槛还未设置"); Assert.notNull(couponPo.getPriceLimit(), "价格门槛还未设置");
Assert.notNull(couponPo.getDaysLimit(), "用户可领取次数还未设置");
ruleName = "立减" + couponPo.getPriceDiscount() + "元"; ruleName = "立减" + couponPo.getPriceDiscount() + "元";
if (couponPo.getPriceLimit().compareTo(BigDecimal.ZERO) == 0) { if (couponPo.getPriceLimit().compareTo(BigDecimal.ZERO) == 0) {
ruleDesc = "无门槛"; ruleDesc = "无门槛";
...@@ -134,10 +133,7 @@ public class CouponServiceImpl implements ICouponService { ...@@ -134,10 +133,7 @@ public class CouponServiceImpl implements ICouponService {
ruleDesc = "满" + couponPo.getPriceLimit() + "元"; ruleDesc = "满" + couponPo.getPriceLimit() + "元";
} }
} }
Assert.notNull(couponPo.getDaysLimit(), "用户可领取次数限制还未设置"); Assert.notNull(couponPo.getUserLimit(), "用户可领取次数限制还未设置");
Assert.isTrue(couponPo.getDaysLimit() == 0
|| (couponPo.getDaysLimit() > 0 && couponPo.getUserLimit() != null && couponPo.getUserLimit() > 0),
"用户可领取次数限制还未设置完全");
Assert.notNull(couponPo.getUseStartTime(), "优惠券的绝对有效时间还未设置"); Assert.notNull(couponPo.getUseStartTime(), "优惠券的绝对有效时间还未设置");
Assert.notNull(couponPo.getUseEndTime(), "优惠券的绝对有效时间还未设置"); Assert.notNull(couponPo.getUseEndTime(), "优惠券的绝对有效时间还未设置");
if (couponPo.getReceivableTime() != null && couponPo.getReceivableTime().isAfter(couponPo.getUseStartTime())) { if (couponPo.getReceivableTime() != null && couponPo.getReceivableTime().isAfter(couponPo.getUseStartTime())) {
......
package com.soss.system.service.impl; package com.soss.system.service.impl;
import com.soss.common.exception.ServiceException;
import com.soss.common.utils.DateUtils; import com.soss.common.utils.DateUtils;
import com.soss.system.constants.OrderStatusConstant; import com.soss.system.constants.OrderStatusConstant;
import com.soss.system.domain.Customer; import com.soss.system.domain.Customer;
...@@ -33,6 +34,11 @@ public class CustomerServiceImpl implements ICustomerService ...@@ -33,6 +34,11 @@ public class CustomerServiceImpl implements ICustomerService
@Autowired @Autowired
private ShopMapper shopMapper; private ShopMapper shopMapper;
@Override
public Customer selectCustById(String custId) {
return customerMapper.selectCustomerById(custId);
}
/** /**
* 查询用户信息 * 查询用户信息
* *
...@@ -60,9 +66,6 @@ public class CustomerServiceImpl implements ICustomerService ...@@ -60,9 +66,6 @@ public class CustomerServiceImpl implements ICustomerService
order1.setShop(shopMapper.selectShopById(order1.getShopId())); order1.setShop(shopMapper.selectShopById(order1.getShopId()));
} }
return orders; return orders;
} }
/** /**
...@@ -99,11 +102,19 @@ public class CustomerServiceImpl implements ICustomerService ...@@ -99,11 +102,19 @@ public class CustomerServiceImpl implements ICustomerService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateCustomer(Customer customer) public int updateCustomer(Customer customer) {
{
return customerMapper.updateCustomer(customer); return customerMapper.updateCustomer(customer);
} }
@Override
public void updateCustBirthday(Customer customer) {
Customer cust = customerMapper.selectCustomerById(customer.getId());
if (cust.getBirthday() != null) {
throw new ServiceException("生日只能修改一次");
}
customerMapper.updateCustomer(customer);
}
/** /**
* 批量删除用户信息 * 批量删除用户信息
* *
...@@ -111,8 +122,7 @@ public class CustomerServiceImpl implements ICustomerService ...@@ -111,8 +122,7 @@ public class CustomerServiceImpl implements ICustomerService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteCustomerByIds(Long[] ids) public int deleteCustomerByIds(Long[] ids) {
{
return customerMapper.deleteCustomerByIds(ids); return customerMapper.deleteCustomerByIds(ids);
} }
......
...@@ -227,7 +227,7 @@ public class GoodsServiceImpl implements IGoodsService ...@@ -227,7 +227,7 @@ public class GoodsServiceImpl implements IGoodsService
public int updateGoods(Goods goods) { public int updateGoods(Goods goods) {
Goods goodsOri = goodsMapper.selectGoodsById(goods.getId()); Goods goodsOri = goodsMapper.selectGoodsById(goods.getId());
int i = goodsMapper.updateGoods(goods); int i = goodsMapper.updateGoods(goods);
if (Objects.equals(goodsOri.getSpec(), goods.getSpec())) { if (StringUtils.isEmpty(goods.getSpec()) || Objects.equals(goodsOri.getSpec(), goods.getSpec())) {
return i; return i;
} }
/*if(StringUtils.isNotEmpty(goods.getSpec())){ /*if(StringUtils.isNotEmpty(goods.getSpec())){
......
package com.soss.system.service.impl; package com.soss.system.service.impl;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.soss.common.core.domain.AjaxResult; import com.soss.common.core.domain.AjaxResult;
import com.soss.common.enums.RefundState;
import com.soss.common.exception.ServiceException; import com.soss.common.exception.ServiceException;
import com.soss.common.utils.GenerateCode; import com.soss.common.utils.GenerateCode;
import com.soss.common.utils.StringUtils; import com.soss.common.utils.StringUtils;
import com.soss.system.constants.OrderStatusConstant; import com.soss.system.constants.OrderStatusConstant;
import com.soss.system.domain.Order; import com.soss.system.domain.Order;
import com.soss.system.domain.OrderDetail; import com.soss.system.domain.OrderDetail;
import com.soss.system.domain.OrderRefund;
import com.soss.system.domain.OrderSnapshot; import com.soss.system.domain.OrderSnapshot;
import com.soss.system.domain.vo.OrderQuery; import com.soss.system.domain.vo.OrderQuery;
import com.soss.system.jiguang.impl.JiGuangPushServiceImpl; import com.soss.system.mapper.OrderDetailMapper;
import com.soss.system.mapper.OrderMapper; import com.soss.system.mapper.OrderRefundMapper;
import com.soss.system.mapper.OrderSnapshotMapper; import com.soss.system.mapper.OrderSnapshotMapper;
import com.soss.system.service.IOrderRefundService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.soss.system.mapper.OrderRefundMapper; import org.springframework.util.CollectionUtils;
import com.soss.system.domain.OrderRefund;
import com.soss.system.service.IOrderRefundService; import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* 订单退款Service业务层处理 * 订单退款Service业务层处理
...@@ -30,6 +34,7 @@ import com.soss.system.service.IOrderRefundService; ...@@ -30,6 +34,7 @@ import com.soss.system.service.IOrderRefundService;
* @date 2022-04-28 * @date 2022-04-28
*/ */
@Service @Service
@Slf4j
public class OrderRefundServiceImpl implements IOrderRefundService public class OrderRefundServiceImpl implements IOrderRefundService
{ {
@Autowired @Autowired
...@@ -40,11 +45,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService ...@@ -40,11 +45,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService
@Autowired @Autowired
private OrderSnapshotMapper orderSnapshotMapper; private OrderSnapshotMapper orderSnapshotMapper;
@Autowired @Autowired
private MachineApiServiceImpl machineApiService; private OrderDetailMapper orderDetailMapper;
@Autowired
private JiGuangPushServiceImpl jiGuangPushService;
@Autowired
private OrderOperationLogServiceImpl orderOperationLogService;
/** /**
* 查询订单退款 * 查询订单退款
...@@ -98,34 +99,46 @@ public class OrderRefundServiceImpl implements IOrderRefundService ...@@ -98,34 +99,46 @@ public class OrderRefundServiceImpl implements IOrderRefundService
if(order ==null ){ if(order ==null ){
return AjaxResult.error("找不到该订单"); return AjaxResult.error("找不到该订单");
} }
// 制作中、制作完成、聚餐中、已完成
String state = order.getState(); String state = order.getState();
// 制作中、制作完成、取餐中、已完成、待取超时、退款失败
List<String> status = Arrays.asList(OrderStatusConstant.production,OrderStatusConstant.productionCompleted,OrderStatusConstant.Taking,OrderStatusConstant.completed,OrderStatusConstant.timeout,OrderStatusConstant.refundFailed); List<String> status = Arrays.asList(OrderStatusConstant.production,OrderStatusConstant.productionCompleted,OrderStatusConstant.Taking,OrderStatusConstant.completed,OrderStatusConstant.timeout,OrderStatusConstant.refundFailed);
if(OrderStatusConstant.Paid.equals(state)){ if (OrderStatusConstant.Paid.equals(state)) {
//orderRefund.setRefundAmount(order.getAmount()); //orderRefund.setRefundAmount(order.getAmount());
// 4 支付制作中 5 制作完成未取 6 取餐中 7 取餐完成 // 4 支付制作中 5 制作完成未取 6 取餐中 7 取餐完成
}else if(status.contains(state)){ } else if (status.contains(state)) {
String desc = orderRefund.getDesc(); String desc = orderRefund.getDesc();
if(StringUtils.isEmpty(desc)){ if (StringUtils.isEmpty(desc)) {
return AjaxResult.error("请联系客服进行退款"); return AjaxResult.error("请联系客服进行退款");
} }
}else{ } else {
return AjaxResult.error("该订单状态不允许退款"); return AjaxResult.error("该订单状态不允许退款");
} }
List<OrderDetail> orderDetails = orderDetailMapper.listDetailByIds(orderRefund.getOrderDetailIds());
List<String> illegalGoodNames = orderDetails.stream().filter(orderDetail -> orderDetail.getRefundTime() != null).map(OrderDetail::getGoodsName).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(illegalGoodNames)) {
return AjaxResult.error("商品" + illegalGoodNames + "已退过款");
}
BigDecimal orderDetailAmount = orderDetails.stream().map(OrderDetail::getRealAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
if (orderDetailAmount.compareTo(orderRefund.getRefundAmount()) != 0) {
log.warn("退款金额[{}]与商品明细总额[{}]不符", orderRefund.getRefundAmount(), orderDetailAmount);
return AjaxResult.error("退款金额与商品明细总额不符");
}
orderRefund.setCreatedAt(new Date()); orderRefund.setCreatedAt(new Date());
orderRefund.setUpdatedAt(new Date()); orderRefund.setUpdatedAt(new Date());
orderRefund.setState("0"); orderRefund.setState(RefundState.PENDING.getState());
orderRefund.setOrderNo(order.getOrderNo()); orderRefund.setOrderNo(order.getOrderNo());
orderRefund.setRefundNo(GenerateCode.getCode("R","%09d")); orderRefund.setRefundNo(GenerateCode.getCode("R", "%09d"));
orderRefund.setTotalFee(order.getAmount()); orderRefund.setTotalFee(orderDetailAmount);
orderRefund.setOrderNo(order.getOrderNo()); orderRefund.setOrderNo(order.getOrderNo());
if(StringUtils.isEmpty(orderRefund.getCreateUserName())){ if (StringUtils.isEmpty(orderRefund.getCreateUserName())) {
orderRefund.setCreateUserName(order.getUserName()); orderRefund.setCreateUserName(order.getUserName());
} }
int i = orderRefundMapper.insertOrderRefund(orderRefund); orderRefundMapper.insertOrderRefund(orderRefund);
order.setState(OrderStatusConstant.refunding); order.setState(OrderStatusConstant.refunding);
orderService.updateOrder(order); orderService.updateOrder(order);
orderDetailMapper.bindRefund(orderRefund.getId(), orderRefund.getOrderDetailIds());
orderRefund.setOrder(order); orderRefund.setOrder(order);
return AjaxResult.success(orderRefund); return AjaxResult.success(orderRefund);
} }
......
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray; ...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.soss.common.core.domain.AjaxResult; import com.soss.common.core.domain.AjaxResult;
import com.soss.common.core.domain.model.LoginUser; import com.soss.common.core.domain.model.LoginUser;
import com.soss.common.enums.MachineState;
import com.soss.common.exception.ServiceException; import com.soss.common.exception.ServiceException;
import com.soss.common.utils.StringUtils; import com.soss.common.utils.StringUtils;
import com.soss.common.utils.spring.SpringUtils; import com.soss.common.utils.spring.SpringUtils;
...@@ -19,6 +20,7 @@ import com.soss.system.mapper.*; ...@@ -19,6 +20,7 @@ import com.soss.system.mapper.*;
import com.soss.system.service.IOrderService; import com.soss.system.service.IOrderService;
import com.soss.system.utils.SendSmsUtil; import com.soss.system.utils.SendSmsUtil;
import com.soss.system.weixin.util.SendMessageUtils; import com.soss.system.weixin.util.SendMessageUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.support.atomic.RedisAtomicInteger; import org.springframework.data.redis.support.atomic.RedisAtomicInteger;
...@@ -139,7 +141,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -139,7 +141,7 @@ public class OrderServiceImpl implements IOrderService {
List<Machine> machines = machineMapper.selectMachineList(machine); List<Machine> machines = machineMapper.selectMachineList(machine);
if (machines != null && !machines.isEmpty()) { if (machines != null && !machines.isEmpty()) {
Machine machine1 = machines.get(0); Machine machine1 = machines.get(0);
if (!"1".equals(machine1.getState())) { if (!MachineState.RUNNING.getState().equals(machine1.getState())) {
return AjaxResult.error("机器暂时不可用"); return AjaxResult.error("机器暂时不可用");
} }
machineId = machine1.getId(); machineId = machine1.getId();
...@@ -178,8 +180,8 @@ public class OrderServiceImpl implements IOrderService { ...@@ -178,8 +180,8 @@ public class OrderServiceImpl implements IOrderService {
} }
@Override @Override
public void checkBusinessTime(Long shopId) { public void checkShopInfo(Order order) {
Shop shop = shopMapper.selectShopById(shopId); Shop shop = shopMapper.selectShopById(order.getShopId());
String startTime = shop.getStartTime(); String startTime = shop.getStartTime();
String endTime = shop.getEndTime(); String endTime = shop.getEndTime();
String[] split = startTime.split(":"); String[] split = startTime.split(":");
...@@ -194,6 +196,12 @@ public class OrderServiceImpl implements IOrderService { ...@@ -194,6 +196,12 @@ public class OrderServiceImpl implements IOrderService {
if (startBusiness.getTimeInMillis() > l || endBusiness.getTimeInMillis() < l) { if (startBusiness.getTimeInMillis() > l || endBusiness.getTimeInMillis() < l) {
throw new ServiceException("当前时间本店休息中,暂停点单~"); throw new ServiceException("当前时间本店休息中,暂停点单~");
} }
if (shop.getDistanceLimit() != null && shop.getDistanceLimit() > 0) {
double distance = AppServiceImpl.GetRealDistance(order.getLng().doubleValue(), order.getLat().doubleValue(), Double.parseDouble(shop.getLng()), Double.parseDouble(shop.getLat()));
if (distance > shop.getDistanceLimit() * 1000) {
throw new ServiceException("超过店铺下单的距离范围");
}
}
} }
/** /**
...@@ -263,9 +271,9 @@ public class OrderServiceImpl implements IOrderService { ...@@ -263,9 +271,9 @@ public class OrderServiceImpl implements IOrderService {
order.setFinishTime(new Date()); order.setFinishTime(new Date());
orderOperationLogService.insertOrderOperationLog(order); orderOperationLogService.insertOrderOperationLog(order);
jiGuangPushService.pushOrderState(order); jiGuangPushService.pushOrderState(order);
if (BooleanUtils.isTrue(order.getSendMsgFlag3())) {
sendMessageUtils.sendWxMsg(order); sendMessageUtils.sendWxMsg(order);
}
} }
/** /**
...@@ -318,13 +326,14 @@ public class OrderServiceImpl implements IOrderService { ...@@ -318,13 +326,14 @@ public class OrderServiceImpl implements IOrderService {
private void productionCompletedState(Order order) { private void productionCompletedState(Order order) {
orderOperationLogService.insertOrderOperationLog(order); orderOperationLogService.insertOrderOperationLog(order);
jiGuangPushService.pushOrderState(order); jiGuangPushService.pushOrderState(order);
wechatMessageService.insertWechatMessage(order.getUserId(), "制作完成,您的订单已经制作完成,现在可以去取餐啦!"); wechatMessageService.insertWechatMessage(order.getUserId(), order.getId(), "制作完成,您的订单已经制作完成,现在可以去取餐啦!");
if (BooleanUtils.isTrue(order.getSendMsgFlag2())) {
sendMessageUtils.sendWxMsg(order); sendMessageUtils.sendWxMsg(order);
}
Customer customer = customerMapper.selectCustomerById(order.getUserId()); Customer customer = customerMapper.selectCustomerById(order.getUserId());
if (!"1".equals(customer.getAllow())) { if (!"1".equals(customer.getAllow())) {
sendSmsUtil.sendSms(order.getUserPhone(), "SMS_243650242", null); sendSmsUtil.sendSms(order.getUserPhone(), "SMS_243650242", null);
} }
} }
/** /**
...@@ -339,9 +348,10 @@ public class OrderServiceImpl implements IOrderService { ...@@ -339,9 +348,10 @@ public class OrderServiceImpl implements IOrderService {
private void productionState(Order order) { private void productionState(Order order) {
orderOperationLogService.insertOrderOperationLog(order); orderOperationLogService.insertOrderOperationLog(order);
jiGuangPushService.pushOrderState(order); jiGuangPushService.pushOrderState(order);
wechatMessageService.insertWechatMessage(order.getUserId(), "制作提醒,您的订单已经开始制作,马上就能享受美味了!"); wechatMessageService.insertWechatMessage(order.getUserId(), order.getId(), "制作提醒,您的订单已经开始制作,马上就能享受美味了!");
if (BooleanUtils.isTrue(order.getSendMsgFlag2())) {
sendMessageUtils.sendWxMsg(order); sendMessageUtils.sendWxMsg(order);
}
} }
/** /**
...@@ -359,9 +369,11 @@ public class OrderServiceImpl implements IOrderService { ...@@ -359,9 +369,11 @@ public class OrderServiceImpl implements IOrderService {
machineApiService.updateOrder(order); machineApiService.updateOrder(order);
//极光推送 //极光推送
jiGuangPushService.pushOrderState(order); jiGuangPushService.pushOrderState(order);
wechatMessageService.insertWechatMessage(order.getUserId(), "下单成功,您已经下单成功了~"); wechatMessageService.insertWechatMessage(order.getUserId(), order.getId(), "下单成功,您已经下单成功了~");
if (BooleanUtils.isTrue(order.getSendMsgFlag1())) {
sendMessageUtils.sendWxMsg(order); sendMessageUtils.sendWxMsg(order);
} }
}
/** /**
* 批量删除订单 * 批量删除订单
...@@ -402,7 +414,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -402,7 +414,7 @@ public class OrderServiceImpl implements IOrderService {
for (OrderDetail orderDetail : orderDetails) { for (OrderDetail orderDetail : orderDetails) {
ShopGoodsSku shopGoodsSku = new ShopGoodsSku(); ShopGoodsSku shopGoodsSku = new ShopGoodsSku();
shopGoodsSku.setSkuId(orderDetail.getSkuId()); shopGoodsSku.setSkuId(orderDetail.getSkuId());
shopGoodsSku.setShopId(Long.valueOf(order.getShopId())); shopGoodsSku.setShopId(order.getShopId());
shopGoodsSku.setIsDeleted("0"); shopGoodsSku.setIsDeleted("0");
List<ShopGoodsSku> shopGoodsSkus = shopGoodsSkuMapper.selectShopGoodsSkuList(shopGoodsSku); List<ShopGoodsSku> shopGoodsSkus = shopGoodsSkuMapper.selectShopGoodsSkuList(shopGoodsSku);
if (shopGoodsSkus == null || shopGoodsSkus.isEmpty()) { if (shopGoodsSkus == null || shopGoodsSkus.isEmpty()) {
......
...@@ -137,6 +137,7 @@ public class OrderTakingServiceImpl { ...@@ -137,6 +137,7 @@ public class OrderTakingServiceImpl {
CategoryVo categoryVo = new CategoryVo(); CategoryVo categoryVo = new CategoryVo();
categoryVo.setId(Long.parseLong(category.getId())); categoryVo.setId(Long.parseLong(category.getId()));
categoryVo.setName(category.getName()); categoryVo.setName(category.getName());
categoryVo.setIcon(category.getIcon());
List<Goods> goodsList = shopGoodsMapper.selectShopCategoryGoodsByCategoryId(shopId, category.getId()); List<Goods> goodsList = shopGoodsMapper.selectShopCategoryGoodsByCategoryId(shopId, category.getId());
List<GoodsVo> goodsVoList = new ArrayList<>(); List<GoodsVo> goodsVoList = new ArrayList<>();
categoryVo.setGoods(goodsVoList); categoryVo.setGoods(goodsVoList);
......
...@@ -3,6 +3,7 @@ package com.soss.system.service.impl; ...@@ -3,6 +3,7 @@ package com.soss.system.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.soss.common.core.domain.AjaxResult; import com.soss.common.core.domain.AjaxResult;
import com.soss.common.enums.MachineState;
import com.soss.common.enums.ShopState; import com.soss.common.enums.ShopState;
import com.soss.common.exception.ServiceException; import com.soss.common.exception.ServiceException;
import com.soss.common.utils.StringUtils; import com.soss.common.utils.StringUtils;
...@@ -100,7 +101,7 @@ public class ShopServiceImpl implements IShopService ...@@ -100,7 +101,7 @@ public class ShopServiceImpl implements IShopService
if (!Objects.equals(shop.getState(), ShopState.CLOSE.getState())) { if (!Objects.equals(shop.getState(), ShopState.CLOSE.getState())) {
throw new ServiceException("需暂停营业状态才可以开始测试"); throw new ServiceException("需暂停营业状态才可以开始测试");
} }
this.updateShop(new Shop(shopId, ShopState.TESTING.getState())); shopMapper.updateShop(new Shop(shopId, ShopState.TESTING.getState()));
} }
@Override @Override
...@@ -109,24 +110,24 @@ public class ShopServiceImpl implements IShopService ...@@ -109,24 +110,24 @@ public class ShopServiceImpl implements IShopService
if (CollectionUtils.isEmpty(machines)) { if (CollectionUtils.isEmpty(machines)) {
throw new ServiceException("需绑定机器后才可完成测试"); throw new ServiceException("需绑定机器后才可完成测试");
} }
// 完成测试后的校验 todo 逻辑待定 // 完成测试后的校验
long unFinishTestMachineCount = machines.stream().filter(machine -> !machine.getState().equals(1)).count(); long unFinishTestMachineCount = machines.stream().filter(machine -> !machine.getState().equals(MachineState.RUNNING.getState())
&& !Objects.equals(machine.getState(), MachineState.STANDBY.getState())).count();
if (unFinishTestMachineCount > 0) { if (unFinishTestMachineCount > 0) {
throw new ServiceException("需机器完成运营测试后才可完成测试"); throw new ServiceException("需机器完成运营测试后才可完成测试");
} }
Shop shop = new Shop(shopId, ShopState.CLOSE.getState()); Shop shop = new Shop(shopId, ShopState.CLOSE.getState());
this.updateShop(shop); shopMapper.updateShop(shop);
} }
@Override @Override
public void open(Long shopId) { public void open(Long shopId) {
Shop shop = shopMapper.selectShopById(shopId); Shop shop = shopMapper.selectShopById(shopId);
Assert.notNull(shop, "未查询到匹配的店铺信息[id=" + shopId + "]"); Assert.notNull(shop, "未查询到匹配的店铺信息[id=" + shopId + "]");
// 判断店铺绑定机器是否输入组件属性对应经验值 todo if (!Objects.equals(shop.getState(), ShopState.CLOSE.getState())) {
/*if () { throw new ServiceException("店铺暂停营业状态下才能正常营业");
throw new ServiceException("店铺绑定机器还未输入组件属性对应经验值"); }
}*/ shopMapper.updateShop(new Shop(shopId, ShopState.OPEN.getState()));
this.updateShop(new Shop(shopId, ShopState.OPEN.getState()));
} }
/** /**
......
package com.soss.system.service.impl; package com.soss.system.service.impl;
import java.util.Date; import com.soss.common.enums.MessageState;
import java.util.List; import com.soss.common.enums.MessageType;
import com.soss.system.domain.WechatMessage;
import com.soss.system.mapper.WechatMessageMapper;
import com.soss.system.service.IWechatMessageService; import com.soss.system.service.IWechatMessageService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.soss.system.mapper.WechatMessageMapper;
import com.soss.system.domain.WechatMessage; import java.util.Date;
import java.util.List;
/** /**
* 小程序信息发送Service业务层处理 * 小程序信息发送Service业务层处理
...@@ -58,19 +60,24 @@ public class WechatMessageServiceImpl implements IWechatMessageService ...@@ -58,19 +60,24 @@ public class WechatMessageServiceImpl implements IWechatMessageService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertWechatMessage(WechatMessage wechatMessage) public int insertWechatMessage(WechatMessage wechatMessage) {
{
return wechatMessageMapper.insertWechatMessage(wechatMessage); return wechatMessageMapper.insertWechatMessage(wechatMessage);
} }
@Override @Override
public int insertWechatMessage(String openId, String message) { public int insertWechatMessage(String openId, Long targetId, String message) {
return insertWechatMessage(openId, targetId, MessageType.ORDER.getType(), message);
}
@Override
public int insertWechatMessage(String openId, Long targetId, Integer messageType, String message) {
WechatMessage wechatMessage = new WechatMessage(); WechatMessage wechatMessage = new WechatMessage();
wechatMessage.setMessage(message); wechatMessage.setMessage(message);
wechatMessage.setTargetId(targetId);
wechatMessage.setCreatedAt(new Date()); wechatMessage.setCreatedAt(new Date());
wechatMessage.setState("0"); wechatMessage.setState(MessageState.TO_BE_SEND.getState());
wechatMessage.setIsRead("1"); wechatMessage.setIsRead("1");
wechatMessage.setType("1"); wechatMessage.setType(messageType);
wechatMessage.setUserId(openId); wechatMessage.setUserId(openId);
wechatMessage.setUpdatedAt(new Date()); wechatMessage.setUpdatedAt(new Date());
return wechatMessageMapper.insertWechatMessage(wechatMessage); return wechatMessageMapper.insertWechatMessage(wechatMessage);
......
...@@ -18,12 +18,13 @@ ...@@ -18,12 +18,13 @@
<select id="selectCouponById" resultMap="BaseResultMap"> <select id="selectCouponById" resultMap="BaseResultMap">
select * select *
from coupon from coupon
where id = #{id} where id = #{id} and state != ${@com.soss.common.enums.CouponState @DELETE.getState}
</select> </select>
<select id="listCoupon" parameterType="com.soss.system.domain.Coupon" resultMap="BaseResultMap"> <select id="listCoupon" parameterType="com.soss.system.domain.Coupon" resultMap="BaseResultMap">
select * from coupon select * from coupon
<where> <where>
state != ${@com.soss.common.enums.CouponState @DELETE.getState}
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
<if test="categoryId != null">and category_id = #{categoryId}</if> <if test="categoryId != null">and category_id = #{categoryId}</if>
<if test="state != null">and state = #{state}</if> <if test="state != null">and state = #{state}</if>
...@@ -34,6 +35,7 @@ ...@@ -34,6 +35,7 @@
<select id="getCouponCategoryTypeStat" resultType="com.soss.system.domain.CouponCategory"> <select id="getCouponCategoryTypeStat" resultType="com.soss.system.domain.CouponCategory">
select category_id id, count(*) couponCnt from coupon where category_id in select category_id id, count(*) couponCnt from coupon where category_id in
<foreach collection="categoryIds" item="categoryId" open="(" close=")" separator=",">#{categoryId}</foreach> <foreach collection="categoryIds" item="categoryId" open="(" close=")" separator=",">#{categoryId}</foreach>
and state != ${@com.soss.common.enums.CouponState @DELETE.getState}
group by category_id group by category_id
</select> </select>
...@@ -89,6 +91,6 @@ ...@@ -89,6 +91,6 @@
update coupon c update coupon c
left join coupon_rule cr on c.rule_id = cr.id left join coupon_rule cr on c.rule_id = cr.id
set c.state = ${@com.soss.common.enums.CouponState @EXPIRED.getState} set c.state = ${@com.soss.common.enums.CouponState @EXPIRED.getState}
where cr.use_end_time &lt; now() where cr.use_end_time &lt; now() and c.state = ${@com.soss.common.enums.CouponState @ONLINE.getState}
</update> </update>
</mapper> </mapper>
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
useStartTime, cu.expired_time useEndTime, cc.`desc` categoryDesc, cr.category_ids categoryIdStr, cr.goods_ids useStartTime, cu.expired_time useEndTime, cc.`desc` categoryDesc, cr.category_ids categoryIdStr, cr.goods_ids
goodsIdStr, cr.province provinceStr, cr.city cityStr, cr.area areaStr, cr.shop_ids shopIdStr, goodsIdStr, cr.province provinceStr, cr.city cityStr, cr.area areaStr, cr.shop_ids shopIdStr,
cr.week_limit weekLimitStr, cr.price_discount priceDiscount, c.id couponId, cr.price_limit priceLimit, cr.week_limit weekLimitStr, cr.price_discount priceDiscount, c.id couponId, cr.price_limit priceLimit,
cr.order_limit orderLimit cr.order_limit orderLimit, cu.state
</sql> </sql>
<sql id="selectCustAvailableCoupon"> <sql id="selectCustAvailableCoupon">
...@@ -159,6 +159,6 @@ ...@@ -159,6 +159,6 @@
<update id="expireCouponUser"> <update id="expireCouponUser">
update coupon_user update coupon_user
set state = ${@com.soss.common.enums.CouponUserState @EXPIRED.getState} set state = ${@com.soss.common.enums.CouponUserState @EXPIRED.getState}
where expired_time &lt; now() where expired_time &lt; now() and state = ${@com.soss.common.enums.CouponUserState @EFFECTIVE.getState}
</update> </update>
</mapper> </mapper>
...@@ -5,16 +5,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -5,16 +5,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.soss.system.mapper.CustomerMapper"> <mapper namespace="com.soss.system.mapper.CustomerMapper">
<resultMap type="Customer" id="CustomerResult"> <resultMap type="Customer" id="CustomerResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="userName" column="user_name" /> <result property="userName" column="user_name"/>
<result property="phone" column="phone" /> <result property="phone" column="phone"/>
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time"/>
<result property="headSculpturePath" column="head_sculpture_path" /> <result property="headSculpturePath" column="head_sculpture_path"/>
<result property="soucre" column="soucre" /> <result property="sex" column="sex"/>
<result property="birthday" column="birthday"/>
<result property="soucre" column="soucre"/>
</resultMap> </resultMap>
<sql id="selectCustomerVo"> <sql id="selectCustomerVo">
select id, user_name, phone, create_time, head_sculpture_path, soucre from customer select id, user_name, phone, create_time, head_sculpture_path, sex, birthday, soucre from customer
</sql> </sql>
<select id="selectCustomerList" parameterType="Customer" resultMap="CustomerResult"> <select id="selectCustomerList" parameterType="Customer" resultMap="CustomerResult">
...@@ -40,6 +42,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -40,6 +42,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phone != null">phone,</if> <if test="phone != null">phone,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="headSculpturePath != null">head_sculpture_path,</if> <if test="headSculpturePath != null">head_sculpture_path,</if>
<if test="sex != null">sex,</if>
<if test="birthday != null">birthday,</if>
<if test="soucre != null">soucre,</if> <if test="soucre != null">soucre,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
...@@ -48,6 +52,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -48,6 +52,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phone != null">#{phone},</if> <if test="phone != null">#{phone},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="headSculpturePath != null">#{headSculpturePath},</if> <if test="headSculpturePath != null">#{headSculpturePath},</if>
<if test="sex != null">#{sex},</if>
<if test="birthday != null">#{birthday},</if>
<if test="soucre != null">#{soucre},</if> <if test="soucre != null">#{soucre},</if>
</trim> </trim>
</insert> </insert>
...@@ -58,6 +64,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -58,6 +64,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userName != null">user_name = #{userName},</if> <if test="userName != null">user_name = #{userName},</if>
<if test="phone != null">phone = #{phone},</if> <if test="phone != null">phone = #{phone},</if>
<if test="headSculpturePath != null">head_sculpture_path = #{headSculpturePath},</if> <if test="headSculpturePath != null">head_sculpture_path = #{headSculpturePath},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="soucre != null">soucre = #{soucre},</if> <if test="soucre != null">soucre = #{soucre},</if>
<if test="allow != null">allow = #{soucre},</if> <if test="allow != null">allow = #{soucre},</if>
</trim> </trim>
......
...@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="GoodsCategory" id="GoodsCategoryResult"> <resultMap type="GoodsCategory" id="GoodsCategoryResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="name" column="name" /> <result property="name" column="name" />
<result property="icon" column="icon"/>
<result property="remarks" column="remarks" /> <result property="remarks" column="remarks" />
<result property="turn" column="turn" /> <result property="turn" column="turn" />
<result property="state" column="state" /> <result property="state" column="state" />
...@@ -17,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -17,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectGoodsCategoryVo"> <sql id="selectGoodsCategoryVo">
select id, name, remarks, turn, state, is_deleted, created_at, updated_at, code from goods_category select id, name, icon, remarks, turn, state, is_deleted, created_at, updated_at, code from goods_category
</sql> </sql>
<select id="selectGoodsCategoryList" parameterType="GoodsCategory" resultMap="GoodsCategoryResult"> <select id="selectGoodsCategoryList" parameterType="GoodsCategory" resultMap="GoodsCategoryResult">
...@@ -50,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -50,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into goods_category insert into goods_category
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if> <if test="name != null and name != ''">name,</if>
<if test="icon != null and icon != ''">icon,</if>
<if test="remarks != null">remarks,</if> <if test="remarks != null">remarks,</if>
<if test="turn != null and turn != ''">turn,</if> <if test="turn != null and turn != ''">turn,</if>
<if test="state != null and state != ''">state,</if> <if test="state != null and state != ''">state,</if>
...@@ -60,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -60,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if> <if test="name != null and name != ''">#{name},</if>
<if test="icon != null and icon != ''">#{icon},</if>
<if test="remarks != null">#{remarks},</if> <if test="remarks != null">#{remarks},</if>
<if test="turn != null and turn != ''">#{turn},</if> <if test="turn != null and turn != ''">#{turn},</if>
<if test="state != null and state != ''">#{state},</if> <if test="state != null and state != ''">#{state},</if>
...@@ -74,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -74,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update goods_category update goods_category
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if> <if test="name != null and name != ''">name = #{name},</if>
<if test="icon != null and icon != ''">icon = #{icon},</if>
<if test="remarks != null">remarks = #{remarks},</if> <if test="remarks != null">remarks = #{remarks},</if>
<if test="turn != null and turn != ''">turn = #{turn},</if> <if test="turn != null and turn != ''">turn = #{turn},</if>
<if test="state != null and state != ''">state = #{state},</if> <if test="state != null and state != ''">state = #{state},</if>
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.soss.system.mapper.OrderDetailMapper"> <mapper namespace="com.soss.system.mapper.OrderDetailMapper">
<resultMap type="OrderDetail" id="OrderDetailResult"> <resultMap type="OrderDetail" id="OrderDetailResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id"/>
<result property="goodsId" column="goods_id" /> <result property="goodsId" column="goods_id"/>
<result property="goodsName" column="goods_name" /> <result property="goodsName" column="goods_name"/>
<result property="machineId" column="machine_id" /> <result property="machineId" column="machine_id"/>
<result property="num" column="num" /> <result property="num" column="num"/>
<result property="viewAmount" column="view_amount" /> <result property="viewAmount" column="view_amount"/>
<result property="amountShould" column="amount_should" /> <result property="amountShould" column="amount_should"/>
<result property="couponAmount" column="coupon_amount" /> <result property="couponAmount" column="coupon_amount"/>
<result property="realAmount" column="real_amount" /> <result property="realAmount" column="real_amount"/>
<result property="specRuleDetail" column="spec_rule_detail" /> <result property="specRuleDetail" column="spec_rule_detail"/>
<result property="specRuleIds" column="spec_rule_ids" /> <result property="specRuleIds" column="spec_rule_ids"/>
<result property="skuId" column="sku_id" /> <result property="skuId" column="sku_id"/>
<result property="goodsCategory" column="goods_category" /> <result property="goodsCategory" column="goods_category"/>
<result property="createdAt" column="created_at" /> <result property="createdAt" column="created_at"/>
<result property="updatedAt" column="updated_at" /> <result property="refundId" column="refund_id"/>
<result property="refundTime" column="refund_time"/>
<result property="updatedAt" column="updated_at"/>
</resultMap> </resultMap>
<sql id="selectOrderDetailVo"> <sql id="selectOrderDetailVo">
select id, order_id, goods_id, goods_name, machine_id, num, view_amount, amount_should, coupon_amount, real_amount, spec_rule_detail, spec_rule_ids, sku_id, goods_category, created_at, updated_at from order_detail select * from order_detail
</sql> </sql>
<select id="selectOrderDetailList" parameterType="OrderDetail" resultMap="OrderDetailResult"> <select id="selectOrderDetailList" parameterType="OrderDetail" resultMap="OrderDetailResult">
<include refid="selectOrderDetailVo"/> <include refid="selectOrderDetailVo"/>
<where> <where>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if> <if test="orderId != null and orderId != ''">and order_id = #{orderId}</if>
<if test="goodsId != null and goodsId != ''"> and goods_id = #{goodsId}</if> <if test="goodsId != null and goodsId != ''">and goods_id = #{goodsId}</if>
<if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if> <if test="goodsName != null and goodsName != ''">and goods_name like concat('%', #{goodsName}, '%')</if>
<if test="machineId != null and machineId != ''"> and machine_id = #{machineId}</if> <if test="machineId != null and machineId != ''">and machine_id = #{machineId}</if>
<if test="num != null and num != ''"> and num = #{num}</if> <if test="num != null and num != ''">and num = #{num}</if>
<if test="viewAmount != null "> and view_amount = #{viewAmount}</if> <if test="viewAmount != null ">and view_amount = #{viewAmount}</if>
<if test="amountShould != null "> and amount_should = #{amountShould}</if> <if test="amountShould != null ">and amount_should = #{amountShould}</if>
<if test="couponAmount != null "> and coupon_amount = #{couponAmount}</if> <if test="couponAmount != null ">and coupon_amount = #{couponAmount}</if>
<if test="realAmount != null "> and real_amount = #{realAmount}</if> <if test="realAmount != null ">and real_amount = #{realAmount}</if>
<if test="specRuleDetail != null and specRuleDetail != ''"> and spec_rule_detail = #{specRuleDetail}</if> <if test="specRuleDetail != null and specRuleDetail != ''">and spec_rule_detail = #{specRuleDetail}</if>
<if test="specRuleIds != null and specRuleIds != ''"> and spec_rule_ids = #{specRuleIds}</if> <if test="specRuleIds != null and specRuleIds != ''">and spec_rule_ids = #{specRuleIds}</if>
<if test="skuId != null and skuId != ''"> and sku_id = #{skuId}</if> <if test="skuId != null and skuId != ''">and sku_id = #{skuId}</if>
<if test="goodsCategory != null and goodsCategory != ''"> and goods_category = #{goodsCategory}</if> <if test="goodsCategory != null and goodsCategory != ''">and goods_category = #{goodsCategory}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if> <if test="createdAt != null ">and created_at = #{createdAt}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if> <if test="refundId != null ">and refund_id = #{refundId}</if>
<if test="refundTime != null ">and refund_time = #{refundTime}</if>
<if test="updatedAt != null ">and updated_at = #{updatedAt}</if>
</where> </where>
</select> </select>
<select id="listDetailByIds" resultMap="OrderDetailResult">
<include refid="selectOrderDetailVo"/>
where id in
<foreach collection="ids" item="id" separator="," open="(" close=")">#{id}</foreach>
</select>
<select id="selectOrderDetailById" parameterType="String" resultMap="OrderDetailResult"> <select id="selectOrderDetailById" parameterType="String" resultMap="OrderDetailResult">
<include refid="selectOrderDetailVo"/> <include refid="selectOrderDetailVo"/>
where id = #{id} where id = #{id}
...@@ -70,6 +80,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -70,6 +80,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="skuId != null and skuId != ''">sku_id,</if> <if test="skuId != null and skuId != ''">sku_id,</if>
<if test="goodsCategory != null">goods_category,</if> <if test="goodsCategory != null">goods_category,</if>
<if test="createdAt != null">created_at,</if> <if test="createdAt != null">created_at,</if>
<if test="refundId != null">refund_id,</if>
<if test="refundTime != null">refund_time,</if>
<if test="updatedAt != null">updated_at,</if> <if test="updatedAt != null">updated_at,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
...@@ -87,6 +99,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -87,6 +99,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="skuId != null and skuId != ''">#{skuId},</if> <if test="skuId != null and skuId != ''">#{skuId},</if>
<if test="goodsCategory != null">#{goodsCategory},</if> <if test="goodsCategory != null">#{goodsCategory},</if>
<if test="createdAt != null">#{createdAt},</if> <if test="createdAt != null">#{createdAt},</if>
<if test="refundId != null">#{refundId},</if>
<if test="refundTime != null">#{refundTime},</if>
<if test="updatedAt != null">#{updatedAt},</if> <if test="updatedAt != null">#{updatedAt},</if>
</trim> </trim>
</insert> </insert>
...@@ -107,6 +121,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -107,6 +121,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="specRuleIds != null and specRuleIds != ''">spec_rule_ids = #{specRuleIds},</if> <if test="specRuleIds != null and specRuleIds != ''">spec_rule_ids = #{specRuleIds},</if>
<if test="skuId != null and skuId != ''">sku_id = #{skuId},</if> <if test="skuId != null and skuId != ''">sku_id = #{skuId},</if>
<if test="goodsCategory != null">goods_category = #{goodsCategory},</if> <if test="goodsCategory != null">goods_category = #{goodsCategory},</if>
<if test="refundId != null">refund_id = #{refundId},</if>
<if test="refundTime != null">refund_time = #{refundTime},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if> <if test="updatedAt != null">updated_at = #{updatedAt},</if>
</trim> </trim>
where id = #{id} where id = #{id}
...@@ -122,4 +138,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -122,4 +138,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<update id="bindRefund">
update order_detail set refund_id = #{refundId} where id in
<foreach collection="ids" item="id" separator="," open="(" close=")">#{id}</foreach>
</update>
<update id="updateRefundState">
update order_detail set
<choose>
<when test="refundTime != null">refund_time = #{refundTime}</when>
<otherwise>refund_id = null, refund_time = null</otherwise>
</choose>
where refund_id = #{refundId}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -5,54 +5,64 @@ ...@@ -5,54 +5,64 @@
<mapper namespace="com.soss.system.mapper.OrderMapper"> <mapper namespace="com.soss.system.mapper.OrderMapper">
<resultMap type="Order" id="OrderResult"> <resultMap type="Order" id="OrderResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="orderNo" column="order_no" /> <result property="orderNo" column="order_no"/>
<result property="orderNum" column="order_num" /> <result property="orderNum" column="order_num"/>
<result property="userId" column="user_id" /> <result property="userId" column="user_id"/>
<result property="userName" column="user_name" /> <result property="userName" column="user_name"/>
<result property="userPhone" column="user_phone" /> <result property="userPhone" column="user_phone"/>
<result property="payTime" column="pay_time" /> <result property="payTime" column="pay_time"/>
<result property="finishTime" column="finish_time" /> <result property="finishTime" column="finish_time"/>
<result property="amount" column="amount" /> <result property="amount" column="amount"/>
<result property="couponId" column="coupon_id" /> <result property="couponId" column="coupon_id"/>
<result property="couponAmount" column="coupon_amount" /> <result property="couponAmount" column="coupon_amount"/>
<result property="paidAmount" column="paid_amount" /> <result property="paidAmount" column="paid_amount"/>
<result property="goodsNum" column="goods_num" /> <result property="goodsNum" column="goods_num"/>
<result property="pickCode" column="pick_code" /> <result property="pickCode" column="pick_code"/>
<result property="shopId" column="shop_id" /> <result property="shopId" column="shop_id"/>
<result property="machineId" column="machine_id" /> <result property="machineId" column="machine_id"/>
<result property="source" column="source" /> <result property="lng" column="lng"/>
<result property="state" column="state" /> <result property="lat" column="lat"/>
<result property="createdAt" column="created_at" /> <result property="source" column="source"/>
<result property="updatedAt" column="updated_at" /> <result property="state" column="state"/>
<result property="sendMsgFlag1" column="send_msg_flag1"/>
<result property="sendMsgFlag2" column="send_msg_flag2"/>
<result property="sendMsgFlag3" column="send_msg_flag3"/>
<result property="createdAt" column="created_at"/>
<result property="updatedAt" column="updated_at"/>
</resultMap> </resultMap>
<sql id="selectOrderVo"> <sql id="selectOrderVo">
select id, order_no, order_num, user_id, user_name, user_phone, pay_time, finish_time, amount, coupon_id, coupon_amount, paid_amount, goods_num, pick_code, shop_id, machine_id, source, state, created_at, updated_at from `order` select * from `order`
</sql> </sql>
<select id="selectOrderList" parameterType="Order" resultMap="OrderResult"> <select id="selectOrderList" parameterType="Order" resultMap="OrderResult">
<include refid="selectOrderVo"/> <include refid="selectOrderVo"/>
<where> <where>
<if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if> <if test="orderNo != null and orderNo != ''">and order_no = #{orderNo}</if>
<if test="orderNum != null and orderNum != ''"> and order_num = #{orderNum}</if> <if test="orderNum != null and orderNum != ''">and order_num = #{orderNum}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if> <if test="userId != null and userId != ''">and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if> <if test="userName != null and userName != ''">and user_name like concat('%', #{userName}, '%')</if>
<if test="userPhone != null and userPhone != ''"> and user_phone = #{userPhone}</if> <if test="userPhone != null and userPhone != ''">and user_phone = #{userPhone}</if>
<if test="payTime != null "> and pay_time = #{payTime}</if> <if test="payTime != null ">and pay_time = #{payTime}</if>
<if test="finishTime != null "> and finish_time = #{finishTime}</if> <if test="finishTime != null ">and finish_time = #{finishTime}</if>
<if test="amount != null "> and amount = #{amount}</if> <if test="amount != null ">and amount = #{amount}</if>
<if test="couponId != null "> and coupon_id = #{couponId}</if> <if test="couponId != null ">and coupon_id = #{couponId}</if>
<if test="couponAmount != null "> and coupon_amount = #{couponAmount}</if> <if test="couponAmount != null ">and coupon_amount = #{couponAmount}</if>
<if test="paidAmount != null "> and paid_amount = #{paidAmount}</if> <if test="paidAmount != null ">and paid_amount = #{paidAmount}</if>
<if test="goodsNum != null and goodsNum != ''"> and goods_num = #{goodsNum}</if> <if test="goodsNum != null and goodsNum != ''">and goods_num = #{goodsNum}</if>
<if test="pickCode != null and pickCode != ''"> and pick_code = #{pickCode}</if> <if test="pickCode != null and pickCode != ''">and pick_code = #{pickCode}</if>
<if test="shopId != null and shopId != ''"> and shop_id = #{shopId}</if> <if test="shopId != null and shopId != ''">and shop_id = #{shopId}</if>
<if test="machineId != null and machineId != ''"> and machine_id = #{machineId}</if> <if test="machineId != null and machineId != ''">and machine_id = #{machineId}</if>
<if test="source != null and source != ''"> and source = #{source}</if> <if test="lng != null">and lng = #{lng}</if>
<if test="state != null and state != ''"> and state = #{state}</if> <if test="lat != null">and lat = #{lat}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if> <if test="source != null and source != ''">and source = #{source}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if> <if test="state != null and state != ''">and state = #{state}</if>
<if test="sendMsgFlag1 != null">and send_msg_flag1 = #{sendMsgFlag1}</if>
<if test="sendMsgFlag2 != null">and send_msg_flag2 = #{sendMsgFlag2}</if>
<if test="sendMsgFlag3 != null">and send_msg_flag3 = #{sendMsgFlag3}</if>
<if test="createdAt != null ">and created_at = #{createdAt}</if>
<if test="updatedAt != null ">and updated_at = #{updatedAt}</if>
</where> </where>
</select> </select>
...@@ -80,8 +90,13 @@ ...@@ -80,8 +90,13 @@
<if test="pickCode != null and pickCode != ''">pick_code,</if> <if test="pickCode != null and pickCode != ''">pick_code,</if>
<if test="shopId != null and shopId != ''">shop_id,</if> <if test="shopId != null and shopId != ''">shop_id,</if>
<if test="machineId != null and machineId != ''">machine_id,</if> <if test="machineId != null and machineId != ''">machine_id,</if>
<if test="lng != null">lng,</if>
<if test="lat != null">lat,</if>
<if test="source != null and source != ''">source,</if> <if test="source != null and source != ''">source,</if>
<if test="state != null and state != ''">state,</if> <if test="state != null and state != ''">state,</if>
<if test="sendMsgFlag1 != null">send_msg_flag1,</if>
<if test="sendMsgFlag2 != null">send_msg_flag2,</if>
<if test="sendMsgFlag3 != null">send_msg_flag3,</if>
<if test="createdAt != null">created_at,</if> <if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if> <if test="updatedAt != null">updated_at,</if>
</trim> </trim>
...@@ -103,6 +118,9 @@ ...@@ -103,6 +118,9 @@
<if test="machineId != null and machineId != ''">#{machineId},</if> <if test="machineId != null and machineId != ''">#{machineId},</if>
<if test="source != null and source != ''">#{source},</if> <if test="source != null and source != ''">#{source},</if>
<if test="state != null and state != ''">#{state},</if> <if test="state != null and state != ''">#{state},</if>
<if test="sendMsgFlag1 != null">#{sendMsgFlag1},</if>
<if test="sendMsgFlag2 != null">#{sendMsgFlag2},</if>
<if test="sendMsgFlag3 != null">#{sendMsgFlag3},</if>
<if test="createdAt != null">#{createdAt},</if> <if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if> <if test="updatedAt != null">#{updatedAt},</if>
</trim> </trim>
...@@ -126,8 +144,13 @@ ...@@ -126,8 +144,13 @@
<if test="pickCode != null and pickCode != ''">pick_code = #{pickCode},</if> <if test="pickCode != null and pickCode != ''">pick_code = #{pickCode},</if>
<if test="shopId != null and shopId != ''">shop_id = #{shopId},</if> <if test="shopId != null and shopId != ''">shop_id = #{shopId},</if>
<if test="machineId != null and machineId != ''">machine_id = #{machineId},</if> <if test="machineId != null and machineId != ''">machine_id = #{machineId},</if>
<if test="lng != null">lng = #{lng},</if>
<if test="lat != null">lat = #{lat},</if>
<if test="source != null and source != ''">source = #{source},</if> <if test="source != null and source != ''">source = #{source},</if>
<if test="state != null and state != ''">state = #{state},</if> <if test="state != null and state != ''">state = #{state},</if>
<if test="sendMsgFlag1 != null">send_msg_flag1 = #{sendMsgFlag1},</if>
<if test="sendMsgFlag2 != null">send_msg_flag2 = #{sendMsgFlag2},</if>
<if test="sendMsgFlag3 != null">send_msg_flag3 = #{sendMsgFlag3},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if> <if test="updatedAt != null">updated_at = #{updatedAt},</if>
</trim> </trim>
where id = #{id} where id = #{id}
......
...@@ -123,8 +123,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -123,8 +123,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<![CDATA[ and o.pay_time <= #{payAtEnd}]]> <![CDATA[ and o.pay_time <= #{payAtEnd}]]>
</if> </if>
order by or2.created_at desc order by or2.created_at desc
</select> </select>
<select id="sumOrderRefundAmount" resultType="java.math.BigDecimal">
select sum(refund_amount) from order_refund where order_id = #{orderId}
and state = ${@com.soss.common.enums.RefundState @SUCCESS.getState}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="province" column="province" /> <result property="province" column="province" />
<result property="city" column="city" /> <result property="city" column="city" />
<result property="zone" column="zone"/> <result property="zone" column="zone"/>
<result property="distanceLimit" column="distance_limit"/>
<result property="state" column="state"/> <result property="state" column="state"/>
<result property="createdAt" column="created_at"/> <result property="createdAt" column="created_at"/>
<result property="updatedAt" column="updated_at"/> <result property="updatedAt" column="updated_at"/>
...@@ -24,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -24,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectShopVo"> <sql id="selectShopVo">
select id, name, code, lng, lat, remarks, start_time, end_time, address, province, city, zone, state, created_at, updated_at, is_default from shop select id, name, code, lng, lat, remarks, start_time, end_time, address, province, city, zone, distance_limit, state, created_at, updated_at, is_default from shop
</sql> </sql>
<select id="selectAllShop" resultMap="ShopResult"> <select id="selectAllShop" resultMap="ShopResult">
...@@ -77,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -77,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="province != null and province != ''">province,</if> <if test="province != null and province != ''">province,</if>
<if test="city != null and city != ''">city,</if> <if test="city != null and city != ''">city,</if>
<if test="zone != null">zone,</if> <if test="zone != null">zone,</if>
<if test="distanceLimit != null">distance_limit,</if>
<if test="state != null">state,</if> <if test="state != null">state,</if>
<if test="createdAt != null">created_at,</if> <if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if> <if test="updatedAt != null">updated_at,</if>
...@@ -94,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -94,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="province != null and province != ''">#{province},</if> <if test="province != null and province != ''">#{province},</if>
<if test="city != null and city != ''">#{city},</if> <if test="city != null and city != ''">#{city},</if>
<if test="zone != null">#{zone},</if> <if test="zone != null">#{zone},</if>
<if test="distanceLimit != null">#{distanceLimit},</if>
<if test="state != null">#{state},</if> <if test="state != null">#{state},</if>
<if test="createdAt != null">#{createdAt},</if> <if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if> <if test="updatedAt != null">#{updatedAt},</if>
...@@ -115,6 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -115,6 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="province != null and province != ''">province = #{province},</if> <if test="province != null and province != ''">province = #{province},</if>
<if test="city != null and city != ''">city = #{city},</if> <if test="city != null and city != ''">city = #{city},</if>
<if test="zone != null">zone = #{zone},</if> <if test="zone != null">zone = #{zone},</if>
<if test="distanceLimit != null">distance_limit = #{distanceLimit},</if>
<if test="state != null">state = #{state},</if> <if test="state != null">state = #{state},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if> <if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="isDefault != null">is_default = #{isDefault},</if> <if test="isDefault != null">is_default = #{isDefault},</if>
......
...@@ -15,10 +15,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -15,10 +15,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updatedAt" column="updated_at" /> <result property="updatedAt" column="updated_at" />
<result property="code" column="code" /> <result property="code" column="code" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="materialRemark" column="material_remark"/>
</resultMap> </resultMap>
<sql id="selectSpecVo"> <sql id="selectSpecVo">
select id, name, state, is_show, is_deleted, is_neccessary, created_at, updated_at, code,remark from spec select * from spec
</sql> </sql>
<select id="selectSpecList" parameterType="Spec" resultMap="SpecResult"> <select id="selectSpecList" parameterType="Spec" resultMap="SpecResult">
...@@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updatedAt != null">updated_at,</if> <if test="updatedAt != null">updated_at,</if>
<if test="code != null">code,</if> <if test="code != null">code,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="materialRemark != null">material_remark,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if> <if test="name != null and name != ''">#{name},</if>
...@@ -65,6 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -65,6 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updatedAt != null">#{updatedAt},</if> <if test="updatedAt != null">#{updatedAt},</if>
<if test="code != null">#{code},</if> <if test="code != null">#{code},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="materialRemark != null">#{materialRemark},</if>
</trim> </trim>
</insert> </insert>
...@@ -79,6 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -79,6 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updatedAt != null">updated_at = #{updatedAt},</if> <if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="code != null">code = #{code},</if> <if test="code != null">code = #{code},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="materialRemark != null">material_remark = #{materialRemark},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
......
...@@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="userId" column="user_id" /> <result property="userId" column="user_id" />
<result property="msgId" column="msg_id" /> <result property="msgId" column="msg_id" />
<result property="message" column="message" /> <result property="message" column="message" />
<result property="targetId" column="target_id"/>
<result property="targetUrl" column="target_url" /> <result property="targetUrl" column="target_url" />
<result property="state" column="state" /> <result property="state" column="state" />
<result property="type" column="type" /> <result property="type" column="type" />
...@@ -19,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -19,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectWechatMessageVo"> <sql id="selectWechatMessageVo">
select id, user_id, msg_id, message, target_url, state, type, is_read, is_deleted, created_at, updated_at from wechat_message select * from wechat_message
</sql> </sql>
<select id="selectWechatMessageList" parameterType="WechatMessage" resultMap="WechatMessageResult"> <select id="selectWechatMessageList" parameterType="WechatMessage" resultMap="WechatMessageResult">
...@@ -28,9 +29,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -28,9 +29,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null "> and user_id = #{userId}</if> <if test="userId != null "> and user_id = #{userId}</if>
<if test="msgId != null and msgId != ''"> and msg_id = #{msgId}</if> <if test="msgId != null and msgId != ''"> and msg_id = #{msgId}</if>
<if test="message != null and message != ''"> and message = #{message}</if> <if test="message != null and message != ''"> and message = #{message}</if>
<if test="targetId != null">and target_id = #{targetId}</if>
<if test="targetUrl != null and targetUrl != ''"> and target_url = #{targetUrl}</if> <if test="targetUrl != null and targetUrl != ''"> and target_url = #{targetUrl}</if>
<if test="state != null and state != ''"> and state = #{state}</if> <if test="state != null and state != ''"> and state = #{state}</if>
<if test="type != null and type != ''"> and type = #{type}</if> <if test="type != null"> and type = #{type}</if>
<if test="isRead != null and isRead != ''"> and is_read = #{isRead}</if> <if test="isRead != null and isRead != ''"> and is_read = #{isRead}</if>
<if test="isDeleted != null and isDeleted != ''"> and is_deleted = #{isDeleted}</if> <if test="isDeleted != null and isDeleted != ''"> and is_deleted = #{isDeleted}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if> <if test="createdAt != null "> and created_at = #{createdAt}</if>
...@@ -50,9 +52,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -50,9 +52,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">user_id,</if> <if test="userId != null">user_id,</if>
<if test="msgId != null and msgId != ''">msg_id,</if> <if test="msgId != null and msgId != ''">msg_id,</if>
<if test="message != null and message != ''">message,</if> <if test="message != null and message != ''">message,</if>
<if test="targetId != null">target_id,</if>
<if test="targetUrl != null and targetUrl != ''">target_url,</if> <if test="targetUrl != null and targetUrl != ''">target_url,</if>
<if test="state != null and state != ''">state,</if> <if test="state != null and state != ''">state,</if>
<if test="type != null and type != ''">type,</if> <if test="type != null">type,</if>
<if test="isRead != null and isRead != ''">is_read,</if> <if test="isRead != null and isRead != ''">is_read,</if>
<if test="isDeleted != null and isDeleted != ''">is_deleted,</if> <if test="isDeleted != null and isDeleted != ''">is_deleted,</if>
<if test="createdAt != null">created_at,</if> <if test="createdAt != null">created_at,</if>
...@@ -62,9 +65,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -62,9 +65,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">#{userId},</if> <if test="userId != null">#{userId},</if>
<if test="msgId != null and msgId != ''">#{msgId},</if> <if test="msgId != null and msgId != ''">#{msgId},</if>
<if test="message != null and message != ''">#{message},</if> <if test="message != null and message != ''">#{message},</if>
<if test="targetId != null">#{targetId},</if>
<if test="targetUrl != null and targetUrl != ''">#{targetUrl},</if> <if test="targetUrl != null and targetUrl != ''">#{targetUrl},</if>
<if test="state != null and state != ''">#{state},</if> <if test="state != null and state != ''">#{state},</if>
<if test="type != null and type != ''">#{type},</if> <if test="type != null">#{type},</if>
<if test="isRead != null and isRead != ''">#{isRead},</if> <if test="isRead != null and isRead != ''">#{isRead},</if>
<if test="isDeleted != null and isDeleted != ''">#{isDeleted},</if> <if test="isDeleted != null and isDeleted != ''">#{isDeleted},</if>
<if test="createdAt != null">#{createdAt},</if> <if test="createdAt != null">#{createdAt},</if>
...@@ -78,9 +82,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -78,9 +82,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">user_id = #{userId},</if> <if test="userId != null">user_id = #{userId},</if>
<if test="msgId != null and msgId != ''">msg_id = #{msgId},</if> <if test="msgId != null and msgId != ''">msg_id = #{msgId},</if>
<if test="message != null and message != ''">message = #{message},</if> <if test="message != null and message != ''">message = #{message},</if>
<if test="targetId != null">target_id = #{targetId},</if>
<if test="targetUrl != null and targetUrl != ''">target_url = #{targetUrl},</if> <if test="targetUrl != null and targetUrl != ''">target_url = #{targetUrl},</if>
<if test="state != null and state != ''">state = #{state},</if> <if test="state != null and state != ''">state = #{state},</if>
<if test="type != null and type != ''">type = #{type},</if> <if test="type != null">type = #{type},</if>
<if test="isRead != null and isRead != ''">is_read = #{isRead},</if> <if test="isRead != null and isRead != ''">is_read = #{isRead},</if>
<if test="isDeleted != null and isDeleted != ''">is_deleted = #{isDeleted},</if> <if test="isDeleted != null and isDeleted != ''">is_deleted = #{isDeleted},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if> <if test="updatedAt != null">updated_at = #{updatedAt},</if>
......
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