|
@@ -10,15 +10,26 @@ import com.fjhx.account.entity.account.po.AccountPayment;
|
|
|
import com.fjhx.account.entity.account.po.AccountSubjects;
|
|
|
import com.fjhx.account.entity.calculate.po.CalculateItem;
|
|
|
import com.fjhx.account.entity.calculate.vo.CalculateItemVo;
|
|
|
+import com.fjhx.account.service.account.AccountManagementService;
|
|
|
import com.fjhx.account.service.account.AccountPaymentService;
|
|
|
import com.fjhx.account.service.account.AccountSubjectsService;
|
|
|
import com.fjhx.account.service.calculate.CalculateItemService;
|
|
|
import com.fjhx.account.service.payee.PayeeInfoService;
|
|
|
import com.fjhx.account.service.payment.PaymentTypeService;
|
|
|
import com.fjhx.common.controller.Label;
|
|
|
+import com.fjhx.common.entity.art.po.ArtCopyright;
|
|
|
+import com.fjhx.common.entity.contractor.po.Contractor;
|
|
|
+import com.fjhx.common.entity.logistics.po.LogisticsCompanyInfo;
|
|
|
+import com.fjhx.common.entity.patent.po.Patent;
|
|
|
+import com.fjhx.common.entity.trademark.po.Trademark;
|
|
|
import com.fjhx.common.enums.FlowStatusEnum1;
|
|
|
+import com.fjhx.common.service.art.ArtCopyrightService;
|
|
|
+import com.fjhx.common.service.contractor.ContractorService;
|
|
|
import com.fjhx.common.service.logistics.LogisticsCompanyInfoService;
|
|
|
+import com.fjhx.common.service.patent.PatentService;
|
|
|
+import com.fjhx.common.service.trademark.TrademarkService;
|
|
|
import com.fjhx.common.utils.Assert;
|
|
|
+import com.fjhx.customer.entity.customer.po.Customer;
|
|
|
import com.fjhx.customer.service.customer.CustomerService;
|
|
|
import com.fjhx.file.utils.ObsFileUtil;
|
|
|
import com.fjhx.flow.entity.flow.po.FlowExample;
|
|
@@ -34,21 +45,25 @@ import com.fjhx.form.entity.cost.vo.CostControlVo;
|
|
|
import com.fjhx.form.mapper.cost.CostControlMapper;
|
|
|
import com.fjhx.form.service.cost.CostControlDetailService;
|
|
|
import com.fjhx.form.service.cost.CostControlService;
|
|
|
+import com.fjhx.jushuitan.entity.shop.po.ShopInfo;
|
|
|
import com.fjhx.jushuitan.service.shop.ShopInfoService;
|
|
|
import com.fjhx.sale.entity.contract.po.Contract;
|
|
|
import com.fjhx.sale.entity.contract.vo.ContractOutboundInfoVo;
|
|
|
import com.fjhx.sale.service.contract.ContractOutboundInfoService;
|
|
|
import com.fjhx.sale.service.contract.ContractService;
|
|
|
+import com.fjhx.supply.entity.supplier.po.SupplierInfo;
|
|
|
import com.fjhx.supply.service.supplier.SupplierInfoService;
|
|
|
import com.fjhx.wms.entity.stock.po.StockJournalDetails;
|
|
|
import com.fjhx.wms.service.stock.StockJournalDetailsService;
|
|
|
import com.ruoyi.common.core.domain.BaseIdPo;
|
|
|
import com.ruoyi.common.core.domain.BasePo;
|
|
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
|
|
+import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import com.ruoyi.common.utils.wrapper.SqlField;
|
|
|
import com.ruoyi.system.service.ISysDeptService;
|
|
|
+import com.ruoyi.system.service.ISysUserService;
|
|
|
import com.ruoyi.system.utils.UserUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -99,6 +114,18 @@ public class CostControlServiceImpl extends ServiceImpl<CostControlMapper, CostC
|
|
|
private PayeeInfoService payeeInfoService;
|
|
|
@Autowired
|
|
|
private AccountSubjectsService accountSubjectsService;
|
|
|
+ @Autowired
|
|
|
+ private AccountManagementService accountManagementService;
|
|
|
+ @Autowired
|
|
|
+ private PatentService patentService;
|
|
|
+ @Autowired
|
|
|
+ private ISysUserService sysUserService;
|
|
|
+ @Autowired
|
|
|
+ private ContractorService contractorService;
|
|
|
+ @Autowired
|
|
|
+ private ArtCopyrightService artCopyrightService;
|
|
|
+ @Autowired
|
|
|
+ private TrademarkService trademarkService;
|
|
|
|
|
|
@Override
|
|
|
public Page<CostControlVo> getPage(CostControlSelectDto dto) {
|
|
@@ -190,10 +217,9 @@ public class CostControlServiceImpl extends ServiceImpl<CostControlMapper, CostC
|
|
|
List<Long> ccdIds = costControlDetailVos.stream().map(CostControlDetail::getId).collect(Collectors.toList());
|
|
|
List<CalculateItemVo> ciList = calculateItemService.getList(IWrapper.getWrapper().in(CalculateItem::getCostControlDetailId, ccdIds));
|
|
|
if (ObjectUtil.isNotEmpty(ciList)) {
|
|
|
- //赋值客户信息
|
|
|
- customerService.attributeAssign(ciList, CalculateItem::getBusinessId, (item, customer) -> {
|
|
|
- item.setCustomerName(customer.getName());
|
|
|
- });
|
|
|
+ //赋值核算项目名称
|
|
|
+ setCalculateItemInfo(ciList);
|
|
|
+
|
|
|
ciMap = ciList.stream().collect(Collectors.groupingBy(CalculateItem::getCostControlDetailId));
|
|
|
}
|
|
|
//赋值记账科目信息
|
|
@@ -220,7 +246,84 @@ public class CostControlServiceImpl extends ServiceImpl<CostControlMapper, CostC
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void setCalculateItemInfo(List<CalculateItemVo> ciList) {
|
|
|
+ for (CalculateItemVo calculateItemVo : ciList) {
|
|
|
+ switch (calculateItemVo.getType()) {
|
|
|
+ case "部门":
|
|
|
+ case "核算中心":
|
|
|
+ SysDept dept = sysDeptService.getById(calculateItemVo.getBusinessId());
|
|
|
+ if (ObjectUtil.isNotEmpty(dept)) {
|
|
|
+ calculateItemVo.setBusinessName(dept.getDeptName());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "专利":
|
|
|
+ Patent patent = patentService.getById(calculateItemVo.getBusinessId());
|
|
|
+ if (ObjectUtil.isNotEmpty(patent)) {
|
|
|
+ calculateItemVo.setBusinessName(patent.getName());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "快递公司":
|
|
|
+ LogisticsCompanyInfo logisticsCompanyInfo = logisticsCompanyInfoService.getById(calculateItemVo.getBusinessId());
|
|
|
+ if (ObjectUtil.isNotEmpty(logisticsCompanyInfo)) {
|
|
|
+ calculateItemVo.setBusinessName(logisticsCompanyInfo.getName());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "股东":
|
|
|
+ case "职员":
|
|
|
+ SysUser user = sysUserService.getById(calculateItemVo.getBusinessId());
|
|
|
+ if (ObjectUtil.isNotEmpty(user)) {
|
|
|
+ calculateItemVo.setBusinessName(user.getUserName());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "承包商":
|
|
|
+ Contractor contractor = contractorService.getById(calculateItemVo.getBusinessId());
|
|
|
+ if (ObjectUtil.isNotEmpty(contractor)) {
|
|
|
+ calculateItemVo.setBusinessName(contractor.getName());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "客户":
|
|
|
+ Customer customer = customerService.getById(calculateItemVo.getBusinessId());
|
|
|
+ if (ObjectUtil.isNotEmpty(customer)) {
|
|
|
+ calculateItemVo.setBusinessName(customer.getName());
|
|
|
+ calculateItemVo.setCustomerName(customer.getName());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "店铺":
|
|
|
+ ShopInfo shopInfo = shopInfoService.getById(calculateItemVo.getBusinessId());
|
|
|
+ if (ObjectUtil.isNotEmpty(shopInfo)) {
|
|
|
+ calculateItemVo.setBusinessName(shopInfo.getName());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "供应商":
|
|
|
+ SupplierInfo supplierInfo = supplierInfoService.getById(calculateItemVo.getBusinessId());
|
|
|
+ if (ObjectUtil.isNotEmpty(supplierInfo)) {
|
|
|
+ calculateItemVo.setBusinessName(supplierInfo.getName());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "美术版权":
|
|
|
+ ArtCopyright artCopyright = artCopyrightService.getById(calculateItemVo.getBusinessId());
|
|
|
+ if (ObjectUtil.isNotEmpty(artCopyright)) {
|
|
|
+ calculateItemVo.setBusinessName(artCopyright.getName());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "商标":
|
|
|
+ Trademark trademark = trademarkService.getById(calculateItemVo.getBusinessId());
|
|
|
+ if (ObjectUtil.isNotEmpty(trademark)) {
|
|
|
+ calculateItemVo.setBusinessName(trademark.getName());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ calculateItemVo.setBusinessName("未知核算项目!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void setInfo(List<CostControlVo> costControlVos) {
|
|
|
+ //赋值收款账户
|
|
|
+ accountManagementService.attributeAssign(costControlVos, CostControlVo::getAccountPaymentId, (detail, accountManagement) -> {
|
|
|
+ detail.setPaymentAccountManagementName(accountManagement.getName());
|
|
|
+ });
|
|
|
+
|
|
|
//赋值收付款方式
|
|
|
paymentTypeService.attributeAssign(costControlVos, CostControlVo::getCostType, (detail, paymentType) -> {
|
|
|
detail.setCostTypeName(paymentType.getName());
|
|
@@ -243,7 +346,11 @@ public class CostControlServiceImpl extends ServiceImpl<CostControlMapper, CostC
|
|
|
}
|
|
|
for (CostControlVo costControlVo : costControlVos) {
|
|
|
//归属公司、部门
|
|
|
- costControlVo.setCompanyName(deptMap.get(costControlVo.getCompanyId()));
|
|
|
+ List<String> companyNameList = new ArrayList<>();
|
|
|
+ for (String companyIdStr : costControlVo.getCompanyId().split(",")) {
|
|
|
+ companyNameList.add(deptMap.getOrDefault(Long.valueOf(companyIdStr), companyIdStr));
|
|
|
+ }
|
|
|
+ costControlVo.setCompanyName(companyNameList.stream().collect(Collectors.joining(",")));
|
|
|
costControlVo.setDeptName(deptMap.get(costControlVo.getDeptId()));
|
|
|
}
|
|
|
}
|