From cdd6551b190b981b807a3b95e9635c559ccc769d Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期一, 19 五月 2025 09:45:07 +0800 Subject: [PATCH] git ch --- server/service/src/main/java/com/doumee/service/business/impl/CompanySolutionServiceImpl.java | 129 ++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 126 insertions(+), 3 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/CompanySolutionServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/CompanySolutionServiceImpl.java index 5ca7afe..3aee62d 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/CompanySolutionServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/CompanySolutionServiceImpl.java @@ -1,31 +1,61 @@ package com.doumee.service.business.impl; +import com.doumee.biz.system.SystemDictDataBiz; +import com.doumee.core.constants.ResponseStatus; +import com.doumee.core.exception.BusinessException; +import com.doumee.core.model.LoginUserInfo; import com.doumee.core.model.PageData; import com.doumee.core.model.PageWrap; +import com.doumee.core.utils.Constants; import com.doumee.core.utils.Utils; +import com.doumee.dao.business.CompanyMapper; import com.doumee.dao.business.CompanySolutionMapper; -import com.doumee.dao.business.model.CompanySolution; +import com.doumee.dao.business.MultifileMapper; +import com.doumee.dao.business.SolutionsMapper; +import com.doumee.dao.business.join.CompanySolutionJoinMapper; +import com.doumee.dao.business.model.*; +import com.doumee.dao.system.model.SystemUser; import com.doumee.service.business.CompanySolutionService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.doumee.service.business.third.SignService; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.checkerframework.checker.units.qual.A; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import oshi.driver.linux.Sysfs; +import java.util.Date; import java.util.List; +import java.util.Objects; /** * 浼佷笟鍙敤淇濋櫓鏂规鍏宠仈琛⊿ervice瀹炵幇 * @author 姹熻箘韫� - * @date 2024/01/15 15:07 + * @date 2024/01/16 10:03 */ @Service public class CompanySolutionServiceImpl implements CompanySolutionService { @Autowired + private CompanySolutionJoinMapper companySolutionJoinMapper; + @Autowired private CompanySolutionMapper companySolutionMapper; + @Autowired + private CompanyMapper companyMapper; + @Autowired + private MultifileMapper multifileMapper; + @Autowired + private SolutionsMapper solutionsMapper; + @Autowired + private SystemDictDataBiz systemDictDataBiz; + @Autowired + private SignService signService; @Override public Integer create(CompanySolution companySolution) { @@ -77,7 +107,37 @@ QueryWrapper<CompanySolution> wrapper = new QueryWrapper<>(companySolution); return companySolutionMapper.selectOne(wrapper); } - + @Override + public List<CompanySolution> findListForCompany(CompanySolution companySolution) { + MPJLambdaWrapper<CompanySolution> csWrapper = new MPJLambdaWrapper<>(); + csWrapper.selectAll(CompanySolution.class); + csWrapper.selectAs(Solutions::getType,CompanySolution::getSolutionType); + csWrapper.selectAs(Solutions::getName,CompanySolution::getSolutionName); + csWrapper.selectAs(Company::getName,CompanySolution::getCompanyName); + csWrapper.selectAs(SystemUser::getRealname,CompanySolution::getSignUserName); + csWrapper.select(" t4.name as shopName "); + csWrapper.leftJoin(Solutions.class,Solutions::getId,CompanySolution::getSolutionBaseId); + csWrapper.leftJoin(Company.class, Company::getId,CompanySolution::getCompanyId); + csWrapper.leftJoin(SystemUser.class, SystemUser::getId,CompanySolution::getSignUserId); + csWrapper.leftJoin(" company t4 on t4.id = t.shop_id "); + csWrapper.eq(Objects.nonNull(companySolution.getCompanyId()),CompanySolution::getCompanyId,companySolution.getCompanyId()); + csWrapper.eq(Objects.nonNull(companySolution.getSolutionId()),CompanySolution::getSolutionBaseId,companySolution.getSolutionId()); + csWrapper.eq(CompanySolution::getIsdeleted, Constants.ZERO); + csWrapper.eq(Solutions::getIsdeleted, Constants.ZERO); + csWrapper.orderByAsc(CompanySolution::getCreateDate); + csWrapper.orderByAsc(CompanySolution::getSortnum); + List<CompanySolution> companySolutionList = companySolutionJoinMapper.selectJoinList(CompanySolution.class,csWrapper); + if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(companySolutionList)){ + String url = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+ + systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode(); + for (CompanySolution c:companySolutionList) { + if(StringUtils.isNotBlank(c.getFileSignUrl())){ + c.setFileSignUrl(url + c.getFileSignUrl()); + } + } + } + return companySolutionList; + } @Override public List<CompanySolution> findList(CompanySolution companySolution) { QueryWrapper<CompanySolution> wrapper = new QueryWrapper<>(companySolution); @@ -145,4 +205,67 @@ QueryWrapper<CompanySolution> wrapper = new QueryWrapper<>(companySolution); return companySolutionMapper.selectCount(wrapper); } + + + + @Override + public String getCompanySolutionSignLink(Integer id) { + if(id == null ){ + throw new BusinessException(ResponseStatus.BAD_REQUEST); + } + LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); + MPJLambdaWrapper<CompanySolution> queryWrapper = new MPJLambdaWrapper<>(); + queryWrapper.selectAll(CompanySolution.class); + queryWrapper.selectAs(Company::getName,CompanySolution::getShopName); + queryWrapper.leftJoin(Company.class,Company::getId,CompanySolution::getCompanyId); + queryWrapper.eq(CompanySolution::getId,id); + queryWrapper.last(" limit 1"); + CompanySolution companySolution = companySolutionJoinMapper.selectJoinOne(CompanySolution.class,queryWrapper); + if(companySolution == null ||!Constants.equalsInteger(companySolution.getIsdeleted(),Constants.ZERO) ){ + throw new BusinessException(ResponseStatus.DATA_EMPTY); + } + Company company = companyMapper.selectById(companySolution.getCompanyId()); + if(Objects.isNull(company)){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌浼佷笟淇℃伅!"); + } + Solutions solutions = solutionsMapper.selectById(companySolution.getSolutionId()); + if(Objects.isNull(solutions)){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌鍏宠仈鏂规淇℃伅!"); + } + //濡傛灉鏄┏鍥�,鍙兘鍙┏鍥炲凡绛剧珷鐘舵�佷笅鐨勯��鍥炵敵璇风姸鎬佽繘琛屾搷浣� + if(!Constants.equalsInteger(companySolution.getStatus(),Constants.ZERO)){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ヤ紒涓氱殑鏂规纭涔︾姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵"); + } + Multifile f = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda() + .eq(Multifile::getObjId,companySolution.getSolutionId()) + .eq(Multifile::getObjType,Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey()) + .eq(Multifile::getIsdeleted,Constants.ZERO).last("limit 1")); + if(f == null || StringUtils.isBlank(f.getFileurl())){ + throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇寰呯绔犳枃浠跺け璐ワ紝璇疯仈绯荤‘璁ょ缃叉枃浠舵槸鍚︽纭紒"); + } + String url = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+ + systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode()+f.getFileurl(); + String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode(); + String applyNo = signService.applySign(solutions.getName(),url,company.getName(),company.getCode(),company.getEmail(),null,company.getSignId(),notifyUrl); + if(StringUtils.isBlank(applyNo) ){ + throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�"); + } + String link = signService.signLink(applyNo,company.getName(),company.getCode()); + if(StringUtils.isBlank(link) ){ + throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�"); + } + CompanySolution update= new CompanySolution(); + update.setId(companySolution.getId()); + update.setEditor(user.getId()); + update.setEditDate(new Date()); + update.setApplyNo(applyNo); + update.setSignStatus(Constants.ZERO); +// update.setSignUserId(user.getId()); +// update.setSignDate(new Date()); + companySolutionJoinMapper.updateById(update); + return link; + } + + + } -- Gitblit v1.9.3