|
@@ -1,16 +1,15 @@
|
|
|
package com.dayou.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.dayou.common.BaseEntity;
|
|
|
-import com.dayou.dto.AProListSelectDTO;
|
|
|
-import com.dayou.dto.AssetsProductionDetailDTO;
|
|
|
-import com.dayou.dto.TaskRecordDTO;
|
|
|
-import com.dayou.entity.AssetsProduction;
|
|
|
-import com.dayou.entity.BusinessProductionPerformance;
|
|
|
-import com.dayou.entity.WorkFlowNodeInstance;
|
|
|
+import com.dayou.dto.*;
|
|
|
+import com.dayou.entity.*;
|
|
|
+import com.dayou.exception.ErrorCode;
|
|
|
import com.dayou.mapper.AssetsProductionMapper;
|
|
|
import com.dayou.service.IAssetsProductionService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.dayou.service.IBusinessProductionService;
|
|
|
+import com.dayou.service.IOrderFundService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -34,6 +33,9 @@ import java.util.ArrayList;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import com.dayou.enums.BatchTaskTypeEnum;
|
|
|
|
|
|
+import static com.dayou.enums.MainBusinessEnum.ASSET_BUSINESS;
|
|
|
+import static com.dayou.enums.ProductionEnum.STATEMENT;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 资产产品表 服务实现类
|
|
@@ -51,6 +53,9 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
|
|
|
@Autowired
|
|
|
private IBusinessProductionService businessProductionService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IOrderFundService orderFundService;
|
|
|
+
|
|
|
/**
|
|
|
* 根据资产业务id查询资产业务产品
|
|
|
*
|
|
@@ -158,4 +163,52 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
|
|
|
public Integer getInatanceCount(AProListSelectDTO aProListSelectDTO) {
|
|
|
return assetsProductionMapper.getInatanceCount(aProListSelectDTO);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 产品出入库
|
|
|
+ * @param wareHouseDTO 出入库信息dto
|
|
|
+ * @return Boolean
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean assetsProRepertory(AssetsProWareHouseDTO wareHouseDTO) {
|
|
|
+ AssetsProduction assetsProduction = this.getOne(new LambdaQueryWrapper<AssetsProduction>()
|
|
|
+ .select(BaseEntity::getId,AssetsProduction::getRepertoryState,
|
|
|
+ AssetsProduction::getProductionNo,
|
|
|
+ AssetsProduction::getBusinessId,
|
|
|
+ AssetsProduction::getProductionType)
|
|
|
+ .eq(BaseEntity::getId,wareHouseDTO.getProductionId())
|
|
|
+ .eq(BaseEntity::getDeleted, Boolean.FALSE));
|
|
|
+ if (ObjectUtil.isNull(assetsProduction)){
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "产品不存在,操作失败。");
|
|
|
+ } else if (!assetsProduction.getProductionNo().equals(wareHouseDTO.getProductionNo())) {
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "出库的产品报告号与当前操作的产品报告号不一致,请检查。");
|
|
|
+ } else if (!assetsProduction.getProductionType().equals(wareHouseDTO.getProductionType())) {
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "出库的产品类型与当前操作的产品类型不符,请检查。");
|
|
|
+ }
|
|
|
+
|
|
|
+ // true出库,false入库
|
|
|
+ if (wareHouseDTO.getRepertoryState()){ // 出库
|
|
|
+ if (ObjectUtil.isNull(assetsProduction.getRepertoryState())){
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "产品还未入库,无法出库。");
|
|
|
+ } else if (assetsProduction.getRepertoryState()) {
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "产品还已出库,无需出库。");
|
|
|
+ }
|
|
|
+ OrderFund orderFund = orderFundService.getOne(new LambdaQueryWrapper<OrderFund>()
|
|
|
+ .select(BaseEntity::getId,OrderFund::getRealAmount)
|
|
|
+ .eq(OrderFund::getBusinessId,wareHouseDTO.getBusinessId())
|
|
|
+ .eq(OrderFund::getBusinessType,ASSET_BUSINESS.getCode()));
|
|
|
+ // 非意见书,且实收款未认领(订单实收款为NULL)
|
|
|
+ if (!assetsProduction.getProductionType().equals(STATEMENT.name()) && ObjectUtil.isNull(orderFund)){
|
|
|
+ // 判断出库审核是否通过
|
|
|
+ if (true){ // 不通过提示
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "不满足出库条件,该产品需客户经理申请产品出库通过后方可出库。");
|
|
|
+ }else { // 通过则出库
|
|
|
+
|
|
|
+ }
|
|
|
+ }else { // 意见书可以直接出库
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|