developrelease_toaliyun_real
| @@ -0,0 +1,26 @@ | |||||
| package com.iformall.config; | |||||
| import org.springframework.context.annotation.Bean; | |||||
| import org.springframework.context.annotation.Configuration; | |||||
| import org.springframework.core.task.AsyncTaskExecutor; | |||||
| import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |||||
| import java.util.concurrent.ThreadPoolExecutor; | |||||
| @Configuration | |||||
| public class MyExecutorConfig { | |||||
| /** | |||||
| * 自定义异步线程池 | |||||
| * | |||||
| * @return | |||||
| */ | |||||
| @Bean | |||||
| public AsyncTaskExecutor taskExecutor() { | |||||
| ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); | |||||
| executor.setThreadNamePrefix("Anno-Executor"); | |||||
| executor.setMaxPoolSize(100); | |||||
| executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); | |||||
| return executor; | |||||
| } | |||||
| } | |||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.controller; | package com.iformall.controller; | ||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| @@ -263,6 +264,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| public ResultData queryTemplateCount() { | public ResultData queryTemplateCount() { | ||||
| String userId = getUser().getId().toString(); | String userId = getUser().getId().toString(); | ||||
| Map entries = stringRedisTemplate.opsForHash().entries(userId); | Map entries = stringRedisTemplate.opsForHash().entries(userId); | ||||
| logger.info(JSONArray.toJSONString(entries) + ">>>>>>>>>>>>>>>>>>>>>1"); | |||||
| if (entries.size() < 4) { | if (entries.size() < 4) { | ||||
| entries.clear(); | entries.clear(); | ||||
| return new ResultData(Result.SUCCESS, "ok", entries); | return new ResultData(Result.SUCCESS, "ok", entries); | ||||
| @@ -273,6 +275,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| String failCount = entries.get("failCount").toString(); | String failCount = entries.get("failCount").toString(); | ||||
| if (allCount.equals(failCount)) {//stringRedisTemplate.expire(userId,1,TimeUnit.SECONDS); | if (allCount.equals(failCount)) {//stringRedisTemplate.expire(userId,1,TimeUnit.SECONDS); | ||||
| logger.info(JSONArray.toJSONString(entries) + ">>>>>>>>>>>>>>>>>>>>>2"); | |||||
| //完全失败 | //完全失败 | ||||
| stringRedisTemplate.opsForHash().delete(userId, "allCount"); | stringRedisTemplate.opsForHash().delete(userId, "allCount"); | ||||
| stringRedisTemplate.opsForHash().delete(userId, "allSuccessCount"); | stringRedisTemplate.opsForHash().delete(userId, "allSuccessCount"); | ||||
| @@ -58,7 +58,7 @@ public class WxCardPayController extends BaseController { | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | ||||
| public ResultData cardOrderList(@ModelAttribute WxCardVo wxCardVo, Integer pageNum, Integer pageSize) { | public ResultData cardOrderList(@ModelAttribute WxCardVo wxCardVo, Integer pageNum, Integer pageSize) { | ||||
| String ipStr = getIpAddr(); | String ipStr = getIpAddr(); | ||||
| logger.info("cardOrderList: " + ipStr); | |||||
| logger.info("cardPay/cardOrderList: " + ipStr); | |||||
| if (wxCardVo == null) wxCardVo = new WxCardVo(); | if (wxCardVo == null) wxCardVo = new WxCardVo(); | ||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxCardVo.setTenantId(user.getTenantId()); | wxCardVo.setTenantId(user.getTenantId()); | ||||
| @@ -83,7 +83,7 @@ public class WxCardPayController extends BaseController { | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | ||||
| public ResultData cardSpendlist(@ModelAttribute WxCardSpendVo wxCardSpendVo, Integer pageNum, Integer pageSize) { | public ResultData cardSpendlist(@ModelAttribute WxCardSpendVo wxCardSpendVo, Integer pageNum, Integer pageSize) { | ||||
| String ipStr = getIpAddr(); | String ipStr = getIpAddr(); | ||||
| logger.info("cardSpendlist: " + ipStr); | |||||
| logger.info("cardPay/cardSpendlist: " + ipStr); | |||||
| if (wxCardSpendVo == null) { | if (wxCardSpendVo == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空"); | ||||
| } | } | ||||
| @@ -107,7 +107,7 @@ public class WxCardPayController extends BaseController { | |||||
| @GetMapping("sum") | @GetMapping("sum") | ||||
| public ResultData sumCardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend) { | public ResultData sumCardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend) { | ||||
| String ipStr = getIpAddr(); | String ipStr = getIpAddr(); | ||||
| logger.info("sumCardSpendList: " + ipStr + " :" + wxCardSpend.toString()); | |||||
| logger.info("cardPay/sumCardSpendList: " + ipStr + " :" + wxCardSpend.toString()); | |||||
| if (wxCardSpend == null) { | if (wxCardSpend == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空"); | ||||
| } | } | ||||
| @@ -120,7 +120,7 @@ public class WxCardPayController extends BaseController { | |||||
| @ApiOperation("交易流水导出") | @ApiOperation("交易流水导出") | ||||
| @GetMapping("/exportData") | @GetMapping("/exportData") | ||||
| public void exportData(@ModelAttribute WxCardSpendVo wxCardSpendVo, HttpServletRequest request, HttpServletResponse response) { | public void exportData(@ModelAttribute WxCardSpendVo wxCardSpendVo, HttpServletRequest request, HttpServletResponse response) { | ||||
| logger.info("[" + getIpAddr() + "] WxCardPayController::exportData"); | |||||
| logger.info("[" + getIpAddr() + "] cardPay/exportData"); | |||||
| if (wxCardSpendVo == null) { | if (wxCardSpendVo == null) { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空"); | ||||
| } | } | ||||
| @@ -138,19 +138,31 @@ public class WxCardPayController extends BaseController { | |||||
| wxCardSpendService.exportData(wxCardSpendVo, request, response); | wxCardSpendService.exportData(wxCardSpendVo, request, response); | ||||
| } | } | ||||
| @ApiOperation("更新补贴记录") | |||||
| @PostMapping("update") | |||||
| public ResultData update(@RequestBody WxCardSpendVo wxCardSpendVo) { | |||||
| @ApiOperation("更新卡消费支付状态") | |||||
| @PostMapping("/updatePayStatus") | |||||
| public ResultData update(@RequestBody WxCardSpend wxCardSpend) { | |||||
| String ipStr = getIpAddr(); | String ipStr = getIpAddr(); | ||||
| logger.info("subsidy/update: " + ipStr + " :" + wxCardSpendVo.toString()); | |||||
| if (wxCardSpendVo == null) { | |||||
| logger.info("cardPay/updatePayStatus: " + ipStr + " :" + wxCardSpend.toString()); | |||||
| if (wxCardSpend == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空"); | ||||
| } | } | ||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxCardSpendVo.setTenantId(user.getTenantId()); | |||||
| wxCardSpendVo.setStatus(EnumCardSpendStatus.MANUAL_PAY.getCode()); | |||||
| wxCardSpendVo.setUpdateDate(new Date()); | |||||
| int num = wxCardSpendService.update(wxCardSpendVo); | |||||
| return new ResultData(num); | |||||
| wxCardSpend.setTenantId(user.getTenantId()); | |||||
| wxCardSpendService.update(wxCardSpend); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("卡完结") | |||||
| @PostMapping("/finishCard") | |||||
| public ResultData finishCard(@RequestBody WxCardInfo wxCardInfo) { | |||||
| String ipStr = getIpAddr(); | |||||
| logger.info("cardPay/finishCard: " + ipStr + " :" + wxCardInfo.toString()); | |||||
| if (wxCardInfo == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空"); | |||||
| } | |||||
| MallUserInfo user = getUser(); | |||||
| wxCardInfo.setTenantId(user.getTenantId()); | |||||
| int remainShareAmount = wxCardSpendService.finishCard(user.getTenantId(), wxCardInfo.getId()); | |||||
| return new ResultData(remainShareAmount); | |||||
| } | } | ||||
| } | } | ||||
| @@ -4,22 +4,15 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.dto.WxOrderReportDto; | import com.iformall.domain.dto.WxOrderReportDto; | ||||
| import com.iformall.domain.vo.WxMerchantMicroPayVo; | import com.iformall.domain.vo.WxMerchantMicroPayVo; | ||||
| import com.iformall.domain.vo.WxMerchantTradeDailyVo; | |||||
| import com.iformall.enums.EnumOrderStatus; | |||||
| import com.iformall.enums.EnumOrderType; | import com.iformall.enums.EnumOrderType; | ||||
| import com.iformall.service.MarkingDataReportService; | import com.iformall.service.MarkingDataReportService; | ||||
| import com.iformall.service.WxMerchantTradeDailyService; | |||||
| import com.iformall.service.WxOrderService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| 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.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.Calendar; | |||||
| import java.util.Date; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxMerchantMicroPay") | @RequestMapping("wxMerchantMicroPay") | ||||
| @@ -36,6 +29,7 @@ public class WxMerchantMicroPayController extends BaseController { | |||||
| WxOrderReportDto wxOrderReportDto = new WxOrderReportDto(); | WxOrderReportDto wxOrderReportDto = new WxOrderReportDto(); | ||||
| wxOrderReportDto.setTenantId(getTenantId()); | wxOrderReportDto.setTenantId(getTenantId()); | ||||
| wxOrderReportDto.setType(EnumOrderType.MICROPAY.getCode()); | wxOrderReportDto.setType(EnumOrderType.MICROPAY.getCode()); | ||||
| wxOrderReportDto.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); | |||||
| return new ResultData(markingDataReportService.listOrderReportByDate(wxOrderReportDto)); | return new ResultData(markingDataReportService.listOrderReportByDate(wxOrderReportDto)); | ||||
| } | } | ||||
| @@ -590,6 +590,7 @@ public class WxUserStructureController extends BaseController { | |||||
| logger.error(ErrorCode.USER_IS_EMPTY.getMessage()); | logger.error(ErrorCode.USER_IS_EMPTY.getMessage()); | ||||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | return new ResultData(ErrorCode.USER_IS_EMPTY); | ||||
| } | } | ||||
| info.setPoins(info.getPoins() == null ? 0 : info.getPoins()); | |||||
| if(info.getPoins() < score) { | if(info.getPoins() < score) { | ||||
| logger.error(ErrorCode.MEM_SCORE_NOT_ENOUGH.getMessage()); | logger.error(ErrorCode.MEM_SCORE_NOT_ENOUGH.getMessage()); | ||||
| return new ResultData(ErrorCode.MEM_SCORE_NOT_ENOUGH); | return new ResultData(ErrorCode.MEM_SCORE_NOT_ENOUGH); | ||||
| @@ -150,6 +150,12 @@ public enum ErrorCode{ | |||||
| */ | */ | ||||
| CARD_IS_NOT_FOUND(9001, "优惠卡不存在"), | CARD_IS_NOT_FOUND(9001, "优惠卡不存在"), | ||||
| CARD_REMAIN_AMOUNT_IS_NOT_ENOUGH(9002, "优惠卡余额不足"), | CARD_REMAIN_AMOUNT_IS_NOT_ENOUGH(9002, "优惠卡余额不足"), | ||||
| CARD_IS_NOT_COST(9003, "优惠卡未消费,退款请用卡券退款,钱直接退回购买人手里"), | |||||
| /** | |||||
| * 卡消费 | |||||
| */ | |||||
| CARD_SPEND_IS_PAID(9050, "卡消费已支付"), | |||||
| @@ -1,10 +1,13 @@ | |||||
| package com.iformall.domain.dto; | package com.iformall.domain.dto; | ||||
| import lombok.Data; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| /** | /** | ||||
| * Created by syf on 2018/8/30. | * Created by syf on 2018/8/30. | ||||
| */ | */ | ||||
| @Data | |||||
| public class WxOrderReportDto { | public class WxOrderReportDto { | ||||
| private String tenantId; | private String tenantId; | ||||
| private Long merchantId; | private Long merchantId; | ||||
| @@ -12,52 +15,5 @@ public class WxOrderReportDto { | |||||
| private Date startTime; | private Date startTime; | ||||
| private Date endTime; | private Date endTime; | ||||
| private Integer type; | private Integer type; | ||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String tenantId) { | |||||
| this.tenantId = tenantId; | |||||
| } | |||||
| public Long getMerchantId() { | |||||
| return merchantId; | |||||
| } | |||||
| public void setMerchantId(Long merchantId) { | |||||
| this.merchantId = merchantId; | |||||
| } | |||||
| public String getMerchantName() { | |||||
| return merchantName; | |||||
| } | |||||
| public void setMerchantName(String merchantName) { | |||||
| this.merchantName = merchantName; | |||||
| } | |||||
| public Integer getType() { | |||||
| return type; | |||||
| } | |||||
| public void setType(Integer type) { | |||||
| this.type = type; | |||||
| } | |||||
| public Date getStartTime() { | |||||
| return startTime; | |||||
| } | |||||
| public void setStartTime(Date startTime) { | |||||
| this.startTime = startTime; | |||||
| } | |||||
| public Date getEndTime() { | |||||
| return endTime; | |||||
| } | |||||
| public void setEndTime(Date endTime) { | |||||
| this.endTime = endTime; | |||||
| } | |||||
| private Integer orderStatus; | |||||
| } | } | ||||
| @@ -77,6 +77,14 @@ public class WxCardSpend implements Serializable { | |||||
| @Transient | @Transient | ||||
| protected String payStatusStr; | protected String payStatusStr; | ||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value="开始时间",name="startdate") | |||||
| private Date startdate; | |||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value="结束时间",name="enddate") | |||||
| private Date enddate; | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| @@ -40,11 +40,4 @@ public class WxCardSpendVo extends WxCardSpend { | |||||
| @io.swagger.annotations.ApiModelProperty(value="持有人绑定的手机号",name="ouPhone") | @io.swagger.annotations.ApiModelProperty(value="持有人绑定的手机号",name="ouPhone") | ||||
| private String ouPhone; | private String ouPhone; | ||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value="开始时间",name="startdate") | |||||
| private Date startdate; | |||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value="结束时间",name="enddate") | |||||
| private Date enddate; | |||||
| } | } | ||||
| @@ -9,7 +9,7 @@ public interface WxCardSpendMapper extends CommonMapper<WxCardSpend, Long> { | |||||
| List<WxCardSpend> findList(WxCardSpend wxCardSpend); | List<WxCardSpend> findList(WxCardSpend wxCardSpend); | ||||
| int updateByCond(WxCardSpend wxCardSpend); | |||||
| void updateByCond(WxCardSpend wxCardSpend); | |||||
| List<WxCardSpendVo> findCardSpendVoList(WxCardSpend wxCardSpend); | List<WxCardSpendVo> findCardSpendVoList(WxCardSpend wxCardSpend); | ||||
| @@ -73,7 +73,15 @@ public interface WxCardSpendService { | |||||
| * | * | ||||
| * @param record | * @param record | ||||
| */ | */ | ||||
| int update(WxCardSpendVo record); | |||||
| void update(WxCardSpend record); | |||||
| /** | |||||
| * 卡完结 | |||||
| * | |||||
| * @param tenantId | |||||
| * @param cardId | |||||
| */ | |||||
| int finishCard(String tenantId, Long cardId); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -84,7 +92,7 @@ public interface WxCardSpendService { | |||||
| /** | /** | ||||
| * cardPay分账 | * cardPay分账 | ||||
| * | |||||
| * @param tenantId | |||||
| * @param orderId | * @param orderId | ||||
| * @param cardSpendId | * @param cardSpendId | ||||
| */ | */ | ||||
| @@ -494,7 +494,7 @@ public class DataTowerServiceImpl implements DataTowerService { | |||||
| return m.get("carcount"); | return m.get("carcount"); | ||||
| })); | })); | ||||
| TreeMap<Object, Object> historymap = new TreeMap<>(); | |||||
| Map<Object, Object> historymap = new LinkedHashMap<>(); | |||||
| for (String date : tjTimeList) { | for (String date : tjTimeList) { | ||||
| Object o = collect.get(date); | Object o = collect.get(date); | ||||
| if (o == null) { | if (o == null) { | ||||
| @@ -6,10 +6,7 @@ import com.iformall.domain.dto.MarkingCouponDataReportDto; | |||||
| import com.iformall.domain.dto.WxOrderReportDto; | import com.iformall.domain.dto.WxOrderReportDto; | ||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.vo.*; | import com.iformall.domain.vo.*; | ||||
| import com.iformall.enums.EnumCarCmd; | |||||
| import com.iformall.enums.EnumCouponSendSendType; | |||||
| import com.iformall.enums.EnumCouponType; | |||||
| import com.iformall.enums.EnumOrderType; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.MarkingDataReportService; | import com.iformall.service.MarkingDataReportService; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| @@ -430,6 +427,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| params.put("endTime", addDay(1)); | params.put("endTime", addDay(1)); | ||||
| } | } | ||||
| params.put("type", wxOrderReportDto.getType()); | params.put("type", wxOrderReportDto.getType()); | ||||
| params.put("orderStatus", wxOrderReportDto.getOrderStatus()); | |||||
| List<WxOrderReportVo> list = wxOrderMapper.listOrderReportByDate(params); | List<WxOrderReportVo> list = wxOrderMapper.listOrderReportByDate(params); | ||||
| String startdate = DateUtils.getTimeBefore(30, new Date()); | String startdate = DateUtils.getTimeBefore(30, new Date()); | ||||
| @@ -74,7 +74,7 @@ public class WxBrandServiceImpl implements WxBrandService { | |||||
| } | } | ||||
| try { | try { | ||||
| wxBrand.setUpdatetime(new Date()); | wxBrand.setUpdatetime(new Date()); | ||||
| wxBrandMapper.updateByPrimaryKeySelective(wxBrand); | |||||
| wxBrandMapper.updateByPrimaryKey(wxBrand); | |||||
| return new ResultData(Result.SUCCESS, "操作成功"); | return new ResultData(Result.SUCCESS, "操作成功"); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("更新租赁合同信息失败,e:" + e.getMessage()); | logger.error("更新租赁合同信息失败,e:" + e.getMessage()); | ||||
| @@ -275,8 +275,62 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public int update(WxCardSpendVo record) { | |||||
| return wxCardSpendMapper.updateByCond(record); | |||||
| public void update(WxCardSpend record) { | |||||
| // 1. 检查符合条件的卡消费记录是否已支付 | |||||
| List<WxCardSpend> cardSpends = wxCardSpendMapper.findList(record); | |||||
| if (cardSpends.stream().anyMatch((cs->(!cs.getPayStatus().equals(EnumCardSpendStatus.NOT_PAY.getCode()))))){ | |||||
| throw new MallinkException(ErrorCode.CARD_SPEND_IS_PAID); | |||||
| } | |||||
| // 2. 更新支付状态 | |||||
| record.setPayStatus(EnumCardSpendStatus.MANUAL_PAY.getCode()); | |||||
| record.setUpdateDate(new Date()); | |||||
| wxCardSpendMapper.updateByCond(record); | |||||
| } | |||||
| @Override | |||||
| public int finishCard(String tenantId, Long cardId) { | |||||
| // admin用户手动帮已用卡消费用户退卡, 此卡需要分账完结, 买卡的钱进商场账户 | |||||
| WxCardInfo cardInfo = null; | |||||
| try { | |||||
| cardInfo = wxCardInfoMapper.selectByPrimaryKey(cardId); | |||||
| } catch (Exception e) { | |||||
| logger.error("微信分账: " + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), e.getMessage()); | |||||
| } | |||||
| if(cardInfo != null) { | |||||
| if (cardInfo.getRemainingAmount().equals(cardInfo.getAmount())){ | |||||
| logger.error("请用订单退款接口: "); | |||||
| throw new MallinkException(ErrorCode.CARD_IS_NOT_COST); | |||||
| } else if(cardInfo.getRemainingAmount() > 0){ | |||||
| // 卡已消费, 余额不为0 | |||||
| int remainShareFeeAmount = cardInfo.getRemainingShareFeeAmount(); | |||||
| try { | |||||
| WxCouponOrder couponOrder = wxCouponOrderMapper.selectByPrimaryKey(cardInfo.getId()); | |||||
| // 更新 coupon order状态 | |||||
| couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.CARD_RETURNED.getCode()); | |||||
| couponOrder.setUpdateDate(new Date()); | |||||
| wxCouponOrderMapper.updateByPrimaryKeySelective(couponOrder); | |||||
| // 卡余额 | |||||
| WxCardInfo cardInfo1 = new WxCardInfo(); | |||||
| cardInfo1.setId(cardInfo.getId()); | |||||
| cardInfo1.setRemainingAmount(0); | |||||
| cardInfo1.setUpdateDate(new Date()); | |||||
| wxCardInfoMapper.updateByPrimaryKeySelective(cardInfo1); | |||||
| // 分账完结 | |||||
| WxSharingOrderDto shareOrder = new WxSharingOrderDto(); | |||||
| shareOrder.setcUserId(couponOrder.getOwnerId()); | |||||
| shareOrder.setTenantId(tenantId); | |||||
| shareOrder.setTransactionId(cardInfo.getTransactionId()); | |||||
| cardShareFinished(cardInfo, shareOrder); | |||||
| } catch (MallinkException e) { | |||||
| logger.error("微信分账: " + e.getMessage()); | |||||
| throw new MallinkException(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| return remainShareFeeAmount; | |||||
| } | |||||
| } | |||||
| return 0; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -364,6 +418,8 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * 卡分账完结 | * 卡分账完结 | ||||
| * @param cardInfo | * @param cardInfo | ||||
| @@ -393,7 +449,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| logger.error("card spend insert error"); | logger.error("card spend insert error"); | ||||
| return; | return; | ||||
| } | } | ||||
| // card info 更新 余额 | |||||
| // card info 更新 分账 余额 | |||||
| WxCardInfo cardInfo1 = new WxCardInfo(); | WxCardInfo cardInfo1 = new WxCardInfo(); | ||||
| cardInfo1.setId(cardInfo.getId()); | cardInfo1.setId(cardInfo.getId()); | ||||
| cardInfo1.setRemainingShareFeeAmount(0); | cardInfo1.setRemainingShareFeeAmount(0); | ||||
| @@ -341,7 +341,11 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| } | } | ||||
| // 更改 couponOrder 状态 | // 更改 couponOrder 状态 | ||||
| wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_INVALID.getCode()); //3退款,券作废 | |||||
| if(wxCouponOrder.getCouponType().equals(EnumCouponType.CARD_MULTIMCH.getCode())) { | |||||
| wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.CARD_RETURNED.getCode()); // 卡线下退款 | |||||
| } else { | |||||
| wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_INVALID.getCode()); //3退款,券作废 | |||||
| } | |||||
| if (payType == EnumPayType.PAY_B_REFUND) { | if (payType == EnumPayType.PAY_B_REFUND) { | ||||
| wxCouponOrder.setBUserId(bUserId); | wxCouponOrder.setBUserId(bUserId); | ||||
| } else{ | } else{ | ||||
| @@ -9,7 +9,7 @@ | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | ||||
| <result column="logo" jdbcType="VARCHAR" property="logo"/> | <result column="logo" jdbcType="VARCHAR" property="logo"/> | ||||
| <result column="summary" jdbcType="VARCHAR" property="summary"/> | <result column="summary" jdbcType="VARCHAR" property="summary"/> | ||||
| <result column="createdate" jdbcType="TIMESTAMP" property="createtime"/> | |||||
| <result column="createdate" jdbcType="TIMESTAMP" property="createdate"/> | |||||
| </resultMap> | </resultMap> | ||||
| @@ -1,136 +1,151 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="com.iformall.mapper.WxCardSpendMapper"> | <mapper namespace="com.iformall.mapper.WxCardSpendMapper"> | ||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCardSpend"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="card_id" jdbcType="BIGINT" property="cardId" /> | |||||
| <result column="owner_id" jdbcType="BIGINT" property="ownerId" /> | |||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||||
| <result column="order_id" jdbcType="BIGINT" property="orderId" /> | |||||
| <result column="deduction_amount" jdbcType="INTEGER" property="deductionAmount" /> | |||||
| <result column="payment" jdbcType="INTEGER" property="payment" /> | |||||
| <result column="real_payment" jdbcType="INTEGER" property="realPayment" /> | |||||
| <result column="card_remain_amount" jdbcType="INTEGER" property="cardRemainAmount" /> | |||||
| <result column="card_before_amount" jdbcType="INTEGER" property="cardBeforeAmount" /> | |||||
| <result column="card_remain_real_amount" jdbcType="INTEGER" property="cardRemainRealAmount" /> | |||||
| <result column="card_before_real_amount" jdbcType="INTEGER" property="cardBeforeRealAmount" /> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||||
| <result column="pay_status" jdbcType="INTEGER" property="payStatus" /> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCardSpend"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="card_id" jdbcType="BIGINT" property="cardId"/> | |||||
| <result column="owner_id" jdbcType="BIGINT" property="ownerId"/> | |||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||||
| <result column="order_id" jdbcType="BIGINT" property="orderId"/> | |||||
| <result column="deduction_amount" jdbcType="INTEGER" property="deductionAmount"/> | |||||
| <result column="payment" jdbcType="INTEGER" property="payment"/> | |||||
| <result column="real_payment" jdbcType="INTEGER" property="realPayment"/> | |||||
| <result column="card_remain_amount" jdbcType="INTEGER" property="cardRemainAmount"/> | |||||
| <result column="card_before_amount" jdbcType="INTEGER" property="cardBeforeAmount"/> | |||||
| <result column="card_remain_real_amount" jdbcType="INTEGER" property="cardRemainRealAmount"/> | |||||
| <result column="card_before_real_amount" jdbcType="INTEGER" property="cardBeforeRealAmount"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="pay_status" jdbcType="INTEGER" property="payStatus"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`card_id`,`owner_id`,`merchant_id`,`order_id`,`deduction_amount`,`payment`,`real_payment`, | `id`,`tenant_id`,`card_id`,`owner_id`,`merchant_id`,`order_id`,`deduction_amount`,`payment`,`real_payment`, | ||||
| `card_remain_amount`,`card_before_amount`,`card_remain_real_amount`,`card_before_real_amount`, | `card_remain_amount`,`card_before_amount`,`card_remain_real_amount`,`card_before_real_amount`, | ||||
| `create_date`,`update_date`, `pay_status` | `create_date`,`update_date`, `pay_status` | ||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != cardId "> | |||||
| and `card_id` = #{cardId} | |||||
| </if> | |||||
| <if test=" null != ownerId "> | |||||
| and `owner_id` = #{ownerId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != orderId "> | |||||
| and `order_id` = #{orderId} | |||||
| </if> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != cardId "> | |||||
| and `card_id` = #{cardId} | |||||
| </if> | |||||
| <if test=" null != ownerId "> | |||||
| and `owner_id` = #{ownerId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != orderId "> | |||||
| and `order_id` = #{orderId} | |||||
| </if> | |||||
| <if test=" null != deductionAmount "> | <if test=" null != deductionAmount "> | ||||
| and `deduction_amount` = #{deductionAmount} | and `deduction_amount` = #{deductionAmount} | ||||
| </if> | </if> | ||||
| <if test=" null != payment "> | <if test=" null != payment "> | ||||
| and `payment` = #{payment} | and `payment` = #{payment} | ||||
| </if> | </if> | ||||
| <if test=" null != realPayment "> | |||||
| and `real_payment` = #{realPayment} | |||||
| </if> | |||||
| <if test=" null != cardRemainAmount "> | |||||
| and `card_remain_amount` = #{cardRemainAmount} | |||||
| </if> | |||||
| <if test=" null != cardBeforeAmount "> | |||||
| and `card_before_amount` = #{cardBeforeAmount} | |||||
| </if> | |||||
| <if test=" null != realPayment "> | |||||
| and `real_payment` = #{realPayment} | |||||
| </if> | |||||
| <if test=" null != cardRemainAmount "> | |||||
| and `card_remain_amount` = #{cardRemainAmount} | |||||
| </if> | |||||
| <if test=" null != cardBeforeAmount "> | |||||
| and `card_before_amount` = #{cardBeforeAmount} | |||||
| </if> | |||||
| <if test=" null != cardRemainRealAmount "> | <if test=" null != cardRemainRealAmount "> | ||||
| and `card_remain_real_amount` = #{cardRemainRealAmount} | and `card_remain_real_amount` = #{cardRemainRealAmount} | ||||
| </if> | </if> | ||||
| <if test=" null != cardBeforeRealAmount "> | <if test=" null != cardBeforeRealAmount "> | ||||
| and `card_before_real_amount` = #{cardBeforeRealAmount} | and `card_before_real_amount` = #{cardBeforeRealAmount} | ||||
| </if> | </if> | ||||
| <if test=" null != createDate "> | |||||
| and `create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and `update_date` = #{updateDate} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `pay_status` = #{payStatus} | |||||
| </if> | |||||
| <if test=" null != startdate and null!=enddate"> | |||||
| and `create_date` between #{startdate} and #{enddate} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxCardSpend" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_card_spend | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <if test=" null != createDate "> | |||||
| and `create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and `update_date` = #{updateDate} | |||||
| </if> | |||||
| <if test=" null != payStatus "> | |||||
| and `pay_status` = #{payStatus} | |||||
| </if> | |||||
| <if test=" null != startdate and null!=enddate"> | |||||
| and `create_date` between #{startdate} and #{enddate} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxCardSpend" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_card_spend | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <select id="updateByCond" parameterType="com.iformall.domain.po.WxCardSpend" resultMap="BaseResultMap"> | |||||
| update wx_card_spend | |||||
| set `pay_status` = #{payStatus} | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <select id="updateByCond" parameterType="com.iformall.domain.po.WxCardSpend"> | |||||
| update wx_card_spend | |||||
| set `pay_status` = #{payStatus}, `update_date` = #{updateDate} | |||||
| <where> | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != startdate and null!=enddate"> | |||||
| and `create_date` between #{startdate} and #{enddate} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| </where> | |||||
| </select> | |||||
| <resultMap id="VoResultMap" type="com.iformall.domain.vo.WxCardSpendVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="card_id" jdbcType="BIGINT" property="cardId" /> | |||||
| <result column="owner_id" jdbcType="BIGINT" property="ownerId" /> | |||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||||
| <result column="order_id" jdbcType="BIGINT" property="orderId" /> | |||||
| <result column="deduction_amount" jdbcType="INTEGER" property="deductionAmount" /> | |||||
| <result column="payment" jdbcType="INTEGER" property="payment" /> | |||||
| <result column="real_payment" jdbcType="INTEGER" property="realPayment" /> | |||||
| <result column="card_remain_amount" jdbcType="INTEGER" property="cardRemainAmount" /> | |||||
| <result column="card_before_amount" jdbcType="INTEGER" property="cardBeforeAmount" /> | |||||
| <result column="card_remain_real_amount" jdbcType="INTEGER" property="cardRemainRealAmount" /> | |||||
| <result column="card_before_real_amount" jdbcType="INTEGER" property="cardBeforeRealAmount" /> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||||
| <result column="pay_status" jdbcType="INTEGER" property="payStatus" /> | |||||
| <resultMap id="VoResultMap" type="com.iformall.domain.vo.WxCardSpendVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="card_id" jdbcType="BIGINT" property="cardId"/> | |||||
| <result column="owner_id" jdbcType="BIGINT" property="ownerId"/> | |||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||||
| <result column="order_id" jdbcType="BIGINT" property="orderId"/> | |||||
| <result column="deduction_amount" jdbcType="INTEGER" property="deductionAmount"/> | |||||
| <result column="payment" jdbcType="INTEGER" property="payment"/> | |||||
| <result column="real_payment" jdbcType="INTEGER" property="realPayment"/> | |||||
| <result column="card_remain_amount" jdbcType="INTEGER" property="cardRemainAmount"/> | |||||
| <result column="card_before_amount" jdbcType="INTEGER" property="cardBeforeAmount"/> | |||||
| <result column="card_remain_real_amount" jdbcType="INTEGER" property="cardRemainRealAmount"/> | |||||
| <result column="card_before_real_amount" jdbcType="INTEGER" property="cardBeforeRealAmount"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="pay_status" jdbcType="INTEGER" property="payStatus"/> | |||||
| <result column="title" jdbcType="VARCHAR" property="title"/> | <result column="title" jdbcType="VARCHAR" property="title"/> | ||||
| <result column="name" jdbcType="VARCHAR" property="merchantName"/> | |||||
| <result column="name" jdbcType="VARCHAR" property="merchantName"/> | |||||
| <result column="subsidy" jdbcType="INTEGER" property="subsidy" /> | |||||
| <result column="real_subsidy" jdbcType="INTEGER" property="realSubsidy" /> | |||||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||||
| <result column="subsidy" jdbcType="INTEGER" property="subsidy"/> | |||||
| <result column="real_subsidy" jdbcType="INTEGER" property="realSubsidy"/> | |||||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||||
| <result column="onick_name" jdbcType="VARCHAR" property="onickName"/> | |||||
| <result column="ou_phone" jdbcType="VARCHAR" property="ouPhone"/> | |||||
| </resultMap> | |||||
| <result column="onick_name" jdbcType="VARCHAR" property="onickName"/> | |||||
| <result column="ou_phone" jdbcType="VARCHAR" property="ouPhone"/> | |||||
| </resultMap> | |||||
| <sql id="allVoColumns"> | |||||
| <sql id="allVoColumns"> | |||||
| cs.`id`,cs.`tenant_id`,cs.`card_id`,cs.`owner_id`,cs.`merchant_id`,cs.`order_id`,cs.`deduction_amount`,cs.`payment`,cs.`real_payment`, | cs.`id`,cs.`tenant_id`,cs.`card_id`,cs.`owner_id`,cs.`merchant_id`,cs.`order_id`,cs.`deduction_amount`,cs.`payment`,cs.`real_payment`, | ||||
| cs.`card_remain_amount`,cs.`card_before_amount`,cs.`card_remain_real_amount`,cs.`card_before_real_amount`, | cs.`card_remain_amount`,cs.`card_before_amount`,cs.`card_remain_real_amount`,cs.`card_before_real_amount`, | ||||
| cs.`create_date`,cs.`update_date`, cs.`pay_status`, | cs.`create_date`,cs.`update_date`, cs.`pay_status`, | ||||
| @@ -139,125 +154,125 @@ | |||||
| ou.`nick_name` as onick_name, ou.`phone` as ou_phone | ou.`nick_name` as onick_name, ou.`phone` as ou_phone | ||||
| </sql> | </sql> | ||||
| <sql id="dynamicVoWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and cs.`id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and cs.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != cardId "> | |||||
| and cs.`card_id` = #{cardId} | |||||
| </if> | |||||
| <if test=" null != ownerId "> | |||||
| and cs.`owner_id` = #{ownerId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and cs.`merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != orderId "> | |||||
| and cs.`order_id` = #{orderId} | |||||
| </if> | |||||
| <if test=" null != deductionAmount "> | |||||
| and cs.`deduction_amount` = #{deductionAmount} | |||||
| </if> | |||||
| <if test=" null != payment "> | |||||
| and cs.`payment` = #{payment} | |||||
| </if> | |||||
| <if test=" null != realPayment "> | |||||
| and cs.`real_payment` = #{realPayment} | |||||
| </if> | |||||
| <if test=" null != cardRemainAmount "> | |||||
| and cs.`card_remain_amount` = #{cardRemainAmount} | |||||
| </if> | |||||
| <if test=" null != cardBeforeAmount "> | |||||
| and cs.`card_before_amount` = #{cardBeforeAmount} | |||||
| </if> | |||||
| <if test=" null != cardRemainRealAmount "> | |||||
| and cs.`card_remain_real_amount` = #{cardRemainRealAmount} | |||||
| </if> | |||||
| <if test=" null != cardBeforeRealAmount "> | |||||
| and cs.`card_before_real_amount` = #{cardBeforeRealAmount} | |||||
| </if> | |||||
| <if test=" null != createDate "> | |||||
| and cs.`create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and cs.`update_date` = #{updateDate} | |||||
| </if> | |||||
| <if test=" null != payStatus "> | |||||
| and cs.`pay_status` = #{payStatus} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and ms.`status` = #{status} | |||||
| </if> | |||||
| <if test=" null != ouPhone "> | |||||
| and ou.`phone` = #{ouPhone} | |||||
| </if> | |||||
| <if test=" null != startdate and null!=enddate"> | |||||
| and cs.`create_date` between #{startdate} and #{enddate} | |||||
| </if> | |||||
| <if test=" null != payStatusS "> | |||||
| and cs.`pay_status` in | |||||
| <foreach collection="payStatusS" index="index" item="sItem" open="(" separator="," close=")"> | |||||
| #{sItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and cs.id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| </sql> | |||||
| <sql id="dynamicVoWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and cs.`id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and cs.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != cardId "> | |||||
| and cs.`card_id` = #{cardId} | |||||
| </if> | |||||
| <if test=" null != ownerId "> | |||||
| and cs.`owner_id` = #{ownerId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and cs.`merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != orderId "> | |||||
| and cs.`order_id` = #{orderId} | |||||
| </if> | |||||
| <if test=" null != deductionAmount "> | |||||
| and cs.`deduction_amount` = #{deductionAmount} | |||||
| </if> | |||||
| <if test=" null != payment "> | |||||
| and cs.`payment` = #{payment} | |||||
| </if> | |||||
| <if test=" null != realPayment "> | |||||
| and cs.`real_payment` = #{realPayment} | |||||
| </if> | |||||
| <if test=" null != cardRemainAmount "> | |||||
| and cs.`card_remain_amount` = #{cardRemainAmount} | |||||
| </if> | |||||
| <if test=" null != cardBeforeAmount "> | |||||
| and cs.`card_before_amount` = #{cardBeforeAmount} | |||||
| </if> | |||||
| <if test=" null != cardRemainRealAmount "> | |||||
| and cs.`card_remain_real_amount` = #{cardRemainRealAmount} | |||||
| </if> | |||||
| <if test=" null != cardBeforeRealAmount "> | |||||
| and cs.`card_before_real_amount` = #{cardBeforeRealAmount} | |||||
| </if> | |||||
| <if test=" null != createDate "> | |||||
| and cs.`create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and cs.`update_date` = #{updateDate} | |||||
| </if> | |||||
| <if test=" null != payStatus "> | |||||
| and cs.`pay_status` = #{payStatus} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and ms.`status` = #{status} | |||||
| </if> | |||||
| <if test=" null != ouPhone "> | |||||
| and ou.`phone` = #{ouPhone} | |||||
| </if> | |||||
| <if test=" null != startdate and null!=enddate"> | |||||
| and cs.`create_date` between #{startdate} and #{enddate} | |||||
| </if> | |||||
| <if test=" null != payStatusS "> | |||||
| and cs.`pay_status` in | |||||
| <foreach collection="payStatusS" index="index" item="sItem" open="(" separator="," close=")"> | |||||
| #{sItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and cs.id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| </sql> | |||||
| <select id="findCardSpendVoList" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultMap="VoResultMap"> | |||||
| select | |||||
| <include refid="allVoColumns"/> | |||||
| from wx_card_spend cs | |||||
| <select id="findCardSpendVoList" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultMap="VoResultMap"> | |||||
| select | |||||
| <include refid="allVoColumns"/> | |||||
| from wx_card_spend cs | |||||
| left join wx_coupon_order co on co.id = cs.card_id | left join wx_coupon_order co on co.id = cs.card_id | ||||
| left join wx_coupon c on c.id = co.coupon_id | left join wx_coupon c on c.id = co.coupon_id | ||||
| left join wx_merchant m on m.id = cs.merchant_id | |||||
| left join wx_merchant m on m.id = cs.merchant_id | |||||
| left join wx_merchant_subsidy ms on ms.order_id = cs.order_id | left join wx_merchant_subsidy ms on ms.order_id = cs.order_id | ||||
| left join wx_c_user ou on ou.id = co.owner_id | |||||
| <include refid="dynamicVoWhereConditions" /> | |||||
| left join wx_c_user ou on ou.id = co.owner_id | |||||
| <include refid="dynamicVoWhereConditions"/> | |||||
| order by cs.create_date DESC | order by cs.create_date DESC | ||||
| </select> | |||||
| </select> | |||||
| <select id="sumCardSpendVoForMerchant" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="hashmap"> | |||||
| select cs.merchant_id, m.name as merchantName, | |||||
| IFNULL(SUM(cs.`deduction_amount`),0) as sum_deduction_amount, | |||||
| IFNULL(SUM(cs.`payment`),0) as sum_payment, | |||||
| IFNULL(SUM(cs.`real_payment`),0) as sum_real_payment, | |||||
| IFNULL(SUM(ms.`subsidy`), 0) as sum_subsidy, | |||||
| IFNULL(SUM(ms.`real_subsidy`), 0) as sum_real_subsidy | |||||
| from wx_card_spend cs | |||||
| left join wx_coupon_order co on co.id = cs.card_id | |||||
| left join wx_coupon c on c.id = co.coupon_id | |||||
| left join wx_merchant m on m.id = cs.merchant_id | |||||
| left join wx_merchant_subsidy ms on ms.order_id = cs.order_id | |||||
| left join wx_c_user ou on ou.id = co.owner_id | |||||
| <include refid="dynamicVoWhereConditions"/> | |||||
| group by cs.merchant_id | |||||
| </select> | |||||
| <select id="sumCardSpendVoForOwner" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="hashmap"> | |||||
| select cs.owner_id, | |||||
| IFNULL(SUM(cs.`deduction_amount`),0) as sum_deduction_amount, | |||||
| IFNULL(SUM(cs.`payment`),0) as sum_payment, | |||||
| IFNULL(SUM(cs.`real_payment`),0) as sum_real_payment, | |||||
| IFNULL(SUM(ms.`subsidy`), 0) as sum_subsidy, | |||||
| IFNULL(SUM(ms.`real_subsidy`), 0) as sum_real_subsidy | |||||
| from wx_card_spend cs | |||||
| left join wx_coupon_order co on co.id = cs.card_id | |||||
| left join wx_coupon c on c.id = co.coupon_id | |||||
| left join wx_merchant m on m.id = cs.merchant_id | |||||
| left join wx_merchant_subsidy ms on ms.order_id = cs.order_id | |||||
| left join wx_c_user ou on ou.id = co.owner_id | |||||
| <include refid="dynamicVoWhereConditions"/> | |||||
| group by cs.owner_id | |||||
| </select> | |||||
| <select id="sumCardSpendVoForMerchant" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="hashmap"> | |||||
| select cs.merchant_id, m.name as merchantName, | |||||
| IFNULL(SUM(cs.`deduction_amount`),0) as sum_deduction_amount, | |||||
| IFNULL(SUM(cs.`payment`),0) as sum_payment, | |||||
| IFNULL(SUM(cs.`real_payment`),0) as sum_real_payment, | |||||
| IFNULL(SUM(ms.`subsidy`), 0) as sum_subsidy, | |||||
| IFNULL(SUM(ms.`real_subsidy`), 0) as sum_real_subsidy | |||||
| from wx_card_spend cs | |||||
| left join wx_coupon_order co on co.id = cs.card_id | |||||
| left join wx_coupon c on c.id = co.coupon_id | |||||
| left join wx_merchant m on m.id = cs.merchant_id | |||||
| left join wx_merchant_subsidy ms on ms.order_id = cs.order_id | |||||
| left join wx_c_user ou on ou.id = co.owner_id | |||||
| <include refid="dynamicVoWhereConditions" /> | |||||
| group by cs.merchant_id | |||||
| </select> | |||||
| <select id="sumCardSpendVoForOwner" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="hashmap"> | |||||
| select cs.owner_id, | |||||
| IFNULL(SUM(cs.`deduction_amount`),0) as sum_deduction_amount, | |||||
| IFNULL(SUM(cs.`payment`),0) as sum_payment, | |||||
| IFNULL(SUM(cs.`real_payment`),0) as sum_real_payment, | |||||
| IFNULL(SUM(ms.`subsidy`), 0) as sum_subsidy, | |||||
| IFNULL(SUM(ms.`real_subsidy`), 0) as sum_real_subsidy | |||||
| from wx_card_spend cs | |||||
| left join wx_coupon_order co on co.id = cs.card_id | |||||
| left join wx_coupon c on c.id = co.coupon_id | |||||
| left join wx_merchant m on m.id = cs.merchant_id | |||||
| left join wx_merchant_subsidy ms on ms.order_id = cs.order_id | |||||
| left join wx_c_user ou on ou.id = co.owner_id | |||||
| <include refid="dynamicVoWhereConditions" /> | |||||
| group by cs.owner_id | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -323,9 +323,20 @@ | |||||
| </select> | </select> | ||||
| <select id="listOrderReportByDate" resultType="com.iformall.domain.vo.WxOrderReportVo" parameterType="hashmap"> | <select id="listOrderReportByDate" resultType="com.iformall.domain.vo.WxOrderReportVo" parameterType="hashmap"> | ||||
| select DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime, count(o.id) count, IFNULL (SUM(o.payment),0) amount | |||||
| select DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime, | |||||
| count(o.id) count, | |||||
| IFNULL (SUM(o.payment),0) amount | |||||
| from wx_order o | from wx_order o | ||||
| where o.`tenant_id` = #{tenantId} and o.`type` = #{type} | |||||
| where o.`tenant_id` = #{tenantId} | |||||
| <if test=" null != tenantId"> | |||||
| and o.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != type"> | |||||
| and o.`type` = #{type} | |||||
| </if> | |||||
| <if test=" null != orderStatus"> | |||||
| and o.`order_status` = #{orderStatus} | |||||
| </if> | |||||
| <if test=" null != startTime and null != endTime"> | <if test=" null != startTime and null != endTime"> | ||||
| and o.`create_date` BETWEEN #{startTime} and #{endTime} | and o.`create_date` BETWEEN #{startTime} and #{endTime} | ||||
| </if> | </if> | ||||
| @@ -441,7 +452,7 @@ | |||||
| <if test="tenantId!=null"> | <if test="tenantId!=null"> | ||||
| and o.tenant_id =#{tenantId} | and o.tenant_id =#{tenantId} | ||||
| </if> | </if> | ||||
| <if test="merchantName!=null"> | |||||
| <if test="merchantName!=null and merchantName!=''"> | |||||
| and o.`merchant_name` like concat('%',#{merchantName},'%') | and o.`merchant_name` like concat('%',#{merchantName},'%') | ||||
| </if> | </if> | ||||
| <if test="startdate!=null and enddate!=null"> | <if test="startdate!=null and enddate!=null"> | ||||
| @@ -36,7 +36,7 @@ | |||||
| <scope>test</scope> | <scope>test</scope> | ||||
| <groupId>com.alibaba</groupId> | <groupId>com.alibaba</groupId> | ||||
| <artifactId>druid</artifactId> | <artifactId>druid</artifactId> | ||||
| <version>1.1.11</version> | |||||
| <version>1.1.12</version> | |||||
| </dependency> | </dependency> | ||||
| </dependencies> | </dependencies> | ||||
| <build> | <build> | ||||