|
@@ -6,34 +6,21 @@ 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.dayou.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.dayou.service.IBusinessProductionService;
|
|
|
-import com.dayou.service.IOrderFundService;
|
|
|
-import com.dayou.service.IProductionOutWarehouseService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
-import com.dayou.utils.ExcelUtil;
|
|
|
-import org.apache.poi.ss.usermodel.Cell;
|
|
|
-import org.apache.poi.ss.usermodel.CellStyle;
|
|
|
-import org.apache.poi.ss.usermodel.Row;
|
|
|
-import org.apache.poi.ss.usermodel.Sheet;
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
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;
|
|
@@ -53,6 +40,9 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
|
|
|
private AssetsProductionMapper assetsProductionMapper;
|
|
|
|
|
|
@Autowired
|
|
|
+ private IAssetsService assetsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private IBusinessProductionService businessProductionService;
|
|
|
|
|
|
@Autowired
|
|
@@ -61,6 +51,9 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
|
|
|
@Autowired
|
|
|
private IProductionOutWarehouseService productionOutWarehouseService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IProductionFundService productionFundService;
|
|
|
+
|
|
|
/**
|
|
|
* 根据资产业务id查询资产业务产品
|
|
|
*
|
|
@@ -128,6 +121,7 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
|
|
|
* @return Boolean
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean writeAssetsProduction(AssetsProduction assetsProduction) {
|
|
|
int count = this.count(new LambdaQueryWrapper<AssetsProduction>().select(AssetsProduction::getCreateProductionDate).eq(AssetsProduction::getProductionNo, assetsProduction.getProductionNo())
|
|
|
.eq(AssetsProduction::getId, assetsProduction.getId()));
|
|
@@ -136,6 +130,14 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
|
|
|
}
|
|
|
// 生成产品二维码
|
|
|
assetsProduction.setQrCode(businessProductionService.doCreateNormalCode(assetsProduction.getProductionType(), assetsProduction.getProductionNo()));
|
|
|
+ // 新增收款信息
|
|
|
+// AssetsProduction productionType = this.getOne(new LambdaQueryWrapper<AssetsProduction>()
|
|
|
+// .select(AssetsProduction::getProductionType)
|
|
|
+// .eq(AssetsProduction::getProductionNo, assetsProduction.getProductionNo())
|
|
|
+// .eq(AssetsProduction::getId, assetsProduction.getId()));
|
|
|
+// if (ObjectUtil.isNotNull(productionType) && !productionType.getProductionType().equals("STATEMENT")){
|
|
|
+ addAssetsShouldAmount(assetsProduction);
|
|
|
+// }
|
|
|
return assetsProductionMapper.writeAssetsProduction(assetsProduction);
|
|
|
}
|
|
|
|
|
@@ -174,13 +176,14 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
|
|
|
|
|
|
/**
|
|
|
* 根据业务id与产品号集合获取每个产品是否有提交过的流程实例信息
|
|
|
+ *
|
|
|
* @return List<Integer>
|
|
|
*/
|
|
|
@Override
|
|
|
public List<Integer> getInatanceCountList(AProListSelectDTO aProListSelectDTO) {
|
|
|
List<Integer> countList = new ArrayList<>();
|
|
|
- for (String productionNo : aProListSelectDTO.getProductionNos()){
|
|
|
- countList.add(assetsProductionMapper.getInatanceCountByIdAndProNo(aProListSelectDTO.getBusinessId(),productionNo));
|
|
|
+ for (String productionNo : aProListSelectDTO.getProductionNos()) {
|
|
|
+ countList.add(assetsProductionMapper.getInatanceCountByIdAndProNo(aProListSelectDTO.getBusinessId(), productionNo));
|
|
|
}
|
|
|
return countList;
|
|
|
}
|
|
@@ -251,4 +254,58 @@ public class AssetsProductionServiceImpl extends ServiceImpl<AssetsProductionMap
|
|
|
}
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据资产产品id更新文件路由信息
|
|
|
+ *
|
|
|
+ * @param assetsProduction 产品信息dto
|
|
|
+ * @return Boolean
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean updateProductionFileInfo(AssetsProduction assetsProduction) {
|
|
|
+ return assetsProductionMapper.updateProductionFileInfo(assetsProduction);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取产品实收款
|
|
|
+ *
|
|
|
+ * @param productionNo 产品号
|
|
|
+ * @return BigDecimal
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public BigDecimal getProductionRealAmount(String productionNo) {
|
|
|
+ return assetsProductionMapper.getProductionRealAmount(productionNo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增订单收款信息
|
|
|
+ * @param assetsProduction 资产订单信息
|
|
|
+ */
|
|
|
+ public void addAssetsShouldAmount(AssetsProduction assetsProduction){
|
|
|
+ // 从订单收款表获取应收款信息
|
|
|
+ OrderFund orderFund = new OrderFund();
|
|
|
+ orderFund = orderFundService.getOne(new LambdaQueryWrapper<OrderFund>()
|
|
|
+ .select(OrderFund::getOrderId, OrderFund::getShouldAmount)
|
|
|
+ .eq(OrderFund::getBusinessId, assetsProduction.getBusinessId())
|
|
|
+ .eq(OrderFund::getBusinessType, "ASSET_BUSINESS"));
|
|
|
+
|
|
|
+ if (ObjectUtil.isNotNull(orderFund) && ObjectUtil.isNotNull(orderFund.getShouldAmount())) {
|
|
|
+ ProductionFund productionFund = new ProductionFund();
|
|
|
+ productionFund.setOrderFundId(orderFund.getId());
|
|
|
+ productionFund.setProductionShouldAmount(orderFund.getShouldAmount());
|
|
|
+ productionFund.setProductionNo(assetsProduction.getProductionNo());
|
|
|
+ // 新增产品的收款信息
|
|
|
+ productionFundService.save(productionFund);
|
|
|
+ } else {
|
|
|
+ Assets assets = assetsService.getById(assetsProduction.getBusinessId());
|
|
|
+ orderFund.setBusinessId(assets.getId());
|
|
|
+ orderFund.setOrderId(assets.getOrderId());
|
|
|
+ orderFund.setOrderName(assets.getName());
|
|
|
+ orderFund.setBusinessType("ASSET_BUSINESS");
|
|
|
+ orderFund.setShouldAmount(BigDecimal.valueOf(0));
|
|
|
+ orderFundService.save(orderFund);
|
|
|
+ // 订单应收款新增后 继续调用方法添加产品收款信息
|
|
|
+ addAssetsShouldAmount(assetsProduction);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|