From dc9a4bd68978a1033360507c3a30ecd42d30bc3f Mon Sep 17 00:00:00 2001 From: YXY <932687738@qq.com> Date: Thu, 24 Aug 2023 22:42:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=B8=8A=E4=BC=A0=E9=99=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flyingbook/LarkHelper/LarkUserHelper.java | 25 +++- .../controller/LarkActiveController.java | 28 +++-- .../domain/lark/LarkUserRequest.java | 3 + .../domain/larkactive/LarkActiveImportVo.java | 22 ++++ .../mapper/LarkUserActiveRelatoinMapper.java | 2 + .../ILarkUserActiveRelatoinService.java | 3 +- .../LarkUserActiveCommentServiceImpl.java | 3 + .../LarkUserActiveRelatoinServiceImpl.java | 119 ++++++++++++------ .../mapper/LarkUserActiveRelatoinMapper.xml | 17 +++ 9 files changed, 173 insertions(+), 49 deletions(-) create mode 100644 ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/domain/larkactive/LarkActiveImportVo.java diff --git a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/LarkHelper/LarkUserHelper.java b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/LarkHelper/LarkUserHelper.java index 0a05fdf..641dfa1 100644 --- a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/LarkHelper/LarkUserHelper.java +++ b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/LarkHelper/LarkUserHelper.java @@ -7,6 +7,7 @@ import com.lark.oapi.service.authen.v1.model.CreateAccessTokenReq; import com.lark.oapi.service.authen.v1.model.CreateAccessTokenReqBody; import com.lark.oapi.service.authen.v1.model.CreateAccessTokenRespBody; import com.lark.oapi.service.contact.v3.enums.BatchGetIdUserUserIdTypeEnum; +import com.lark.oapi.service.contact.v3.enums.GetUserUserIdTypeEnum; import com.lark.oapi.service.contact.v3.model.*; import com.ruoyi.flyingbook.domain.lark.LarkApprovalRequest; import com.ruoyi.flyingbook.domain.lark.LarkException; @@ -31,11 +32,13 @@ public class LarkUserHelper extends LarkHelper{ public static void main(String[] args) throws Exception { LarkUserHelper bk = new LarkUserHelper(); - GetUserRespBody userRespBody = bk.getUserInfoDetail(new LarkUserRequest(appId, secret, openId)); +// GetUserRespBody userRespBody = bk.getUserInfoDetail(new LarkUserRequest(appId, secret, openId)); // userRespBody.getUser().getName(); - System.out.println(userRespBody); - LarkSessionResponse larkSessionResponse = bk.tokenLoginValidate(new LarkUserRequest(appId, secret, openId, code)); - System.out.println(larkSessionResponse); +// System.out.println(userRespBody); +// LarkSessionResponse larkSessionResponse = bk.tokenLoginValidate(new LarkUserRequest(appId, secret, openId, code)); +// System.out.println(larkSessionResponse); + GetUserRespBody userRespBody = bk.getUserInfo(new LarkUserRequest("cli_a4504c9fe9f95013", "oWiLzl2Tkt68tvZHjQIfOb27rPQkTUhu", "85623f9d")); + System.out.println(JSONObject.toJSONString(userRespBody)); } @@ -56,6 +59,20 @@ public class LarkUserHelper extends LarkHelper{ } } + public GetUserRespBody getUserInfo(LarkUserRequest request) { + GetUserResp getUserResp = null; + try { + getUserResp = buildClient(request).contact().user().get(GetUserReq.newBuilder().userId(request.getOpenId()).userIdType(GetUserUserIdTypeEnum.USER_ID).build()); + } catch (Exception e) { + throw new RuntimeException(new LarkException("LarkUserHelper.getUserInfoDetail",e.getMessage(),request).getErrorMessageBody()); + } + if (getUserResp != null && getUserResp.getCode() == 0){ + return getUserResp.getData(); + }else { + throw new RuntimeException(new LarkException("LarkUserHelper.getUserInfoDetail",getUserResp.getMsg(),request).getErrorMessageBody()); + } + } + /** * 获取userToken */ diff --git a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/controller/LarkActiveController.java b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/controller/LarkActiveController.java index 3cef7ce..fc98dec 100644 --- a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/controller/LarkActiveController.java +++ b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/controller/LarkActiveController.java @@ -20,14 +20,16 @@ import com.ruoyi.flyingbook.domain.lark.LarkUserRequest; import com.ruoyi.flyingbook.domain.larkactive.*; import com.ruoyi.flyingbook.service.*; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.io.IOException; +import java.util.*; +import java.util.stream.Collectors; @Slf4j @RestController @@ -113,7 +115,7 @@ public class LarkActiveController extends BaseController { * 查询评论 */ @PostMapping("/queryComment") - public ResponseVo>> queryComment(@RequestBody LarkActiveUserRelationRequest request) { + public ResponseVo>> queryComment(@RequestBody LarkActiveUserRelationRequest request) { return larkUserActiveCommentService.queryComment(request); } @@ -141,7 +143,7 @@ public class LarkActiveController extends BaseController { @PostMapping("/inviteUser") public ResponseVo inviteUser(@RequestBody LarkUserActiveInviteRelatoin request) { ResponseVo responseVo = new ResponseVo(); - if (request.getUserName().equals(request.getInviteUserName())){ + if (request.getUserName().equals(request.getInviteUserName())) { return responseVo; } larkUserActiveInviteRelatoinService.create(request); @@ -180,7 +182,6 @@ public class LarkActiveController extends BaseController { .head(LarkActiveCountVo.class) .registerWriteHandler(new CustomMergeStrategy(LarkActiveCountVo.class)) .excelType(ExcelTypeEnum.XLSX) - .password("123456") .autoCloseStream(Boolean.TRUE) .sheet("sheetName") .doWrite(Arrays.asList(larkActiveCountVo)); @@ -189,5 +190,18 @@ public class LarkActiveController extends BaseController { } } + @PostMapping("/import") + public void importActive(@RequestPart("file") MultipartFile file) { + try { + List list = EasyExcel.read(file.getInputStream()) + .head(LarkActiveImportVo.class) + .sheet() + .doReadSync(); + larkUserActiveRelatoinService.submit(list,APP_ID,APP_SECRET); + } catch (IOException e) { + e.printStackTrace(); + } + } + } diff --git a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/domain/lark/LarkUserRequest.java b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/domain/lark/LarkUserRequest.java index 4273572..cc58080 100644 --- a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/domain/lark/LarkUserRequest.java +++ b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/domain/lark/LarkUserRequest.java @@ -17,6 +17,9 @@ public class LarkUserRequest extends LarkRequest{ private String openId; //登录预授权码 private String code; + public LarkUserRequest(String appId, String appSecret) { + super(appId, appSecret); + } public LarkUserRequest(String appId, String appSecret, String openId) { super(appId, appSecret); diff --git a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/domain/larkactive/LarkActiveImportVo.java b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/domain/larkactive/LarkActiveImportVo.java new file mode 100644 index 0000000..841bbf6 --- /dev/null +++ b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/domain/larkactive/LarkActiveImportVo.java @@ -0,0 +1,22 @@ +package com.ruoyi.flyingbook.domain.larkactive; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.ruoyi.common.utils.excelStrategy.CustomMerge; +import lombok.Data; + + +/** + * 【请填写功能名称】对象 lark_active + * + * @author ruoyi + * @date 2023-08-16 + */ +@Data +public class LarkActiveImportVo { + + @ExcelProperty("填写者ID") + private String userId; + + +} diff --git a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/mapper/LarkUserActiveRelatoinMapper.java b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/mapper/LarkUserActiveRelatoinMapper.java index 45033ce..57cb83f 100644 --- a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/mapper/LarkUserActiveRelatoinMapper.java +++ b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/mapper/LarkUserActiveRelatoinMapper.java @@ -37,6 +37,8 @@ public interface LarkUserActiveRelatoinMapper { public int queryUserCount(LarkUserActiveRelatoin larkUserActiveRelatoin); public List queryUserCountGroupByActive(LarkUserActiveRelatoin larkUserActiveRelatoin); public List queryByIdList(@Param("idList") List idList); + public List queryByOpenIdList(@Param("openIdList") List openIdList,@Param("activeId") Long activeId); + public List updateByIdList(@Param("idList") List idList,@Param("activeStage") String activeStage); /** * 新增【请填写功能名称】 diff --git a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/service/ILarkUserActiveRelatoinService.java b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/service/ILarkUserActiveRelatoinService.java index ad524ed..ab558ad 100644 --- a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/service/ILarkUserActiveRelatoinService.java +++ b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/service/ILarkUserActiveRelatoinService.java @@ -3,6 +3,7 @@ package com.ruoyi.flyingbook.service; import com.ruoyi.flyingbook.domain.LarkUserActiveRelatoin; import com.ruoyi.flyingbook.domain.edi.ResponseVo; import com.ruoyi.flyingbook.domain.larkactive.LarkActiveCountVo; +import com.ruoyi.flyingbook.domain.larkactive.LarkActiveImportVo; import com.ruoyi.flyingbook.domain.larkactive.LarkActiveUserRelationRequest; import java.util.List; @@ -34,7 +35,7 @@ public interface ILarkUserActiveRelatoinService { public ResponseVo queryPage(LarkActiveUserRelationRequest request); public ResponseVo commitFile(LarkActiveUserRelationRequest request); - public ResponseVo submit(LarkActiveUserRelationRequest request); + public void submit(List list,String appId,String appSecret); /** * 新增【请填写功能名称】 diff --git a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/service/impl/LarkUserActiveCommentServiceImpl.java b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/service/impl/LarkUserActiveCommentServiceImpl.java index 98f99f7..35bdea2 100644 --- a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/service/impl/LarkUserActiveCommentServiceImpl.java +++ b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/service/impl/LarkUserActiveCommentServiceImpl.java @@ -117,6 +117,9 @@ public class LarkUserActiveCommentServiceImpl implements ILarkUserActiveCommentS @Override public ResponseVo comment(LarkActiveUserRelationRequest request) { + if (StringUtils.isBlank(request.getComment())){ + return new ResponseVo<>(); + } List larkActives = larkActiveMapper.selectLarkActiveByName(request.getLarkActiveName(), FlagStatus.OK.getCode()); if (CollectionUtils.isEmpty(larkActives)) { return new ResponseVo(); diff --git a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/service/impl/LarkUserActiveRelatoinServiceImpl.java b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/service/impl/LarkUserActiveRelatoinServiceImpl.java index 32c0c91..070aa26 100644 --- a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/service/impl/LarkUserActiveRelatoinServiceImpl.java +++ b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/service/impl/LarkUserActiveRelatoinServiceImpl.java @@ -1,18 +1,22 @@ package com.ruoyi.flyingbook.service.impl; import cn.hutool.core.util.IdUtil; +import com.lark.oapi.service.contact.v3.model.GetUserRespBody; import com.ruoyi.common.enums.FlagStatus; import com.ruoyi.common.enums.LarkActiveEnum; import com.ruoyi.common.enums.LarkActiveStageEnum; import com.ruoyi.common.enums.LarkUserTypeEnum; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.flyingbook.CosHelper.CosHelper; +import com.ruoyi.flyingbook.LarkHelper.LarkUserHelper; import com.ruoyi.flyingbook.domain.LarkActive; import com.ruoyi.flyingbook.domain.LarkLoginLog; import com.ruoyi.flyingbook.domain.LarkUserActiveImage; import com.ruoyi.flyingbook.domain.LarkUserActiveRelatoin; import com.ruoyi.flyingbook.domain.edi.ResponseVo; +import com.ruoyi.flyingbook.domain.lark.LarkUserRequest; import com.ruoyi.flyingbook.domain.larkactive.LarkActiveCountVo; +import com.ruoyi.flyingbook.domain.larkactive.LarkActiveImportVo; import com.ruoyi.flyingbook.domain.larkactive.LarkActiveUserRelationRequest; import com.ruoyi.flyingbook.domain.larkactive.LarkActiveVo; import com.ruoyi.flyingbook.mapper.LarkActiveMapper; @@ -21,6 +25,7 @@ import com.ruoyi.flyingbook.mapper.LarkUserActiveImageMapper; import com.ruoyi.flyingbook.mapper.LarkUserActiveRelatoinMapper; import com.ruoyi.flyingbook.service.ILarkUserActiveInviteRelatoinService; import com.ruoyi.flyingbook.service.ILarkUserActiveRelatoinService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.binary.Base64; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -32,10 +37,8 @@ import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -44,6 +47,7 @@ import java.util.stream.Collectors; * @author ruoyi * @date 2023-08-16 */ +@Slf4j @Service public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoinService { @Autowired @@ -58,7 +62,8 @@ public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoi private LarkLoginLogMapper larkLoginLogMapper; @Autowired private ILarkUserActiveInviteRelatoinService larkUserActiveInviteRelatoinService; - + @Autowired + private LarkUserHelper larkUserHelper; private static final String BUCKET_NAME = "ruoyi-1308275795"; @@ -98,16 +103,16 @@ public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoi Map activeCountMap = larkUserActiveRelatoinMapper.queryUserCountGroupByActive(larkUserActiveRelatoin).stream().collect(Collectors.toMap(LarkActiveVo::getId, LarkActiveVo::getQty, (k1, k2) -> k1)); for (LarkActive active : larkActives) { Integer qty = activeCountMap.getOrDefault(active.getId(), 0); - fillCount(larkActiveCountVo,qty,active.getActiveDesc()); + fillCount(larkActiveCountVo, qty, active.getActiveDesc()); } } return larkActiveCountVo; } - private void fillCount(LarkActiveCountVo larkActiveCountVo,Integer qty,String activeCode){ + private void fillCount(LarkActiveCountVo larkActiveCountVo, Integer qty, String activeCode) { qty = qty == null ? 0 : qty; LarkActiveEnum activeEnum = LarkActiveEnum.getByCode(activeCode); - switch (activeEnum){ + switch (activeEnum) { case MOOC: larkActiveCountVo.setMoccQty(qty); break; @@ -156,26 +161,26 @@ public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoi return new ResponseVo(request.getCurrentPage(), request.getPageSize(), null, count); } - private File base642File(String base64){ + private File base642File(String base64) { File file = null; - if(base64.contains("data:image")){ - base64 = base64.substring(base64.indexOf(",")+1); + if (base64.contains("data:image")) { + base64 = base64.substring(base64.indexOf(",") + 1); } BufferedOutputStream bos = null; FileOutputStream fos = null; try { base64 = base64.toString().replace("\r\n", ""); //创建文件目录 - String prefix=".jpg"; + String prefix = ".jpg"; file = File.createTempFile(IdUtil.randomUUID(), prefix); byte[] bytes = Base64.decodeBase64(base64); fos = new FileOutputStream(file); bos = new BufferedOutputStream(fos); bos.write(bytes); - }catch (Exception e){ + } catch (Exception e) { - }finally { + } finally { if (bos != null) { try { bos.close(); @@ -198,15 +203,15 @@ public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoi public ResponseVo commitFile(LarkActiveUserRelationRequest request) { ResponseVo responseVo = new ResponseVo(); List larkActives = larkActiveMapper.selectLarkActiveByName(request.getLarkActiveName(), FlagStatus.OK.getCode()); - if (CollectionUtils.isEmpty(larkActives)){ + if (CollectionUtils.isEmpty(larkActives)) { return responseVo; } LarkActive active = larkActives.get(0); - LarkUserActiveRelatoin relatoin = queryUserActiveRelation(request.getCompanyName(),request.getUserName(), active.getId()); + LarkUserActiveRelatoin relatoin = queryUserActiveRelation(request.getCompanyName(), request.getUserName(), active.getId()); if (relatoin == null) { return responseVo; } - Integer totalCount = userActiveCount(relatoin,request.getImageBase64()) + 1; + Integer totalCount = userActiveCount(relatoin, request.getImageBase64()) + 1; LarkActive larkActive = larkActiveMapper.selectLarkActiveById(relatoin.getActiveId()); String url = null; if (StringUtils.isNotBlank(request.getImageBase64())) { @@ -217,11 +222,11 @@ public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoi split[0] = key; key = String.join(".", split); cosHelper.upload(BUCKET_NAME, key, file); - buildUserActiveImage(relatoin, key,null); + buildUserActiveImage(relatoin, key, null); url = cosHelper.previewUrl(BUCKET_NAME, key); responseVo.setData(url); - }else { - buildUserActiveImage(relatoin,null, request.getRemark()); + } else { + buildUserActiveImage(relatoin, null, request.getRemark()); } if (totalCount >= larkActive.getActiveImageCount()) { relatoin.setActiveStage(LarkActiveStageEnum.ADJUST.getCode()); @@ -232,22 +237,62 @@ public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoi } @Override - public ResponseVo submit(LarkActiveUserRelationRequest request) { - List larkActives = larkActiveMapper.selectLarkActiveByName(request.getLarkActiveName(), FlagStatus.OK.getCode()); - if (CollectionUtils.isEmpty(larkActives)){ - return new ResponseVo(); + public void submit(List list, String appId, String appSecret) { + LarkUserRequest larkUserRequest = new LarkUserRequest(appId, appSecret); + Set openIdSet = new HashSet<>(); + for (LarkActiveImportVo larkActiveImportVo : list) { + if (StringUtils.isNotBlank(larkActiveImportVo.getUserId())) { + try { + larkUserRequest.setOpenId(larkActiveImportVo.getUserId()); + GetUserRespBody userInfoDetail = larkUserHelper.getUserInfo(larkUserRequest); + openIdSet.add(userInfoDetail.getUser().getOpenId()); + } catch (Exception e) { + log.info("import file error userId:{}", larkActiveImportVo.getUserId(), e); + } + } } - LarkActive active = larkActives.get(0); - LarkUserActiveRelatoin relatoin = queryUserActiveRelation(request.getCompanyName(),request.getUserName(), active.getId()); - if (relatoin == null) { - return new ResponseVo(); + if (CollectionUtils.isEmpty(openIdSet)) { + return; + } + List larkLoginLogs = larkLoginLogMapper.queryByOpenId(new ArrayList<>(openIdSet)); + List openIdList = larkLoginLogs.stream() + .filter(r -> { + return StringUtils.isNotBlank(r.getOpenId()); + }) + .map(LarkLoginLog::getOpenId) + .collect(Collectors.toList()); + if (CollectionUtils.isEmpty(openIdList)) { + return; + } + //todo yxy 任务id + Long activeId = null; + Map relationMap = larkUserActiveRelatoinMapper.queryByOpenIdList(openIdList,activeId).stream() + .collect(Collectors.toMap(LarkUserActiveRelatoin::getUserName, Function.identity(),(k1,k2)->k1)); + List waitUpdateList = new ArrayList<>(); + for (LarkLoginLog larkLoginLog : larkLoginLogs) { + LarkUserActiveRelatoin activeRelatoin = relationMap.get(larkLoginLog.getOpenId()); + if (activeRelatoin == null){ + LarkUserActiveRelatoin relatoin = new LarkUserActiveRelatoin(); + relatoin.setCreateTime(new Date()); + relatoin.setCreateBy("system"); + relatoin.setActiveStage(LarkActiveStageEnum.ADJUST.getCode()); + relatoin.setFlag(FlagStatus.OK.getCode()); + relatoin.setActiveId(activeId); + relatoin.setUserName(larkLoginLog.getOpenId()); + relatoin.setCompanyName(larkLoginLog.getCompanyName()); + larkUserActiveRelatoinMapper.insertLarkUserActiveRelatoin(relatoin); + }else { + if (!LarkActiveStageEnum.ADJUST.getCode().equals(activeRelatoin.getActiveStage())){ + waitUpdateList.add(activeRelatoin.getActiveId()); + } + } + } + if (CollectionUtils.isNotEmpty(waitUpdateList)){ + larkUserActiveRelatoinMapper.updateByIdList(waitUpdateList,LarkActiveStageEnum.ADJUST.getCode()); } - relatoin.setActiveStage(LarkActiveStageEnum.ADJUST.getCode()); - larkUserActiveRelatoinMapper.updateLarkUserActiveRelatoin(relatoin); - return new ResponseVo(); } - private void buildUserActiveImage(LarkUserActiveRelatoin relatoin, String key,String remark) { + private void buildUserActiveImage(LarkUserActiveRelatoin relatoin, String key, String remark) { LarkUserActiveImage larkUserActiveImage = new LarkUserActiveImage(); larkUserActiveImage.setCreateTime(new Date()); larkUserActiveImage.setCreateBy("System"); @@ -256,20 +301,20 @@ public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoi if (StringUtils.isNotBlank(key)) { larkUserActiveImage.setBucketName(BUCKET_NAME); larkUserActiveImage.setFileKey(key); - }else { + } else { larkUserActiveImage.setRemark(remark); } larkUserActiveImageMapper.insertLarkUserActiveImage(larkUserActiveImage); } - private Integer userActiveCount(LarkUserActiveRelatoin relatoin,String image) { + private Integer userActiveCount(LarkUserActiveRelatoin relatoin, String image) { LarkUserActiveImage larkUserActiveImage = new LarkUserActiveImage(); larkUserActiveImage.setUserActiveRelatoin(relatoin.getId()); larkUserActiveImage.setFlag(FlagStatus.OK.getCode()); List larkUserActiveImages = larkUserActiveImageMapper.selectLarkUserActiveImageList(larkUserActiveImage); if (StringUtils.isNotBlank(image)) { return larkUserActiveImages.size(); - }else { + } else { List collect = larkUserActiveImages.stream() .filter(r -> { return StringUtils.isNotBlank(r.getRemark()); @@ -280,7 +325,7 @@ public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoi } } - private LarkUserActiveRelatoin queryUserActiveRelation(String companyName,String userName, Long activeId) { + private LarkUserActiveRelatoin queryUserActiveRelation(String companyName, String userName, Long activeId) { LarkUserActiveRelatoin relatoin = new LarkUserActiveRelatoin(); relatoin.setUserName(userName); relatoin.setActiveId(activeId); @@ -288,7 +333,7 @@ public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoi List larkUserActiveRelatoins = larkUserActiveRelatoinMapper.selectLarkUserActiveRelatoinList(relatoin); if (CollectionUtils.isNotEmpty(larkUserActiveRelatoins)) { return larkUserActiveRelatoins.get(0); - }else { + } else { relatoin.setCreateBy("System"); relatoin.setCreateTime(new Date()); relatoin.setActiveStage(LarkActiveStageEnum.SUBMIT.getCode()); diff --git a/ruoyi-flyingbook/src/main/resources/mapper/LarkUserActiveRelatoinMapper.xml b/ruoyi-flyingbook/src/main/resources/mapper/LarkUserActiveRelatoinMapper.xml index c7c3288..d632258 100644 --- a/ruoyi-flyingbook/src/main/resources/mapper/LarkUserActiveRelatoinMapper.xml +++ b/ruoyi-flyingbook/src/main/resources/mapper/LarkUserActiveRelatoinMapper.xml @@ -59,6 +59,23 @@ + + + + update lark_user_active_relatoin set activeStage = #{activeStage} + where id in + + #{item} + + +