소스 검색

Merge branch 'test' of ssh://git@git.jishutao.com:55555/jishutao/kede-server.git into test

anderx 7 년 전
부모
커밋
48027ab6d7

+ 2 - 0
src/main/java/com/goafanti/common/dao/TOrderMonthReportMapper.java

@@ -96,4 +96,6 @@ public interface TOrderMonthReportMapper {
 	
 	int updateByMonth(Integer month);
 	int updateByYear();
+	
+	int getHistory(TOrderMonthReport monthReport);
 }

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

@@ -492,6 +492,9 @@
   	<if test='b.orderNo != null and b.orderNo != ""'>
   	and b.order_no = #{b.orderNo,jdbcType=VARCHAR}
   	</if>
+  	<if test='b.departmentId != null and b.departmentId != ""'>
+	and oa.department_id = #{b.departmentId,jdbcType=VARCHAR}
+	</if>
   	<if test='b.creater != null and b.creater != ""'>
   	and b.creater = #{b.creater,jdbcType=VARCHAR}
   	</if>
@@ -530,6 +533,9 @@
   	<if test='b.creater != null and b.creater != ""'>
   	and b.creater = #{b.creater,jdbcType=VARCHAR}
   	</if>
+  	<if test='b.departmentId != null and b.departmentId != ""'>
+	and oa.department_id = #{b.departmentId,jdbcType=VARCHAR}
+	</if>
   	<if test='b.payerName != null and b.payerName != ""'>
   	<bind name="nn" value="'%' + b.payerName + '%'"/>
   	and u.nickname like #{nn,jdbcType=VARCHAR}

+ 2 - 2
src/main/java/com/goafanti/common/mapper/TOrderBonusMapper.xml

@@ -390,7 +390,7 @@
   		and oa.name like #{sn,jdbcType=VARCHAR}
   		</if>
   		<if test='b.departmentId != null and b.departmentId != ""'>
-  		and a.department_id = #{b.departmentId,jdbcType=VARCHAR}
+  		and oa.department_id = #{b.departmentId,jdbcType=VARCHAR}
   		</if>
   		<if test="b.grantStatus != null">
 		and b.grant_status = #{b.grantStatus,jdbcType=INTEGER}
@@ -433,7 +433,7 @@
   		and oa.name like #{sn,jdbcType=VARCHAR}
   		</if>
   		<if test='b.departmentId != null and b.departmentId != ""'>
-  		and a.department_id = #{b.departmentId,jdbcType=VARCHAR}
+  		and oa.department_id = #{b.departmentId,jdbcType=VARCHAR}
   		</if>
   		<if test="b.grantStatus != null">
 		and b.grant_status = #{b.grantStatus,jdbcType=INTEGER}

+ 18 - 7
src/main/java/com/goafanti/common/mapper/TOrderMonthReportMapper.xml

@@ -14,6 +14,7 @@
     <result column="proof_count" jdbcType="REAL" property="proofCount" />
     <result column="salemans_id" jdbcType="VARCHAR" property="salemansId" />
     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="history" jdbcType="INTEGER" property="history" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <!--
@@ -89,7 +90,7 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Tue Nov 27 14:53:14 CST 2018.
     -->
-    id, type, month, amount, proof_count, salemans_id, update_time
+    id, type, month, amount, proof_count, salemans_id, update_time, history
   </sql>
   <select id="selectByExample" parameterType="com.goafanti.common.model.TOrderMonthReportExample" resultMap="BaseResultMap">
     <!--
@@ -149,10 +150,10 @@
     -->
     insert into t_order_month_report (id, type, month, 
       amount, proof_count, salemans_id, 
-      update_time)
+      update_time, history)
     values (#{id,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{month,jdbcType=INTEGER}, 
       #{amount,jdbcType=DECIMAL}, #{proofCount,jdbcType=REAL}, #{salemansId,jdbcType=VARCHAR}, 
-      #{updateTime,jdbcType=TIMESTAMP})
+      #{updateTime,jdbcType=TIMESTAMP}, #{history,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderMonthReport">
     <!--
@@ -183,6 +184,9 @@
       <if test="updateTime != null">
         update_time,
       </if>
+      <if test="history != null">
+        history,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -206,6 +210,9 @@
       <if test="updateTime != null">
         #{updateTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="history != null">
+        #{history,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.goafanti.common.model.TOrderMonthReportExample" resultType="java.lang.Integer">
@@ -317,8 +324,8 @@
   </update>
    <!-- 定时插入上月的签单数据 -->
   <insert id="insertLastMonthOrderData" parameterType="java.lang.String">
-  	REPLACE INTO t_order_month_report(`type`,`month`,amount,proof_count,salemans_id) 
-	select o.order_type, date_format(DATE_ADD(NOW(),INTERVAL -1 MONTH),'%Y%m'),sum(o.total_amount), sum(o.proof_count), o.salesman_id 
+  	REPLACE INTO t_order_month_report(`type`,`month`,amount,proof_count,salemans_id,history) 
+	select o.order_type, date_format(DATE_ADD(NOW(),INTERVAL -1 MONTH),'%Y%m'),sum(o.total_amount), sum(o.proof_count), o.salesman_id , 1
 	from t_order_new o
 	where 1 = 1
 	  and o.proof_status = 1 and o.delete_sign = 0 and o.order_status &lt;&gt; 7
@@ -478,8 +485,8 @@
  </insert>
  <!-- 更新指定月份的统计数据 -->
  <insert id="updateByMonth" parameterType="java.lang.Integer">
- 	REPLACE INTO t_order_month_report(`type`,`month`,amount,proof_count,salemans_id) 
-	select o.order_type, #{month,jdbcType=INTEGER},sum(o.total_amount), sum(o.proof_count), o.salesman_id 
+ 	REPLACE INTO t_order_month_report(`type`,`month`,amount,proof_count,salemans_id,history) 
+	select o.order_type, #{month,jdbcType=INTEGER},sum(o.total_amount), sum(o.proof_count), o.salesman_id ,1
 	from t_order_new o
 	where 1 = 1
 	  and o.proof_status = 1 and o.delete_sign = 0 and o.order_status &lt;&gt; 7
@@ -493,4 +500,8 @@
 	where CAST(`month` as CHAR) like concat (year(now()),'%') 
 	group by m.salemans_id , m.`type`
  </insert>
+ <!-- 获得历史状态 -->
+ <select id="getHistory" parameterType="com.goafanti.common.model.TOrderMonthReport" resultType="java.lang.Integer">
+ 	select history from t_order_month_report where salemans_id = #{salemansId,jdbcType=VARCHAR} and `type` = #{type,jdbcType=INTEGER} and `month` = #{month,jdbcType=INTEGER}
+ </select>
 </mapper>

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

@@ -1026,6 +1026,9 @@
   		<if test='o.orderStatus != null and o.orderStatus != ""'>
 	  	and o.order_status = #{o.orderStatus,jdbcType=INTEGER}
 	  	</if>
+  		<if test='o.departmentId != null and o.departmentId != ""'>
+	  	and a.department_id = #{o.departmentId,jdbcType=INTEGER}
+	  	</if>
   		<if test='o.liquidationStatus != null and o.liquidationStatus != ""'>
 	  	and o.liquidation_status = #{o.liquidationStatus,jdbcType=INTEGER}
 	  	</if>
@@ -1063,6 +1066,9 @@
 	  	<if test='o.orderStatus != null and o.orderStatus != ""'>
 	  	and o.order_status = #{o.orderStatus,jdbcType=INTEGER}
 	  	</if>
+	  	<if test='o.departmentId != null and o.departmentId != ""'>
+	  	and a.department_id = #{o.departmentId,jdbcType=INTEGER}
+	  	</if>
 	  	<if test='o.liquidationStatus != null and o.liquidationStatus != ""'>
 	  	and o.liquidation_status = #{o.liquidationStatus,jdbcType=VARCHAR}
 	  	</if>

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

@@ -466,6 +466,9 @@
   	<if test='r.refundStatus == null or r.refundStatus == ""'>
   		and refund_status &lt; 2
   	</if>
+  	<if test='r.departmentId != null and r.departmentId != ""'>
+  	and a.department_id = #{r.departmentId,jdbcType=INTEGER}
+  	</if>
   	<if test='r.id != null and r.id != ""'>
   		and r.id= #{r.id,jdbcType=INTEGER}
   	</if>
@@ -497,6 +500,9 @@
   	<if test='r.refundStatus == null or r.refundStatus == ""'>
   		and r.refund_status &lt; 2
   	</if>
+  	<if test='r.departmentId != null and r.departmentId != ""'>
+  	and a.department_id = #{r.departmentId,jdbcType=INTEGER}
+  	</if>
   	<if test='r.id != null and r.id != ""'>
   		and r.id= #{r.id,jdbcType=INTEGER}
   	</if>

+ 10 - 0
src/main/java/com/goafanti/common/model/TOrderMonthReport.java

@@ -40,6 +40,8 @@ public class TOrderMonthReport {
 	 * @mbggenerated  Tue Nov 27 14:53:14 CST 2018
 	 */
 	private Date updateTime;
+	
+	private Integer history;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order_month_report.id
@@ -166,4 +168,12 @@ public class TOrderMonthReport {
 	public void setUpdateTime(Date updateTime) {
 		this.updateTime = updateTime;
 	}
+
+	public Integer getHistory() {
+		return history;
+	}
+
+	public void setHistory(Integer history) {
+		this.history = history;
+	}
 }

+ 8 - 0
src/main/java/com/goafanti/order/bo/OrderListBo.java

@@ -70,6 +70,8 @@ public class OrderListBo {
 	private String companyName;
 	/** 合同编号 */
 	private String contractNo;
+	/** 部门编号*/
+	private String departmentId;
 	
 	public String getOrderNo() {
 		return orderNo;
@@ -263,4 +265,10 @@ public class OrderListBo {
 	public void setContractNo(String contractNo) {
 		this.contractNo = contractNo;
 	}
+	public String getDepartmentId() {
+		return departmentId;
+	}
+	public void setDepartmentId(String departmentId) {
+		this.departmentId = departmentId;
+	}
 }

+ 7 - 0
src/main/java/com/goafanti/order/bo/OrderRefundBo.java

@@ -14,6 +14,7 @@ public class OrderRefundBo extends TOrderRefund {
 	private String endTime;
 	private String refundAmount;
 	private String contractNo;
+	private String departmentId;
 	public String getBuyName() {
 		return buyName;
 	}
@@ -74,5 +75,11 @@ public class OrderRefundBo extends TOrderRefund {
 	public void setContractNo(String contractNo) {
 		this.contractNo = contractNo;
 	}
+	public String getDepartmentId() {
+		return departmentId;
+	}
+	public void setDepartmentId(String departmentId) {
+		this.departmentId = departmentId;
+	}
 	
 }

+ 14 - 3
src/main/java/com/goafanti/order/service/impl/FundManagerOrderServiceImpl.java

@@ -32,6 +32,7 @@ import com.goafanti.common.model.Notice;
 import com.goafanti.common.model.TOrderBack;
 import com.goafanti.common.model.TOrderBillNew;
 import com.goafanti.common.model.TOrderBonus;
+import com.goafanti.common.model.TOrderMonthReport;
 import com.goafanti.common.model.TOrderNew;
 import com.goafanti.common.model.TOrderRefund;
 import com.goafanti.common.model.TOrderTask;
@@ -452,9 +453,19 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 		int sy = cal.get(Calendar.YEAR);
 		int sm = cal.get(Calendar.MONTH);
 		Integer month = sy*100+(sm+1);
-		//重新校对月统计
-		int c = monthReportMapper.updateByMonth(month);
-		LoggerUtils.debug(logger, "更新订单统计【%s】条。", c);
+		
+		
+		TOrderMonthReport monthReport = new TOrderMonthReport();
+		monthReport.setSalemansId(new1.getSalesmanId());
+		monthReport.setType(new1.getOrderType());
+		monthReport.setMonth(month);
+		//如果订单签单时间是在201801-201811之间的不用重新计算,并且是历史数据
+		Integer history = monthReportMapper.getHistory(monthReport);
+		if(month > 201811 && history != 0){
+			//重新校对月统计
+			int c = monthReportMapper.updateByMonth(month);
+			LoggerUtils.debug(logger, "更新订单统计【%s】条。", c);
+		}
 	}
 
 	@Override