|
|
@@ -4,11 +4,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import io.seata.common.util.CollectionUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.client.entity.CorpsAttn;
|
|
|
+import org.springblade.client.feign.ICorpsAttnClient;
|
|
|
+import org.springblade.client.feign.ICorpsDescClient;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
+import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
|
import org.springblade.purchase.sales.entity.Biding;
|
|
|
+import org.springblade.purchase.sales.entity.BidingAgent;
|
|
|
import org.springblade.purchase.sales.entity.BidingItems;
|
|
|
+import org.springblade.purchase.sales.mapper.BidingAgentMapper;
|
|
|
import org.springblade.purchase.sales.mapper.BidingItemsMapper;
|
|
|
import org.springblade.purchase.sales.mapper.BidingMapper;
|
|
|
import org.springblade.purchase.sales.service.IBidingItemsService;
|
|
|
@@ -29,6 +35,9 @@ import java.util.List;
|
|
|
public class BidingItemsServiceImpl extends ServiceImpl<BidingItemsMapper, BidingItems> implements IBidingItemsService {
|
|
|
|
|
|
private final BidingMapper bidingMapper;
|
|
|
+ private final ICorpsDescClient corpsDescClient;
|
|
|
+ private final BidingAgentMapper bidingAgentMapper;
|
|
|
+ private final ICorpsAttnClient corpsAttnClient;
|
|
|
|
|
|
/**
|
|
|
* 保存订单明细信息
|
|
|
@@ -40,6 +49,32 @@ public class BidingItemsServiceImpl extends ServiceImpl<BidingItemsMapper, Bidin
|
|
|
*/
|
|
|
@Override
|
|
|
public List<BidingItems> saveBidingItemsMessage(List<BidingItems> list, Long pid, Integer distinguish){
|
|
|
+ //获得当前用户信息
|
|
|
+ CorpsAttn corpsAttn = corpsAttnClient.getUser(AuthUtil.getUserId());
|
|
|
+ if (ObjectUtil.isEmpty(corpsAttn) || ObjectUtil.isEmpty(corpsAttn.getPid())){
|
|
|
+ throw new SecurityException("用户信息异常");
|
|
|
+ }
|
|
|
+
|
|
|
+ //获得代理信息
|
|
|
+ LambdaQueryWrapper<BidingAgent> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(BidingAgent::getTenantId, AuthUtil.getTenantId());
|
|
|
+ lambdaQueryWrapper.eq(BidingAgent::getIsDeleted,0);
|
|
|
+ lambdaQueryWrapper.eq(BidingAgent::getPid, pid);
|
|
|
+ lambdaQueryWrapper.in(BidingAgent::getAgentId, corpsAttn.getPid());
|
|
|
+ BidingAgent bidingAgent = bidingAgentMapper.selectOne(lambdaQueryWrapper);
|
|
|
+
|
|
|
+ if (bidingAgent == null){
|
|
|
+ throw new SecurityException("数据异常");
|
|
|
+ }else {
|
|
|
+ if (bidingAgent.getNonEditable() == null){//为空代表第一次添加标书对比
|
|
|
+ bidingAgent.setNonEditable(0);
|
|
|
+ } else if (bidingAgent.getNonEditable() == 0){//为零代表已经添加标书 此次为修改
|
|
|
+ bidingAgent.setNonEditable(1);
|
|
|
+ } else if (bidingAgent.getNonEditable() == 1){//为一代表已经修改过一次 不允许再修改
|
|
|
+ throw new SecurityException("投标信息只允许修改一次");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
list.forEach(item -> {
|
|
|
if (item.getId() == null){//id为空 新增
|
|
|
item.setTenantId(SecureUtil.getTenantId());
|
|
|
@@ -60,6 +95,8 @@ public class BidingItemsServiceImpl extends ServiceImpl<BidingItemsMapper, Bidin
|
|
|
baseMapper.updateById(item);
|
|
|
}
|
|
|
});
|
|
|
+ //更新代理明细信息
|
|
|
+ bidingAgentMapper.updateById(bidingAgent);
|
|
|
return list;
|
|
|
}
|
|
|
|