| @@ -130,7 +130,9 @@ public class WxRentContractController extends BaseController { | |||||
| @SystemControllerLog(description = "租赁合同-添加") | @SystemControllerLog(description = "租赁合同-添加") | ||||
| public ResultData add(@RequestBody WxRentContract wxRentContract) { | public ResultData add(@RequestBody WxRentContract wxRentContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::add"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::add"); | ||||
| if(StringUtils.isBlank(wxRentContract.getBusDiscountRatio())){ | |||||
| wxRentContract.setBusDiscountTime(new Integer(0)); | |||||
| } | |||||
| WxMerchant wxMerchant = new WxMerchant(); | WxMerchant wxMerchant = new WxMerchant(); | ||||
| wxMerchant.setName(wxRentContract.getMerchantName()); | wxMerchant.setName(wxRentContract.getMerchantName()); | ||||
| wxMerchant.setId(wxRentContract.getMerchantId()); | wxMerchant.setId(wxRentContract.getMerchantId()); | ||||
| @@ -169,6 +171,10 @@ public class WxRentContractController extends BaseController { | |||||
| @SystemControllerLog(description = "租赁合同-更新") | @SystemControllerLog(description = "租赁合同-更新") | ||||
| public ResultData update(@RequestBody WxRentContract wxRentContract) { | public ResultData update(@RequestBody WxRentContract wxRentContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::update"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::update"); | ||||
| if(StringUtils.isBlank(wxRentContract.getBusDiscountRatio())){ | |||||
| wxRentContract.setBusDiscountTime(new Integer(0)); | |||||
| } | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxRentContract.setTenantId(user.getTenantId()); | wxRentContract.setTenantId(user.getTenantId()); | ||||
| wxRentContract.setAdjustPeriodHandle(); | wxRentContract.setAdjustPeriodHandle(); | ||||
| @@ -195,6 +201,9 @@ public class WxRentContractController extends BaseController { | |||||
| @SystemControllerLog(description = "租赁合同-更新金额") | @SystemControllerLog(description = "租赁合同-更新金额") | ||||
| public ResultData updateMoney(@RequestBody WxRentContract wxRentContract) { | public ResultData updateMoney(@RequestBody WxRentContract wxRentContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateMoney"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::updateMoney"); | ||||
| if(StringUtils.isBlank(wxRentContract.getBusDiscountRatio())){ | |||||
| wxRentContract.setBusDiscountTime(new Integer(0)); | |||||
| } | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxRentContract.setTenantId(user.getTenantId()); | wxRentContract.setTenantId(user.getTenantId()); | ||||
| wxRentContract.setAdjustPeriodHandle(); | wxRentContract.setAdjustPeriodHandle(); | ||||
| @@ -210,6 +219,9 @@ public class WxRentContractController extends BaseController { | |||||
| @SystemControllerLog(description = "租赁合同-更新文件") | @SystemControllerLog(description = "租赁合同-更新文件") | ||||
| public ResultData updateFile(@RequestBody WxRentContract wxRentContract) { | public ResultData updateFile(@RequestBody WxRentContract wxRentContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateFile"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::updateFile"); | ||||
| if(StringUtils.isBlank(wxRentContract.getBusDiscountRatio())){ | |||||
| wxRentContract.setBusDiscountTime(new Integer(0)); | |||||
| } | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxRentContract.setTenantId(user.getTenantId()); | wxRentContract.setTenantId(user.getTenantId()); | ||||
| wxRentContract.setAdjustPeriodHandle(); | wxRentContract.setAdjustPeriodHandle(); | ||||
| @@ -2,14 +2,10 @@ package com.iformall.controller.rent; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.BaseEntity; | import com.iformall.domain.po.BaseEntity; | ||||
| import com.iformall.domain.po.WxBillRent; | |||||
| import com.iformall.domain.po.WxBillSettle; | import com.iformall.domain.po.WxBillSettle; | ||||
| import com.iformall.domain.po.WxBillSettleRecord; | |||||
| import com.iformall.service.WxBillRentService; | |||||
| import com.iformall.service.WxBillSettleRecordService; | import com.iformall.service.WxBillSettleRecordService; | ||||
| import com.iformall.service.WxBillSettleService; | import com.iformall.service.WxBillSettleService; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -19,7 +15,6 @@ import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| @@ -53,21 +48,13 @@ public class WxBillSettleController extends BaseController { | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @PostMapping("add") | |||||
| @ApiOperation("账单管理-结算单-新增") | |||||
| @SystemControllerLog(description = "账单管理-结算单-新增") | |||||
| public ResultData add(@RequestBody WxBillSettle wxBillSettle) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBillSettleController::add"); | |||||
| @PostMapping("addOrUpdate") | |||||
| @ApiOperation("账单管理-结算单-新增或编辑") | |||||
| @SystemControllerLog(description = "账单管理-结算单-新增或编辑") | |||||
| public ResultData addOrUpdate(@RequestBody WxBillSettle wxBillSettle) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBillSettleController::addOrUpdate"); | |||||
| wxBillSettle.setTenantId(getTenantId()); | wxBillSettle.setTenantId(getTenantId()); | ||||
| return wxBillSettleService.saveOrUpdate(wxBillSettle); | |||||
| } | |||||
| @PostMapping("update") | |||||
| @ApiOperation("账单管理-结算单-更新") | |||||
| @SystemControllerLog(description = "账单管理-结算单-更新") | |||||
| public ResultData update(@RequestBody WxBillSettle wxBillSettle) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBillSettleController::update"); | |||||
| return wxBillSettleService.saveOrUpdate(wxBillSettle); | |||||
| return wxBillSettleService.saveOrUpdate(wxBillSettle,getUser()); | |||||
| } | } | ||||
| @GetMapping("exportSettle") | @GetMapping("exportSettle") | ||||
| @@ -7,6 +7,7 @@ import com.iformall.annotation.UserDataRuleAnnotation; | |||||
| import com.iformall.domain.po.BaseEntity; | import com.iformall.domain.po.BaseEntity; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.WxUserDataRule; | import com.iformall.domain.po.WxUserDataRule; | ||||
| import com.iformall.mapper.WxRentContractMapper; | |||||
| import com.iformall.service.WxUserDataRuleService; | import com.iformall.service.WxUserDataRuleService; | ||||
| import com.iformall.shiro.UserSession; | import com.iformall.shiro.UserSession; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| @@ -37,6 +38,9 @@ public class UserDataRuleAspect { | |||||
| @Autowired | @Autowired | ||||
| private WxUserDataRuleService wxUserDataRuleService; | private WxUserDataRuleService wxUserDataRuleService; | ||||
| @Autowired | |||||
| private WxRentContractMapper wxRentContractMapper; | |||||
| @Pointcut("@annotation(com.iformall.annotation.UserDataRuleAnnotation)") | @Pointcut("@annotation(com.iformall.annotation.UserDataRuleAnnotation)") | ||||
| public void userDataRulePointcut() { | public void userDataRulePointcut() { | ||||
| } | } | ||||
| @@ -90,7 +94,14 @@ public class UserDataRuleAspect { | |||||
| BaseEntity baseEntity = (BaseEntity) args[0]; | BaseEntity baseEntity = (BaseEntity) args[0]; | ||||
| baseEntity.setFloorForRule(buildingFloor); | baseEntity.setFloorForRule(buildingFloor); | ||||
| baseEntity.setBusinessForRule(businessForRule); | baseEntity.setBusinessForRule(businessForRule); | ||||
| String contract = "contract"; | |||||
| if (StringUtils.isNotEmpty(buildingFloor) && value.contains(contract)) { | |||||
| int count = wxRentContractMapper.getShopCountMax(); | |||||
| String[] tempShop = new String[count]; | |||||
| baseEntity.setTempShop(tempShop); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,81 @@ | |||||
| alter table wx_flow_config modify `parent_id` BIGINT(20) NULL DEFAULT NULL; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 789) parent_id, | |||||
| '789' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 790) parent_id, | |||||
| '790' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 1000) parent_id, | |||||
| '1000' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 1001) parent_id, | |||||
| '1001' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 1002) parent_id, | |||||
| '1002' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 1003) parent_id, | |||||
| '1003' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 1004) parent_id, | |||||
| '1004' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 1005) parent_id, | |||||
| '1005' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 1006) parent_id, | |||||
| '1006' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 1007) parent_id, | |||||
| '1007' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 1008) parent_id, | |||||
| '1008' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 1009) parent_id, | |||||
| '1009' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 1010) parent_id, | |||||
| '1010' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 1011) parent_id, | |||||
| '1011' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 1012) parent_id, | |||||
| '1012' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| INSERT INTO `wx_flow_config` (`id`, `parent_id`, `tenant_id`, `name`, `type`, `model_id`, `sort`) | |||||
| select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id, | |||||
| (select id from wx_flow_config where name = '账单审批' and tenant_id = 1013) parent_id, | |||||
| '1013' tenant_id, '结算单审核' name, 10 type, 0 model_id, 2 sort from dual; | |||||
| @@ -0,0 +1 @@ | |||||
| update mall_permission set parent_id=5,icon='icon-quanyiguanli-' where id=513; | |||||
| @@ -0,0 +1,5 @@ | |||||
| alter table wx_pay_order | |||||
| add `pos_payment_type` tinyint(6) NULL COMMENT '支付方式: 0微信;1支付宝;2现金;3会员折扣;4优惠券;5预付卡;6银行卡,来源于POS' after `pay_from`, | |||||
| modify `ip` varchar(20) NULL COMMENT 'ip地址', | |||||
| change column `pos_pay_id` `pos_pay_order_id` bigint(20) NULL COMMENT 'POS支付订单ID', | |||||
| change column `type` `pay_from` tinyint(6) NULL COMMENT '支付类型(0:C端微信支付, 1:POS支付)'; | |||||
| @@ -164,7 +164,7 @@ public class WxCouponOrderController extends BaseController { | |||||
| } | } | ||||
| if(couponOrder != null) { | if(couponOrder != null) { | ||||
| wxCouponOrderService.sendInsideCouponVerifyMsg(couponOrder.getTenantId(), couponOrderId, wxMerchantBUser.getId(), EnumCouponVerifyType.VERIFY_B.getCode()); | |||||
| wxCouponOrderService.sendInsideCouponVerifyMsg(couponOrder.getTenantId(), couponOrderId, wxMerchantBUser.getId()); | |||||
| } | } | ||||
| return new ResultData(couponOrder); | return new ResultData(couponOrder); | ||||
| @@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestBody; | import org.springframework.web.bind.annotation.RequestBody; | ||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.*; | import java.util.*; | ||||
| @RestController | @RestController | ||||
| @@ -30,6 +31,8 @@ public class PosController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| private final SimpleDateFormat neuDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); | |||||
| private final PosService posService; | private final PosService posService; | ||||
| private final ThDevInfoService thDevInfoService; | private final ThDevInfoService thDevInfoService; | ||||
| private final WxCouponOrderService couponOrderService; | private final WxCouponOrderService couponOrderService; | ||||
| @@ -313,12 +316,11 @@ public class PosController extends BaseController { | |||||
| WxPayConstant.RET_FAIL, | WxPayConstant.RET_FAIL, | ||||
| 500, e.getMessage()); | 500, e.getMessage()); | ||||
| } | } | ||||
| doActionAfterVerify(params, retMap, EnumCouponVerifyType.VERIFY_POS_INDEPENDENT); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | ||||
| WxPayConstant.RET_SUCCESS, null); | WxPayConstant.RET_SUCCESS, null); | ||||
| } | } | ||||
| private void doActionAfterVerify(@RequestBody Map<String, String> params, Map<String, String> retMap, EnumCouponVerifyType verifyType) { | |||||
| private void doActionAfterVerify(Map<String, String> params, Map<String, String> retMap) { | |||||
| String tenantId = params.get(WxPayConstant.TENANT_ID); // 租户ID | String tenantId = params.get(WxPayConstant.TENANT_ID); // 租户ID | ||||
| String buUserIdStr = params.get(WxPayConstant.BUSER_ID); // POS操作员ID | String buUserIdStr = params.get(WxPayConstant.BUSER_ID); // POS操作员ID | ||||
| String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券ID | String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券ID | ||||
| @@ -334,7 +336,7 @@ public class PosController extends BaseController { | |||||
| String errCode = retMap.get(WxPayConstant.ERR_CODE); | String errCode = retMap.get(WxPayConstant.ERR_CODE); | ||||
| if(StringUtils.isBlank(errCode)) { | if(StringUtils.isBlank(errCode)) { | ||||
| // 无异常信息,核销成功 | // 无异常信息,核销成功 | ||||
| couponOrderService.sendInsideCouponVerifyMsg(tenantId, couponOrderId, buUserId, verifyType.getCode()); | |||||
| couponOrderService.sendInsideCouponVerifyMsg(tenantId, couponOrderId, buUserId); | |||||
| } | } | ||||
| } | } | ||||
| @@ -450,6 +452,37 @@ public class PosController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| @ApiOperation(value = "POS订单同步", notes = "支付成功/支付取消后订单同步") | |||||
| @PostMapping("/posOrderSync") | |||||
| @SystemControllerLog(description = "POS订单同步") | |||||
| public Map<String, String> posOrderSync(@RequestBody Map<String, String> params) { | |||||
| logger.info(params.toString()); | |||||
| JSONObject payContent = new JSONObject(); | |||||
| // 1. check sign | |||||
| Map<String, String> retMap = checkSign(params, payContent); | |||||
| if (retMap != null) { | |||||
| // 签名相关异常返回 | |||||
| return retMap; | |||||
| } | |||||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||||
| try { | |||||
| retMap = posService.posOrderSync(params); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | |||||
| WxPayConstant.RET_SUCCESS, null); | |||||
| } catch (MallinkException e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | |||||
| WxPayConstant.RET_FAIL, | |||||
| e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | |||||
| WxPayConstant.RET_FAIL, | |||||
| 500, e.getMessage()); | |||||
| } | |||||
| } | |||||
| private Map<String, String> couponOrderPayVerify(@RequestBody Map<String, String> params) { | private Map<String, String> couponOrderPayVerify(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| @@ -474,7 +507,7 @@ public class PosController extends BaseController { | |||||
| 500, e.getMessage()); | 500, e.getMessage()); | ||||
| } | } | ||||
| doActionAfterVerify(params, retMap, EnumCouponVerifyType.VERIFY_POS_PAY); | |||||
| doActionAfterVerify(params, retMap); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | ||||
| WxPayConstant.RET_SUCCESS, null); | WxPayConstant.RET_SUCCESS, null); | ||||
| } | } | ||||
| @@ -531,7 +564,7 @@ public class PosController extends BaseController { | |||||
| String errCode = retMap.get(WxPayConstant.VERIFY); | String errCode = retMap.get(WxPayConstant.VERIFY); | ||||
| if(errCode.equalsIgnoreCase(WxPayConstant.TRUE)) { | if(errCode.equalsIgnoreCase(WxPayConstant.TRUE)) { | ||||
| // 核销成功 | // 核销成功 | ||||
| couponOrderService.sendInsideCouponVerifyMsg(tenantId, couponOrderId, buUserId, EnumCouponVerifyType.VERIFY_POS_PAY.getCode()); | |||||
| couponOrderService.sendInsideCouponVerifyMsg(tenantId, couponOrderId, buUserId); | |||||
| } | } | ||||
| } | } | ||||
| @@ -670,36 +703,6 @@ public class PosController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| @ApiOperation(value = "POS订单同步", notes = "支付成功/支付取消后订单同步") | |||||
| @PostMapping("/posOrderSync") | |||||
| @SystemControllerLog(description = "POS订单同步") | |||||
| public Map<String, String> posOrderSync(@RequestBody Map<String, String> params) { | |||||
| logger.info(params.toString()); | |||||
| JSONObject payContent = new JSONObject(); | |||||
| // 1. check sign | |||||
| Map<String, String> retMap = checkSign(params, payContent); | |||||
| if (retMap != null) { | |||||
| // 签名相关异常返回 | |||||
| return retMap; | |||||
| } | |||||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||||
| try { | |||||
| } catch (MallinkException e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | |||||
| WxPayConstant.RET_FAIL, | |||||
| e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | |||||
| WxPayConstant.RET_FAIL, | |||||
| 500, e.getMessage()); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| /** | /** | ||||
| * 构造返回map,无签名, 有错误 | * 构造返回map,无签名, 有错误 | ||||
| @@ -717,6 +720,7 @@ public class PosController extends BaseController { | |||||
| retMap.put(WxPayConstant.RESULT_CODE, resCode); | retMap.put(WxPayConstant.RESULT_CODE, resCode); | ||||
| retMap.put(WxPayConstant.ERR_CODE, "" + errCode); | retMap.put(WxPayConstant.ERR_CODE, "" + errCode); | ||||
| retMap.put(WxPayConstant.ERR_CODE_DES, errMsg); | retMap.put(WxPayConstant.ERR_CODE_DES, errMsg); | ||||
| retMap.put(WxPayConstant.TIMESTAMP, neuDateFormat.format(new Date())); | |||||
| return retMap; | return retMap; | ||||
| } | } | ||||
| @@ -737,6 +741,8 @@ public class PosController extends BaseController { | |||||
| retMap.put(WxPayConstant.RETURN_CODE, retCode); | retMap.put(WxPayConstant.RETURN_CODE, retCode); | ||||
| retMap.put(WxPayConstant.RETURN_MSG, retMsg); | retMap.put(WxPayConstant.RETURN_MSG, retMsg); | ||||
| retMap.put(WxPayConstant.RESULT_CODE, resCode); | retMap.put(WxPayConstant.RESULT_CODE, resCode); | ||||
| retMap.put(WxPayConstant.TIMESTAMP, neuDateFormat.format(new Date())); | |||||
| if (err != null) { | if (err != null) { | ||||
| retMap.put(WxPayConstant.ERR_CODE, "" + err.getCode()); | retMap.put(WxPayConstant.ERR_CODE, "" + err.getCode()); | ||||
| retMap.put(WxPayConstant.ERR_CODE_DES, err.getMessage()); | retMap.put(WxPayConstant.ERR_CODE_DES, err.getMessage()); | ||||
| @@ -764,6 +770,7 @@ public class PosController extends BaseController { | |||||
| retMap.put(WxPayConstant.RESULT_CODE, resCode); | retMap.put(WxPayConstant.RESULT_CODE, resCode); | ||||
| retMap.put(WxPayConstant.ERR_CODE, "" + errCode); | retMap.put(WxPayConstant.ERR_CODE, "" + errCode); | ||||
| retMap.put(WxPayConstant.ERR_CODE_DES, errMsg); | retMap.put(WxPayConstant.ERR_CODE_DES, errMsg); | ||||
| retMap.put(WxPayConstant.TIMESTAMP, neuDateFormat.format(new Date())); | |||||
| return WxPayment.buildSignAfterParasMapForHMAC(retMap, resKey); | return WxPayment.buildSignAfterParasMapForHMAC(retMap, resKey); | ||||
| } | } | ||||
| @@ -1103,12 +1103,27 @@ public class PosServiceImpl implements PosService { | |||||
| // 核销取消 | // 核销取消 | ||||
| if (couponOrderCVo.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()) && | if (couponOrderCVo.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()) && | ||||
| actionType.equals(EnumPosActionType.VERIFY_CANCEL)) { | actionType.equals(EnumPosActionType.VERIFY_CANCEL)) { | ||||
| // 检查是否有发放的券, 有则无法退券 | |||||
| try { | |||||
| cancelVerify(couponOrderCVo, buUserId, posOrderId); | |||||
| retMap.put(WxPayConstant.CANCEL, WxPayConstant.TRUE); | |||||
| return retMap; | |||||
| } catch (MallinkException e) { | |||||
| logger.error(e.getMessage()); | |||||
| throw new MallinkException(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| /* | |||||
| logger.info("券已被核销无法取消: " + couponOrderIdStr); | logger.info("券已被核销无法取消: " + couponOrderIdStr); | ||||
| retMap.put(WxPayConstant.CANCEL, WxPayConstant.FALSE); | retMap.put(WxPayConstant.CANCEL, WxPayConstant.FALSE); | ||||
| String errMessage = String.format("此券核销后无法退回,原价:%s元, 售价:%s元", coupon.getPriceStr(), couponOrderCVo.getCouponPriceStr()); | |||||
| // TODO 系统发放的券 | |||||
| Map cancelMap = new HashMap(); | |||||
| cancelMap.put(WxPayConstant.PRICE, coupon.getPrice()); | |||||
| cancelMap.put(WxPayConstant.SALE_PRICE, coupon.getSalePrice()); | |||||
| retMap.put(WxPayConstant.CANCEL_JSON, JSON.toJSONString(cancelMap)); | |||||
| String errMessage = String.format("此券核销后无法退回,原价:%s元, 售价:%s元", coupon.getPriceStr(), coupon.getSalePriceStr()); | |||||
| // TODO 系统发放的券, 也加入核销信息中 | |||||
| retMap.put(WxPayConstant.CANCEL_DES, errMessage); | retMap.put(WxPayConstant.CANCEL_DES, errMessage); | ||||
| return retMap; | return retMap; | ||||
| */ | |||||
| } | } | ||||
| String errMessage = "取消异常:未知的核销状态-" + couponOrderCVo.getCouponOrderStatus()+ ", 核销action-" + actionType.getCode(); | String errMessage = "取消异常:未知的核销状态-" + couponOrderCVo.getCouponOrderStatus()+ ", 核销action-" + actionType.getCode(); | ||||
| logger.error(errMessage); | logger.error(errMessage); | ||||
| @@ -1243,6 +1258,7 @@ public class PosServiceImpl implements PosService { | |||||
| } | } | ||||
| // 2. update couponOrder | // 2. update couponOrder | ||||
| Date curDate = new Date(); | |||||
| try { | try { | ||||
| WxCouponOrder couponOrder = new WxCouponOrder(); | WxCouponOrder couponOrder = new WxCouponOrder(); | ||||
| couponOrder.setId(couponOrderCVo.getId()); | couponOrder.setId(couponOrderCVo.getId()); | ||||
| @@ -1257,7 +1273,7 @@ public class PosServiceImpl implements PosService { | |||||
| actionType.equals(EnumPosActionType.VERIFY_PAY)) { | actionType.equals(EnumPosActionType.VERIFY_PAY)) { | ||||
| couponOrder.setBUserId(buUserId); | couponOrder.setBUserId(buUserId); | ||||
| } | } | ||||
| couponOrder.setUpdateDate(new Date()); | |||||
| couponOrder.setUpdateDate(curDate); | |||||
| if (couponOrder.getBUserId() == null) { | if (couponOrder.getBUserId() == null) { | ||||
| num = couponOrderMapper.updateVerifyCouponOrder(couponOrder); | num = couponOrderMapper.updateVerifyCouponOrder(couponOrder); | ||||
| } else { | } else { | ||||
| @@ -1755,6 +1771,7 @@ public class PosServiceImpl implements PosService { | |||||
| String merchantIdStr = params.get(WxPayConstant.NEU_MERCHANT_ID); // 商户ID | String merchantIdStr = params.get(WxPayConstant.NEU_MERCHANT_ID); // 商户ID | ||||
| String buUserIdStr = params.get(WxPayConstant.NEU_BU_USER_ID); // POS操作员ID | String buUserIdStr = params.get(WxPayConstant.NEU_BU_USER_ID); // POS操作员ID | ||||
| String cuUserIdStr = params.get(WxPayConstant.NEU_MEM_ID); // 富茂系统会员ID | String cuUserIdStr = params.get(WxPayConstant.NEU_MEM_ID); // 富茂系统会员ID | ||||
| String sceneTypeStr = params.get(WxPayConstant.NEU_ORDER_SCENE_TYPE); // 场景类型 | |||||
| String posOrderIdStr = params.get(WxPayConstant.NEU_ORDER_ID); // POS订单ID | String posOrderIdStr = params.get(WxPayConstant.NEU_ORDER_ID); // POS订单ID | ||||
| String posOrderTimeStr = params.get(WxPayConstant.NEU_ORDER_TIME); // POS订单时间 | String posOrderTimeStr = params.get(WxPayConstant.NEU_ORDER_TIME); // POS订单时间 | ||||
| String posAmountStr = params.get(WxPayConstant.NEU_ORDER_AMOUNT); // POS订单总额 | String posAmountStr = params.get(WxPayConstant.NEU_ORDER_AMOUNT); // POS订单总额 | ||||
| @@ -1778,6 +1795,9 @@ public class PosServiceImpl implements PosService { | |||||
| if (StringUtils.isBlank(cuUserIdStr)) { | if (StringUtils.isBlank(cuUserIdStr)) { | ||||
| errParam(WxPayConstant.NEU_MEM_ID); | errParam(WxPayConstant.NEU_MEM_ID); | ||||
| } | } | ||||
| if (StringUtils.isBlank(sceneTypeStr)) { | |||||
| errParam(WxPayConstant.NEU_ORDER_SCENE_TYPE); | |||||
| } | |||||
| if (StringUtils.isBlank(posOrderIdStr)) { | if (StringUtils.isBlank(posOrderIdStr)) { | ||||
| errParam(WxPayConstant.NEU_ORDER_ID); | errParam(WxPayConstant.NEU_ORDER_ID); | ||||
| } | } | ||||
| @@ -1792,14 +1812,16 @@ public class PosServiceImpl implements PosService { | |||||
| } | } | ||||
| Long merchantId, buUserId, posOrderId, memId; | Long merchantId, buUserId, posOrderId, memId; | ||||
| Integer posAmount = 0; | |||||
| Long posAmount = 0L; | |||||
| Integer sceneType; | |||||
| Date orderTime = null; | Date orderTime = null; | ||||
| try { | try { | ||||
| merchantId = Long.valueOf(merchantIdStr); | merchantId = Long.valueOf(merchantIdStr); | ||||
| buUserId = Long.valueOf(buUserIdStr); | buUserId = Long.valueOf(buUserIdStr); | ||||
| memId = Long.valueOf(cuUserIdStr); | memId = Long.valueOf(cuUserIdStr); | ||||
| sceneType = Integer.valueOf(sceneTypeStr); | |||||
| posOrderId = Long.valueOf(posOrderIdStr); | posOrderId = Long.valueOf(posOrderIdStr); | ||||
| posAmount = Integer.valueOf(posAmountStr); | |||||
| posAmount = Long.valueOf(posAmountStr); | |||||
| } catch (NumberFormatException e) { | } catch (NumberFormatException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage()); | throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage()); | ||||
| @@ -1813,9 +1835,9 @@ public class PosServiceImpl implements PosService { | |||||
| // 2. check merchant | // 2. check merchant | ||||
| WxMerchant merchant = checkAndGetMerchant(merchantId); | WxMerchant merchant = checkAndGetMerchant(merchantId); | ||||
| // 3. check buUser | // 3. check buUser | ||||
| final WxMerchantBUser merchantBUser = checkAndGetMerchantUser(merchantId, buUserId); | |||||
| WxMerchantBUser merchantBUser = checkAndGetMerchantUser(buUserId, merchantId); | |||||
| if (posStatusStr.equalsIgnoreCase(WxPayConstant.NEU_ORDER_PAY)) { | if (posStatusStr.equalsIgnoreCase(WxPayConstant.NEU_ORDER_PAY)) { | ||||
| WxOrder order = createOrderByPos(merchantBUser, memId, posOrderId, posAmount, orderTime); | |||||
| WxOrder order = createOrderByPos(merchantBUser, memId, posOrderId, posAmount.intValue(), orderTime); | |||||
| String payDetail = params.get(WxPayConstant.NEU_PAY_DETAIL); | String payDetail = params.get(WxPayConstant.NEU_PAY_DETAIL); | ||||
| JSONObject payDetailObj = JSON.parseObject(payDetail); | JSONObject payDetailObj = JSON.parseObject(payDetail); | ||||
| JSONArray payDetailList = payDetailObj.getJSONArray(WxPayConstant.NEU_PAY_DETAIL_LIST); | JSONArray payDetailList = payDetailObj.getJSONArray(WxPayConstant.NEU_PAY_DETAIL_LIST); | ||||
| @@ -1841,13 +1863,14 @@ public class PosServiceImpl implements PosService { | |||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage()); | throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage()); | ||||
| } | } | ||||
| if (neuPayOrderType.equalsIgnoreCase(String.valueOf(EnumNeuPosPamentType.MEM_DISCOUNT.getCode()))) { | |||||
| if (neuPayOrderType.equals(String.valueOf(EnumNeuPosPamentType.MEM_DISCOUNT.getCode()))) { | |||||
| // 会员折扣 | // 会员折扣 | ||||
| WxPayOrder payOrder = payOrderFromMemDiscount(merchantBUser, order, memId, neuPayOrderId, neuPaymentAmount, neuPosPayOrderTime); | WxPayOrder payOrder = payOrderFromMemDiscount(merchantBUser, order, memId, neuPayOrderId, neuPaymentAmount, neuPosPayOrderTime); | ||||
| } else if (neuPayOrderType.equalsIgnoreCase(String.valueOf(EnumNeuPosPamentType.MEM_COUPON.getCode()))) { | |||||
| // 优惠券, 交易核销 | |||||
| WxPayOrder payOrder = payOrderFromCouponVerify(merchantBUser, order, memId, neuPayOrderId, neuPaymentAmount, neuPosPayOrderTime, neuPayThirdNo); | |||||
| } else if (neuPayOrderType.equalsIgnoreCase(String.valueOf(EnumNeuPosPamentType.MEM_CARD.getCode()))) { | |||||
| } else if (neuPayOrderType.equals(String.valueOf(EnumNeuPosPamentType.MEM_COUPON.getCode()))) { | |||||
| // 优惠券 | |||||
| WxPayOrder payOrder = payOrderFromCouponVerify(merchantBUser, order, memId, sceneType, | |||||
| neuPayOrderId, neuPaymentAmount, neuPosPayOrderTime, neuPayThirdNo); | |||||
| } else if (neuPayOrderType.equals(String.valueOf(EnumNeuPosPamentType.MEM_CARD.getCode()))) { | |||||
| // 预付卡, 不能退 | // 预付卡, 不能退 | ||||
| WxPayOrder payOrder = payOrderFromCard(merchantBUser, order, memId, neuPayOrderId, neuPaymentAmount, neuPosPayOrderTime, neuPayThirdNo); | WxPayOrder payOrder = payOrderFromCard(merchantBUser, order, memId, neuPayOrderId, neuPaymentAmount, neuPosPayOrderTime, neuPayThirdNo); | ||||
| } else { | } else { | ||||
| @@ -1939,6 +1962,7 @@ public class PosServiceImpl implements PosService { | |||||
| WxMerchantBUser merchantBUser, | WxMerchantBUser merchantBUser, | ||||
| WxOrder order, | WxOrder order, | ||||
| Long memId, | Long memId, | ||||
| Integer sceneType, | |||||
| Long posPayOrderId, String neuPaymentAmount, Date neuPosPayOrderTime, String posPayOrderNo) { | Long posPayOrderId, String neuPaymentAmount, Date neuPosPayOrderTime, String posPayOrderNo) { | ||||
| // 1. insert into PayOrder | // 1. insert into PayOrder | ||||
| WxPayOrder payOrder = new WxPayOrder() {{ | WxPayOrder payOrder = new WxPayOrder() {{ | ||||
| @@ -1948,6 +1972,7 @@ public class PosServiceImpl implements PosService { | |||||
| setId(id); | setId(id); | ||||
| setTenantId(merchantBUser.getTenantId()); | setTenantId(merchantBUser.getTenantId()); | ||||
| setCUserId(memId); | setCUserId(memId); | ||||
| setBUserId(merchantBUser.getId()); | |||||
| setOrderId(order.getId()); | setOrderId(order.getId()); | ||||
| setCreateTime(curDate); | setCreateTime(curDate); | ||||
| setUpdateTime(curDate); | setUpdateTime(curDate); | ||||
| @@ -1958,9 +1983,10 @@ public class PosServiceImpl implements PosService { | |||||
| setPayVendor(EnumPayWay.PAY_WAY_POS_NEU.getCode()); | setPayVendor(EnumPayWay.PAY_WAY_POS_NEU.getCode()); | ||||
| setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | ||||
| setShare(EnumPayShare.NO.getCode()); | setShare(EnumPayShare.NO.getCode()); | ||||
| setPayFrom(EnumPayFrom.POS.getCode()); | |||||
| setPosPayOrderId(posPayOrderId); | setPosPayOrderId(posPayOrderId); | ||||
| setPosPayOrderTime(neuPosPayOrderTime.getTime()); | setPosPayOrderTime(neuPosPayOrderTime.getTime()); | ||||
| setPosPaymentType(EnumNeuPosPamentType.MEM_DISCOUNT.getCode()); | |||||
| setPosPaymentType(EnumNeuPosPamentType.MEM_COUPON.getCode()); | |||||
| setPosPayDes("POS优惠券支付"); | setPosPayDes("POS优惠券支付"); | ||||
| setPosPayOrderNo(posPayOrderNo); | setPosPayOrderNo(posPayOrderNo); | ||||
| }}; | }}; | ||||
| @@ -1969,7 +1995,13 @@ public class PosServiceImpl implements PosService { | |||||
| logger.error("pay order insert error: " + payOrder.toString()); | logger.error("pay order insert error: " + payOrder.toString()); | ||||
| throw new MallinkException(ErrorCode.DB_FAIL); | throw new MallinkException(ErrorCode.DB_FAIL); | ||||
| } | } | ||||
| // 2. 核销 | |||||
| Long couponOrderId = Long.valueOf(posPayOrderNo); | |||||
| // 2. 预核销->核销 | |||||
| if (sceneType.equals(EnumPosSceneType.PAY.getCode())) { | |||||
| // TODO | |||||
| } | |||||
| // 3. 核销后处理 | |||||
| couponOrderService.sendInsideCouponVerifyMsg(merchantBUser.getTenantId(), couponOrderId, merchantBUser.getId()); | |||||
| return payOrder; | return payOrder; | ||||
| } | } | ||||
| @@ -1,5 +1,7 @@ | |||||
| package com.iformall.pos.test; | package com.iformall.pos.test; | ||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.fasterxml.jackson.databind.ObjectMapper; | import com.fasterxml.jackson.databind.ObjectMapper; | ||||
| import com.iformall.PosApplication; | import com.iformall.PosApplication; | ||||
| @@ -23,6 +25,8 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; | |||||
| import org.springframework.test.web.servlet.result.MockMvcResultHandlers; | import org.springframework.test.web.servlet.result.MockMvcResultHandlers; | ||||
| import org.springframework.test.web.servlet.result.MockMvcResultMatchers; | import org.springframework.test.web.servlet.result.MockMvcResultMatchers; | ||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.Date; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -41,6 +45,8 @@ public class PosAppTest { | |||||
| @Autowired | @Autowired | ||||
| private MockMvc mockMvc; | private MockMvc mockMvc; | ||||
| private static final SimpleDateFormat neuDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); | |||||
| private static final String devId = "neupos"; | private static final String devId = "neupos"; | ||||
| private static final String devReqKey = "qVH2YDmXJ$ok4a95"; | private static final String devReqKey = "qVH2YDmXJ$ok4a95"; | ||||
| private static final String devResKey = "VE#1fB2PhUe@&3Of"; | private static final String devResKey = "VE#1fB2PhUe@&3Of"; | ||||
| @@ -51,6 +57,8 @@ public class PosAppTest { | |||||
| private static final String phone = "13120223636"; | private static final String phone = "13120223636"; | ||||
| private static final String password = "drpos345"; | private static final String password = "drpos345"; | ||||
| private static final String posSN = "1"; | |||||
| /* | /* | ||||
| 可用的交易券, 支付可用(1, 2, 6), 核销可用(4, 6, 8, 9) | 可用的交易券, 支付可用(1, 2, 6), 核销可用(4, 6, 8, 9) | ||||
| coupon_order_id, coupon_type, 售价, 面额, cancellable | coupon_order_id, coupon_type, 售价, 面额, cancellable | ||||
| @@ -106,20 +114,7 @@ public class PosAppTest { | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | reqObj.put(WxPayConstant.TENANT_ID, tenantId); | ||||
| reqObj.put(WxPayConstant.PHONE, phone); | reqObj.put(WxPayConstant.PHONE, phone); | ||||
| reqObj.put(WxPayConstant.PASSWORD, password); | reqObj.put(WxPayConstant.PASSWORD, password); | ||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/checkUserPassword") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| System.out.println("response sign: " + resSigned); | |||||
| boolean resSigned = sendAndRes("/checkUserPassword", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | Assert.assertEquals(resSigned, true); | ||||
| } | } | ||||
| @Test | @Test | ||||
| @@ -128,20 +123,7 @@ public class PosAppTest { | |||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | reqObj.put(WxPayConstant.NONCE_STR, "1"); | ||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | reqObj.put(WxPayConstant.DEV_ID, devId); | ||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | reqObj.put(WxPayConstant.TENANT_ID, tenantId); | ||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/getPosMemConfig") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| System.out.println("response sign: " + resSigned); | |||||
| boolean resSigned = sendAndRes("/getPosMemConfig", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | Assert.assertEquals(resSigned, true); | ||||
| } | } | ||||
| @@ -151,19 +133,7 @@ public class PosAppTest { | |||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | reqObj.put(WxPayConstant.NONCE_STR, "1"); | ||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | reqObj.put(WxPayConstant.DEV_ID, devId); | ||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | reqObj.put(WxPayConstant.TENANT_ID, tenantId); | ||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/getQrCode") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| boolean resSigned = sendAndRes("/getQrCode", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | Assert.assertEquals(resSigned, true); | ||||
| } | } | ||||
| @@ -173,7 +143,22 @@ public class PosAppTest { | |||||
| String phone = "13910154397"; | String phone = "13910154397"; | ||||
| String posOrderId = "1"; | String posOrderId = "1"; | ||||
| String posAmount = "200"; | String posAmount = "200"; | ||||
| doCheckMem(memId, phone, posOrderId, posAmount); | |||||
| Map<String, String> reqObj = new HashMap<>(); | |||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | |||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | |||||
| if (StringUtils.isNotBlank(memId)) { | |||||
| reqObj.put(WxPayConstant.MEM_ID, memId); | |||||
| } | |||||
| if (StringUtils.isNotBlank(phone)) { | |||||
| reqObj.put(WxPayConstant.MEM_PHONE, phone); | |||||
| } | |||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | |||||
| reqObj.put(WxPayConstant.POS_AMOUNT, posAmount); | |||||
| boolean resSigned = sendAndRes("/checkMem", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | } | ||||
| @Test | @Test | ||||
| @@ -182,7 +167,22 @@ public class PosAppTest { | |||||
| String phone = "13910154397"; | String phone = "13910154397"; | ||||
| String posAmount = "20000"; | String posAmount = "20000"; | ||||
| String selCoList = "[\"321877927162249216\"]"; | String selCoList = "[\"321877927162249216\"]"; | ||||
| doCalcMem(memId, phone, posAmount, selCoList); | |||||
| Map<String, String> reqObj = new HashMap<>(); | |||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | |||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | |||||
| if (StringUtils.isNotBlank(memId)) { | |||||
| reqObj.put(WxPayConstant.MEM_ID, memId); | |||||
| } | |||||
| if (StringUtils.isNotBlank(phone)) { | |||||
| reqObj.put(WxPayConstant.MEM_PHONE, phone); | |||||
| } | |||||
| reqObj.put(WxPayConstant.POS_AMOUNT, posAmount); | |||||
| reqObj.put(WxPayConstant.SELECTED_COUPON_ORDER_LIST, selCoList); | |||||
| boolean resSigned = sendAndRes("/calcMem", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | } | ||||
| @Test | @Test | ||||
| @@ -217,6 +217,57 @@ public class PosAppTest { | |||||
| doCouponOrderVerifyCancel(couponOrderId, posOrderId); | doCouponOrderVerifyCancel(couponOrderId, posOrderId); | ||||
| } | } | ||||
| @Test | |||||
| public void verifySyncTest() throws Exception { | |||||
| String memId = "321178010928119808"; | |||||
| String memPhone = "13910154397"; | |||||
| String sceneType = "2"; // 核销 | |||||
| String posOrderId = "1"; | |||||
| String posAmount = "20000"; | |||||
| String posPayOrderId = "1"; | |||||
| String posPaymentType = "4"; | |||||
| String posPaymentTypeDes = "优惠券"; | |||||
| String posPaymentStatus = "0"; | |||||
| String couponOrderId = "321878223800205312"; | |||||
| Date curDate = new Date(); | |||||
| Map<String, String> payDetailOne = new HashMap<>(); | |||||
| payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_ID, posPayOrderId); | |||||
| payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_TIME, neuDateFormat.format(curDate)); | |||||
| payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_TYPE, posPaymentType); | |||||
| payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_TYPE_DES, posPaymentTypeDes); | |||||
| payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_PARAM, "{}"); | |||||
| payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_STATUS, posPaymentStatus); | |||||
| payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_OUT_NO, couponOrderId); | |||||
| payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_AMOUNT, posAmount); | |||||
| payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_OUT_TIME, neuDateFormat.format(curDate)); | |||||
| JSONArray payDetailList = new JSONArray(); | |||||
| payDetailList.add(payDetailOne); | |||||
| Map<String, String> reqObj = new HashMap<>(); | |||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | |||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | |||||
| reqObj.put(WxPayConstant.NEU_TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.NEU_MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.NEU_BU_USER_ID, buUserId); | |||||
| reqObj.put(WxPayConstant.NEU_MEM_ID, memId); | |||||
| reqObj.put(WxPayConstant.NEU_MEM_PHONE, memPhone); | |||||
| reqObj.put(WxPayConstant.NEU_ORDER_SCENE_TYPE, sceneType); | |||||
| reqObj.put(WxPayConstant.NEU_ORDER_ID, posOrderId); | |||||
| reqObj.put(WxPayConstant.NEU_ORDER_TIME, neuDateFormat.format(curDate)); | |||||
| reqObj.put(WxPayConstant.NEU_ORDER_AMOUNT, posAmount); | |||||
| reqObj.put(WxPayConstant.NEU_ORDER_CREATE_SN, posSN); | |||||
| reqObj.put(WxPayConstant.NEU_ORDER_STATUS, "0"); | |||||
| JSONObject payDetail = new JSONObject(); | |||||
| payDetail.put(WxPayConstant.NEU_PAY_DETAIL_LIST, JSON.toJSONString(payDetailList)); | |||||
| reqObj.put(WxPayConstant.NEU_PAY_DETAIL, JSON.toJSONString(payDetail)); | |||||
| boolean resSigned = sendAndRes("/posOrderSync", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | |||||
| @Test | @Test | ||||
| public void couponOrderPreVerifyTest() throws Exception { | public void couponOrderPreVerifyTest() throws Exception { | ||||
| String couponOrderId = "321877927162249216"; | String couponOrderId = "321877927162249216"; | ||||
| @@ -264,67 +315,7 @@ public class PosAppTest { | |||||
| doCardPayPreCancel(cardId, cardSpendId, posOrderId); | doCardPayPreCancel(cardId, cardSpendId, posOrderId); | ||||
| } | } | ||||
| private void doCheckMem(String memId, String phone, String posOrderId, String posAmount) throws Exception { | |||||
| Map<String, String> reqObj = new HashMap<>(); | |||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | |||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | |||||
| if (StringUtils.isNotBlank(memId)) { | |||||
| reqObj.put(WxPayConstant.MEM_ID, memId); | |||||
| } | |||||
| if (StringUtils.isNotBlank(phone)) { | |||||
| reqObj.put(WxPayConstant.MEM_PHONE, phone); | |||||
| } | |||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | |||||
| reqObj.put(WxPayConstant.POS_AMOUNT, posAmount); | |||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/checkMem") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | |||||
| private void doCalcMem(String memId, String phone, String posAmount, String selCoList) throws Exception { | |||||
| Map<String, String> reqObj = new HashMap<>(); | |||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | |||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | |||||
| if (StringUtils.isNotBlank(memId)) { | |||||
| reqObj.put(WxPayConstant.MEM_ID, memId); | |||||
| } | |||||
| if (StringUtils.isNotBlank(phone)) { | |||||
| reqObj.put(WxPayConstant.MEM_PHONE, phone); | |||||
| } | |||||
| reqObj.put(WxPayConstant.POS_AMOUNT, posAmount); | |||||
| reqObj.put(WxPayConstant.SELECTED_COUPON_ORDER_LIST, selCoList); | |||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/calcMem") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | |||||
| private void doCheckCouponOrder(String couponOrderId, String sceneType, String posOrderId, String posAmount) throws Exception { | private void doCheckCouponOrder(String couponOrderId, String sceneType, String posOrderId, String posAmount) throws Exception { | ||||
| Map<String, String> reqObj = new HashMap<>(); | Map<String, String> reqObj = new HashMap<>(); | ||||
| @@ -337,19 +328,7 @@ public class PosAppTest { | |||||
| reqObj.put(WxPayConstant.SCENE_TYPE, sceneType); | reqObj.put(WxPayConstant.SCENE_TYPE, sceneType); | ||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | ||||
| reqObj.put(WxPayConstant.POS_AMOUNT, posAmount); | reqObj.put(WxPayConstant.POS_AMOUNT, posAmount); | ||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/checkCouponOrder") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String, String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| boolean resSigned = sendAndRes("/checkCouponOrder", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | Assert.assertEquals(resSigned, true); | ||||
| } | } | ||||
| @@ -362,20 +341,7 @@ public class PosAppTest { | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | reqObj.put(WxPayConstant.BUSER_ID, buUserId); | ||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId); | reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId); | ||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | ||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/couponOrderVerify") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| boolean resSigned = sendAndRes("/couponOrderVerify", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | Assert.assertEquals(resSigned, true); | ||||
| } | } | ||||
| @@ -388,19 +354,7 @@ public class PosAppTest { | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | reqObj.put(WxPayConstant.BUSER_ID, buUserId); | ||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId); | reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId); | ||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | ||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/couponOrderVerifyCancel") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| boolean resSigned = sendAndRes("/couponOrderVerifyCancel", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | Assert.assertEquals(resSigned, true); | ||||
| } | } | ||||
| @@ -414,19 +368,7 @@ public class PosAppTest { | |||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId); | reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId); | ||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | ||||
| reqObj.put(WxPayConstant.POS_AMOUNT, posAmount); | reqObj.put(WxPayConstant.POS_AMOUNT, posAmount); | ||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/couponOrderPreVerify") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| boolean resSigned = sendAndRes("/couponOrderPreVerify", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | Assert.assertEquals(resSigned, true); | ||||
| } | } | ||||
| @@ -440,19 +382,7 @@ public class PosAppTest { | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | reqObj.put(WxPayConstant.BUSER_ID, buUserId); | ||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId); | reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId); | ||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | ||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/couponOrderPreVerifyCancel") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| boolean resSigned = sendAndRes("/couponOrderPreVerifyCancel", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | Assert.assertEquals(resSigned, true); | ||||
| } | } | ||||
| @@ -466,19 +396,7 @@ public class PosAppTest { | |||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId); | reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId); | ||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | ||||
| reqObj.put(WxPayConstant.POS_AMOUNT, posAmount); | reqObj.put(WxPayConstant.POS_AMOUNT, posAmount); | ||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/couponOrderPayVerifyOne") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| boolean resSigned = sendAndRes("/couponOrderPayVerifyOne", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | Assert.assertEquals(resSigned, true); | ||||
| } | } | ||||
| @@ -492,19 +410,7 @@ public class PosAppTest { | |||||
| reqObj.put(WxPayConstant.SELECTED_COUPON_ORDER_LIST, couponOrderIdList); | reqObj.put(WxPayConstant.SELECTED_COUPON_ORDER_LIST, couponOrderIdList); | ||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | ||||
| reqObj.put(WxPayConstant.POS_AMOUNT, posAmount); | reqObj.put(WxPayConstant.POS_AMOUNT, posAmount); | ||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/couponOrderPayVerifyList") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| boolean resSigned = sendAndRes("/couponOrderPayVerifyList", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | Assert.assertEquals(resSigned, true); | ||||
| } | } | ||||
| @@ -518,19 +424,7 @@ public class PosAppTest { | |||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | ||||
| reqObj.put(WxPayConstant.POS_AMOUNT, posAmount); | reqObj.put(WxPayConstant.POS_AMOUNT, posAmount); | ||||
| reqObj.put(WxPayConstant.CARD_ID, cardId); | reqObj.put(WxPayConstant.CARD_ID, cardId); | ||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/cardPayPre") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| boolean resSigned = sendAndRes("/cardPayPre", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | Assert.assertEquals(resSigned, true); | ||||
| } | } | ||||
| @@ -545,72 +439,23 @@ public class PosAppTest { | |||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | ||||
| reqObj.put(WxPayConstant.CARD_ID, cardId); | reqObj.put(WxPayConstant.CARD_ID, cardId); | ||||
| reqObj.put(WxPayConstant.CARD_SPEND_ID, cardSpendId); | reqObj.put(WxPayConstant.CARD_SPEND_ID, cardSpendId); | ||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/cardPayPreCancel") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | |||||
| private void doCardPay(String cardId, String posOrderId, String posAmount) throws Exception { | |||||
| Map<String, String> reqObj = new HashMap<>(); | |||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | |||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | |||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | |||||
| reqObj.put(WxPayConstant.POS_AMOUNT, posAmount); | |||||
| reqObj.put(WxPayConstant.CARD_ID, cardId); | |||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/cardPay") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| boolean resSigned = sendAndRes("/cardPayPreCancel", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | Assert.assertEquals(resSigned, true); | ||||
| } | } | ||||
| private void doCardPayCancel(String cardId, String cardSpendId, String posOrderId) throws Exception { | |||||
| Map<String, String> reqObj = new HashMap<>(); | |||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | |||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | |||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | |||||
| reqObj.put(WxPayConstant.CARD_ID, cardId); | |||||
| reqObj.put(WxPayConstant.CARD_SPEND_ID, cardSpendId); | |||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/cardPayCancel") | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | |||||
| private boolean sendAndRes(String url, Map<String, String> reqObj) throws Exception { | |||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | |||||
| String reqJsonStr = JSONObject.toJSONString(reqObj); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post(url) | |||||
| .contentType(MediaType.APPLICATION_JSON) | |||||
| .content(reqJsonStr)) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String,String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| return WxPayment.verifyNotifyHMAC(respMap, devResKey); | |||||
| } | |||||
| } | } | ||||
| @@ -36,6 +36,8 @@ public class BaseEntity implements Serializable { | |||||
| @Transient | @Transient | ||||
| protected String businessForRule; | protected String businessForRule; | ||||
| @Transient | |||||
| protected String[] tempShop; | |||||
| public String getSortColumns() { | public String getSortColumns() { | ||||
| if(StringUtils.isBlank(sortColumn)){ | if(StringUtils.isBlank(sortColumn)){ | ||||
| @@ -8,6 +8,7 @@ import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | import javax.persistence.Transient; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | |||||
| /** | /** | ||||
| * @author luozukai | * @author luozukai | ||||
| @@ -46,5 +47,7 @@ public class WxBillSettle extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") | @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") | ||||
| private Date updatetime; | private Date updatetime; | ||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") | |||||
| private Map<String, Object> flowParams; | |||||
| } | } | ||||
| @@ -64,6 +64,8 @@ public class WxPayOrder extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="支付后结果来源(0:callback, 1:query)",name="payEndFrom") | @io.swagger.annotations.ApiModelProperty(value="支付后结果来源(0:callback, 1:query)",name="payEndFrom") | ||||
| private Integer payEndFrom; | private Integer payEndFrom; | ||||
| @io.swagger.annotations.ApiModelProperty(value="支付后结果来源(0:C端微信支付, 1:POS支付)",name="payFrom") | |||||
| private Integer payFrom; | |||||
| @io.swagger.annotations.ApiModelProperty(value="支付订单号,来源于POS",name="posPayOrderId") | @io.swagger.annotations.ApiModelProperty(value="支付订单号,来源于POS",name="posPayOrderId") | ||||
| private Long posPayOrderId; | private Long posPayOrderId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="支付订单创建时间,来源于POS",name="posPayOrderTime") | @io.swagger.annotations.ApiModelProperty(value="支付订单创建时间,来源于POS",name="posPayOrderTime") | ||||
| @@ -16,6 +16,4 @@ public class FmInsideCouponVerifyMsg extends BaseMsg{ | |||||
| private Long couponOrderId; | private Long couponOrderId; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "B端用户ID", name = "bUserId") | @io.swagger.annotations.ApiModelProperty(value = "B端用户ID", name = "bUserId") | ||||
| private Long bUserId; | private Long bUserId; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "核销类型()", name = "verifyType") | |||||
| private Integer verifyType; | |||||
| } | } | ||||
| @@ -0,0 +1,35 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumPayEndFrom { | |||||
| CALLBACK(0, "callback"), | |||||
| QUERY(1, "查询"); | |||||
| public static EnumPayEndFrom getEnum(Integer code) { | |||||
| for (EnumPayEndFrom value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumPayEndFrom(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -5,8 +5,8 @@ package com.iformall.enums; | |||||
| */ | */ | ||||
| public enum EnumPayFrom { | public enum EnumPayFrom { | ||||
| CALLBACK(0, "callback"), | |||||
| QUERY(1, "查询"); | |||||
| INSIDE_C(0, "C端支付"), | |||||
| POS(1, "POS"); | |||||
| public static EnumPayFrom getEnum(Integer code) { | public static EnumPayFrom getEnum(Integer code) { | ||||
| for (EnumPayFrom value : values()) { | for (EnumPayFrom value : values()) { | ||||
| @@ -64,4 +64,7 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long> | |||||
| List<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo record); | List<WxRentPropertyContractVo> listContractVo(WxRentPropertyContractVo record); | ||||
| WxRentContract getByBill(WxBillRent billRent); | WxRentContract getByBill(WxBillRent billRent); | ||||
| int getShopCountMax(); | |||||
| } | } | ||||
| @@ -10,6 +10,7 @@ public class WxPayConstant { | |||||
| public final static String RETURN_CODE = "return_code"; | public final static String RETURN_CODE = "return_code"; | ||||
| public final static String RETURN_MSG = "return_msg"; | public final static String RETURN_MSG = "return_msg"; | ||||
| public final static String RESULT_CODE = "result_code"; | public final static String RESULT_CODE = "result_code"; | ||||
| public final static String TIMESTAMP = "timestamp"; | |||||
| public final static String ERR_CODE = "err_code"; | public final static String ERR_CODE = "err_code"; | ||||
| public final static String ERR_CODE_DES = "err_code_des"; | public final static String ERR_CODE_DES = "err_code_des"; | ||||
| public final static String NONCE_STR = "nonce_str"; | public final static String NONCE_STR = "nonce_str"; | ||||
| @@ -54,6 +55,7 @@ public class WxPayConstant { | |||||
| public final static String VERIFY = "verify"; | public final static String VERIFY = "verify"; | ||||
| public final static String PAY = "pay"; | public final static String PAY = "pay"; | ||||
| public final static String CANCEL = "cancel"; | public final static String CANCEL = "cancel"; | ||||
| public final static String CANCEL_JSON = "cancel_json"; | |||||
| public final static String CANCEL_DES = "cancel_des"; | public final static String CANCEL_DES = "cancel_des"; | ||||
| public final static String REG_QRCODE_URL = "qrcode_url"; | public final static String REG_QRCODE_URL = "qrcode_url"; | ||||
| @@ -101,6 +103,7 @@ public class WxPayConstant { | |||||
| public final static String NEU_ORDER_TIME = "OrderTimeOfPlatform"; // 平台订单创建时间, 格式:4位年2位月2位日2位24小时制时2位分2位秒3位毫秒 | public final static String NEU_ORDER_TIME = "OrderTimeOfPlatform"; // 平台订单创建时间, 格式:4位年2位月2位日2位24小时制时2位分2位秒3位毫秒 | ||||
| public final static String NEU_ORDER_AMOUNT = "OrderAmount"; // 订单价格 | public final static String NEU_ORDER_AMOUNT = "OrderAmount"; // 订单价格 | ||||
| public final static String NEU_ORDER_CREATE_SN = "OrderCreateSN"; // 创建订单的POS SN号 | public final static String NEU_ORDER_CREATE_SN = "OrderCreateSN"; // 创建订单的POS SN号 | ||||
| public final static String NEU_ORDER_SCENE_TYPE = "SceneType"; // 订单场景 1:订单支付 2:核销 | |||||
| public final static String NEU_ORDER_STATUS = "OrderStatus"; // 必要,订单状态: 0有效,1取消,根据订单状态处理优惠券;有效:优惠券从预核销处理为核销; | public final static String NEU_ORDER_STATUS = "OrderStatus"; // 必要,订单状态: 0有效,1取消,根据订单状态处理优惠券;有效:优惠券从预核销处理为核销; | ||||
| public final static String NEU_PAY_DETAIL = "PaymentDetail"; | public final static String NEU_PAY_DETAIL = "PaymentDetail"; | ||||
| public final static String NEU_PAY_DETAIL_LIST = "PaymentDetailList"; | public final static String NEU_PAY_DETAIL_LIST = "PaymentDetailList"; | ||||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.WxBillSettle; | import com.iformall.domain.po.WxBillSettle; | ||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| @@ -33,7 +34,7 @@ public interface WxBillSettleService { | |||||
| * | * | ||||
| * @param record | * @param record | ||||
| */ | */ | ||||
| ResultData saveOrUpdate(WxBillSettle record); | |||||
| ResultData saveOrUpdate(WxBillSettle record, MallUserInfo userInfo); | |||||
| void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillSettle wxBillSettle); | void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillSettle wxBillSettle); | ||||
| } | } | ||||
| @@ -57,7 +57,7 @@ public interface WxCouponOrderService { | |||||
| /** | /** | ||||
| * 核销后发送消息 | * 核销后发送消息 | ||||
| */ | */ | ||||
| void sendInsideCouponVerifyMsg(String tenantId, Long couponOrderId, Long buUserId, Integer verifyType); | |||||
| void sendInsideCouponVerifyMsg(String tenantId, Long couponOrderId, Long buUserId); | |||||
| /** | /** | ||||
| * 核销后处理 | * 核销后处理 | ||||
| @@ -65,7 +65,7 @@ public interface WxCouponOrderService { | |||||
| * @param couponOrder | * @param couponOrder | ||||
| * @param bUser 核销人(登录用户) | * @param bUser 核销人(登录用户) | ||||
| */ | */ | ||||
| void actionAfterVerify(WxCouponOrder couponOrder, WxMerchantBUser bUser, Integer verifyType); | |||||
| void actionAfterVerify(WxCouponOrder couponOrder, WxMerchantBUser bUser); | |||||
| /** | /** | ||||
| * 核销发券 | * 核销发券 | ||||
| @@ -664,30 +664,30 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| List<WxBillAllVo> list = wxBillAllMapper.list(wxBillAll); | List<WxBillAllVo> list = wxBillAllMapper.list(wxBillAll); | ||||
| if (!list.isEmpty()) { | if (!list.isEmpty()) { | ||||
| //租金总额 | //租金总额 | ||||
| Long rentSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT.getCode())) | |||||
| Long rentSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT.getCode())) | |||||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); | .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); | ||||
| //物业总额 | //物业总额 | ||||
| Long propertySum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY.getCode())) | Long propertySum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY.getCode())) | ||||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); | .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); | ||||
| //押金总额 | //押金总额 | ||||
| Long depositSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT_DEPOSIT.getCode()) || | |||||
| Long depositSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT_DEPOSIT.getCode()) || | |||||
| b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode()) || b.getBillTypeValue().equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) | b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode()) || b.getBillTypeValue().equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) | ||||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); | .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); | ||||
| //水费 | //水费 | ||||
| Long waterSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.WATER.getCode())) | |||||
| Long waterSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.WATER.getCode())) | |||||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); | .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); | ||||
| //电费 | //电费 | ||||
| Long powerSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.POWER.getCode())) | |||||
| Long powerSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.POWER.getCode())) | |||||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); | .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); | ||||
| //空调费 | //空调费 | ||||
| Long airConditioningSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())) | |||||
| Long airConditioningSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())) | |||||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); | .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); | ||||
| //其他费用 | //其他费用 | ||||
| Long otherSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.ROUTINE.getCode())) | |||||
| Long otherSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.ROUTINE.getCode())) | |||||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); | .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); | ||||
| //押金明细 | //押金明细 | ||||
| StringBuffer depositDetail = new StringBuffer(); | StringBuffer depositDetail = new StringBuffer(); | ||||
| list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT_DEPOSIT.getCode()) || | |||||
| list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT_DEPOSIT.getCode()) || | |||||
| b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode()) || b.getBillTypeValue().equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) | b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode()) || b.getBillTypeValue().equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) | ||||
| .forEach(b -> { | .forEach(b -> { | ||||
| BigDecimal owe = new BigDecimal(status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | BigDecimal owe = new BigDecimal(status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | ||||
| @@ -696,7 +696,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| //其他费用明细 | //其他费用明细 | ||||
| StringBuffer otherDetail = new StringBuffer(); | StringBuffer otherDetail = new StringBuffer(); | ||||
| list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.ROUTINE.getCode())) | |||||
| list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.ROUTINE.getCode())) | |||||
| .forEach(b -> { | .forEach(b -> { | ||||
| BigDecimal owe = new BigDecimal(status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | BigDecimal owe = new BigDecimal(status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | ||||
| otherDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); | otherDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); | ||||
| @@ -731,7 +731,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| List<WxMerchantVo> listCVo = wxMerchantMapper.findListCVo(wxMerchantVo); | List<WxMerchantVo> listCVo = wxMerchantMapper.findListCVo(wxMerchantVo); | ||||
| wxMerchantVo = listCVo.get(0); | wxMerchantVo = listCVo.get(0); | ||||
| result.put("merchant", wxMerchantVo.getMerchantName()); | result.put("merchant", wxMerchantVo.getMerchantName()); | ||||
| WxShopVo wxShopVo = wxMerchantVo.getShopVoList().parallelStream().filter(s -> StringUtils.isNotEmpty(s.getLinkPhone())).findAny().orElse(null); | |||||
| WxShopVo wxShopVo = wxMerchantVo.getShopVoList().stream().filter(s -> StringUtils.isNotEmpty(s.getLinkPerson())).findFirst().orElse(null); | |||||
| if (wxShopVo != null) { | if (wxShopVo != null) { | ||||
| String linkPerson = wxShopVo.getLinkPerson(); | String linkPerson = wxShopVo.getLinkPerson(); | ||||
| String linkPhone = wxShopVo.getLinkPhone(); | String linkPhone = wxShopVo.getLinkPhone(); | ||||
| @@ -1,12 +1,17 @@ | |||||
| package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.WxBillSettle; | import com.iformall.domain.po.WxBillSettle; | ||||
| import com.iformall.mapper.WxBillSettleMapper; | import com.iformall.mapper.WxBillSettleMapper; | ||||
| import com.iformall.service.WxBillSettleService; | import com.iformall.service.WxBillSettleService; | ||||
| import com.iformall.service.WxFlowService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| @@ -18,20 +23,35 @@ import javax.servlet.http.HttpServletResponse; | |||||
| public class WxBillSettleServiceImpl implements WxBillSettleService { | public class WxBillSettleServiceImpl implements WxBillSettleService { | ||||
| @Autowired | @Autowired | ||||
| private WxBillSettleMapper wxBillSettleMapper; | private WxBillSettleMapper wxBillSettleMapper; | ||||
| @Autowired | |||||
| private WxFlowService wxFlowService; | |||||
| @Override | @Override | ||||
| public PageInfo<WxBillSettle> listAsPage(WxBillSettle record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxBillSettle> listAsPage(WxBillSettle record, Integer pageIndex, Integer pageSize) { | ||||
| return null; | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillSettleMapper.findList(record)); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxBillSettle getById(Long id) { | public WxBillSettle getById(Long id) { | ||||
| return null; | |||||
| return wxBillSettleMapper.selectByPrimaryKey(id); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData saveOrUpdate(WxBillSettle record) { | |||||
| return null; | |||||
| @Transactional | |||||
| public ResultData saveOrUpdate(WxBillSettle record, MallUserInfo userInfo) { | |||||
| if (record.getId() == null) { | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxBillSettleMapper.insertSelective(record); | |||||
| } else { | |||||
| wxBillSettleMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| //启动审批流 | |||||
| record.getFlowParams().put("businessId",record.getId()); | |||||
| if (record.getFlowParams() != null && record.getFlowParams().size() > 0) { | |||||
| wxFlowService.start(record.getFlowParams(), userInfo.getId(), userInfo.getName(), record.getTenantId()); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -388,18 +388,17 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void sendInsideCouponVerifyMsg(String tenantId, Long couponOrderId, Long buUserId, Integer verifyType) { | |||||
| public void sendInsideCouponVerifyMsg(String tenantId, Long couponOrderId, Long buUserId) { | |||||
| FmInsideCouponVerifyMsg verifyMsg = new FmInsideCouponVerifyMsg(); | FmInsideCouponVerifyMsg verifyMsg = new FmInsideCouponVerifyMsg(); | ||||
| verifyMsg.setMsgType(EnumMsgRecordType.INSIDE_COUPON_VERIFY.getCode()); | verifyMsg.setMsgType(EnumMsgRecordType.INSIDE_COUPON_VERIFY.getCode()); | ||||
| verifyMsg.setTenantId(tenantId); | verifyMsg.setTenantId(tenantId); | ||||
| verifyMsg.setCouponOrderId(couponOrderId); | verifyMsg.setCouponOrderId(couponOrderId); | ||||
| verifyMsg.setBUserId(buUserId); | verifyMsg.setBUserId(buUserId); | ||||
| verifyMsg.setVerifyType(verifyType); | |||||
| mqBaseProducer.sendMessage(verifyMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | mqBaseProducer.sendMessage(verifyMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void actionAfterVerify(WxCouponOrder couponOrder, WxMerchantBUser bUser, Integer verifyType) { | |||||
| public void actionAfterVerify(WxCouponOrder couponOrder, WxMerchantBUser bUser) { | |||||
| try { | try { | ||||
| // 核销分账 | // 核销分账 | ||||
| shareAfterVerify(couponOrder, bUser.getMerchantId()); | shareAfterVerify(couponOrder, bUser.getMerchantId()); | ||||
| @@ -417,14 +416,10 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| boolean bSentCoupon = false; | boolean bSentCoupon = false; | ||||
| // 核销发券 | // 核销发券 | ||||
| // POS交易核销暂不发券 | |||||
| if (verifyType.equals(EnumCouponVerifyType.VERIFY_B.getCode()) || | |||||
| verifyType.equals(EnumCouponVerifyType.VERIFY_POS_INDEPENDENT.getCode())) { | |||||
| try { | |||||
| bSentCoupon = sendCouponAfterVerify(couponOrder, bUser); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| try { | |||||
| bSentCoupon = sendCouponAfterVerify(couponOrder, bUser); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | } | ||||
| // 核销发模板消息 | // 核销发模板消息 | ||||
| @@ -724,7 +724,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| if ("MICROPAY".equals(tradeType)) { | if ("MICROPAY".equals(tradeType)) { | ||||
| handleMicroOrderPaySuccess(record, transactionId, openId, sub_is_subscribe); | handleMicroOrderPaySuccess(record, transactionId, openId, sub_is_subscribe); | ||||
| } else { | } else { | ||||
| handleOrderPaySuccess(record, transactionId, EnumPayFrom.QUERY.getCode()); | |||||
| handleOrderPaySuccess(record, transactionId, EnumPayEndFrom.QUERY.getCode()); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "订单支付成功", returnMap); | return new ResultData(Result.SUCCESS, "订单支付成功", returnMap); | ||||
| } else if ("REFUND".equals(trade_state)) { | } else if ("REFUND".equals(trade_state)) { | ||||
| @@ -1125,10 +1125,10 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| timeEnd = new Date(); | timeEnd = new Date(); | ||||
| } | } | ||||
| payOrder.setPayTimeEnd(timeEnd); | payOrder.setPayTimeEnd(timeEnd); | ||||
| payOrder.setPayEndFrom(EnumPayFrom.CALLBACK.getCode()); | |||||
| payOrder.setPayEndFrom(EnumPayEndFrom.CALLBACK.getCode()); | |||||
| // 处理支付成功 | // 处理支付成功 | ||||
| handleOrderPaySuccess(payOrder, paramMap.get("transaction_id"), EnumPayFrom.CALLBACK.getCode()); | |||||
| handleOrderPaySuccess(payOrder, paramMap.get("transaction_id"), EnumPayEndFrom.CALLBACK.getCode()); | |||||
| logger.info("notify order, wxpay checksign success, paramMap:{}, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); | logger.info("notify order, wxpay checksign success, paramMap:{}, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); | ||||
| SortedMap resultMap = new TreeMap(); | SortedMap resultMap = new TreeMap(); | ||||
| resultMap.put("return_code", "SUCCESS"); | resultMap.put("return_code", "SUCCESS"); | ||||
| @@ -254,17 +254,15 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| * @param revenueLong | * @param revenueLong | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| public static Long countPrice(Integer ratio,Long revenueLong,int timeType,int period){ | |||||
| public static Long countPrice(Integer ratio,Long revenueLong,int timeType,int period,int from){ | |||||
| BigDecimal hundred = new BigDecimal(100); | BigDecimal hundred = new BigDecimal(100); | ||||
| BigDecimal revenue = new BigDecimal(revenueLong == null ? 0 : revenueLong).divide(hundred); | BigDecimal revenue = new BigDecimal(revenueLong == null ? 0 : revenueLong).divide(hundred); | ||||
| BigDecimal payRatio = new BigDecimal(ratio == null ? 0 : ratio).divide(new BigDecimal(10000)); | BigDecimal payRatio = new BigDecimal(ratio == null ? 0 : ratio).divide(new BigDecimal(10000)); | ||||
| BigDecimal price; | BigDecimal price; | ||||
| if(EnumMissTimeType.YEAR.getCode().equals(timeType)){ | |||||
| if(EnumMissTimeType.YEAR.getCode().equals(timeType) && EnumGetRatioFrom.RENT.getCode().equals(from)){ | |||||
| price = revenue.multiply(new BigDecimal(12)).multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN);;; | price = revenue.multiply(new BigDecimal(12)).multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN);;; | ||||
| }else if(EnumMissTimeType.PERIOD.getCode().equals(timeType)){ | |||||
| }else if(EnumMissTimeType.PERIOD.getCode().equals(timeType) && EnumGetRatioFrom.RENT.getCode().equals(from)){ | |||||
| price = revenue.multiply(new BigDecimal(period)).multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN);; | price = revenue.multiply(new BigDecimal(period)).multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN);; | ||||
| }else if(EnumMissTimeType.MONTH.getCode().equals(timeType)){ | |||||
| price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); | |||||
| }else{ | }else{ | ||||
| price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); | price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); | ||||
| } | } | ||||
| @@ -315,7 +313,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| if (revenue.compareTo(start) >= 0 && revenue.compareTo(end)<= 0){ | if (revenue.compareTo(start) >= 0 && revenue.compareTo(end)<= 0){ | ||||
| ratioVo.setRatio(ratio); | ratioVo.setRatio(ratio); | ||||
| ratioVo.setPrice(countPrice(ratioVo.getRatio(),revenueLong,timeType,period)); | |||||
| ratioVo.setPrice(countPrice(ratioVo.getRatio(),revenueLong,timeType,period,from)); | |||||
| break; | break; | ||||
| } | } | ||||
| }else if(e.indexOf(">") >= 0){ | }else if(e.indexOf(">") >= 0){ | ||||
| @@ -401,7 +399,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| record.setPrice(0l); | record.setPrice(0l); | ||||
| }else{ | }else{ | ||||
| if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){ | if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){ | ||||
| record.setPrice(countPrice(record.getPayRatio(),record.getRevenue(),EnumMissTimeType.OTHER.getCode(),record.getAdjustPeriod())); | |||||
| record.setPrice(countPrice(record.getPayRatio(),record.getRevenue(),EnumMissTimeType.OTHER.getCode(),record.getAdjustPeriod(),EnumGetRatioFrom.RENT.getCode())); | |||||
| }else{ | }else{ | ||||
| int dayCount = record.getReceivePeriod() * 30; | int dayCount = record.getReceivePeriod() * 30; | ||||
| RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); | RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); | ||||
| @@ -634,7 +632,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| if(!EnumFromType.SWITCH.getCode().equals(from)){ | if(!EnumFromType.SWITCH.getCode().equals(from)){ | ||||
| if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | ||||
| if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){ | if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){ | ||||
| record.setPrice(countPrice(record.getPayRatio(),record.getRevenue(),EnumMissTimeType.OTHER.getCode(),record.getAdjustPeriod())); | |||||
| record.setPrice(countPrice(record.getPayRatio(),record.getRevenue(),EnumMissTimeType.OTHER.getCode(),record.getAdjustPeriod(),from)); | |||||
| }else{ | }else{ | ||||
| int dayCount = record.getReceivePeriod() * 30; | int dayCount = record.getReceivePeriod() * 30; | ||||
| RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); | RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); | ||||
| @@ -1266,23 +1264,20 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| }else{ | }else{ | ||||
| Double priceD = new Double(price); | Double priceD = new Double(price); | ||||
| //年 除12 | |||||
| if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){ | |||||
| priceD = new Double(price)/12; | |||||
| } | |||||
| if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | |||||
| if (EnumRentContractType.RENT_BY_JOINT.getCode().equals(wxRentContract.getType())) { | |||||
| //设置跳点率为年周期 price不变 | //设置跳点率为年周期 price不变 | ||||
| if(EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())){ | if(EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())){ | ||||
| if(i == billTimeVoListSize - 1){ | |||||
| priceD = new Double(price); | |||||
| }else { | |||||
| return priceD.longValue(); | |||||
| } | |||||
| return priceD.longValue(); | |||||
| } | } | ||||
| //年或者设置跳点率为年周期 除12 | //年或者设置跳点率为年周期 除12 | ||||
| if(EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())){ | if(EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())){ | ||||
| priceD = new Double(price)/12; | priceD = new Double(price)/12; | ||||
| } | } | ||||
| }else{ | |||||
| //年 除12 | |||||
| if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){ | |||||
| priceD = new Double(price)/12; | |||||
| } | |||||
| } | } | ||||
| //生成金额直接计算 | //生成金额直接计算 | ||||
| @@ -1293,7 +1288,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); | SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); | ||||
| SimpleDateFormat sdD = new SimpleDateFormat("d"); | SimpleDateFormat sdD = new SimpleDateFormat("d"); | ||||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| if(i == billTimeVoListSize - 1){//最后 | if(i == billTimeVoListSize - 1){//最后 | ||||
| //判断是否满足整月 | //判断是否满足整月 | ||||
| @@ -44,11 +44,6 @@ public class FmInsideCouponVerifyMsgServiceImpl implements MsgSendService { | |||||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "用户未找到" + msg.getBUserId()); | throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "用户未找到" + msg.getBUserId()); | ||||
| } | } | ||||
| Integer verifyType = msg.getVerifyType(); | |||||
| if (verifyType == null) { | |||||
| verifyType = EnumCouponVerifyType.VERIFY_B.getCode(); | |||||
| } | |||||
| couponOrderService.actionAfterVerify(couponOrder, user, verifyType); | |||||
| couponOrderService.actionAfterVerify(couponOrder, user); | |||||
| } | } | ||||
| } | } | ||||
| @@ -143,19 +143,19 @@ | |||||
| <if test=" null != building and ''!= building">and b.id = #{building}</if> | <if test=" null != building and ''!= building">and b.id = #{building}</if> | ||||
| <if test=" null != floor and ''!= floor">and f.id = #{floor}</if> | <if test=" null != floor and ''!= floor">and f.id = #{floor}</if> | ||||
| <if test=" null != operationType ">and `operation_type` = #{operationType}</if> | <if test=" null != operationType ">and `operation_type` = #{operationType}</if> | ||||
| <if test="(null != floorForRule and '' != floorForRule) or (null != businessForRule and '' != businessForRule)"> | |||||
| and rc.merchant_id in( | |||||
| select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms | |||||
| inner join wx_merchant m on ms.merchant_id = m.id | |||||
| inner join wx_shop s on s.id=ms.shop_id | |||||
| where m.tenant_id=#{tenantId} and s.is_del=0 | |||||
| <if test=" null != businessForRule and '' != businessForRule "> | |||||
| and m.business_id in (${businessForRule}) | |||||
| </if> | |||||
| <if test=" null != floorForRule and '' != floorForRule "> | |||||
| and s.`floor` in (${floorForRule}) | |||||
| </if> | |||||
| ) | |||||
| <if test=" null != businessForRule and '' != businessForRule "> | |||||
| and rc.business_id in (${businessForRule}) | |||||
| </if> | |||||
| <if test="null != rentShopType and 1 == rentShopType and null != floorForRule and '' != floorForRule "> | |||||
| and rc.`id` in | |||||
| <foreach collection="tempShop" index="idx" separator=" union all " open="(" close=")"> | |||||
| select id from wx_rent_contract where tenant_id=#{tenantId} and | |||||
| json_unquote(json_extract(json_extract(rent_info,'$[*].shopId'),concat('$[',#{idx},']'))) in(select | |||||
| id from wx_shop where tenant_id=#{tenantId} and floor in (${floorForRule})) | |||||
| </foreach> | |||||
| </if> | |||||
| <if test="null != rentShopType and 2 == rentShopType and null != floorForRule and '' != floorForRule "> | |||||
| and rc.shop_id in (select id from wx_shop where tenant_id=#{tenantId} and floor in (${floorForRule})) | |||||
| </if> | </if> | ||||
| </where> | </where> | ||||
| @@ -171,19 +171,19 @@ | |||||
| <if test=" null != building and ''!= building">and b.id = #{building}</if> | <if test=" null != building and ''!= building">and b.id = #{building}</if> | ||||
| <if test=" null != floor and ''!= floor">and f.id = #{floor}</if> | <if test=" null != floor and ''!= floor">and f.id = #{floor}</if> | ||||
| <if test=" null != operationType ">and `operation_type` = #{operationType}</if> | <if test=" null != operationType ">and `operation_type` = #{operationType}</if> | ||||
| <if test="(null != floorForRule and '' != floorForRule) or (null != businessForRule and '' != businessForRule)"> | |||||
| and rc.merchant_id in( | |||||
| select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms | |||||
| inner join wx_merchant m on ms.merchant_id = m.id | |||||
| inner join wx_shop s on s.id=ms.shop_id | |||||
| where m.tenant_id=#{tenantId} and s.is_del=0 | |||||
| <if test=" null != businessForRule and '' != businessForRule "> | |||||
| and m.business_id in (${businessForRule}) | |||||
| </if> | |||||
| <if test=" null != floorForRule and '' != floorForRule "> | |||||
| and s.`floor` in (${floorForRule}) | |||||
| </if> | |||||
| ) | |||||
| <if test=" null != businessForRule and '' != businessForRule "> | |||||
| and rc.business_id in (${businessForRule}) | |||||
| </if> | |||||
| <if test="null != rentShopType and 1 == rentShopType and null != floorForRule and '' != floorForRule "> | |||||
| and rc.`id` in | |||||
| <foreach collection="tempShop" index="idx" separator=" union all " open="(" close=")"> | |||||
| select id from wx_rent_contract where tenant_id=#{tenantId} and | |||||
| json_unquote(json_extract(json_extract(rent_info,'$[*].shopId'),concat('$[',#{idx},']'))) in(select | |||||
| id from wx_shop where tenant_id=#{tenantId} and floor in (${floorForRule})) | |||||
| </foreach> | |||||
| </if> | |||||
| <if test="null != rentShopType and 2 == rentShopType and null != floorForRule and '' != floorForRule "> | |||||
| and rc.shop_id in (select id from wx_shop where tenant_id=#{tenantId} and floor in (${floorForRule})) | |||||
| </if> | </if> | ||||
| </where> | </where> | ||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| @@ -379,23 +379,25 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != status ">and rc.`status` = #{status}</if> | <if test=" null != status ">and rc.`status` = #{status}</if> | ||||
| <if test=" null != type ">and rc.`type` = #{type}</if> | <if test=" null != type ">and rc.`type` = #{type}</if> | ||||
| <if test=" null != rentShopType ">and rc.`rent_shop_type` = #{rentShopType}</if> | |||||
| <if test=" null != rentShopType "> | |||||
| and rc.`rent_shop_type` = #{rentShopType} | |||||
| </if> | |||||
| <if test=" null != applyStatus ">and rc.`apply_status` = #{applyStatus}</if> | <if test=" null != applyStatus ">and rc.`apply_status` = #{applyStatus}</if> | ||||
| <if test=" null != operationType ">and rc.`operation_type` = #{operationType}</if> | <if test=" null != operationType ">and rc.`operation_type` = #{operationType}</if> | ||||
| <if test=" null != businessForRule and '' != businessForRule "> | |||||
| and rc.business_id in (${businessForRule}) | |||||
| </if> | |||||
| <if test="(null != floorForRule and '' != floorForRule) or (null != businessForRule and '' != businessForRule)"> | |||||
| and rc.merchant_id in( | |||||
| select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms | |||||
| inner join wx_merchant m on ms.merchant_id = m.id | |||||
| inner join wx_shop s on s.id=ms.shop_id | |||||
| where m.tenant_id=#{tenantId} and s.is_del=0 | |||||
| <if test=" null != businessForRule and '' != businessForRule "> | |||||
| and m.business_id in (${businessForRule}) | |||||
| </if> | |||||
| <if test=" null != floorForRule and '' != floorForRule "> | |||||
| and s.`floor` in (${floorForRule}) | |||||
| </if> | |||||
| ) | |||||
| <if test="null != rentShopType and 1 == rentShopType and null != floorForRule and '' != floorForRule "> | |||||
| and rc.`id` in | |||||
| <foreach collection="tempShop" index="idx" separator=" union all " open="(" close=")"> | |||||
| select id from wx_rent_contract where tenant_id=#{tenantId} and | |||||
| json_unquote(json_extract(json_extract(rent_info,'$[*].shopId'),concat('$[',#{idx},']'))) in(select | |||||
| id from wx_shop where tenant_id=#{tenantId} and floor in (${floorForRule})) | |||||
| </foreach> | |||||
| </if> | |||||
| <if test="null != rentShopType and 2 == rentShopType and null != floorForRule and '' != floorForRule "> | |||||
| and rc.shop_id in (select id from wx_shop where tenant_id=#{tenantId} and floor in (${floorForRule})) | |||||
| </if> | </if> | ||||
| </where> | </where> | ||||
| @@ -408,5 +410,10 @@ | |||||
| select rent_contract_id from wx_bill_rent id = #{id} | select rent_contract_id from wx_bill_rent id = #{id} | ||||
| ) | ) | ||||
| </select> | </select> | ||||
| <select id="getShopCountMax" resultType="int"> | |||||
| select max(json_length(rent_info)) from wx_rent_contract | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -529,6 +529,7 @@ | |||||
| <result column="floor_name" jdbcType="VARCHAR" property="floorName"/> | <result column="floor_name" jdbcType="VARCHAR" property="floorName"/> | ||||
| <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/> | <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/> | ||||
| <result column="manager_phone" jdbcType="VARCHAR" property="linkPhone"/> | <result column="manager_phone" jdbcType="VARCHAR" property="linkPhone"/> | ||||
| <result column="manager" jdbcType="VARCHAR" property="linkPerson"/> | |||||
| </resultMap> | </resultMap> | ||||
| @@ -538,7 +539,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <select id="findShopVoList" parameterType="java.util.Map" resultMap="ShopVoResultMap"> | <select id="findShopVoList" parameterType="java.util.Map" resultMap="ShopVoResultMap"> | ||||
| select s.id,s.shop_number,b.building_name,f.floor_name,s.addr,s.baidu_poi,s.manager_phone | |||||
| select s.id,s.shop_number,b.building_name,f.floor_name,s.addr,s.baidu_poi,s.manager_phone,s.manager | |||||
| from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id | from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id | ||||
| left join wx_merchant m on ms.merchant_id=m.id | left join wx_merchant m on ms.merchant_id=m.id | ||||
| left join wx_mall_building b on s.building=b.id | left join wx_mall_building b on s.building=b.id | ||||