anderx пре 1 година
родитељ
комит
caefa52205

+ 1 - 0
src/main/java/com/goafanti/common/dao/TOrderNewMapper.java

@@ -176,5 +176,6 @@ public interface TOrderNewMapper {
 
     List<String> selectByDepAndProcess(@Param("depId") String depId, @Param("processStatus") Integer processStatus);
 
+    TOrderNew selectByTid(Integer tid);
 }
 

+ 1 - 1
src/main/java/com/goafanti/common/dao/TaskAnnualReportMapper.java

@@ -10,7 +10,7 @@ import java.util.List;
  * 项目年报(TaskAnnualReport)表数据库访问层
  *
  * @author makejava
- * @since 2024-12-26 10:53:48
+ * @since 2024-12-26 13:45:50
  */
 public interface TaskAnnualReportMapper {
 

+ 6 - 0
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -2681,6 +2681,12 @@
         where b.delete_sign in (0,2)
           and a.task_receiver = #{aid}
     </select>
+    <select id="selectByTid"  resultMap="TOrderNewMap">
+        select
+        <include refid="TOrderNewAllSql"/>
+        from t_order_new
+        where order_no in (select order_no from t_order_task where id = #{tid})
+    </select>
 
 </mapper>
 

+ 13 - 24
src/main/java/com/goafanti/common/mapper/TaskAnnualReportMapper.xml

@@ -9,13 +9,12 @@
         <result property="year" column="year" jdbcType="INTEGER"/>
         <result property="salesAmount" column="sales_amount" jdbcType="VARCHAR"/>
         <result property="researchAmount" column="research_amount" jdbcType="VARCHAR"/>
-        <result property="assets" column="assets" jdbcType="VARCHAR"/>
         <result property="aid" column="aid" jdbcType="VARCHAR"/>
         <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
     </resultMap>
 
     <sql id="TaskAnnualReportAllSql">
-        id, uid, tid, year, sales_amount, research_amount, assets, aid, create_time
+        id, uid, tid, year, sales_amount, research_amount, aid, create_time
     </sql>
 
     <!--查询单个-->
@@ -45,15 +44,12 @@
             <if test="year != null">
                 and year = #{year}
             </if>
-            <if test="salesAmount != null and salesAmount != ''">
+            <if test="salesAmount != null">
                 and sales_amount = #{salesAmount}
             </if>
-            <if test="researchAmount != null and researchAmount != ''">
+            <if test="researchAmount != null">
                 and research_amount = #{researchAmount}
             </if>
-            <if test="assets != null and assets != ''">
-                and assets = #{assets}
-            </if>
             <if test="aid != null and aid != ''">
                 and aid = #{aid}
             </if>
@@ -83,15 +79,12 @@
             <if test="year != null">
                 and year = #{year}
             </if>
-            <if test="salesAmount != null and salesAmount != ''">
+            <if test="salesAmount != null">
                 and sales_amount = #{salesAmount}
             </if>
-            <if test="researchAmount != null and researchAmount != ''">
+            <if test="researchAmount != null">
                 and research_amount = #{researchAmount}
             </if>
-            <if test="assets != null and assets != ''">
-                and assets = #{assets}
-            </if>
             <if test="aid != null and aid != ''">
                 and aid = #{aid}
             </if>
@@ -103,25 +96,25 @@
 
     <!--新增所有列-->
     <insert id="insert" keyProperty="id" useGeneratedKeys="true">
-        insert into task_annual_report(uid, tid, year, sales_amount, research_amount, assets, aid, create_time)
-        values (#{uid}, #{tid}, #{year}, #{salesAmount}, #{researchAmount}, #{assets}, #{aid}, #{createTime})
+        insert into task_annual_report(uid, tid, year, sales_amount, research_amount, aid, create_time)
+        values (#{uid}, #{tid}, #{year}, #{salesAmount}, #{researchAmount}, #{aid}, #{createTime})
     </insert>
 
     <insert id="insertBatch">
-        insert into task_annual_report(uid, tid, year, sales_amount, research_amount, assets, aid, create_time)
+        insert into task_annual_report(uid, tid, year, sales_amount, research_amount, aid, create_time)
         values
         <foreach collection="entities" item="entity" separator=",">
             (#{entity.uid}, #{entity.tid}, #{entity.year}, #{entity.salesAmount}, #{entity.researchAmount},
-            #{entity.assets}, #{entity.aid}, #{entity.createTime})
+            #{entity.aid}, #{entity.createTime})
         </foreach>
     </insert>
 
     <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
-        insert into task_annual_report(uid, tid, year, sales_amount, research_amount, assets, aid, create_time)
+        insert into task_annual_report(uid, tid, year, sales_amount, research_amount, aid, create_time)
         values
         <foreach collection="entities" item="entity" separator=",">
             (#{entity.uid}, #{entity.tid}, #{entity.year}, #{entity.salesAmount}, #{entity.researchAmount},
-            #{entity.assets}, #{entity.aid}, #{entity.createTime})
+            #{entity.aid}, #{entity.createTime})
         </foreach>
         on duplicate key update
         uid = values(uid),
@@ -129,7 +122,6 @@
         year = values(year),
         sales_amount = values(sales_amount),
         research_amount = values(research_amount),
-        assets = values(assets),
         aid = values(aid),
         create_time = values(create_time)
     </insert>
@@ -147,15 +139,12 @@
             <if test="year != null">
                 year = #{year},
             </if>
-            <if test="salesAmount != null and salesAmount != ''">
+            <if test="salesAmount != null">
                 sales_amount = #{salesAmount},
             </if>
-            <if test="researchAmount != null and researchAmount != ''">
+            <if test="researchAmount != null">
                 research_amount = #{researchAmount},
             </if>
-            <if test="assets != null and assets != ''">
-                assets = #{assets},
-            </if>
             <if test="aid != null and aid != ''">
                 aid = #{aid},
             </if>

+ 9 - 20
src/main/java/com/goafanti/common/model/TaskAnnualReport.java

@@ -1,6 +1,7 @@
 package com.goafanti.common.model;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 
 
@@ -8,10 +9,10 @@ import java.util.Date;
  * 项目年报(TaskAnnualReport)实体类
  *
  * @author makejava
- * @since 2024-12-26 10:53:48
+ * @since 2024-12-26 13:45:50
  */
 public class TaskAnnualReport implements Serializable {
-    private static final long serialVersionUID = -98384195143360440L;
+    private static final long serialVersionUID = 726853661805494653L;
 
     private Integer id;
     /**
@@ -29,15 +30,11 @@ public class TaskAnnualReport implements Serializable {
     /**
      * 销售额
      */
-    private String salesAmount;
+    private BigDecimal salesAmount;
     /**
      * 研发费用
      */
-    private String researchAmount;
-    /**
-     * 总资产
-     */
-    private String assets;
+    private BigDecimal researchAmount;
     /**
      * 录入人
      */
@@ -80,30 +77,22 @@ public class TaskAnnualReport implements Serializable {
         this.year = year;
     }
 
-    public String getSalesAmount() {
+    public BigDecimal getSalesAmount() {
         return salesAmount;
     }
 
-    public void setSalesAmount(String salesAmount) {
+    public void setSalesAmount(BigDecimal salesAmount) {
         this.salesAmount = salesAmount;
     }
 
-    public String getResearchAmount() {
+    public BigDecimal getResearchAmount() {
         return researchAmount;
     }
 
-    public void setResearchAmount(String researchAmount) {
+    public void setResearchAmount(BigDecimal researchAmount) {
         this.researchAmount = researchAmount;
     }
 
-    public String getAssets() {
-        return assets;
-    }
-
-    public void setAssets(String assets) {
-        this.assets = assets;
-    }
-
     public String getAid() {
         return aid;
     }

+ 10 - 0
src/main/java/com/goafanti/techproject/service/impl/TaskAnnualReportServiceImpl.java

@@ -1,13 +1,17 @@
 package com.goafanti.techproject.service.impl;
 
+import com.goafanti.common.dao.TOrderNewMapper;
 import com.goafanti.common.dao.TaskAnnualReportMapper;
+import com.goafanti.common.model.TOrderNew;
 import com.goafanti.common.model.TaskAnnualReport;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.techproject.service.TaskAnnualReportService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -21,6 +25,8 @@ import java.util.Map;
 public class TaskAnnualReportServiceImpl extends BaseMybatisDao<TaskAnnualReportMapper> implements TaskAnnualReportService {
     @Resource
     private TaskAnnualReportMapper taskAnnualReportMapper;
+    @Resource
+    private TOrderNewMapper tOrderNewMapper;
 
 
     @Override
@@ -51,6 +57,10 @@ public class TaskAnnualReportServiceImpl extends BaseMybatisDao<TaskAnnualReport
      */
     @Override
     public TaskAnnualReport insert(TaskAnnualReport taskAnnualReport) {
+        TOrderNew tOrderNew =tOrderNewMapper.selectByTid(taskAnnualReport.getTid());
+        taskAnnualReport.setAid(TokenManager.getAdminId());
+        taskAnnualReport.setUid(tOrderNew.getBuyerId());
+        taskAnnualReport.setCreateTime(new Date());
         this.taskAnnualReportMapper.insert(taskAnnualReport);
         return taskAnnualReport;
     }