| @@ -25,6 +25,8 @@ import org.springframework.web.bind.annotation.RestController; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("aliCircle") | |||
| @@ -53,6 +55,27 @@ public class AliBusinessCircleOrderController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("统计接口") | |||
| @GetMapping("statistics") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| @SystemControllerLog(description = "-统计") | |||
| public ResultData statistics(@ModelAttribute AliBusinessCircleOrder circleOrder) { | |||
| logger.debug("[" + getIpAddr() + "] AliBusinessCircleOrderController::statistics"); | |||
| if (null == circleOrder) { | |||
| circleOrder = new AliBusinessCircleOrder(); | |||
| } | |||
| circleOrder.updateTenantInfo(getTenantInfo()); | |||
| Integer sumPayAmount = aliBusinessCircleOrderService.sumCirclePayment(circleOrder); | |||
| Integer sumRefundAmount = aliBusinessCircleOrderService.sumCircleRefundAmount(circleOrder); | |||
| Map resultMap = new HashMap(); | |||
| resultMap.put("sumPayAmount",sumPayAmount); | |||
| resultMap.put("sumRefundAmount",sumRefundAmount); | |||
| return new ResultData(resultMap); | |||
| } | |||
| @ApiOperation("详情接口") | |||
| @GetMapping("detail") | |||
| @ApiImplicitParams({ | |||
| @@ -21,6 +21,8 @@ import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("wxCircle") | |||
| @@ -49,6 +51,27 @@ public class WxBusinessCircleOrderController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("统计接口") | |||
| @GetMapping("statistics") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| @SystemControllerLog(description = "-统计") | |||
| public ResultData statistics(@ModelAttribute WxBusinessCircleOrder circleOrder) { | |||
| logger.debug("[" + getIpAddr() + "] AliBusinessCircleOrderController::statistics"); | |||
| if (null == circleOrder) { | |||
| circleOrder = new WxBusinessCircleOrder(); | |||
| } | |||
| circleOrder.updateTenantInfo(getTenantInfo()); | |||
| Integer sumPayAmount = wxBusinessCircleOrderService.sumCirclePayment(circleOrder); | |||
| Integer sumRefundAmount = wxBusinessCircleOrderService.sumCircleRefundAmount(circleOrder); | |||
| Map resultMap = new HashMap(); | |||
| resultMap.put("sumPayAmount",sumPayAmount); | |||
| resultMap.put("sumRefundAmount",sumRefundAmount); | |||
| return new ResultData(resultMap); | |||
| } | |||
| @ApiOperation("详情接口") | |||
| @GetMapping("detail") | |||
| @ApiImplicitParams({ | |||
| @@ -5,7 +5,6 @@ import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.AliBusinessCircleOrder; | |||
| import com.iformall.domain.po.WxThirdPartyOrders; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.enums.EnumThirdOrderType; | |||
| @@ -26,6 +25,8 @@ import org.springframework.web.bind.annotation.RestController; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("thirdCircle") | |||
| @@ -54,6 +55,27 @@ public class WxThirdPartyOrdersController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("统计接口") | |||
| @GetMapping("statistics") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| @SystemControllerLog(description = "-统计") | |||
| public ResultData statistics(@ModelAttribute WxThirdPartyOrders circleOrder) { | |||
| logger.debug("[" + getIpAddr() + "] AliBusinessCircleOrderController::statistics"); | |||
| if (null == circleOrder) { | |||
| circleOrder = new WxThirdPartyOrders(); | |||
| } | |||
| circleOrder.updateTenantInfo(getTenantInfo()); | |||
| Integer sumPayAmount = wxThirdPartyOrdersOrderService.sumCirclePayment(circleOrder); | |||
| Integer sumRefundAmount = wxThirdPartyOrdersOrderService.sumCircleRefundAmount(circleOrder); | |||
| Map resultMap = new HashMap(); | |||
| resultMap.put("sumPayAmount",sumPayAmount); | |||
| resultMap.put("sumRefundAmount",sumRefundAmount); | |||
| return new ResultData(resultMap); | |||
| } | |||
| @ApiOperation("详情接口") | |||
| @GetMapping("detail") | |||
| @ApiImplicitParams({ | |||
| @@ -13,6 +13,8 @@ import com.iformall.domain.vo.WxCouponOrderCVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.DateUtils; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| @@ -153,9 +155,26 @@ public class WxCouponOrderController extends BaseController { | |||
| @ApiImplicitParam(name = "couponOrderId", value = "券ID", dataType = "string", paramType = "query", required = true) | |||
| }) | |||
| public ResultData detail(String couponOrderId) { | |||
| if (couponOrderId == null) { | |||
| logger.info("couponOrderController.detail:" + couponOrderId); | |||
| if (StringUtils.isBlank(couponOrderId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| String _decodeCouponOrderId = WxCouponOrderCVo.getDecodeExpiredCouponOrderId(couponOrderId); | |||
| if (_decodeCouponOrderId.contains(WxCouponOrderCVo.arg)) { | |||
| String[] decodeids = _decodeCouponOrderId.split(WxCouponOrderCVo.arg); | |||
| couponOrderId = decodeids[0]; | |||
| String expiredtimeStr = decodeids[1]; | |||
| logger.info("couponOrderController.detail。decode:[coid]" + couponOrderId+",[time]"+expiredtimeStr); | |||
| Date expiredtime = DateUtils.string2Date(expiredtimeStr).getTime(); | |||
| if (expiredtime.before(new Date())) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"码已失效,请更新二维码后重试"); | |||
| } | |||
| } | |||
| Long bUserId = getLoginBUser().getId(); | |||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserService.getById(getLoginBUser().getId()); | |||
| if (wxMerchantBUser == null) { | |||
| @@ -270,6 +289,18 @@ public class WxCouponOrderController extends BaseController { | |||
| logger.error("couponOrderId不能为空: " + paramMap.toString()); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| String _decodeCouponOrderId = WxCouponOrderCVo.getDecodeExpiredCouponOrderId(couponOrderIdStr); | |||
| if (_decodeCouponOrderId.contains(WxCouponOrderCVo.arg)) { | |||
| String[] decodeids = _decodeCouponOrderId.split(WxCouponOrderCVo.arg); | |||
| couponOrderIdStr = decodeids[0]; | |||
| String expiredtimeStr = decodeids[1]; | |||
| Date expiredtime = DateUtils.string2Date(expiredtimeStr).getTime(); | |||
| if (expiredtime.before(new Date())) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"码已失效,请更新二维码后重试"); | |||
| } | |||
| } | |||
| Long couponOrderId = 0L; | |||
| try { | |||
| couponOrderId = Long.valueOf(couponOrderIdStr); | |||
| @@ -196,6 +196,22 @@ public class WxCouponOrderController extends BaseController { | |||
| return new ResultData(wxCouponOrderCVo); | |||
| } | |||
| @ApiOperation(value = "获取动态id") | |||
| @GetMapping("dynamicId") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "couponOrderId", value = "券ID", dataType = "string", paramType = "query", required = true) | |||
| }) | |||
| public ResultData dynamicId(String couponOrderId) { | |||
| if (StringUtils.isBlank(couponOrderId) || couponOrderId.equalsIgnoreCase(Constant.UNDEFINED)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| Map retmap = new HashMap(); | |||
| retmap.put("dynamicId", WxCouponOrderCVo.calcuteExpiredCouponOrderId(couponOrderId)); | |||
| retmap.put("expiredSeconds", WxCouponOrderCVo.expiredSeconds); | |||
| return new ResultData(retmap); | |||
| } | |||
| @ApiOperation(value = "卡券富文本接口") | |||
| @GetMapping("html") | |||
| @@ -107,7 +107,7 @@ public class AppTest { | |||
| /** | |||
| * 创建交易信息 接口 | |||
| */ | |||
| String s = HttpUtil.doPost("https://openapi.malls.iformall.com/api/thirdCircle/order", headMap, JSON.toJSONString(paramMap)); | |||
| // String s = HttpUtil.doPost("https://openapi.malls.iformall.com/api/thirdCircle/order", headMap, JSON.toJSONString(paramMap)); | |||
| // String s = HttpUtil.doPost("http://localhost:7070/public/api/thirdCircle/order", headMap, JSON.toJSONString(paramMap)); | |||
| @@ -122,7 +122,7 @@ public class AppTest { | |||
| // String s = HttpUtil.doPost("https://openapitest.malls.iformall.com/api/thirdCircle/pointDeduction", headMap, JSON.toJSONString(paramMap)); | |||
| System.out.println(s); | |||
| // System.out.println(s); | |||
| } | |||
| @@ -32,55 +32,53 @@ public class SysMonitorSchedule { | |||
| @Autowired | |||
| private SysMonitorMapper sysMonitorMapper; | |||
| @Async | |||
| @Scheduled(cron = "0 */5 * * * *?") // 每隔5分钟检查一下各个网址 | |||
| public void checkUrls() { | |||
| if(isFmMonitor) { | |||
| SysMonitor q = new SysMonitor(); | |||
| q.setEnable(EnumSysMonitorStatus.ENABLE.getCode()); | |||
| List<SysMonitor> sysMonitors = sysMonitorMapper.findList(q); | |||
| for (SysMonitor sysMonitor : sysMonitors) { | |||
| checkSysMonitor(sysMonitor); | |||
| } | |||
| } | |||
| } | |||
| private void checkSysMonitor(SysMonitor sysMonitor) { | |||
| boolean isNormal = true; | |||
| for(int i=0;i<3;i++) { | |||
| try { | |||
| String result = HttpUtil.doGet(sysMonitor.getUrl()); | |||
| if (StringUtils.isBlank(result)) { | |||
| isNormal = false; | |||
| } else { | |||
| if (result.length() < 60) { | |||
| logger.info(result); | |||
| } else { | |||
| logger.info(result.substring(0, 50)); | |||
| } | |||
| } | |||
| } catch (RuntimeException e) { | |||
| logger.error(e.getMessage()); | |||
| isNormal = false; | |||
| } | |||
| if(isNormal) { | |||
| break; | |||
| } | |||
| } | |||
| if(!isNormal) { | |||
| String[] receivers = fmMonitorEmails.split(","); | |||
| String content = sysMonitor.getErrMsg(); | |||
| content = content.replace("{name}", sysMonitor.getName()); | |||
| content = content.replace("{url}", sysMonitor.getUrl()); | |||
| //发送邮件 | |||
| logger.error(sysMonitor.getName() + "访问异常"); | |||
| mailService.sendSimpleMail(receivers, sysMonitor.getName() + "访问异常", content); | |||
| } | |||
| } | |||
| // @Scheduled(cron = "0 */5 * * * *?") // 每隔5分钟检查一下各个网址 | |||
| // public void checkUrls() { | |||
| // if(isFmMonitor) { | |||
| // SysMonitor q = new SysMonitor(); | |||
| // q.setEnable(EnumSysMonitorStatus.ENABLE.getCode()); | |||
| // List<SysMonitor> sysMonitors = sysMonitorMapper.findList(q); | |||
| // | |||
| // for (SysMonitor sysMonitor : sysMonitors) { | |||
| // checkSysMonitor(sysMonitor); | |||
| // } | |||
| // } | |||
| // } | |||
| // | |||
| // private void checkSysMonitor(SysMonitor sysMonitor) { | |||
| // boolean isNormal = true; | |||
| // for(int i=0;i<3;i++) { | |||
| // try { | |||
| // String result = HttpUtil.doGet(sysMonitor.getUrl()); | |||
| // if (StringUtils.isBlank(result)) { | |||
| // isNormal = false; | |||
| // } else { | |||
| // if (result.length() < 60) { | |||
| // logger.info(result); | |||
| // } else { | |||
| // logger.info(result.substring(0, 50)); | |||
| // } | |||
| // } | |||
| // } catch (RuntimeException e) { | |||
| // logger.error(e.getMessage()); | |||
| // isNormal = false; | |||
| // } | |||
| // if(isNormal) { | |||
| // break; | |||
| // } | |||
| // } | |||
| // | |||
| // if(!isNormal) { | |||
| // String[] receivers = fmMonitorEmails.split(","); | |||
| // | |||
| // String content = sysMonitor.getErrMsg(); | |||
| // content = content.replace("{name}", sysMonitor.getName()); | |||
| // content = content.replace("{url}", sysMonitor.getUrl()); | |||
| // | |||
| // //发送邮件 | |||
| // logger.error(sysMonitor.getName() + "访问异常"); | |||
| // mailService.sendSimpleMail(receivers, sysMonitor.getName() + "访问异常", content); | |||
| // } | |||
| // } | |||
| } | |||
| @@ -2,8 +2,13 @@ package com.iformall.domain.vo; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.common.SortColumn; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import com.iformall.utils.Base64Util; | |||
| import com.iformall.utils.DateUtils; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| @@ -12,6 +17,8 @@ import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @JsonIgnoreProperties(value = {"handler"}) | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @@ -154,4 +161,22 @@ public class WxCouponOrderCVo extends WxCouponOrder { | |||
| } | |||
| return priceStr; | |||
| } | |||
| public static final int expiredSeconds = 60; | |||
| public static final String arg = "&"; | |||
| public static String calcuteExpiredCouponOrderId(String couponOrderId) { | |||
| if (StringUtils.isBlank(couponOrderId)) { | |||
| return null; | |||
| } | |||
| StringBuffer sb = new StringBuffer().append(couponOrderId).append(arg).append(DateUtils.date2String(DateUtils.getSecondsTimeAfter(expiredSeconds, new Date()))); | |||
| return Base64Util.encode(sb.toString().getBytes()); | |||
| } | |||
| public static String getDecodeExpiredCouponOrderId(String couponOrderId) { | |||
| if (StringUtils.isBlank(couponOrderId)) { | |||
| return null; | |||
| } | |||
| return new String(Base64Util.decode(couponOrderId)); | |||
| } | |||
| } | |||
| @@ -45,4 +45,6 @@ public interface AliBusinessCircleOrderMapper extends CommonMapper<AliBusinessCi | |||
| void updateOrderStatus(AliBusinessCircleOrder record); | |||
| Integer sumCirclePayment(BusinessCircleBase record); | |||
| Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); | |||
| } | |||
| @@ -48,4 +48,6 @@ public interface WxBusinessCircleOrderMapper extends CommonMapper<WxBusinessCirc | |||
| void updateOrderStatus(WxBusinessCircleOrder record); | |||
| Integer sumCirclePayment(BusinessCircleBase record); | |||
| Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.BusinessCircleBase; | |||
| import com.iformall.domain.po.WxThirdPartyOrders; | |||
| import com.iformall.domain.vo.WxThirdPartyOrdersVo; | |||
| @@ -43,4 +44,8 @@ public interface WxThirdPartyOrdersMapper extends CommonMapper<WxThirdPartyOrder | |||
| */ | |||
| void updateOrderStatus(WxThirdPartyOrders record); | |||
| Integer sumCirclePayment(BusinessCircleBase record); | |||
| Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); | |||
| } | |||
| @@ -55,4 +55,6 @@ public interface AliBusinessCircleOrderService { | |||
| void exportData(AliBusinessCircleOrder circleOrder, HttpServletRequest request, HttpServletResponse response); | |||
| Integer sumCirclePayment(BusinessCircleBase circleOrder); | |||
| Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); | |||
| } | |||
| @@ -58,5 +58,7 @@ public interface WxBusinessCircleOrderService { | |||
| void exportData(WxBusinessCircleOrder circleOrder, HttpServletRequest request, HttpServletResponse response); | |||
| Integer sumCirclePayment(BusinessCircleBase circleOrder); | |||
| Integer sumCirclePayment(BusinessCircleBase circleOrder); | |||
| Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.BusinessCircleBase; | |||
| import com.iformall.domain.po.WxThirdPartyOrders; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumThirdOrderType; | |||
| @@ -60,4 +61,8 @@ public interface WxThirdPartyOrdersService { | |||
| void exportData(WxThirdPartyOrders circleOrder, HttpServletRequest request, HttpServletResponse response); | |||
| void exportDataVo(WxThirdPartyOrders circleOrder, HttpServletRequest request, HttpServletResponse response); | |||
| Integer sumCirclePayment(BusinessCircleBase circleOrder); | |||
| Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); | |||
| } | |||
| @@ -76,6 +76,8 @@ public class WxPayOrderServiceHelper { | |||
| return EnumPayStatus.PAY_STATUS_WAIT.getCode(); | |||
| }else if ("PAYERROR".equals(trade_state)) { | |||
| return EnumPayStatus.PAY_STATUS_FAIL.getCode(); | |||
| }else if ("FAIL".equals(trade_state)) { | |||
| return EnumPayStatus.PAY_STATUS_FAIL.getCode(); | |||
| } | |||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), "订单查询微信支付状态非法["+trade_state+"]"+payOrderNo); | |||
| }else { | |||
| @@ -365,4 +365,10 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| return sumCirclePayment==null?0:sumCirclePayment; | |||
| } | |||
| @Override | |||
| public Integer sumCircleRefundAmount(BusinessCircleBase circleOrder) { | |||
| Integer sumCircleRefundAmount = aliBusinessCircleOrderMapper.sumCircleRefundAmount(circleOrder); | |||
| return sumCircleRefundAmount==null?0:sumCircleRefundAmount; | |||
| } | |||
| } | |||
| @@ -378,5 +378,11 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| return sumCirclePayment==null?0:sumCirclePayment; | |||
| } | |||
| @Override | |||
| public Integer sumCircleRefundAmount(BusinessCircleBase circleOrder) { | |||
| Integer sumCircleRefundAmount = wxBusinessCircleOrderMapper.sumCircleRefundAmount(circleOrder); | |||
| return sumCircleRefundAmount==null?0:sumCircleRefundAmount; | |||
| } | |||
| } | |||
| @@ -462,4 +462,16 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| List<WxThirdPartyOrdersVo> list = wxThirdPartyOrdersMapper.findListVo(circleOrder); | |||
| excelService.exportExcel(list, null, "第三方积分抵扣", WxThirdPartyOrdersVo.class, "第三方积分抵扣.xlsx", response, false); | |||
| } | |||
| @Override | |||
| public Integer sumCirclePayment(BusinessCircleBase circleOrder) { | |||
| Integer sumCirclePayment = wxThirdPartyOrdersMapper.sumCirclePayment(circleOrder); | |||
| return sumCirclePayment==null?0:sumCirclePayment; | |||
| } | |||
| @Override | |||
| public Integer sumCircleRefundAmount(BusinessCircleBase circleOrder) { | |||
| Integer sumCircleRefundAmount = wxThirdPartyOrdersMapper.sumCircleRefundAmount(circleOrder); | |||
| return sumCircleRefundAmount==null?0:sumCircleRefundAmount; | |||
| } | |||
| } | |||
| @@ -42,7 +42,8 @@ public class DaHuaUtil { | |||
| params.put("cipher", cipher); | |||
| params.put("timestamp", System.currentTimeMillis()); | |||
| try { | |||
| return HttpUtil.doPost(URL, JSONObject.toJSONString(params)); | |||
| //return HttpUtil.doPost(URL, JSONObject.toJSONString(params)); | |||
| return null; | |||
| } catch (Exception e) { | |||
| return null; | |||
| } | |||
| @@ -382,7 +382,34 @@ public class DateUtils { | |||
| Date date = new Date(myTime * 1000); | |||
| return formatter.format(date); | |||
| } | |||
| /** | |||
| * 获得当前时间前几秒的时间 | |||
| * | |||
| * @param hour | |||
| * 前几小时 | |||
| * @return | |||
| */ | |||
| public static String getSecondsTimeBefore(int seconds, Date myDate) { | |||
| SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| long myTime = (myDate.getTime() / 1000) - seconds; | |||
| Date date = new Date(myTime * 1000); | |||
| return formatter.format(date); | |||
| } | |||
| /** | |||
| * 获得当前时间后几秒的时间 | |||
| * | |||
| * @param hour | |||
| * 后几小时 | |||
| * @return | |||
| */ | |||
| public static Date getSecondsTimeAfter(int seconds, Date myDate) { | |||
| long myTime = (myDate.getTime() / 1000) + seconds; | |||
| Date testDate = new Date(myTime * 1000); | |||
| return testDate; | |||
| } | |||
| /** | |||
| * 获得当前时间后几小时的时间 | |||
| * | |||
| @@ -395,7 +422,7 @@ public class DateUtils { | |||
| Date testDate = new Date(myTime * 1000); | |||
| return testDate; | |||
| } | |||
| /** | |||
| * 获得当前时间后几天的时间 | |||
| * | |||
| @@ -23,6 +23,10 @@ import org.apache.http.util.EntityUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import com.github.binarywang.wxpay.service.WxPayService; | |||
| import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import javax.net.ssl.HttpsURLConnection; | |||
| import javax.net.ssl.KeyManager; | |||
| import javax.net.ssl.KeyManagerFactory; | |||
| @@ -31,9 +35,15 @@ import java.io.*; | |||
| import java.net.URI; | |||
| import java.net.URL; | |||
| import java.nio.charset.Charset; | |||
| import java.security.KeyManagementException; | |||
| import java.security.KeyStore; | |||
| import java.security.KeyStoreException; | |||
| import java.security.NoSuchAlgorithmException; | |||
| import java.security.SecureRandom; | |||
| import java.security.UnrecoverableKeyException; | |||
| import java.security.cert.CertificateException; | |||
| import java.util.*; | |||
| import java.util.concurrent.ConcurrentHashMap; | |||
| /** | |||
| @@ -49,32 +59,32 @@ public class HttpUtil { | |||
| private static final String DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36"; | |||
| /** | |||
| * get请求 | |||
| * @return | |||
| */ | |||
| public static String doGet(String url) { | |||
| try { | |||
| CloseableHttpClient client = HttpClients.createDefault(); | |||
| //发送get请求 | |||
| HttpGet request = new HttpGet(url); | |||
| HttpResponse response = client.execute(request); | |||
| /**请求发送成功,并得到响应**/ | |||
| if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { | |||
| /**读取服务器返回过来的json字符串数据**/ | |||
| String strResult = EntityUtils.toString(response.getEntity()); | |||
| return strResult; | |||
| } | |||
| } | |||
| catch (IOException e) { | |||
| logger.error(e.getMessage()); | |||
| throw new RuntimeException(e); | |||
| } | |||
| return null; | |||
| } | |||
| // /** | |||
| // * get请求 | |||
| // * @return | |||
| // */ | |||
| // public static String doGet(String url) { | |||
| // try { | |||
| // CloseableHttpClient client = HttpClients.createDefault(); | |||
| // //发送get请求 | |||
| // HttpGet request = new HttpGet(url); | |||
| // HttpResponse response = client.execute(request); | |||
| // | |||
| // /**请求发送成功,并得到响应**/ | |||
| // if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { | |||
| // /**读取服务器返回过来的json字符串数据**/ | |||
| // String strResult = EntityUtils.toString(response.getEntity()); | |||
| // | |||
| // return strResult; | |||
| // } | |||
| // } | |||
| // catch (IOException e) { | |||
| // logger.error(e.getMessage()); | |||
| // throw new RuntimeException(e); | |||
| // } | |||
| // | |||
| // return null; | |||
| // } | |||
| /** | |||
| * get请求 | |||
| @@ -166,71 +176,71 @@ public class HttpUtil { | |||
| return null; | |||
| } | |||
| /** | |||
| * post请求(用于key-value格式的参数) | |||
| * @param url | |||
| * @param params | |||
| * @return | |||
| */ | |||
| public static String doPost(String url,Map<String,String> headMap, Map params){ | |||
| // 定义HttpClient | |||
| CloseableHttpClient client = HttpClients.createDefault(); | |||
| BufferedReader in = null; | |||
| try { | |||
| // 实例化HTTP方法 | |||
| HttpPost request = new HttpPost(); | |||
| request.setURI(new URI(url)); | |||
| if(headMap != null){ | |||
| Set<String> set = headMap.keySet(); | |||
| for(String key: set){ | |||
| request.addHeader(key,headMap.get(key)); | |||
| } | |||
| } | |||
| //设置参数 | |||
| List<NameValuePair> nvps = new ArrayList<NameValuePair>(); | |||
| for (Iterator iter = params.keySet().iterator(); iter.hasNext();) { | |||
| String name = (String) iter.next(); | |||
| String value = String.valueOf(params.get(name)); | |||
| nvps.add(new BasicNameValuePair(name, value)); | |||
| //System.out.println(name +"-"+value); | |||
| } | |||
| request.setEntity(new UrlEncodedFormEntity(nvps,HTTP.UTF_8)); | |||
| HttpResponse response = client.execute(request); | |||
| int code = response.getStatusLine().getStatusCode(); | |||
| if(code == 200){ //请求成功 | |||
| in = new BufferedReader(new InputStreamReader(response.getEntity() | |||
| .getContent(),"utf-8")); | |||
| StringBuilder sb = new StringBuilder(""); | |||
| String line = ""; | |||
| String NL = System.getProperty("line.separator"); | |||
| while ((line = in.readLine()) != null) { | |||
| sb.append(line + NL); | |||
| } | |||
| in.close(); | |||
| client.close(); | |||
| return sb.toString(); | |||
| } | |||
| else{ // | |||
| logger.info("状态码:" + code); | |||
| client.close(); | |||
| } | |||
| } | |||
| catch(Exception e){ | |||
| logger.error(e.getMessage()); | |||
| return null; | |||
| } | |||
| return null; | |||
| } | |||
| // /** | |||
| // * post请求(用于key-value格式的参数) | |||
| // * @param url | |||
| // * @param params | |||
| // * @return | |||
| // */ | |||
| // public static String doPost(String url,Map<String,String> headMap, Map params){ | |||
| // | |||
| // // 定义HttpClient | |||
| // CloseableHttpClient client = HttpClients.createDefault(); | |||
| // | |||
| // BufferedReader in = null; | |||
| // try { | |||
| // | |||
| // // 实例化HTTP方法 | |||
| // HttpPost request = new HttpPost(); | |||
| // request.setURI(new URI(url)); | |||
| // if(headMap != null){ | |||
| // Set<String> set = headMap.keySet(); | |||
| // for(String key: set){ | |||
| // request.addHeader(key,headMap.get(key)); | |||
| // } | |||
| // } | |||
| // | |||
| // //设置参数 | |||
| // List<NameValuePair> nvps = new ArrayList<NameValuePair>(); | |||
| // for (Iterator iter = params.keySet().iterator(); iter.hasNext();) { | |||
| // String name = (String) iter.next(); | |||
| // String value = String.valueOf(params.get(name)); | |||
| // nvps.add(new BasicNameValuePair(name, value)); | |||
| // | |||
| // //System.out.println(name +"-"+value); | |||
| // } | |||
| // request.setEntity(new UrlEncodedFormEntity(nvps,HTTP.UTF_8)); | |||
| // | |||
| // HttpResponse response = client.execute(request); | |||
| // int code = response.getStatusLine().getStatusCode(); | |||
| // if(code == 200){ //请求成功 | |||
| // in = new BufferedReader(new InputStreamReader(response.getEntity() | |||
| // .getContent(),"utf-8")); | |||
| // StringBuilder sb = new StringBuilder(""); | |||
| // String line = ""; | |||
| // String NL = System.getProperty("line.separator"); | |||
| // while ((line = in.readLine()) != null) { | |||
| // sb.append(line + NL); | |||
| // } | |||
| // | |||
| // in.close(); | |||
| // | |||
| // client.close(); | |||
| // | |||
| // return sb.toString(); | |||
| // } | |||
| // else{ // | |||
| // logger.info("状态码:" + code); | |||
| // client.close(); | |||
| // } | |||
| // } | |||
| // catch(Exception e){ | |||
| // logger.error(e.getMessage()); | |||
| // return null; | |||
| // } | |||
| // | |||
| // return null; | |||
| // } | |||
| /** | |||
| * post请求(用于key-value格式的参数,wiwide) | |||
| @@ -366,111 +376,111 @@ public class HttpUtil { | |||
| return null; | |||
| } | |||
| /** | |||
| * post请求(用于请求json格式的参数) | |||
| * @param url | |||
| * @param params | |||
| * @return | |||
| */ | |||
| public static String doPost(String url, String params) throws Exception { | |||
| CloseableHttpClient httpclient = HttpClients.createDefault(); | |||
| HttpPost httpPost = new HttpPost(url);// 创建httpPost | |||
| httpPost.setHeader("Accept", "application/json"); | |||
| httpPost.setHeader("Content-Type", "application/json"); | |||
| String charSet = "UTF-8"; | |||
| StringEntity entity = new StringEntity(params, charSet); | |||
| httpPost.setEntity(entity); | |||
| CloseableHttpResponse response = null; | |||
| try { | |||
| response = httpclient.execute(httpPost); | |||
| StatusLine status = response.getStatusLine(); | |||
| int state = status.getStatusCode(); | |||
| if (state == HttpStatus.SC_OK) { | |||
| HttpEntity responseEntity = response.getEntity(); | |||
| String jsonString = EntityUtils.toString(responseEntity); | |||
| return jsonString; | |||
| } | |||
| else{ | |||
| logger.info("请求返回:"+state+"("+url+")"); | |||
| } | |||
| } | |||
| finally { | |||
| if (response != null) { | |||
| try { | |||
| response.close(); | |||
| } catch (IOException e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| try { | |||
| httpclient.close(); | |||
| } catch (IOException e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| /** | |||
| * post请求(用于请求json格式的参数) | |||
| * @param url | |||
| * @param params | |||
| * @return | |||
| */ | |||
| public static String doPost(String url, Map<String,String> headMap, String params){ | |||
| CloseableHttpClient httpclient = HttpClients.createDefault(); | |||
| HttpPost httpPost = new HttpPost(url);// 创建httpPost | |||
| httpPost.setHeader("Accept", "application/json"); | |||
| httpPost.setHeader("Content-Type", "application/json"); | |||
| if(headMap != null){ | |||
| Set<String> set = headMap.keySet(); | |||
| for(String key: set){ | |||
| httpPost.addHeader(key,headMap.get(key)); | |||
| } | |||
| } | |||
| String charSet = "UTF-8"; | |||
| StringEntity entity = new StringEntity(params, charSet); | |||
| httpPost.setEntity(entity); | |||
| CloseableHttpResponse response = null; | |||
| try { | |||
| response = httpclient.execute(httpPost); | |||
| StatusLine status = response.getStatusLine(); | |||
| int state = status.getStatusCode(); | |||
| if (state == HttpStatus.SC_OK) { | |||
| HttpEntity responseEntity = response.getEntity(); | |||
| String jsonString = EntityUtils.toString(responseEntity); | |||
| return jsonString; | |||
| } | |||
| else{ | |||
| logger.info("请求返回:"+state+"("+url+")"); | |||
| } | |||
| } | |||
| catch(Exception e){ | |||
| logger.error(e.getMessage()); | |||
| return null; | |||
| } | |||
| finally { | |||
| if (response != null) { | |||
| try { | |||
| response.close(); | |||
| } catch (IOException e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| try { | |||
| httpclient.close(); | |||
| } catch (IOException e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| // /** | |||
| // * post请求(用于请求json格式的参数) | |||
| // * @param url | |||
| // * @param params | |||
| // * @return | |||
| // */ | |||
| // public static String doPost(String url, String params) throws Exception { | |||
| // | |||
| // CloseableHttpClient httpclient = HttpClients.createDefault(); | |||
| // HttpPost httpPost = new HttpPost(url);// 创建httpPost | |||
| // httpPost.setHeader("Accept", "application/json"); | |||
| // httpPost.setHeader("Content-Type", "application/json"); | |||
| // String charSet = "UTF-8"; | |||
| // StringEntity entity = new StringEntity(params, charSet); | |||
| // httpPost.setEntity(entity); | |||
| // CloseableHttpResponse response = null; | |||
| // | |||
| // try { | |||
| // response = httpclient.execute(httpPost); | |||
| // StatusLine status = response.getStatusLine(); | |||
| // int state = status.getStatusCode(); | |||
| // if (state == HttpStatus.SC_OK) { | |||
| // HttpEntity responseEntity = response.getEntity(); | |||
| // String jsonString = EntityUtils.toString(responseEntity); | |||
| // return jsonString; | |||
| // } | |||
| // else{ | |||
| // logger.info("请求返回:"+state+"("+url+")"); | |||
| // } | |||
| // } | |||
| // finally { | |||
| // if (response != null) { | |||
| // try { | |||
| // response.close(); | |||
| // } catch (IOException e) { | |||
| // logger.error(e.getMessage()); | |||
| // } | |||
| // } | |||
| // try { | |||
| // httpclient.close(); | |||
| // } catch (IOException e) { | |||
| // logger.error(e.getMessage()); | |||
| // } | |||
| // } | |||
| // return null; | |||
| // } | |||
| // /** | |||
| // * post请求(用于请求json格式的参数) | |||
| // * @param url | |||
| // * @param params | |||
| // * @return | |||
| // */ | |||
| // public static String doPost(String url, Map<String,String> headMap, String params){ | |||
| // | |||
| // CloseableHttpClient httpclient = HttpClients.createDefault(); | |||
| // HttpPost httpPost = new HttpPost(url);// 创建httpPost | |||
| // httpPost.setHeader("Accept", "application/json"); | |||
| // httpPost.setHeader("Content-Type", "application/json"); | |||
| // | |||
| // if(headMap != null){ | |||
| // Set<String> set = headMap.keySet(); | |||
| // for(String key: set){ | |||
| // httpPost.addHeader(key,headMap.get(key)); | |||
| // } | |||
| // } | |||
| // | |||
| // String charSet = "UTF-8"; | |||
| // StringEntity entity = new StringEntity(params, charSet); | |||
| // httpPost.setEntity(entity); | |||
| // CloseableHttpResponse response = null; | |||
| // | |||
| // try { | |||
| // response = httpclient.execute(httpPost); | |||
| // StatusLine status = response.getStatusLine(); | |||
| // int state = status.getStatusCode(); | |||
| // if (state == HttpStatus.SC_OK) { | |||
| // HttpEntity responseEntity = response.getEntity(); | |||
| // String jsonString = EntityUtils.toString(responseEntity); | |||
| // return jsonString; | |||
| // } | |||
| // else{ | |||
| // logger.info("请求返回:"+state+"("+url+")"); | |||
| // } | |||
| // } | |||
| // catch(Exception e){ | |||
| // logger.error(e.getMessage()); | |||
| // return null; | |||
| // } | |||
| // finally { | |||
| // if (response != null) { | |||
| // try { | |||
| // response.close(); | |||
| // } catch (IOException e) { | |||
| // logger.error(e.getMessage()); | |||
| // } | |||
| // } | |||
| // try { | |||
| // httpclient.close(); | |||
| // } catch (IOException e) { | |||
| // logger.error(e.getMessage()); | |||
| // } | |||
| // } | |||
| // return null; | |||
| // } | |||
| public static String payPost(String url, String params) { | |||
| @@ -489,9 +499,11 @@ public class HttpUtil { | |||
| } | |||
| } | |||
| private static OkHttpClient OkHttpClient = new OkHttpClient(); | |||
| private static String exec(okhttp3.Request request) { | |||
| try { | |||
| okhttp3.Response response = new OkHttpClient().newCall(request).execute(); | |||
| okhttp3.Response response = OkHttpClient.newCall(request).execute(); | |||
| if (!response.isSuccessful()) | |||
| throw new RuntimeException("Unexpected code " + response); | |||
| return response.body().string(); | |||
| @@ -501,20 +513,36 @@ public class HttpUtil { | |||
| } | |||
| } | |||
| private static Map<String,SSLContext> sslContextMap = new ConcurrentHashMap<String,SSLContext>(); | |||
| private static SSLContext getSSLContext(String certPath, String certPass) throws KeyStoreException, NoSuchAlgorithmException, | |||
| CertificateException, FileNotFoundException, IOException, UnrecoverableKeyException, KeyManagementException { | |||
| String key = certPath+certPass; | |||
| SSLContext sslContext = sslContextMap.get(key); | |||
| if ( null == sslContext ) { | |||
| synchronized("sslContextLock"+key) { | |||
| sslContext = sslContextMap.get(key); | |||
| if (null == sslContext) { | |||
| KeyStore clientStore = KeyStore.getInstance("PKCS12"); | |||
| clientStore.load(new FileInputStream(certPath), certPass.toCharArray()); | |||
| KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); | |||
| kmf.init(clientStore, certPass.toCharArray()); | |||
| KeyManager[] kms = kmf.getKeyManagers(); | |||
| sslContext = SSLContext.getInstance("TLS"); | |||
| sslContext.init(kms, null, new SecureRandom()); | |||
| sslContextMap.put(key, sslContext); | |||
| } | |||
| } | |||
| } | |||
| return sslContext; | |||
| } | |||
| public static String payPostSSL(String url, String data, String certPath, String certPass) { | |||
| HttpsURLConnection conn = null; | |||
| OutputStream out = null; | |||
| InputStream inputStream = null; | |||
| BufferedReader reader = null; | |||
| try { | |||
| KeyStore clientStore = KeyStore.getInstance("PKCS12"); | |||
| clientStore.load(new FileInputStream(certPath), certPass.toCharArray()); | |||
| KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); | |||
| kmf.init(clientStore, certPass.toCharArray()); | |||
| KeyManager[] kms = kmf.getKeyManagers(); | |||
| SSLContext sslContext = SSLContext.getInstance("TLS"); | |||
| sslContext.init(kms, null, new SecureRandom()); | |||
| SSLContext sslContext = getSSLContext(certPath, certPass); | |||
| HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); | |||
| URL _url = new URL(url); | |||
| conn = (HttpsURLConnection) _url.openConnection(); | |||
| @@ -554,61 +582,61 @@ public class HttpUtil { | |||
| } | |||
| } | |||
| private static String ClientCustomSSL(String url, String p12file, String mch_id, String xmlStr) throws Exception{ | |||
| KeyStore keyStore = KeyStore.getInstance("PKCS12"); | |||
| FileInputStream instream = new FileInputStream(new File(p12file)); | |||
| try { | |||
| keyStore.load(instream, mch_id.toCharArray()); | |||
| } finally { | |||
| instream.close(); | |||
| } | |||
| // Trust own CA and all self-signed certs | |||
| SSLContext sslcontext = SSLContexts.custom() | |||
| .loadKeyMaterial(keyStore, mch_id.toCharArray()) | |||
| .build(); | |||
| // Allow TLSv1 protocol only | |||
| SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory( | |||
| sslcontext, | |||
| new String[] { "TLSv1" }, | |||
| null, | |||
| SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); | |||
| CloseableHttpClient httpclient = HttpClients.custom() | |||
| .setSSLSocketFactory(sslsf) | |||
| .build(); | |||
| try { | |||
| HttpPost httpPost = new HttpPost(url); | |||
| StringEntity entityStr = new StringEntity(xmlStr); | |||
| entityStr.setContentType("text/xml"); | |||
| //logger.info("entityStr--------------"+entityStr); | |||
| httpPost.setEntity(entityStr); | |||
| CloseableHttpResponse response = httpclient.execute(httpPost); | |||
| try { | |||
| HttpEntity entity = response.getEntity(); | |||
| //System.out.println("----------------------------------------"); | |||
| //System.out.println(response.getStatusLine()); | |||
| if (entity != null) { | |||
| //System.out.println("Response content length: " + entity.getContentLength()); | |||
| BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(entity.getContent())); | |||
| StringBuilder sb = new StringBuilder(); | |||
| String line = null; | |||
| while ((line = bufferedReader.readLine()) != null) { | |||
| sb.append(line).append("\n"); | |||
| } | |||
| return sb.toString(); | |||
| } | |||
| EntityUtils.consume(entity); | |||
| } finally { | |||
| response.close(); | |||
| } | |||
| } finally { | |||
| httpclient.close(); | |||
| return null; | |||
| } | |||
| } | |||
| // private static String ClientCustomSSL(String url, String p12file, String mch_id, String xmlStr) throws Exception{ | |||
| // KeyStore keyStore = KeyStore.getInstance("PKCS12"); | |||
| // FileInputStream instream = new FileInputStream(new File(p12file)); | |||
| // try { | |||
| // keyStore.load(instream, mch_id.toCharArray()); | |||
| // } finally { | |||
| // instream.close(); | |||
| // } | |||
| // | |||
| // // Trust own CA and all self-signed certs | |||
| // SSLContext sslcontext = SSLContexts.custom() | |||
| // .loadKeyMaterial(keyStore, mch_id.toCharArray()) | |||
| // .build(); | |||
| // // Allow TLSv1 protocol only | |||
| // SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory( | |||
| // sslcontext, | |||
| // new String[] { "TLSv1" }, | |||
| // null, | |||
| // SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); | |||
| // CloseableHttpClient httpclient = HttpClients.custom() | |||
| // .setSSLSocketFactory(sslsf) | |||
| // .build(); | |||
| // try { | |||
| // HttpPost httpPost = new HttpPost(url); | |||
| // StringEntity entityStr = new StringEntity(xmlStr); | |||
| // entityStr.setContentType("text/xml"); | |||
| // //logger.info("entityStr--------------"+entityStr); | |||
| // httpPost.setEntity(entityStr); | |||
| // | |||
| // CloseableHttpResponse response = httpclient.execute(httpPost); | |||
| // try { | |||
| // HttpEntity entity = response.getEntity(); | |||
| // | |||
| // //System.out.println("----------------------------------------"); | |||
| // //System.out.println(response.getStatusLine()); | |||
| // if (entity != null) { | |||
| // //System.out.println("Response content length: " + entity.getContentLength()); | |||
| // BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(entity.getContent())); | |||
| // StringBuilder sb = new StringBuilder(); | |||
| // String line = null; | |||
| // while ((line = bufferedReader.readLine()) != null) { | |||
| // sb.append(line).append("\n"); | |||
| // } | |||
| // return sb.toString(); | |||
| // } | |||
| // EntityUtils.consume(entity); | |||
| // } finally { | |||
| // response.close(); | |||
| // } | |||
| // } finally { | |||
| // httpclient.close(); | |||
| // return null; | |||
| // } | |||
| // | |||
| // } | |||
| } | |||
| @@ -127,7 +127,7 @@ | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultMap="BaseResultMap"> | |||
| @@ -135,6 +135,7 @@ | |||
| <include refid="allColumns"/> | |||
| from ali_business_circle_order | |||
| <include refid="dynamicWhereConditions"/> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </select> | |||
| <select id="getById" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultMap="BaseResultMap"> | |||
| @@ -216,22 +217,16 @@ | |||
| select | |||
| IFNULL(SUM(`pay_amount`),0) as sum_pay_amount | |||
| from ali_business_circle_order | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and `time_end` >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and `time_end` < #{endTime} | |||
| </if> | |||
| <include refid="dynamicWhereConditions"/> | |||
| and is_refund = 0 | |||
| </select> | |||
| <select id="sumCircleRefundAmount" parameterType="com.iformall.domain.po.BusinessCircleBase" resultType="Integer"> | |||
| select | |||
| IFNULL(SUM(`refund_amount`),0) as sum_refund_amount | |||
| from ali_business_circle_order | |||
| <include refid="dynamicWhereConditions"/> | |||
| and is_refund = 1 | |||
| </select> | |||
| </mapper> | |||
| @@ -148,7 +148,7 @@ | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxBusinessCircleOrder" resultMap="BaseResultMap"> | |||
| @@ -156,6 +156,7 @@ | |||
| <include refid="allColumns"/> | |||
| from wx_business_circle_order | |||
| <include refid="dynamicWhereConditions"/> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </select> | |||
| <select id="getById" parameterType="com.iformall.domain.po.WxBusinessCircleOrder" resultMap="BaseResultMap"> | |||
| @@ -244,27 +245,20 @@ | |||
| where `id` = #{id} and `tenant_id` = #{tenantId} | |||
| </update> | |||
| <select id="sumCirclePayment" parameterType="com.iformall.domain.po.BusinessCircleBase" resultType="Integer"> | |||
| select | |||
| IFNULL(SUM(`pay_amount`),0) as sum_pay_amount | |||
| from wx_business_circle_order | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and `time_end` >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and `time_end` < #{endTime} | |||
| </if> | |||
| <include refid="dynamicWhereConditions"/> | |||
| and is_refund = 0 | |||
| </select> | |||
| <select id="sumCircleRefundAmount" parameterType="com.iformall.domain.po.BusinessCircleBase" resultType="Integer"> | |||
| select | |||
| IFNULL(SUM(`refund_amount`),0) as sum_refund_amount | |||
| from wx_business_circle_order | |||
| <include refid="dynamicWhereConditions"/> | |||
| and is_refund = 1 | |||
| </select> | |||
| </mapper> | |||
| @@ -147,7 +147,7 @@ | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxThirdPartyOrders" resultMap="BaseResultMap"> | |||
| @@ -155,6 +155,7 @@ | |||
| <include refid="allColumns"/> | |||
| from wx_third_party_orders | |||
| <include refid="dynamicWhereConditions"/> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </select> | |||
| <select id="findListVo" parameterType="com.iformall.domain.po.WxThirdPartyOrders" resultType="com.iformall.domain.vo.WxThirdPartyOrdersVo"> | |||
| @@ -242,4 +243,20 @@ | |||
| where `id` = #{id} and `tenant_id` = #{tenantId} | |||
| </update> | |||
| <select id="sumCirclePayment" parameterType="com.iformall.domain.po.BusinessCircleBase" resultType="Integer"> | |||
| select | |||
| IFNULL(SUM(`pay_amount`),0) as sum_pay_amount | |||
| from wx_third_party_orders | |||
| <include refid="dynamicWhereConditions"/> | |||
| and is_refund = 0 | |||
| </select> | |||
| <select id="sumCircleRefundAmount" parameterType="com.iformall.domain.po.BusinessCircleBase" resultType="Integer"> | |||
| select | |||
| IFNULL(SUM(`refund_amount`),0) as sum_refund_amount | |||
| from wx_third_party_orders | |||
| <include refid="dynamicWhereConditions"/> | |||
| and is_refund = 1 | |||
| </select> | |||
| </mapper> | |||