|
|
|
@ -1,14 +1,19 @@
@@ -1,14 +1,19 @@
|
|
|
|
|
package com.cloud.kicc.commonbiz.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.cloud.kicc.common.core.api.R; |
|
|
|
|
import com.cloud.kicc.common.core.constant.AppConstants; |
|
|
|
|
import com.cloud.kicc.common.security.util.SecurityUtils; |
|
|
|
|
import com.cloud.kicc.commonbiz.api.entity.PushConcernFanType; |
|
|
|
|
import com.cloud.kicc.commonbiz.api.entity.PushType; |
|
|
|
|
import com.cloud.kicc.commonbiz.service.IPushConcernFanService; |
|
|
|
|
import com.cloud.kicc.commonbiz.service.IPushConcernFanTypeService; |
|
|
|
|
import com.cloud.kicc.commonbiz.service.IPushTypeService; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
@ -17,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
@@ -17,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.validation.Valid; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* <p> |
|
|
|
@ -33,7 +39,8 @@ import java.util.Arrays;
@@ -33,7 +39,8 @@ import java.util.Arrays;
|
|
|
|
|
public class PushTypeController { |
|
|
|
|
|
|
|
|
|
private final IPushTypeService iPushTypeService; |
|
|
|
|
|
|
|
|
|
private final IPushConcernFanTypeService iPushConcernFanTypeService; |
|
|
|
|
private final IPushConcernFanService iPushConcernFanService; |
|
|
|
|
private LambdaQueryWrapper<PushType> getQueryWrapper(PushType pushType) { |
|
|
|
|
return new LambdaQueryWrapper<PushType>() |
|
|
|
|
.eq(PushType::getCreateById, pushType.getCreateById()) |
|
|
|
@ -54,10 +61,30 @@ public class PushTypeController {
@@ -54,10 +61,30 @@ public class PushTypeController {
|
|
|
|
|
return R.ok(iPushTypeService.getById(id)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("保存") |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
public R save(@Valid @RequestBody PushType pushType) { |
|
|
|
|
iPushTypeService.save(pushType); |
|
|
|
|
IPage<Map<String, Object>> list = iPushConcernFanService.selectPushConcernFanList(new Page(1, 999), |
|
|
|
|
MapUtil.<String, Object>builder() |
|
|
|
|
.put("status", "1") |
|
|
|
|
.put("concernUserId", SecurityUtils.getUser().getId()) |
|
|
|
|
.build()); |
|
|
|
|
list.getRecords().forEach(item -> |
|
|
|
|
iPushConcernFanTypeService.save(new PushConcernFanType() |
|
|
|
|
.setConcernFanId(item.get("id").toString()) |
|
|
|
|
.setName(pushType.getName()) |
|
|
|
|
.setConcernUserId(item.get("concernUserId").toString()) |
|
|
|
|
.setFanUserId(item.get("fanUserId").toString()) |
|
|
|
|
.setTypeId(pushType.getId()) |
|
|
|
|
.setPlaySound(pushType.getPlaySound()) |
|
|
|
|
.setPlayVibrate(pushType.getPlayVibrate()) |
|
|
|
|
.setPlayLights(pushType.getPlayLights()) |
|
|
|
|
.setPlayToText(pushType.getPlayToText()) |
|
|
|
|
.setOnlineRingtone(pushType.getOnlineRingtone()) |
|
|
|
|
.setOfflineRingtone(pushType.getOfflineRingtone())) |
|
|
|
|
); |
|
|
|
|
return R.ok(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -72,9 +99,9 @@ public class PushTypeController {
@@ -72,9 +99,9 @@ public class PushTypeController {
|
|
|
|
|
@DeleteMapping("/remove/{ids:[\\w,]+}") |
|
|
|
|
public R<Boolean> removeById(@PathVariable String[] ids) { |
|
|
|
|
iPushTypeService.removeByIds(Arrays.asList(ids)); |
|
|
|
|
iPushConcernFanTypeService.remove(Wrappers.<PushConcernFanType>lambdaQuery().in(PushConcernFanType::getTypeId, ids)); |
|
|
|
|
return R.ok(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|