Quellcode durchsuchen

Merge tag 'refs/tags/jenkins-back-end-1474' into release

develop
release_toaliyun_real
Stormeye Wu vor 7 Jahren
Ursprung
Commit
d3363f975e
13 geänderte Dateien mit 524 neuen und 439 gelöschten Zeilen
  1. +10
    -6
      mallinkAdmin/src/main/java/com/iformall/controller/WxCarController.java
  2. +4
    -0
      mallinkAdmin/src/main/java/com/iformall/shiro/MyShiroRealm.java
  3. +378
    -332
      mallinkCApi/src/main/java/com/iformall/controller/WxCarController.java
  4. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponCarMapper.java
  5. +9
    -2
      mallinkService/src/main/java/com/iformall/service/WxCouponCarService.java
  6. +1
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java
  7. +5
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponCarServiceImpl.java
  8. +3
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java
  9. +32
    -31
      mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml
  10. +28
    -27
      mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml
  11. +28
    -27
      mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml
  12. +12
    -11
      mallinkService/src/main/resources/mapper/WxBillRentMapper.xml
  13. +12
    -1
      mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml

+ 10
- 6
mallinkAdmin/src/main/java/com/iformall/controller/WxCarController.java Datei anzeigen

@@ -245,38 +245,42 @@ public class WxCarController extends BaseController {
}


@ApiOperation("优免券模板已分配总数")
@ApiOperation("优免券模板库存总数")
@GetMapping("/templateAmtCount")
@ApiImplicitParams({
@ApiImplicitParam(name = "templateId", value = "模板ID", dataType = "Long", paramType = "query", required = true)})
@SystemControllerLog(description = "车-优免券模板已分配总数")
public ResultData getTemplateAmountSum(Long templateId) {
logger.debug("[" + getIpAddr() + "] WxCarController::getTemplateAmountSum");
Map map = new HashMap();
// 库存总数 = 库存总数(status=0) + 作废券已领取(待使用+已使用)
Integer amountCount = 0;
try {
amountCount = wxCouponCarService.getAmtCountByTemplateId(templateId);
amountCount = wxCouponCarService.getAmtCountByTemplateId(templateId) +
wxCouponCarService.getClaimCountByTemplateId(templateId);
} catch (Exception e) {
logger.error(e.getMessage());
}
Map map = new HashMap();
map.put("amountCount", amountCount);
return new ResultData(map);
}

@ApiOperation("优免券模板库存总数")
@ApiOperation("优免券模板已分配总数")
@GetMapping("/templateAvaiCount")
@ApiImplicitParams({
@ApiImplicitParam(name = "templateId", value = "模板ID", dataType = "Long", paramType = "query", required = true)})
@SystemControllerLog(description = "车-优免券模板库存总数")
public ResultData getTemplateAvailSum(Long templateId) {
logger.debug("[" + getIpAddr() + "] WxCarController::getTemplateAvailSum");
Map map = new HashMap();
// 已分配总数 = 可用库存总数(status=0)+ 作废券已领取(待使用+已使用)
Integer availCount = 0;
try {
availCount = wxCouponCarService.getAvaibleCountByTemplateId(templateId);
availCount = wxCouponCarService.getAvaibleCountByTemplateId(templateId) +
wxCouponCarService.getClaimCountByTemplateId(templateId);
} catch (Exception e) {
logger.error(e.getMessage());
}
Map map = new HashMap();
map.put("availCount", availCount);
return new ResultData(map);
}


+ 4
- 0
mallinkAdmin/src/main/java/com/iformall/shiro/MyShiroRealm.java Datei anzeigen

@@ -53,6 +53,10 @@ public class MyShiroRealm extends AuthorizingRealm {
if(user == null) {
throw new UnknownAccountException(ErrorCode.USER_IS_EMPTY.getMessage());
}
if(user.getTenantId().equals("1")) {
// 只支持租户为1的用户
throw new UnknownAccountException("租户不支持");
}
if(user.getStatus()==null ||
!EnumMallUserStatus.VALID.getCode().equals(user.getStatus())) {//用户被禁用
throw new DisabledAccountException(ErrorCode.USER_IS_LOCKED.getMessage());


+ 378
- 332
mallinkCApi/src/main/java/com/iformall/controller/WxCarController.java Datei anzeigen

@@ -95,50 +95,7 @@ public class WxCarController extends BaseController {
WxPark park = getCurrentPark(getTenantId());
// 2. get vendor params
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()){
// TJD不需要共同登录
Map resultMap = new HashMap();
@@ -149,8 +106,55 @@ public class WxCarController extends BaseController {
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 tenantId
* @param iVendorType
@@ -161,9 +165,9 @@ public class WxCarController extends BaseController {
* @param etcpToken
* @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;
JSONObject retObj;
/*{"code": 0,"msg": "ok","data": {"number": 3,"carList": ["晋 BMZ105","云 C12345"]}} */
@@ -253,115 +257,134 @@ public class WxCarController extends BaseController {
WxPark park = getCurrentPark(getTenantId());
// 2. get vendor params
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-----
@@ -399,89 +422,98 @@ public class WxCarController extends BaseController {
// 1, get mall's park
WxPark park = getCurrentPark(getTenantId());
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 {
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);
if (retObj.getIntValue("code") == 0) {
if (retObj.getString("returnCode").equalsIgnoreCase(EnumTJDCode.SUCCESS.getMessage())) {
try {
WxCUserCar userCar = new WxCUserCar();
userCar.setCUserId(getUserId());
userCar.setTenantId(getTenantId());
userCar.setCarNumber(carNumber);
wxCUserCarService.deleteByObj(userCar);
} 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();
} 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
WxPark park = getCurrentPark(getTenantId());
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 {
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
WxPark park = getCurrentPark(getTenantId());
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;
}




+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponCarMapper.java Datei anzeigen

@@ -15,5 +15,7 @@ public interface WxCouponCarMapper extends CommonMapper<WxCouponCar, String> {

Integer findTemplateAvailCount(Long templateId);

Integer findAmtCountForCouponOrderTakeOff(Long templateId);

WxCouponCarVo findVoDetail(@Param("id")Long id);
}

+ 9
- 2
mallinkService/src/main/java/com/iformall/service/WxCouponCarService.java Datei anzeigen

@@ -47,19 +47,26 @@ public interface WxCouponCarService {
void deleteById(Long id);

/**
* 根据templateId获取分配总数
* 根据templateId获取库存总数
*
* @param templateId
*/
Integer getAmtCountByTemplateId(Long templateId);

/**
* 根据templateId获取库存总数
* 根据templateId获取已分配总数
*
* @param templateId
*/
Integer getAvaibleCountByTemplateId(Long templateId);

/**
* 根据templateId获取作废券的已领取总数
*
* @param templateId
*/
Integer getClaimCountByTemplateId(Long templateId);

/**
* 根据coupon获得实体
*


+ 1
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java Datei anzeigen

@@ -2504,3 +2504,4 @@ public class WxChartServiceImpl implements WxChartDataService {
}

}


+ 5
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponCarServiceImpl.java Datei anzeigen

@@ -56,6 +56,11 @@ public class WxCouponCarServiceImpl implements WxCouponCarService {
return wxCouponCarMapper.findTemplateAvailCount(templateId);
}

@Override
public Integer getClaimCountByTemplateId(Long templateId) {
return wxCouponCarMapper.findAmtCountForCouponOrderTakeOff(templateId);
}

@Override
public WxCouponCarVo findDetailVo(Long id) {
return wxCouponCarMapper.findVoDetail(id);


+ 3
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java Datei anzeigen

@@ -223,10 +223,11 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
WxCreditHistory wxCreditHistory = new WxCreditHistory();
wxCreditHistory.setBusinessId(Long.valueOf(wxMerchant.getBusinessId()));
wxCreditHistory.setTenantId(tenantId);
if (StringUtils.isNotEmpty(spendStr)) {
int credit = 0;
if (StringUtils.isNotBlank(spendStr)) {
wxCreditHistory.setSpend(new BigDecimal(spendStr).multiply(new BigDecimal(100)).intValue());
credit = payAddCredit(wxCreditHistory);
}
int credit = payAddCredit(wxCreditHistory);
creditMap.put("credit", credit);
}
return creditMap;


+ 32
- 31
mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml Datei anzeigen

@@ -22,9 +22,9 @@
<result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
<result column="return_price" jdbcType="BIGINT" property="returnPrice"/>
<result column="pay_way" jdbcType="INTEGER" property="payWay"/>
</resultMap>
<sql id="allColumns">
`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`,
@@ -32,42 +32,42 @@
</sql>

<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 != updatetime ">and `updatetime` = #{updatetime}</if>
<if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
<if test=" null != payWay ">and `pay_way` = #{payWay}</if>
<if test=" null != ids ">
and id in
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
#{idItem}
</foreach>
</if>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
</sql>
<select id="findList" parameterType="com.iformall.domain.po.WxBillDeposit" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_bill_rent_deposit
<include refid="dynamicWhereConditions" />
</select>
<select id="queryBillDepositList" parameterType="com.iformall.domain.po.WxRentContract" resultType="hashmap">
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`,
@@ -86,11 +86,11 @@
<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 != payWay ">and br.`pay_way` = #{payWay}</if>
</where>
order by id desc
</select>
<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
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)
where tenant_id=#{tenantId} and status!=#{paid} and status!=5 and DATEDIFF(now(),receive_date)>0
</update>
<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
where br.tenant_id=#{tenantId} and br.status!=#{paid} and br.status!=5 and now() &lt; br.receive_date
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
where b.rent_contract_id = r.id and b.status = 1 and r.id = #{id}
</select>
</mapper>


+ 28
- 27
mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml Datei anzeigen

@@ -21,9 +21,9 @@
<result column="comments" jdbcType="VARCHAR" property="comments" />
<result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
<result column="pay_way" jdbcType="INTEGER" property="payWay"/>
</resultMap>
<sql id="allColumns">
`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`,
@@ -31,40 +31,40 @@
</sql>

<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 != name "> and `name` = #{name} </if>
<if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
<if test=" null != payWay ">and `pay_way` = #{payWay}</if>
<if test=" null != ids ">
and id in
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
#{idItem}
</foreach>
</if>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
</sql>
<select id="findList" parameterType="com.iformall.domain.po.WxBillOther" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_bill_other
<include refid="dynamicWhereConditions" />
</select>
<select id="queryBillList" parameterType="com.iformall.domain.po.WxBillOther" resultType="hashmap">
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`,
@@ -82,16 +82,16 @@
<if test=" null != name ">and br.`name` = #{name}</if>
<if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if>
<if test=" null != payWay ">and br.`pay_way` = #{payWay}</if>
</where>
order by id desc
</select>
<update id="updateNotPaidStatus" parameterType="hashmap">
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
</update>
<update id="updateWaitPayStatus" parameterType="hashmap">
update wx_bill_other set status=#{waitPay} where tenant_id=#{tenantId}
and status!=#{paid} and DATEDIFF(now(),receive_date) &lt;=0
@@ -114,5 +114,6 @@
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}
</select>
</mapper>


+ 28
- 27
mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml Datei anzeigen

@@ -30,9 +30,9 @@
<result column="pay_way" jdbcType="INTEGER" property="payWay"/>
<result column="late_pay_status" jdbcType="INTEGER" property="latePayStatus"/>
<result column="comments" jdbcType="VARCHAR" property="comments"/>
</resultMap>
<sql id="allColumns">
`id`,`property_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,
`createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`need_pay`,
@@ -43,21 +43,21 @@

<sql id="dynamicWhereConditions">
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 != 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 != updatetime ">and `updatetime` = #{updatetime}</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 != ids ">
and id in
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
#{idItem}
</foreach>
</if>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
</sql>
<select id="findList" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_bill_property
<include refid="dynamicWhereConditions" />
</select>
<select id="queryBillPropertyList" parameterType="com.iformall.domain.po.WxBillProperty" resultType="hashmap">
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`,
@@ -109,11 +109,11 @@
<if test=" null != propertyContractId ">and br.`property_contract_id` = #{propertyContractId}</if>
<if test=" null != payWay ">and br.`pay_way` = #{payWay}</if>
<if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if>
</where>
<if test=" null != sortColumns">order by br.${sortColumns}</if>
</select>
<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
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
where status = 1 and tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0
</select>
<update id="updateNotPaidStatus" parameterType="hashmap">
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
</update>
<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
where br.tenant_id=#{tenantId} and br.status!=#{paid} and br.status != 6 and now() &lt; br.receive_date
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}
</select>
</mapper>


+ 12
- 11
mallinkService/src/main/resources/mapper/WxBillRentMapper.xml Datei anzeigen

@@ -30,9 +30,9 @@
<result column="pay_way" jdbcType="INTEGER" property="payWay"/>
<result column="late_pay_status" jdbcType="INTEGER" property="latePayStatus"/>
<result column="comments" jdbcType="VARCHAR" property="comments"/>
</resultMap>
<sql id="allColumns">
`id`,`rent_contract_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,
`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`,
`pay_way`,`late_pay_status`,`comments`
</sql>
<sql id="dynamicWhereConditions">
where 1=1
<if test=" null != id ">and `id` = #{id}</if>
@@ -74,15 +74,15 @@
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>
<select id="findList" parameterType="com.iformall.domain.po.WxBillRent" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_bill_rent
<include refid="dynamicWhereConditions"/>
</select>
<select id="queryBillRentList" parameterType="com.iformall.domain.po.WxRentContract" resultType="hashmap">
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`,
@@ -113,11 +113,11 @@
<if test=" null != rentContractId ">and br.`rent_contract_id` = #{rentContractId}</if>
<if test=" null != payWay ">and br.`pay_way` = #{payWay}</if>
<if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if>
</where>
<if test=" null != sortColumns">order by br.${sortColumns}</if>
</select>
<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
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
where status = 1 and tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0
</select>
<update id="updateNotPaidStatus" parameterType="hashmap">
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
</update>

<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
where br.tenant_id=#{tenantId} and br.status!=#{paid} and br.status!=6 and now() &lt; br.receive_date
and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a)
@@ -178,3 +178,4 @@


</mapper>


+ 12
- 1
mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml Datei anzeigen

@@ -71,7 +71,18 @@
from wx_coupon_car car, wx_coupon c
where car.id = c.id
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 id="findTemplateAvailCount" parameterType="Long" resultType="Integer">


Laden…
Abbrechen
Speichern