|
|
@@ -10,10 +10,12 @@ import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
+import com.cyksj.mapper.corp.CorpMsgBulkTaskCategoryMapper;
|
|
|
import com.cyksj.mapper.corp.CorpTagMapper;
|
|
|
import com.cyksj.mapper.manage.coupon.CouponMapper;
|
|
|
import com.cyksj.model.dto.CornMetaDto;
|
|
|
import com.cyksj.model.entity.CorpMsgBulkTask;
|
|
|
+import com.cyksj.model.entity.CorpMsgBulkTaskCategory;
|
|
|
import com.cyksj.model.entity.CorpTag;
|
|
|
import com.cyksj.model.excel.ExcelCorpMsgBulkTaskSendRecordData;
|
|
|
import com.cyksj.model.request.CorpActiveBulkMsg;
|
|
|
@@ -29,6 +31,7 @@ import com.ejlchina.searcher.util.MapBuilder;
|
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@@ -59,6 +62,8 @@ public class CorpMsgBulkTaskController {
|
|
|
|
|
|
private final CorpTagMapper corpTagMapper;
|
|
|
|
|
|
+ private final CorpMsgBulkTaskCategoryMapper corpMsgBulkTaskCategoryMapper;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 新建群发
|
|
|
@@ -244,4 +249,51 @@ public class CorpMsgBulkTaskController {
|
|
|
corpMsgBulkTaskService.sendActiveCorpBulkMsg(msg);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增分类
|
|
|
+ */
|
|
|
+ @PostMapping("/category/post")
|
|
|
+ public Result<String> postCategory(@RequestBody @Validated CorpMsgBulkTaskCategory corpMsgBulkTaskCategory) {
|
|
|
+ try {
|
|
|
+ corpMsgBulkTaskCategoryMapper.insert(corpMsgBulkTaskCategory);
|
|
|
+ } catch (DuplicateKeyException e) {
|
|
|
+ }
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑分类
|
|
|
+ */
|
|
|
+ @PostMapping("/category/update")
|
|
|
+ public Result<String> upCategory(@RequestBody @Validated CorpMsgBulkTaskCategory corpMsgBulkTaskCategory) {
|
|
|
+ try {
|
|
|
+ corpMsgBulkTaskCategoryMapper.updateById(corpMsgBulkTaskCategory);
|
|
|
+ } catch (DuplicateKeyException e) {
|
|
|
+ }
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除分类
|
|
|
+ */
|
|
|
+ @PostMapping("/category/delete/{id}")
|
|
|
+ public Result<String> delCategory(@PathVariable Long id) {
|
|
|
+ int count = corpMsgBulkTaskService.count(Wrappers.lambdaQuery(CorpMsgBulkTask.class).eq(CorpMsgBulkTask::getCategory, id));
|
|
|
+ if (count > 0) {
|
|
|
+ throw BusinessRuntimeException.getInstance("存在该分类下的群发任务");
|
|
|
+ }
|
|
|
+ corpMsgBulkTaskCategoryMapper.deleteById(id);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分类列表
|
|
|
+ */
|
|
|
+ @PostMapping("/category/get")
|
|
|
+ public Result<SearchResult<CorpMsgBulkTaskCategory>> getCategory() {
|
|
|
+ SearchResult<CorpMsgBulkTaskCategory> search = beanSearcher.search(CorpMsgBulkTaskCategory.class, MapUtils.flatBuilder(request.getParameterMap()).build());
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
+ }
|
|
|
}
|