批量和全量添加备注

master
382696293@qq.com 2 years ago
parent 734f21eee6
commit c81e29d697

@ -2,11 +2,14 @@ package com.flossom.system.controller;
import java.util.List;
import java.io.IOException;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.domain.entity.WxUserMember;
import com.flossom.common.core.domain.entity.WxUserRemark;
import com.flossom.common.core.domain.req.WxUserIntegralVm;
import com.flossom.common.core.domain.req.WxUserMemberVm;
import com.flossom.common.core.domain.req.WxUserRemarkReq;
import com.flossom.common.core.enums.IntegralChangeTypeEnum;
import com.flossom.common.core.exception.ServiceException;
@ -17,6 +20,7 @@ import com.flossom.common.core.web.page.TableDataInfo;
import com.flossom.common.log.annotation.Log;
import com.flossom.common.log.enums.BusinessType;
import com.flossom.common.security.annotation.RequiresPermissions;
import com.flossom.system.service.IWxUserMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -34,6 +38,9 @@ public class WxUserRemarkController extends BaseController {
@Autowired
private IWxUserRemarkService wxUserRemarkService;
@Autowired
private IWxUserMemberService wxUserMemberService;
/**
*
*/
@ -101,7 +108,25 @@ public class WxUserRemarkController extends BaseController {
*/
@PostMapping("/batchAddRemark")
public R batchAddRemark(@RequestBody @Validated WxUserRemarkReq wxUserRemarkReq) {
if(wxUserRemarkReq.getUserIdList() == null || wxUserRemarkReq.getUserIdList().size() == 0) {
return R.fail("请选择用户");
}
wxUserRemarkService.batchAddRemark(wxUserRemarkReq);
return R.ok();
}
/**
*
*/
@PostMapping("/allAddRemark")
public R allAddRemark(@RequestBody @Validated WxUserRemarkReq wxUserRemarkReq, WxUserMemberVm wxUserMemberVm) {
wxUserRemarkService.batchAddRemark(wxUserRemarkReq);
List<WxUserMember> list = wxUserMemberService.selectWxUserMemberList(wxUserMemberVm);
if (list != null && list.size() > 0) {
List<Long> collect = list.stream().map(wxUserMember -> wxUserMember.getId()).collect(Collectors.toList());
wxUserRemarkReq.setUserIdList(collect);
wxUserRemarkService.batchAddRemark(wxUserRemarkReq);
}
return R.ok();
}
}

@ -99,14 +99,6 @@ public class WxUserRemarkServiceImpl implements IWxUserRemarkService {
@Override
public void batchAddRemark(WxUserRemarkReq wxUserRemarkReq) {
if (wxUserRemarkReq.getUserIdList() == null || wxUserRemarkReq.getUserIdList().size() == 0) {
List<Integer> userIdList = wxUserMemberMapper.selectWxUserMemberIdList();
if (userIdList != null && userIdList.size() > 0) {
List<Long> collect = userIdList.stream().map(Integer::longValue).collect(Collectors.toList());
wxUserRemarkReq.setUserIdList(collect);
}
}
if (wxUserRemarkReq.getUserIdList() != null && wxUserRemarkReq.getUserIdList().size() > 0) {
WxUserRemark wxUserRemark = new WxUserRemark();
for (Long userId : wxUserRemarkReq.getUserIdList()) {

Loading…
Cancel
Save