|
@@ -13,6 +13,7 @@ import com.caimei365.commodity.utils.ListPagingUtil;
|
|
|
import com.caimei365.commodity.utils.MongodbUtils;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -29,6 +30,7 @@ import java.util.stream.Collectors;
|
|
|
* @author : Charles
|
|
|
* @date : 2023/4/26
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
public class ProcurementServiceImpl implements ProcurementService {
|
|
|
@Value("${caimei.wwwDomain}")
|
|
@@ -98,21 +100,11 @@ public class ProcurementServiceImpl implements ProcurementService {
|
|
|
procurementDto.setDelFlag(p.getDelFlag());
|
|
|
// 参与机构数量
|
|
|
procurementDto.setPartNumber(additionalPoList.size());
|
|
|
-// // 是否参与集采 0未参与 1参与 2我创建的
|
|
|
-// if (p.getCreateUserId().equals(userId.toString())) {
|
|
|
-// procurementDto.setIsInvolved(2);
|
|
|
-// } else {
|
|
|
-// List<String> stringList = additionalPoList.stream().map(a -> a.getAdditionalId()).collect(Collectors.toList());
|
|
|
-// List<ProcurePo> collect = involvedList.stream().filter(item -> stringList.contains(item.getId())).collect(Collectors.toList());
|
|
|
-// if (null != collect && collect.size() > 0) {
|
|
|
-// procurementDto.setIsInvolved(1);
|
|
|
-// } else {
|
|
|
-// procurementDto.setIsInvolved(0);
|
|
|
-// }
|
|
|
-// }
|
|
|
if (!p.getUserId().equals(userId)) {
|
|
|
additionalService.findProcureById(p.getId()).forEach(s -> {
|
|
|
- procurementDto.setSId(s.getAdditionalId());
|
|
|
+ if (s.getProcureId().equals(p.getId()) && involvedList.stream().map(ProcurePo::getId).collect(Collectors.toList()).contains(s.getAdditionalId())) {
|
|
|
+ procurementDto.setSId(s.getAdditionalId());
|
|
|
+ }
|
|
|
procurementDto.setProcurePo(procureService.findById(s.getAdditionalId()));
|
|
|
});
|
|
|
}
|
|
@@ -141,7 +133,9 @@ public class ProcurementServiceImpl implements ProcurementService {
|
|
|
public ResponseJson<Map<String, Object>> detailProcurement(String id, Integer userId) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
// 我参与的
|
|
|
+ log.info("userId====="+userId);
|
|
|
List<ProcurePo> involvedList = procureService.findInvolvedList(userId.toString());
|
|
|
+ log.info("involvedList====="+involvedList);
|
|
|
// 参与集采集合
|
|
|
List<AdditionalPo> additionalPoLi = additionalService.findProcureById(id);
|
|
|
// 参与者集合
|
|
@@ -178,8 +172,9 @@ public class ProcurementServiceImpl implements ProcurementService {
|
|
|
}
|
|
|
}
|
|
|
// sid
|
|
|
+ log.info("involvedList====="+involvedList);
|
|
|
for(AdditionalPo add: additionalPoLi) {
|
|
|
- if (add.getProcureId().equals(procurePo.getId())) {
|
|
|
+ if (add.getProcureId().equals(procurePo.getId()) && involvedList.stream().map(ProcurePo::getId).collect(Collectors.toList()).contains(add.getAdditionalId())) {
|
|
|
procurementDto.setSId(add.getAdditionalId());
|
|
|
}
|
|
|
}
|
|
@@ -215,37 +210,6 @@ public class ProcurementServiceImpl implements ProcurementService {
|
|
|
procurementList.add(procurement);
|
|
|
}
|
|
|
|
|
|
-// // 设置参与者信息
|
|
|
-// List<AdditionalPo> additionalList = additionalService.findProcureById(procurePo.getId());
|
|
|
-// for (AdditionalPo add : additionalList) {
|
|
|
-// // 参与者信息
|
|
|
-// ProcurePo procure = procureService.findById(add.getProcureId());
|
|
|
-// procurement.setId(procure.getId());
|
|
|
-// procurement.setUserId(procure.getUserId());
|
|
|
-// String imageURL = ImageUtils.getImageURL("product", procure.getProductImage(), 0, domain);
|
|
|
-// if (StringUtils.isNotBlank(imageURL)) {
|
|
|
-// procurement.setProductImage(imageURL);
|
|
|
-// }
|
|
|
-// procurement.setProductName(procure.getProductName());
|
|
|
-// procurement.setPrice(procure.getPrice());
|
|
|
-// procurement.setSaveTime(returnFormat.format(procure.getSaveTime()));
|
|
|
-// if (StringUtils.isNotBlank(procure.getCreateUserId())) {
|
|
|
-// procurement.setCreateUserId(procure.getCreateUserId());
|
|
|
-// }
|
|
|
-// procurement.setNumber(procure.getNumber());
|
|
|
-// procurement.setIsAchieve(procure.getIsAchieve());
|
|
|
-// procurement.setDelFlag(procure.getDelFlag());
|
|
|
-// procurementList.add(procurement);
|
|
|
-// }
|
|
|
-// // 用户信息获取
|
|
|
-// List<String> userIds = procurementList.stream().map(ProcurementDto::getUserId).collect(Collectors.toList());
|
|
|
-// List<UserVo> userInfo = procurementMapper.selUserInfo(userIds);
|
|
|
-// // 用户信息赋予
|
|
|
-// if (null != userInfo) {
|
|
|
-// procurementList.forEach(p -> {
|
|
|
-// p.setUserName(userInfo.get(userInfo.indexOf(p.getUserId())).getUserName());
|
|
|
-// });
|
|
|
-// }
|
|
|
map.put("procurementList", procurementList);
|
|
|
return ResponseJson.success(map);
|
|
|
}
|
|
@@ -343,7 +307,6 @@ public class ProcurementServiceImpl implements ProcurementService {
|
|
|
if (null != collect && collect.size() > 0) {
|
|
|
p.setUserName(collect.get(0).getUserName());
|
|
|
}
|
|
|
-// p.setUserName(userInfo.get(userInfo.indexOf(p.getUserId())).getUserName());
|
|
|
});
|
|
|
}
|
|
|
return ResponseJson.success(procurementList);
|
|
@@ -371,16 +334,12 @@ public class ProcurementServiceImpl implements ProcurementService {
|
|
|
procurementDto.setIsInvolved(2);
|
|
|
}
|
|
|
// 检索匹配
|
|
|
-// ProcurePo procurePo = involvedList.get(involvedList.indexOf(id));
|
|
|
ProcurePo procurePo = null;
|
|
|
for (ProcurePo s : involvedList) {
|
|
|
if (id.equals(s.getId())) {
|
|
|
procurePo = s;
|
|
|
}
|
|
|
}
|
|
|
- /*List<String> userIds = new ArrayList<>();
|
|
|
- userIds.add(procurePo.getUserId());
|
|
|
- List<UserVo> userInfo = procurementMapper.selUserInfo(userIds);*/
|
|
|
// 返回赋值
|
|
|
procurementDto.setId(procurePo.getId());
|
|
|
procurementDto.setUserId(procurePo.getUserId());
|
|
@@ -422,10 +381,6 @@ public class ProcurementServiceImpl implements ProcurementService {
|
|
|
if (StringUtils.isNotBlank(procurementDto.getId())) {
|
|
|
// 修改集采信息
|
|
|
procurePo.setId(procurementDto.getId());
|
|
|
-// procurePo.setCreateUserId(procurementDto.getCreateUserId());
|
|
|
-// procurePo.setIsAchieve(procurementDto.getIsAchieve());
|
|
|
-// procurePo.setIsInvolved(procurementDto.getIsInvolved());
|
|
|
-// procurePo.setDelFlag(procurementDto.getDelFlag());
|
|
|
MongodbUtils.updateFirst("_id", procurePo.getId(),
|
|
|
new String[]{"productImage", "productName", "price", "number"},
|
|
|
new String[]{procurePo.getProductImage(),
|
|
@@ -456,7 +411,6 @@ public class ProcurementServiceImpl implements ProcurementService {
|
|
|
ProcurePo procurePo = new ProcurePo();
|
|
|
String id=procurementDto.getId();
|
|
|
if (status ==1) {
|
|
|
-// procureService.deleteById(procurePo.getId());
|
|
|
id=((AdditionalPo)MongodbUtils.find(AdditionalPo.class, new java.lang.String[]{"additionalId"}, new java.lang.String[]{procurementDto.getId()}).get(0)).getProcureId();
|
|
|
MongodbUtils.removeById("additionalId", procurementDto.getId(), AdditionalPo.class);
|
|
|
MongodbUtils.removeById("_id", procurementDto.getId(), ProcurePo.class);
|
|
@@ -470,7 +424,6 @@ public class ProcurementServiceImpl implements ProcurementService {
|
|
|
procurePo.setSaveTime(Long.valueOf(saveFormat.parse(time).getTime()));
|
|
|
procurePo.setNumber(procurementDto.getNumber());
|
|
|
procurePo.setClubName(procurementDto.getUserName());
|
|
|
-// procurePo.setCreateUserId(procurementDto.getUserId());
|
|
|
procurePo.setIsAchieve("0");
|
|
|
procurePo.setIsInvolved(1);
|
|
|
procurePo.setDelFlag("0");
|
|
@@ -482,28 +435,6 @@ public class ProcurementServiceImpl implements ProcurementService {
|
|
|
additionalPo.setAdditionalId(procurePo.getId());
|
|
|
additionalPo.setDelFlag("0");
|
|
|
additionalService.save(additionalPo);
|
|
|
-// } else {
|
|
|
-// // 参与集采需求
|
|
|
-// procurePo.setId(procurementDto.getId());
|
|
|
-// procurePo.setUserId(procurementDto.getUserId());
|
|
|
-// procurePo.setProductImage(procurementDto.getProductImage());
|
|
|
-// procurePo.setProductName(procurementDto.getProductName());
|
|
|
-// procurePo.setPrice(procurementDto.getPrice());
|
|
|
-// String time = saveFormat.format(new Date());
|
|
|
-// procurePo.setSaveTime(Long.valueOf(saveFormat.parse(time).getTime()));
|
|
|
-// procurePo.setNumber(procurementDto.getNumber());
|
|
|
-//// procurePo.setCreateUserId(procurementDto.getUserId());
|
|
|
-// procurePo.setIsAchieve("0");
|
|
|
-// procurePo.setIsInvolved(1);
|
|
|
-// procurePo.setDelFlag("0");
|
|
|
-// procureService.updateFirst(procurePo);
|
|
|
-//// // 设置集采 发布与参与对应关系
|
|
|
-//// AdditionalPo additionalPo = new AdditionalPo();
|
|
|
-//// additionalPo.setProcureId(procurementDto.getId());
|
|
|
-//// additionalPo.setAdditionalId(procurePo.getId());
|
|
|
-//// additionalPo.setDelFlag("0");
|
|
|
-//// additionalService.update(additionalPo);
|
|
|
-// }
|
|
|
return ResponseJson.success();
|
|
|
}
|
|
|
|
|
@@ -519,37 +450,10 @@ public class ProcurementServiceImpl implements ProcurementService {
|
|
|
public ResponseJson updateProcurement(String id, Integer userId, Integer procurementType) {
|
|
|
// 更新集采信息
|
|
|
if (1 == procurementType) {
|
|
|
- // 删除集采
|
|
|
- /*ProcurePo procurePo = new ProcurePo();
|
|
|
- procurePo.setId(id.toString());
|
|
|
- procurePo.setIsInvolved(0);
|
|
|
- MongodbUtils.updateFirst("_id", procurePo.getId(),
|
|
|
- new String[]{"IsInvolved"},
|
|
|
- new String[]{procurePo.getIsInvolved().toString()},
|
|
|
- ProcurePo.class);*/
|
|
|
// 退出集采
|
|
|
procureService.deleteById(id);
|
|
|
// 删除关系
|
|
|
additionalService.deleteByAdditionalId(id);
|
|
|
-
|
|
|
-
|
|
|
-// AdditionalPo additionalPo = new AdditionalPo();
|
|
|
-// ProcurePo procurePo = new ProcurePo();
|
|
|
-// // 主集采下所有参与者 参与id
|
|
|
-// List<AdditionalPo> poList = additionalService.findProcureById(id.toString());
|
|
|
-// for (AdditionalPo add : poList) {
|
|
|
-// ProcurePo byId = procureService.findById(add.getAdditionalId());
|
|
|
-// if (byId.getUserId().equals(userId)) {
|
|
|
-// // 修改集采参与记录关系
|
|
|
-// additionalPo.setAdditionalId(byId.getId());
|
|
|
-// additionalPo.setDelFlag("1");
|
|
|
-// additionalService.update(additionalPo);
|
|
|
-// // 修改集采参与记录
|
|
|
-// procurePo.setId(byId.getId());
|
|
|
-// procurePo.setDelFlag("1");
|
|
|
-// procureService.update(procurePo);
|
|
|
-// }
|
|
|
-// }
|
|
|
} else {
|
|
|
// 删除集采
|
|
|
ProcurePo procurePo = new ProcurePo();
|