developrelease_toaliyun_real
| @@ -245,38 +245,42 @@ public class WxCarController extends BaseController { | |||||
| } | } | ||||
| @ApiOperation("优免券模板已分配总数") | |||||
| @ApiOperation("优免券模板库存总数") | |||||
| @GetMapping("/templateAmtCount") | @GetMapping("/templateAmtCount") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "templateId", value = "模板ID", dataType = "Long", paramType = "query", required = true)}) | @ApiImplicitParam(name = "templateId", value = "模板ID", dataType = "Long", paramType = "query", required = true)}) | ||||
| @SystemControllerLog(description = "车-优免券模板已分配总数") | @SystemControllerLog(description = "车-优免券模板已分配总数") | ||||
| public ResultData getTemplateAmountSum(Long templateId) { | public ResultData getTemplateAmountSum(Long templateId) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCarController::getTemplateAmountSum"); | logger.debug("[" + getIpAddr() + "] WxCarController::getTemplateAmountSum"); | ||||
| Map map = new HashMap(); | |||||
| // 库存总数 = 库存总数(status=0) + 作废券已领取(待使用+已使用) | |||||
| Integer amountCount = 0; | Integer amountCount = 0; | ||||
| try { | try { | ||||
| amountCount = wxCouponCarService.getAmtCountByTemplateId(templateId); | |||||
| amountCount = wxCouponCarService.getAmtCountByTemplateId(templateId) + | |||||
| wxCouponCarService.getClaimCountByTemplateId(templateId); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| } | } | ||||
| Map map = new HashMap(); | |||||
| map.put("amountCount", amountCount); | map.put("amountCount", amountCount); | ||||
| return new ResultData(map); | return new ResultData(map); | ||||
| } | } | ||||
| @ApiOperation("优免券模板库存总数") | |||||
| @ApiOperation("优免券模板已分配总数") | |||||
| @GetMapping("/templateAvaiCount") | @GetMapping("/templateAvaiCount") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "templateId", value = "模板ID", dataType = "Long", paramType = "query", required = true)}) | @ApiImplicitParam(name = "templateId", value = "模板ID", dataType = "Long", paramType = "query", required = true)}) | ||||
| @SystemControllerLog(description = "车-优免券模板库存总数") | @SystemControllerLog(description = "车-优免券模板库存总数") | ||||
| public ResultData getTemplateAvailSum(Long templateId) { | public ResultData getTemplateAvailSum(Long templateId) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCarController::getTemplateAvailSum"); | logger.debug("[" + getIpAddr() + "] WxCarController::getTemplateAvailSum"); | ||||
| Map map = new HashMap(); | |||||
| // 已分配总数 = 可用库存总数(status=0)+ 作废券已领取(待使用+已使用) | |||||
| Integer availCount = 0; | Integer availCount = 0; | ||||
| try { | try { | ||||
| availCount = wxCouponCarService.getAvaibleCountByTemplateId(templateId); | |||||
| availCount = wxCouponCarService.getAvaibleCountByTemplateId(templateId) + | |||||
| wxCouponCarService.getClaimCountByTemplateId(templateId); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| } | } | ||||
| Map map = new HashMap(); | |||||
| map.put("availCount", availCount); | map.put("availCount", availCount); | ||||
| return new ResultData(map); | return new ResultData(map); | ||||
| } | } | ||||
| @@ -53,6 +53,10 @@ public class MyShiroRealm extends AuthorizingRealm { | |||||
| if(user == null) { | if(user == null) { | ||||
| throw new UnknownAccountException(ErrorCode.USER_IS_EMPTY.getMessage()); | throw new UnknownAccountException(ErrorCode.USER_IS_EMPTY.getMessage()); | ||||
| } | } | ||||
| if(user.getTenantId().equals("1")) { | |||||
| // 只支持租户为1的用户 | |||||
| throw new UnknownAccountException("租户不支持"); | |||||
| } | |||||
| if(user.getStatus()==null || | if(user.getStatus()==null || | ||||
| !EnumMallUserStatus.VALID.getCode().equals(user.getStatus())) {//用户被禁用 | !EnumMallUserStatus.VALID.getCode().equals(user.getStatus())) {//用户被禁用 | ||||
| throw new DisabledAccountException(ErrorCode.USER_IS_LOCKED.getMessage()); | throw new DisabledAccountException(ErrorCode.USER_IS_LOCKED.getMessage()); | ||||
| @@ -95,50 +95,7 @@ public class WxCarController extends BaseController { | |||||
| WxPark park = getCurrentPark(getTenantId()); | WxPark park = getCurrentPark(getTenantId()); | ||||
| // 2. get vendor params | // 2. get vendor params | ||||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | ||||
| String phone = paramMap.get("phone"); | |||||
| if (StringUtils.isBlank(phone) && StringUtils.isBlank(user.getPhone()) && StringUtils.isBlank(user.getVerifyCodePhone())) { | |||||
| logger.error("手机号为空,请授权手机号"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||||
| } | |||||
| if (!StringUtils.isBlank(user.getPhone()) && !user.getPhone().contains("*")) { | |||||
| phone = user.getPhone(); | |||||
| } else { | |||||
| phone = user.getVerifyCodePhone(); | |||||
| } | |||||
| String params = park.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String appId = objParams.getString("appId"); | |||||
| String merchantNo = objParams.getString("merchantNo"); | |||||
| String merchantKey = objParams.getString("merchantKey"); | |||||
| String version = objParams.getString("version"); | |||||
| String ret = ""; | |||||
| try { | |||||
| ret = etcp.userSignin(url, appId, merchantNo, merchantKey, version, phone); | |||||
| } catch (MallinkException e) { | |||||
| logger.error("ETCP failed: " + e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getIntValue("code") == EnumETCPCode.SUCCESS.getCode()) { | |||||
| // 获取绑定的车牌 | |||||
| JSONObject dataObj = retObj.getJSONObject("data"); | |||||
| dataObj.put("vendor", EnumCarVendor.CAR_ETCP.getCode()); | |||||
| String etcpToken = dataObj.getString("token"); | |||||
| try { | |||||
| JSONObject dataObj1 = syncCarNumbers(user.getId(), user.getTenantId(), park.getVendorType(), | |||||
| url, merchantNo, merchantKey, version, | |||||
| etcpToken); | |||||
| } catch (MallinkException e) { | |||||
| logger.error("ETCP cmd error: " + e.getMessage()); | |||||
| } | |||||
| // c端必须保存此token | |||||
| return new ResultData(dataObj); | |||||
| } else { | |||||
| logger.error("共同登录失败: "+phone); | |||||
| return new ResultData(ErrorCode.ETCP_LOGIN_FAIL.getCode(), "共同登录失败"); | |||||
| } | |||||
| return initForEtcp(paramMap, user, park); | |||||
| } else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()){ | } else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()){ | ||||
| // TJD不需要共同登录 | // TJD不需要共同登录 | ||||
| Map resultMap = new HashMap(); | Map resultMap = new HashMap(); | ||||
| @@ -149,8 +106,55 @@ public class WxCarController extends BaseController { | |||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "登录失败"); | return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "登录失败"); | ||||
| } | } | ||||
| private ResultData initForEtcp(Map<String, String> paramMap, WxCUser user, WxPark park) { | |||||
| String phone = paramMap.get("phone"); | |||||
| if (StringUtils.isBlank(phone) && StringUtils.isBlank(user.getPhone()) && StringUtils.isBlank(user.getVerifyCodePhone())) { | |||||
| logger.error("手机号为空,请授权手机号"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号为空,请授权手机号"); | |||||
| } | |||||
| if (!StringUtils.isBlank(user.getPhone()) && !user.getPhone().contains("*")) { | |||||
| phone = user.getPhone(); | |||||
| } else { | |||||
| phone = user.getVerifyCodePhone(); | |||||
| } | |||||
| String params = park.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String appId = objParams.getString("appId"); | |||||
| String merchantNo = objParams.getString("merchantNo"); | |||||
| String merchantKey = objParams.getString("merchantKey"); | |||||
| String version = objParams.getString("version"); | |||||
| String ret = ""; | |||||
| try { | |||||
| ret = etcp.userSignin(url, appId, merchantNo, merchantKey, version, phone); | |||||
| } catch (MallinkException e) { | |||||
| logger.error("ETCP failed: " + e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getIntValue("code") == EnumETCPCode.SUCCESS.getCode()) { | |||||
| // 获取绑定的车牌 | |||||
| JSONObject dataObj = retObj.getJSONObject("data"); | |||||
| dataObj.put("vendor", EnumCarVendor.CAR_ETCP.getCode()); | |||||
| String etcpToken = dataObj.getString("token"); | |||||
| try { | |||||
| JSONObject dataObj1 = etcpSyncCarNumbers(user.getId(), user.getTenantId(), park.getVendorType(), | |||||
| url, merchantNo, merchantKey, version, | |||||
| etcpToken); | |||||
| } catch (MallinkException e) { | |||||
| logger.error("ETCP cmd error: " + e.getMessage()); | |||||
| } | |||||
| // c端必须保存此token | |||||
| return new ResultData(dataObj); | |||||
| } else { | |||||
| logger.error("共同登录失败: "+phone); | |||||
| return new ResultData(ErrorCode.ETCP_LOGIN_FAIL.getCode(), "共同登录失败"); | |||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * 同步 | |||||
| * ETCP同步 | |||||
| * @param cUserId | * @param cUserId | ||||
| * @param tenantId | * @param tenantId | ||||
| * @param iVendorType | * @param iVendorType | ||||
| @@ -161,9 +165,9 @@ public class WxCarController extends BaseController { | |||||
| * @param etcpToken | * @param etcpToken | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| private JSONObject syncCarNumbers(Long cUserId, String tenantId, int iVendorType, | |||||
| String url, String merchantNo, String merchantKey, String version, | |||||
| String etcpToken) { | |||||
| private JSONObject etcpSyncCarNumbers(Long cUserId, String tenantId, int iVendorType, | |||||
| String url, String merchantNo, String merchantKey, String version, | |||||
| String etcpToken) { | |||||
| String ret; | String ret; | ||||
| JSONObject retObj; | JSONObject retObj; | ||||
| /*{"code": 0,"msg": "ok","data": {"number": 3,"carList": ["晋 BMZ105","云 C12345"]}} */ | /*{"code": 0,"msg": "ok","data": {"number": 3,"carList": ["晋 BMZ105","云 C12345"]}} */ | ||||
| @@ -253,115 +257,134 @@ public class WxCarController extends BaseController { | |||||
| WxPark park = getCurrentPark(getTenantId()); | WxPark park = getCurrentPark(getTenantId()); | ||||
| // 2. get vendor params | // 2. get vendor params | ||||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | ||||
| String etcpToken = paramMap.get("etcpToken"); | |||||
| if (StringUtils.isBlank(etcpToken)) { | |||||
| logger.error("etcpToken为空"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "etcpToken为空"); | |||||
| } | |||||
| String carNumber = paramMap.get("carNumber"); | |||||
| if (StringUtils.isBlank(carNumber)) { | |||||
| logger.error("carNumber为空"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||||
| } | |||||
| String params = park.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String merchantNo = objParams.getString("merchantNo"); | |||||
| String merchantKey = objParams.getString("merchantKey"); | |||||
| String version = objParams.getString("version"); | |||||
| return etcpBindCar(paramMap, park); | |||||
| } | |||||
| else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()) { | |||||
| return tjdBindCar(paramMap, park); | |||||
| } | |||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "绑车牌失败"); | |||||
| } | |||||
| String ret = ""; | |||||
| try { | |||||
| ret = etcp.bindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber, null); | |||||
| } catch (MallinkException e) { | |||||
| logger.error("ETCP failed: " + e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getIntValue("code") == 0) { | |||||
| // 插入车牌 | |||||
| Date curr = new Date(); | |||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setCUserId(getUserId()); | |||||
| userCar.setTenantId(getTenantId()); | |||||
| userCar.setCarNumber(carNumber); | |||||
| userCar.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| userCar.setCreateDate(curr); | |||||
| userCar.setUpdateDate(curr); | |||||
| wxCUserCarService.saveOrUpdate(userCar); | |||||
| private ResultData etcpBindCar(Map<String, String> paramMap, WxPark park) { | |||||
| String etcpToken = paramMap.get("etcpToken"); | |||||
| if (StringUtils.isBlank(etcpToken)) { | |||||
| logger.error("etcpToken为空"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "etcpToken为空"); | |||||
| } | |||||
| String carNumber = paramMap.get("carNumber"); | |||||
| if (StringUtils.isBlank(carNumber)) { | |||||
| logger.error("carNumber为空"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||||
| } | |||||
| String params = park.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String merchantNo = objParams.getString("merchantNo"); | |||||
| String merchantKey = objParams.getString("merchantKey"); | |||||
| String version = objParams.getString("version"); | |||||
| String ret = ""; | |||||
| try { | |||||
| ret = etcp.bindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber, null); | |||||
| } catch (MallinkException e) { | |||||
| logger.error("ETCP failed: " + e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getIntValue("code") == 0) { | |||||
| addCarInfoToDB(carNumber); | |||||
| JSONObject dataObj = retObj.getJSONObject("data"); | |||||
| return new ResultData(dataObj); | |||||
| } else { | |||||
| String message = retObj.getString("message"); | |||||
| logger.error("绑车牌失败: " + carNumber); | |||||
| return new ResultData(ErrorCode.ETCP_BIND_FAIL.getCode(), message, retObj); | |||||
| } | |||||
| } | |||||
| wxScoreRulesService.addScore(EnumScoreType.BIND_CAR,userCar); | |||||
| //增加积分 | |||||
| addCredit(); | |||||
| JSONObject dataObj = retObj.getJSONObject("data"); | |||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_CAR,getUserId()); | |||||
| return new ResultData(dataObj); | |||||
| } else { | |||||
| String message = retObj.getString("message"); | |||||
| logger.error("绑车牌失败: " + carNumber); | |||||
| return new ResultData(ErrorCode.ETCP_BIND_FAIL.getCode(), message, retObj); | |||||
| } | |||||
| private void addCarInfoToDB(String carNumber) { | |||||
| // 插入车牌 | |||||
| Date curr = new Date(); | |||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setCUserId(getUserId()); | |||||
| userCar.setTenantId(getTenantId()); | |||||
| userCar.setCarNumber(carNumber); | |||||
| userCar.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| userCar.setCreateDate(curr); | |||||
| userCar.setUpdateDate(curr); | |||||
| wxCUserCarService.saveOrUpdate(userCar); | |||||
| // 成长值 | |||||
| wxScoreRulesService.addScore(EnumScoreType.BIND_CAR,userCar); | |||||
| //增加积分 | |||||
| addCredit(); | |||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_CAR,getUserId()); | |||||
| } | |||||
| private ResultData tjdBindCar(@RequestBody Map<String, String> paramMap, WxPark park) { | |||||
| String carNumber = paramMap.get("carNumber"); | |||||
| if (StringUtils.isBlank(carNumber)) { | |||||
| logger.error("carNumber为空"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||||
| } | } | ||||
| else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()) { | |||||
| String carNumber = paramMap.get("carNumber"); | |||||
| if (StringUtils.isBlank(carNumber)) { | |||||
| logger.error("carNumber为空"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||||
| } | |||||
| String carNumColor = paramMap.get("carNumColor"); | |||||
| //if (StringUtils.isBlank(carNumColor)) { | |||||
| // logger.error("carNumColor为空"); | |||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumColor为空"); | |||||
| //} | |||||
| Long newCarId = 0L; | |||||
| String outCarId = paramMap.get("outCarId"); | |||||
| if (StringUtils.isBlank(outCarId)) { | |||||
| logger.warn("outCarId为空"); | |||||
| newCarId = wxCUserCarService.getNewCarID(); | |||||
| outCarId = String.valueOf(newCarId); | |||||
| } | |||||
| String params = park.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String partner = objParams.getString("partner"); | |||||
| String key = objParams.getString("key"); | |||||
| String version = objParams.getString("version"); | |||||
| String ret = tjd.registerCar(url, partner, key, version, | |||||
| carNumber, carNumColor, null, outCarId); | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| retObj.put("vendor", park.getVendorType()); | |||||
| if (retObj.getString("returnCode").equalsIgnoreCase(EnumTJDCode.SUCCESS.getMessage())) { | |||||
| String carId = retObj.getString("carId"); | |||||
| // 插入车牌 | |||||
| Date curr = new Date(); | |||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setId(newCarId); | |||||
| userCar.setCUserId(getUserId()); | |||||
| userCar.setTenantId(getTenantId()); | |||||
| userCar.setCarNumber(carNumber); | |||||
| userCar.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| JSONObject jo = new JSONObject(); | |||||
| jo.put("carId", carId); | |||||
| userCar.setVendorParams(JSON.toJSONString(jo)); | |||||
| userCar.setCreateDate(curr); | |||||
| userCar.setUpdateDate(curr); | |||||
| try { | |||||
| wxCUserCarService.save(userCar); | |||||
| wxScoreRulesService.addScore(EnumScoreType.BIND_CAR,userCar); | |||||
| //增加积分 | |||||
| addCredit(); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "TJD保存车牌失败, e:" + e.getMessage()); | |||||
| } | |||||
| String carNumColor = paramMap.get("carNumColor"); | |||||
| //if (StringUtils.isBlank(carNumColor)) { | |||||
| // logger.error("carNumColor为空"); | |||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumColor为空"); | |||||
| //} | |||||
| Long newCarId = 0L; | |||||
| String outCarId = paramMap.get("outCarId"); | |||||
| if (StringUtils.isBlank(outCarId)) { | |||||
| logger.warn("outCarId为空"); | |||||
| newCarId = wxCUserCarService.getNewCarID(); | |||||
| outCarId = String.valueOf(newCarId); | |||||
| } | |||||
| String params = park.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String partner = objParams.getString("partner"); | |||||
| String key = objParams.getString("key"); | |||||
| String version = objParams.getString("version"); | |||||
| String ret = tjd.registerCar(url, partner, key, version, | |||||
| carNumber, carNumColor, null, outCarId); | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| retObj.put("vendor", park.getVendorType()); | |||||
| if (retObj.getString("returnCode").equalsIgnoreCase(EnumTJDCode.SUCCESS.getMessage())) { | |||||
| ResultData e = tjdInsertToDB(carNumber, newCarId, retObj); | |||||
| if (e != null) return e; | |||||
| return new ResultData(retObj); | |||||
| } else { | |||||
| return new ResultData(ErrorCode.TJD_BIND_FAIL.getCode(), "绑车牌失败", retObj); | |||||
| } | |||||
| } | |||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_CAR,getUserId()); | |||||
| return new ResultData(retObj); | |||||
| } else { | |||||
| return new ResultData(ErrorCode.TJD_BIND_FAIL.getCode(), "绑车牌失败", retObj); | |||||
| } | |||||
| private ResultData tjdInsertToDB(String carNumber, Long newCarId, JSONObject retObj) { | |||||
| String carId = retObj.getString("carId"); | |||||
| // 插入车牌 | |||||
| Date curr = new Date(); | |||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setId(newCarId); | |||||
| userCar.setCUserId(getUserId()); | |||||
| userCar.setTenantId(getTenantId()); | |||||
| userCar.setCarNumber(carNumber); | |||||
| userCar.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| JSONObject jo = new JSONObject(); | |||||
| jo.put("carId", carId); | |||||
| userCar.setVendorParams(JSON.toJSONString(jo)); | |||||
| userCar.setCreateDate(curr); | |||||
| userCar.setUpdateDate(curr); | |||||
| try { | |||||
| wxCUserCarService.save(userCar); | |||||
| wxScoreRulesService.addScore(EnumScoreType.BIND_CAR,userCar); | |||||
| //增加积分 | |||||
| addCredit(); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "TJD保存车牌失败, e:" + e.getMessage()); | |||||
| } | } | ||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "绑车牌失败"); | |||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_CAR,getUserId()); | |||||
| return null; | |||||
| } | } | ||||
| //-----增加积分start----- | //-----增加积分start----- | ||||
| @@ -399,89 +422,98 @@ public class WxCarController extends BaseController { | |||||
| // 1, get mall's park | // 1, get mall's park | ||||
| WxPark park = getCurrentPark(getTenantId()); | WxPark park = getCurrentPark(getTenantId()); | ||||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | ||||
| String etcpToken = paramMap.get("etcpToken"); | |||||
| if (StringUtils.isBlank(etcpToken)) { | |||||
| logger.error("etcpToken为空"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "etcpToken为空"); | |||||
| } | |||||
| String carNumber = paramMap.get("carNumber"); | |||||
| if (StringUtils.isBlank(carNumber)) { | |||||
| logger.error("carNumber为空"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||||
| } | |||||
| String params = park.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String merchantNo = objParams.getString("merchantNo"); | |||||
| String merchantKey = objParams.getString("merchantKey"); | |||||
| String version = objParams.getString("version"); | |||||
| return etcpUnbindCar(paramMap, park); | |||||
| } | |||||
| else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()) { | |||||
| ResultData e = tjdUnbindCar(paramMap, park); | |||||
| if (e != null) return e; | |||||
| } | |||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "解绑车牌失败"); | |||||
| } | |||||
| String ret = ""; | |||||
| private ResultData etcpUnbindCar(Map<String, String> paramMap, WxPark park) { | |||||
| String etcpToken = paramMap.get("etcpToken"); | |||||
| if (StringUtils.isBlank(etcpToken)) { | |||||
| logger.error("etcpToken为空"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "etcpToken为空"); | |||||
| } | |||||
| String carNumber = paramMap.get("carNumber"); | |||||
| if (StringUtils.isBlank(carNumber)) { | |||||
| logger.error("carNumber为空"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||||
| } | |||||
| String params = park.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String merchantNo = objParams.getString("merchantNo"); | |||||
| String merchantKey = objParams.getString("merchantKey"); | |||||
| String version = objParams.getString("version"); | |||||
| String ret = ""; | |||||
| try { | |||||
| ret = etcp.unbindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber); | |||||
| } catch (MallinkException e) { | |||||
| logger.error("ETCP failed: " + e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getIntValue("code") == 0) { | |||||
| try { | try { | ||||
| ret = etcp.unbindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber); | |||||
| } catch (MallinkException e) { | |||||
| logger.error("ETCP failed: " + e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setCUserId(getUserId()); | |||||
| userCar.setTenantId(getTenantId()); | |||||
| userCar.setCarNumber(carNumber); | |||||
| wxCUserCarService.deleteByObj(userCar); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "解绑车牌数据库错误, e:" + e.getMessage()); | |||||
| } | } | ||||
| return new ResultData(); | |||||
| } else { | |||||
| String message = retObj.getString("message"); | |||||
| logger.error("解绑车牌失败"); | |||||
| return new ResultData(ErrorCode.ETCP_UNBIND_FAIL.getCode(), message, retObj); | |||||
| } | |||||
| } | |||||
| private ResultData tjdUnbindCar(@RequestBody Map<String, String> paramMap, WxPark park) { | |||||
| String carNumber = paramMap.get("carNumber"); | |||||
| if (StringUtils.isBlank(carNumber)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||||
| } | |||||
| WxCUserCar queryOne = new WxCUserCar(); | |||||
| queryOne.setCarNumber(carNumber); | |||||
| queryOne.setTenantId(getTenantId()); | |||||
| queryOne.setCUserId(getUserId()); | |||||
| WxCUserCar userCar = wxCUserCarService.getOne(queryOne); | |||||
| if (userCar != null) { | |||||
| String params = userCar.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String carId = objParams.getString("carId"); | |||||
| params = park.getVendorParams(); | |||||
| String url = objParams.getString("url"); | |||||
| String partner = objParams.getString("partner"); | |||||
| String key = objParams.getString("key"); | |||||
| String version = objParams.getString("version"); | |||||
| String ret = tjd.writeOffCar(url, partner, key, version, carId); | |||||
| JSONObject retObj = JSON.parseObject(ret); | JSONObject retObj = JSON.parseObject(ret); | ||||
| if (retObj.getIntValue("code") == 0) { | |||||
| if (retObj.getString("returnCode").equalsIgnoreCase(EnumTJDCode.SUCCESS.getMessage())) { | |||||
| try { | try { | ||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setCUserId(getUserId()); | |||||
| userCar.setTenantId(getTenantId()); | |||||
| userCar.setCarNumber(carNumber); | |||||
| wxCUserCarService.deleteByObj(userCar); | wxCUserCarService.deleteByObj(userCar); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | |||||
| logger.error("解绑车牌数据库错误, e:" + e.getMessage()); | |||||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "解绑车牌数据库错误, e:" + e.getMessage()); | return new ResultData(ErrorCode.DB_FAIL.getCode(), "解绑车牌数据库错误, e:" + e.getMessage()); | ||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } else { | } else { | ||||
| String message = retObj.getString("message"); | |||||
| logger.error("解绑车牌失败"); | |||||
| return new ResultData(ErrorCode.ETCP_UNBIND_FAIL.getCode(), message, retObj); | |||||
| return new ResultData(ErrorCode.TJD_UNBIND_FAIL, "解绑车牌失败"); | |||||
| } | } | ||||
| } | } | ||||
| else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()) { | |||||
| String carNumber = paramMap.get("carNumber"); | |||||
| if (StringUtils.isBlank(carNumber)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||||
| } | |||||
| WxCUserCar queryOne = new WxCUserCar(); | |||||
| queryOne.setCarNumber(carNumber); | |||||
| queryOne.setTenantId(getTenantId()); | |||||
| queryOne.setCUserId(getUserId()); | |||||
| WxCUserCar userCar = wxCUserCarService.getOne(queryOne); | |||||
| if (userCar != null) { | |||||
| String params = userCar.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String carId = objParams.getString("carId"); | |||||
| params = park.getVendorParams(); | |||||
| String url = objParams.getString("url"); | |||||
| String partner = objParams.getString("partner"); | |||||
| String key = objParams.getString("key"); | |||||
| String version = objParams.getString("version"); | |||||
| String ret = tjd.writeOffCar(url, partner, key, version, carId); | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getString("returnCode").equalsIgnoreCase(EnumTJDCode.SUCCESS.getMessage())) { | |||||
| try { | |||||
| wxCUserCarService.deleteByObj(userCar); | |||||
| } catch (Exception e) { | |||||
| logger.error("解绑车牌数据库错误, e:" + e.getMessage()); | |||||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "解绑车牌数据库错误, e:" + e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | |||||
| } else { | |||||
| return new ResultData(ErrorCode.TJD_UNBIND_FAIL, "解绑车牌失败"); | |||||
| } | |||||
| } | |||||
| } | |||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "解绑车牌失败"); | |||||
| return null; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -529,76 +561,84 @@ public class WxCarController extends BaseController { | |||||
| // 1, get mall's park | // 1, get mall's park | ||||
| WxPark park = getCurrentPark(getTenantId()); | WxPark park = getCurrentPark(getTenantId()); | ||||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | ||||
| String etcpToken = paramMap.get("etcpToken"); | |||||
| String carNumber = paramMap.get("carNumber"); | |||||
| if (StringUtils.isBlank(etcpToken)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "etcpToken为空"); | |||||
| } | |||||
| if (StringUtils.isBlank(carNumber)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||||
| } | |||||
| String params = park.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String appId = objParams.getString("appId"); | |||||
| String merchantNo = objParams.getString("merchantNo"); | |||||
| String merchantKey = objParams.getString("merchantKey"); | |||||
| String version = objParams.getString("version"); | |||||
| return etcpCarStopFee(paramMap, park); | |||||
| } | |||||
| else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()) { | |||||
| return tjdCarStopFee(paramMap, park); | |||||
| } | |||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "停车费获取失败"); | |||||
| } | |||||
| String ret = ""; | |||||
| private ResultData etcpCarStopFee(@RequestBody Map<String, String> paramMap, WxPark park) { | |||||
| String etcpToken = paramMap.get("etcpToken"); | |||||
| String carNumber = paramMap.get("carNumber"); | |||||
| if (StringUtils.isBlank(etcpToken)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "etcpToken为空"); | |||||
| } | |||||
| if (StringUtils.isBlank(carNumber)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||||
| } | |||||
| String params = park.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String appId = objParams.getString("appId"); | |||||
| String merchantNo = objParams.getString("merchantNo"); | |||||
| String merchantKey = objParams.getString("merchantKey"); | |||||
| String version = objParams.getString("version"); | |||||
| String ret = ""; | |||||
| try { | |||||
| ret = etcp.orderUnpay(url, appId, merchantNo, merchantKey, version, etcpToken, carNumber); | |||||
| } catch (MallinkException e) { | |||||
| logger.error("ETCP failed: " + e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getIntValue("code") == 0) { | |||||
| JSONObject feeObj = retObj.getJSONArray("data").getJSONObject(0); | |||||
| /* | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setTenantId(user.getTenantId()); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_UNPAY.getCode()); | |||||
| String feeStr = JSON.toJSONString(feeObj); | |||||
| wxCarCmdLog.setCmdJson(feeStr); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | try { | ||||
| ret = etcp.orderUnpay(url, appId, merchantNo, merchantKey, version, etcpToken, carNumber); | |||||
| } catch (MallinkException e) { | |||||
| logger.error("ETCP failed: " + e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("etcpOrderUnpay: 入库错误:" + feeStr); | |||||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "入库错误", feeStr); | |||||
| } | |||||
| */ | |||||
| return new ResultData(Result.SUCCESS, "停车费获取成功", feeObj); | |||||
| } else { | |||||
| String message = retObj.getString("message"); | |||||
| return new ResultData(ErrorCode.ETCP_STOP_FEE_FAIL.getCode(), message, retObj); | |||||
| } | |||||
| } | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getIntValue("code") == 0) { | |||||
| JSONObject feeObj = retObj.getJSONArray("data").getJSONObject(0); | |||||
| /* | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setTenantId(user.getTenantId()); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_UNPAY.getCode()); | |||||
| String feeStr = JSON.toJSONString(feeObj); | |||||
| wxCarCmdLog.setCmdJson(feeStr); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("etcpOrderUnpay: 入库错误:" + feeStr); | |||||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "入库错误", feeStr); | |||||
| } | |||||
| */ | |||||
| return new ResultData(Result.SUCCESS, "停车费获取成功", feeObj); | |||||
| } else { | |||||
| String message = retObj.getString("message"); | |||||
| return new ResultData(ErrorCode.ETCP_STOP_FEE_FAIL.getCode(), message, retObj); | |||||
| } | |||||
| private ResultData tjdCarStopFee(@RequestBody Map<String, String> paramMap, WxPark park) { | |||||
| String carNumber = paramMap.get("carNumber"); | |||||
| if (StringUtils.isBlank(carNumber)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||||
| } | } | ||||
| else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()) { | |||||
| String carNumber = paramMap.get("carNumber"); | |||||
| if (StringUtils.isBlank(carNumber)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||||
| } | |||||
| String params = park.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String partner = objParams.getString("partner"); | |||||
| String key = objParams.getString("key"); | |||||
| String version = objParams.getString("version"); | |||||
| String ret = tjd.infoForFreeMins(url, partner, key, version, carNumber); | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getString("returnCode").equalsIgnoreCase(EnumTJDCode.SUCCESS.getMessage())) { | |||||
| return new ResultData(retObj); | |||||
| } else { | |||||
| return new ResultData(ErrorCode.TJD_STOP_FEE_FAIL.getCode(), "停车费获取失败"); | |||||
| } | |||||
| String params = park.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String partner = objParams.getString("partner"); | |||||
| String key = objParams.getString("key"); | |||||
| String version = objParams.getString("version"); | |||||
| String ret = tjd.infoForFreeMins(url, partner, key, version, carNumber); | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getString("returnCode").equalsIgnoreCase(EnumTJDCode.SUCCESS.getMessage())) { | |||||
| return new ResultData(retObj); | |||||
| } else { | |||||
| return new ResultData(ErrorCode.TJD_STOP_FEE_FAIL.getCode(), "停车费获取失败"); | |||||
| } | } | ||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "停车费获取失败"); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -782,62 +822,68 @@ public class WxCarController extends BaseController { | |||||
| /// 1, get mall's park | /// 1, get mall's park | ||||
| WxPark park = getCurrentPark(getTenantId()); | WxPark park = getCurrentPark(getTenantId()); | ||||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | ||||
| String params = park.getVendorParams(); | |||||
| if(params == null) { | |||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "车场不支持"); | |||||
| } | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String merchantNo = objParams.getString("merchantNo"); | |||||
| String merchantKey = objParams.getString("merchantKey"); | |||||
| String version = objParams.getString("version"); | |||||
| if (park.getParkingId() == null) { | |||||
| // those code is not supported | |||||
| /* | |||||
| String lat = objParams.getString("lat"); | |||||
| String lon = objParams.getString("lon"); | |||||
| String radius = objParams.getString("radius"); | |||||
| String ret = etcp.parkingInfo(url, merchantNo, merchantKey, version, lat, lon, radius); | |||||
| logger.info(ret); | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getIntValue("code") == EnumETCPCode.SUCCESS.getCode()) { | |||||
| JSONObject retData = retObj.getJSONObject("data"); | |||||
| if (retData != null) { | |||||
| JSONArray retDataList = retData.getJSONArray("list"); | |||||
| if (retDataList != null) { | |||||
| JSONObject parkData = retDataList.getJSONObject(0); | |||||
| if (parkData != null) { | |||||
| String parkId = parkData.getString("id"); | |||||
| objParams.put("parkId", parkId); | |||||
| params = JSON.toJSONString(objParams); | |||||
| park.setVendorParams(params); | |||||
| park.setParkingId(parkId); | |||||
| wxParkService.saveOrUpdate(park); | |||||
| } | |||||
| ResultData e = etcpParkStatus(park); | |||||
| if (e != null) return e; | |||||
| } | |||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "车场不支持"); | |||||
| } | |||||
| private ResultData etcpParkStatus(WxPark park) { | |||||
| String params = park.getVendorParams(); | |||||
| if(params == null) { | |||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "车场不支持"); | |||||
| } | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String merchantNo = objParams.getString("merchantNo"); | |||||
| String merchantKey = objParams.getString("merchantKey"); | |||||
| String version = objParams.getString("version"); | |||||
| if (park.getParkingId() == null) { | |||||
| // those code is not supported | |||||
| /* | |||||
| String lat = objParams.getString("lat"); | |||||
| String lon = objParams.getString("lon"); | |||||
| String radius = objParams.getString("radius"); | |||||
| String ret = etcp.parkingInfo(url, merchantNo, merchantKey, version, lat, lon, radius); | |||||
| logger.info(ret); | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getIntValue("code") == EnumETCPCode.SUCCESS.getCode()) { | |||||
| JSONObject retData = retObj.getJSONObject("data"); | |||||
| if (retData != null) { | |||||
| JSONArray retDataList = retData.getJSONArray("list"); | |||||
| if (retDataList != null) { | |||||
| JSONObject parkData = retDataList.getJSONObject(0); | |||||
| if (parkData != null) { | |||||
| String parkId = parkData.getString("id"); | |||||
| objParams.put("parkId", parkId); | |||||
| params = JSON.toJSONString(objParams); | |||||
| park.setVendorParams(params); | |||||
| park.setParkingId(parkId); | |||||
| wxParkService.saveOrUpdate(park); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| */ | |||||
| } | } | ||||
| */ | |||||
| } | |||||
| if (park.getParkingId() != null) { | |||||
| String ret = ""; | |||||
| try { | |||||
| ret = etcp.parkingStatus(url, merchantNo, merchantKey, version, park.getParkingId()); | |||||
| } catch (MallinkException e) { | |||||
| logger.error("ETCP failed: " + e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| if (park.getParkingId() != null) { | |||||
| String ret = ""; | |||||
| try { | |||||
| ret = etcp.parkingStatus(url, merchantNo, merchantKey, version, park.getParkingId()); | |||||
| } catch (MallinkException e) { | |||||
| logger.error("ETCP failed: " + e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getIntValue("code") == EnumETCPCode.SUCCESS.getCode()) { | |||||
| if (retObj.get("data") != null) { | |||||
| return new ResultData(retObj.getJSONObject("data")); | |||||
| } | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getIntValue("code") == EnumETCPCode.SUCCESS.getCode()) { | |||||
| if (retObj.get("data") != null) { | |||||
| return new ResultData(retObj.getJSONObject("data")); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "车场不支持"); | |||||
| return null; | |||||
| } | } | ||||
| @@ -15,5 +15,7 @@ public interface WxCouponCarMapper extends CommonMapper<WxCouponCar, String> { | |||||
| Integer findTemplateAvailCount(Long templateId); | Integer findTemplateAvailCount(Long templateId); | ||||
| Integer findAmtCountForCouponOrderTakeOff(Long templateId); | |||||
| WxCouponCarVo findVoDetail(@Param("id")Long id); | WxCouponCarVo findVoDetail(@Param("id")Long id); | ||||
| } | } | ||||
| @@ -47,19 +47,26 @@ public interface WxCouponCarService { | |||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| /** | /** | ||||
| * 根据templateId获取分配总数 | |||||
| * 根据templateId获取库存总数 | |||||
| * | * | ||||
| * @param templateId | * @param templateId | ||||
| */ | */ | ||||
| Integer getAmtCountByTemplateId(Long templateId); | Integer getAmtCountByTemplateId(Long templateId); | ||||
| /** | /** | ||||
| * 根据templateId获取库存总数 | |||||
| * 根据templateId获取已分配总数 | |||||
| * | * | ||||
| * @param templateId | * @param templateId | ||||
| */ | */ | ||||
| Integer getAvaibleCountByTemplateId(Long templateId); | Integer getAvaibleCountByTemplateId(Long templateId); | ||||
| /** | |||||
| * 根据templateId获取作废券的已领取总数 | |||||
| * | |||||
| * @param templateId | |||||
| */ | |||||
| Integer getClaimCountByTemplateId(Long templateId); | |||||
| /** | /** | ||||
| * 根据coupon获得实体 | * 根据coupon获得实体 | ||||
| * | * | ||||
| @@ -2504,3 +2504,4 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| } | } | ||||
| } | } | ||||
| @@ -56,6 +56,11 @@ public class WxCouponCarServiceImpl implements WxCouponCarService { | |||||
| return wxCouponCarMapper.findTemplateAvailCount(templateId); | return wxCouponCarMapper.findTemplateAvailCount(templateId); | ||||
| } | } | ||||
| @Override | |||||
| public Integer getClaimCountByTemplateId(Long templateId) { | |||||
| return wxCouponCarMapper.findAmtCountForCouponOrderTakeOff(templateId); | |||||
| } | |||||
| @Override | @Override | ||||
| public WxCouponCarVo findDetailVo(Long id) { | public WxCouponCarVo findDetailVo(Long id) { | ||||
| return wxCouponCarMapper.findVoDetail(id); | return wxCouponCarMapper.findVoDetail(id); | ||||
| @@ -223,10 +223,11 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | WxCreditHistory wxCreditHistory = new WxCreditHistory(); | ||||
| wxCreditHistory.setBusinessId(Long.valueOf(wxMerchant.getBusinessId())); | wxCreditHistory.setBusinessId(Long.valueOf(wxMerchant.getBusinessId())); | ||||
| wxCreditHistory.setTenantId(tenantId); | wxCreditHistory.setTenantId(tenantId); | ||||
| if (StringUtils.isNotEmpty(spendStr)) { | |||||
| int credit = 0; | |||||
| if (StringUtils.isNotBlank(spendStr)) { | |||||
| wxCreditHistory.setSpend(new BigDecimal(spendStr).multiply(new BigDecimal(100)).intValue()); | wxCreditHistory.setSpend(new BigDecimal(spendStr).multiply(new BigDecimal(100)).intValue()); | ||||
| credit = payAddCredit(wxCreditHistory); | |||||
| } | } | ||||
| int credit = payAddCredit(wxCreditHistory); | |||||
| creditMap.put("credit", credit); | creditMap.put("credit", credit); | ||||
| } | } | ||||
| return creditMap; | return creditMap; | ||||
| @@ -22,9 +22,9 @@ | |||||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | ||||
| <result column="return_price" jdbcType="BIGINT" property="returnPrice"/> | <result column="return_price" jdbcType="BIGINT" property="returnPrice"/> | ||||
| <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | ||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`, | `id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`, | ||||
| `expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`,`merchant_id`,`user_id`,`shop_id`,`updatetime`, | `expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`,`merchant_id`,`user_id`,`shop_id`,`updatetime`, | ||||
| @@ -32,42 +32,42 @@ | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1 = 1 | |||||
| <if test=" null != id "> and `id` = #{id} </if> | |||||
| <if test=" null != rentContractId "> and `rent_contract_id` = #{rentContractId} </if> | |||||
| <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if> | |||||
| <if test=" null != pay "> and `pay` = #{pay} </if> | |||||
| <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if> | |||||
| <if test=" null != payDate "> and `pay_date` = #{payDate} </if> | |||||
| <if test=" null != createtime "> and `createtime` = #{createtime} </if> | |||||
| <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if> | |||||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||||
| <if test=" null != owe "> and `owe` = #{owe} </if> | |||||
| <if test=" null != status "> and `status` = #{status} </if> | |||||
| <if test=" null != isDel "> and `is_del` = #{isDel} </if> | |||||
| <if test=" null != needPay "> and `need_pay` = #{needPay} </if> | |||||
| <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if> | |||||
| <if test=" null != userId "> and `user_id` = #{userId} </if> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> and `id` = #{id} </if> | |||||
| <if test=" null != rentContractId "> and `rent_contract_id` = #{rentContractId} </if> | |||||
| <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if> | |||||
| <if test=" null != pay "> and `pay` = #{pay} </if> | |||||
| <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if> | |||||
| <if test=" null != payDate "> and `pay_date` = #{payDate} </if> | |||||
| <if test=" null != createtime "> and `createtime` = #{createtime} </if> | |||||
| <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if> | |||||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||||
| <if test=" null != owe "> and `owe` = #{owe} </if> | |||||
| <if test=" null != status "> and `status` = #{status} </if> | |||||
| <if test=" null != isDel "> and `is_del` = #{isDel} </if> | |||||
| <if test=" null != needPay "> and `need_pay` = #{needPay} </if> | |||||
| <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if> | |||||
| <if test=" null != userId "> and `user_id` = #{userId} </if> | |||||
| <if test=" null != shopId "> and `shop_id` = #{shopId} </if> | <if test=" null != shopId "> and `shop_id` = #{shopId} </if> | ||||
| <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if> | <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if> | ||||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | ||||
| <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | ||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| #{idItem} | |||||
| #{idItem} | |||||
| </foreach> | </foreach> | ||||
| </if> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| </sql> | </sql> | ||||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillDeposit" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxBillDeposit" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns" /> from wx_bill_rent_deposit | select <include refid="allColumns" /> from wx_bill_rent_deposit | ||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="queryBillDepositList" parameterType="com.iformall.domain.po.WxRentContract" resultType="hashmap"> | <select id="queryBillDepositList" parameterType="com.iformall.domain.po.WxRentContract" resultType="hashmap"> | ||||
| select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | ||||
| br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | ||||
| @@ -86,11 +86,11 @@ | |||||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | ||||
| <if test=" null != rentContractId ">and br.`rent_contract_id` = #{rentContractId}</if> | <if test=" null != rentContractId ">and br.`rent_contract_id` = #{rentContractId}</if> | ||||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | ||||
| </where> | </where> | ||||
| order by id desc | order by id desc | ||||
| </select> | </select> | ||||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | ||||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent_deposit | select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent_deposit | ||||
| where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate} | where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate} | ||||
| @@ -129,10 +129,10 @@ | |||||
| update wx_bill_rent_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | update wx_bill_rent_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | ||||
| where tenant_id=#{tenantId} and status!=#{paid} and status!=5 and DATEDIFF(now(),receive_date)>0 | where tenant_id=#{tenantId} and status!=#{paid} and status!=5 and DATEDIFF(now(),receive_date)>0 | ||||
| </update> | </update> | ||||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | <update id="updateWaitPayStatus" parameterType="hashmap"> | ||||
| update wx_bill_rent_deposit set status=#{waitPay} where id in( | |||||
| select a.id from (select br.id,rc.receive_period,br.rent_contract_id,br.receive_date from wx_bill_rent_deposit br | |||||
| update wx_bill_rent_deposit set status=#{waitPay} where id in( | |||||
| select a.id from (select br.id,rc.receive_period,br.rent_contract_id,br.receive_date from wx_bill_rent_deposit br | |||||
| left join wx_rent_contract rc on br.rent_contract_id=rc.id | left join wx_rent_contract rc on br.rent_contract_id=rc.id | ||||
| where br.tenant_id=#{tenantId} and br.status!=#{paid} and br.status!=5 and now() < br.receive_date | where br.tenant_id=#{tenantId} and br.status!=#{paid} and br.status!=5 and now() < br.receive_date | ||||
| and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | ||||
| @@ -142,5 +142,6 @@ | |||||
| select count(*) c from wx_rent_contract r,wx_bill_rent_deposit b | select count(*) c from wx_rent_contract r,wx_bill_rent_deposit b | ||||
| where b.rent_contract_id = r.id and b.status = 1 and r.id = #{id} | where b.rent_contract_id = r.id and b.status = 1 and r.id = #{id} | ||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||
| @@ -21,9 +21,9 @@ | |||||
| <result column="comments" jdbcType="VARCHAR" property="comments" /> | <result column="comments" jdbcType="VARCHAR" property="comments" /> | ||||
| <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/> | ||||
| <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | ||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`, | `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`, | ||||
| `tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`name`,`comments`, | `tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`name`,`comments`, | ||||
| @@ -31,40 +31,40 @@ | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1 = 1 | |||||
| <if test=" null != id "> and `id` = #{id} </if> | |||||
| <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if> | |||||
| <if test=" null != pay "> and `pay` = #{pay} </if> | |||||
| <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if> | |||||
| <if test=" null != payDate "> and `pay_date` = #{payDate} </if> | |||||
| <if test=" null != createtime "> and `createtime` = #{createtime} </if> | |||||
| <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if> | |||||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||||
| <if test=" null != owe "> and `owe` = #{owe} </if> | |||||
| <if test=" null != status "> and `status` = #{status} </if> | |||||
| <if test=" null != isDel "> and `is_del` = #{isDel} </if> | |||||
| <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if> | |||||
| <if test=" null != userId "> and `user_id` = #{userId} </if> | |||||
| <if test=" null != shopId "> and `shop_id` = #{shopId} </if> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> and `id` = #{id} </if> | |||||
| <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if> | |||||
| <if test=" null != pay "> and `pay` = #{pay} </if> | |||||
| <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if> | |||||
| <if test=" null != payDate "> and `pay_date` = #{payDate} </if> | |||||
| <if test=" null != createtime "> and `createtime` = #{createtime} </if> | |||||
| <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if> | |||||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||||
| <if test=" null != owe "> and `owe` = #{owe} </if> | |||||
| <if test=" null != status "> and `status` = #{status} </if> | |||||
| <if test=" null != isDel "> and `is_del` = #{isDel} </if> | |||||
| <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if> | |||||
| <if test=" null != userId "> and `user_id` = #{userId} </if> | |||||
| <if test=" null != shopId "> and `shop_id` = #{shopId} </if> | |||||
| <if test=" null != updatetime "> and `updatetime` = #{updatetime} </if> | <if test=" null != updatetime "> and `updatetime` = #{updatetime} </if> | ||||
| <if test=" null != name "> and `name` = #{name} </if> | <if test=" null != name "> and `name` = #{name} </if> | ||||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | ||||
| <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | <if test=" null != payWay ">and `pay_way` = #{payWay}</if> | ||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| #{idItem} | |||||
| #{idItem} | |||||
| </foreach> | </foreach> | ||||
| </if> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| </sql> | </sql> | ||||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillOther" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxBillOther" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns" /> from wx_bill_other | select <include refid="allColumns" /> from wx_bill_other | ||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="queryBillList" parameterType="com.iformall.domain.po.WxBillOther" resultType="hashmap"> | <select id="queryBillList" parameterType="com.iformall.domain.po.WxBillOther" resultType="hashmap"> | ||||
| select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | ||||
| br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | ||||
| @@ -82,16 +82,16 @@ | |||||
| <if test=" null != name ">and br.`name` = #{name}</if> | <if test=" null != name ">and br.`name` = #{name}</if> | ||||
| <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if> | ||||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | ||||
| </where> | </where> | ||||
| order by id desc | order by id desc | ||||
| </select> | </select> | ||||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | <update id="updateNotPaidStatus" parameterType="hashmap"> | ||||
| update wx_bill_other set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | update wx_bill_other set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | ||||
| where tenant_id=#{tenantId} and status!=#{paid} and DATEDIFF(now(),receive_date)>0 | where tenant_id=#{tenantId} and status!=#{paid} and DATEDIFF(now(),receive_date)>0 | ||||
| </update> | </update> | ||||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | <update id="updateWaitPayStatus" parameterType="hashmap"> | ||||
| update wx_bill_other set status=#{waitPay} where tenant_id=#{tenantId} | update wx_bill_other set status=#{waitPay} where tenant_id=#{tenantId} | ||||
| and status!=#{paid} and DATEDIFF(now(),receive_date) <=0 | and status!=#{paid} and DATEDIFF(now(),receive_date) <=0 | ||||
| @@ -114,5 +114,6 @@ | |||||
| select IFNULL(round(sum(owe)/100,2),0) owe,tenant_id from wx_bill_other | select IFNULL(round(sum(owe)/100,2),0) owe,tenant_id from wx_bill_other | ||||
| where status = 1 and tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} | where status = 1 and tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} | ||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||
| @@ -30,9 +30,9 @@ | |||||
| <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | ||||
| <result column="late_pay_status" jdbcType="INTEGER" property="latePayStatus"/> | <result column="late_pay_status" jdbcType="INTEGER" property="latePayStatus"/> | ||||
| <result column="comments" jdbcType="VARCHAR" property="comments"/> | <result column="comments" jdbcType="VARCHAR" property="comments"/> | ||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`, | `id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`, | ||||
| `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | ||||
| @@ -43,21 +43,21 @@ | |||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1=1 | where 1=1 | ||||
| <if test=" null != id "> and `id` = #{id} </if> | |||||
| <if test=" null != id "> and `id` = #{id} </if> | |||||
| <if test=" null != propertyContractId "> and `property_contract_id` = #{propertyContractId} </if> | <if test=" null != propertyContractId "> and `property_contract_id` = #{propertyContractId} </if> | ||||
| <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if> | |||||
| <if test=" null != pay "> and `pay` = #{pay} </if> | |||||
| <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if> | |||||
| <if test=" null != payDate "> and `pay_date` = #{payDate} </if> | |||||
| <if test=" null != createtime "> and `createtime` = #{createtime} </if> | |||||
| <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if> | |||||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||||
| <if test=" null != owe "> and `owe` = #{owe} </if> | |||||
| <if test=" null != status "> and `status` = #{status} </if> | |||||
| <if test=" null != isDel "> and `is_del` = #{isDel} </if> | |||||
| <if test=" null != needPay "> and `need_pay` = #{needPay} </if> | |||||
| <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if> | |||||
| <if test=" null != userId "> and `user_id` = #{userId} </if> | |||||
| <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if> | |||||
| <if test=" null != pay "> and `pay` = #{pay} </if> | |||||
| <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if> | |||||
| <if test=" null != payDate "> and `pay_date` = #{payDate} </if> | |||||
| <if test=" null != createtime "> and `createtime` = #{createtime} </if> | |||||
| <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if> | |||||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||||
| <if test=" null != owe "> and `owe` = #{owe} </if> | |||||
| <if test=" null != status "> and `status` = #{status} </if> | |||||
| <if test=" null != isDel "> and `is_del` = #{isDel} </if> | |||||
| <if test=" null != needPay "> and `need_pay` = #{needPay} </if> | |||||
| <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if> | |||||
| <if test=" null != userId "> and `user_id` = #{userId} </if> | |||||
| <if test=" null != shopId "> and `shop_id` = #{shopId} </if> | <if test=" null != shopId "> and `shop_id` = #{shopId} </if> | ||||
| <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if> | <if test=" null != updatetime ">and `updatetime` = #{updatetime}</if> | ||||
| <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if> | ||||
| @@ -67,19 +67,19 @@ | |||||
| <if test=" null != latePayStatus ">and `late_pay_status` = #{latePayStatus}</if> | <if test=" null != latePayStatus ">and `late_pay_status` = #{latePayStatus}</if> | ||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| #{idItem} | |||||
| #{idItem} | |||||
| </foreach> | </foreach> | ||||
| </if> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| </sql> | </sql> | ||||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns" /> from wx_bill_property | select <include refid="allColumns" /> from wx_bill_property | ||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="queryBillPropertyList" parameterType="com.iformall.domain.po.WxBillProperty" resultType="hashmap"> | <select id="queryBillPropertyList" parameterType="com.iformall.domain.po.WxBillProperty" resultType="hashmap"> | ||||
| select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | ||||
| br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | ||||
| @@ -109,11 +109,11 @@ | |||||
| <if test=" null != propertyContractId ">and br.`property_contract_id` = #{propertyContractId}</if> | <if test=" null != propertyContractId ">and br.`property_contract_id` = #{propertyContractId}</if> | ||||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | ||||
| <if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if> | <if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if> | ||||
| </where> | </where> | ||||
| <if test=" null != sortColumns">order by br.${sortColumns}</if> | <if test=" null != sortColumns">order by br.${sortColumns}</if> | ||||
| </select> | </select> | ||||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | ||||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property | select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property | ||||
| where tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0 | where tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0 | ||||
| @@ -131,15 +131,15 @@ | |||||
| select IFNULL(round(sum(owe)/100,2),0) owe,tenant_id from wx_bill_property | select IFNULL(round(sum(owe)/100,2),0) owe,tenant_id from wx_bill_property | ||||
| where status = 1 and tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0 | where status = 1 and tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0 | ||||
| </select> | </select> | ||||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | <update id="updateNotPaidStatus" parameterType="hashmap"> | ||||
| update wx_bill_property set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | update wx_bill_property set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | ||||
| where tenant_id=#{tenantId} and status!=#{paid} and status != 6 and DATEDIFF(now(),receive_date)>0 | where tenant_id=#{tenantId} and status!=#{paid} and status != 6 and DATEDIFF(now(),receive_date)>0 | ||||
| </update> | </update> | ||||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | <update id="updateWaitPayStatus" parameterType="hashmap"> | ||||
| update wx_bill_property set status=#{waitPay} where id in( | |||||
| select a.id from (select br.id,rc.receive_period,br.property_contract_id,br.receive_date from wx_bill_property br | |||||
| update wx_bill_property set status=#{waitPay} where id in( | |||||
| select a.id from (select br.id,rc.receive_period,br.property_contract_id,br.receive_date from wx_bill_property br | |||||
| left join wx_property_contract rc on br.property_contract_id=rc.id | left join wx_property_contract rc on br.property_contract_id=rc.id | ||||
| where br.tenant_id=#{tenantId} and br.status!=#{paid} and br.status != 6 and now() < br.receive_date | where br.tenant_id=#{tenantId} and br.status!=#{paid} and br.status != 6 and now() < br.receive_date | ||||
| and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | ||||
| @@ -179,3 +179,4 @@ | |||||
| where c.id = br.property_contract_id and br.status = 1 and c.id = #{contractId} | where c.id = br.property_contract_id and br.status = 1 and c.id = #{contractId} | ||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||
| @@ -30,9 +30,9 @@ | |||||
| <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | <result column="pay_way" jdbcType="INTEGER" property="payWay"/> | ||||
| <result column="late_pay_status" jdbcType="INTEGER" property="latePayStatus"/> | <result column="late_pay_status" jdbcType="INTEGER" property="latePayStatus"/> | ||||
| <result column="comments" jdbcType="VARCHAR" property="comments"/> | <result column="comments" jdbcType="VARCHAR" property="comments"/> | ||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`, | `id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`, | ||||
| `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | `createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`, | ||||
| @@ -40,7 +40,7 @@ | |||||
| `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`, | `revenue`,`late_pay_ratio`,`late_pay_time`,`late_pay_price`,`period`,`is_preview`,`shop_info`, | ||||
| `pay_way`,`late_pay_status`,`comments` | `pay_way`,`late_pay_status`,`comments` | ||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1=1 | where 1=1 | ||||
| <if test=" null != id ">and `id` = #{id}</if> | <if test=" null != id ">and `id` = #{id}</if> | ||||
| @@ -74,15 +74,15 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | <if test=" null != sortColumns">order by ${sortColumns}</if> | ||||
| </sql> | </sql> | ||||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillRent" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxBillRent" resultMap="BaseResultMap"> | ||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_bill_rent | from wx_bill_rent | ||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="queryBillRentList" parameterType="com.iformall.domain.po.WxRentContract" resultType="hashmap"> | <select id="queryBillRentList" parameterType="com.iformall.domain.po.WxRentContract" resultType="hashmap"> | ||||
| select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | ||||
| br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`, | ||||
| @@ -113,11 +113,11 @@ | |||||
| <if test=" null != rentContractId ">and br.`rent_contract_id` = #{rentContractId}</if> | <if test=" null != rentContractId ">and br.`rent_contract_id` = #{rentContractId}</if> | ||||
| <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if> | ||||
| <if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if> | <if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if> | ||||
| </where> | </where> | ||||
| <if test=" null != sortColumns">order by br.${sortColumns}</if> | <if test=" null != sortColumns">order by br.${sortColumns}</if> | ||||
| </select> | </select> | ||||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | ||||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent | select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent | ||||
| where tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0 | where tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0 | ||||
| @@ -134,15 +134,15 @@ | |||||
| select IFNULL(round(sum(owe)/100,2),0) owe,tenant_id from wx_bill_rent | select IFNULL(round(sum(owe)/100,2),0) owe,tenant_id from wx_bill_rent | ||||
| where status = 1 and tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0 | where status = 1 and tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0 | ||||
| </select> | </select> | ||||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | <update id="updateNotPaidStatus" parameterType="hashmap"> | ||||
| update wx_bill_rent set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | update wx_bill_rent set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date) | ||||
| where tenant_id=#{tenantId} and status!=#{paid} and status!=6 and DATEDIFF(now(),receive_date)>0 | where tenant_id=#{tenantId} and status!=#{paid} and status!=6 and DATEDIFF(now(),receive_date)>0 | ||||
| </update> | </update> | ||||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | <update id="updateWaitPayStatus" parameterType="hashmap"> | ||||
| update wx_bill_rent set status=#{waitPay} where id in( | |||||
| select a.id from (select br.id,rc.receive_period,br.rent_contract_id,br.receive_date from wx_bill_rent br | |||||
| update wx_bill_rent set status=#{waitPay} where id in( | |||||
| select a.id from (select br.id,rc.receive_period,br.rent_contract_id,br.receive_date from wx_bill_rent br | |||||
| left join wx_rent_contract rc on br.rent_contract_id=rc.id | left join wx_rent_contract rc on br.rent_contract_id=rc.id | ||||
| where br.tenant_id=#{tenantId} and br.status!=#{paid} and br.status!=6 and now() < br.receive_date | where br.tenant_id=#{tenantId} and br.status!=#{paid} and br.status!=6 and now() < br.receive_date | ||||
| and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a) | ||||
| @@ -178,3 +178,4 @@ | |||||
| </mapper> | </mapper> | ||||
| @@ -71,7 +71,18 @@ | |||||
| from wx_coupon_car car, wx_coupon c | from wx_coupon_car car, wx_coupon c | ||||
| where car.id = c.id | where car.id = c.id | ||||
| and c.status = 0 | and c.status = 0 | ||||
| and json_extract(vendor_params,'$.id') = ${value} | |||||
| and json_extract(car.vendor_params,'$.id') = ${value} | |||||
| </select> | |||||
| <select id="findAmtCountForCouponOrderTakeOff" parameterType="Long" resultType="Integer"> | |||||
| select count(co.id) as id_count | |||||
| from wx_coupon_order co, wx_coupon c, wx_coupon_car car | |||||
| where 1=1 | |||||
| and c.id = co.coupon_id | |||||
| and (co.coupon_order_status = 0 or co.coupon_order_status = 1) | |||||
| and c.status = 1 | |||||
| and car.id = c.id | |||||
| and json_extract(car.vendor_params,'$.id') = ${value} | |||||
| </select> | </select> | ||||
| <select id="findTemplateAvailCount" parameterType="Long" resultType="Integer"> | <select id="findTemplateAvailCount" parameterType="Long" resultType="Integer"> | ||||