Просмотр исходного кода

新增订单项目数据统计表开发

anderx 1 год назад
Родитель
Сommit
1d2fd0e6e3

+ 149 - 14
src/main/java/com/goafanti/common/mapper/TOrderTaskMapper.xml

@@ -2514,23 +2514,158 @@
   <select id="selectStatisticsOrderProject" resultType="com.goafanti.order.bo.OutOrderProject">
     SELECT a.order_no as orderNo, a.order_type orderType,a.sales_type as salesType,b.service_type AS serviceType,a.liquidation_status as liquidationStatus,
            b2.big_customer as bigCustomer, b.dun_node_content as dunNodeContent,b.project_type as projectType, a.total_amount as totalAmount,a.approval ,a.sign_time as signTime,
-           a.create_time as createTime,b.buyer_name as buyerName,a.contract_no as contractNo, d.bname htlx,b.order_receivables orderReceivables,
+           a.create_time as createTime,b.buyer_name as buyerName,a.contract_no as contractNo, d.bname htlx,b.order_receivables orderReceivables,a.refund_amount refundAmount,
            a.settlement_amount as settlementAmount,b.invoice_amount as invicueAmount, b.cost_amount as costAmount,b.payment_amount as paymentAmount,
-           b.finance_name as financeName,b.salesman_name as salesmanName, e.commodity_name as commodityName,e2.service_year as serviceYear,
-           e2.service_life as serviceLife,e2.year_sum as yearSum,e.task_distribution_time as taskDistributionTime ,e.commodity_quantity as commodityQuantity,
+           b.finance_name as financeName,b.salesman_name as salesmanName, e.commodity_name as commodityName,ttm.service_year as serviceYear,
+           ttm.service_life as serviceLife,ttm.year_sum as yearSum,e.task_distribution_time as taskDistributionTime ,e.commodity_quantity as commodityQuantity,
            e3.cost_amount as costAmount,e.project_status as  projectStatus,e.task_start_time as taskStartTime,e.task_end_time as taskEndTime,
-           e.receiver_name as receiverName ,'技术组',t1.cb,a.order_status orderStatus,e.satisfaction_degree satisfactionDegree,
-      e.task_comment taskComment,'核算比例',a.order_status orderStatus,t1.counts,t1.tdtk,a3.name depName,a4.name province
+           e.receiver_name as receiverName ,'技术组',t1.cb restatement,a.order_status orderStatus,e.satisfaction_degree satisfactionDegree,
+      e.task_comment taskComment,'核算比例',a.order_status orderStatus,t1.counts,t1.tdtk refundType,a3.name depName,a4.name as  province
     from t_order_new a left join t_order_mid b on a.order_no =b.order_no
         left join admin a2 on a.salesman_id=a2.id left join department a3 on a2.department_id=a3.id
-        left join district_glossory a4 on a3.province=a4.id
-        left join user_mid b2 on a.buyer_id=b2.uid
-                       left join t_order_task c on a.order_no =c.order_no and c.main =1
-                       left join business_project d on c.commodity_id =d.id left join business_category d2 on d.cid =d2.id
-                       left join t_order_task e on a.order_no =e.order_no and e.split_status in (0,2)
-                       left join t_task_member e2 on e.id =e2.tid left join t_task_mid e3 on e.id =e3.tid
-                       left join (SELECT order_no ,count(*)counts,sum(if(`type`=0,1,0))tdtk,sum(if(`type`=4,1,0))cb
-                                  from new_order_change group by order_no ) t1 on a.order_no =t1.order_no
-    where a.process_status >6
+        left join district_glossory a4 on a3.province=a4.id left join user_mid b2 on a.buyer_id=b2.uid
+        left join t_order_task c on a.order_no =c.order_no and c.main =1
+        left join business_project d on c.commodity_id =d.id left join business_category d2 on d.cid =d2.id
+        left join t_order_task e on a.order_no =e.order_no and e.split_status in (0,2)
+        left join admin e2 on e.task_receiver=e2.id left join t_task_mid e3 on e.id=e3.tid
+        left join t_task_member ttm on e.id =ttm.tid
+        left join (SELECT order_no ,count(*)counts,sum(if(`type`=0,1,0))tdtk,sum(if(`type`=4,1,0))cb
+            from new_order_change group by order_no ) t1 on a.order_no =t1.order_no
+    <if test="dunType !=null">
+      left join new_order_dun nod  on e.id=nod.tid
+    </if>
+    where a.process_status >6 and a.delete_sign in (0,2)
+    <if test="orderNo !=null">
+      and a.order_no like CONCAT('%',#{orderNo},'%')
+    </if>
+    <if test="contractNo !=null">
+      and a.contract_no like CONCAT('%',#{contractNo},'%')
+    </if>
+    <if test="userName !=null">
+      and b.buyer_name like CONCAT('%',#{userName},'%')
+    </if>
+    <if test="businessCategory !=null">
+      and d2.id = #{businessCategory}
+    </if>
+    <if test="projectName !=null">
+      and d.commodity_name like CONCAT('%',#{projectName},'%')
+    </if>
+    <if test="orderAmountType==1">
+      and a.total_amount &lt; 10
+    </if>
+    <if test="orderAmountType==2">
+      and a.total_amount &gt;= 10 and a.total_amount &lt; 20
+    </if>
+    <if test="orderAmountType==3">
+      and a.total_amount &gt;= 20 and a.total_amount &lt; 30
+    </if>
+    <if test="orderAmountType==4">
+      and a.total_amount &gt;= 30 and a.total_amount &lt; 40
+    </if>
+    <if test="orderAmountType==5">
+      and a.total_amount &gt;= 40
+    </if>
+    <if test="depId !=null">
+      and a3.id = #{depId}
+    </if>
+    <if test="liabilitiesDepId !=null">
+      and e2.department_id = #{liabilitiesDepId}
+    </if>
+    <if test="declarationBatch !=null">
+      and e.declaration_batch = #{declarationBatch}
+    </if>
+    <if test="projectAmountType==1">
+      and e.commodity_price &lt; 1
+    </if>
+    <if test="projectAmountType==2">
+      and e.commodity_price &gt;= 1 and e.commodity_price &lt; 5
+    </if>
+    <if test="projectAmountType==3">
+      and e.commodity_price &gt;= 5 and e.commodity_price &lt; 10
+    </if>
+    <if test="projectAmountType==4">
+      and e.commodity_price &gt;= 10 and e.commodity_price &lt; 20
+    </if>
+    <if test="projectAmountType==5">
+      and e.commodity_price &gt;= 20
+    </if>
+    <if test="projectStatus !=null">
+      and e.project_status = #{projectStatus}
+    </if>
+    <if test="satisfactionDegree !=null">
+      and e.satisfaction_degree = #{satisfactionDegree}
+    </if>
+    <if test="startDate !=null and endDate !=null">
+      and a.create_time BETWEEN #{startDate} and #{endDate}
+    </if>
+    <if test="signStartDate !=null and signEndDate !=null">
+      and a.sign_time BETWEEN #{signStartDate} and #{signEndDate}
+    </if>
+    <if test="projectStartDate !=null and projectEndDate !=null">
+      and e.task_distribution_time BETWEEN #{projectStartDate} and #{projectEndDate}
+    </if>
+    <if test="salesType !=null">
+      and a.sales_type = #{salesType}
+    </if>
+    <if test="serviceType !=null">
+      and find_in_set(b.service_type,#{serviceType})
+    </if>
+    <if test="liquidationStatus !=null">
+      and a.liquidation_status = #{liquidationStatus}
+    </if>
+    <if test="dunType !=null">
+      and nod.dun_type = #{dunType}
+    </if>
+    <if test="province !=null">
+      and a4.id = #{province}
+    </if>
+    <if test="salesmanId !=null">
+      and a.salesman_id = #{salesmanId}
+    </if>
+    <if test="financeId !=null">
+      and a.finance_id = #{financeId}
+    </if>
+    <if test="techId !=null">
+      and e.task_receiver =#{techId}
+    </if>
+    <if test="approval ==0">
+      and a.approval = 0
+    </if>
+    <if test="approval ==1">
+      and a.approval > 0
+    </if>
+    <if test="projectType !=null">
+      and b.project_type = #{projectType}
+    </if>
+    <if test="bigCustomer !=null">
+      and b2.big_customer = #{bigCustomer}
+    </if>
+    <if test="restatement ==0">
+     and t1.cb = 0
+    </if>
+    <if test="restatement ==1">
+      and t1.cb > 0
+    </if>
+    <if test="changeType ==0">
+      and t1.counts is null
+    </if>
+    <if test="changeType ==1">
+      and t1.counts >0
+    </if>
+    <if test="refundType ==0">
+      and (t1.tdtk = 0 or t1.tdtk is null)
+    </if>
+    <if test="refundType ==1">
+      and t1.tdtk >0
+    </if>
+    <if test="orderType ==0">
+      and a.order_type  in(0,2)
+    </if>
+    <if test="orderType ==1">
+      and a.order_type  in(1)
+    </if>
+    <if test="projectCompleteStartTime !=null and projectCompleteEndTime !=null">
+      and e.task_end_time BETWEEN #{projectCompleteStartTime} and #{projectCompleteEndTime}
+    </if>
   </select>
 </mapper>

+ 26 - 26
src/main/java/com/goafanti/order/bo/InputOrderProject.java

@@ -37,7 +37,7 @@ public class InputOrderProject {
     /**
      * 申报批次
      */
-    private Integer effectiveCount;
+    private Integer declarationBatch;
     /**
      * 项目金额类型 1=1万以下,2=1-5万,3=5-10万,4=10-20万,5=20万以上
      */
@@ -98,15 +98,15 @@ public class InputOrderProject {
     /**
      * 财务负责人
      */
-    private String financeName;
+    private String financeId;
     /**
      * 营销负责人
      */
-    private String salesmanName;
+    private String salesmanId;
     /**
      * 技术负责人
      */
-    private String techName;
+    private String techId;
     /**
      * 是否特批 0否 1是
      */
@@ -138,11 +138,11 @@ public class InputOrderProject {
     /**
      * 项目完成时间开始
      */
-    private Integer projectCompleteStartTime;
+    private String projectCompleteStartTime;
     /**
      * 项目完成时间结束
      */
-    private Integer projectCompleteEndTime;
+    private String projectCompleteEndTime;
 
     public String getOrderNo() {
         return orderNo;
@@ -208,12 +208,12 @@ public class InputOrderProject {
         this.liabilitiesDepId = liabilitiesDepId;
     }
 
-    public Integer getEffectiveCount() {
-        return effectiveCount;
+    public Integer getDeclarationBatch() {
+        return declarationBatch;
     }
 
-    public void setEffectiveCount(Integer effectiveCount) {
-        this.effectiveCount = effectiveCount;
+    public void setDeclarationBatch(Integer declarationBatch) {
+        this.declarationBatch = declarationBatch;
     }
 
     public Integer getProjectAmountType() {
@@ -328,28 +328,28 @@ public class InputOrderProject {
         this.province = province;
     }
 
-    public String getFinanceName() {
-        return financeName;
+    public String getFinanceId() {
+        return financeId;
     }
 
-    public void setFinanceName(String financeName) {
-        this.financeName = financeName;
+    public void setFinanceId(String financeId) {
+        this.financeId = financeId;
     }
 
-    public String getSalesmanName() {
-        return salesmanName;
+    public String getSalesmanId() {
+        return salesmanId;
     }
 
-    public void setSalesmanName(String salesmanName) {
-        this.salesmanName = salesmanName;
+    public void setSalesmanId(String salesmanId) {
+        this.salesmanId = salesmanId;
     }
 
-    public String getTechName() {
-        return techName;
+    public String getTechId() {
+        return techId;
     }
 
-    public void setTechName(String techName) {
-        this.techName = techName;
+    public void setTechId(String techId) {
+        this.techId = techId;
     }
 
     public Integer getApproval() {
@@ -408,19 +408,19 @@ public class InputOrderProject {
         this.refundType = refundType;
     }
 
-    public Integer getProjectCompleteStartTime() {
+    public String getProjectCompleteStartTime() {
         return projectCompleteStartTime;
     }
 
-    public void setProjectCompleteStartTime(Integer projectCompleteStartTime) {
+    public void setProjectCompleteStartTime(String projectCompleteStartTime) {
         this.projectCompleteStartTime = projectCompleteStartTime;
     }
 
-    public Integer getProjectCompleteEndTime() {
+    public String getProjectCompleteEndTime() {
         return projectCompleteEndTime;
     }
 
-    public void setProjectCompleteEndTime(Integer projectCompleteEndTime) {
+    public void setProjectCompleteEndTime(String projectCompleteEndTime) {
         this.projectCompleteEndTime = projectCompleteEndTime;
     }
 }

+ 4 - 4
src/main/java/com/goafanti/order/bo/OutOrderProject.java

@@ -117,19 +117,19 @@ public class OutOrderProject {
     /**
      * 成本金额
      */
-    @Excel(name = "总成本")
+    @Excel(name = "总成本",scale = 6)
     private String costAmount;
     /**
      * 成本实付
      */
-    @Excel(name = "实付成本")
+    @Excel(name = "实付成本",scale = 6)
     private String paymentAmount;
     /**
      * 开票金额
      */
-    @Excel(name = "已开票金额")
+    @Excel(name = "已开票金额",scale = 6)
     private String invicueAmount;
-    @Excel(name = "退款金额")
+    @Excel(name = "退款金额",scale = 6)
     private String refundAmount;
     /**
      * 财务负责人

+ 1 - 1
src/main/java/com/goafanti/order/controller/StatisticsApiController.java

@@ -189,7 +189,7 @@ public class StatisticsApiController extends CertifyApiController {
 	 * @return
 	 */
 	@RequestMapping(value="/orderProject", method = RequestMethod.GET)
-	public Result orderProject(InputOrderProject in ){
+	public Result<List<OutOrderProject>> orderProject(InputOrderProject in ){
 		Result res=new Result();
 		res.data(userStaticticsService.orderProject(in));
 		return res;

+ 4 - 0
src/main/java/com/goafanti/order/service/impl/UserStatisticsServiceImpl.java

@@ -98,6 +98,10 @@ public class UserStatisticsServiceImpl extends BaseMybatisDao<UserMidMapper> imp
 
 	@Override
 	public List<OutOrderProject> orderProject(InputOrderProject in) {
+		if (in.getEndDate()!=null)in.setEndDate(in.getEndDate()+" 23:59:59");
+		if (in.getProjectEndDate()!=null)in.setProjectEndDate(in.getProjectEndDate()+" 23:59:59");
+		if (in.getSignEndDate()!=null)in.setSignEndDate(in.getSignEndDate()+" 23:59:59");
+		if (in.getProjectCompleteEndTime()!=null)in.setProjectCompleteEndTime(in.getProjectCompleteEndTime()+" 23:59:59");
 		List<OutOrderProject> outOrderProject = tOrderTaskMapper.selectStatisticsOrderProject(in);
 		for (OutOrderProject e : outOrderProject) {
 			//计算比例