|
@@ -1,17 +1,19 @@
|
|
|
package com.fjhx.sale.service.contract.impl;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fjhx.common.utils.Assert;
|
|
|
+import com.fjhx.sale.entity.contract.dto.ContractBudgetDto;
|
|
|
+import com.fjhx.sale.entity.contract.dto.ContractBudgetSelectDto;
|
|
|
import com.fjhx.sale.entity.contract.po.ContractBudget;
|
|
|
+import com.fjhx.sale.entity.contract.vo.ContractBudgetVo;
|
|
|
import com.fjhx.sale.mapper.contract.ContractBudgetMapper;
|
|
|
import com.fjhx.sale.service.contract.ContractBudgetService;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.fjhx.sale.entity.contract.vo.ContractBudgetVo;
|
|
|
-import com.fjhx.sale.entity.contract.dto.ContractBudgetSelectDto;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
-import com.fjhx.sale.entity.contract.dto.ContractBudgetDto;
|
|
|
-import cn.hutool.core.bean.BeanUtil;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -19,7 +21,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
* 外销合同--预算 服务实现类
|
|
|
* </p>
|
|
|
*
|
|
|
- * @author
|
|
|
+ * @author
|
|
|
* @since 2023-05-17
|
|
|
*/
|
|
|
@Service
|
|
@@ -35,7 +37,7 @@ public class ContractBudgetServiceImpl extends ServiceImpl<ContractBudgetMapper,
|
|
|
|
|
|
@Override
|
|
|
public ContractBudgetVo detail(Long id) {
|
|
|
- ContractBudget ContractBudget = this.getOne(Wrappers.<ContractBudget>query().lambda().eq(com.fjhx.sale.entity.contract.po.ContractBudget::getContractId,id));
|
|
|
+ ContractBudget ContractBudget = this.getOne(Wrappers.<ContractBudget>query().lambda().eq(com.fjhx.sale.entity.contract.po.ContractBudget::getContractId, id));
|
|
|
ContractBudgetVo result = BeanUtil.toBean(ContractBudget, ContractBudgetVo.class);
|
|
|
return result;
|
|
|
}
|
|
@@ -55,4 +57,19 @@ public class ContractBudgetServiceImpl extends ServiceImpl<ContractBudgetMapper,
|
|
|
this.removeById(id);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void budget(ContractBudgetDto contractBudgetDto) {
|
|
|
+ Long contractId = contractBudgetDto.getContractId();
|
|
|
+ Assert.notEmpty(contractId, "合同id不能为空");
|
|
|
+
|
|
|
+ ContractBudget contractBudget = getOne(q -> q.eq(ContractBudget::getContractId, contractId));
|
|
|
+ if (ObjectUtils.isEmpty(contractBudget)) {
|
|
|
+ this.save(contractBudgetDto);
|
|
|
+ } else {
|
|
|
+ contractBudgetDto.setId(contractBudget.getId());
|
|
|
+ this.updateById(contractBudgetDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|