| @@ -298,7 +298,7 @@ public class WxMerchantController extends BaseController { | |||
| @TenantIgnore | |||
| public ResultData hasMerchantEncode(@ModelAttribute WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::hasMerchantEncode{}"+wxMerchant.toString()); | |||
| boolean has = wxMerchantService.hasMerchant(wxMerchant); | |||
| boolean has = wxMerchantService.hasMerchantEncode(wxMerchant); | |||
| return new ResultData(has); | |||
| } | |||
| @@ -0,0 +1,335 @@ | |||
| package com.iformall.controller.datatower; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.UserCountVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.service.*; | |||
| import io.swagger.annotations.Api; | |||
| 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.math.BigDecimal; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.*; | |||
| @RestController | |||
| @Api(description = "会员统计") | |||
| @RequestMapping("userStatistics") | |||
| public class WxUserStatisticsController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| @Autowired | |||
| private WxMallService wxMallService; | |||
| @ApiOperation("查询微信用户数量") | |||
| @GetMapping("/findWxUserCount") | |||
| @SystemControllerLog(description = "查询微信用户数量") | |||
| public ResultData findWxUserCount() { | |||
| logger.debug("[" + getIpAddr() + "] userStatistics::findWxUserCount"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| //昨日同比 | |||
| Map<String, Object> map = new HashMap<>(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setEndTime(new Date()); | |||
| //微信用户数据 | |||
| long wxTotalCount = wxCUserService.findCount(dto,tenantEntitys);//总量 | |||
| map.put("wxTotalCount",wxTotalCount); | |||
| Calendar c = Calendar.getInstance(); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE, 0); | |||
| c.set(Calendar.SECOND, 0); | |||
| Date today = c.getTime(); | |||
| dto.setStartTime(today); | |||
| dto.setEndTime(null); | |||
| long wxTodayCount = wxCUserService.findCount(dto, tenantEntitys);//今天新增 | |||
| map.put("wxTodayCount",wxTodayCount); | |||
| //昨日同比 | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -1); | |||
| dto.setStartTime(c.getTime()); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| dto.setEndTime(c.getTime()); | |||
| long wxYesterdayCount = wxCUserService.findCount(dto, tenantEntitys); | |||
| if (wxYesterdayCount > 0) { | |||
| double yesterday = (double) (wxTodayCount - wxYesterdayCount) / wxYesterdayCount * 100; | |||
| double zrhb = new BigDecimal(yesterday).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||
| map.put("wxhb", zrhb + "%"); | |||
| } else { | |||
| map.put("wxhb", "--%"); | |||
| } | |||
| return new ResultData(map); | |||
| } | |||
| @ApiOperation("查询会员数量") | |||
| @GetMapping("/findBasicUserCount") | |||
| @SystemControllerLog(description = "查询会员数量") | |||
| public ResultData findBasicUserCount() { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStatisticsController::findBasicUserCount"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| //昨日同比 | |||
| Map<String, Object> map = new HashMap<>(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setEndTime(new Date()); | |||
| //会员用户数据 | |||
| long memTotalCount = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto);//总量 | |||
| map.put("memTotalCount",memTotalCount); | |||
| Calendar c = Calendar.getInstance(); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE, 0); | |||
| c.set(Calendar.SECOND, 0); | |||
| Date today = c.getTime(); | |||
| dto.setStartTime(today); | |||
| dto.setEndTime(null); | |||
| long memTodayCount = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto);//今天新增 | |||
| map.put("memTodayCount",memTodayCount); | |||
| //昨日同比 | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -1); | |||
| dto.setStartTime(c.getTime()); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| dto.setEndTime(c.getTime()); | |||
| long memYesterdayCount = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto); | |||
| if (memYesterdayCount > 0) { | |||
| double yesterday = (double) (memTodayCount - memYesterdayCount) / memYesterdayCount * 100; | |||
| double zrhb = new BigDecimal(yesterday).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||
| map.put("memhb", zrhb + "%"); | |||
| } else { | |||
| map.put("memhb", "--%"); | |||
| } | |||
| return new ResultData(map); | |||
| } | |||
| @ApiOperation("查询微信用户趋势") | |||
| @GetMapping("/findWxUserTrend") | |||
| @SystemControllerLog(description = "查询微信用户趋势") | |||
| public ResultData findWxUserTrend(Date startTime, Date endTime, Integer reportType) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStatisticsController::findUserCount"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| if (startTime == null || endTime == null) { | |||
| startTime = addMonth(new Date(), -1); | |||
| endTime = new Date(); | |||
| reportType = EnumUserCountReportType.DAY.getCode(); | |||
| } | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| dto.setReportType(reportType); | |||
| List<UserCountVo> wxCountList = new ArrayList<>();//每日新增会员数 | |||
| List<UserCountVo> wxCounts = wxCUserService.findCountHistory(dto,tenantEntitys);//每日新增会员数 | |||
| SimpleDateFormat sdf; | |||
| SimpleDateFormat fsdf; | |||
| if (reportType.equals(EnumUserCountReportType.YEAR.getCode())) { | |||
| sdf = new SimpleDateFormat("yyyy"); | |||
| fsdf = new SimpleDateFormat("yyyy"); | |||
| }else if (reportType.equals(EnumUserCountReportType.MONTH.getCode())) { | |||
| sdf = new SimpleDateFormat("yyyy-MM"); | |||
| fsdf = new SimpleDateFormat("yyyy-MM"); | |||
| }else { | |||
| sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||
| fsdf = new SimpleDateFormat("MM-dd"); | |||
| } | |||
| Date curTime = new Date(startTime.getTime()); | |||
| do { | |||
| UserCountVo wxUc = new UserCountVo(); | |||
| wxUc.setReportTime(fsdf.format(curTime)); | |||
| final Date ct = new Date(curTime.getTime()); | |||
| if (ct.before(new Date()) || ct.equals(new Date())) { | |||
| //用户 | |||
| Optional<UserCountVo> opWxUserCountVo = | |||
| wxCounts.stream().filter(md -> md.getReportTime().equals(sdf.format(ct))).findFirst(); | |||
| if (opWxUserCountVo.isPresent()) { | |||
| wxUc.setIncCount(opWxUserCountVo.get().getIncCount()); | |||
| wxUc.setTotalCount(opWxUserCountVo.get().getTotalCount()); | |||
| } else { | |||
| wxUc.setIncCount(0L); | |||
| wxUc.setTotalCount(0L); | |||
| } | |||
| } | |||
| wxCountList.add(wxUc); | |||
| if (reportType.equals(EnumUserCountReportType.YEAR.getCode())) { | |||
| curTime = addYear(curTime, 1); | |||
| } else if (reportType.equals(EnumUserCountReportType.MONTH.getCode())) { | |||
| curTime = addMonth(curTime, 1); | |||
| } else { | |||
| curTime = addDay(curTime, 1); | |||
| } | |||
| }while (curTime.before(endTime) || curTime.equals(endTime)); | |||
| if (wxCountList.size() > 0 | |||
| && wxCountList.get(0).getTotalCount() != null | |||
| && wxCountList.get(0).getTotalCount() == 0) { | |||
| WxCUserBasicInfoDto pdto = new WxCUserBasicInfoDto(); | |||
| pdto.updateTenantInfo(tenantEntity); | |||
| pdto.setEndTime(startTime); | |||
| wxCountList.get(0).setTotalCount(wxCUserService.findCount(pdto, tenantEntitys)); | |||
| } | |||
| for (int i = 1; i < wxCountList.size(); i++){ | |||
| if (wxCountList.get(i).getTotalCount() != null && | |||
| wxCountList.get(i-1).getTotalCount() != null && | |||
| wxCountList.get(i).getTotalCount() < wxCountList.get(i-1).getTotalCount()){ | |||
| wxCountList.get(i).setTotalCount(wxCountList.get(i-1).getTotalCount()); | |||
| } | |||
| } | |||
| return new ResultData(wxCountList); | |||
| } | |||
| @ApiOperation("查询会员趋势") | |||
| @GetMapping("/findBasicUserTrend") | |||
| @SystemControllerLog(description = "查询会员趋势") | |||
| public ResultData findBasicUserTrend(Date startTime, Date endTime, Integer reportType) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStatisticsController::findBasicUserTrend"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| if (startTime == null || endTime == null) { | |||
| startTime = addMonth(new Date(), -1); | |||
| endTime = new Date(); | |||
| reportType = EnumUserCountReportType.DAY.getCode(); | |||
| } | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| dto.setReportType(reportType); | |||
| List<UserCountVo> memCountList = new ArrayList<>();//每日新增会员数 | |||
| List<UserCountVo> memCounts = wxCUserBasicInfoService.findCountHistory(ifParentUpdateTenantInfo(),dto);//每日新增会员数 | |||
| SimpleDateFormat sdf; | |||
| SimpleDateFormat fsdf; | |||
| if (reportType.equals(EnumUserCountReportType.YEAR.getCode())) { | |||
| sdf = new SimpleDateFormat("yyyy"); | |||
| fsdf = new SimpleDateFormat("yyyy"); | |||
| }else if (reportType.equals(EnumUserCountReportType.MONTH.getCode())) { | |||
| sdf = new SimpleDateFormat("yyyy-MM"); | |||
| fsdf = new SimpleDateFormat("yyyy-MM"); | |||
| }else { | |||
| sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||
| fsdf = new SimpleDateFormat("MM-dd"); | |||
| } | |||
| Date curTime = new Date(startTime.getTime()); | |||
| do { | |||
| UserCountVo memUc = new UserCountVo(); | |||
| memUc.setReportTime(fsdf.format(curTime)); | |||
| final Date ct = new Date(curTime.getTime()); | |||
| if (ct.before(new Date()) || ct.equals(new Date())) { | |||
| //会员 | |||
| Optional<UserCountVo> opMemUserCountVo = | |||
| memCounts.stream().filter(md -> md.getReportTime().equals(sdf.format(ct))).findFirst(); | |||
| if (opMemUserCountVo.isPresent()) { | |||
| memUc.setIncCount(opMemUserCountVo.get().getIncCount()); | |||
| memUc.setTotalCount(opMemUserCountVo.get().getTotalCount()); | |||
| } else { | |||
| memUc.setIncCount(0L); | |||
| memUc.setTotalCount(0L); | |||
| } | |||
| } | |||
| memCountList.add(memUc); | |||
| if (reportType.equals(EnumUserCountReportType.YEAR.getCode())) { | |||
| curTime = addYear(curTime, 1); | |||
| } else if (reportType.equals(EnumUserCountReportType.MONTH.getCode())) { | |||
| curTime = addMonth(curTime, 1); | |||
| } else { | |||
| curTime = addDay(curTime, 1); | |||
| } | |||
| }while (curTime.before(endTime) || curTime.equals(endTime)); | |||
| if (memCountList.size() > 0 | |||
| && memCountList.get(0).getTotalCount() != null | |||
| && memCountList.get(0).getTotalCount() == 0) { | |||
| WxCUserBasicInfoDto pdto = new WxCUserBasicInfoDto(); | |||
| pdto.setEndTime(startTime); | |||
| memCountList.get(0).setTotalCount(wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),pdto)); | |||
| } | |||
| for (int i = 1; i < memCountList.size(); i++){ | |||
| if ( memCountList.get(i).getTotalCount() != null && | |||
| memCountList.get(i-1).getTotalCount() != null && | |||
| memCountList.get(i).getTotalCount() < memCountList.get(i-1).getTotalCount()){ | |||
| memCountList.get(i).setTotalCount(memCountList.get(i-1).getTotalCount()); | |||
| } | |||
| } | |||
| return new ResultData(memCountList); | |||
| } | |||
| private Date addDay(Date date , int addDayAmount) { | |||
| Calendar c = Calendar.getInstance(); | |||
| c.setTime(date); | |||
| c.add(Calendar.DATE, addDayAmount); | |||
| Date result = c.getTime(); | |||
| return result; | |||
| } | |||
| private Date addMonth(Date date, int addMountAmount) { | |||
| Calendar c = Calendar.getInstance(); | |||
| c.setTime(date); | |||
| c.add(Calendar.MONTH, addMountAmount); | |||
| Date result = c.getTime(); | |||
| return result; | |||
| } | |||
| private Date addYear(Date date, int addYearAmount) { | |||
| Calendar c = Calendar.getInstance(); | |||
| c.setTime(date); | |||
| c.add(Calendar.YEAR, addYearAmount); | |||
| Date result = c.getTime(); | |||
| return result; | |||
| } | |||
| } | |||
| @@ -1,3 +1,9 @@ | |||
| ALTER TABLE `wx_merchant` | |||
| ADD COLUMN `encode` varchar(50) COMMENT '唯一编码' AFTER `name`, | |||
| ADD UNIQUE INDEX `code_unique`(`encode`) USING BTREE; | |||
| ADD UNIQUE INDEX `code_unique`(`encode`) USING BTREE; | |||
| ALTER TABLE `wx_third_party_api` | |||
| ADD COLUMN `name` varchar(255) COMMENT '名称' AFTER `type`, | |||
| ADD COLUMN `remark` varchar(255) COMMENT '描述' AFTER `tp_id`; | |||
| @@ -194,13 +194,15 @@ public class AliPayController extends BaseController { | |||
| @RequestMapping(value = "/notify") | |||
| public String __Notify(@RequestParam Map<String, Object> paramMap) throws Exception { | |||
| logger.info("alipay notify ======{}:"+paramMap); | |||
| String msgMethod = (String) paramMap.get("msg_method"); | |||
| String notifyId = (String) paramMap.get("notify_id"); | |||
| if (StringUtils.isBlank(msgMethod)) { | |||
| logger.error("alipay notify notify error. msg_method empity:"+paramMap); | |||
| return "fail"; | |||
| }else { | |||
| AliBusinessCircleOrder aliBusinessCircleOrder = new AliBusinessCircleOrder(); | |||
| aliBusinessCircleOrder.setNoticeId(notifyId); | |||
| aliBusinessCircleOrder.setNoticeEventType(msgMethod); | |||
| //支付成功 | |||
| if ("alipay.business.mall.trade.success".equals(msgMethod)) { | |||
| String bizContent = (String) paramMap.get("biz_content"); | |||
| @@ -244,7 +246,7 @@ public class AliPayController extends BaseController { | |||
| logger.error("alipay notify . 找不到门店:"+paramMap); | |||
| return "fail"; | |||
| } | |||
| AliBusinessCircleOrder aliBusinessCircleOrder = new AliBusinessCircleOrder(); | |||
| aliBusinessCircleOrder.updateTenantInfo(merchant); | |||
| aliBusinessCircleOrder.setTransactionId(tradeNo); | |||
| aliBusinessCircleOrder.setAmount(amount); | |||
| @@ -256,7 +258,8 @@ public class AliPayController extends BaseController { | |||
| aliBusinessCircleOrder.setMallId(mallId); | |||
| aliBusinessCircleOrder.setMallName(mallName); | |||
| aliBusinessCircleOrderService.createOrder(aliBusinessCircleOrder); | |||
| aliBusinessCircleOrderService.createOrder(merchant,aliBusinessCircleOrder); | |||
| return "success"; | |||
| } | |||
| //退款成功 | |||
| @@ -284,7 +287,7 @@ public class AliPayController extends BaseController { | |||
| logger.error("alipay notify . 找不到门店:"+paramMap); | |||
| return "fail"; | |||
| } | |||
| AliBusinessCircleOrder aliBusinessCircleOrder = new AliBusinessCircleOrder(); | |||
| aliBusinessCircleOrder.updateTenantInfo(merchant); | |||
| aliBusinessCircleOrder.setTransactionId(tradeNo); | |||
| aliBusinessCircleOrder.setRefundAmount(refundAmount); | |||
| @@ -295,7 +298,7 @@ public class AliPayController extends BaseController { | |||
| aliBusinessCircleOrder.setMallId(mallId); | |||
| aliBusinessCircleOrder.setMallName(mallName); | |||
| aliBusinessCircleOrderService.insertRefundNoticeOrder(aliBusinessCircleOrder); | |||
| aliBusinessCircleOrderService.insertRefundNoticeOrder(merchant,aliBusinessCircleOrder); | |||
| return "success"; | |||
| } | |||
| }else{ | |||
| @@ -84,7 +84,6 @@ public class WxBusinessOrderController extends BaseController { | |||
| wxBusinessCircleOrder.setNoticeId(notifyData.getId()); | |||
| wxBusinessCircleOrder.setNoticeCreateTime(sdf.parse(notifyData.getCreateTime())); | |||
| wxBusinessCircleOrder.setNoticeEventType(notifyData.getEventType()); | |||
| wxBusinessCircleOrder.setNoticeResourceType(notifyData.getResourceType()); | |||
| wxBusinessCircleOrder.setSummary(notifyData.getSummary()); | |||
| //解密 | |||
| @@ -1,6 +1,8 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.domain.po.WxThirdPartyApi; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.service.WxThirdPartyApiService; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.IPUtil; | |||
| import org.slf4j.Logger; | |||
| @@ -28,6 +30,9 @@ public class BaseController { | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> objectCommonRedisTemplate; | |||
| @Autowired | |||
| WxThirdPartyApiService wxThirdPartyApiService; | |||
| @InitBinder | |||
| public void InitBinder(WebDataBinder dataBinder) { | |||
| @@ -57,6 +62,10 @@ public class BaseController { | |||
| return appId; | |||
| } | |||
| public WxThirdPartyApi getAppConfig() { | |||
| return wxThirdPartyApiService.findByApp(this.getAppId(),null); | |||
| } | |||
| public TenantEntity getTenantInfo() { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| String tenantId = (String) request.getAttribute(Constant.TENANT_ID); | |||
| @@ -54,7 +54,7 @@ public class UserBasicInfoController extends BaseController { | |||
| WxCUserBasicInfo userBasicInfo = wxCUserBasicInfoService.registerByPhone(tenantEntity, phone); | |||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantInfo(tenantEntity); | |||
| userBasicInfo.setLecelList(levelList); | |||
| userBasicInfo.setLevelList(levelList); | |||
| userBasicInfo.setLevel(WxLevelConfigService.DEFAULT_LEVEL); | |||
| if(userBasicInfo.getPoins() != null && userBasicInfo.getPoins() > 0){ | |||
| for (WxLevelConfig levelConfig : levelList) { | |||
| @@ -9,6 +9,7 @@ import com.iformall.service.WxThirdPartyOrdersService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.commons.lang3.math.NumberUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -46,27 +47,27 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| logger.info("UserThirdCircleOrderController >>>>>>>>>>>> createOrder >>>>>>>>>>>>>"+map.toString()); | |||
| String transactionId = (String) map.get("transactionId");//***订单Id | |||
| Long shopNumber = (Long) map.get("shopNumber");//***门店唯一标识 对应双方平台门店 | |||
| String shopNumber = (String) map.get("shopNumber");//***门店唯一标识 对应双方平台门店 | |||
| String shopName = (String) map.get("shopName");//门店名称 | |||
| Long userNumber = (Long) map.get("userNumber");//***会员Id | |||
| String userNumber = (String) map.get("userNumber");//***会员Id | |||
| String userPhone = (String) map.get("userPhone");//会员手机号 | |||
| String timeEnd = (String) map.get("timeEnd");//***付款时间(yyyy-MM-dd HH:mm:ss) | |||
| Integer amount = (Integer) map.get("amount");//***付款金额(分) | |||
| String amount = (String) map.get("amount");//***付款金额(分) | |||
| String summary = (String) map.get("summary");//付款摘要 | |||
| if(StringUtils.isBlank(transactionId)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"transactionId为空"); | |||
| } | |||
| if(shopNumber == null){ | |||
| if(StringUtils.isBlank(shopNumber)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"shopNumber为空"); | |||
| } | |||
| if(userNumber == null){ | |||
| if(StringUtils.isBlank(userNumber)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"userNumber为空"); | |||
| } | |||
| if(StringUtils.isNotBlank(userPhone) && !userPhone.matches("^1[0-9]{10}$")){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"userPhone格式不正确"); | |||
| } | |||
| if(timeEnd == null){ | |||
| if(StringUtils.isBlank(timeEnd)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"timeEnd为空"); | |||
| } | |||
| Date timeEndDate = null; | |||
| @@ -75,22 +76,26 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| } catch (ParseException e) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"timeEnd格式不正确"); | |||
| } | |||
| if(amount == null){ | |||
| if(StringUtils.isBlank(amount)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"amount为空"); | |||
| } | |||
| if(!NumberUtils.isCreatable(amount) || Integer.parseInt(amount) <= 0){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"amount为非数字"); | |||
| } | |||
| WxThirdPartyOrders thirdPartyOrders = new WxThirdPartyOrders(); | |||
| thirdPartyOrders.updateTenantInfo(getTenantInfo()); | |||
| thirdPartyOrders.setSourceAppId(getAppId()); | |||
| thirdPartyOrders.setSourceAppName(getAppConfig().getName()); | |||
| thirdPartyOrders.setTransactionId(transactionId); | |||
| thirdPartyOrders.setShopNumber(String.valueOf(shopNumber)); | |||
| thirdPartyOrders.setShopNumber(shopNumber); | |||
| thirdPartyOrders.setShopName(shopName); | |||
| thirdPartyOrders.setUserNumber(String.valueOf(userNumber)); | |||
| thirdPartyOrders.setUserNumber(userNumber); | |||
| thirdPartyOrders.setUserPhone(userPhone); | |||
| thirdPartyOrders.setTimeEnd(timeEndDate); | |||
| thirdPartyOrders.setAmount(amount); | |||
| thirdPartyOrders.setPayAmount(amount); | |||
| thirdPartyOrders.setAmount(Integer.parseInt(amount)); | |||
| thirdPartyOrders.setPayAmount(Integer.parseInt(amount)); | |||
| thirdPartyOrders.setSummary(summary); | |||
| try{ | |||
| thirdPartyOrdersService.createOrder(thirdPartyOrders); | |||
| @@ -98,7 +103,7 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| }catch(Exception e){ | |||
| e.printStackTrace(); | |||
| logger.error("异常:" + e); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||
| } | |||
| @@ -118,8 +123,8 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| String transactionId = (String) map.get("transactionId");//***订单Id | |||
| String refundTime = (String) map.get("refundTime");//***退款时间(yyyy-MM-dd HH:mm:ss) | |||
| String refundSummary = (String) map.get("refundSummary");//退款摘要 | |||
| Integer refundAmount = (Integer) map.get("refundAmount");//退款金额(分) | |||
| String refundId = (String) map.get("refundId");//退款Id | |||
| String refundAmount = (String) map.get("refundAmount");//退款金额(分) | |||
| String refundId = (String) map.get("refundId");//**退款Id | |||
| if(StringUtils.isBlank(transactionId)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"transactionId为空"); | |||
| @@ -133,16 +138,23 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| } catch (ParseException e) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"timeEnd格式不正确"); | |||
| } | |||
| if(StringUtils.isNotBlank(refundAmount) && (!NumberUtils.isCreatable(refundAmount) || Integer.parseInt(refundAmount) <= 0)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"refundAmount为非数字"); | |||
| } | |||
| if(StringUtils.isBlank(refundId)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"refundId为空"); | |||
| } | |||
| WxThirdPartyOrders thirdPartyOrders = new WxThirdPartyOrders(); | |||
| thirdPartyOrders.updateTenantInfo(getTenantInfo()); | |||
| thirdPartyOrders.setSourceAppId(getAppId()); | |||
| thirdPartyOrders.setSourceType(EnumThirdOrderType.RMB_PAY.getCode()); | |||
| thirdPartyOrders.setSourceAppName(getAppConfig().getName()); | |||
| thirdPartyOrders.setTransactionId(transactionId); | |||
| thirdPartyOrders.setEndTime(refundTimeDate); | |||
| thirdPartyOrders.setTimeEnd(refundTimeDate); | |||
| thirdPartyOrders.setSummary(refundSummary); | |||
| thirdPartyOrders.setRefundAmount(refundAmount); | |||
| thirdPartyOrders.setRefundAmount(Integer.parseInt(refundAmount)); | |||
| thirdPartyOrders.setRefundId(refundId); | |||
| try{ | |||
| @@ -151,7 +163,7 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| }catch(Exception e){ | |||
| e.printStackTrace(); | |||
| logger.error("异常:" + e); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||
| } | |||
| @@ -170,21 +182,21 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| logger.info("UserThirdCircleOrderController >>>>>>>>>>>> pointDeduction >>>>>>>>>>>>>"+map.toString()); | |||
| String transactionId = (String) map.get("transactionId");//***订单Id | |||
| Long shopNumber = (Long) map.get("shopNumber");//***门店唯一标识 对应双方平台门店 | |||
| String shopNumber = (String) map.get("shopNumber");//***门店唯一标识 对应双方平台门店 | |||
| String shopName = (String) map.get("shopName");//门店名称 | |||
| Long userNumber = (Long) map.get("userNumber");//***会员Id | |||
| String userNumber = (String) map.get("userNumber");//***会员Id | |||
| String userPhone = (String) map.get("userPhone");//会员手机号 | |||
| String timeEnd = (String) map.get("timeEnd");//***抵扣时间 | |||
| Integer amount = (Integer) map.get("amount");//***积分数量 | |||
| String summary = (String) map.get("summary");//付款摘要 | |||
| String amount = (String) map.get("amount");//***积分数量 | |||
| String summary = (String) map.get("summary");//摘要 | |||
| if(StringUtils.isBlank(transactionId)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"transactionId为空"); | |||
| } | |||
| if(shopNumber == null){ | |||
| if(StringUtils.isBlank(shopNumber)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"shopNumber为空"); | |||
| } | |||
| if(userNumber == null){ | |||
| if(StringUtils.isBlank(userNumber)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"userNumber为空"); | |||
| } | |||
| if(StringUtils.isNotBlank(userPhone) && !userPhone.matches("^1[0-9]{10}$")){ | |||
| @@ -199,21 +211,26 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| } catch (ParseException e) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"timeEnd格式不正确"); | |||
| } | |||
| if(amount == null){ | |||
| if(StringUtils.isBlank(amount)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"amount为空"); | |||
| } | |||
| if(!NumberUtils.isCreatable(amount) || Integer.parseInt(amount) <= 0){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"amount为非数字"); | |||
| } | |||
| WxThirdPartyOrders thirdPartyOrders = new WxThirdPartyOrders(); | |||
| thirdPartyOrders.updateTenantInfo(getTenantInfo()); | |||
| thirdPartyOrders.setSourceAppId(getAppId()); | |||
| thirdPartyOrders.setSourceAppName(getAppConfig().getName()); | |||
| thirdPartyOrders.setTransactionId(transactionId); | |||
| thirdPartyOrders.setShopNumber(String.valueOf(shopNumber)); | |||
| thirdPartyOrders.setShopNumber(shopNumber); | |||
| thirdPartyOrders.setShopName(shopName); | |||
| thirdPartyOrders.setUserNumber(String.valueOf(userNumber)); | |||
| thirdPartyOrders.setUserNumber(userNumber); | |||
| thirdPartyOrders.setUserPhone(userPhone); | |||
| thirdPartyOrders.setTimeEnd(timeEndDate); | |||
| thirdPartyOrders.setAmount(amount); | |||
| thirdPartyOrders.setAmount(Integer.parseInt(amount)); | |||
| thirdPartyOrders.setPayAmount(Integer.parseInt(amount)); | |||
| thirdPartyOrders.setSummary(summary); | |||
| try{ | |||
| thirdPartyOrdersService.pointDeduction(thirdPartyOrders); | |||
| @@ -222,7 +239,7 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| }catch(Exception e){ | |||
| e.printStackTrace(); | |||
| logger.error("异常:" + e); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||
| } | |||
| } | |||
| @@ -31,20 +31,43 @@ public class AppTest { | |||
| /** | |||
| * 注册并查询用户详细信息 参数 | |||
| */ | |||
| // paramMap.put("phone","17600293031"); | |||
| // paramMap.put("phone","18872592633"); | |||
| /** | |||
| * 创建交易信息 参数 | |||
| */ | |||
| // IdWorker idWorker = IdWorker.get(); | |||
| // paramMap.put("transactionId",String.valueOf(idWorker.nextId()));//***订单Id | |||
| // paramMap.put("shopNumber","1001");//***门店唯一标识 对应双方平台门店 | |||
| // paramMap.put("shopName","百丽");//门店名称 | |||
| // paramMap.put("userNumber","546907706202185728");//***会员Id | |||
| // paramMap.put("userPhone","18872592633");//会员手机号 | |||
| // paramMap.put("timeEnd","2021-04-27 11:43:00");//***付款时间(yyyy-MM-dd HH:mm:ss) | |||
| // paramMap.put("amount","1000");//***付款金额(分) | |||
| // paramMap.put("summary","我要加积分");//付款摘要 | |||
| /** | |||
| * 交易退款信息 参数 | |||
| */ | |||
| // IdWorker idWorker = IdWorker.get(); | |||
| // paramMap.put("transactionId","547662852896411648");//***订单Id | |||
| // paramMap.put("refundTime","2021-04-27 11:50:00");//***退款时间(yyyy-MM-dd HH:mm:ss) | |||
| // paramMap.put("refundAmount","1000");//退款金额(分) | |||
| // paramMap.put("refundSummary","我要退款");//付款摘要 | |||
| // paramMap.put("refundId",String.valueOf(idWorker.nextId()));//退款订单号 | |||
| /** | |||
| * 积分抵扣 参数 | |||
| */ | |||
| IdWorker idWorker = IdWorker.get(); | |||
| paramMap.put("transactionId",String.valueOf(idWorker.nextId()));//***订单Id | |||
| paramMap.put("shopNumber","461675336101793792");//***门店唯一标识 对应双方平台门店 | |||
| paramMap.put("shopNumber","1001");//***门店唯一标识 对应双方平台门店 | |||
| paramMap.put("shopName","百丽");//门店名称 | |||
| paramMap.put("userNumber","542490555719278592");//***会员Id | |||
| paramMap.put("userNumber","546907706202185728");//***会员Id546907706202185728 | |||
| paramMap.put("userPhone","18872592633");//会员手机号 | |||
| paramMap.put("timeEnd","2021-04-26 11:43:00");//***付款时间(yyyy-MM-dd HH:mm:ss) | |||
| paramMap.put("amount","1000");//***付款金额(分) | |||
| paramMap.put("summary","我要加积分");//付款摘要 | |||
| paramMap.put("timeEnd","2021-04-26 11:43:00");//***积分抵扣时间 | |||
| paramMap.put("amount","100");//***付款金额(分) | |||
| paramMap.put("summary","我要换东西");//付款摘要 | |||
| /** | |||
| @@ -63,7 +86,17 @@ public class AppTest { | |||
| /** | |||
| * 创建交易信息 接口 | |||
| */ | |||
| String s = HttpUtil.doPost("https://openapitest.malls.iformall.com/api/thirdCircle/order", headMap, JSON.toJSONString(paramMap)); | |||
| // String s = HttpUtil.doPost("https://openapitest.malls.iformall.com/api/thirdCircle/order", headMap, JSON.toJSONString(paramMap)); | |||
| /** | |||
| * 交易退款 接口 | |||
| */ | |||
| // String s = HttpUtil.doPost("https://openapitest.malls.iformall.com/api/thirdCircle/orderRefund", headMap, JSON.toJSONString(paramMap)); | |||
| /** | |||
| * 交易退款 接口 | |||
| */ | |||
| String s = HttpUtil.doPost("https://openapitest.malls.iformall.com/api/thirdCircle/pointDeduction", headMap, JSON.toJSONString(paramMap)); | |||
| System.out.println(s); | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -26,9 +26,6 @@ public class BusinessCircleBase extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="商圈支付结果通知类型:MALL_TRANSACTION.SUCCESS",name="noticeEventType") | |||
| private String noticeEventType; | |||
| @io.swagger.annotations.ApiModelProperty(value="商圈支付结果通知资源数据类型:encrypt-resource",name="noticeResourceType") | |||
| private String noticeResourceType; | |||
| @io.swagger.annotations.ApiModelProperty(value="商圈支付结果通知回调摘要",name="summary") | |||
| private String summary; | |||
| @@ -84,6 +81,9 @@ public class BusinessCircleBase extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="是否退款(1:是,0:否)",name="isRefund") | |||
| private Integer isRefund; | |||
| @io.swagger.annotations.ApiModelProperty(value="正常订单状态(is_refund=0时)1:部分退款2:订单关闭",name="orderStatus") | |||
| private Integer orderStatus; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信支付退款单号",name="refundId") | |||
| private String refundId; | |||
| @@ -115,7 +115,7 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId { | |||
| private String level; | |||
| @TableField(exist = false) | |||
| private List<WxLevelConfig> lecelList; | |||
| private List<WxLevelConfig> levelList; | |||
| @Excel(name="积分",width = 20, orderNum = "12") | |||
| @io.swagger.annotations.ApiModelProperty(value="积分",name="credit") | |||
| @@ -17,6 +17,9 @@ public class WxThirdPartyApi extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="name") | |||
| private String name; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="appId") | |||
| private String appId; | |||
| @@ -44,6 +47,9 @@ public class WxThirdPartyApi extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="version") | |||
| private String version; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="remark") | |||
| private String remark; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="tpId") | |||
| private String tpId; | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -14,6 +15,9 @@ public class WxThirdPartyOrders extends BusinessCircleBase { | |||
| @io.swagger.annotations.ApiModelProperty(value="来源(wx_third_party_api)",name="sourceAppId") | |||
| private String sourceAppId; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="来源(wx_third_party_api)",name="sourceAppName") | |||
| private String sourceAppName; | |||
| @io.swagger.annotations.ApiModelProperty(value="1:RMB订单;2:积分订单",name="sourceType") | |||
| private Integer sourceType; | |||
| @@ -35,4 +35,10 @@ public interface AliBusinessCircleOrderMapper extends CommonMapper<AliBusinessCi | |||
| */ | |||
| void insertRefundNoticeOrder(AliBusinessCircleOrder record); | |||
| /** | |||
| * 修改正常订单状态 | |||
| * @param record | |||
| */ | |||
| void updateOrderStatus(AliBusinessCircleOrder record); | |||
| } | |||
| @@ -38,4 +38,10 @@ public interface WxBusinessCircleOrderMapper extends CommonMapper<WxBusinessCirc | |||
| */ | |||
| void insertRefundNoticeOrder(WxBusinessCircleOrder record); | |||
| /** | |||
| * 修改正常订单状态 | |||
| * @param record | |||
| */ | |||
| void updateOrderStatus(WxBusinessCircleOrder record); | |||
| } | |||
| @@ -35,4 +35,10 @@ public interface WxThirdPartyOrdersMapper extends CommonMapper<WxThirdPartyOrder | |||
| */ | |||
| void insertRefundNoticeOrder(WxThirdPartyOrders record); | |||
| /** | |||
| * 修改正常订单状态 | |||
| * @param record | |||
| */ | |||
| void updateOrderStatus(WxThirdPartyOrders record); | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.AliBusinessCircleOrder; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import java.util.List; | |||
| @@ -35,9 +36,9 @@ public interface AliBusinessCircleOrderService { | |||
| List<AliBusinessCircleOrder> getRefundOrderByTransactionId(String transactionId, String tenantId); | |||
| void createOrder(AliBusinessCircleOrder record); | |||
| void createOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record); | |||
| void insertRefundNoticeOrder(AliBusinessCircleOrder record); | |||
| void insertRefundNoticeOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record); | |||
| /** | |||
| * 积分 | |||
| @@ -32,7 +32,7 @@ public interface WxThirdPartyOrdersService { | |||
| * @return | |||
| */ | |||
| WxThirdPartyOrders getOrderByTransactionId(EnumThirdOrderType orderType, String transactionId, String tenantId); | |||
| WxThirdPartyOrders getRefundOrderByRefundId(String refundId, String tenantId); | |||
| WxThirdPartyOrders getRefundOrderByRefundId(EnumThirdOrderType orderType,String refundId, String tenantId); | |||
| List<WxThirdPartyOrders> getRefundOrderByTransactionId(EnumThirdOrderType orderType, String transactionId, String tenantId); | |||
| @@ -13,6 +13,8 @@ import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| @@ -82,7 +84,8 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| } | |||
| @Override | |||
| public void createOrder(AliBusinessCircleOrder record) { | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void createOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record) { | |||
| String lockKey = StringUtils.join(ALI_CIRCLE_KEY,record.getTransactionId(), ":",EnumYesOrNo.NO.getCode(),":","lock"); | |||
| long time = System.currentTimeMillis() + 2000; | |||
| String timeStr = String.valueOf(time); | |||
| @@ -99,12 +102,15 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| //TODO 第三方获取门店(标识可能发生变化) | |||
| // WxMerchant wxMerchant = wxMerchantService.getById(Long.parseLong(record.getMallStoreId())); | |||
| WxMerchant wxMerchant = wxMerchantService.getMerchantByEncode(record.getMallStoreId()); | |||
| if(wxMerchant != null){ | |||
| record.setMerchantId(wxMerchant.getId()); | |||
| }else{ | |||
| logger.error("--Ali商圈付款通知消息未找到门店--mallStoreId="+record.getMallStoreId()); | |||
| } | |||
| //必有门店 | |||
| // WxMerchant wxMerchant = wxMerchantService.getMerchantByEncode(record.getMallStoreId()); | |||
| // if(wxMerchant != null){ | |||
| // record.setMerchantId(wxMerchant.getId()); | |||
| // }else{ | |||
| // logger.error("--Ali商圈付款通知消息未找到门店--mallStoreId="+record.getMallStoreId()); | |||
| // } | |||
| record.setMerchantId(wxMerchant.getId()); | |||
| AliPayCUser userQ = new AliPayCUser(); | |||
| userQ.updateTenantInfo(record); | |||
| userQ.setAlipayUserId(record.getBuyerId()); | |||
| @@ -140,7 +146,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| creditHistory.setMerchantId(record.getMerchantId()); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setSpend(record.getPayAmount()); | |||
| creditHistory.setChangePurpose("Ali商圈消费:消费商户["+record.getMallName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose("支付宝商圈消费:商户["+wxMerchant.getName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| @@ -169,36 +175,43 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| } | |||
| @Override | |||
| public void insertRefundNoticeOrder(AliBusinessCircleOrder record) { | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void insertRefundNoticeOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record) { | |||
| AliBusinessCircleOrder order = this.getOrderByTransactionId(record.getTransactionId(),record.getTenantId()); | |||
| if(order == null){ | |||
| logger.error("--Ali商圈退款--付款消息未找到--transactionId="+record.getTransactionId()); | |||
| }else{ | |||
| String lockKey = StringUtils.join(ALI_CIRCLE_KEY,record.getRefundId(), ":",EnumYesOrNo.YES.getCode(),":","lock"); | |||
| String lockKey = StringUtils.join(ALI_CIRCLE_KEY,record.getTransactionId(), ":",EnumYesOrNo.YES.getCode(),":","lock"); | |||
| long time = System.currentTimeMillis() + 2000; | |||
| String timeStr = String.valueOf(time); | |||
| if (redisLock.lock2(lockKey, timeStr)) { | |||
| AliBusinessCircleOrder refundOrder = this.getRefundOrderByRefundId(record.getRefundId(),record.getTenantId()); | |||
| if(refundOrder != null){ | |||
| logger.error("--Ali商圈退款--退款消息已存在---RefundId="+record.getRefundId()); | |||
| }else{ | |||
| List<AliBusinessCircleOrder> refundOrders = this.getRefundOrderByTransactionId(record.getTransactionId(),record.getTenantId()); | |||
| Integer amount = order.getPayAmount(); | |||
| Integer increasedPoints = order.getIncreasedPoints(); | |||
| Integer refundAmount = 0; | |||
| Integer refundIncreasedPoints = 0; | |||
| if(refundOrders != null && refundOrders.size()>0){ | |||
| for (AliBusinessCircleOrder ro:refundOrders) { | |||
| refundAmount += ro.getRefundAmount(); | |||
| refundIncreasedPoints += ro.getIncreasedPoints(); | |||
| } | |||
| } | |||
| if(refundAmount >= amount){ | |||
| logger.error("--Ali商圈退款--已经退款--transactionId="+record.getTransactionId()); | |||
| }else if((refundAmount + record.getRefundAmount()) > amount ){ | |||
| logger.error("--Ali商圈退款--退款金额超限--transactionId="+record.getTransactionId()); | |||
| }else{ | |||
| List<AliBusinessCircleOrder> refundOrders = this.getRefundOrderByTransactionId(record.getTransactionId(),record.getTenantId()); | |||
| if(refundOrders != null && refundOrders.size() > 0){ | |||
| logger.error("--Ali商圈退款--已经退款--transactionId="+record.getTransactionId()); | |||
| } | |||
| // AliBusinessCircleOrder refundOrder = this.getRefundOrderByRefundId(record.getRefundId(),record.getTenantId()); | |||
| // if(refundOrder != null){ | |||
| // logger.error("--Ali商圈退款--退款消息已存在---RefundId="+record.getRefundId()); | |||
| // }else{ | |||
| // List<AliBusinessCircleOrder> refundOrders = this.getRefundOrderByTransactionId(record.getTransactionId(),record.getTenantId()); | |||
| // Integer amount = order.getPayAmount(); | |||
| // Integer increasedPoints = order.getIncreasedPoints(); | |||
| // Integer refundAmount = 0; | |||
| // Integer refundIncreasedPoints = 0; | |||
| // | |||
| // if(refundOrders != null && refundOrders.size()>0){ | |||
| // for (AliBusinessCircleOrder ro:refundOrders) { | |||
| // refundAmount += ro.getRefundAmount(); | |||
| // refundIncreasedPoints += ro.getIncreasedPoints(); | |||
| // } | |||
| // } | |||
| // if(refundAmount >= amount){ | |||
| // logger.error("--Ali商圈退款--已经退款--transactionId="+record.getTransactionId()); | |||
| // }else if((refundAmount + record.getRefundAmount()) > amount ){ | |||
| // logger.error("--Ali商圈退款--退款金额超限--transactionId="+record.getTransactionId()); | |||
| // } | |||
| else{ | |||
| Date now = new Date(); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| @@ -211,6 +224,10 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| record.setMerchantId(order.getMerchantId()); | |||
| aliBusinessCircleOrderMapper.insertRefundNoticeOrder(record); | |||
| order.setOrderStatus(2);//全额退款 订单关闭 | |||
| order.setUpdateTime(now); | |||
| aliBusinessCircleOrderMapper.updateOrderStatus(order); | |||
| if(order.getEarnPoints().equals(EnumYesOrNo.YES.getCode())){ | |||
| WxCreditHistory creditHistory = new WxCreditHistory(); | |||
| creditHistory.setTenantId(record.getFinalTenantId()); | |||
| @@ -219,21 +236,21 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| creditHistory.setCUserId(record.getCUserId()); | |||
| creditHistory.setCreateDate(new Date()); | |||
| creditHistory.setCouponId(record.getId()); | |||
| creditHistory.setMerchantId(record.getMerchantId()); | |||
| creditHistory.setMerchantId(order.getMerchantId()); | |||
| creditHistory.setCreditType(EnumScoreType.REFUND_CONSUMPTION.getCode()); | |||
| int points = 0; | |||
| if((refundAmount + record.getRefundAmount()) == amount){ | |||
| points = increasedPoints - refundIncreasedPoints; | |||
| }else{ | |||
| points = new BigDecimal(order.getIncreasedPoints()) | |||
| .divide(new BigDecimal(order.getPayAmount()),2,BigDecimal.ROUND_HALF_UP) | |||
| .multiply(new BigDecimal(record.getRefundAmount())) | |||
| .intValue(); | |||
| } | |||
| // int points = 0; | |||
| // if((refundAmount + record.getRefundAmount()) == amount){ | |||
| // points = increasedPoints - refundIncreasedPoints; | |||
| // }else{ | |||
| // points = new BigDecimal(order.getIncreasedPoints()) | |||
| // .divide(new BigDecimal(order.getPayAmount()),2,BigDecimal.ROUND_HALF_UP) | |||
| // .multiply(new BigDecimal(record.getRefundAmount())) | |||
| // .intValue(); | |||
| // } | |||
| int points = order.getIncreasedPoints(); | |||
| creditHistory.setCreditNum(points); | |||
| creditHistory.setSpend(0-record.getRefundAmount()); | |||
| creditHistory.setChangePurpose("Ali商圈消费退款:商户["+record.getMallName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose("支付宝商圈退款:商户["+wxMerchant.getName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| @@ -248,7 +265,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| this.updatePoints(record); | |||
| } | |||
| } | |||
| } | |||
| // } | |||
| redisLock.unlock(lockKey, timeStr); | |||
| }else{ | |||
| @@ -13,6 +13,8 @@ import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| @@ -82,6 +84,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void createOrder(WxBusinessCircleOrder record) { | |||
| String lockKey = StringUtils.join(WX_CIRCLE_KEY,record.getTransactionId(), ":",EnumYesOrNo.NO.getCode(),":", "lock"); | |||
| long time = System.currentTimeMillis() + 2000; | |||
| @@ -104,7 +107,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| if (wxMerchant != null) { | |||
| record.setMerchantId(wxMerchant.getId()); | |||
| } else { | |||
| logger.error("--Wx商圈付款通知消息未找到门店--shopName=" + record.getWxShopName() + "&shopNumber=" + record.getWxShopNumber()); | |||
| logger.error("--wx商圈付款通知消息未找到门店--shopName=" + record.getWxShopName() + "&shopNumber=" + record.getWxShopNumber()); | |||
| } | |||
| WxCUser userQ = new WxCUser(); | |||
| userQ.updateTenantInfo(record); | |||
| @@ -133,7 +136,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| creditHistory.setMerchantId(record.getMerchantId()); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setSpend(record.getPayAmount()); | |||
| creditHistory.setChangePurpose("Wx商圈消费:消费商户["+record.getWxShopName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose("微信商圈消费:商户["+record.getWxShopName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| @@ -167,6 +170,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void insertRefundNoticeOrder(WxBusinessCircleOrder record) { | |||
| WxBusinessCircleOrder order = this.getOrderByTransactionId(record.getTransactionId(),record.getTenantId()); | |||
| if(order == null){ | |||
| @@ -207,6 +211,14 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| record.setMerchantId(order.getMerchantId()); | |||
| wxBusinessCircleOrderMapper.insertRefundNoticeOrder(record); | |||
| if((refundAmount + record.getRefundAmount()) == amount){ | |||
| order.setOrderStatus(2);//全额退款 | |||
| }else{ | |||
| order.setOrderStatus(1);//部分退款 | |||
| } | |||
| order.setUpdateTime(now); | |||
| wxBusinessCircleOrderMapper.updateOrderStatus(order); | |||
| if(order.getEarnPoints().equals(EnumYesOrNo.YES.getCode())){ | |||
| WxCreditHistory creditHistory = new WxCreditHistory(); | |||
| creditHistory.setTenantId(record.getFinalTenantId()); | |||
| @@ -229,7 +241,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| creditHistory.setCreditNum(points); | |||
| creditHistory.setSpend(0-record.getRefundAmount()); | |||
| creditHistory.setChangePurpose("Wx商圈消费退款:商户["+record.getWxShopName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose("微信商圈退款:商户["+record.getWxShopName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| @@ -784,9 +784,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Override | |||
| public boolean hasMerchantEncode(WxMerchant wxMerchant) { | |||
| if(StringUtils.isBlank(wxMerchant.getEncode())){ | |||
| return true; | |||
| return false; | |||
| }else{ | |||
| return wxMerchantMapper.hasMerchant(wxMerchant) > 0 ? true : false; | |||
| return wxMerchantMapper.hasMerchantEncode(wxMerchant) > 0 ? true : false; | |||
| } | |||
| } | |||
| @@ -37,7 +37,7 @@ public class WxThirdPartyApiServiceImpl implements WxThirdPartyApiService { | |||
| @Override | |||
| public WxThirdPartyApi findByApp(String appId, String appKey) { | |||
| if(StringUtils.isBlank(appId) || StringUtils.isBlank(appKey)){ | |||
| if(StringUtils.isBlank(appId)){ | |||
| return null; | |||
| } | |||
| WxThirdPartyApi apiConfig = null; | |||
| @@ -15,14 +15,13 @@ import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import static org.springframework.transaction.annotation.Propagation.REQUIRED; | |||
| @Service | |||
| public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService { | |||
| @@ -73,8 +72,9 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| } | |||
| @Override | |||
| public WxThirdPartyOrders getRefundOrderByRefundId(String refundId, String tenantId) { | |||
| public WxThirdPartyOrders getRefundOrderByRefundId(EnumThirdOrderType orderType,String refundId, String tenantId) { | |||
| WxThirdPartyOrders recordQ = new WxThirdPartyOrders(); | |||
| recordQ.setSourceType(orderType.getCode()); | |||
| recordQ.setRefundId(refundId); | |||
| recordQ.setTenantId(tenantId); | |||
| return wxThirdPartyOrdersMapper.getRefundOrderByRefundId(recordQ); | |||
| @@ -90,6 +90,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void createOrder(WxThirdPartyOrders record) { | |||
| String lockKey = StringUtils.join(THIRD_CIRCLE_KEY,record.getTransactionId(), ":",EnumYesOrNo.NO.getCode(),":", "lock"); | |||
| long time = System.currentTimeMillis() + 2000; | |||
| @@ -113,12 +114,22 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| WxMerchant wxMerchant = wxMerchantService.getMerchantByEncode(record.getShopNumber()); | |||
| if(wxMerchant != null){ | |||
| record.setMerchantId(wxMerchant.getId()); | |||
| record.setShopName(wxMerchant.getName()); | |||
| }else{ | |||
| if(StringUtils.isBlank(record.getShopName())){ | |||
| record.setShopName("第三方门店"); | |||
| } | |||
| logger.info("--第三方付款通知消息未找到门店--shopName="+record.getShopName()+"&shopNumber="+record.getShopNumber()); | |||
| } | |||
| WxCUserBasicInfo basicInfo = null; | |||
| basicInfo = wxCUserBasicInfoService.getById(Long.parseLong(record.getUserNumber()), record.getFinalTenantId()); | |||
| Long userId = null; | |||
| try { | |||
| userId = Long.parseLong(record.getUserNumber()); | |||
| } catch (NumberFormatException e) {} | |||
| if(userId != null){ | |||
| basicInfo = wxCUserBasicInfoService.getById(userId, record.getFinalTenantId()); | |||
| } | |||
| if(basicInfo == null){ | |||
| basicInfo = wxCUserBasicInfoService.registerByPhone(record, record.getUserPhone()); | |||
| } | |||
| @@ -148,7 +159,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| creditHistory.setMerchantId(record.getMerchantId()); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setSpend(record.getPayAmount()); | |||
| creditHistory.setChangePurpose("第三方消费:消费商户["+record.getShopName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose(record.getSourceAppName()+"·消费:商户["+record.getShopName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| @@ -178,15 +189,16 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void insertRefundNoticeOrder(WxThirdPartyOrders record) { | |||
| WxThirdPartyOrders order = this.getOrderByTransactionId(EnumThirdOrderType.RMB_PAY,record.getTransactionId(),record.getTenantId()); | |||
| if(order == null){ | |||
| logger.error("--第三方退款--付款消息未找到--transactionId="+record.getTransactionId()); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "付款消息未找到"); | |||
| }else{ | |||
| WxThirdPartyOrders refundOrder = this.getRefundOrderByRefundId(record.getRefundId(),record.getTenantId()); | |||
| WxThirdPartyOrders refundOrder = this.getRefundOrderByRefundId(EnumThirdOrderType.RMB_PAY,record.getRefundId(),record.getTenantId()); | |||
| if(refundOrder != null){ | |||
| logger.error("--Ali商圈退款--退款消息已存在---RefundId="+record.getRefundId()); | |||
| logger.error("--第三方退款--退款消息已存在---RefundId="+record.getRefundId()); | |||
| }else{ | |||
| String lockKey = StringUtils.join(THIRD_CIRCLE_KEY,record.getRefundId(), ":",EnumYesOrNo.YES.getCode(),":", "lock"); | |||
| long time = System.currentTimeMillis() + 2000; | |||
| @@ -204,6 +216,9 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| refundIncreasedPoints += ro.getIncreasedPoints(); | |||
| } | |||
| } | |||
| if(record.getRefundAmount() == null){ | |||
| record.setRefundAmount(order.getPayAmount()-refundAmount); | |||
| } | |||
| if(refundAmount >= amount){ | |||
| logger.error("--第三方退款--已经退款--transactionId="+record.getTransactionId()); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "已经退款"); | |||
| @@ -218,12 +233,26 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| record.setCreateTime(now); | |||
| record.setUpdateTime(now); | |||
| record.setSourceType(EnumThirdOrderType.RMB_PAY.getCode()); | |||
| record.setShopName(order.getShopName()); | |||
| record.setShopNumber(order.getShopNumber()); | |||
| record.setUserPhone(order.getUserPhone()); | |||
| record.setUserNumber(order.getUserNumber()); | |||
| record.setAmount(order.getAmount()); | |||
| record.setPayAmount(order.getPayAmount()); | |||
| record.setCUserId(order.getCUserId()); | |||
| record.setMerchantId(order.getMerchantId()); | |||
| wxThirdPartyOrdersMapper.insertRefundNoticeOrder(record); | |||
| if((refundAmount + record.getRefundAmount()) == amount){ | |||
| order.setOrderStatus(2);//全额退款 | |||
| }else{ | |||
| order.setOrderStatus(1);//部分退款 | |||
| } | |||
| order.setUpdateTime(now); | |||
| wxThirdPartyOrdersMapper.updateOrderStatus(order); | |||
| if(order.getEarnPoints().equals(EnumYesOrNo.YES.getCode())){ | |||
| WxCreditHistory creditHistory = new WxCreditHistory(); | |||
| creditHistory.setTenantId(record.getFinalTenantId()); | |||
| @@ -246,7 +275,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| creditHistory.setCreditNum(points); | |||
| creditHistory.setSpend(0-record.getRefundAmount()); | |||
| creditHistory.setChangePurpose("第三方消费退款:商户["+record.getShopName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose(record.getSourceAppName()+"·消费退款:商户["+record.getShopName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| @@ -284,13 +313,17 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| wxThirdPartyOrdersMapper.updatePoints(record); | |||
| } | |||
| @Transactional(propagation = REQUIRED ,rollbackFor = Exception.class) | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void pointDeduction(WxThirdPartyOrders record) { | |||
| WxCUserBasicInfo basicInfo = null; | |||
| if(StringUtils.isNotBlank(record.getUserNumber())){ | |||
| basicInfo = wxCUserBasicInfoService.getById(Long.parseLong(record.getUserNumber()), record.getFinalTenantId()); | |||
| Long userId = null; | |||
| try { | |||
| userId = Long.parseLong(record.getUserNumber()); | |||
| } catch (NumberFormatException e) {} | |||
| if(userId != null){ | |||
| basicInfo = wxCUserBasicInfoService.getById(userId, record.getFinalTenantId()); | |||
| } | |||
| if(basicInfo == null){ | |||
| logger.error("--第三方积分订单--未找到用户---userId="+record.getUserNumber()); | |||
| @@ -321,21 +354,31 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| WxMerchant wxMerchant = wxMerchantService.getMerchantByEncode(record.getShopNumber()); | |||
| if(wxMerchant != null){ | |||
| record.setMerchantId(wxMerchant.getId()); | |||
| record.setShopName(wxMerchant.getName()); | |||
| }else{ | |||
| if(StringUtils.isBlank(record.getShopName())){ | |||
| record.setShopName("第三方门店"); | |||
| } | |||
| logger.info("--第三方积分抵扣未找到门店--shopName="+record.getShopName()+"&shopNumber="+record.getShopNumber()); | |||
| } | |||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | |||
| wxCreditHistory.setTenantId(record.getFinalTenantId()); | |||
| wxCreditHistory.setCUserId(basicInfo.getId()); | |||
| wxCreditHistory.setOperatorId(basicInfo.getId()); | |||
| wxCreditHistory.setOperatorType(EnumUserType.THIRD_CIRCLE.getCode()); | |||
| wxCreditHistory.setCreditNum(record.getAmount()); | |||
| wxCreditHistory.setCreditType(EnumScoreType.CHANGE_CREDIT.getCode()); | |||
| wxCreditHistory.setChangePurpose("第三方积分抵扣{}"+record.getSummary()); | |||
| wxCreditHistory.setCouponId(record.getId()); | |||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,record.getTenantId()); | |||
| WxCreditHistory creditHistory = new WxCreditHistory(); | |||
| creditHistory.setTenantId(record.getFinalTenantId()); | |||
| creditHistory.setCUserId(basicInfo.getId()); | |||
| creditHistory.setOperatorId(basicInfo.getId()); | |||
| creditHistory.setOperatorType(EnumUserType.THIRD_CIRCLE.getCode()); | |||
| creditHistory.setCreditNum(record.getPayAmount()); | |||
| creditHistory.setCreditType(EnumScoreType.CHANGE_CREDIT.getCode()); | |||
| creditHistory.setChangePurpose(record.getSourceAppName()+"·积分抵扣-"+record.getPayAmount()+"{"+record.getSummary()+"}"); | |||
| creditHistory.setCouponId(record.getId()); | |||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory, record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| creditNum = creditHistory.getCreditNum(); | |||
| } | |||
| if(creditNum == 0){ | |||
| throw new MallinkException(ErrorCode.CREDIT_ZERO.getCode(), "本次扣减积分为0"); | |||
| } | |||
| wxThirdPartyOrdersMapper.insertNoticeOrder(record); | |||
| } | |||
| redisLock.unlock(lockKey, timeStr); | |||
| @@ -52,6 +52,7 @@ public class Constant { | |||
| public static final String REQUEST_C_USER_KEY = "REQUEST_C_USER"; | |||
| public static final String APP_Id = "APP_Id"; | |||
| public static final String APP_NAME = "APP_NAME"; | |||
| public static final String LOGIN_B_USER_KEY = "LOGIN_B_USER_KEY"; | |||
| @@ -9,7 +9,6 @@ | |||
| <result column="notice_id" jdbcType="VARCHAR" property="noticeId" /> | |||
| <result column="notice_create_time" jdbcType="TIMESTAMP" property="noticeCreateTime"/> | |||
| <result column="notice_event_type" jdbcType="VARCHAR" property="noticeEventType" /> | |||
| <result column="notice_resource_type" jdbcType="VARCHAR" property="noticeResourceType" /> | |||
| <result column="summary" jdbcType="VARCHAR" property="summary" /> | |||
| <result column="mall_id" jdbcType="VARCHAR" property="mallId" /> | |||
| @@ -34,6 +33,7 @@ | |||
| <result column="is_refund" jdbcType="TINYINT" property="isRefund"/> | |||
| <result column="order_status" jdbcType="TINYINT" property="orderStatus"/> | |||
| <result column="refund_id" jdbcType="VARCHAR" property="refundId" /> | |||
| <result column="refund_amount" jdbcType="INTEGER" property="refundAmount"/> | |||
| @@ -42,10 +42,10 @@ | |||
| <sql id="allColumns"> | |||
| `id`, `tenant_id`, `parent_tenant_id`, `notice_id`, `notice_create_time`, `notice_event_type`, | |||
| `notice_resource_type`, `summary`,`mall_id`, `mall_name`, `mall_store_id`, `buyer_id`, | |||
| `time_end`, `amount`, `pay_amount`, `transaction_id`, `create_time`, `update_time`, | |||
| `summary`,`mall_id`, `mall_name`, `mall_store_id`, `buyer_id`, | |||
| `time_end`, `amount`, `pay_amount`, `transaction_id`, `create_time`, `update_time`, | |||
| `merchant_id`, `c_user_id`, `earn_points`, `increased_points`, `points_update_time`, | |||
| `is_refund`, `refund_id`, `refund_amount` | |||
| `is_refund`, `order_status`, `refund_id`, `refund_amount` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -101,6 +101,10 @@ | |||
| and `is_refund` = #{isRefund} | |||
| </if> | |||
| <if test=" null != orderStatus "> | |||
| and `order_status` = #{orderStatus} | |||
| </if> | |||
| <if test=" null != refundId and '' != refundId"> | |||
| and `refund_id` = #{refundId} | |||
| </if> | |||
| @@ -114,14 +118,14 @@ | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxThirdPartyOrders" resultMap="BaseResultMap"> | |||
| <select id="findList" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from ali_business_circle_order | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="getById" parameterType="com.iformall.domain.po.WxThirdPartyOrders" resultMap="BaseResultMap"> | |||
| <select id="getById" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from ali_business_circle_order | |||
| @@ -129,7 +133,7 @@ | |||
| and tenant_id=#{tenantId} | |||
| </select> | |||
| <select id="getOrderByTransactionId" parameterType="com.iformall.domain.po.WxThirdPartyOrders" resultMap="BaseResultMap"> | |||
| <select id="getOrderByTransactionId" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from ali_business_circle_order | |||
| @@ -138,7 +142,7 @@ | |||
| and `transaction_id` = #{transactionId} | |||
| </select> | |||
| <select id="getRefundOrderByRefundId" parameterType="com.iformall.domain.po.WxThirdPartyOrders" resultMap="BaseResultMap"> | |||
| <select id="getRefundOrderByRefundId" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from ali_business_circle_order | |||
| @@ -147,7 +151,7 @@ | |||
| and `refund_id` = #{refundId} | |||
| </select> | |||
| <select id="getRefundOrderByTransactionId" parameterType="com.iformall.domain.po.WxThirdPartyOrders" resultMap="BaseResultMap"> | |||
| <select id="getRefundOrderByTransactionId" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from ali_business_circle_order | |||
| @@ -156,37 +160,44 @@ | |||
| and `transaction_id` = #{transactionId} | |||
| </select> | |||
| <insert id="insertNoticeOrder" parameterType="com.iformall.domain.po.WxThirdPartyOrders" > | |||
| <insert id="insertNoticeOrder" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" > | |||
| INSERT INTO ali_business_circle_order ( | |||
| `id`, `tenant_id`, `parent_tenant_id`, `notice_id`, `notice_create_time`, `notice_event_type`, | |||
| `notice_resource_type`, `summary`, `mall_id`, `mall_name`, `mall_store_id`, `buyer_id`,`time_end`, `amount`, `pay_amount`, `transaction_id`, `create_time`, `update_time`, | |||
| `summary`, `mall_id`, `mall_name`, `mall_store_id`, `buyer_id`,`time_end`, `amount`, `pay_amount`, `transaction_id`, `create_time`, `update_time`, | |||
| `merchant_id`, `c_user_id`, `earn_points`, `is_refund` | |||
| ) | |||
| VALUES( | |||
| #{id},#{tenantId},#{parentTenantId},#{noticeId},#{noticeCreateTime},#{noticeEventType}, | |||
| #{noticeResourceType},#{summary},#{mallId},#{mallName},#{mallStoreId},#{buyerId},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{createTime},#{updateTime}, | |||
| #{summary},#{mallId},#{mallName},#{mallStoreId},#{buyerId},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{createTime},#{updateTime}, | |||
| #{merchantId},#{cUserId},0,0 | |||
| ); | |||
| </insert> | |||
| <update id="updatePoints" parameterType="com.iformall.domain.po.WxThirdPartyOrders"> | |||
| <update id="updatePoints" parameterType="com.iformall.domain.po.AliBusinessCircleOrder"> | |||
| update ali_business_circle_order set | |||
| `earn_points` = 1, `increased_points` = #{increasedPoints}, `points_update_time` = #{pointsUpdateTime}, | |||
| `update_time` = #{updateTime} | |||
| where `id` = #{id} and `tenant_id` = #{tenantId} | |||
| </update> | |||
| <insert id="insertRefundNoticeOrder" parameterType="com.iformall.domain.po.WxThirdPartyOrders" > | |||
| <insert id="insertRefundNoticeOrder" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" > | |||
| INSERT INTO ali_business_circle_order ( | |||
| `id`, `tenant_id`, `parent_tenant_id`,`notice_id`, `notice_create_time`, `notice_event_type`, | |||
| `notice_resource_type`, `summary`,`mall_id`, `mall_name`, `mall_store_id`, `buyer_id`, `time_end`, `amount`,`pay_amount`, `transaction_id`, `create_time`, `update_time`, | |||
| `summary`,`mall_id`, `mall_name`, `mall_store_id`, `buyer_id`, `time_end`, `amount`,`pay_amount`, `transaction_id`, `create_time`, `update_time`, | |||
| `merchant_id`, `c_user_id`, `earn_points`, `is_refund`, `refund_id`, `refund_amount` | |||
| ) | |||
| VALUES( | |||
| #{id},#{tenantId},#{parentTenantId},#{noticeId},#{noticeCreateTime},#{noticeEventType}, | |||
| #{noticeResourceType},#{summary},#{mallId},#{mallName},#{mallStoreId},#{buyerId},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{createTime},#{updateTime}, | |||
| #{summary},#{mallId},#{mallName},#{mallStoreId},#{buyerId},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{createTime},#{updateTime}, | |||
| #{merchantId},#{cUserId},0,1,#{refundId},#{refundAmount} | |||
| ); | |||
| </insert> | |||
| <update id="updateOrderStatus" parameterType="com.iformall.domain.po.AliBusinessCircleOrder"> | |||
| update ali_business_circle_order set | |||
| `order_status` = #{orderStatus}, | |||
| `update_time` = #{updateTime} | |||
| where `id` = #{id} and `tenant_id` = #{tenantId} | |||
| </update> | |||
| </mapper> | |||
| @@ -8,7 +8,6 @@ | |||
| <result column="notice_id" jdbcType="VARCHAR" property="noticeId" /> | |||
| <result column="notice_create_time" jdbcType="TIMESTAMP" property="noticeCreateTime"/> | |||
| <result column="notice_event_type" jdbcType="VARCHAR" property="noticeEventType" /> | |||
| <result column="notice_resource_type" jdbcType="VARCHAR" property="noticeResourceType" /> | |||
| <result column="summary" jdbcType="VARCHAR" property="summary" /> | |||
| <result column="wx_mchid" jdbcType="VARCHAR" property="wxMchid" /> | |||
| <result column="wx_merchant_name" jdbcType="VARCHAR" property="wxMerchantName" /> | |||
| @@ -35,6 +34,7 @@ | |||
| <result column="is_points_notify" jdbcType="TINYINT" property="isPointsNotify"/> | |||
| <result column="is_refund" jdbcType="TINYINT" property="isRefund"/> | |||
| <result column="order_status" jdbcType="TINYINT" property="orderStatus"/> | |||
| <result column="refund_id" jdbcType="VARCHAR" property="refundId" /> | |||
| <result column="refund_amount" jdbcType="INTEGER" property="refundAmount"/> | |||
| @@ -43,10 +43,10 @@ | |||
| <sql id="allColumns"> | |||
| `id`, `tenant_id`, `parent_tenant_id`, `notice_id`, `notice_create_time`, `notice_event_type`, | |||
| `notice_resource_type`, `summary`, `wx_mchid`, `wx_merchant_name`, `wx_shop_name`, `wx_shop_number`, | |||
| `summary`, `wx_mchid`, `wx_merchant_name`, `wx_shop_name`, `wx_shop_number`, | |||
| `appid`, `openid`, `time_end`, `amount`, `pay_amount`, `transaction_id`, `commit_tag`, `create_time`, `update_time`, | |||
| `merchant_id`, `c_user_id`, `earn_points`, `increased_points`, `points_update_time`, `is_points_notify`, | |||
| `is_refund`, `refund_id`, `refund_amount` | |||
| `is_refund`, `order_status`, `refund_id`, `refund_amount` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -122,6 +122,10 @@ | |||
| and `is_refund` = #{isRefund} | |||
| </if> | |||
| <if test=" null != orderStatus "> | |||
| and `order_status` = #{orderStatus} | |||
| </if> | |||
| <if test=" null != refundId and '' != refundId"> | |||
| and `refund_id` = #{refundId} | |||
| </if> | |||
| @@ -180,13 +184,13 @@ | |||
| <insert id="insertNoticeOrder" parameterType="com.iformall.domain.po.WxBusinessCircleOrder" > | |||
| INSERT INTO wx_business_circle_order ( | |||
| `id`, `tenant_id`, `parent_tenant_id`, `notice_id`, `notice_create_time`, `notice_event_type`, | |||
| `notice_resource_type`, `summary`, `wx_mchid`, `wx_merchant_name`, `wx_shop_name`, `wx_shop_number`, | |||
| `summary`, `wx_mchid`, `wx_merchant_name`, `wx_shop_name`, `wx_shop_number`, | |||
| `appid`, `openid`, `time_end`, `amount`, `pay_amount`, `transaction_id`, `commit_tag`, `create_time`, `update_time`, | |||
| `merchant_id`, `c_user_id`, `earn_points`, `is_points_notify`, `is_refund` | |||
| ) | |||
| VALUES( | |||
| #{id},#{tenantId},#{parentTenantId},#{noticeId},#{noticeCreateTime},#{noticeEventType}, | |||
| #{noticeResourceType},#{summary},#{wxMchid},#{wxMerchantName},#{wxShopName},#{wxShopNumber}, | |||
| #{summary},#{wxMchid},#{wxMerchantName},#{wxShopName},#{wxShopNumber}, | |||
| #{appid},#{openid},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{commitTag},#{createTime},#{updateTime}, | |||
| #{merchantId},#{cUserId},0,0,0 | |||
| ); | |||
| @@ -209,16 +213,23 @@ | |||
| <insert id="insertRefundNoticeOrder" parameterType="com.iformall.domain.po.WxBusinessCircleOrder" > | |||
| INSERT INTO wx_business_circle_order ( | |||
| `id`, `tenant_id`, `parent_tenant_id`, `notice_id`, `notice_create_time`, `notice_event_type`, | |||
| `notice_resource_type`, `summary`, `wx_mchid`, `wx_merchant_name`, `wx_shop_name`, `wx_shop_number`, | |||
| `summary`, `wx_mchid`, `wx_merchant_name`, `wx_shop_name`, `wx_shop_number`, | |||
| `appid`, `openid`, `time_end`, `amount`,`pay_amount`, `transaction_id`, `commit_tag`, `create_time`, `update_time`, | |||
| `merchant_id`, `c_user_id`, `earn_points`, `is_refund`, `refund_id`, `refund_amount` | |||
| ) | |||
| VALUES( | |||
| #{id},#{tenantId},#{parentTenantId},#{noticeId},#{noticeCreateTime},#{noticeEventType}, | |||
| #{noticeResourceType},#{summary},#{wxMchid},#{wxMerchantName},#{wxShopName},#{wxShopNumber}, | |||
| #{summary},#{wxMchid},#{wxMerchantName},#{wxShopName},#{wxShopNumber}, | |||
| #{appid},#{openid},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{commitTag},#{createTime},#{updateTime}, | |||
| #{merchantId},#{cUserId},0,1,#{refundId},#{refundAmount} | |||
| ); | |||
| </insert> | |||
| <update id="updateOrderStatus" parameterType="com.iformall.domain.po.WxBusinessCircleOrder"> | |||
| update wx_business_circle_order set | |||
| `order_status` = #{orderStatus}, | |||
| `update_time` = #{updateTime} | |||
| where `id` = #{id} and `tenant_id` = #{tenantId} | |||
| </update> | |||
| </mapper> | |||
| @@ -6,6 +6,7 @@ | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||
| <result column="app_id" jdbcType="VARCHAR" property="appId"/> | |||
| <result column="app_key" jdbcType="VARCHAR" property="appKey"/> | |||
| <result column="sign_key" jdbcType="VARCHAR" property="signKey"/> | |||
| @@ -15,11 +16,12 @@ | |||
| <result column="user_name" jdbcType="VARCHAR" property="userName"/> | |||
| <result column="password" jdbcType="VARCHAR" property="password"/> | |||
| <result column="version" jdbcType="VARCHAR" property="version"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="tp_id" jdbcType="VARCHAR" property="tpId"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`type`,`app_id`,`app_key`,`sign_key`,`api_url`, `token`,`token_expired_time`,`user_name`,`password`,`version`,`tp_id` | |||
| `id`,`tenant_id`,`parent_tenant_id`,`type`,`name`,`app_id`,`app_key`,`sign_key`,`api_url`, `token`,`token_expired_time`,`user_name`,`password`,`version`,`remark`,`tp_id` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -12,7 +12,6 @@ | |||
| <result column="notice_id" jdbcType="VARCHAR" property="noticeId" /> | |||
| <result column="notice_create_time" jdbcType="TIMESTAMP" property="noticeCreateTime"/> | |||
| <result column="notice_event_type" jdbcType="VARCHAR" property="noticeEventType" /> | |||
| <result column="notice_resource_type" jdbcType="VARCHAR" property="noticeResourceType" /> | |||
| <result column="summary" jdbcType="VARCHAR" property="summary" /> | |||
| <result column="shop_name" jdbcType="VARCHAR" property="shopName" /> | |||
| @@ -38,6 +37,7 @@ | |||
| <result column="is_refund" jdbcType="TINYINT" property="isRefund"/> | |||
| <result column="order_status" jdbcType="TINYINT" property="orderStatus"/> | |||
| <result column="refund_id" jdbcType="VARCHAR" property="refundId" /> | |||
| <result column="refund_amount" jdbcType="INTEGER" property="refundAmount"/> | |||
| @@ -46,10 +46,10 @@ | |||
| <sql id="allColumns"> | |||
| `id`, `tenant_id`, `parent_tenant_id`, `source_app_id`, `source_type`,`notice_id`, `notice_create_time`, `notice_event_type`, | |||
| `notice_resource_type`, `summary`,`shop_name`, `shop_number`, `user_phone`, `user_number`, | |||
| `time_end`, `amount`, `pay_amount`, `transaction_id`, `create_time`, `update_time`, | |||
| `summary`,`shop_name`, `shop_number`, `user_phone`, `user_number`, | |||
| `time_end`, `amount`, `pay_amount`, `transaction_id`, `create_time`, `update_time`, | |||
| `merchant_id`, `c_user_id`, `earn_points`, `increased_points`, `points_update_time`, | |||
| `is_refund`, `refund_id`, `refund_amount` | |||
| `is_refund`, `order_status`, `refund_id`, `refund_amount` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -121,6 +121,10 @@ | |||
| and `is_refund` = #{isRefund} | |||
| </if> | |||
| <if test=" null != orderStatus "> | |||
| and `order_status` = #{orderStatus} | |||
| </if> | |||
| <if test=" null != refundId and '' != refundId"> | |||
| and `refund_id` = #{refundId} | |||
| </if> | |||
| @@ -154,7 +158,7 @@ | |||
| <include refid="allColumns"/> | |||
| from wx_third_party_orders | |||
| where `is_refund` = 0 | |||
| and `sourceType` = #{sourceType} | |||
| and `source_type` = #{sourceType} | |||
| and `tenant_id` = #{tenantId} | |||
| and `transaction_id` = #{transactionId} | |||
| </select> | |||
| @@ -164,6 +168,7 @@ | |||
| <include refid="allColumns"/> | |||
| from wx_third_party_orders | |||
| where `is_refund` = 1 | |||
| and `source_type` = #{sourceType} | |||
| and tenant_id = #{tenantId} | |||
| and `refund_id` = #{refundId} | |||
| </select> | |||
| @@ -173,7 +178,7 @@ | |||
| <include refid="allColumns"/> | |||
| from wx_third_party_orders | |||
| where `is_refund` = 1 | |||
| and `sourceType` = #{sourceType} | |||
| and `source_type` = #{sourceType} | |||
| and `tenant_id` = #{tenantId} | |||
| and `transaction_id` = #{transactionId} | |||
| </select> | |||
| @@ -181,12 +186,12 @@ | |||
| <insert id="insertNoticeOrder" parameterType="com.iformall.domain.po.WxThirdPartyOrders" > | |||
| INSERT INTO wx_third_party_orders ( | |||
| `id`, `tenant_id`, `parent_tenant_id`,`source_app_id`, `source_type`, `notice_id`, `notice_create_time`, `notice_event_type`, | |||
| `notice_resource_type`, `summary`, `shop_name`, `shop_number`, `user_phone`, `user_number`,`time_end`, `amount`, `pay_amount`, `transaction_id`, `create_time`, `update_time`, | |||
| `summary`, `shop_name`, `shop_number`, `user_phone`, `user_number`,`time_end`, `amount`, `pay_amount`, `transaction_id`, `create_time`, `update_time`, | |||
| `merchant_id`, `c_user_id`, `earn_points`, `is_refund` | |||
| ) | |||
| VALUES( | |||
| #{id},#{tenantId},#{parentTenantId},#{sourceAppId},#{sourceType},#{noticeId},#{noticeCreateTime},#{noticeEventType}, | |||
| #{noticeResourceType},#{summary},#{shopName},#{shopNumber},#{userPhone},#{userNumber},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{createTime},#{updateTime}, | |||
| #{summary},#{shopName},#{shopNumber},#{userPhone},#{userNumber},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{createTime},#{updateTime}, | |||
| #{merchantId},#{cUserId},0,0 | |||
| ); | |||
| </insert> | |||
| @@ -201,14 +206,21 @@ | |||
| <insert id="insertRefundNoticeOrder" parameterType="com.iformall.domain.po.WxThirdPartyOrders" > | |||
| INSERT INTO wx_third_party_orders ( | |||
| `id`, `tenant_id`, `parent_tenant_id`,`source_app_id`, `source_type`, `notice_id`, `notice_create_time`, `notice_event_type`, | |||
| `notice_resource_type`, `summary`,`shop_name`, `shop_number`, `user_phone`, `user_number`, `time_end`, `amount`,`pay_amount`, `transaction_id`, `create_time`, `update_time`, | |||
| `summary`,`shop_name`, `shop_number`, `user_phone`, `user_number`, `time_end`, `amount`,`pay_amount`, `transaction_id`, `create_time`, `update_time`, | |||
| `merchant_id`, `c_user_id`, `earn_points`, `is_refund`, `refund_id`, `refund_amount` | |||
| ) | |||
| VALUES( | |||
| #{id},#{tenantId},#{parentTenantId},#{sourceAppId},#{sourceType},#{noticeId},#{noticeCreateTime},#{noticeEventType}, | |||
| #{noticeResourceType},#{summary},#{shopName},#{shopNumber},#{userPhone},#{userNumber},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{createTime},#{updateTime}, | |||
| #{summary},#{shopName},#{shopNumber},#{userPhone},#{userNumber},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{createTime},#{updateTime}, | |||
| #{merchantId},#{cUserId},0,1,#{refundId},#{refundAmount} | |||
| ); | |||
| </insert> | |||
| <update id="updateOrderStatus" parameterType="com.iformall.domain.po.WxThirdPartyOrders"> | |||
| update wx_third_party_orders set | |||
| `order_status` = #{orderStatus}, | |||
| `update_time` = #{updateTime} | |||
| where `id` = #{id} and `tenant_id` = #{tenantId} | |||
| </update> | |||
| </mapper> | |||