Преглед изворни кода

1.完善机器设备生成与作价等功能

GouGengquan пре 7 месеци
родитељ
комит
2fa956593b

+ 1 - 1
biz-base/src/main/java/com/dayou/handler/GlobalException.java

@@ -64,7 +64,7 @@ public class GlobalException {
         else {
             // 其他异常
             log.error("Exception Message:",e);
-            return Result.build(Status.SYSTEM_ERROR,e.getMessage());
+            return Result.build(Status.SYSTEM_ERROR);
         }
     }
 }

+ 8 - 0
dao/src/main/java/com/dayou/mapper/AssetsCalculateMapper.java

@@ -54,4 +54,12 @@ public interface AssetsCalculateMapper extends BaseMapper<AssetsCalculate> {
      * @return AssetsCalculateVO
      */
     AssetsCalculateVO getCalculateInfoForDoc(@Param("calculateId") Long calculateId);
+
+    /**
+     * 根据测算表id获取基础测算信息
+     *
+     * @param calculateId 测算表id
+     * @return String
+     */
+    String getCalculateBaseInfo(@Param("calculateId") Long calculateId);
 }

+ 8 - 0
dao/src/main/java/com/dayou/mapper/DocumentProductionMapper.java

@@ -8,4 +8,12 @@ import org.apache.ibatis.annotations.Param;
 public interface DocumentProductionMapper extends BaseMapper<DocumentProduction> {
 
     Page<DocumentProduction> getPage(Page page, @Param("doc") DocumentProduction doc);
+
+    /**
+     * 通过业务id获取文档信息
+     * @param businessId 业务id
+     * @param businessSubId 业务二级id
+     * @return DocumentProduction
+     */
+    DocumentProduction getDocProdByBusinessId(@Param("businessId") Long businessId, @Param("businessSubId") Long businessSubId);
 }

+ 10 - 7
dao/src/main/resources/mapper/AssetsCalculateMapper.xml

@@ -25,16 +25,11 @@
 
     <!--根据项目id和进度名获取测算表基本信息-->
     <select id="getCalculateProgress" resultType="com.dayou.vo.calculate.AssetsCalculateProgressVO">
-        SELECT id, project_id, calculate_name, progress
+        SELECT id, project_id, calculate_name, progress, valuation_basis_date
         FROM assets_calculate
         WHERE delete_status = 0
         AND progress != 'FINISHED'
-        <if test="projectId != null">
-            AND project_id = #{projectId}
-        </if>
-        <if test="calculateId != null">
-            AND project_id = #{calculateId}
-        </if>
+        AND project_id = #{projectId}
     </select>
 
     <!--通过id更新测算表进度-->
@@ -87,5 +82,13 @@
         AND calculate.id = #{calculateId}
     </select>
 
+    <!--根据测算表id获取基础测算信息-->
+    <select id="getCalculateBaseInfo" resultType="java.lang.String">
+        SELECT base_info
+        FROM assets_calculate
+        WHERE delete_status = 0
+        AND id = #{calculateId}
+    </select>
+
 
 </mapper>

+ 11 - 0
dao/src/main/resources/mapper/DocumentProductionMapper.xml

@@ -24,4 +24,15 @@
             AND delete_status = 0 ORDER by update_time DESC
     </select>
 
+    <!--通过业务id获取文档信息-->
+    <select id="getDocProdByBusinessId" resultType="com.dayou.entity.DocumentProduction">
+        SELECT id, business_type, business_id, doc_type, doc_no, doc_name, consignor, doc_url, doc_version, is_active, create_user_id, create_time, update_time, delete_status, business_cate, business_sub_id
+        FROM document_production
+        WHERE delete_status = 0
+        AND business_id = #{businessId}
+        <if test="businessSubId != null">
+            AND business_sub_id = #{businessSubId}
+        </if>
+    </select>
+
 </mapper>

+ 0 - 129
domain/src/main/java/com/dayou/dto/calculate/equipment/EquipmentInfoDTO.java

@@ -1,129 +0,0 @@
-package com.dayou.dto.calculate.equipment;
-
-import lombok.Data;
-
-import java.time.LocalDate;
-
-/**
- * 机器设备-主模板-详细信息
- */
-@Data
-public class EquipmentInfoDTO {
-
-    /**
-     * 序号
-     */
-    private Integer id;
-
-    /**
-     * 设备名称
-     */
-    private String equipmentName;
-
-    /**
-     * 生产厂家
-     */
-    private String manufacturer;
-
-    /**
-     * 型号规格
-     */
-    private String model;
-
-    /**
-     * 购买日期
-     */
-    private LocalDate purchaseDate;
-
-    /**
-     * 启动日期
-     */
-    private LocalDate activationDate;
-
-    /**
-     * 数量
-     */
-    private Integer quantity;
-
-    /**
-     * 计量单位
-     */
-    private String unitOfMeasurement;
-
-    /**
-     * 账面原值
-     */
-    private Double originalValue;
-
-    /**
-     * 账面净值
-     */
-    private Double netValue;
-
-    /**
-     * 含税单价
-     */
-    private Double taxedUnitPrice;
-
-    /**
-     * 税率
-     */
-    private Double taxRate;
-
-    /**
-     * 备注
-     */
-    private String remark;
-
-    /**
-     * 经济使用年数
-     */
-    private Integer economicServiceLife;
-
-    /**
-     * 直接观察成新率
-     */
-    private Double directObservationDepreciationRate;
-
-    /**
-     * 设备类型
-     */
-    private String equipmentType;
-
-    /**
-     * 作价方法
-     */
-    private String valuationMethod;
-
-    /**
-     * 询价依据
-     */
-    private String inquiryBasis;
-
-    /**
-     * 询价地点
-     */
-    private String inquiryLocation;
-
-    /**
-     * 单价
-     */
-    private Double price;
-
-    /**
-     * 运杂费率
-     */
-    private Double freightAndMiscellaneousFeeRate;
-
-    /**
-     * 基础费率
-     */
-    private Double baseRate;
-
-    /**
-     * 安装费率
-     */
-    private Double installationRate;
-
-
-}

+ 0 - 98
domain/src/main/java/com/dayou/dto/calculate/equipment/ImportedEquipmentInfoDTO.java

@@ -1,98 +0,0 @@
-package com.dayou.dto.calculate.equipment;
-
-import lombok.Data;
-
-import java.time.LocalDate;
-
-/**
- * 机器设备-进口设备测算-详细信息-段落模板
- */
-@Data
-public class ImportedEquipmentInfoDTO {
-
-    /**
-     * 序号
-     */
-    private Integer sortId;
-
-    /**
-     * 设备名称
-     */
-    private String equipmentName;
-
-    /**
-     * 生产厂家
-     */
-    private String manufacturer;
-
-    /**
-     * 型号规格
-     */
-    private String model;
-
-    /**
-     * 数量
-     */
-    private Integer quantity;
-
-    /**
-     * 计量单位
-     */
-    private String unitOfMeasurement;
-
-    /**
-     * 购买日期
-     */
-    private LocalDate purchaseDate;
-
-    /**
-     * 启用日期
-     */
-    private LocalDate activationDate;
-
-    /**
-     * 取价依据
-     */
-    private String pricingBasis;
-
-    /**
-     * 基准日汇率中间价
-     */
-    private Double centralParityRate;
-
-    /**
-     * 商品编号
-     */
-    private String productCode;
-
-    /**
-     * 币种
-     */
-    private String currency;
-
-    /**
-     * 地址
-     */
-    private String address;
-
-    /**
-     * 成交方式
-     */
-    private String transactionMethod;
-
-    /**
-     * 合同金额
-     */
-    private Double contractAmount;
-
-    /**
-     * 合同签订日期
-     */
-    private LocalDate contractSigningDate;
-
-    /**
-     * 到岸港口
-     */
-    private String destinationPort;
-
-}

+ 0 - 23
domain/src/main/java/com/dayou/dto/calculate/equipment/NonStandardEquipmentBaseDTO.java

@@ -1,23 +0,0 @@
-package com.dayou.dto.calculate.equipment;
-
-import lombok.Data;
-
-import java.time.LocalDate;
-
-/**
- * 机器设备-非标设备测算-段落模板
- */
-@Data
-public class NonStandardEquipmentBaseDTO {
-
-    /**
-     * 测算名
-     */
-    private String calculateName;
-
-    /**
-     * 评估基准日
-     */
-    private LocalDate valuationBasisDate;
-
-}

+ 0 - 123
domain/src/main/java/com/dayou/dto/calculate/equipment/NonStandardEquipmentInfoDTO.java

@@ -1,123 +0,0 @@
-package com.dayou.dto.calculate.equipment;
-
-import lombok.Data;
-
-import java.time.LocalDate;
-
-/**
- * 机器设备-非标设备测算-详细信息-段落模板
- */
-@Data
-public class NonStandardEquipmentInfoDTO {
-
-    /**
-     * 序号
-     */
-    private Integer id;
-
-    /**
-     * 设备编号
-     */
-    private String equipmentNumber;
-
-    /**
-     * 设备名称
-     */
-    private String equipmentName;
-
-    /**
-     * 型号规格
-     */
-    private String model;
-
-    /**
-     * 生产厂家
-     */
-    private String manufacturer;
-
-    /**
-     * 所属系统/生产线名称
-     */
-    private String affiliatedSystem;
-
-    /**
-     * 计量单位
-     */
-    private String unitOfMeasurement;
-
-    /**
-     * 数量
-     */
-    private Integer quantity;
-
-    /**
-     * 购买日期
-     */
-    private LocalDate purchaseDate;
-
-    /**
-     * 启用日期
-     */
-    private LocalDate activationDate;
-
-    /**
-     * 原值
-     */
-    private Double originalValue;
-
-    /**
-     * 净值
-     */
-    private Double netValue;
-
-    /**
-     * 备注
-     */
-    private String remark;
-
-    /**
-     * 价格来源
-     */
-    private String priceSource;
-
-    /**
-     * 询价地点
-     */
-    private String inquiryLocation;
-
-    /**
-     * 主材费/设备报价(含税不含运费不含安装调试费)
-     */
-    private Double mainMaterialCost;
-
-    /**
-     * 不含主要外购件费的成本主材费率
-     */
-    private Double mainMaterialCostRate;
-
-    /**
-     * 主要外购件费
-     */
-    private Double mainPurchasedPartsCost;
-
-    /**
-     * 成本利润率
-     */
-    private Double costProfitRatio;
-
-    /**
-     * 销售税金率
-     */
-    private Double salesTaxRate;
-
-    /**
-     * 非标准设备设计费率
-     */
-    private Double designFeeRate;
-
-    /**
-     * 增值税率
-     */
-    private Double VATRate;
-
-}

+ 7 - 0
domain/src/main/java/com/dayou/vo/calculate/AssetsCalculateProgressVO.java

@@ -2,6 +2,8 @@ package com.dayou.vo.calculate;
 
 import lombok.Data;
 
+import java.time.LocalDate;
+
 /**
  * 测算表进度信息
  */
@@ -28,4 +30,9 @@ public class AssetsCalculateProgressVO {
      */
     private String progress;
 
+    /**
+     * 评估基准日
+     */
+    private LocalDate valuationBasisDate;
+
 }

+ 10 - 2
service/src/main/java/com/dayou/service/DocumentProductionService.java

@@ -10,9 +10,17 @@ public interface DocumentProductionService extends IService<DocumentProduction>
     Page<DocumentProduction> getPage(DocumentProduction documentProduction, Page page);
 
     /**
-     * 新增文档信息
+     * 保存文档信息
      * @param documentProduction 文档信息
      * @return Boolean
      */
-    Boolean addDocumentProduction(DocumentProduction documentProduction);
+    Boolean saveDocumentProduction(DocumentProduction documentProduction);
+
+    /**
+     * 通过业务id获取文档信息
+     * @param businessId 业务id
+     * @param businessSubId 业务二级id
+     * @return DocumentProduction
+     */
+    DocumentProduction getDocProdByBusinessId(Long businessId, Long businessSubId);
 }

+ 17 - 10
service/src/main/java/com/dayou/service/impl/AssetsCalculateServiceImpl.java

@@ -163,8 +163,10 @@ public class AssetsCalculateServiceImpl extends ServiceImpl<AssetsCalculateMappe
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean updateCalculateBaseInfo(Long calculateId, String baseInfo) {
-        // 更新测算表进度
-        assetsCalculateMapper.updateCalculateProgress(calculateId, "IMPORT");
+        // 如果baseInfo为null说明是第一次进行填写测算基本信息的操作,则更新测算表进度
+        if (ObjectUtil.isNull(getCalculateBaseInfo(calculateId))) {
+            assetsCalculateMapper.updateCalculateProgress(calculateId, "IMPORT");
+        }
         return assetsCalculateMapper.updateCalculateBaseInfo(calculateId, baseInfo);
     }
 
@@ -354,8 +356,16 @@ public class AssetsCalculateServiceImpl extends ServiceImpl<AssetsCalculateMappe
 
         // 保存文档信息到数据库
         AssetsCalculateVO assetsCalculateVO = assetsCalculateMapper.getCalculateInfoForDoc(calculateId);
-        DocumentProduction documentProduction = new DocumentProduction()
-                .setBusinessType("ASSETS")
+        // 设置文档信息
+        DocumentProduction documentProduction = documentProductionService.getDocProdByBusinessId(assetsCalculateVO.getProjectId(), calculateId);
+
+        if (ObjectUtil.isNotNull(documentProduction)) { // 判断文档信息是否为空,不为空说明以前生成过文档,则更新文档版本号
+            documentProduction.setDocVersion(documentProduction.getDocVersion() + 1);
+        } else { // 为空重新new对象
+            documentProduction = new DocumentProduction();
+        }
+        // 设置文档信息
+        documentProduction.setBusinessType("ASSETS")
                 .setBusinessId(assetsCalculateVO.getProjectId())
                 .setDocType(EQPT_CALCULATE.getName())
                 .setDocName(assetsCalculateVO.getCalculateName() + ".xlsx")
@@ -365,7 +375,8 @@ public class AssetsCalculateServiceImpl extends ServiceImpl<AssetsCalculateMappe
                 .setBusinessCate(assetsCalculateVO.getProjectTypeName())
                 .setDocNo("")
                 .setBusinessSubId(calculateId);
-        return documentProductionService.addDocumentProduction(documentProduction);
+
+        return documentProductionService.saveDocumentProduction(documentProduction);
     }
 
     /**
@@ -376,11 +387,7 @@ public class AssetsCalculateServiceImpl extends ServiceImpl<AssetsCalculateMappe
      */
     @Override
     public String getCalculateBaseInfo(Long calculateId) {
-        return assetsCalculateMapper.selectOne(new LambdaQueryWrapper<AssetsCalculate>()
-                        .select(AssetsCalculate::getBaseInfo)
-                        .eq(BaseEntity::getId, calculateId)
-                        .eq(BaseEntity::getDeleteStatus, 0))
-                .getBaseInfo();
+        return assetsCalculateMapper.getCalculateBaseInfo(calculateId);
     }
 
     /**

+ 19 - 3
service/src/main/java/com/dayou/service/impl/DocumentProductionServiceImpl.java

@@ -1,5 +1,6 @@
 package com.dayou.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.dayou.entity.DocumentProduction;
@@ -21,12 +22,27 @@ public class DocumentProductionServiceImpl extends ServiceImpl<DocumentProductio
     }
 
     /**
-     * 新增文档信息
+     * 保存文档信息
      * @param documentProduction 文档信息
      * @return Boolean
      */
     @Override
-    public Boolean addDocumentProduction(DocumentProduction documentProduction) {
-        return this.save(documentProduction);
+    public Boolean saveDocumentProduction(DocumentProduction documentProduction) {
+        if (ObjectUtil.isNotNull(documentProduction.getId())) {
+            return this.updateById(documentProduction);
+        }else {
+            return this.save(documentProduction);
+        }
+    }
+
+    /**
+     * 通过业务id获取文档信息
+     * @param businessId 业务id
+     * @param businessSubId 业务二级id
+     * @return DocumentProduction
+     */
+    @Override
+    public DocumentProduction getDocProdByBusinessId(Long businessId, Long businessSubId) {
+        return documentProductionMapper.getDocProdByBusinessId(businessId, businessSubId);
     }
 }

+ 19 - 0
sql/update_sql.sql

@@ -568,3 +568,22 @@ ALTER TABLE assets_calculate_eqpt_imp_data MODIFY COLUMN id bigint(20) NOT NULL
  */
 ALTER TABLE document_production ADD COLUMN business_sub_id bigint(20) NULL COMMENT '业务二级id';
 
+/**
+  日期:2024-12-04
+  修改人:苟耕铨
+  未更新到test-env
+ */
+CREATE TABLE `assets_report` (
+                                 `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '资产项目报告id',
+                                 `project_id` bigint(20) NOT NULL COMMENT '资产项目id',
+                                 `report_name` varchar(255) DEFAULT NULL COMMENT '报告名',
+                                 `base_info` json DEFAULT NULL COMMENT '基础报告信息',
+                                 `create_user_id` bigint(20) DEFAULT NULL COMMENT '报告创建者user_id',
+                                 `progress` varchar(128) NOT NULL COMMENT '报告生成进度(BASE、GENERATE、FINISHED)',
+                                 `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+                                 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+                                 `delete_status` bit(1) NOT NULL DEFAULT b'0' COMMENT '删除状态',
+                                 PRIMARY KEY (`id`),
+                                 KEY `project_id` (`project_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='资产项目报告信息表';
+