Просмотр исходного кода

Merge remote-tracking branch 'origin/develop' into develop

release_toaliyun_real
luozukai 7 лет назад
Родитель
Сommit
17ebe204c9
64 измененных файлов: 973 добавлений и 539 удалений
  1. +26
    -0
      mallinkAdmin/src/main/java/com/iformall/config/MyExecutorConfig.java
  2. +2
    -11
      mallinkAdmin/src/main/java/com/iformall/controller/UploadController.java
  3. +15
    -12
      mallinkAdmin/src/main/java/com/iformall/controller/WxCUserBasicInfoController.java
  4. +8
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/WxCarCallBackController.java
  5. +2
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/WxCardPayController.java
  6. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/WxCouponOrderController.java
  7. +2
    -8
      mallinkAdmin/src/main/java/com/iformall/controller/WxMerchantMicroPayController.java
  8. +1
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/WxMerchantSubsidyController.java
  9. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/WxMsgController.java
  10. +3
    -1
      mallinkAdmin/src/main/java/com/iformall/interceptor/HttpServletRequestWrapperFilter.java
  11. +3
    -1
      mallinkAdmin/src/main/java/com/iformall/interceptor/RequestInterceptor.java
  12. +11
    -1
      mallinkBApi/src/main/java/com/iformall/controller/WxMerchantBUserController.java
  13. +14
    -9
      mallinkCApi/src/main/java/com/iformall/controller/WxCardPayController.java
  14. +1
    -1
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java
  15. +2
    -2
      mallinkCApi/src/main/java/com/iformall/controller/WxMallController.java
  16. +44
    -0
      mallinkCApi/src/main/java/com/iformall/controller/WxMerchantController.java
  17. +39
    -12
      mallinkSchedule/src/main/java/com/iformall/schedule/CouponOrderExpiringSchedule.java
  18. +7
    -8
      mallinkSchedule/src/main/java/com/iformall/schedule/OrderExpiringSchedule.java
  19. +1
    -1
      mallinkService/src/main/java/com/iformall/common/ErrorCode.java
  20. +4
    -48
      mallinkService/src/main/java/com/iformall/domain/dto/WxOrderReportDto.java
  21. +8
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCardSpend.java
  22. +32
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java
  23. +7
    -7
      mallinkService/src/main/java/com/iformall/domain/po/WxMerchantBUser.java
  24. +11
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxWiWideInfo.java
  25. +2
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/CUserBaseInfoT.java
  26. +18
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxCUserBasicInfoVo.java
  27. +0
    -7
      mallinkService/src/main/java/com/iformall/domain/vo/WxCardSpendVo.java
  28. +0
    -38
      mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantDiscountVo.java
  29. +2
    -1
      mallinkService/src/main/java/com/iformall/enums/EnumRentContractType.java
  30. +36
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumWiWideInfoStatus.java
  31. +3
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java
  32. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCarCmdLogMapper.java
  33. +1
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxCardSpendMapper.java
  34. +4
    -2
      mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java
  35. +19
    -9
      mallinkService/src/main/java/com/iformall/service/WxCarCmdLogService.java
  36. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxCardSpendService.java
  37. +11
    -2
      mallinkService/src/main/java/com/iformall/service/WxMerchantService.java
  38. +3
    -1
      mallinkService/src/main/java/com/iformall/service/WxOrderService.java
  39. +14
    -1
      mallinkService/src/main/java/com/iformall/service/impl/DataTowerServiceImpl.java
  40. +4
    -6
      mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java
  41. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxBrandServiceImpl.java
  42. +34
    -30
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java
  43. +8
    -5
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java
  44. +7
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCarCmdLogServiceImpl.java
  45. +32
    -12
      mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java
  46. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantBUserServiceImpl.java
  47. +6
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java
  48. +10
    -5
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantSubsidyServiceImpl.java
  49. +8
    -6
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  50. +0
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java
  51. +16
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  52. +23
    -0
      mallinkService/src/main/java/com/iformall/utils/HashUtil.java
  53. +100
    -0
      mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
  54. +5
    -2
      mallinkService/src/main/resources/mapper/WxCarCmdLogMapper.xml
  55. +233
    -218
      mallinkService/src/main/resources/mapper/WxCardSpendMapper.xml
  56. +6
    -6
      mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml
  57. +3
    -3
      mallinkService/src/main/resources/mapper/WxCouponInjectMapper.xml
  58. +29
    -1
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml
  59. +34
    -25
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml
  60. +6
    -6
      mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml
  61. +22
    -1
      mallinkService/src/main/resources/mapper/WxMerchantMapper.xml
  62. +21
    -4
      mallinkService/src/main/resources/mapper/WxOrderMapper.xml
  63. +2
    -2
      mallinkService/src/main/resources/mapper/WxWiwideInfoMapper.xml
  64. +1
    -8
      pom.xml

+ 26
- 0
mallinkAdmin/src/main/java/com/iformall/config/MyExecutorConfig.java Просмотреть файл

@@ -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;
}
}


+ 2
- 11
mallinkAdmin/src/main/java/com/iformall/controller/UploadController.java Просмотреть файл

@@ -209,17 +209,8 @@ public class UploadController extends BaseController {
metadata.setContentType(multiReq.getContentType());
metadata.setContentLength(multiReq.getSize());

FileOutputStream fos = null;
BufferedInputStream fs = null;

String fileName = "";
int dot = multiReq.getOriginalFilename().lastIndexOf('.');
if (dot >= 0) {
fileName = "cimg/" + multiReq.getOriginalFilename().substring(dot, multiReq.getOriginalFilename().length());
} else {
fileName = "cimg/" + UUID.randomUUID().toString();
}

String fileName = multiReq.getOriginalFilename();
fileName = "cimg/" + fileName;
ResultData data = awsUpload(multiReq, metadata, fileName);
return data;
}


+ 15
- 12
mallinkAdmin/src/main/java/com/iformall/controller/WxCUserBasicInfoController.java Просмотреть файл

@@ -1,6 +1,7 @@
package com.iformall.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
@@ -261,8 +262,9 @@ public class WxCUserBasicInfoController extends BaseController {

@GetMapping("/queryTemplateCount")
public ResultData queryTemplateCount() {
String userId = getUser().getId().toString();
Map entries = stringRedisTemplate.opsForHash().entries(userId);
String importKey = "import-" + getUser().getId();
Map entries = stringRedisTemplate.opsForHash().entries(importKey);
logger.info(JSONArray.toJSONString(entries) + ">>>>>>>>>>>>>>>>>>>>>1");
if (entries.size() < 4) {
entries.clear();
return new ResultData(Result.SUCCESS, "ok", entries);
@@ -272,21 +274,22 @@ public class WxCUserBasicInfoController extends BaseController {
String successCount = entries.get("successCount").toString();
String failCount = entries.get("failCount").toString();

if (allCount.equals(failCount)) {//stringRedisTemplate.expire(userId,1,TimeUnit.SECONDS);
if (StringUtils.isNotBlank(failCount) && allCount.equals(failCount)) {//stringRedisTemplate.expire(userId,1,TimeUnit.SECONDS);
logger.info(JSONArray.toJSONString(entries) + ">>>>>>>>>>>>>>>>>>>>>2");
//完全失败
stringRedisTemplate.opsForHash().delete(userId, "allCount");
stringRedisTemplate.opsForHash().delete(userId, "allSuccessCount");
stringRedisTemplate.opsForHash().delete(userId, "successCount");
stringRedisTemplate.opsForHash().delete(userId, "failCount");
stringRedisTemplate.opsForHash().delete(importKey, "allCount");
stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount");
stringRedisTemplate.opsForHash().delete(importKey, "successCount");
stringRedisTemplate.opsForHash().delete(importKey, "failCount");
return new ResultData(ErrorCode.MEM_IMPORT_ERR);
}
//导入完成
if (allSuccessCount.equals(successCount)) {
if (StringUtils.isNotBlank(allSuccessCount) && allSuccessCount.equals(successCount)) {
ResultData ok = new ResultData(Result.SUCCESS, "ok", entries);
stringRedisTemplate.opsForHash().delete(userId, "allCount");
stringRedisTemplate.opsForHash().delete(userId, "allSuccessCount");
stringRedisTemplate.opsForHash().delete(userId, "successCount");
stringRedisTemplate.opsForHash().delete(userId, "failCount");
stringRedisTemplate.opsForHash().delete(importKey, "allCount");
stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount");
stringRedisTemplate.opsForHash().delete(importKey, "successCount");
stringRedisTemplate.opsForHash().delete(importKey, "failCount");
return ok;
}
return new ResultData(Result.SUCCESS, "查询成功", entries);


+ 8
- 1
mallinkAdmin/src/main/java/com/iformall/controller/WxCarCallBackController.java Просмотреть файл

@@ -228,10 +228,17 @@ public class WxCarCallBackController extends BaseController {
logger.info("["+getIpAddr()+"etcpPaidCallback: " + paramMap.toString());
String carNumber = paramMap.get("plateNumber");

// TODO how to get the parkId
// 根据orderId获取入场信息,确定租户ID
String orderId = paramMap.get("orderId");
HashMap<String, String> map = new HashMap<String, String>();
map.put("synId", orderId);
String tenant_id = wxCarCmdLogService.getTenantIdBySynId(map);

Date currentDate = new Date();
WxCarCmdLog wxCarCmdLog = new WxCarCmdLog();
if(StringUtils.isNotBlank(tenant_id)) {
wxCarCmdLog.setTenantId(tenant_id);
}
wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode());
wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PAY_MANUAL.getCode());
wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap));


+ 2
- 2
mallinkAdmin/src/main/java/com/iformall/controller/WxCardPayController.java Просмотреть файл

@@ -148,8 +148,8 @@ public class WxCardPayController extends BaseController {
}
MallUserInfo user = getUser();
wxCardSpend.setTenantId(user.getTenantId());
int num = wxCardSpendService.update(wxCardSpend);
return new ResultData(num);
wxCardSpendService.update(wxCardSpend);
return new ResultData();
}

@ApiOperation("卡完结")


+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/WxCouponOrderController.java Просмотреть файл

@@ -110,7 +110,7 @@ public class WxCouponOrderController extends BaseController {
} catch (Exception e) {
wxCouponOrder.setEndDate(null);
}
wxCouponOrder.setSortColumns(WxCouponOrder.Field.Id_DESC);
wxCouponOrderService.exportData(request, response, wxCouponOrder);

}


+ 2
- 8
mallinkAdmin/src/main/java/com/iformall/controller/WxMerchantMicroPayController.java Просмотреть файл

@@ -4,22 +4,15 @@ import com.github.pagehelper.PageInfo;
import com.iformall.common.ResultData;
import com.iformall.domain.dto.WxOrderReportDto;
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.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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

@RestController
@RequestMapping("wxMerchantMicroPay")
@@ -36,6 +29,7 @@ public class WxMerchantMicroPayController extends BaseController {
WxOrderReportDto wxOrderReportDto = new WxOrderReportDto();
wxOrderReportDto.setTenantId(getTenantId());
wxOrderReportDto.setType(EnumOrderType.MICROPAY.getCode());
wxOrderReportDto.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode());
return new ResultData(markingDataReportService.listOrderReportByDate(wxOrderReportDto));
}



+ 1
- 0
mallinkAdmin/src/main/java/com/iformall/controller/WxMerchantSubsidyController.java Просмотреть файл

@@ -130,6 +130,7 @@ public class WxMerchantSubsidyController extends BaseController {
wxMerchantSubsidy.setStatusS(tmpList);
}
}
wxMerchantSubsidy.setSortColumns(WxMerchantSubsidy.Field.CreateDate_DESC);
wxMerchantSubsidyService.exportData(wxMerchantSubsidy, request, response);
}



+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/WxMsgController.java Просмотреть файл

@@ -107,7 +107,7 @@ public class WxMsgController extends BaseController {
if (phones.equals("")) {//没有手工输入手机号时解析标签,有,继续流转
phones = parselabel(wxMsg.getTenantId(), wxMsg);
if (phones.equals("")) {//解析之后手机号依然不存在时返回
return new ResultData(ErrorCode.MSG_PHONE_NOT_FOUND);
return new ResultData(ErrorCode.MSG_NO_VALID_PHONE);
}
}



+ 3
- 1
mallinkAdmin/src/main/java/com/iformall/interceptor/HttpServletRequestWrapperFilter.java Просмотреть файл

@@ -17,7 +17,9 @@ public class HttpServletRequestWrapperFilter implements Filter {
ServletRequest requestWrapper = null;
if (request instanceof HttpServletRequest) {
String url = ((HttpServletRequest) request).getRequestURI();
if (!url.contains("awsFileUpload") && !url.contains("ueditor/exec")
if (!url.contains("awsFileUpload")
&& !url.contains("cimgUpload")
&& !url.contains("ueditor/exec")
&& !url.contains("/wxCUserBasicInfo/importTemplate")) {
requestWrapper = new BodyReaderHttpServletRequestWrapper((HttpServletRequest) request);
} else {


+ 3
- 1
mallinkAdmin/src/main/java/com/iformall/interceptor/RequestInterceptor.java Просмотреть файл

@@ -45,7 +45,9 @@ public class RequestInterceptor extends HandlerInterceptorAdapter {
String url = request.getRequestURL().toString();
if(url.contains("pvlog")
|| url.contains("awsFileUpload")
|| url.contains("ueditor/exec")) {
|| url.contains("cimgUpload")
|| url.contains("ueditor/exec")
|| url.contains("/wxCUserBasicInfo/importTemplate")) {
// pvlog不检查幂等
// awsFileUpload不检查幂等
// ueditor 不检查幂等


+ 11
- 1
mallinkBApi/src/main/java/com/iformall/controller/WxMerchantBUserController.java Просмотреть файл

@@ -10,6 +10,7 @@ import com.iformall.enums.EnumMerchantBUserStatus;
import com.iformall.enums.EnumMerchantStatus;
import com.iformall.interceptor.AuthorizationInterceptor;
import com.iformall.service.*;
import com.iformall.utils.HashUtil;
import com.iformall.utils.IPUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -81,6 +82,15 @@ public class WxMerchantBUserController extends BaseController {
resultMap.put("service_phone", mall.getServicePhone());
resultMap.put("tenant_id",merchant.getTenantId());
resultMap.put("merchant_id",merchant.getId());
String mid = null;
try {
mid = String.valueOf(merchant.getId());
if(mid != null) {
resultMap.put("merchant_id_scan", HashUtil.EncoderByMd5(mid));
}
}catch (Exception e) {
logger.error(e.getMessage());
}

return new ResultData(resultMap);
}
@@ -235,7 +245,7 @@ public class WxMerchantBUserController extends BaseController {
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID);
}
// check password
if (user1.getbUserPwd().equalsIgnoreCase(password)) {
if (user1.getUserPwd().equalsIgnoreCase(password)) {
user1.createToken(currentDate);
token = user1.getToken();
resultMap.put("token", token);


+ 14
- 9
mallinkCApi/src/main/java/com/iformall/controller/WxCardPayController.java Просмотреть файл

@@ -6,6 +6,7 @@ import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxCardSpendVo;
import com.iformall.enums.EnumMerchantStatus;
import com.iformall.exception.MallinkException;
import com.iformall.service.*;
import io.swagger.annotations.Api;
@@ -44,22 +45,22 @@ public class WxCardPayController extends BaseController {
@Autowired
WxCardSpendService wxCardSpendService;

@ApiOperation(value = "C端扫B端储值卡支付订单", notes = "params:{\"cardId\":\"String\",\"merchantCode\":\"String\",\"totalFee\":\"String(元)\"}")
@ApiOperation(value = "C端扫B端储值卡支付订单", notes = "params:{\"cardId\":\"String\",\"merchantId\":\"String\",\"totalFee\":\"String(元)\"}")
@PostMapping("order_create")
public ResultData saveCardPayOrder(@RequestBody Map<String, String> paramMap, HttpServletRequest request) {
String ipStr = getIpAddr();
logger.info("saveCardPayOrder: " + ipStr + " :" + paramMap.toString());
String cardIdStr = paramMap.get("cardId");
String merchantCode = paramMap.get("merchantCode");
String merchantStr = paramMap.get("merchantId");
String totalFeeStr = paramMap.get("totalFee");

if (StringUtils.isBlank(cardIdStr)) {
logger.error("cardId不能为空");
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardId不能为空");
}
if (StringUtils.isBlank(merchantCode)) {
logger.error("merchantCode不能为空");
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "merchantCode不能为空");
if (StringUtils.isBlank(merchantStr)) {
logger.error("merchantId不能为空");
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "merchantId不能为空");
}
if (StringUtils.isBlank(totalFeeStr)) {
logger.error("totalFee不能为空");
@@ -75,10 +76,10 @@ public class WxCardPayController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardIdStr转换失败");
}
try {
merchantId = Long.valueOf(merchantCode);
merchantId = Long.valueOf(merchantStr);
} catch (Exception e) {
logger.error("merchantCode convert failed:" + merchantCode);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "merchantCode转换失败");
logger.error("merchantCode convert failed:" + merchantStr);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "merchantId转换失败");
}

BigDecimal totalFee = new BigDecimal(totalFeeStr);
@@ -106,10 +107,14 @@ public class WxCardPayController extends BaseController {
WxCUser user = getUser();

WxMerchant merchant = wxMerchantService.getById(merchantId);
if (merchant.getStatus() == EnumMerchantStatus.NOT_VALID.getCode()) {
logger.error("商户已禁用, merchantId: " + merchant.getId());
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID);
}

WxOrder order = null;
try {
order = wxOrderService.saveCardPayOrder(merchant, totalFeeStr, payment);
order = wxOrderService.saveCardPayOrder(merchant, user, totalFeeStr, payment);
} catch (MallinkException e) {
logger.error("saveCardPayOrder 1" + e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage());


+ 1
- 1
mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java Просмотреть файл

@@ -37,7 +37,7 @@ public class WxCouponChannelController extends BaseController {
wxCouponChannel.setTenantId(getTenantId());
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());
wxCouponChannel.setSortColumns(WxCouponChannel.Field.CreateDate_DESC);
wxCouponChannel.setIsCRequest(0);//标记为C端调用
return new ResultData(wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize));
}



+ 2
- 2
mallinkCApi/src/main/java/com/iformall/controller/WxMallController.java Просмотреть файл

@@ -5,7 +5,7 @@ import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxMerchantDiscountVo;
import com.iformall.domain.vo.WxMerchantVo;
import com.iformall.enums.EnumMerchantStatus;
import com.iformall.service.*;
import io.swagger.annotations.Api;
@@ -123,7 +123,7 @@ public class WxMallController extends BaseController {
WxMerchant merchantQ = new WxMerchant();
merchantQ.setTenantId(user.getTenantId());
merchantQ.setStatus(EnumMerchantStatus.VALID.getCode());
List<WxMerchantDiscountVo> list = wxMerchantService.getDisCountList(merchantQ);
List<WxMerchantVo> list = wxMerchantService.getDisCountList(merchantQ);
return new ResultData(Result.SUCCESS, "查询成功", list);
}



+ 44
- 0
mallinkCApi/src/main/java/com/iformall/controller/WxMerchantController.java Просмотреть файл

@@ -0,0 +1,44 @@
package com.iformall.controller;

import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.vo.WxMerchantVo;
import com.iformall.service.WxMerchantService;
import com.iformall.utils.HashUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
* @author Stormeye
*/
@RestController
@RequestMapping("/api/merchant")
public class WxMerchantController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private WxMerchantService wxMerchantService;


@ApiOperation("根据code查询接口")
@GetMapping("/findByCode")
@ApiImplicitParam(name = "merchantCode", value = "merchantCode", dataType = "String", paramType = "query", required = true)
public ResultData findByCode(String merchantCode) {
logger.debug("[" + getIpAddr() + "] WxMerchantController::findByCode");
if(merchantCode == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
HashMap<String, String> params = new HashMap<String, String>();
params.put("tenantId", getTenantId());
params.put("merchantCode", HashUtil.DecodeByMD5(merchantCode));
WxMerchantVo wxMerchant = wxMerchantService.getMerchantInfo(params);
return new ResultData(wxMerchant);
}

}

+ 39
- 12
mallinkSchedule/src/main/java/com/iformall/schedule/CouponOrderExpiringSchedule.java Просмотреть файл

@@ -1,9 +1,14 @@
package com.iformall.schedule;

import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.config.PayProperty;
import com.iformall.domain.po.*;
import com.iformall.enums.EnumAppType;
import com.iformall.enums.EnumCouponOrderStatus;
import com.iformall.enums.EnumCouponType;
import com.iformall.enums.EnumPayType;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.*;
import com.iformall.service.WxPayOrderService;
import com.iformall.service.WxRefundOrderService;
@@ -15,6 +20,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Component
@@ -50,20 +56,41 @@ public class CouponOrderExpiringSchedule {

List<WxCouponOrder> list = wxCouponOrderMapper.findExpiredCouponOrderByValidDate();

list.parallelStream().forEach(co -> {
// 券过期与退款分离
couponOrderExpire(co);

if(!co.getCouponType().equals(EnumCouponType.CARD_MULTIMCH.getCode())) {
// 非储值卡, 可以退款
WxAppinfo appinfo = new WxAppinfo();
appinfo.setTenantId(co.getTenantId());
appinfo.setType(EnumAppType.B.getCode());
appinfo = wxAppinfoMapper.findList(appinfo).get(0);

try {
wxRefundOrderService.createRefundOrder(payProperty.isReal(), appinfo, co.getId(), EnumPayType.PAY_AUTO_REFUND, null);
} catch (Exception e) {
logger.error("退款失败:"+e.getMessage()+"couponOrderId="+co.getId());
}
}

for(WxCouponOrder co:list) {

WxAppinfo appinfo = new WxAppinfo();
appinfo.setTenantId(co.getTenantId());
appinfo.setType(EnumAppType.B.getCode());
appinfo = wxAppinfoMapper.findList(appinfo).get(0);
});
}

try {
wxRefundOrderService.createRefundOrder(payProperty.isReal(), appinfo, co.getId(), EnumPayType.PAY_AUTO_REFUND, null);
} catch (Exception e) {
logger.error("退款失败:"+e.getMessage()+"couponOrderId="+co.getId());
continue;
}
private void couponOrderExpire(WxCouponOrder co) {
// 标记 couponOrder过期
WxCouponOrder wxCouponOrder = new WxCouponOrder();
wxCouponOrder.setId(co.getId());
if(co.getCouponType().equals(EnumCouponType.CARD_MULTIMCH.getCode())) {
wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.CARD_OVER_TIME.getCode()); // 卡线下退款
} else {
wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_OVER_TIME.getCode()); //券已过期
}
wxCouponOrder.setUpdateDate(new Date());
try {
wxCouponOrderMapper.updateByPrimaryKeySelective(wxCouponOrder);
} catch (Exception e) {
logger.error("db failed: couponOrder-" + wxCouponOrder.getId() + ", e:" + e.getMessage());
}
}
}

+ 7
- 8
mallinkSchedule/src/main/java/com/iformall/schedule/OrderExpiringSchedule.java Просмотреть файл

@@ -37,21 +37,20 @@ public class OrderExpiringSchedule {

Map dateMap = new HashMap();
Date curDate = new Date();
Date expireDate = new Date(curDate.getTime() - TIME_OUT_VALUE );

// 只检查券相关订单
// 券相关订单
dateMap.put("type", EnumOrderType.COUPON.getCode());
dateMap.put("endDate", new Date(curDate.getTime() - TIME_OUT_VALUE ));
List<WxOrder> wxOrderList = wxOrderMapper.findListOfUnpaidOrderByDate(dateMap);

for(WxOrder wxOrder: wxOrderList){
orderExpired(wxOrder);
}
dateMap.put("endDate", expireDate);
List<WxOrder> orderCoupons = wxOrderMapper.findListOfUnpaidOrderByDate(dateMap);
orderCoupons.parallelStream().forEach( o -> {
orderExpired(o);
});
}

@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public void orderExpired(WxOrder order) {
order.setUpdateDate(new Date());
order.setType(EnumOrderType.COUPON.getCode());
order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL.getCode());
wxOrderMapper.updateByPrimaryKeySelective(order);



+ 1
- 1
mallinkService/src/main/java/com/iformall/common/ErrorCode.java Просмотреть файл

@@ -253,7 +253,7 @@ public enum ErrorCode{
/**
* 会员
*/
MEM_IMPORT_ERR(13000, "模板导入失败"),
MEM_IMPORT_ERR(13000, "模板导入失败,请尝试重新导入"),
MEM_SCORE_NOT_ENOUGH(13001, "成长值不够扣减值"),

/**


+ 4
- 48
mallinkService/src/main/java/com/iformall/domain/dto/WxOrderReportDto.java Просмотреть файл

@@ -1,10 +1,13 @@
package com.iformall.domain.dto;

import lombok.Data;

import java.util.Date;

/**
* Created by syf on 2018/8/30.
*/
@Data
public class WxOrderReportDto {
private String tenantId;
private Long merchantId;
@@ -12,52 +15,5 @@ public class WxOrderReportDto {
private Date startTime;
private Date endTime;
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;
}

+ 8
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCardSpend.java Просмотреть файл

@@ -77,6 +77,14 @@ public class WxCardSpend implements Serializable {
@Transient
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
{
Id_ASC("`id` ASC"),Id_DESC("`id` DESC")


+ 32
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java Просмотреть файл

@@ -40,6 +40,15 @@ public class WxCouponChannel implements Serializable {
this.ids = ids;
}

@Transient
private Integer isCRequest;

@Transient
private Date startdate;

@Transient
private Date enddate;


@Transient
protected List<Long> couponIds;
@@ -89,6 +98,13 @@ public class WxCouponChannel implements Serializable {
@io.swagger.annotations.ApiModelProperty(value="子频道ID",name="subTargetId")
private Long subTargetId;

public Integer getIsCRequest() {
return isCRequest;
}

public void setIsCRequest(Integer isCRequest) {
this.isCRequest = isCRequest;
}

public String getTenantId() {
return tenantId;
@@ -165,6 +181,22 @@ public class WxCouponChannel implements Serializable {
this.subTargetId = subTargetId;
}

public Date getStartdate() {
return startdate;
}

public void setStartdate(Date startdate) {
this.startdate = startdate;
}

public Date getEnddate() {
return enddate;
}

public void setEnddate(Date enddate) {
this.enddate = enddate;
}



public static enum Field


+ 7
- 7
mallinkService/src/main/java/com/iformall/domain/po/WxMerchantBUser.java Просмотреть файл

@@ -50,8 +50,8 @@ public class WxMerchantBUser implements Serializable {
@io.swagger.annotations.ApiModelProperty(value = "B端用户手机号", name = "phone")
private String phone;
/***/
@io.swagger.annotations.ApiModelProperty(value = "", name = "bUserPwd")
private String bUserPwd;
@io.swagger.annotations.ApiModelProperty(value = "", name = "userPwd")
private String userPwd;
/*商户id**/
@io.swagger.annotations.ApiModelProperty(value = "商户id", name = "merchantId")
private Long merchantId;
@@ -159,19 +159,19 @@ public class WxMerchantBUser implements Serializable {
this.status = status;
}

public String getbUserPwd() {
return bUserPwd;
public String getUserPwd() {
return userPwd;
}

public void setbUserPwd(String bUserPwd) {
this.bUserPwd = bUserPwd;
public void setUserPwd(String userPwd) {
this.userPwd = userPwd;
}

public static enum Field {
Id_ASC("`id` ASC"), Id_DESC("`id` DESC"),
TenantId_ASC("`tenant_id` ASC"), TenantId_DESC("`tenant_id` DESC"),
Phone_ASC("`phone` ASC"), Phone_DESC("`phone` DESC"),
BUserPwd_ASC("`b_user_pwd` ASC"), BUserPwd_DESC("`b_user_pwd` DESC"),
UserPwd_ASC("`user_pwd` ASC"), UserPwd_DESC("`user_pwd` DESC"),
MerchantId_ASC("`merchant_id` ASC"), MerchantId_DESC("`merchant_id` DESC"),
CreateDate_ASC("`create_date` ASC"), CreateDate_DESC("`create_date` DESC"),
UpdateDate_ASC("`update_date` ASC"), UpdateDate_DESC("`update_date` DESC"),


+ 11
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxWiWideInfo.java Просмотреть файл

@@ -59,6 +59,9 @@ public class WxWiWideInfo implements Serializable {
@io.swagger.annotations.ApiModelProperty(value="expiredTime",name="expiredTime")
private Date expiredTime;

/*卖外迪信息类型列表,1,支持客流 2,支持wifi*/
@io.swagger.annotations.ApiModelProperty(value="capability",name="capability")
private String capability;

public String getTenantId() {
return tenantId;
@@ -105,6 +108,14 @@ public class WxWiWideInfo implements Serializable {
this.expiredTime = expiredTime;
}

public String getCapability() {
return capability;
}

public void setCapability(String capability) {
this.capability = capability;
}

public static enum Field
{
Id_ASC("`id` ASC"),Id_DESC("`id` DESC")


+ 2
- 0
mallinkService/src/main/java/com/iformall/domain/vo/CUserBaseInfoT.java Просмотреть файл

@@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.annotation.Excel;

import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

public class CUserBaseInfoT implements Serializable {
@@ -19,6 +20,7 @@ public class CUserBaseInfoT implements Serializable {
@Excel(name="手机号",width = 20,orderNum = "3")
@io.swagger.annotations.ApiModelProperty(value="微信用户绑定的手机号",name="phone")
@NotNull
@Pattern(regexp = "1[0123456789]\\d{9}", message = "手机号不正确")
private String phone;
/**用户昵称**/
@Excel(name="微信昵称",width = 20,orderNum = "4")


+ 18
- 0
mallinkService/src/main/java/com/iformall/domain/vo/WxCUserBasicInfoVo.java Просмотреть файл

@@ -0,0 +1,18 @@
package com.iformall.domain.vo;

import com.iformall.domain.po.WxCUserBasicInfo;

public class WxCUserBasicInfoVo extends WxCUserBasicInfo {

/**用户tags*/
@io.swagger.annotations.ApiModelProperty(value="用户tags",name="tags")
private String tags;

public String getTags() {
return tags;
}

public void setTags(String tags) {
this.tags = tags;
}
}

+ 0
- 7
mallinkService/src/main/java/com/iformall/domain/vo/WxCardSpendVo.java Просмотреть файл

@@ -40,11 +40,4 @@ public class WxCardSpendVo extends WxCardSpend {
@io.swagger.annotations.ApiModelProperty(value="持有人绑定的手机号",name="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;
}

+ 0
- 38
mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantDiscountVo.java Просмотреть файл

@@ -1,38 +0,0 @@
package com.iformall.domain.vo;

public class WxMerchantDiscountVo extends WxMerchantVo {
private static final long serialVersionUID = 6687964942922444531L;

@io.swagger.annotations.ApiModelProperty(value="VIP折扣率1",name="vipDiscountRate1")
private Integer vipDiscountRate1;

@io.swagger.annotations.ApiModelProperty(value="VIP折扣率2",name="vipDiscountRate2")
private Integer vipDiscountRate2;

@io.swagger.annotations.ApiModelProperty(value="VIP折扣率3",name="vipDiscountRate3")
private Integer vipDiscountRate3;

public Integer getVipDiscountRate1() {
return vipDiscountRate1;
}

public void setVipDiscountRate1(Integer vipDiscountRate1) {
this.vipDiscountRate1 = vipDiscountRate1;
}

public Integer getVipDiscountRate2() {
return vipDiscountRate2;
}

public void setVipDiscountRate2(Integer vipDiscountRate2) {
this.vipDiscountRate2 = vipDiscountRate2;
}

public Integer getVipDiscountRate3() {
return vipDiscountRate3;
}

public void setVipDiscountRate3(Integer vipDiscountRate3) {
this.vipDiscountRate3 = vipDiscountRate3;
}
}

+ 2
- 1
mallinkService/src/main/java/com/iformall/enums/EnumRentContractType.java Просмотреть файл

@@ -8,7 +8,8 @@ package com.iformall.enums;
public enum EnumRentContractType {

RENT_BY_AREA(1, "面积"),
RENT_BY_JOINT(2, "联营扣点")
RENT_BY_JOINT(2, "联营扣点"),
RENT_BY_AREA_AND_JOINT(3, "面积与联营扣点取高")
;

public static EnumRentContractType getEnum(Integer code) {


+ 36
- 0
mallinkService/src/main/java/com/iformall/enums/EnumWiWideInfoStatus.java Просмотреть файл

@@ -0,0 +1,36 @@
package com.iformall.enums;

/**
* Created by Stormeye on 2018/08/09.
*/
public enum EnumWiWideInfoStatus {

INVALID(0, "未开通"),
VALID(1, "已开通")
;

public static EnumWiWideInfoStatus getEnum(Integer code) {
for (EnumWiWideInfoStatus value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

EnumWiWideInfoStatus(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

+ 3
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java Просмотреть файл

@@ -4,6 +4,7 @@ import com.iformall.common.CommonMapper;
import com.iformall.domain.dto.WxCUserBasicInfoDto;
import com.iformall.domain.po.WxCUserBasicInfo;
import com.iformall.domain.vo.CUserBaseVo;
import com.iformall.domain.vo.WxCUserBasicInfoVo;

import java.util.List;

@@ -22,4 +23,6 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S
long findCountByScore(WxCUserBasicInfoDto dto);

long findCount(WxCUserBasicInfoDto dto);

List<WxCUserBasicInfoVo> findVoList(WxCUserBasicInfo wxCUserBasicInfo);
}

+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCarCmdLogMapper.java Просмотреть файл

@@ -23,4 +23,6 @@ public interface WxCarCmdLogMapper extends CommonMapper<WxCarCmdLog, Long> {

List<Map<String,Object>> queryPlateNumberList(Map<String,Object> carParams);

String queryTenantIdBySynId(HashMap<String,String> params);

}

+ 1
- 1
mallinkService/src/main/java/com/iformall/mapper/WxCardSpendMapper.java Просмотреть файл

@@ -9,7 +9,7 @@ public interface WxCardSpendMapper extends CommonMapper<WxCardSpend, Long> {

List<WxCardSpend> findList(WxCardSpend wxCardSpend);

int updateByCond(WxCardSpend wxCardSpend);
void updateByCond(WxCardSpend wxCardSpend);

List<WxCardSpendVo> findCardSpendVoList(WxCardSpend wxCardSpend);



+ 4
- 2
mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java Просмотреть файл

@@ -3,13 +3,15 @@ package com.iformall.mapper;
import java.util.*;
import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.vo.WxMerchantDiscountVo;
import com.iformall.domain.vo.WxMerchantVo;

public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> {

List<WxMerchant> findList(WxMerchant wxMerchant);

List<WxMerchantDiscountVo> findDiscountList(WxMerchant wxMerchant);
List<WxMerchantVo> findDiscountList(WxMerchant wxMerchant);

WxMerchantVo getMerchantByCode(HashMap<String, String> params);



+ 19
- 9
mallinkService/src/main/java/com/iformall/service/WxCarCmdLogService.java Просмотреть файл

@@ -3,14 +3,16 @@ package com.iformall.service;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.WxCarCmdLog;

import java.util.HashMap;

public interface WxCarCmdLogService {

/**
* 根据实体查询分页列表
*
* @param record
* @param offset
* @param limit
* @param pageIndex
* @param pageSize
* @return
*/
PageInfo<WxCarCmdLog> listAsPage(WxCarCmdLog record, Integer pageIndex, Integer pageSize);
@@ -36,12 +38,20 @@ public interface WxCarCmdLogService {
* @param id
*/
void deleteById(Long id);


/**
* 根据synId获取tenantId
* @param params
* @return
*/
String getTenantIdBySynId(HashMap<String, String> params);








}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxCardSpendService.java Просмотреть файл

@@ -73,7 +73,7 @@ public interface WxCardSpendService {
*
* @param record
*/
int update(WxCardSpend record);
void update(WxCardSpend record);

/**
* 卡完结


+ 11
- 2
mallinkService/src/main/java/com/iformall/service/WxMerchantService.java Просмотреть файл

@@ -3,8 +3,9 @@ package com.iformall.service;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.vo.WxMerchantDiscountVo;
import com.iformall.domain.vo.WxMerchantVo;

import java.util.HashMap;
import java.util.List;

/**
@@ -28,7 +29,15 @@ public interface WxMerchantService {
* @param record
* @return
*/
List<WxMerchantDiscountVo> getDisCountList(WxMerchant record);
List<WxMerchantVo> getDisCountList(WxMerchant record);

/**
* 根据code查询
*
* @param params
* @return
*/
WxMerchantVo getMerchantInfo(HashMap<String, String> params);

/**
* 根据实体查询分页列表


+ 3
- 1
mallinkService/src/main/java/com/iformall/service/WxOrderService.java Просмотреть файл

@@ -51,10 +51,12 @@ public interface WxOrderService {
/**
* 商户码-储值卡支付
* @param merchant
* @param cUser
* @param totalFeeStr
* @param payment
* @return 订单id
*/
WxOrder saveCardPayOrder(WxMerchant merchant, String totalFeeStr, Integer payment);
WxOrder saveCardPayOrder(WxMerchant merchant, WxCUser cUser, String totalFeeStr, Integer payment);

/**
* 免费券订单接口


+ 14
- 1
mallinkService/src/main/java/com/iformall/service/impl/DataTowerServiceImpl.java Просмотреть файл

@@ -1,5 +1,6 @@
package com.iformall.service.impl;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
@@ -494,7 +495,7 @@ public class DataTowerServiceImpl implements DataTowerService {
return m.get("carcount");
}));

TreeMap<Object, Object> historymap = new TreeMap<>();
Map<Object, Object> historymap = new LinkedHashMap<>();
for (String date : tjTimeList) {
Object o = collect.get(date);
if (o == null) {
@@ -673,6 +674,18 @@ public class DataTowerServiceImpl implements DataTowerService {
return new ResultData(ErrorCode.WIWIDE_INFO_NOT_FOUND);
}
wiWideInfo = list.get(0);
List<Integer> cap = JSONArray.parseArray(wiWideInfo.getCapability(), Integer.class);
Integer dataType;
try {
dataType = Integer.valueOf(params.get("dataType"));
params.remove("dataType");
}catch (Exception e){
return new ResultData(ErrorCode.WIWIDE_INFO_NOT_FOUND);
}

if (cap == null || !cap.stream().anyMatch(c->c.equals(dataType))) {
return new ResultData(ErrorCode.WIWIDE_INFO_NOT_FOUND);
}
String res = WiwideUtil.queryData(wiWideInfo, getWiwideToken(wiWideInfo), params);
JSONObject result = JSONObject.parseObject(res);
if (result.getInteger("result") == 200){


+ 4
- 6
mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java Просмотреть файл

@@ -6,10 +6,7 @@ import com.iformall.domain.dto.MarkingCouponDataReportDto;
import com.iformall.domain.dto.WxOrderReportDto;
import com.iformall.domain.po.WxCoupon;
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.service.MarkingDataReportService;
import com.iformall.utils.DateUtils;
@@ -428,6 +425,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
params.put("endTime", addDay(1));
}
params.put("type", wxOrderReportDto.getType());
params.put("orderStatus", wxOrderReportDto.getOrderStatus());
List<WxOrderReportVo> list = wxOrderMapper.listOrderReportByDate(params);

String startdate = DateUtils.getTimeBefore(30, new Date());
@@ -568,7 +566,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
if (markingCouponDataReportDto.getStartTime() != null)
params1.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0));
if (markingCouponDataReportDto.getEndTime() != null)
params1.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1));
params1.put("endTime", markingCouponDataReportDto.getEndTime());
PageHelper.startPage(pageIndex, pageSize);
List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportList(params1);

@@ -582,7 +580,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
if (markingCouponDataReportDto.getStartTime() != null)
params2.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0));
if (markingCouponDataReportDto.getEndTime() != null)
params2.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1));
params2.put("endTime", markingCouponDataReportDto.getEndTime());
List<TouchUsersReportVo> couponDatalist = wxCouponOrderMapper.touchUsersReportList(params2);

Map<String,TouchUsersReportVo> visitMap = couponDatalist.stream().collect(Collectors.toMap(TouchUsersReportVo::getxTime, p -> p));


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxBrandServiceImpl.java Просмотреть файл

@@ -74,7 +74,7 @@ public class WxBrandServiceImpl implements WxBrandService {
}
try {
wxBrand.setUpdatetime(new Date());
wxBrandMapper.updateByPrimaryKeySelective(wxBrand);
wxBrandMapper.updateByPrimaryKey(wxBrand);
return new ResultData(Result.SUCCESS, "操作成功");
} catch (Exception e) {
logger.error("更新租赁合同信息失败,e:" + e.getMessage());


+ 34
- 30
mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java Просмотреть файл

@@ -18,6 +18,7 @@ import com.iformall.domain.po.WxTags;
import com.iformall.domain.vo.CUserBaseInfoT;
import com.iformall.domain.vo.CUserBaseVo;
import com.iformall.domain.vo.CUserTagVo;
import com.iformall.domain.vo.WxCUserBasicInfoVo;
import com.iformall.enums.EnumAssignTagsTrigger;
import com.iformall.enums.EnumScoreType;
import com.iformall.mapper.WxCUserBasicInfoMapper;
@@ -155,7 +156,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {
public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) {
WxCUserBasicInfo basicInfoQ = new WxCUserBasicInfo();
basicInfoQ.setTenantId(tenantId);
List<WxCUserBasicInfo> memberlist = wxCUserBasicInfoMapper.findList(basicInfoQ);
List<WxCUserBasicInfoVo> memberlist = wxCUserBasicInfoMapper.findVoList(basicInfoQ);

XSSFWorkbook workbook;
String filepath = Constant.fileDirectory;
@@ -168,6 +169,9 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

WxTags wxTagsQ = new WxTags();
List<WxTags> tagList = wxTagsMapper.findList(wxTagsQ);

try {
File file = new File(filepath);
workbook = new XSSFWorkbook();
@@ -211,7 +215,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {
tagCellTwo = rowtwo.createCell(9);
scoreCellTwo = rowtwo.createCell(10);

WxCUserBasicInfo entity = memberlist.get(i);
WxCUserBasicInfoVo entity = memberlist.get(i);

String sexStr = "保密";
if (entity.getSex() == 1)
@@ -229,21 +233,22 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {
updateDateCellTwo.setCellValue(sdf.format(entity.getUpdateDate()));
createDateCellTwo.setCellValue(sdf.format(entity.getCreateDate()));
if (entity != null) {
if (entity.getTagId() != null) {
WxCUserTags uTag = wxCUserTagsMapper.selectByPrimaryKey(entity.getTagId());
if (uTag != null && StringUtils.isNotBlank(uTag.getTags())) {
List<Long> ids = JSONObject.parseArray(uTag.getTags(), Long.class);
if (entity.getTagId() != null && entity.getTags() != null) {
if (StringUtils.isNotBlank(entity.getTags())) {
List<Long> ids = JSONObject.parseArray(entity.getTags(), Long.class);
if (!ids.isEmpty()) {
WxTags wxTagsQ = new WxTags();
wxTagsQ.setIds(ids);
List<WxTags> tagList = wxTagsMapper.findList(wxTagsQ);
String tagNames = "";
String tagIds = "";
List<Long> tagIdList = new ArrayList<>();
for (WxTags wt : tagList) {
tagNames += wt.getName() + "/";
tagIds += wt.getId() + ",";
tagIdList.add(wt.getId());
for(Long id: ids) {
for(WxTags tag: tagList) {
if(id.equals(tag.getId())) {
tagNames += tag.getName() + "/";
tagIds += tag.getId() + ",";
tagIdList.add(tag.getId());
break;
}
}
}
if (StringUtils.isNotBlank(tagNames)) {
entity.setTagNames(tagNames.substring(0, tagNames.length() - 1));
@@ -513,26 +518,25 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {

final IdWorker idWorker = IdWorker.get();

String importKey = "import-" + userId;

//默认添加到redis里
stringRedisTemplate.opsForHash().put(importKey, "allCount", "");
stringRedisTemplate.opsForHash().put(importKey, "allSuccessCount", "0");
stringRedisTemplate.opsForHash().put(importKey, "successCount", "0");
stringRedisTemplate.opsForHash().put(importKey, "failCount", "0");

ImportParams params = new ImportParams();
IExcelDataHandler<CUserBaseInfoT> handler = new UserExcelHandler();
handler.setNeedHandlerFields(new String[]{"姓名", "性别", "手机号", "微信昵称", "学历", "生日", "地址", "上次活跃时间", "注册时间", "标签", "成长值"});// 注意这里对应的是excel的列名。也就是对象上指定的列名。
params.setDataHandler(handler);
//params.setVerifyHandler();
// 需要验证
params.setNeedVerfiy(true);
params.setImportFields(new String[]{"姓名", "性别", "手机号", "微信昵称", "学历", "生日", "地址", "上次活跃时间", "注册时间", "标签", "成长值"});
params.setNeedVerify(true);

try {

ExcelImportResult<CUserBaseInfoT> datalist = ExcelImportUtil.importExcelMore(file.getInputStream(), CUserBaseInfoT.class, params);
List<CUserBaseInfoT> successList = datalist.getList();
List<CUserBaseInfoT> failList = datalist.getFailList();
logger.info("验证通过的数量:" + successList.size());
logger.info("验证未通过的数量:" + failList.size());
//如果不存在就添加
stringRedisTemplate.opsForHash().put(userId, "allCount", successList.size() + failList.size() + "");
stringRedisTemplate.opsForHash().put(userId, "allSuccessCount", successList.size() + "");
stringRedisTemplate.opsForHash().put(userId, "successCount", "0");
stringRedisTemplate.opsForHash().put(userId, "failCount", failList.size() + "");
logger.info("验证通过的数量: " + successList.size());
logger.info("验证未通过的数量: " + failList.size());

successList.parallelStream().forEach(uBase->{

@@ -644,12 +648,12 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {
stringRedisTemplate.opsForHash().increment(userId,"successCount",1);
});
} catch (Exception e) {
stringRedisTemplate.opsForHash().put(importKey, "allCount", "1");
stringRedisTemplate.opsForHash().put(importKey, "allSuccessCount", "0");
stringRedisTemplate.opsForHash().put(importKey, "successCount", "0");
stringRedisTemplate.opsForHash().put(importKey, "failCount", "1");
e.printStackTrace();
logger.error("导入模板失败:"+e.getMessage());
stringRedisTemplate.opsForHash().put(userId, "allCount", "1");
stringRedisTemplate.opsForHash().put(userId, "allSuccessCount", "0");
stringRedisTemplate.opsForHash().put(userId, "successCount", "0");
stringRedisTemplate.opsForHash().put(userId, "failCount", "1");
}

return new ResultData();


+ 8
- 5
mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java Просмотреть файл

@@ -126,11 +126,14 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService {
String str = JSON.toJSONString(tagId);
hs.addAll(wxCUserTagsMapper.findByTags(str, tenantId));
}
List<Long> userIds = new ArrayList<>();
userIds.addAll(hs);
WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo();
wxCUserBasicInfo.setIds(userIds);
return wxCUserBasicInfoMapper.findList(wxCUserBasicInfo);
if (!hs.isEmpty()) {
List<Long> userIds = new ArrayList<>();
userIds.addAll(hs);
WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo();
wxCUserBasicInfo.setIds(userIds);
return wxCUserBasicInfoMapper.findList(wxCUserBasicInfo);
}
return new ArrayList<>();
}




+ 7
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCarCmdLogServiceImpl.java Просмотреть файл

@@ -11,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iformall.common.IdWorker;

import java.util.HashMap;

@Service
public class WxCarCmdLogServiceImpl implements WxCarCmdLogService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -47,7 +49,11 @@ public class WxCarCmdLogServiceImpl implements WxCarCmdLogService {
}
@Override
public String getTenantIdBySynId(HashMap<String,String> params) {
return wxCarCmdLogMapper.queryTenantIdBySynId(params);
}



+ 32
- 12
mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java Просмотреть файл

@@ -1,6 +1,5 @@
package com.iformall.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
@@ -16,7 +15,6 @@ import com.iformall.service.WxCardSpendService;
import com.iformall.service.WxProfitSharingOrderService;
import com.iformall.utils.Constant;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
@@ -32,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;

@@ -120,7 +119,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
return new ResultData(ErrorCode.DB_FAIL.getCode(), "获取payAccount失败");
}

// 5. 扣减计算
// 4. 扣减计算
Integer payment = cardInfo.getSaleAmount() * record.getDeductionAmount() / cardInfo.getAmount();
Double dChargeFee = Math.ceil(payment * 1.0D * payAccount.getRate() / 10000);
Integer real_payment = payment - dChargeFee.intValue();
@@ -133,7 +132,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
remain_real_pament = cardInfo.getRemainingShareFeeAmount() - real_payment;
}

// 6 insert card_spend
// 5 insert card_spend
record.setId(idWorker.nextId());
record.setPayment(payment);
record.setRealPayment(real_payment);
@@ -151,6 +150,19 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
return new ResultData(ErrorCode.DB_FAIL.getCode(), "card spend 插入出错!");
}

// 6. update order status
WxOrder orderUpdate = new WxOrder();
orderUpdate.setId(order.getId());
orderUpdate.setPaymentTime(curDate);
orderUpdate.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode());
orderUpdate.setUpdateDate(curDate);
try {
wxOrderMapper.updateByPrimaryKeySelective(orderUpdate);
} catch (Exception e) {
logger.error("order update error");
return new ResultData(ErrorCode.DB_FAIL.getCode(), "order update 出错!");
}

// 7. update card info
cardInfo.setRemainingAmount(remaingAmount);
cardInfo.setRemainingShareFeeAmount(remain_real_pament);
@@ -275,7 +287,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
}

@Override
public int update(WxCardSpend 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()))))){
@@ -284,8 +296,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
// 2. 更新支付状态
record.setPayStatus(EnumCardSpendStatus.MANUAL_PAY.getCode());
record.setUpdateDate(new Date());
int num = wxCardSpendMapper.updateByCond(record);
return num;
wxCardSpendMapper.updateByCond(record);
}

@Override
@@ -369,6 +380,10 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
cardSpend.setCardId(cardId);
cardSpend.setOrderId(orderId);
cardSpend = wxCardSpendMapper.selectOne(cardSpend);
if (cardSpend != null && cardSpend.getRealPayment() <= 0) {
logger.error("微信分账金额为0, 无法再分");
return;
}
WxCardInfo cardInfo = wxCardInfoMapper.selectByPrimaryKey(cardSpend.getCardId());
WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(orderId);
WxMerchant merchant = wxMerchantMapper.selectByPrimaryKey(cardSpend.getMerchantId());
@@ -389,6 +404,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
ResultData resultData = profitSharingOrderService.createSharingOrder(shareOrder);
if(resultData.code != Result.SUCCESS) {
// 分账异常
logger.error(resultData.message);
throw new MallinkException(resultData.code, resultData.message);
}

@@ -484,7 +500,8 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
String filename = UUID.randomUUID() + ".xlsx";
filepath = filepath + filename;

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
DecimalFormat df = new DecimalFormat("0.00");

try {
File file = new File(filepath);
@@ -528,16 +545,19 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {

WxCardSpendVo entity = cardSpendVoList.get(i);

idCellTwo.setCellValue(entity.getId());
idCellTwo.setCellValue(String.valueOf(entity.getId()));
ownerCellTwo.setCellValue(entity.getOnickName());
phoneCellTwo.setCellValue(entity.getOuPhone());
cardNameCellTwo.setCellValue(entity.getTitle());
merchantNameCellTwo.setCellValue(entity.getMerchantName());
costCellTwo.setCellValue(entity.getDeductionAmount());
String dStr = df.format((float)entity.getDeductionAmount()/100);
costCellTwo.setCellValue(dStr);
if (entity.getCreateDate() != null)
costTimeCellTwo.setCellValue(sdf.format(entity.getCreateDate()));
receivePayCellTwo.setCellValue(entity.getPayment());
realReceivePayCellTwo.setCellValue(entity.getRealPayment());
dStr = df.format((float)entity.getPayment()/100);
receivePayCellTwo.setCellValue(dStr);
dStr = df.format((float)entity.getRealPayment()/100);
realReceivePayCellTwo.setCellValue(dStr);
String statusStr = "未支付";
if (entity.getPayStatus().equals(EnumCardSpendStatus.NOT_PAY.getCode()))
statusStr = "未支付";


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantBUserServiceImpl.java Просмотреть файл

@@ -118,7 +118,7 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService {
List<WxMerchantBUser> list = wxMerchantBUserMapper.findList(bUser);
if (list.size() > 0) {
bUser = list.get(0);
bUser.setbUserPwd(pwd);
bUser.setUserPwd(pwd);
try {
wxMerchantBUserMapper.updateByPrimaryKeySelective(bUser);
} catch (Exception e) {


+ 6
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java Просмотреть файл

@@ -7,7 +7,6 @@ import com.iformall.common.IdWorker;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxMerchantDiscountVo;
import com.iformall.domain.vo.WxMerchantVo;
import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
@@ -102,10 +101,15 @@ public class WxMerchantServiceImpl implements WxMerchantService {
}

@Override
public List<WxMerchantDiscountVo> getDisCountList(WxMerchant record) {
public List<WxMerchantVo> getDisCountList(WxMerchant record) {
return wxMerchantMapper.findDiscountList(record);
}

@Override
public WxMerchantVo getMerchantInfo(HashMap<String, String> params) {
return wxMerchantMapper.getMerchantByCode(params);
}

@Override
public List<WxMerchant> etcpList(WxMerchant record) {
record.setCarVendorType(EnumCarVendor.CAR_ETCP.getCode());


+ 10
- 5
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantSubsidyServiceImpl.java Просмотреть файл

@@ -25,6 +25,7 @@ import com.iformall.common.IdWorker;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;
@@ -94,7 +95,8 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService {
String filename = UUID.randomUUID() + ".xlsx";
filepath = filepath + filename;

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
DecimalFormat df = new DecimalFormat("0.00");

try {
File file = new File(filepath);
@@ -129,13 +131,16 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService {

WxMerchantSubsidyVo entity = subsidyVoList.get(i);

idCellTwo.setCellValue(entity.getId());
idCellTwo.setCellValue(String.valueOf(entity.getOrderId()));
merchantNameCellTwo.setCellValue(entity.getMerchantName());
if (entity.getCreateDate() != null)
createDateCellTwo.setCellValue(sdf.format(entity.getCreateDate()));
orderPaymentCellTwo.setCellValue(entity.getOrderPayment()/ 100);
receiverPaymentCellTwo.setCellValue(entity.getReceiverPayment() / 100);
subsidyCellTwo.setCellValue(entity.getSubsidy() / 100);
String dStr = df.format((float)entity.getOrderPayment()/100);
orderPaymentCellTwo.setCellValue(dStr);
dStr = df.format((float)entity.getReceiverPayment()/100);
receiverPaymentCellTwo.setCellValue(dStr);
dStr = df.format((float)entity.getSubsidy()/100);
subsidyCellTwo.setCellValue(dStr);
String statusStr = "未补贴";
if (entity.getStatus().equals(EnumMerchantSubsidyStatus.NOT_SUBSIDY.getCode())) {
statusStr = "未补贴";


+ 8
- 6
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java Просмотреть файл

@@ -452,12 +452,7 @@ public class WxOrderServiceImpl implements WxOrderService {

@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public WxOrder saveCardPayOrder(WxMerchant merchant, String totalFeeStr, Integer payment) {
if (merchant.getStatus() == EnumMerchantStatus.NOT_VALID.getCode()) {
logger.error("商户已禁用, merchantId: " + merchant.getId());
throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_VALID);
}

public WxOrder saveCardPayOrder(WxMerchant merchant, WxCUser cUser, String totalFeeStr, Integer payment) {
Date curr = new Date();

final IdWorker idWorker = IdWorker.get();
@@ -473,6 +468,7 @@ public class WxOrderServiceImpl implements WxOrderService {
record.setOrderNumber(orderNumber);
record.setType(EnumOrderType.PREPAIDCARD.getCode());
record.setProductId(merchant.getId());
record.setcUserId(cUser.getId());
record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode());
record.setPayment(payment);
record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode());
@@ -617,6 +613,9 @@ public class WxOrderServiceImpl implements WxOrderService {
throw new MallinkException(ErrorCode.COUPON_IS_NOT_FREE);
}

// 减库存操作
stockReduce(user, coupon, couponIdStr);

int payment = coupon.getSalePrice();

Date curr = new Date();
@@ -696,6 +695,9 @@ public class WxOrderServiceImpl implements WxOrderService {
throw new MallinkException(ErrorCode.COUPON_IS_NOT_FREE);
}

// 减库存操作
stockReduce(user, coupon, couponIdStr);

int payment = coupon.getSalePrice();

Date curr = new Date();


+ 0
- 4
mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java Просмотреть файл

@@ -300,10 +300,6 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
throw new MallinkException(ErrorCode.REFUND_PAY_ORDER_IS_ZERO);
}

if (wxCouponOrder.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_OVER_TIME.getCode())) {
logger.error("已过期: couponOrder-" + couponOrderId);
throw new MallinkException(ErrorCode.COUPON_ORDER_IS_OVER_TIME);
}
if (wxCouponOrder.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_INVALID.getCode())) {
logger.error("已退款: couponOrder-" + couponOrderId);
throw new MallinkException(ErrorCode.COUPON_ORDER_IS_OVER_TIME);


+ 16
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Просмотреть файл

@@ -165,6 +165,22 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND);
}
wxRentContractMapper.insertSelective(record);
//建立账单
if (record.getMerchantId() != null && record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode())
&& record.getReceivePeriod() != null && record.getDeposit() > 0 && record.getPrice() > 0) {
WxBillRent wxBillRent = new WxBillRent();
wxBillRent.setMerchantId(record.getMerchantId());
List<Map<String, Object>> billRentList = wxBillRentMapper.queryBillRentList(wxBillRent);
if (billRentList.size() == 0) {
WxMerchant wxMerchant = new WxMerchant();
wxMerchant.setId(record.getMerchantId());
wxMerchant.setTenantId(record.getTenantId());
//租金
buildRent(wxMerchant);
//押金
buildDeposit(wxMerchant);
}
}
} catch (Exception e) {
logger.error("保存租赁合同信息失败,e:" + e.getMessage());
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage());


+ 23
- 0
mallinkService/src/main/java/com/iformall/utils/HashUtil.java Просмотреть файл

@@ -1,6 +1,8 @@
package com.iformall.utils;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.util.Base64;

/**
* @author Stormeye
@@ -82,4 +84,25 @@ public class HashUtil {
}
return diff == 0;
}

public static String EncoderByMd5(String str) {
if (str == null) {
return null;
}
try {
String enc = hash("md5", str);
enc = new String(Base64.getUrlEncoder().encode(enc.getBytes("utf-8")));
return enc;
} catch (UnsupportedEncodingException e) {
return null;
}
}

public static String DecodeByMD5(String str) {
if (str == null) {
return null;
}
String dec = new String(Base64.getUrlDecoder().decode(str));
return dec;
}
}

+ 100
- 0
mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml Просмотреть файл

@@ -194,4 +194,104 @@
</if>
</select>

<resultMap id="VoBaseResultMap" type="com.iformall.domain.vo.WxCUserBasicInfoVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="phone" jdbcType="VARCHAR" property="phone"/>
<result column="birthdate" jdbcType="TIMESTAMP" property="birthdate"/>
<result column="education" jdbcType="VARCHAR" property="education"/>
<result column="sex" jdbcType="INTEGER" property="sex"/>
<result column="email" jdbcType="VARCHAR" property="email"/>
<result column="address" jdbcType="VARCHAR" property="address"/>
<result column="poins" jdbcType="INTEGER" property="poins"/>
<result column="tag_id" jdbcType="BIGINT" property="tagId"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="level" jdbcType="VARCHAR" property="level"/>
<result column="nick_name" jdbcType="VARCHAR" property="nickName"/>

<result column="tags" jdbcType="VARCHAR" property="tags"/>
</resultMap>

<sql id="allVoColumns">
cu.`id`,cu.`phone`,cu.`birthdate`,cu.`education`,cu.`sex`,cu.`email`,cu.`address`,cu.`poins`,cu.`tag_id`,
cu.`create_date`,cu.`update_date`,cu.`tenant_id`,cu.`name`,cu.`level`,cu.`nick_name`,
cut.`tags`
</sql>

<sql id="dynamicVoWhereConditions">
where 1 = 1

<if test=" null != id ">
and cu.`id` = #{id}
</if>

<if test=" null != tenantId ">
and cu.`tenant_id` = #{tenantId}
</if>

<if test=" null != phone ">
and cu.`phone` like concat('%', #{phone},'%')
</if>

<if test=" null != birthdate ">
and cu.`birthdate` = #{birthdate}
</if>

<if test=" null != education ">
and cu.`education` like concat('%', #{education},'%')
</if>

<if test=" null != sex ">
and cu.`sex` = #{sex}
</if>

<if test=" null != email ">
and cu.`email` like concat('%', #{email},'%')
</if>

<if test=" null != address ">
and cu.`address` like concat('%', #{address},'%')
</if>

<if test=" null != poins ">
and cu.`poins` = #{poins}
</if>

<if test=" null != tagId ">
and cu.`tag_id` = #{tagId}
</if>

<if test=" null != createDate ">
and cu.`create_date` = #{createDate}
</if>

<if test=" null != updateDate ">
and cu.`update_date` = #{updateDate}
</if>

<if test=" null != name ">
and `name` like concat('%', #{name},'%')
</if>
<if test=" null != startTime and null!=endTime">
and cu.`create_date` between #{startTime} and #{endTime}
</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="findVoList" parameterType="com.iformall.domain.vo.WxCUserBasicInfoVo" resultMap="VoBaseResultMap">
select
<include refid="allVoColumns"/>
from wx_c_user_basic_info cu
left join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
<include refid="dynamicVoWhereConditions"/>
</select>

</mapper>

+ 5
- 2
mallinkService/src/main/resources/mapper/WxCarCmdLogMapper.xml Просмотреть файл

@@ -103,8 +103,11 @@
and json_unquote(JSON_EXTRACT(cmd_json,'$.plateNumber')) is not null
group by plateNumber
</select>

<select id="queryTenantIdBySynId" parameterType="hashmap" resultType="String">
select `tenant_id` from wx_car_cmd_log
where cmd_type = 601 and json_extract(cmd_json, "$.synId") = #{synId}
</select>

</mapper>

+ 233
- 218
mallinkService/src/main/resources/mapper/WxCardSpendMapper.xml Просмотреть файл

@@ -1,136 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.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`,
`card_remain_amount`,`card_before_amount`,`card_remain_real_amount`,`card_before_real_amount`,
`create_date`,`update_date`, `pay_status`
</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 ">
and `deduction_amount` = #{deductionAmount}
</if>
<if test=" null != payment ">
and `payment` = #{payment}
</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 ">
and `card_remain_real_amount` = #{cardRemainRealAmount}
</if>
<if test=" null != cardBeforeRealAmount ">
and `card_before_real_amount` = #{cardBeforeRealAmount}
</if>
<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>
<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="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.`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`,
@@ -139,125 +154,125 @@
ou.`nick_name` as onick_name, ou.`phone` as ou_phone
</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 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_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
</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>

+ 6
- 6
mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml Просмотреть файл

@@ -52,7 +52,11 @@
and cc.`business` = #{business}
</if>

<if test=" null != beginTime and null != endTime and null != targetAd and 2 == targetAd">
<if test=" null != startdate and null!=enddate">
and cc.`create_date` between #{startdate} and #{enddate}
</if>

<if test="null !=isCRequest and null != targetAd and 2 == targetAd">
and cc.`begin_time` &lt; now()
and cc.`end_time` &gt; now()
</if>
@@ -68,6 +72,7 @@
<if test=" null != updateDate ">
and cc.`update_date` = #{updateDate}
</if>

<if test=" null != subTargetId ">
and cc.`sub_target_id` = #{subTargetId}
</if>
@@ -91,11 +96,6 @@
<include refid="dynamicWhereConditions" />
</select>

<select id="findListByCouponIds" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_coupon_channel cc
<include refid="dynamicWhereConditions" />
</select>

<update id="updateStatusByCouponId" parameterType="com.iformall.domain.po.WxCouponChannel">
update wx_coupon_channel set status=#{status} where tenant_id=#{tenantId} and coupon_id=#{couponId}
</update>


+ 3
- 3
mallinkService/src/main/resources/mapper/WxCouponInjectMapper.xml Просмотреть файл

@@ -55,9 +55,9 @@
<if test=" null != couponId ">
and `coupon_id` = #{couponId}
</if>
<if test=" null != couponName ">
</if>
<if test=" null != couponName and couponName!=''">
and `coupon_name` like concat('%', #{couponName},'%')
</if>


+ 29
- 1
mallinkService/src/main/resources/mapper/WxCouponMapper.xml Просмотреть файл

@@ -27,10 +27,14 @@
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="business" jdbcType="INTEGER" property="business"/>
<result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/>
<result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/>
<result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/>
</resultMap>

<sql id="allColumns">
`id`,`tenant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_type`,`valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`,`remark`,`status`,`create_date`,`update_date`,`business`,`support_transfer`,`subsidy_num`,`subsidy_type`
`id`,`tenant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_type`,
`valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`,
`remark`,`status`,`create_date`,`update_date`,`business`,`support_transfer`,`subsidy_num`,`subsidy_type`
</sql>

<sql id="dynamicWhereConditions">
@@ -136,6 +140,14 @@
and `support_transfer` = #{supportTransfer}
</if>

<if test=" null != subsidyType ">
and `subsidy_type` = #{subsidyType}
</if>

<if test=" null != subsidyNum ">
and `subsidy_num` = #{subsidyNum}
</if>

<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -255,6 +267,14 @@
and `support_transfer` = #{supportTransfer}
</if>

<if test=" null != subsidyType ">
and `subsidy_type` = #{subsidyType}
</if>

<if test=" null != subsidyNum ">
and `subsidy_num` = #{subsidyNum}
</if>

<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -374,6 +394,14 @@
and `support_transfer` = #{supportTransfer}
</if>

<if test=" null != subsidyType ">
and `subsidy_type` = #{subsidyType}
</if>

<if test=" null != subsidyNum ">
and `subsidy_num` = #{subsidyNum}
</if>

<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">


+ 34
- 25
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml Просмотреть файл

@@ -145,33 +145,38 @@
</select>

<select id="couponDataList" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap">
SELECT DATE_FORMAT(wx_coupon_order.create_date,'%Y-%m-%d') as createTime,wx_coupon_order.coupon_id as couponId
,COUNT(DISTINCT c_user_id) as couponUserCount,count(*) as couponCount
,(select Count(coupon_id) from wx_coupon_order c
SELECT DATE_FORMAT(wx_coupon_order.create_date,'%Y-%m-%d') as createTime,
wx_coupon_order.coupon_id as couponId
,COUNT(DISTINCT c_user_id) as couponUserCount,count(*) as couponCount
,(case when coupon_type &lt; 7 then
(select Count(coupon_id) from wx_coupon_order c
where coupon_order_status=1
and DATE_FORMAT(create_date,'%Y-%m-%d')=createTime
and DATE_FORMAT(update_date,'%Y-%m-%d')=createTime
and tenant_id=#{tenantId}
and c.coupon_id=couponId
<if test="startTime != null">
and c.update_date &gt;= #{startTime}
</if>
<if test="endTime != null">
and c.update_date &lt;= #{endTime}
</if>
) as verifyCount
,(select Count(DISTINCT c_user_id) from wx_coupon_order d
) else
(select Count(card_id) from wx_coupon_order c, wx_card_spend cs
where DATE_FORMAT(cs.create_date,'%Y-%m-%d')=createTime
and c.tenant_id=#{tenantId}
and c.coupon_id=couponId
and c.id=cs.card_id
) end)
as verifyCount
,(case when coupon_type &lt; 7 then
(select Count(DISTINCT c_user_id) from wx_coupon_order d
where coupon_order_status=1
and d.coupon_id=couponId
and DATE_FORMAT(create_date,'%Y-%m-%d')=createTime
and DATE_FORMAT(update_date,'%Y-%m-%d')=createTime
and tenant_id=#{tenantId}
and d.coupon_id=couponId
<if test="startTime != null">
and d.update_date &gt;= #{startTime}
</if>
<if test="endTime != null">
and d.update_date &lt;= #{endTime}
</if>
) as verifyUserCount
) else
(select Count(DISTINCT cs.owner_id) from wx_coupon_order c, wx_card_spend cs
where DATE_FORMAT(cs.create_date,'%Y-%m-%d')=createTime
and c.tenant_id=#{tenantId}
and c.coupon_id=couponId
and c.id=cs.card_id
) end)
as verifyUserCount
from wx_coupon_order
join wx_coupon on wx_coupon_order.coupon_id=wx_coupon.id
where wx_coupon_order.tenant_id=#{tenantId}
@@ -187,7 +192,7 @@
<if test="couponTitle != null">
and wx_coupon.title like concat('%', #{couponTitle},'%')
</if>
GROUP BY createTime,couponId
GROUP BY createTime,couponId,coupon_type
order by createTime desc
</select>

@@ -373,8 +378,8 @@
<if test=" null != couponOrderStatus ">
and co.coupon_order_status = #{couponOrderStatus}
</if>
<if test=" null != merchantName ">
<if test=" null != merchantName and merchantName!=''">
and (case when com.mc=1 then
(select m.name from wx_merchant m, wx_coupon_merchant cm
where m.id = cm.merchant_id and cm.product_id=co.coupon_id) else '[多商户通用]' end)
@@ -388,9 +393,13 @@
<if test="endDate != null">
AND co.create_date &lt; #{endDate,jdbcType=TIMESTAMP}
</if>

<if test=" null != id ">
and co.id = #{id}
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>

</select>




+ 6
- 6
mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml Просмотреть файл

@@ -5,7 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="b_user_pwd" jdbcType="VARCHAR" property="bUserPwd" />
<result column="user_pwd" jdbcType="VARCHAR" property="userPwd"/>
<result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
@@ -17,7 +17,7 @@
</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`phone`,`b_user_pwd`,`merchant_id`,`create_date`,`update_date`,`app_id`,`token`,`expire_time`,`name`,`status`
`id`,`tenant_id`,`phone`,`user_pwd`,`merchant_id`,`create_date`,`update_date`,`app_id`,`token`,`expire_time`,`name`,`status`
</sql>

<sql id="dynamicWhereConditions">
@@ -36,10 +36,10 @@
<if test=" null != phone ">
and `phone` = #{phone}
</if>
<if test=" null != bUserPwd ">
and `b_user_pwd` like concat('%', #{bUserPwd},'%')
</if>
<if test=" null != userPwd ">
and `user_pwd` like concat('%', #{userPwd},'%')
</if>


+ 22
- 1
mallinkService/src/main/resources/mapper/WxMerchantMapper.xml Просмотреть файл

@@ -98,7 +98,7 @@
m.vip_discount_rate1, m.vip_discount_rate2, m.vip_discount_rate3
</sql>

<resultMap id="MerchantDiscountVoResultMap" type="com.iformall.domain.vo.WxMerchantDiscountVo">
<resultMap id="MerchantDiscountVoResultMap" type="com.iformall.domain.vo.WxMerchantVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl"/>
<result column="name" jdbcType="VARCHAR" property="merchantName"/>
@@ -135,5 +135,26 @@
</where>
</select>

<select id="getMerchantByCode" parameterType="java.util.Map" resultMap="MerchantDiscountVoResultMap">
select
<include refid="allMerchantDiscountVoColumns"/>
FROM wx_merchant m
left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0
left join wx_shop s on ms.shop_id = s.id
left join wx_mall_building mb on s.building = mb.id
left join wx_mall_floor mf on s.floor = mf.id
<where>
<if test=" null != tenantId ">
and m.`tenant_id` = #{tenantId}
</if>
<if test=" null != status ">
and m.`status` = #{status}
</if>
<if test=" null != merchantCode ">
and md5(m.`id`) = #{merchantCode}
</if>
</where>
</select>


</mapper>

+ 21
- 4
mallinkService/src/main/resources/mapper/WxOrderMapper.xml Просмотреть файл

@@ -323,9 +323,20 @@
</select>

<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
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">
and o.`create_date` BETWEEN #{startTime} and #{endTime}
</if>
@@ -416,7 +427,7 @@
o.order_status,o.create_date,o.update_date,o.detail,'[多商户交易]' merchant_name,cubi.`name` c_user_name,cubi.phone
from
(
select o.* from wx_order o where o.type in (0,3) and o.id in(
select o.* from wx_order o where o.type=0 and o.id in(
select o.id from wx_order o left join wx_coupon_merchant cm
on o.product_id=cm.product_id group by o.id having count(o.id)>1)) o
left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id
@@ -425,7 +436,7 @@
o.order_status,o.create_date,o.update_date,o.detail,m.`name` merchant_name,cubi.`name` c_user_name,cubi.phone
from(
select o.*,cm.merchant_id from (
select o.* from wx_order o where o.type in (0,3) and o.id not in(
select o.* from wx_order o where o.type=0 and o.id not in(
select o.id from wx_order o left join wx_coupon_merchant cm
on o.product_id=cm.product_id group by o.id having count(o.id)>1)
) o
@@ -436,6 +447,12 @@
where type in (1,2))o
left join wx_merchant m on o.merchant_id=m.id
left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id
union all
select o.id,o.order_number,o.tenant_id,o.c_user_id,o.product_id,o.type,o.payment_type,o.payment,o.payment_time,
o.order_status,o.create_date,o.update_date,o.detail,m.`name` merchant_name,cubi.`name` c_user_name,cubi.phone
from wx_order o left join wx_merchant m on o.product_id=m.id
left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id
where o.type=3
) o
<where>
<if test="tenantId!=null">


+ 2
- 2
mallinkService/src/main/resources/mapper/WxWiwideInfoMapper.xml Просмотреть файл

@@ -9,11 +9,11 @@
<result column="wiwide_url" jdbcType="VARCHAR" property="wiwideUrl"/>
<result column="token" jdbcType="VARCHAR" property="token"/>
<result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime"/>
<result column="capability" jdbcType="VARCHAR" property="capability"/>
</resultMap>

<sql id="allColumns">
`id`,`tenant_id`,`wiwide_id`,`wiwide_key`,`wiwide_url`, `token`,`expired_time`
`id`,`tenant_id`,`wiwide_id`,`wiwide_key`,`wiwide_url`, `token`,`expired_time`,`capability`
</sql>

<sql id="dynamicWhereConditions">


+ 1
- 8
pom.xml Просмотреть файл

@@ -260,14 +260,7 @@
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-spring-boot-starter</artifactId>
<version>3.3.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.15</version>
<version>4.0.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->


Загрузка…
Отмена
Сохранить