| @@ -0,0 +1,3 @@ | |||||
| ALTER TABLE `wx_card_spend` | |||||
| change `from` `pay_from` tinyint(6) NOT NULL DEFAULT '0' COMMENT '来源(0:C端小程序扫一扫, 1:POS)', | |||||
| drop column `pos_refund_status`; | |||||
| @@ -2,10 +2,8 @@ package com.iformall.service.test; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.service.WxBillSettleService; | |||||
| import com.iformall.service.WxCouponSendService; | |||||
| import com.iformall.service.WxLevelConfigService; | |||||
| import com.iformall.service.WxScoreRulesService; | |||||
| import com.iformall.domain.vo.WxBillAll; | |||||
| import com.iformall.service.*; | |||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import org.apache.shiro.SecurityUtils; | import org.apache.shiro.SecurityUtils; | ||||
| import org.apache.shiro.authc.UsernamePasswordToken; | import org.apache.shiro.authc.UsernamePasswordToken; | ||||
| @@ -61,7 +59,8 @@ public class Test { | |||||
| @Autowired | @Autowired | ||||
| private WxBillSettleService wxBillSettleService; | private WxBillSettleService wxBillSettleService; | ||||
| @Autowired | |||||
| private WxBillAllService wxBillAllService; | |||||
| @Before | @Before | ||||
| public void setUp() { | public void setUp() { | ||||
| @@ -86,8 +85,13 @@ public class Test { | |||||
| @org.junit.Test | @org.junit.Test | ||||
| public void levelList() { | public void levelList() { | ||||
| WxBillSettle settle = wxBillSettleService.getById(328411851323572224l); | |||||
| log.debug("data:{}", JSON.toJSONString(settle)); | |||||
| // WxBillSettle settle = wxBillSettleService.getById(328411851323572224l); | |||||
| // log.debug("data:{}", JSON.toJSONString(settle)); | |||||
| WxBillAll wxBillAll = new WxBillAll(); | |||||
| wxBillAll.setMerchantId(326957139157024768l); | |||||
| wxBillAll.setTenantId("456"); | |||||
| wxBillAll.setBillTypeValue(10); | |||||
| log.debug("data:{}", JSON.toJSONString( wxBillAllService.listBill(wxBillAll))); | |||||
| } | } | ||||
| @@ -1,7 +1,6 @@ | |||||
| package com.iformall.controller; | package com.iformall.controller; | ||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| @@ -60,6 +59,7 @@ public class PosController extends BaseController { | |||||
| @SystemControllerLog(description = "门店用户登录检查") | @SystemControllerLog(description = "门店用户登录检查") | ||||
| public Map<String, String> checkUserPassword(@RequestBody Map<String, String> params) { | public Map<String, String> checkUserPassword(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| JSONObject retObj = new JSONObject(); | |||||
| // 1. check sign | // 1. check sign | ||||
| Map<String, String> retMap = checkSign(params, payContent); | Map<String, String> retMap = checkSign(params, payContent); | ||||
| @@ -71,12 +71,12 @@ public class PosController extends BaseController { | |||||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | logger.info(WxPayConstant.RES_KEY + ": " + resKey); | ||||
| try { | try { | ||||
| retMap = posService.checkUserPassword(params); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", null); | |||||
| retObj = posService.checkUserPassword(params); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", null); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -97,6 +97,7 @@ public class PosController extends BaseController { | |||||
| @SystemControllerLog(description = "支付计算接口") | @SystemControllerLog(description = "支付计算接口") | ||||
| public Map<String, String> calcForMem(@RequestBody Map<String, String> params) { | public Map<String, String> calcForMem(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| JSONObject retObj = new JSONObject(); | |||||
| // 1. check sign | // 1. check sign | ||||
| Map<String, String> retMap = checkSign(params, payContent); | Map<String, String> retMap = checkSign(params, payContent); | ||||
| @@ -108,27 +109,34 @@ public class PosController extends BaseController { | |||||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | logger.info(WxPayConstant.RES_KEY + ": " + resKey); | ||||
| try { | try { | ||||
| retMap = posService.queryAndCalcMem(params); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| retObj = posService.queryAndCalcMem(params); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| } | } | ||||
| } | } | ||||
| @ApiOperation(value = "券核销", notes = "{" + | |||||
| @ApiOperation(value = "优惠核销接口", notes = "{" + | |||||
| "\"dev_id\":\"string(必填)\"," + | "\"dev_id\":\"string(必填)\"," + | ||||
| "\"nonce_str\":\"string(必填)\"," + | "\"nonce_str\":\"string(必填)\"," + | ||||
| "\"tenant_id\":\"string(必填)\"," + | "\"tenant_id\":\"string(必填)\"," + | ||||
| "\"merchant_id\":\"string(必填)\"," + | "\"merchant_id\":\"string(必填)\"," + | ||||
| "\"bu_user_id\":\"string(必填)\"," + | |||||
| "\"coupon_order_id\":\"string(必填)\"," + | |||||
| "\"pos_order_id\":\"string(必填)\"}") | |||||
| "\"order_operator_id\":\"string(必填)\"," + | |||||
| "\"mem_id\":\"string(选填)\"," + | |||||
| "\"mem_phone_number\":\"string(选填)\"," + | |||||
| "\"business_type\":\"string(0:核销1支付(必填)\"," + | |||||
| "\"order_number_of_platform\":\"string(必填)\"," + | |||||
| "\"order_amount\":\"string单位(分)(必填)\"," + | |||||
| "\"order_amount_left\":\"string单位(分)(必填)\"," + | |||||
| "\"order_create_sn\":\"string单位(分)(必填)\"," + | |||||
| "\"coupon_list\":\"json array[券包ID list](必填),例[\"1\",\"2\",\"3\"]\"}") | |||||
| @PostMapping("/couponOrderVerify") | @PostMapping("/couponOrderVerify") | ||||
| @SystemControllerLog(description = "券核销") | |||||
| @SystemControllerLog(description = "优惠核销接口") | |||||
| public Map<String, String> couponOrderVerify(@RequestBody Map<String, String> params) { | public Map<String, String> couponOrderVerify(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| JSONObject retObj = new JSONObject(); | |||||
| // 1. check sign | // 1. check sign | ||||
| Map<String, String> retMap = checkSign(params, payContent); | Map<String, String> retMap = checkSign(params, payContent); | ||||
| @@ -140,33 +148,13 @@ public class PosController extends BaseController { | |||||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | logger.info(WxPayConstant.RES_KEY + ": " + resKey); | ||||
| try { | try { | ||||
| retMap = posService.couponOrderVerifyDo(params, EnumPosActionType.VERIFY_INDEPENT); | |||||
| retObj = posService.couponOrderVerify(params); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| } | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } | |||||
| private void doActionAfterVerify(Map<String, String> params, Map<String, String> retMap) { | |||||
| String tenantId = params.get(WxPayConstant.TENANT_ID); // 租户ID | |||||
| String buUserIdStr = params.get(WxPayConstant.BUSER_ID); // POS操作员ID | |||||
| String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券ID | |||||
| Long buUserId, couponOrderId; | |||||
| try { | |||||
| buUserId = Long.valueOf(buUserIdStr); | |||||
| couponOrderId = Long.valueOf(couponOrderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error(e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage()); | |||||
| } | |||||
| String errCode = retMap.get(WxPayConstant.RESULT_CODE); | |||||
| if(StringUtils.isBlank(errCode)||errCode.equals(WxPayConstant.RESULT_SUCCESS)) { | |||||
| // 无异常信息,核销成功 | |||||
| couponOrderService.sendInsideCouponVerifyMsg(tenantId, couponOrderId, buUserId); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| } | } | ||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } | } | ||||
| @ApiOperation(value = "券核销取消", notes = "{" + | @ApiOperation(value = "券核销取消", notes = "{" + | ||||
| @@ -174,13 +162,26 @@ public class PosController extends BaseController { | |||||
| "\"nonce_str\":\"string(必填)\"," + | "\"nonce_str\":\"string(必填)\"," + | ||||
| "\"tenant_id\":\"string(必填)\"," + | "\"tenant_id\":\"string(必填)\"," + | ||||
| "\"merchant_id\":\"string(必填)\"," + | "\"merchant_id\":\"string(必填)\"," + | ||||
| "\"bu_user_id\":\"string(必填)\"," + | |||||
| "\"coupon_order_id\":\"string(必填)\"" + | |||||
| "\"pos_order_id\":\"string(必填)\"}") | |||||
| "\"order_operator_id\":\"string(必填)\"," + | |||||
| "\"mem_id\":\"string(选填)\"," + | |||||
| "\"mem_phone_number\":\"string(选填)\"," + | |||||
| "\"business_type\":\"string(0:核销1支付(必填)\"," + | |||||
| "\"order_number_of_platform\":\"string(必填)\"," + | |||||
| "\"order_amount\":\"string单位(分)(选填)\"," + | |||||
| "\"order_amount_left\":\"string单位(分)(选填)\"," + | |||||
| "\"order_create_sn\":\"string单位(分)(必填)\"," + | |||||
| "\"payment_info\":{" + | |||||
| "\"coupon_id\":\"string(必填)\"," + | |||||
| "\"order_amount\":\"string单位(分)(选填)\"," + | |||||
| "\"amount_left\":\"string单位(分)(选填)\"," + | |||||
| "\"promotion_amount\":\"string单位(分)(选填)\"," + | |||||
| "\"amount_left_after_pay\":\"string单位(分)(选填)\"" + | |||||
| "}}") | |||||
| @PostMapping("/couponOrderVerifyCancel") | @PostMapping("/couponOrderVerifyCancel") | ||||
| @SystemControllerLog(description = "券核销取消") | @SystemControllerLog(description = "券核销取消") | ||||
| public Map<String, String> couponOrderIndependentVerifyCancel(@RequestBody Map<String, String> params) { | public Map<String, String> couponOrderIndependentVerifyCancel(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| JSONObject retObj = new JSONObject(); | |||||
| // 1. check sign | // 1. check sign | ||||
| Map<String, String> retMap = checkSign(params, payContent); | Map<String, String> retMap = checkSign(params, payContent); | ||||
| @@ -192,77 +193,12 @@ public class PosController extends BaseController { | |||||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | logger.info(WxPayConstant.RES_KEY + ": " + resKey); | ||||
| try { | try { | ||||
| retMap = posService.couponOrderVerifyCancel(params, EnumPosActionType.VERIFY_CANCEL); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| retObj = posService.couponOrderVerifyCancel(params); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",500, e.getMessage()); | |||||
| } | |||||
| } | |||||
| @ApiOperation(value = "POS支付-券", notes = "{" + | |||||
| "\"dev_id\":\"string(必填)\"," + | |||||
| "\"nonce_str\":\"string(必填)\"," + | |||||
| "\"tenant_id\":\"string(必填)\"," + | |||||
| "\"merchant_id\":\"string(必填)\"," + | |||||
| "\"bu_user_id\":\"string(必填)\"," + | |||||
| "\"sel_co_list\":\"json array[券包ID list](必填),例[\"1\",\"2\",\"3\"]\"" + | |||||
| "\"pos_order_id\":\"string(必填)\"," + | |||||
| "\"pos_amount\":\"string(必填)\"}") | |||||
| @PostMapping("/couponOrderPay") | |||||
| @SystemControllerLog(description = "POS支付-券") | |||||
| public Map<String, String> couponOrderPay(@RequestBody Map<String, String> params) { | |||||
| 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.couponOrderVerifyDo(params, EnumPosActionType.PAY_VERIFY_PRE); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } catch (MallinkException e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",500, e.getMessage()); | |||||
| } | |||||
| } | |||||
| @ApiOperation(value = "POS支付取消-券", notes = "{" + | |||||
| "\"dev_id\":\"string(必填)\"," + | |||||
| "\"tenant_id\":\"string(必填)\"," + | |||||
| "\"merchant_id\":\"string(必填)\"," + | |||||
| "\"bu_user_id\":\"string(必填)\"," + | |||||
| "\"coupon_order_id\":\"string(必填)\" +" + | |||||
| "\"nonce_str\":\"string(必填)\" +" + | |||||
| "\"pos_order_id\":\"string(必填)\" }") | |||||
| @PostMapping("/couponOrderPayCancel") | |||||
| @SystemControllerLog(description = "POS支付取消-券") | |||||
| public Map<String, String> couponOrderPayCancel(@RequestBody Map<String, String> params) { | |||||
| 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.couponOrderVerifyCancel(params, EnumPosActionType.PAY_VERIFY_PRE_CANCEL); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } catch (MallinkException e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",500, e.getMessage()); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "",500, e.getMessage()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -272,6 +208,7 @@ public class PosController extends BaseController { | |||||
| public Map<String, String> posOrderSync(@RequestBody Map<String, String> params) { | public Map<String, String> posOrderSync(@RequestBody Map<String, String> params) { | ||||
| logger.info(params.toString()); | logger.info(params.toString()); | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| JSONObject retObj = new JSONObject(); | |||||
| // 1. check sign | // 1. check sign | ||||
| Map<String, String> retMap = checkSign(params, payContent); | Map<String, String> retMap = checkSign(params, payContent); | ||||
| @@ -283,90 +220,15 @@ public class PosController extends BaseController { | |||||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | logger.info(WxPayConstant.RES_KEY + ": " + resKey); | ||||
| try { | try { | ||||
| retMap = posService.posOrderSync(params); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } catch (MallinkException e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| } | |||||
| } | |||||
| private Map<String, String> couponOrderPayVerify(@RequestBody Map<String, String> params) { | |||||
| 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.couponOrderVerifyDo(params, EnumPosActionType.VERIFY_PAY); | |||||
| } catch (MallinkException e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",500, e.getMessage()); | |||||
| } | |||||
| doActionAfterVerify(params, retMap); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } | |||||
| private Map<String, String> couponOrderPayVerifyList(@RequestBody Map<String, String> params) { | |||||
| 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.couponOrderVerifyListDo(params, EnumPosActionType.VERIFY_PAY); | |||||
| retObj = posService.posOrderSync(params); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",500, e.getMessage()); | |||||
| } | |||||
| String tenantId = params.get(WxPayConstant.TENANT_ID); // 租户ID | |||||
| String buUserIdStr = params.get(WxPayConstant.BUSER_ID); // POS操作员ID | |||||
| String arrString = retMap.get(WxPayConstant.RET); | |||||
| Long buUserId; | |||||
| try { | |||||
| buUserId = Long.valueOf(buUserIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", ErrorCode.SYS_PARAMETER_CAST_ERROR); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| } | } | ||||
| JSONArray couponArr = JSON.parseArray(arrString); | |||||
| for (int i = 0;i < couponArr.size(); i++) { | |||||
| String id = retMap.get(WxPayConstant.ID); | |||||
| Long couponOrderId; | |||||
| try { | |||||
| couponOrderId = Long.valueOf(id); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", ErrorCode.SYS_PARAMETER_CAST_ERROR); | |||||
| } | |||||
| String errCode = retMap.get(WxPayConstant.VERIFY); | |||||
| if(errCode.equalsIgnoreCase(WxPayConstant.TRUE)) { | |||||
| // 核销成功 | |||||
| couponOrderService.sendInsideCouponVerifyMsg(tenantId, couponOrderId, buUserId); | |||||
| } | |||||
| } | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } | } | ||||
| @ApiOperation(value = "消费卡预支付", notes = "{" + | @ApiOperation(value = "消费卡预支付", notes = "{" + | ||||
| "\"dev_id\":\"string(必填)\"," + | "\"dev_id\":\"string(必填)\"," + | ||||
| "\"nonce_str\":\"string(必填)\"," + | "\"nonce_str\":\"string(必填)\"," + | ||||
| @@ -380,6 +242,7 @@ public class PosController extends BaseController { | |||||
| @SystemControllerLog(description = "消费卡预支付") | @SystemControllerLog(description = "消费卡预支付") | ||||
| public Map<String, String> cardPayPre(@RequestBody Map<String, String> params) { | public Map<String, String> cardPayPre(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| JSONObject retObj = new JSONObject(); | |||||
| // 1. check sign | // 1. check sign | ||||
| Map<String, String> retMap = checkSign(params, payContent); | Map<String, String> retMap = checkSign(params, payContent); | ||||
| @@ -391,12 +254,12 @@ public class PosController extends BaseController { | |||||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | logger.info(WxPayConstant.RES_KEY + ": " + resKey); | ||||
| try { | try { | ||||
| retMap = posService.cardPayPre(params); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| retObj = posService.cardPayPre(params); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -414,6 +277,7 @@ public class PosController extends BaseController { | |||||
| @SystemControllerLog(description = "消费卡预支付取消") | @SystemControllerLog(description = "消费卡预支付取消") | ||||
| public Map<String, String> cardPayPreCancel(@RequestBody Map<String, String> params) { | public Map<String, String> cardPayPreCancel(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| JSONObject retObj = new JSONObject(); | |||||
| // 1. check sign | // 1. check sign | ||||
| Map<String, String> retMap = checkSign(params, payContent); | Map<String, String> retMap = checkSign(params, payContent); | ||||
| @@ -425,60 +289,15 @@ public class PosController extends BaseController { | |||||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | logger.info(WxPayConstant.RES_KEY + ": " + resKey); | ||||
| try { | try { | ||||
| retMap = posService.cardPayPreCancel(params); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| retObj = posService.cardPayPreCancel(params); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",500, e.getMessage()); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "",500, e.getMessage()); | |||||
| } | } | ||||
| } | } | ||||
| private Map<String, String> cardPay(@RequestBody Map<String, String> params) { | |||||
| 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.cardPay(params); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", null); | |||||
| } catch (MallinkException e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| } | |||||
| } | |||||
| private Map<String, String> cardPayCancel(@RequestBody Map<String, String> params) { | |||||
| 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.cardPayCancel(params); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } catch (MallinkException e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * 构造返回map,无签名, 有错误 | * 构造返回map,无签名, 有错误 | ||||
| * @param retCode | * @param retCode | ||||
| @@ -505,7 +324,7 @@ public class PosController extends BaseController { | |||||
| * @param err | * @param err | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| private Map<String, String> buildReturnMap(Map<String, String> dataMap, String resKey, String retCode, String retMsg, ErrorCode err) { | |||||
| private Map<String, String> buildReturnMap(JSONObject dataMap, String resKey, String retCode, String retMsg, ErrorCode err) { | |||||
| Map<String, String> retMap = new HashMap<>(); | Map<String, String> retMap = new HashMap<>(); | ||||
| retMap.put(WxPayConstant.RETURN_CODE, retCode); | retMap.put(WxPayConstant.RETURN_CODE, retCode); | ||||
| retMap.put(WxPayConstant.RETURN_MSG, retMsg); | retMap.put(WxPayConstant.RETURN_MSG, retMsg); | ||||
| @@ -532,11 +351,8 @@ public class PosController extends BaseController { | |||||
| * @param errMsg | * @param errMsg | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| private Map<String, String> buildReturnMap(Map<String, String> dataMap, String resKey, String retCode, String retMsg, Integer errCode, String errMsg) { | |||||
| private Map<String, String> buildReturnMap(JSONObject dataMap, String resKey, String retCode, String retMsg, Integer errCode, String errMsg) { | |||||
| Map<String, String> retMap = new HashMap<>(); | Map<String, String> retMap = new HashMap<>(); | ||||
| if(retMap == null) { | |||||
| retMap = new HashMap<>(); | |||||
| } | |||||
| 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, "" + errCode); | retMap.put(WxPayConstant.RESULT_CODE, "" + errCode); | ||||
| @@ -1,7 +1,6 @@ | |||||
| package com.iformall.service; | package com.iformall.service; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.iformall.enums.EnumPosActionType; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -14,60 +13,30 @@ public interface PosService { | |||||
| * @param params | * @param params | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| Map<String, String> checkUserPassword(Map<String, String> params) throws MallinkException; | |||||
| /** | |||||
| * 获取商城会员设置状态 | |||||
| * @param params | |||||
| * @return | |||||
| */ | |||||
| Map<String, String> getPosMemConfig(Map<String, String> params) throws MallinkException; | |||||
| /** | |||||
| * 获取商城二维码 | |||||
| * @param params | |||||
| * @return | |||||
| */ | |||||
| Map<String, String> doGetQrCode(Map<String, String> params) throws MallinkException; | |||||
| /** | |||||
| * 识别会员 | |||||
| * @param params | |||||
| * @return | |||||
| */ | |||||
| Map<String, String> checkMember(Map<String, String> params) throws MallinkException; | |||||
| JSONObject checkUserPassword(Map<String, String> params) throws MallinkException; | |||||
| /** | /** | ||||
| * 支付计算 | * 支付计算 | ||||
| * @param params | * @param params | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| Map<String, String> queryAndCalcMem(Map<String, String> params) throws MallinkException; | |||||
| /** | |||||
| * 核销动作(check, pre_verify, verify) | |||||
| * @param params | |||||
| * @param actionType | |||||
| * @return | |||||
| * @throws MallinkException | |||||
| */ | |||||
| Map<String, String> couponOrderVerifyDo(Map<String, String> params, EnumPosActionType actionType) throws MallinkException; | |||||
| JSONObject queryAndCalcMem(Map<String, String> params) throws MallinkException; | |||||
| /** | /** | ||||
| * 核销取消(check, pre_verify, verify) for selected_coupon_list | |||||
| * 优惠核销(包含核销,支付预核销) | |||||
| * @param params | * @param params | ||||
| * @param actionType | |||||
| * @return | * @return | ||||
| * @throws MallinkException | * @throws MallinkException | ||||
| */ | */ | ||||
| Map<String, String> couponOrderVerifyCancel(Map<String, String> params, EnumPosActionType actionType) throws MallinkException; | |||||
| JSONObject couponOrderVerify(Map<String, String> params) throws MallinkException; | |||||
| /** | /** | ||||
| * 核销动作(check, pre_verify, verify) for selected_coupon_list | |||||
| * 优惠撤销(包含核销撤销,支付预核销撤销) | |||||
| * @param params | * @param params | ||||
| * @param actionType | |||||
| * @return | * @return | ||||
| * @throws MallinkException | * @throws MallinkException | ||||
| */ | */ | ||||
| Map<String, String> couponOrderVerifyListDo(Map<String, String> params, EnumPosActionType actionType) throws MallinkException; | |||||
| JSONObject couponOrderVerifyCancel(Map<String, String> params) throws MallinkException; | |||||
| /** | /** | ||||
| * 消费卡POS预支付 | * 消费卡POS预支付 | ||||
| @@ -75,7 +44,7 @@ public interface PosService { | |||||
| * @return | * @return | ||||
| * @throws MallinkException | * @throws MallinkException | ||||
| */ | */ | ||||
| Map<String, String> cardPayPre(Map<String, String> params) throws MallinkException; | |||||
| JSONObject cardPayPre(Map<String, String> params) throws MallinkException; | |||||
| /** | /** | ||||
| * 消费卡POS预支付取消 | * 消费卡POS预支付取消 | ||||
| @@ -83,7 +52,7 @@ public interface PosService { | |||||
| * @return | * @return | ||||
| * @throws MallinkException | * @throws MallinkException | ||||
| */ | */ | ||||
| Map<String, String> cardPayPreCancel(Map<String, String> params) throws MallinkException; | |||||
| JSONObject cardPayPreCancel(Map<String, String> params) throws MallinkException; | |||||
| /** | /** | ||||
| * 订单同步-Neusoft-支付或者退款成功后通知富茂 | * 订单同步-Neusoft-支付或者退款成功后通知富茂 | ||||
| @@ -91,7 +60,7 @@ public interface PosService { | |||||
| * @return | * @return | ||||
| * @throws MallinkException | * @throws MallinkException | ||||
| */ | */ | ||||
| Map<String, String> posOrderSync(Map<String, String> params) throws MallinkException; | |||||
| JSONObject posOrderSync(Map<String, String> params) throws MallinkException; | |||||
| /** | /** | ||||
| * 消费卡POS支付 | * 消费卡POS支付 | ||||
| @@ -99,7 +68,7 @@ public interface PosService { | |||||
| * @return | * @return | ||||
| * @throws MallinkException | * @throws MallinkException | ||||
| */ | */ | ||||
| Map<String, String> cardPay(Map<String, String> params) throws MallinkException; | |||||
| //Map<String, String> cardPay(Map<String, String> params) throws MallinkException; | |||||
| /** | /** | ||||
| @@ -108,7 +77,7 @@ public interface PosService { | |||||
| * @return | * @return | ||||
| * @throws MallinkException | * @throws MallinkException | ||||
| */ | */ | ||||
| Map<String, String> cardPayCancel(Map<String, String> params) throws MallinkException; | |||||
| //Map<String, String> cardPayCancel(Map<String, String> params) throws MallinkException; | |||||
| } | } | ||||
| @@ -118,52 +118,9 @@ public class PosAppTest { | |||||
| boolean resSigned = sendAndRes("/checkUserPassword", reqObj); | boolean resSigned = sendAndRes("/checkUserPassword", reqObj); | ||||
| Assert.assertEquals(resSigned, true); | Assert.assertEquals(resSigned, true); | ||||
| } | } | ||||
| @Test | |||||
| public void getPosMemConfigTest() 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); | |||||
| boolean resSigned = sendAndRes("/getPosMemConfig", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | |||||
| @Test | |||||
| public void getQrCodeTest() 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); | |||||
| boolean resSigned = sendAndRes("/getQrCode", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | |||||
| @Test | |||||
| public void checkMemTest() throws Exception { | |||||
| String memId = "321178010928119808"; | |||||
| String phone = "13910154397"; | |||||
| String posOrderId = "1"; | |||||
| String posAmount = "200"; | |||||
| 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.ORDER_AMOUNT, posAmount); | |||||
| boolean resSigned = sendAndRes("/checkMem", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | |||||
| @Test | @Test | ||||
| public void checkVerifyCalcTest() throws Exception { | |||||
| public void verifyCalculateTest() throws Exception { | |||||
| String selCoList = "[\"321872988134408192\"]"; | String selCoList = "[\"321872988134408192\"]"; | ||||
| String sceneType = String.valueOf(EnumPosSceneType.VERIFY.getCode()); | String sceneType = String.valueOf(EnumPosSceneType.VERIFY.getCode()); | ||||
| Map<String, String> reqObj = new HashMap<>(); | Map<String, String> reqObj = new HashMap<>(); | ||||
| @@ -180,7 +137,7 @@ public class PosAppTest { | |||||
| } | } | ||||
| @Test | @Test | ||||
| public void checkPayCalcTest() throws Exception { | |||||
| public void payCalculateTest_NoCouponOrder() throws Exception { | |||||
| String memId = "321178010928119808"; | String memId = "321178010928119808"; | ||||
| String phone = "13910154397"; | String phone = "13910154397"; | ||||
| String orderAmount = "2000"; | String orderAmount = "2000"; | ||||
| @@ -205,7 +162,7 @@ public class PosAppTest { | |||||
| } | } | ||||
| @Test | @Test | ||||
| public void checkPayCalc1Test() throws Exception { | |||||
| public void payCalculateTest_WithOneCouponOrder() throws Exception { | |||||
| String memId = "321178010928119808"; | String memId = "321178010928119808"; | ||||
| String phone = "13910154397"; | String phone = "13910154397"; | ||||
| String orderAmount = "20000"; | String orderAmount = "20000"; | ||||
| @@ -228,46 +185,107 @@ public class PosAppTest { | |||||
| boolean resSigned = sendAndRes("/queryAndCalc", reqObj); | boolean resSigned = sendAndRes("/queryAndCalc", reqObj); | ||||
| Assert.assertEquals(resSigned, true); | Assert.assertEquals(resSigned, true); | ||||
| } | } | ||||
| /* | |||||
| @Test | |||||
| public void getPosMemConfigTest() 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); | |||||
| boolean resSigned = sendAndRes("/getPosMemConfig", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | |||||
| @Test | @Test | ||||
| public void checkCouponOrderVerifyTest() throws Exception { | |||||
| String couponOrderId = "321878223800205312"; | |||||
| String sceneType = "2"; | |||||
| String posOrderId = "1"; | |||||
| String posAmount = "100"; | |||||
| doCheckCouponOrder(couponOrderId, sceneType, posOrderId, posAmount); | |||||
| public void getQrCodeTest() 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); | |||||
| boolean resSigned = sendAndRes("/getQrCode", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | } | ||||
| @Test | @Test | ||||
| public void checkCouponOrderPayTest() throws Exception { | |||||
| String couponOrderId = "321877927162249216"; | |||||
| String sceneType = "1"; | |||||
| public void checkMemTest() throws Exception { | |||||
| String memId = "321178010928119808"; | |||||
| String phone = "13910154397"; | |||||
| String posOrderId = "1"; | String posOrderId = "1"; | ||||
| String posAmount = "100"; | |||||
| doCheckCouponOrder(couponOrderId, sceneType, posOrderId, posAmount); | |||||
| String posAmount = "200"; | |||||
| 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.ORDER_AMOUNT, posAmount); | |||||
| boolean resSigned = sendAndRes("/checkMem", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | } | ||||
| */ | |||||
| @Test | @Test | ||||
| public void couponOrderVerifyTest() throws Exception { | |||||
| String couponOrderId = "321878223800205312"; | |||||
| public void verifyTest() throws Exception { | |||||
| String posOrderId = "1"; | String posOrderId = "1"; | ||||
| doCouponOrderVerify(couponOrderId, posOrderId); | |||||
| String selCoList = "[\"321878223800205312\"]"; | |||||
| String sceneType = String.valueOf(EnumPosSceneType.VERIFY.getCode()); | |||||
| 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.SCENE_TYPE, sceneType); | |||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | |||||
| reqObj.put(WxPayConstant.ORDER_CREATE_SN, posSN); | |||||
| reqObj.put(WxPayConstant.COUPON_ORDER_LIST, selCoList); | |||||
| boolean resSigned = sendAndRes("/couponOrderVerify", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | } | ||||
| @Test | @Test | ||||
| public void couponOrderVerifyCancelTest() throws Exception { | public void couponOrderVerifyCancelTest() throws Exception { | ||||
| String couponOrderId = "321878223800205312"; | |||||
| String posOrderId = "1"; | String posOrderId = "1"; | ||||
| doCouponOrderVerifyCancel(couponOrderId, posOrderId); | |||||
| String couponOrderId = "321878223800205312"; | |||||
| String orderAmount = "1000"; | |||||
| String amountLeft = "0"; | |||||
| String sceneType = String.valueOf(EnumPosSceneType.VERIFY.getCode()); | |||||
| Map<String, String> reqObj = new HashMap<>(); | |||||
| JSONObject paymentInfo = new JSONObject(); | |||||
| paymentInfo.put(WxPayConstant.COUPON_ID, couponOrderId); | |||||
| paymentInfo.put(WxPayConstant.ORDER_AMOUNT, orderAmount); | |||||
| paymentInfo.put(WxPayConstant.ORDER_AMOUNT_LEFT, orderAmount); | |||||
| paymentInfo.put(WxPayConstant.PROMOTION_AMOUNT, orderAmount); | |||||
| paymentInfo.put(WxPayConstant.AMOUNT_LEFT_AFTER_PAY, amountLeft); | |||||
| 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.SCENE_TYPE, sceneType); | |||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId); | |||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | |||||
| reqObj.put(WxPayConstant.PAYMENT_INFO, JSON.toJSONString(paymentInfo)); | |||||
| boolean resSigned = sendAndRes("/couponOrderVerifyCancel", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | } | ||||
| @Test | @Test | ||||
| public void verifySyncTest() throws Exception { | public void verifySyncTest() throws Exception { | ||||
| String memId = "321178010928119808"; | String memId = "321178010928119808"; | ||||
| String memPhone = "13910154397"; | String memPhone = "13910154397"; | ||||
| String sceneType = "2"; // 核销 | |||||
| String sceneType = "0"; // 核销 | |||||
| String posOrderId = "1"; | String posOrderId = "1"; | ||||
| String posAmount = "20000"; | |||||
| String posAmount = "1000"; | |||||
| String posPayOrderId = "1"; | String posPayOrderId = "1"; | ||||
| String posPaymentType = "4"; | String posPaymentType = "4"; | ||||
| String posPaymentTypeDes = "优惠券"; | String posPaymentTypeDes = "优惠券"; | ||||
| @@ -312,6 +330,83 @@ public class PosAppTest { | |||||
| Assert.assertEquals(resSigned, true); | Assert.assertEquals(resSigned, true); | ||||
| } | } | ||||
| @Test | |||||
| public void payVerifyTest() throws Exception { | |||||
| String memId = "321178010928119808"; | |||||
| String memPhone = "13910154397"; | |||||
| String posOrderId = "2"; | |||||
| String orderAmount = "1000"; | |||||
| String selCoList = "[\"321878223800205312\"]"; | |||||
| String sceneType = String.valueOf(EnumPosSceneType.PAY.getCode()); | |||||
| 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.MEM_ID, memId); | |||||
| reqObj.put(WxPayConstant.MEM_PHONE, memPhone); | |||||
| reqObj.put(WxPayConstant.SCENE_TYPE, sceneType); | |||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | |||||
| reqObj.put(WxPayConstant.ORDER_AMOUNT, orderAmount); | |||||
| reqObj.put(WxPayConstant.ORDER_AMOUNT_LEFT, orderAmount); | |||||
| reqObj.put(WxPayConstant.ORDER_CREATE_SN, posSN); | |||||
| reqObj.put(WxPayConstant.COUPON_ORDER_LIST, selCoList); | |||||
| boolean resSigned = sendAndRes("/couponOrderVerify", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | |||||
| @Test | |||||
| public void payVerifySyncTest() throws Exception { | |||||
| String memId = "321178010928119808"; | |||||
| String memPhone = "13910154397"; | |||||
| String sceneType = "1"; // 支付 | |||||
| String posOrderId = "2"; | |||||
| String orderAmount = "1000"; | |||||
| String posPayOrderId = "2"; | |||||
| 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, orderAmount); | |||||
| 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, orderAmount); | |||||
| 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"; | ||||
| @@ -359,49 +454,6 @@ public class PosAppTest { | |||||
| doCardPayPreCancel(cardId, cardSpendId, posOrderId); | doCardPayPreCancel(cardId, cardSpendId, posOrderId); | ||||
| } | } | ||||
| private void doCheckCouponOrder(String couponOrderId, String sceneType, 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.COUPON_ORDER_ID, couponOrderId); | |||||
| reqObj.put(WxPayConstant.SCENE_TYPE, sceneType); | |||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | |||||
| reqObj.put(WxPayConstant.ORDER_AMOUNT, posAmount); | |||||
| boolean resSigned = sendAndRes("/checkCouponOrder", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | |||||
| private void doCouponOrderVerify(String couponOrderId, 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.COUPON_ORDER_ID, couponOrderId); | |||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | |||||
| boolean resSigned = sendAndRes("/couponOrderVerify", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | |||||
| private void doCouponOrderVerifyCancel(String couponOrderId, 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.COUPON_ORDER_ID, couponOrderId); | |||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId); | |||||
| boolean resSigned = sendAndRes("/couponOrderVerifyCancel", reqObj); | |||||
| Assert.assertEquals(resSigned, true); | |||||
| } | |||||
| private void doPreVerify(String couponOrderId, String posOrderId, String posAmount) throws Exception { | private void doPreVerify(String couponOrderId, String posOrderId, String posAmount) throws Exception { | ||||
| Map<String, String> reqObj = new HashMap<>(); | Map<String, String> reqObj = new HashMap<>(); | ||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | reqObj.put(WxPayConstant.NONCE_STR, "1"); | ||||
| @@ -44,8 +44,10 @@ public class WxBillSettleBill extends BaseEntity { | |||||
| @Transient | @Transient | ||||
| private String receivePay; | private String receivePay; | ||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value="账单开始时间",name="starttime") | @io.swagger.annotations.ApiModelProperty(value="账单开始时间",name="starttime") | ||||
| private Date starttime; | private Date starttime; | ||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value="账单结束时间",name="endtime") | @io.swagger.annotations.ApiModelProperty(value="账单结束时间",name="endtime") | ||||
| private Date endtime; | private Date endtime; | ||||
| } | } | ||||
| @@ -65,11 +65,8 @@ public class WxCardSpend extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="支付状态(0:未分帐, 1:已分账, 2:已人工分账, 10:预支付(POS))",name="payStatus") | @io.swagger.annotations.ApiModelProperty(value="支付状态(0:未分帐, 1:已分账, 2:已人工分账, 10:预支付(POS))",name="payStatus") | ||||
| private Integer payStatus; | private Integer payStatus; | ||||
| @io.swagger.annotations.ApiModelProperty(value="来源(0:C端小程序扫一扫, 1:POS支付)",name="from") | |||||
| private Integer from; | |||||
| @io.swagger.annotations.ApiModelProperty(value="pos状态(1:POS线下退款开始, 2:POS线下退款成功)",name="posRefundStatus") | |||||
| private Integer posRefundStatus; | |||||
| @io.swagger.annotations.ApiModelProperty(value="来源(0:C端小程序扫一扫, 1:POS支付)",name="payFrom") | |||||
| private Integer payFrom; | |||||
| @Transient | @Transient | ||||
| @Excel(name = "消费金额(元)", width = 20, orderNum = "7") | @Excel(name = "消费金额(元)", width = 20, orderNum = "7") | ||||
| @@ -122,7 +122,6 @@ public class WxBillAll extends BaseEntity { | |||||
| private String payDate; | private String payDate; | ||||
| @Transient | @Transient | ||||
| @io.swagger.annotations.ApiModelProperty(value = "过滤已收金额1过滤", name = "filterHasPay") | @io.swagger.annotations.ApiModelProperty(value = "过滤已收金额1过滤", name = "filterHasPay") | ||||
| private Integer filterHasPay; | private Integer filterHasPay; | ||||
| @@ -146,6 +145,11 @@ public class WxBillAll extends BaseEntity { | |||||
| @Transient | @Transient | ||||
| private Integer balance; | private Integer balance; | ||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value = "冻结状态0正常1冻结", name = "freeze") | |||||
| private Integer freeze; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "多个类型", name = "typeStr") | @io.swagger.annotations.ApiModelProperty(value = "多个类型", name = "typeStr") | ||||
| private String typeStr; | private String typeStr; | ||||
| @@ -29,7 +29,7 @@ public class WxPayConstant { | |||||
| public final static String BUSER_ID = "order_operation_id"; | public final static String BUSER_ID = "order_operation_id"; | ||||
| public final static String COUPON_ORDER_ID = "coupon_order_id"; | public final static String COUPON_ORDER_ID = "coupon_order_id"; | ||||
| public final static String COUPON_ORDER_LIST = "coupon_list"; | public final static String COUPON_ORDER_LIST = "coupon_list"; | ||||
| public final static String POS_ORDER_ID = "pos_order_id"; | |||||
| public final static String POS_ORDER_ID = "order_number_of_platform"; | |||||
| public final static String ORDER_CREATE_SN = "order_create_sn"; | public final static String ORDER_CREATE_SN = "order_create_sn"; | ||||
| public final static String ORDER_AMOUNT = "order_amount"; | public final static String ORDER_AMOUNT = "order_amount"; | ||||
| public final static String ORDER_AMOUNT_LEFT = "order_amount_left"; | public final static String ORDER_AMOUNT_LEFT = "order_amount_left"; | ||||
| @@ -39,6 +39,7 @@ public class WxPayConstant { | |||||
| public final static String CARD_SPEND_ID = "card_spend_id"; | public final static String CARD_SPEND_ID = "card_spend_id"; | ||||
| public final static String PHONE = "phone"; | public final static String PHONE = "phone"; | ||||
| public final static String PASSWORD = "password"; | public final static String PASSWORD = "password"; | ||||
| public final static String MEM_CONFIG = "mem_config"; | |||||
| public final static String PROMOTION_AMOUNT = "promotion_amount"; | public final static String PROMOTION_AMOUNT = "promotion_amount"; | ||||
| public final static String AMOUNT_LEFT_AFTER_PAY = "amount_left_after_pay"; | public final static String AMOUNT_LEFT_AFTER_PAY = "amount_left_after_pay"; | ||||
| @@ -69,6 +70,7 @@ public class WxPayConstant { | |||||
| public final static String REG_QRCODE_URL = "qrcode_url"; | public final static String REG_QRCODE_URL = "qrcode_url"; | ||||
| public final static String POS_QRCODE_RULE = "pos_qrcode_rule"; | public final static String POS_QRCODE_RULE = "pos_qrcode_rule"; | ||||
| public final static String QRCODE = "qrcode"; | |||||
| public final static String DISCOUNT = "discount"; | public final static String DISCOUNT = "discount"; | ||||
| @@ -85,6 +87,12 @@ public class WxPayConstant { | |||||
| public final static String COUPON_TYPE = "coupon_type"; | public final static String COUPON_TYPE = "coupon_type"; | ||||
| public final static String IS_SELECTED = "is_selected"; | public final static String IS_SELECTED = "is_selected"; | ||||
| public final static String COUPON_REFUND_RESULT = "coupon_refund_result"; | |||||
| public final static String COUPON_REFUND_ID = "coupon_refund_id"; | |||||
| public final static String COUPON_REFUND_RESULT_CODE = "result_code"; | |||||
| public final static String COUPON_REFUND_RESULT_MSG = "result_msg"; | |||||
| public final static String REFUND_TIME_FROM_IFORMALL = "refund_time_from_iformall"; | |||||
| public final static String COUPON_PROMOTION_AMOUNT = "coupon_promotion_amount"; | public final static String COUPON_PROMOTION_AMOUNT = "coupon_promotion_amount"; | ||||
| public final static String MEMBER_DISCOUNT = "member_discount"; | public final static String MEMBER_DISCOUNT = "member_discount"; | ||||
| @@ -92,6 +100,8 @@ public class WxPayConstant { | |||||
| public final static String PROMOTION_DATA = "promotion_data"; | public final static String PROMOTION_DATA = "promotion_data"; | ||||
| public final static String PAYMENT_PREDICTION = "payment_prediction"; | public final static String PAYMENT_PREDICTION = "payment_prediction"; | ||||
| public final static String PAYMENT_INFO = "payment_info"; | |||||
| public final static String DEDUCT_AMOUNT = "deduct_amount"; | public final static String DEDUCT_AMOUNT = "deduct_amount"; | ||||
| public final static String REMAIN_AMOUNT = "remain_amount"; | public final static String REMAIN_AMOUNT = "remain_amount"; | ||||
| public final static String ORDER_STATUS = "order_status"; | public final static String ORDER_STATUS = "order_status"; | ||||
| @@ -123,7 +133,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_SCENE_TYPE = "BusinessType"; // 订单场景 // 0:核销 1:支付 | |||||
| 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.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.WxBillSettle; | |||||
| import com.iformall.domain.vo.WxBillAll; | import com.iformall.domain.vo.WxBillAll; | ||||
| import com.iformall.domain.vo.WxBillExcelTemplate; | import com.iformall.domain.vo.WxBillExcelTemplate; | ||||
| import com.iformall.domain.vo.WxBillExcelTemplateOther; | import com.iformall.domain.vo.WxBillExcelTemplateOther; | ||||
| @@ -68,6 +69,8 @@ public interface WxBillAllService { | |||||
| void exportOweBill(WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response); | void exportOweBill(WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response); | ||||
| void exportSettleBill(WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response); | |||||
| ResultData updateReceivePay(WxBillAll wxBillAll, MallUserInfo user); | ResultData updateReceivePay(WxBillAll wxBillAll, MallUserInfo user); | ||||
| void addBillAction(EnumBillAction billAction, Long billId, Long oldPrice, Long newPrice, MallUserInfo mallUserInfo); | void addBillAction(EnumBillAction billAction, Long billId, Long oldPrice, Long newPrice, MallUserInfo mallUserInfo); | ||||
| @@ -779,6 +779,26 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| String createtime = DateUtils.getSystemTime("yyyy-MM-dd"); | String createtime = DateUtils.getSystemTime("yyyy-MM-dd"); | ||||
| result.put("createtime", createtime); | result.put("createtime", createtime); | ||||
| String templatePath = "contract-word-template/bill_owe.docx"; | |||||
| String filepath = fmUploadDir; | |||||
| String filename = UUID.randomUUID() + ".docx"; | |||||
| String exportFileName = "催缴单.docx"; | |||||
| WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response); | |||||
| } | |||||
| @Override | |||||
| public void exportSettleBill(WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response) { | |||||
| //商场名称 | |||||
| WxMall wxMall = wxMallMapper.getByTenantId(wxBillSettle.getTenantId()); | |||||
| //映射结果 | |||||
| Map<String, Object> result = new HashMap<>(); | |||||
| result.put("mall", wxMall.getName()); | |||||
| //编号 | |||||
| String number = "JF" + DateUtils.getSystemTime("yyyyMMddHHmmss"); | |||||
| result.put("number", number); | |||||
| String templatePath = "contract-word-template/bill_owe.docx"; | String templatePath = "contract-word-template/bill_owe.docx"; | ||||
| String filepath = fmUploadDir; | String filepath = fmUploadDir; | ||||
| String filename = UUID.randomUUID() + ".docx"; | String filename = UUID.randomUUID() + ".docx"; | ||||
| @@ -12,6 +12,7 @@ import com.iformall.service.ExcelService; | |||||
| import com.iformall.service.WxBillSettleService; | import com.iformall.service.WxBillSettleService; | ||||
| import com.iformall.service.WxFlowService; | import com.iformall.service.WxFlowService; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import org.apache.commons.collections.CollectionUtils; | |||||
| import org.checkerframework.checker.units.qual.A; | import org.checkerframework.checker.units.qual.A; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| @@ -31,6 +32,8 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| @Autowired | @Autowired | ||||
| private WxBillSettleMapper wxBillSettleMapper; | private WxBillSettleMapper wxBillSettleMapper; | ||||
| @Autowired | @Autowired | ||||
| private WxMerchantMapper wxMerchantMapper; | |||||
| @Autowired | |||||
| private WxFlowService wxFlowService; | private WxFlowService wxFlowService; | ||||
| @Autowired | @Autowired | ||||
| private WxBillSettleBillMapper wxBillSettleBillMapper; | private WxBillSettleBillMapper wxBillSettleBillMapper; | ||||
| @@ -69,6 +72,11 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| WxBillSettle billSettle = wxBillSettleMapper.selectByPrimaryKey(id); | WxBillSettle billSettle = wxBillSettleMapper.selectByPrimaryKey(id); | ||||
| if(billSettle != null) { | if(billSettle != null) { | ||||
| WxMerchant merchant = wxMerchantMapper.selectByPrimaryKey(billSettle.getMerchantId()); | |||||
| if(merchant != null){ | |||||
| billSettle.setMerchantName(merchant.getName()); | |||||
| } | |||||
| if(billSettle.getReceiveMoney() > billSettle.getPayMoney()){ | if(billSettle.getReceiveMoney() > billSettle.getPayMoney()){ | ||||
| billSettle.setSettleWay(EnumSettleWay.B.getCode()); | billSettle.setSettleWay(EnumSettleWay.B.getCode()); | ||||
| }else{ | }else{ | ||||
| @@ -152,6 +160,10 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| @Transactional | @Transactional | ||||
| public ResultData saveOrUpdate(WxBillSettle record, MallUserInfo userInfo) { | public ResultData saveOrUpdate(WxBillSettle record, MallUserInfo userInfo) { | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| if (record.getFlowParams() == null || record.getFlowParams().size() == 0) { | |||||
| record.setStatus(EnumSettleStatus.NOT_FINISH.getCode()); | |||||
| } | |||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| wxBillSettleMapper.insertSelective(record); | wxBillSettleMapper.insertSelective(record); | ||||
| @@ -137,7 +137,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| // 5 insert card_spend | // 5 insert card_spend | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| record.setTenantId(cardInfo.getTenantId()); | record.setTenantId(cardInfo.getTenantId()); | ||||
| record.setFrom(EnumCardSpendFrom.C.getCode()); | |||||
| record.setPayFrom(EnumCardSpendFrom.C.getCode()); | |||||
| record.setPayment(payment); | record.setPayment(payment); | ||||
| record.setRealPayment(real_payment); | record.setRealPayment(real_payment); | ||||
| record.setCardBeforeAmount(cardInfo.getRemainingAmount()); | record.setCardBeforeAmount(cardInfo.getRemainingAmount()); | ||||
| @@ -203,9 +203,9 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| wxPropertyContractMapper.updateApplyStatus(wxPropertyContract); | wxPropertyContractMapper.updateApplyStatus(wxPropertyContract); | ||||
| } | } | ||||
| } else if (EnumFlowKey.BILL.getCode().equals(flowType) || EnumFlowKey.NEW_BILL_CHANGE.getCode().equals(flowType)) { | } else if (EnumFlowKey.BILL.getCode().equals(flowType) || EnumFlowKey.NEW_BILL_CHANGE.getCode().equals(flowType)) { | ||||
| Integer billType = getIngeter(getVariableByKey(variables, "billType")); | |||||
| if(EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { | if(EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { | ||||
| //账单审批 | //账单审批 | ||||
| Integer billType = getIngeter(getVariableByKey(variables, "billType")); | |||||
| MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); | MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); | ||||
| Integer billUpdateType = getIngeter(getVariableByKey(variables, "billUpdateType")); | Integer billUpdateType = getIngeter(getVariableByKey(variables, "billUpdateType")); | ||||
| Long oldPrice = Long.parseLong(getVariableByKey(variables, "oldPrice").toString()); | Long oldPrice = Long.parseLong(getVariableByKey(variables, "oldPrice").toString()); | ||||
| @@ -221,6 +221,14 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| wxBillAll.setNewPrice(newPrice); | wxBillAll.setNewPrice(newPrice); | ||||
| } | } | ||||
| wxBillAllService.updateReceivePay(wxBillAll, user); | wxBillAllService.updateReceivePay(wxBillAll, user); | ||||
| }else{ | |||||
| //账单修改金额,冻结 | |||||
| List<WxBillSettleBill> billList = new ArrayList<>(); | |||||
| WxBillSettleBill settleBill = new WxBillSettleBill(); | |||||
| settleBill.setBillType(billType); | |||||
| settleBill.setBillId(businessId); | |||||
| billList.add(settleBill); | |||||
| wxBillSettleService.updateFreeze(billList,EnumFreezeType.YES.getCode()); | |||||
| } | } | ||||
| } else if (EnumFlowKey.NEW_COUPON_UPLINE.getCode().equals(flowType) | } else if (EnumFlowKey.NEW_COUPON_UPLINE.getCode().equals(flowType) | ||||
| || EnumFlowKey.NEW_CARD_UPLINE.getCode().equals(flowType) | || EnumFlowKey.NEW_CARD_UPLINE.getCode().equals(flowType) | ||||
| @@ -2010,7 +2010,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| String ratio = new BigDecimal(integers.get(i)).divide(new BigDecimal(100)).toPlainString(); | String ratio = new BigDecimal(integers.get(i)).divide(new BigDecimal(100)).toPlainString(); | ||||
| result.put("adjustRatio" + i, ratio); | result.put("adjustRatio" + i, ratio); | ||||
| result.put("adjustPeriod" + i, wxRentContract.getAdjustPeriod()); | result.put("adjustPeriod" + i, wxRentContract.getAdjustPeriod()); | ||||
| String payRatio = new BigDecimal(wxRentContract.getPayRatio()).divide(new BigDecimal(100)).toPlainString(); | |||||
| Integer tempPayRatio = Optional.ofNullable(wxRentContract.getPayRatio()).orElse(0); | |||||
| String payRatio = new BigDecimal(tempPayRatio).divide(new BigDecimal(100)).toPlainString(); | |||||
| result.put("payRatio" + i, payRatio); | result.put("payRatio" + i, payRatio); | ||||
| } | } | ||||
| @@ -2039,7 +2040,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| result.put("rentalEndDateDay" + count, enddate.substring(8)); | result.put("rentalEndDateDay" + count, enddate.substring(8)); | ||||
| result.put("adjustRatio" + count, wxRentContract.getAdjustRatio()); | result.put("adjustRatio" + count, wxRentContract.getAdjustRatio()); | ||||
| result.put("adjustPeriod" + count, wxRentContract.getAdjustPeriod()); | result.put("adjustPeriod" + count, wxRentContract.getAdjustPeriod()); | ||||
| String payRatio = new BigDecimal(wxRentContract.getPayRatio()).divide(new BigDecimal(100)).toPlainString(); | |||||
| Integer tempPayRatio = Optional.ofNullable(wxRentContract.getPayRatio()).orElse(0); | |||||
| String payRatio = new BigDecimal(tempPayRatio).divide(new BigDecimal(100)).toPlainString(); | |||||
| result.put("payRatio" + count, payRatio); | result.put("payRatio" + count, payRatio); | ||||
| } | } | ||||
| @@ -2,7 +2,9 @@ package com.iformall.utils; | |||||
| import cn.afterturn.easypoi.word.WordExportUtil; | import cn.afterturn.easypoi.word.WordExportUtil; | ||||
| import org.apache.commons.io.FileUtils; | import org.apache.commons.io.FileUtils; | ||||
| import org.apache.poi.xwpf.usermodel.XWPFDocument; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.apache.poi.xwpf.usermodel.*; | |||||
| import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.util.Assert; | import org.springframework.util.Assert; | ||||
| @@ -12,6 +14,7 @@ import javax.servlet.http.HttpServletResponse; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
| import java.io.OutputStream; | import java.io.OutputStream; | ||||
| import java.util.List; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| public class WordUtil { | public class WordUtil { | ||||
| @@ -84,4 +87,214 @@ public class WordUtil { | |||||
| } | } | ||||
| /** | |||||
| * 循环填充表格内容 | |||||
| * @param xwpfDocument | |||||
| * @param params | |||||
| * @param tableIndex | |||||
| * @throws Exception | |||||
| */ | |||||
| private void insertValueToTable(XWPFDocument xwpfDocument, List<Map<String,String>> params, int tableIndex) throws Exception { | |||||
| List<XWPFTable> tableList = xwpfDocument.getTables(); | |||||
| if(tableList.size()<=tableIndex){ | |||||
| throw new Exception("tableIndex对应的表格不存在"); | |||||
| } | |||||
| XWPFTable table = tableList.get(tableIndex); | |||||
| List<XWPFTableRow> rows = table.getRows(); | |||||
| if(rows.size()<2){ | |||||
| throw new Exception("tableIndex对应表格应该为2行"); | |||||
| } | |||||
| //模板的那一行 | |||||
| XWPFTableRow tmpRow = rows.get(1); | |||||
| List<XWPFTableCell> tmpCells = null; | |||||
| List<XWPFTableCell> cells = null; | |||||
| XWPFTableCell tmpCell = null; | |||||
| tmpCells = tmpRow.getTableCells(); | |||||
| String cellText = null; | |||||
| String cellTextKey = null; | |||||
| Map<String,Object> totalMap = null; | |||||
| for (int i = 0, len = params.size(); i < len; i++) { | |||||
| Map<String,String> map = params.get(i); | |||||
| // 创建新的一行 | |||||
| XWPFTableRow row = table.createRow(); | |||||
| // 获取模板的行高 设置为新一行的行高 | |||||
| row.setHeight(tmpRow.getHeight()); | |||||
| cells = row.getTableCells(); | |||||
| for (int k = 0, klen = cells.size(); k < klen; k++) { | |||||
| tmpCell = tmpCells.get(k); | |||||
| XWPFTableCell cell = cells.get(k); | |||||
| cellText = tmpCell.getText(); | |||||
| if (StringUtils.isNotBlank(cellText)) { | |||||
| //转换为mapkey对应的字段 | |||||
| cellTextKey = cellText.replace("$", "").replace("{", "").replace("}", ""); | |||||
| if (map.containsKey(cellTextKey)) { | |||||
| // 填充内容 并且复制模板行的属性 | |||||
| setCellText(tmpCell,cell,map.get(cellTextKey)); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| // 删除模版行 | |||||
| table.removeRow(1); | |||||
| } | |||||
| /** | |||||
| * 复制模板行的属性 | |||||
| * @param tmpCell | |||||
| * @param cell | |||||
| * @param text | |||||
| * @throws Exception | |||||
| */ | |||||
| private void setCellText(XWPFTableCell tmpCell, XWPFTableCell cell,String text) throws Exception { | |||||
| CTTc cttc2 = tmpCell.getCTTc(); | |||||
| CTTcPr ctPr2 = cttc2.getTcPr(); | |||||
| CTTc cttc = cell.getCTTc(); | |||||
| CTTcPr ctPr = cttc.addNewTcPr(); | |||||
| if (ctPr2.getTcW() != null) { | |||||
| ctPr.addNewTcW().setW(ctPr2.getTcW().getW()); | |||||
| } | |||||
| if (ctPr2.getVAlign() != null) { | |||||
| ctPr.addNewVAlign().setVal(ctPr2.getVAlign().getVal()); | |||||
| } | |||||
| if (cttc2.getPList().size() > 0) { | |||||
| CTP ctp = cttc2.getPList().get(0); | |||||
| if (ctp.getPPr() != null) { | |||||
| if (ctp.getPPr().getJc() != null) { | |||||
| cttc.getPList().get(0).addNewPPr().addNewJc() | |||||
| .setVal(ctp.getPPr().getJc().getVal()); | |||||
| } | |||||
| } | |||||
| } | |||||
| if (ctPr2.getTcBorders() != null) { | |||||
| ctPr.setTcBorders(ctPr2.getTcBorders()); | |||||
| } | |||||
| XWPFParagraph tmpP = tmpCell.getParagraphs().get(0); | |||||
| XWPFParagraph cellP = cell.getParagraphs().get(0); | |||||
| XWPFRun tmpR = null; | |||||
| if (tmpP.getRuns() != null && tmpP.getRuns().size() > 0) { | |||||
| tmpR = tmpP.getRuns().get(0); | |||||
| } | |||||
| XWPFRun cellR = cellP.createRun(); | |||||
| cellR.setText(text); | |||||
| // 复制字体信息 | |||||
| if (tmpR != null) { | |||||
| if(!cellR.isBold()){ | |||||
| cellR.setBold(tmpR.isBold()); | |||||
| } | |||||
| cellR.setItalic(tmpR.isItalic()); | |||||
| cellR.setUnderline(tmpR.getUnderline()); | |||||
| cellR.setColor(tmpR.getColor()); | |||||
| cellR.setTextPosition(tmpR.getTextPosition()); | |||||
| if (tmpR.getFontSize() != -1) { | |||||
| cellR.setFontSize(tmpR.getFontSize()); | |||||
| } | |||||
| if (tmpR.getFontFamily() != null) { | |||||
| cellR.setFontFamily(tmpR.getFontFamily()); | |||||
| } | |||||
| if (tmpR.getCTR() != null) { | |||||
| if (tmpR.getCTR().isSetRPr()) { | |||||
| CTRPr tmpRPr = tmpR.getCTR().getRPr(); | |||||
| if (tmpRPr.isSetRFonts()) { | |||||
| CTFonts tmpFonts = tmpRPr.getRFonts(); | |||||
| CTRPr cellRPr = cellR.getCTR().isSetRPr() ? cellR | |||||
| .getCTR().getRPr() : cellR.getCTR().addNewRPr(); | |||||
| CTFonts cellFonts = cellRPr.isSetRFonts() ? cellRPr | |||||
| .getRFonts() : cellRPr.addNewRFonts(); | |||||
| cellFonts.setAscii(tmpFonts.getAscii()); | |||||
| cellFonts.setAsciiTheme(tmpFonts.getAsciiTheme()); | |||||
| cellFonts.setCs(tmpFonts.getCs()); | |||||
| cellFonts.setCstheme(tmpFonts.getCstheme()); | |||||
| cellFonts.setEastAsia(tmpFonts.getEastAsia()); | |||||
| cellFonts.setEastAsiaTheme(tmpFonts.getEastAsiaTheme()); | |||||
| cellFonts.setHAnsi(tmpFonts.getHAnsi()); | |||||
| cellFonts.setHAnsiTheme(tmpFonts.getHAnsiTheme()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| // 复制段落信息 | |||||
| cellP.setAlignment(tmpP.getAlignment()); | |||||
| cellP.setVerticalAlignment(tmpP.getVerticalAlignment()); | |||||
| cellP.setBorderBetween(tmpP.getBorderBetween()); | |||||
| cellP.setBorderBottom(tmpP.getBorderBottom()); | |||||
| cellP.setBorderLeft(tmpP.getBorderLeft()); | |||||
| cellP.setBorderRight(tmpP.getBorderRight()); | |||||
| cellP.setBorderTop(tmpP.getBorderTop()); | |||||
| cellP.setPageBreak(tmpP.isPageBreak()); | |||||
| if (tmpP.getCTP() != null) { | |||||
| if (tmpP.getCTP().getPPr() != null) { | |||||
| CTPPr tmpPPr = tmpP.getCTP().getPPr(); | |||||
| CTPPr cellPPr = cellP.getCTP().getPPr() != null ? cellP | |||||
| .getCTP().getPPr() : cellP.getCTP().addNewPPr(); | |||||
| // 复制段落间距信息 | |||||
| CTSpacing tmpSpacing = tmpPPr.getSpacing(); | |||||
| if (tmpSpacing != null) { | |||||
| CTSpacing cellSpacing = cellPPr.getSpacing() != null ? cellPPr | |||||
| .getSpacing() : cellPPr.addNewSpacing(); | |||||
| if (tmpSpacing.getAfter() != null) { | |||||
| cellSpacing.setAfter(tmpSpacing.getAfter()); | |||||
| } | |||||
| if (tmpSpacing.getAfterAutospacing() != null) { | |||||
| cellSpacing.setAfterAutospacing(tmpSpacing | |||||
| .getAfterAutospacing()); | |||||
| } | |||||
| if (tmpSpacing.getAfterLines() != null) { | |||||
| cellSpacing.setAfterLines(tmpSpacing.getAfterLines()); | |||||
| } | |||||
| if (tmpSpacing.getBefore() != null) { | |||||
| cellSpacing.setBefore(tmpSpacing.getBefore()); | |||||
| } | |||||
| if (tmpSpacing.getBeforeAutospacing() != null) { | |||||
| cellSpacing.setBeforeAutospacing(tmpSpacing | |||||
| .getBeforeAutospacing()); | |||||
| } | |||||
| if (tmpSpacing.getBeforeLines() != null) { | |||||
| cellSpacing.setBeforeLines(tmpSpacing.getBeforeLines()); | |||||
| } | |||||
| if (tmpSpacing.getLine() != null) { | |||||
| cellSpacing.setLine(tmpSpacing.getLine()); | |||||
| } | |||||
| if (tmpSpacing.getLineRule() != null) { | |||||
| cellSpacing.setLineRule(tmpSpacing.getLineRule()); | |||||
| } | |||||
| } | |||||
| // 复制段落缩进信息 | |||||
| CTInd tmpInd = tmpPPr.getInd(); | |||||
| if (tmpInd != null) { | |||||
| CTInd cellInd = cellPPr.getInd() != null ? cellPPr.getInd() | |||||
| : cellPPr.addNewInd(); | |||||
| if (tmpInd.getFirstLine() != null) { | |||||
| cellInd.setFirstLine(tmpInd.getFirstLine()); | |||||
| } | |||||
| if (tmpInd.getFirstLineChars() != null) { | |||||
| cellInd.setFirstLineChars(tmpInd.getFirstLineChars()); | |||||
| } | |||||
| if (tmpInd.getHanging() != null) { | |||||
| cellInd.setHanging(tmpInd.getHanging()); | |||||
| } | |||||
| if (tmpInd.getHangingChars() != null) { | |||||
| cellInd.setHangingChars(tmpInd.getHangingChars()); | |||||
| } | |||||
| if (tmpInd.getLeft() != null) { | |||||
| cellInd.setLeft(tmpInd.getLeft()); | |||||
| } | |||||
| if (tmpInd.getLeftChars() != null) { | |||||
| cellInd.setLeftChars(tmpInd.getLeftChars()); | |||||
| } | |||||
| if (tmpInd.getRight() != null) { | |||||
| cellInd.setRight(tmpInd.getRight()); | |||||
| } | |||||
| if (tmpInd.getRightChars() != null) { | |||||
| cellInd.setRightChars(tmpInd.getRightChars()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -53,46 +53,46 @@ | |||||
| bill.pay_date payDate,expired_day expiredDay,bill.status,bill.starttime, | bill.pay_date payDate,expired_day expiredDay,bill.status,bill.starttime, | ||||
| bill.endtime,bill.name,bill.rent_shop_type rentShopType,m.name merchantName, | bill.endtime,bill.name,bill.rent_shop_type rentShopType,m.name merchantName, | ||||
| s.shop_number shopNumber, s.manager, s.manager_phone managerPhone,bill.shop_info | s.shop_number shopNumber, s.manager, s.manager_phone managerPhone,bill.shop_info | ||||
| shopInfo,bill.comments,bill.price_detail,updatetime | |||||
| shopInfo,bill.comments,bill.price_detail,updatetime,bill.freeze | |||||
| from ( | from ( | ||||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | ||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' | bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' | ||||
| endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,'' | endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,'' | ||||
| price_detail,updatetime | |||||
| price_detail,updatetime,freeze | |||||
| from wx_bill_rent where tenant_id=#{tenantId} and is_preview = 0 | from wx_bill_rent where tenant_id=#{tenantId} and is_preview = 0 | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' | select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' | ||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' | bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' | ||||
| endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime from wx_bill_rent_deposit where | |||||
| endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze from wx_bill_rent_deposit where | |||||
| tenant_id=#{tenantId} | tenant_id=#{tenantId} | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' | select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' | ||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' | bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' | ||||
| endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,'' | endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,'' | ||||
| price_detail,updatetime | |||||
| price_detail,updatetime,freeze | |||||
| from wx_bill_property where tenant_id=#{tenantId} and is_preview = 0 | from wx_bill_property where tenant_id=#{tenantId} and is_preview = 0 | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' | select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' | ||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' | bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' | ||||
| endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime from wx_bill_property_deposit where | |||||
| endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze from wx_bill_property_deposit where | |||||
| tenant_id=#{tenantId} | tenant_id=#{tenantId} | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,case when type=1 then '水费' when type=2 then '电费' else '空调费' end name, | select id,merchant_id,shop_id,tenant_id,case when type=1 then '水费' when type=2 then '电费' else '空调费' end name, | ||||
| case when type=1 then 5 when type=2 then 6 else 9 end bill_type_value, | case when type=1 then 5 when type=2 then 6 else 9 end bill_type_value, | ||||
| case when type=1 then '水费' when type=2 then '电费' else '空调费' end bill_type,0 as | case when type=1 then '水费' when type=2 then '电费' else '空调费' end bill_type,0 as | ||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, | need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, | ||||
| rent_shop_type,'[]' shop_info, NULL comments,price_detail,updatetime | |||||
| rent_shop_type,'[]' shop_info, NULL comments,price_detail,updatetime,freeze | |||||
| from wx_bill_daily where tenant_id=#{tenantId} | from wx_bill_daily where tenant_id=#{tenantId} | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as | select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as | ||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime, | need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime, | ||||
| rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime | |||||
| rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze | |||||
| from wx_bill_other where tenant_id=#{tenantId} | from wx_bill_other where tenant_id=#{tenantId} | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,comments as name,8 bill_type_value,concat('其他押金-',comments) as | select id,merchant_id,shop_id,tenant_id,comments as name,8 bill_type_value,concat('其他押金-',comments) as | ||||
| bill_type,0 as | bill_type,0 as | ||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime, | need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime, | ||||
| rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime | |||||
| rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze | |||||
| from wx_bill_other_deposit where tenant_id=#{tenantId} | from wx_bill_other_deposit where tenant_id=#{tenantId} | ||||
| ) bill | ) bill | ||||
| left join wx_merchant m on bill.merchant_id=m.id | left join wx_merchant m on bill.merchant_id=m.id | ||||
| @@ -127,7 +127,8 @@ | |||||
| #{type} | #{type} | ||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| <if test=" null != freeze ">and bill.freeze = #{freeze}</if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| <if test=" null == sortColumns"> order by bill.receive_date,bill.id desc,bill.merchant_id,bill.status</if> | <if test=" null == sortColumns"> order by bill.receive_date,bill.id desc,bill.merchant_id,bill.status</if> | ||||
| @@ -19,14 +19,14 @@ | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | ||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | ||||
| <result column="pay_status" jdbcType="INTEGER" property="payStatus"/> | <result column="pay_status" jdbcType="INTEGER" property="payStatus"/> | ||||
| <result column="from" jdbcType="INTEGER" property="from"/> | |||||
| <result column="pos_refund_status" jdbcType="INTEGER" property="posRefundStatus"/> | |||||
| <result column="pay_from" jdbcType="INTEGER" property="payFrom"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`card_id`,`owner_id`,`merchant_id`,`order_id`,`pos_order_id`,``deduction_amount`,`payment`,`real_payment`, | |||||
| `card_remain_amount`,`card_before_amount`,`card_remain_real_amount`,`card_before_real_amount`, | |||||
| `create_date`,`update_date`, `pay_status`, `from`, `pos_refund_status` | |||||
| `id`,`tenant_id`,`card_id`,`owner_id`,`merchant_id`,`order_id`,`pos_order_id`, | |||||
| `deduction_amount`,`payment`,`real_payment`, `card_remain_amount`, | |||||
| `card_before_amount`,`card_remain_real_amount`,`card_before_real_amount`, | |||||
| `create_date`, `update_date`, `pay_status`, `pay_from` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -82,11 +82,8 @@ | |||||
| <if test=" null != payStatus "> | <if test=" null != payStatus "> | ||||
| and `pay_status` = #{payStatus} | and `pay_status` = #{payStatus} | ||||
| </if> | </if> | ||||
| <if test=" null != from "> | |||||
| and `from` = #{from} | |||||
| </if> | |||||
| <if test=" null != posRefundStatus "> | |||||
| and `pos_refund_status` = #{posRefundStatus} | |||||
| <if test=" null != payFrom "> | |||||
| and `pay_from` = #{payFrom} | |||||
| </if> | </if> | ||||
| <if test=" null != startdate and null!=enddate"> | <if test=" null != startdate and null!=enddate"> | ||||
| and `create_date` between #{startdate} and #{enddate} | and `create_date` between #{startdate} and #{enddate} | ||||
| @@ -792,7 +792,7 @@ | |||||
| <sql id="allCUserCouponOrderListColumns"> | <sql id="allCUserCouponOrderListColumns"> | ||||
| co.id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type, | |||||
| co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type, | |||||
| c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,c.valid_start_date,c.valid_end_date,c.auto_refund, | c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,c.valid_start_date,c.valid_end_date,c.auto_refund, | ||||
| cal.channel_type as send_channel_type | cal.channel_type as send_channel_type | ||||
| </sql> | </sql> | ||||
| @@ -877,31 +877,29 @@ | |||||
| </select> | </select> | ||||
| <select id="findAvailCouponOrder" parameterType="java.util.Map" resultMap="CVoResultMap"> | <select id="findAvailCouponOrder" parameterType="java.util.Map" resultMap="CVoResultMap"> | ||||
| select <include refid="allCUserCouponOrderListColumns" /> | |||||
| select <include refid="allCUserCouponOrderDetailColumns" /> | |||||
| from wx_coupon_order co | from wx_coupon_order co | ||||
| left join wx_coupon_merchant cm on cm.product_id = co.coupon_id | |||||
| left join wx_coupon c on c.id = co.coupon_id | |||||
| left join wx_coupon_action_log cal on cal.coupon_order_id = co.id | |||||
| inner join wx_coupon c on c.id = co.coupon_id | |||||
| inner join wx_coupon_merchant cm on cm.product_id = co.coupon_id | |||||
| where co.tenant_id = #{tenantId} and co.c_user_id = #{cUserId} | where co.tenant_id = #{tenantId} and co.c_user_id = #{cUserId} | ||||
| and co.coupon_order_status = 0 | and co.coupon_order_status = 0 | ||||
| and cm.merchant_id = #{merchantId} | and cm.merchant_id = #{merchantId} | ||||
| and co.expired_time > now() | and co.expired_time > now() | ||||
| and c.type in (1, 2, 6) | and c.type in (1, 2, 6) | ||||
| union | union | ||||
| select <include refid="allCUserCouponOrderListColumns" /> | |||||
| select <include refid="allCUserCouponOrderDetailColumns" /> | |||||
| from wx_coupon_order co | from wx_coupon_order co | ||||
| left join wx_coupon_merchant cm on cm.product_id = co.coupon_id | |||||
| left join wx_coupon c on c.id = co.coupon_id | |||||
| left join wx_coupon_action_log cal on cal.coupon_order_id = co.id | |||||
| left join pos_coupon_order_verify pco on pco.coupon_order_id = co.id | |||||
| inner join wx_coupon c on c.id = co.coupon_id | |||||
| inner join wx_coupon_merchant cm on cm.product_id = co.coupon_id | |||||
| inner join pos_coupon_order_verify pco on pco.coupon_order_id = co.id | |||||
| where co.tenant_id = #{tenantId} and co.c_user_id = #{cUserId} | where co.tenant_id = #{tenantId} and co.c_user_id = #{cUserId} | ||||
| and co.coupon_order_status = 100 | and co.coupon_order_status = 100 | ||||
| and cm.merchant_id = #{merchantId} | and cm.merchant_id = #{merchantId} | ||||
| and co.expired_time > now() | and co.expired_time > now() | ||||
| and c.type in (1, 2, 6) | |||||
| <if test="posOrderId != null"> | <if test="posOrderId != null"> | ||||
| and pco.pos_order_id = #{posOrderId} | and pco.pos_order_id = #{posOrderId} | ||||
| </if> | </if> | ||||
| and c.type in (1, 2, 6) | |||||
| </select> | </select> | ||||
| <sql id="allCUserCouponOrderCarListColumns"> | <sql id="allCUserCouponOrderCarListColumns"> | ||||