|
|
|
@@ -4,9 +4,13 @@ import com.iformall.annotation.SystemControllerLog; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.controller.base.BaseController; |
|
|
|
import com.iformall.domain.po.WxMall; |
|
|
|
import com.iformall.domain.po.WxScoreRules; |
|
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
|
import com.iformall.enums.EnumCreditLockedStatus; |
|
|
|
import com.iformall.enums.EnumGroupSupport; |
|
|
|
import com.iformall.enums.EnumScoreRules; |
|
|
|
import com.iformall.service.WxMallService; |
|
|
|
import com.iformall.service.WxScoreRulesService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
@@ -25,6 +29,9 @@ public class WxScoreRulesController extends BaseController { |
|
|
|
@Autowired |
|
|
|
private WxScoreRulesService wxScoreRulesService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxMallService wxMallService; |
|
|
|
|
|
|
|
@ApiOperation("成长值配置") |
|
|
|
@GetMapping("setting") |
|
|
|
@SystemControllerLog(description = "成长值-配置") |
|
|
|
@@ -42,11 +49,27 @@ public class WxScoreRulesController extends BaseController { |
|
|
|
@SystemControllerLog(description = "成长值-积分-配置-新增") |
|
|
|
public ResultData add(@RequestBody WxScoreRules wxScoreRules) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxScoreRulesController::add"); |
|
|
|
TenantEntity tenantEntity = ifParentUpdateTenantInfo(); |
|
|
|
if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { |
|
|
|
return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(), "广场用户无此权限"); |
|
|
|
if(wxScoreRules.getType() != null){ |
|
|
|
if(wxScoreRules.getType().equals(EnumScoreRules.SCORE.getCode()) || wxScoreRules.getType().equals(EnumScoreRules.CREDIT.getCode())){ |
|
|
|
TenantEntity tenantEntity = ifParentUpdateTenantInfo(); |
|
|
|
if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { |
|
|
|
return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(), "广场用户无此权限"); |
|
|
|
} |
|
|
|
wxScoreRules.updateTenantInfo(tenantEntity); |
|
|
|
}else if(wxScoreRules.getType().equals(EnumScoreRules.CREDIT_DOUBLE.getCode())){ |
|
|
|
TenantEntity tenantEntity = getTenantInfo(); |
|
|
|
WxMall mall = wxMallService.getByTenantId(getUser().getTenantId()); |
|
|
|
if((mall.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode()) && StringUtils.isBlank(getUser().getParentTenantId())) || |
|
|
|
StringUtils.isBlank(tenantEntity.getTenantId())){ |
|
|
|
return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(), "集团用户无此权限"); |
|
|
|
} |
|
|
|
wxScoreRules.updateTenantInfo(tenantEntity); |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"type"); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"type"); |
|
|
|
} |
|
|
|
wxScoreRules.updateTenantInfo(tenantEntity); |
|
|
|
wxScoreRulesService.saveOrUpdate(wxScoreRules); |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
@@ -55,11 +78,20 @@ public class WxScoreRulesController extends BaseController { |
|
|
|
@GetMapping("/credit_rules") |
|
|
|
@SystemControllerLog(description = "积分-配置") |
|
|
|
public ResultData creditRulesList() { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxScoreRulesController::list"); |
|
|
|
logger.debug("[" + getIpAddr() + "] creditRulesList::list"); |
|
|
|
WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(getTenantInfo().getFinalTenantId()); |
|
|
|
return new ResultData(scoreRules); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("积分倍率") |
|
|
|
@GetMapping("/credit_double") |
|
|
|
@SystemControllerLog(description = "积分-配置") |
|
|
|
public ResultData creditDoubleRulesList() { |
|
|
|
logger.debug("[" + getIpAddr() + "] creditDoubleRulesList::list"); |
|
|
|
WxScoreRules scoreRules = wxScoreRulesService.getCreditDoubleRules(getTenantInfo().getTenantId()); |
|
|
|
return new ResultData(scoreRules); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("更新积分开关状态") |
|
|
|
@PostMapping("updateCreditLocked") |
|
|
|
@SystemControllerLog(description = "更新积分开关状态") |
|
|
|
|