|
@@ -0,0 +1,518 @@
|
|
|
|
+package com.jeeplus.business.bid.service;
|
|
|
|
+
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
|
+import cn.hutool.extra.spring.SpringUtil;
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
+import com.jeeplus.business.bid.domain.JyTenderBidDetail;
|
|
|
|
+import com.jeeplus.business.bid.domain.TenderBidBasic;
|
|
|
|
+import com.jeeplus.business.bid.mapper.TenderBidBasicMapper;
|
|
|
|
+import com.jeeplus.business.bid.mapper.TenderBidDetailMapper;
|
|
|
|
+import com.jeeplus.business.bid.service.dto.TenderBidDTO;
|
|
|
|
+import com.jeeplus.business.tender.domain.BidDetail;
|
|
|
|
+import com.jeeplus.business.tender.domain.Tender;
|
|
|
|
+import com.jeeplus.business.tender.mapper.BidDetailMapper;
|
|
|
|
+import com.jeeplus.business.tender.service.DTO.TenderDTO;
|
|
|
|
+import com.jeeplus.common.TokenProvider;
|
|
|
|
+import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
|
|
+import com.jeeplus.flowable.feign.IFlowableApi;
|
|
|
|
+import com.jeeplus.pubmodules.oss.domain.WorkAttachment;
|
|
|
|
+import com.jeeplus.pubmodules.oss.service.dto.WorkAttachmentDto;
|
|
|
|
+import com.jeeplus.sys.feign.IPostApi;
|
|
|
|
+import com.jeeplus.sys.feign.IUserApi;
|
|
|
|
+import com.jeeplus.sys.feign.IWorkAttachmentApi;
|
|
|
|
+import com.jeeplus.sys.service.dto.FlowCopy;
|
|
|
|
+import com.jeeplus.sys.service.dto.PostDTO;
|
|
|
|
+import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.util.*;
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+public class TenderBidService {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private TenderBidBasicMapper basicMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private TenderBidDetailMapper detailMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private BidDetailMapper bidDetailMapper;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询中标详情
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public TenderBidDTO findBidById(String id) {
|
|
|
|
+ //查询基础表信息
|
|
|
|
+ TenderBidDTO tenderBidDTO = new TenderBidDTO();
|
|
|
|
+
|
|
|
|
+ ArrayList<JyTenderBidDetail> bids = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ TenderBidBasic tender = basicMapper.findById(id);
|
|
|
|
+ if (ObjectUtil.isNotEmpty(tender)){
|
|
|
|
+ BeanUtils.copyProperties(tender,tenderBidDTO);
|
|
|
|
+ //获取投标详情信息
|
|
|
|
+ List<BidDetail> bidDetails = bidDetailMapper.findByTenderId(tender.getTenderId());
|
|
|
|
+ if (CollectionUtils.isNotEmpty(bidDetails)){
|
|
|
|
+ bidDetails.stream().forEach(detail->{
|
|
|
|
+ //附件信息
|
|
|
|
+ List<WorkAttachmentDto> acList = detailMapper.getByAttachmentId(detail.getId());
|
|
|
|
+ if (CollectionUtils.isNotEmpty(acList)) {
|
|
|
|
+ for (WorkAttachmentDto i : acList) {
|
|
|
|
+ i.setCreateBy(SpringUtil.getBean ( IUserApi.class ).getById(i.getBy()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ detail.setBidFiles(acList);
|
|
|
|
+ tenderBidDTO.setTotalMoney(detail.getTotalMoney());
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ tenderBidDTO.setTenderList(bidDetails);//投标详情
|
|
|
|
+ //获取中标详情
|
|
|
|
+ List<JyTenderBidDetail> details=detailMapper.findByBasicId(id);
|
|
|
|
+ for (JyTenderBidDetail bidDetail : details) {
|
|
|
|
+ //附件信息
|
|
|
|
+ List<WorkAttachmentDto> acList = detailMapper.getByAttachmentId(bidDetail.getId());
|
|
|
|
+ if (CollectionUtils.isNotEmpty(acList)) {
|
|
|
|
+ for (WorkAttachmentDto i : acList) {
|
|
|
|
+ i.setCreateBy(SpringUtil.getBean ( IUserApi.class ).getById(i.getBy()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ bidDetail.setBidFiles(acList);
|
|
|
|
+ bids.add(bidDetail);
|
|
|
|
+ }
|
|
|
|
+ tenderBidDTO.setBidDetails(details); //中标详情
|
|
|
|
+ //附件信息
|
|
|
|
+ List<WorkAttachmentDto> files = detailMapper.getByAttachmentId(tender.getId());
|
|
|
|
+ if (CollectionUtils.isNotEmpty(files)) {
|
|
|
|
+ for (WorkAttachmentDto i : files) {
|
|
|
|
+ i.setCreateBy(SpringUtil.getBean ( IUserApi.class ).getById(i.getBy()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ tenderBidDTO.setFiles(files);
|
|
|
|
+ }
|
|
|
|
+ return tenderBidDTO;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 新增或修改
|
|
|
|
+ * @param dto
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public String save(TenderBidDTO dto) {
|
|
|
|
+ //获取当前登录人信息
|
|
|
|
+ UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getByToken(TokenProvider.getCurrentToken());
|
|
|
|
+ if (StringUtils.isNotBlank(dto.getId())){
|
|
|
|
+ return update(dto,userDTO);
|
|
|
|
+ }else {
|
|
|
|
+ return add(dto,userDTO);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public String add(TenderBidDTO dto, UserDTO userDTO) {
|
|
|
|
+ // 生成id
|
|
|
|
+ String id = UUID.randomUUID().toString().replace("-", "");
|
|
|
|
+ //保存基础表信息
|
|
|
|
+ TenderBidBasic tender = new TenderBidBasic();
|
|
|
|
+ BeanUtils.copyProperties(dto,tender);
|
|
|
|
+ tender.setId(id);
|
|
|
|
+ tender.setCreateById(userDTO.getId());
|
|
|
|
+ tender.setCreateTime(new Date());
|
|
|
|
+ tender.setUpdateById(userDTO.getId());
|
|
|
|
+ tender.setUpdateTime(new Date());
|
|
|
|
+ tender.setDelFlag(0);
|
|
|
|
+ basicMapper.insert(tender);
|
|
|
|
+ //保存详情列表信息
|
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getBidDetails())){
|
|
|
|
+ for (JyTenderBidDetail bidDetail : dto.getBidDetails()) {
|
|
|
|
+ // 生成id
|
|
|
|
+ String detailId = UUID.randomUUID().toString().replace("-", "");
|
|
|
|
+ bidDetail.setId(detailId);
|
|
|
|
+ bidDetail.setBidMan(bidDetail.getBidMan());//投标人
|
|
|
|
+ bidDetail.setCreateById(userDTO.getId());
|
|
|
|
+ bidDetail.setCreateTime(new Date());
|
|
|
|
+ bidDetail.setUpdateById(userDTO.getId());
|
|
|
|
+ bidDetail.setUpdateTime(new Date());
|
|
|
|
+ bidDetail.setDelFlag(0);
|
|
|
|
+
|
|
|
|
+ bidDetail.setTotalMoney(dto.getTotalMoney());
|
|
|
|
+ bidDetail.setBasicId(id); //基础表id
|
|
|
|
+ detailMapper.insert(bidDetail);
|
|
|
|
+ //保存详情列表附件信息
|
|
|
|
+ if (CollectionUtils.isNotEmpty(bidDetail.getBidFiles())){
|
|
|
|
+ saveFiles(bidDetail.getBidFiles(), userDTO, detailId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 保存附件列表信息
|
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getFiles())) {
|
|
|
|
+ saveFiles(dto.getFiles(), userDTO, id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //抄送部门主任,分管领导,办公室
|
|
|
|
+ ArrayList<UserDTO> userDTOS = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ PostDTO postDTOByName = SpringUtil.getBean(IPostApi.class).getPostDTOByName("办公室(嘉溢)");
|
|
|
|
+ List<UserDTO> listByPostId = SpringUtil.getBean(IUserApi.class).findListByPostId(postDTOByName.getId());
|
|
|
|
+ listByPostId.stream().forEach(item->{
|
|
|
|
+ userDTOS.add(item);
|
|
|
|
+ });
|
|
|
|
+ //获取嘉溢所有人员信息
|
|
|
|
+ List<UserDTO> allUserInfo = SpringUtil.getBean(IUserApi.class).findListByCompanyId(userDTO.getCompanyDTO().getId());
|
|
|
|
+ //分管领导
|
|
|
|
+ for (UserDTO userDTO1 : allUserInfo) {
|
|
|
|
+ if (StringUtils.isNotBlank(userDTO1.getManageOfficeIds())){
|
|
|
|
+ String manageOfficeIds = userDTO1.getManageOfficeIds();
|
|
|
|
+ if (manageOfficeIds.contains(",")){
|
|
|
|
+ String[] split = manageOfficeIds.split(",");
|
|
|
|
+ //获取分管领导所分管的部门
|
|
|
|
+ for (String s : split) {
|
|
|
|
+ //判断分管部门与项目创建人所在的部门是否一致
|
|
|
|
+ if (s.equals(userDTO.getOfficeDTO().getId())) {
|
|
|
|
+ userDTOS.add(userDTO1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ if (manageOfficeIds.equals(userDTO.getOfficeDTO().getId())) {
|
|
|
|
+ userDTOS.add(userDTO1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (UserDTO user : userDTOS) {
|
|
|
|
+ String id1 = UUID.randomUUID().toString().replace("-", "");
|
|
|
|
+ FlowCopy flowCopy = new FlowCopy();
|
|
|
|
+ flowCopy.setCreateById(userDTO.getId());
|
|
|
|
+ flowCopy.setCreateTime(new Date());
|
|
|
|
+ flowCopy.setUpdateById(userDTO.getId());
|
|
|
|
+ flowCopy.setUpdateTime(new Date());
|
|
|
|
+ String tenderName = tender.getBatch()+"已中标";
|
|
|
|
+ flowCopy.setProcInsName(tenderName);
|
|
|
|
+ flowCopy.setProcInsId(id);
|
|
|
|
+ flowCopy.setProcDefId(id);
|
|
|
|
+ flowCopy.setUserId(user.getId());
|
|
|
|
+ flowCopy.setId(id1);
|
|
|
|
+ flowCopy.setDelFlag(0);
|
|
|
|
+ SpringUtil.getBean(IFlowableApi.class).add(flowCopy);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return "添加成功";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public String update(TenderBidDTO dto, UserDTO userDTO) {
|
|
|
|
+ //保存基础表信息
|
|
|
|
+ TenderBidBasic tender = new TenderBidBasic();
|
|
|
|
+ BeanUtils.copyProperties(dto,tender);
|
|
|
|
+ tender.setUpdateById(userDTO.getId());
|
|
|
|
+ tender.setUpdateTime(new Date());
|
|
|
|
+ basicMapper.updateById(tender);
|
|
|
|
+ //修改中标详情列表信息
|
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getBidDetails())){
|
|
|
|
+ //根据基础表id获取所有的详情表id
|
|
|
|
+ List<String> idList = detailMapper.getByBasicId(dto.getId());
|
|
|
|
+ for (JyTenderBidDetail bidDetail : dto.getBidDetails()) {
|
|
|
|
+ //删除掉多余的详情信息
|
|
|
|
+ if (null != idList) {
|
|
|
|
+ if (idList.contains(bidDetail.getId())){
|
|
|
|
+ idList.remove(bidDetail.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (null != idList & idList.size()>0) {
|
|
|
|
+ idList.forEach(id->{
|
|
|
|
+ detailMapper.deleteById(id);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (JyTenderBidDetail bidDetail : dto.getBidDetails()) {
|
|
|
|
+ JyTenderBidDetail detail = detailMapper.selectById(bidDetail.getId());
|
|
|
|
+ if (null == detail){
|
|
|
|
+ // 生成id
|
|
|
|
+ String detailId = UUID.randomUUID().toString().replace("-", "");
|
|
|
|
+ bidDetail.setId(detailId);
|
|
|
|
+ bidDetail.setBidMan(bidDetail.getBidMan());//投标人
|
|
|
|
+ bidDetail.setCreateById(userDTO.getId());
|
|
|
|
+ bidDetail.setCreateTime(new Date());
|
|
|
|
+ bidDetail.setUpdateById(userDTO.getId());
|
|
|
|
+ bidDetail.setUpdateTime(new Date());
|
|
|
|
+ bidDetail.setDelFlag(0);
|
|
|
|
+
|
|
|
|
+ bidDetail.setTotalMoney(dto.getTotalMoney());
|
|
|
|
+ bidDetail.setBasicId(dto.getId()); //基础表id
|
|
|
|
+ detailMapper.insert(bidDetail);
|
|
|
|
+ //保存详情列表附件信息
|
|
|
|
+ if (CollectionUtils.isNotEmpty(bidDetail.getBidFiles())){
|
|
|
|
+ saveFiles(bidDetail.getBidFiles(), userDTO, detailId);
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ bidDetail.setUpdateById(userDTO.getId());
|
|
|
|
+ bidDetail.setUpdateTime(new Date());
|
|
|
|
+ bidDetail.setTotalMoney(dto.getTotalMoney());
|
|
|
|
+ detailMapper.updateById(bidDetail);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(bidDetail.getBidFiles())) {
|
|
|
|
+ updateFiles(bidDetail.getBidFiles(), userDTO, bidDetail.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ // 修改附件信息列表
|
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getFiles())) {
|
|
|
|
+ updateFiles(dto.getFiles(), userDTO, dto.getId());
|
|
|
|
+ }
|
|
|
|
+ //抄送前先进行删除
|
|
|
|
+ SpringUtil.getBean(IFlowableApi.class).remove(dto.getId());
|
|
|
|
+ //抄送部门主任,分管领导,办公室
|
|
|
|
+ ArrayList<UserDTO> userDTOS = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ PostDTO postDTOByName = SpringUtil.getBean(IPostApi.class).getPostDTOByName("办公室(嘉溢)");
|
|
|
|
+ List<UserDTO> listByPostId = SpringUtil.getBean(IUserApi.class).findListByPostId(postDTOByName.getId());
|
|
|
|
+ listByPostId.stream().forEach(item->{
|
|
|
|
+ userDTOS.add(item);
|
|
|
|
+ });
|
|
|
|
+ //获取嘉溢所有人员信息
|
|
|
|
+ List<UserDTO> allUserInfo = SpringUtil.getBean(IUserApi.class).findListByCompanyId(userDTO.getCompanyDTO().getId());
|
|
|
|
+ //分管领导
|
|
|
|
+ for (UserDTO userDTO1 : allUserInfo) {
|
|
|
|
+ if (StringUtils.isNotBlank(userDTO1.getManageOfficeIds())){
|
|
|
|
+ String manageOfficeIds = userDTO1.getManageOfficeIds();
|
|
|
|
+ if (manageOfficeIds.contains(",")){
|
|
|
|
+ String[] split = manageOfficeIds.split(",");
|
|
|
|
+ //获取分管领导所分管的部门
|
|
|
|
+ for (String s : split) {
|
|
|
|
+ //判断分管部门与项目创建人所在的部门是否一致
|
|
|
|
+ if (s.equals(userDTO.getOfficeDTO().getId())) {
|
|
|
|
+ userDTOS.add(userDTO1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ if (manageOfficeIds.equals(userDTO.getOfficeDTO().getId())) {
|
|
|
|
+ userDTOS.add(userDTO1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (UserDTO user : userDTOS) {
|
|
|
|
+ String id1 = UUID.randomUUID().toString().replace("-", "");
|
|
|
|
+ FlowCopy flowCopy = new FlowCopy();
|
|
|
|
+ flowCopy.setCreateById(userDTO.getId());
|
|
|
|
+ flowCopy.setCreateTime(new Date());
|
|
|
|
+ flowCopy.setUpdateById(userDTO.getId());
|
|
|
|
+ flowCopy.setUpdateTime(new Date());
|
|
|
|
+ String tenderName = "投标项目--"+tender.getBatch()+"已中标";
|
|
|
|
+ flowCopy.setProcInsName(tenderName);
|
|
|
|
+ flowCopy.setProcInsId(dto.getId());
|
|
|
|
+ flowCopy.setProcDefId(dto.getId());
|
|
|
|
+ flowCopy.setUserId(user.getId());
|
|
|
|
+ flowCopy.setId(id1);
|
|
|
|
+ flowCopy.setDelFlag(0);
|
|
|
|
+ SpringUtil.getBean(IFlowableApi.class).add(flowCopy);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return "修改成功";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 修改附件信息
|
|
|
|
+ * @param list 待修改的附件列表
|
|
|
|
+ * @param userDTO 当前登录用户
|
|
|
|
+ * @param id 关联id
|
|
|
|
+ */
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public void updateFiles(List<WorkAttachmentDto> list, UserDTO userDTO, String id) {
|
|
|
|
+ int j = 1;
|
|
|
|
+ String names = new String();
|
|
|
|
+ //表中存在,但是传过来不存在,说明已删除,表中数据也要删除
|
|
|
|
+ for (WorkAttachmentDto dto : list) {
|
|
|
|
+ names = names + "," +dto.getUrl();
|
|
|
|
+ }
|
|
|
|
+ //查询保存的附件信息
|
|
|
|
+ List<WorkAttachment> infoList = basicMapper.findFileList(id);
|
|
|
|
+ if (org.flowable.editor.language.json.converter.util.CollectionUtils.isNotEmpty(infoList)) {
|
|
|
|
+ for (WorkAttachment i : infoList) {
|
|
|
|
+ if (!names.contains(i.getUrl())) {
|
|
|
|
+// ossServiceMapper.deleteById(i.getId());
|
|
|
|
+ SpringUtil.getBean ( IWorkAttachmentApi.class ).deleteById(i.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //保存信息
|
|
|
|
+ for (WorkAttachmentDto dto : list) {
|
|
|
|
+ //判断是否存在
|
|
|
|
+ Integer isExit = basicMapper.findIsExit(id, dto.getName());
|
|
|
|
+ if (isExit == 0) {
|
|
|
|
+ WorkAttachment i = new WorkAttachment();
|
|
|
|
+ //包含了url、size、name
|
|
|
|
+ i.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
|
+// i.getCreateBy().setId(userDTO.getId());
|
|
|
|
+ i.setCreateTime(new Date());
|
|
|
|
+// i.getUpdateBy().setId(userDTO.getId());
|
|
|
|
+ i.setUpdateTime(new Date());
|
|
|
|
+ i.setDelFlag(0);
|
|
|
|
+ i.setUrl(dto.getUrl());
|
|
|
|
+ //文件类型处理
|
|
|
|
+ List<String> strings = Arrays.asList(dto.getName().split("\\."));
|
|
|
|
+ if (org.flowable.editor.language.json.converter.util.CollectionUtils.isNotEmpty(strings)) {
|
|
|
|
+ i.setType(strings.get(1));
|
|
|
|
+ }
|
|
|
|
+ i.setAttachmentId(id);
|
|
|
|
+ i.setAttachmentName(dto.getName());
|
|
|
|
+ i.setAttachmentFlag("tenderBidFile");
|
|
|
|
+ i.setFileSize(dto.getSize());
|
|
|
|
+ i.setSort(j);
|
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
|
+ String workAttachment = JSON.toJSONString((i));
|
|
|
|
+ String userDTOInfo = JSON.toJSONString((userDTO));
|
|
|
|
+ map.put("workAttachment",workAttachment);
|
|
|
|
+ map.put("userDTO",userDTOInfo);
|
|
|
|
+ SpringUtil.getBean ( IWorkAttachmentApi.class ).insertWorkAttachment(map);
|
|
|
|
+// ossServiceMapper.insertWorkAttachment(i, userDTO);
|
|
|
|
+ j++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 保存附件信息
|
|
|
|
+ * @param list 待保存的附件列表
|
|
|
|
+ * @param userDTO 当前登录用户
|
|
|
|
+ * @param id 关联id
|
|
|
|
+ */
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public void saveFiles(List<WorkAttachmentDto> list, UserDTO userDTO, String id) {
|
|
|
|
+ int j = 1;
|
|
|
|
+ for (WorkAttachmentDto dto : list) {
|
|
|
|
+ WorkAttachment i = new WorkAttachment();
|
|
|
|
+ //包含了url、size、name
|
|
|
|
+ i.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
|
+// i.getCreateBy().setId(userDTO.getId());
|
|
|
|
+ i.setCreateTime(new Date());
|
|
|
|
+// i.getUpdateBy().setId(userDTO.getId());
|
|
|
|
+ i.setUpdateTime(new Date());
|
|
|
|
+ i.setDelFlag(0);
|
|
|
|
+ i.setUrl(dto.getUrl());
|
|
|
|
+ //文件类型处理
|
|
|
|
+ List<String> strings = Arrays.asList(dto.getName().split("\\."));
|
|
|
|
+ if (org.flowable.editor.language.json.converter.util.CollectionUtils.isNotEmpty(strings)) {
|
|
|
|
+ i.setType(strings.get(1));
|
|
|
|
+ }
|
|
|
|
+ i.setAttachmentId(id);
|
|
|
|
+ i.setAttachmentName(dto.getName());
|
|
|
|
+ i.setAttachmentFlag("tenderBidFile");
|
|
|
|
+ i.setFileSize(dto.getSize());
|
|
|
|
+ i.setSort(j);
|
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
|
+ String workAttachment = JSON.toJSONString((i));
|
|
|
|
+ String userDTOInfo = JSON.toJSONString((userDTO));
|
|
|
|
+ map.put("workAttachment",workAttachment);
|
|
|
|
+ map.put("userDTO",userDTOInfo);
|
|
|
|
+ SpringUtil.getBean ( IWorkAttachmentApi.class ).insertWorkAttachment(map);
|
|
|
|
+// ossServiceMapper.insertWorkAttachment(i, userDTO);
|
|
|
|
+ j++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 中标列表查询
|
|
|
|
+ * @param page
|
|
|
|
+ * @param dto
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public IPage<TenderBidDTO> list(Page<TenderBidDTO> page, TenderBidDTO dto) throws Exception {
|
|
|
|
+ QueryWrapper<TenderBidDTO> queryWrapper = QueryWrapperGenerator.buildQueryCondition(dto, TenderBidDTO.class);
|
|
|
|
+ queryWrapper.eq("a.del_flag", 0);
|
|
|
|
+ // 创建时间
|
|
|
|
+ if (dto.getDates() != null) {
|
|
|
|
+ queryWrapper.between("a.create_time", dto.getDates()[0], dto.getDates()[1]);
|
|
|
|
+ }
|
|
|
|
+ // 创建人
|
|
|
|
+ if (StringUtils.isNotEmpty(dto.getCreateById())) {
|
|
|
|
+ queryWrapper.eq("a.create_by_id ", dto.getCreateById());
|
|
|
|
+ }
|
|
|
|
+ //批次
|
|
|
|
+ if (StringUtils.isNotEmpty(dto.getBatch())) {
|
|
|
|
+ queryWrapper.like("b.batch", dto.getBatch());
|
|
|
|
+ }
|
|
|
|
+ //采购金额
|
|
|
|
+ if (null !=dto.getTotalMoneys()){
|
|
|
|
+ if (StringUtils.isNotEmpty(dto.getTotalMoneys()[0])) {
|
|
|
|
+ queryWrapper.ge("a.money",Double.parseDouble(dto.getTotalMoneys()[0]));
|
|
|
|
+ }
|
|
|
|
+ if (dto.getTotalMoneys().length>1 && StringUtils.isNotEmpty(dto.getTotalMoneys()[1])) {
|
|
|
|
+ queryWrapper.le("a.money", Double.parseDouble(dto.getTotalMoneys()[1]));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //采购申请号
|
|
|
|
+ if (StringUtils.isNotEmpty(dto.getPurchaseNumber())) {
|
|
|
|
+ queryWrapper.like("a.purchase_number", dto.getPurchaseNumber());
|
|
|
|
+ }
|
|
|
|
+ //分标编号
|
|
|
|
+ if (StringUtils.isNotEmpty(dto.getSubscaleNumber())) {
|
|
|
|
+ queryWrapper.like("a.subscale_number", dto.getSubscaleNumber());
|
|
|
|
+ }
|
|
|
|
+ //分标名称
|
|
|
|
+ if (StringUtils.isNotEmpty(dto.getSubscaleName())) {
|
|
|
|
+ queryWrapper.like("a.subscale_name", dto.getSubscaleName());
|
|
|
|
+ }
|
|
|
|
+ IPage<TenderBidDTO> iPage=basicMapper.findPageList(queryWrapper,page);
|
|
|
|
+ return iPage;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据id进行删除
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public String remove(String id) {
|
|
|
|
+ // 删除基础信息表
|
|
|
|
+ basicMapper.deleteById(id);
|
|
|
|
+ // 删除详情列表 及对应附件信息
|
|
|
|
+ List<JyTenderBidDetail> detailedList = detailMapper.findByBasicId(id);
|
|
|
|
+ if (null != detailedList){
|
|
|
|
+ detailedList.forEach(de->{
|
|
|
|
+ //附件
|
|
|
|
+ List<WorkAttachmentDto> fileList = detailMapper.getByAttachmentId(de.getId());
|
|
|
|
+ if ( null != fileList ){
|
|
|
|
+ fileList.forEach(f->{
|
|
|
|
+ SpringUtil.getBean(IWorkAttachmentApi.class).deleteById(f.getId());
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ detailMapper.deleteById(de.getId());
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ // 删除附件信息
|
|
|
|
+ SpringUtil.getBean(IWorkAttachmentApi.class).deleteByAttachmentId(id);
|
|
|
|
+ //删除抄送信息
|
|
|
|
+ SpringUtil.getBean(IFlowableApi.class).remove(id);
|
|
|
|
+
|
|
|
|
+ return "删除成功";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据投标id查询中标记录
|
|
|
|
+ * @param page
|
|
|
|
+ * @param dto
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public IPage<TenderBidDTO> bidList(Page<TenderBidDTO> page, TenderBidDTO dto) throws Exception {
|
|
|
|
+ QueryWrapper<TenderBidDTO> queryWrapper = QueryWrapperGenerator.buildQueryCondition(dto, TenderBidDTO.class);
|
|
|
|
+ queryWrapper.eq("a.del_flag", 0);
|
|
|
|
+ queryWrapper.eq("b.tender_id",dto.getTenderId());
|
|
|
|
+ IPage<TenderBidDTO> iPage=basicMapper.bidList(queryWrapper,page);
|
|
|
|
+ return iPage;
|
|
|
|
+ }
|
|
|
|
+}
|