Quellcode durchsuchen

update

Signed-off-by: anderx <312518615@qq.com>
anderx vor 5 Jahren
Ursprung
Commit
cc76223383

+ 158 - 156
src/main/java/com/goafanti/common/constant/AFTConstants.java

@@ -1,159 +1,161 @@
-package com.goafanti.common.constant;
-
-public class AFTConstants {
-	public static final String	YYYYMMDDHHMMSS						= "yyyy-MM-dd HH:mm:ss";
-
-	public static final String	YYYYMMDD							= "yyyy-MM-dd";
-
-	public static final String	YYYY								= "yyyy";
-
-	public static final String	MMDDYYYY							= "MM/dd/yyyy";
-
-	public static final String	MMDD								= "MM-dd";
-
-	public static final String	INITIALPASSWORD						= "123456";				// 初始密码
-
-	/**	超级管理员 */
-	public static final String	SUPERADMIN							= "999999";				// 超级管理员
-	/**	特批决策者 */
-	public static final String	APPROVAL_DECISION					= "99999";				// 特批决策者
-	/**	总裁 */
-	public static final String	CED									= "99998";				// 总裁
+package com.goafanti.common.constant;
+
+public class AFTConstants {
+	public static final String	YYYYMMDDHHMMSS						= "yyyy-MM-dd HH:mm:ss";
+
+	public static final String	YYYYMMDD							= "yyyy-MM-dd";
+
+	public static final String	YYYY								= "yyyy";
+
+	public static final String	MMDDYYYY							= "MM/dd/yyyy";
+
+	public static final String	MMDD								= "MM-dd";
+
+	public static final String	INITIALPASSWORD						= "123456";				// 初始密码
+
+	/**	超级管理员 */
+	public static final String	SUPERADMIN							= "999999";				// 超级管理员
+	/**	特批决策者 */
+	public static final String	APPROVAL_DECISION					= "99999";				// 特批决策者
+	/**	总裁 */
+	public static final String	CED									= "99998";				// 总裁
 	/**	集团副总 */
-	public static final String	VICE_CEO							= "99997";				// 集团副总
+	public static final String	VICE_CEO							= "99997";				// 集团副总
 	/** 技术管理员 */
-	public static final String  TECH_ADMIN                          = "9998";				// 技术管理员
-	/**	技术经理 */
-	public static final String  TECH_MANAGER                        = "998";				// 技术经理
-	/**	技术员 */
-	public static final String  TECH		                        = "98";					// 技术员
-	/**	财务管理员*/
-	public static final String  FINANCE_ADMIN                       = "9997";				// 财务管理员
-	/**	财务经理*/
-	public static final String  FINANCE_MANAGER						= "997";				// 财务经理
-	/**	财务专员*/
-	public static final String  FINANCE								= "97";					// 财务专员
-	/**	营销管理员 */
-	public static final String  SALESMAN_ADMIN                      = "9996";				// 营销管理员
-	/** 营销经理 */
-	public static final String  SALESMAN_MANAGER                    = "996";				// 营销经理
-	/**	营销员 */
-	public static final String  SALESMAN                      		= "96";					// 营销员
-
-
-	public static final String	AREAADMIN							= "";					// 地区管理员
-
-	public static final String	AUDITORADMIN						= "";					// 审核员
-
-	public static final String	MANAGERADMIN						= "";					// 客户经理
-	
-
-
-
-	public static final String	TECHBROKER							= "";					// 技术经纪人
-
-	public static final String	PATENTINFO							= "专利申请管理";
-
-	public static final String	COGNIZANCE							= "高企认定管理";
-
-	public static final String	COPYRIGHT							= "软著申请管理";
-
-	public static final String	TECHPROJECT							= "科技项目申报管理";
-	
-	public static final String	DEFAULT_INITIATOR					= "超级管理员";
-	
-	public static final String	CONSULTANT_MANAGER					= "咨询师管理员";
-
-	public static final int		KEYWORDLENTH						= 16;
-
-	public static final int		IMPORTMAXLENTH						= 1000;					// 科技需求&科技成果批量导入最大数据量
-
-	public static final int		PROVINCEMAXNUM						= 99;
-
-	public static final int		CITYMAXNUM							= 999;
-
-	public static final Integer	ACHIEVEMENT_DEMAND_INIT_COUNT		= 0;
-
-	public static final Integer	ACHIEVEMENT_DEMAND_FIRST_COUNT		= 1;
-
-	public static final Integer	BIG_SHOT_STAR_CACHE_KEY				= 666;
-
-	public static final Integer	BIG_SHOT_LECTURE_CACHE_KEY			= 667;
-
-	public static final Integer	LECTURE_DYNAMIC_LIST_CACHE_KEY		= 668;
-
-	public static final Integer	LECTURE_LIST_CACHE_KEY				= 669;
-
-	public static final Integer	INTERNATIONAL_ACHIEVEMENT_CACHE_KEY	= 670;
-
-	public static final Integer	INTERNATIONAL_USER_CACHE_KEY		= 671;
-
-	public static final Integer	INTERNATIONAL_ORG_CACHE_KEY			= 672;
-
-	public static final Integer	YES									= 1;
-
-	public static final Integer	NO									= 0;
-
-	public static final String	USER_TYPE_PERSONAL					= "0";
-
-	public static final String	USER_TYPE_ORGANIZATION				= "1";
-
-	public static final Integer	USER_SOURCE_REGISTER				= 0;
-
-	public static final Integer	USER_SOURCE_CREATE					= 1;
-
-	public static final Integer	USER_SHARE_PRIVATE					= 0;
-
-	public static final Integer	USER_SHARE_PUBLIC					= 1;
-
-	public static final Integer	USER_STATUS_NORMAL					= 0;
-
-	public static final Integer	USER_STATUS_CANCEL					= 1;
-
-	public static final Integer	USER_STATUS_LOCKING					= 2;
-
-	public static final String	USER_TRANSFER_TO_PUBLIC				= "转为公共客户";
-
-	public static final String	USER_DELETE							= "删除客户";
-
-	public static final String	USER_RECEIVE						= "领取";
-
-	public static final String	USER_TRANSFER_TO_OTHER				= "转交客户给制定人";
-	
-	public static final String	PROJECT_TRANSFER_TO_OTHER				= "转交客户给制定人";
-
-	/**组织类型-公司*/
-	public static final String	ORGANIZATION_TYPE_COMPANY			= "0";
-	/**组织类型-部门*/
-	public static final String	ORGANIZATION_TYPE_DEPARTMENT		= "1";
-	/**组织类型-团队*/
-	public static final String	ORGANIZATION_TYPE_TEAM				= "2";
-
-	public static final String	DAILY								= "daily";
-	public static final String	WEEKLY								= "weekly";
-	public static final String	MONTHLY								= "monthly";
-	public static final String	QUARTERLY							= "quarterly";
-	public static final String	ANNUALLY							= "annually";
-
-	/** 转公共客户拜访时限 **/
-	public static final long USER_FOLLOW_LIMIT_MS					= 24*3600*1000*30L;
-	/** 转公公共客户签单时限 **/
-	public static final long USER_SIGN_LIMIT_MS						= 24*3600*1000*270L;
-	
-	/** 转公共客户拜访时限 **/
-	public static final long PROJECT_FOLLOW_LIMIT_MS					= 24*3600*1000*360L;
-	/** 转公公共客户签单时限 **/
-	public static final long PROJECT_SIGN_LIMIT_MS						= 24*3600*1000*900L;
-	
-	public static final Integer USER_STATUS = 1;
-	/** 领取员工上线 **/
-	public static final Integer USER_RCEIVE_MAX= 9;
-	
-	public static final String ADMIN_EMAIL= "anderx@dingtalk.com";
-	
-	
-	public static final String DEFAULT_CONTACT_TYPE="0";
-	
-	public static final String DEFAULT_RESULT="签单-自动触发";
-	
+	public static final String  TECH_ADMIN                          = "9998";				// 技术管理员
+	/**	技术经理 */
+	public static final String  TECH_MANAGER                        = "998";				// 技术经理
+	/**	技术员 */
+	public static final String  TECH		                        = "98";					// 技术员
+	/**	财务管理员*/
+	public static final String  FINANCE_ADMIN                       = "9997";				// 财务管理员
+	/**	财务经理*/
+	public static final String  FINANCE_MANAGER						= "997";				// 财务经理
+	/**	财务专员*/
+	public static final String  FINANCE								= "97";					// 财务专员
+	/**	营销管理员 */
+	public static final String  SALESMAN_ADMIN                      = "9996";				// 营销管理员
+	/** 营销经理 */
+	public static final String  SALESMAN_MANAGER                    = "996";				// 营销经理
+	/**	营销员 */
+	public static final String  SALESMAN                      		= "96";					// 营销员
+	
+	public static final String  OUTSOURCE_AUDITOR                   = "9991";				// 外包审核
+
+
+	public static final String	AREAADMIN							= "";					// 地区管理员
+
+	public static final String	AUDITORADMIN						= "";					// 审核员
+
+	public static final String	MANAGERADMIN						= "";					// 客户经理
+	
+
+
+
+	public static final String	TECHBROKER							= "";					// 技术经纪人
+
+	public static final String	PATENTINFO							= "专利申请管理";
+
+	public static final String	COGNIZANCE							= "高企认定管理";
+
+	public static final String	COPYRIGHT							= "软著申请管理";
+
+	public static final String	TECHPROJECT							= "科技项目申报管理";
+	
+	public static final String	DEFAULT_INITIATOR					= "超级管理员";
+	
+	public static final String	CONSULTANT_MANAGER					= "咨询师管理员";
+
+	public static final int		KEYWORDLENTH						= 16;
+
+	public static final int		IMPORTMAXLENTH						= 1000;					// 科技需求&科技成果批量导入最大数据量
+
+	public static final int		PROVINCEMAXNUM						= 99;
+
+	public static final int		CITYMAXNUM							= 999;
+
+	public static final Integer	ACHIEVEMENT_DEMAND_INIT_COUNT		= 0;
+
+	public static final Integer	ACHIEVEMENT_DEMAND_FIRST_COUNT		= 1;
+
+	public static final Integer	BIG_SHOT_STAR_CACHE_KEY				= 666;
+
+	public static final Integer	BIG_SHOT_LECTURE_CACHE_KEY			= 667;
+
+	public static final Integer	LECTURE_DYNAMIC_LIST_CACHE_KEY		= 668;
+
+	public static final Integer	LECTURE_LIST_CACHE_KEY				= 669;
+
+	public static final Integer	INTERNATIONAL_ACHIEVEMENT_CACHE_KEY	= 670;
+
+	public static final Integer	INTERNATIONAL_USER_CACHE_KEY		= 671;
+
+	public static final Integer	INTERNATIONAL_ORG_CACHE_KEY			= 672;
+
+	public static final Integer	YES									= 1;
+
+	public static final Integer	NO									= 0;
+
+	public static final String	USER_TYPE_PERSONAL					= "0";
+
+	public static final String	USER_TYPE_ORGANIZATION				= "1";
+
+	public static final Integer	USER_SOURCE_REGISTER				= 0;
+
+	public static final Integer	USER_SOURCE_CREATE					= 1;
+
+	public static final Integer	USER_SHARE_PRIVATE					= 0;
+
+	public static final Integer	USER_SHARE_PUBLIC					= 1;
+
+	public static final Integer	USER_STATUS_NORMAL					= 0;
+
+	public static final Integer	USER_STATUS_CANCEL					= 1;
+
+	public static final Integer	USER_STATUS_LOCKING					= 2;
+
+	public static final String	USER_TRANSFER_TO_PUBLIC				= "转为公共客户";
+
+	public static final String	USER_DELETE							= "删除客户";
+
+	public static final String	USER_RECEIVE						= "领取";
+
+	public static final String	USER_TRANSFER_TO_OTHER				= "转交客户给制定人";
+	
+	public static final String	PROJECT_TRANSFER_TO_OTHER				= "转交客户给制定人";
+
+	/**组织类型-公司*/
+	public static final String	ORGANIZATION_TYPE_COMPANY			= "0";
+	/**组织类型-部门*/
+	public static final String	ORGANIZATION_TYPE_DEPARTMENT		= "1";
+	/**组织类型-团队*/
+	public static final String	ORGANIZATION_TYPE_TEAM				= "2";
+
+	public static final String	DAILY								= "daily";
+	public static final String	WEEKLY								= "weekly";
+	public static final String	MONTHLY								= "monthly";
+	public static final String	QUARTERLY							= "quarterly";
+	public static final String	ANNUALLY							= "annually";
+
+	/** 转公共客户拜访时限 **/
+	public static final long USER_FOLLOW_LIMIT_MS					= 24*3600*1000*30L;
+	/** 转公公共客户签单时限 **/
+	public static final long USER_SIGN_LIMIT_MS						= 24*3600*1000*270L;
+	
+	/** 转公共客户拜访时限 **/
+	public static final long PROJECT_FOLLOW_LIMIT_MS					= 24*3600*1000*360L;
+	/** 转公公共客户签单时限 **/
+	public static final long PROJECT_SIGN_LIMIT_MS						= 24*3600*1000*900L;
+	
+	public static final Integer USER_STATUS = 1;
+	/** 领取员工上线 **/
+	public static final Integer USER_RCEIVE_MAX= 9;
+	
+	public static final String ADMIN_EMAIL= "anderx@dingtalk.com";
+	
+	
+	public static final String DEFAULT_CONTACT_TYPE="0";
+	
+	public static final String DEFAULT_RESULT="签单-自动触发";
+	
 }

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

@@ -96,7 +96,10 @@ public interface TTaskMidMapper {
      */
     int updateByPrimaryKey(TTaskMid record);
 
-	int updateCostAmount(@Param("tid")Integer tid, @Param("costAmount")BigDecimal costAmount, @Param("type")Integer type);
 
 	int updatePaymentAmount(@Param("tid")Integer tid, @Param("paymentAmount")BigDecimal paymentAmount, @Param("type")Integer type);
+
+	List<TTaskMid> selectByTid(Integer tid);
+
+	void updateCostAmount(@Param("tid")Integer tid, @Param("count")BigDecimal count);
 }

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

@@ -77,4 +77,6 @@ public interface ThirdPartyCompanyMapper {
 	int updateByPrimaryKey(ThirdPartyCompany record);
 
 	List<OutThirdPartyCompany> selectByTid(Integer tid);
+
+	OutThirdPartyCompany selectByIdPuls(Integer id);
 }

+ 322 - 322
src/main/java/com/goafanti/common/mapper/OutsourceLogMapper.xml

@@ -1,323 +1,323 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.goafanti.common.dao.OutsourceLogMapper">
-  <resultMap id="BaseResultMap" type="com.goafanti.common.model.OutsourceLog">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Jun 15 09:10:10 CST 2020.
-    -->
-    <id column="id" jdbcType="INTEGER" property="id" />
-    <result column="tid" jdbcType="INTEGER" property="tid" />
-    <result column="status" jdbcType="INTEGER" property="status" />
-    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
-    <result column="aid" jdbcType="VARCHAR" property="aid" />
-    <result column="aname" jdbcType="VARCHAR" property="aname" />
-    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
-  </resultMap>
-  <sql id="Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Jun 15 09:10:10 CST 2020.
-    -->
-    <where>
-      <foreach collection="oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Update_By_Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Jun 15 09:10:10 CST 2020.
-    -->
-    <where>
-      <foreach collection="example.oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Base_Column_List">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Jun 15 09:10:10 CST 2020.
-    -->
-    id, tid, status, remarks, aid, aname, create_time
-  </sql>
-  <select id="selectByExample" parameterType="com.goafanti.common.model.OutsourceLogExample" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Jun 15 09:10:10 CST 2020.
-    -->
-    select
-    <if test="distinct">
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    from outsource_log
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-    <if test="orderByClause != null">
-      order by ${orderByClause}
-    </if>
-  </select>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Jun 15 09:10:10 CST 2020.
-    -->
-    select 
-    <include refid="Base_Column_List" />
-    from outsource_log
-    where id = #{id,jdbcType=INTEGER}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Jun 15 09:10:10 CST 2020.
-    -->
-    delete from outsource_log
-    where id = #{id,jdbcType=INTEGER}
-  </delete>
-  <delete id="deleteByExample" parameterType="com.goafanti.common.model.OutsourceLogExample">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Jun 15 09:10:10 CST 2020.
-    -->
-    delete from outsource_log
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.OutsourceLog">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Jun 15 09:10:10 CST 2020.
-    -->
-    insert into outsource_log (id, tid, status, 
-      remarks, aid, aname, 
-      create_time)
-    values (#{id,jdbcType=INTEGER}, #{tid,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, 
-      #{remarks,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, #{aname,jdbcType=VARCHAR}, 
-      #{createTime,jdbcType=TIMESTAMP})
-  </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.OutsourceLog">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Jun 15 09:10:10 CST 2020.
-    -->
-    insert into outsource_log
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
-      <if test="tid != null">
-        tid,
-      </if>
-      <if test="status != null">
-        status,
-      </if>
-      <if test="remarks != null">
-        remarks,
-      </if>
-      <if test="aid != null">
-        aid,
-      </if>
-      <if test="aname != null">
-        aname,
-      </if>
-      <if test="createTime != null">
-        create_time,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=INTEGER},
-      </if>
-      <if test="tid != null">
-        #{tid,jdbcType=INTEGER},
-      </if>
-      <if test="status != null">
-        #{status,jdbcType=INTEGER},
-      </if>
-      <if test="remarks != null">
-        #{remarks,jdbcType=VARCHAR},
-      </if>
-      <if test="aid != null">
-        #{aid,jdbcType=VARCHAR},
-      </if>
-      <if test="aname != null">
-        #{aname,jdbcType=VARCHAR},
-      </if>
-      <if test="createTime != null">
-        #{createTime,jdbcType=TIMESTAMP},
-      </if>
-    </trim>
-  </insert>
-  <select id="countByExample" parameterType="com.goafanti.common.model.OutsourceLogExample" resultType="java.lang.Long">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Jun 15 09:10:10 CST 2020.
-    -->
-    select count(*) from outsource_log
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </select>
-  <update id="updateByExampleSelective" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Jun 15 09:10:10 CST 2020.
-    -->
-    update outsource_log
-    <set>
-      <if test="record.id != null">
-        id = #{record.id,jdbcType=INTEGER},
-      </if>
-      <if test="record.tid != null">
-        tid = #{record.tid,jdbcType=INTEGER},
-      </if>
-      <if test="record.status != null">
-        status = #{record.status,jdbcType=INTEGER},
-      </if>
-      <if test="record.remarks != null">
-        remarks = #{record.remarks,jdbcType=VARCHAR},
-      </if>
-      <if test="record.aid != null">
-        aid = #{record.aid,jdbcType=VARCHAR},
-      </if>
-      <if test="record.aname != null">
-        aname = #{record.aname,jdbcType=VARCHAR},
-      </if>
-      <if test="record.createTime != null">
-        create_time = #{record.createTime,jdbcType=TIMESTAMP},
-      </if>
-    </set>
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByExample" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Jun 15 09:10:10 CST 2020.
-    -->
-    update outsource_log
-    set id = #{record.id,jdbcType=INTEGER},
-      tid = #{record.tid,jdbcType=INTEGER},
-      status = #{record.status,jdbcType=INTEGER},
-      remarks = #{record.remarks,jdbcType=VARCHAR},
-      aid = #{record.aid,jdbcType=VARCHAR},
-      aname = #{record.aname,jdbcType=VARCHAR},
-      create_time = #{record.createTime,jdbcType=TIMESTAMP}
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.OutsourceLog">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Jun 15 09:10:10 CST 2020.
-    -->
-    update outsource_log
-    <set>
-      <if test="tid != null">
-        tid = #{tid,jdbcType=INTEGER},
-      </if>
-      <if test="status != null">
-        status = #{status,jdbcType=INTEGER},
-      </if>
-      <if test="remarks != null">
-        remarks = #{remarks,jdbcType=VARCHAR},
-      </if>
-      <if test="aid != null">
-        aid = #{aid,jdbcType=VARCHAR},
-      </if>
-      <if test="aname != null">
-        aname = #{aname,jdbcType=VARCHAR},
-      </if>
-      <if test="createTime != null">
-        create_time = #{createTime,jdbcType=TIMESTAMP},
-      </if>
-    </set>
-    where id = #{id,jdbcType=INTEGER}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.OutsourceLog">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Jun 15 09:10:10 CST 2020.
-    -->
-    update outsource_log
-    set tid = #{tid,jdbcType=INTEGER},
-      status = #{status,jdbcType=INTEGER},
-      remarks = #{remarks,jdbcType=VARCHAR},
-      aid = #{aid,jdbcType=VARCHAR},
-      aname = #{aname,jdbcType=VARCHAR},
-      create_time = #{createTime,jdbcType=TIMESTAMP}
-    where id = #{id,jdbcType=INTEGER}
-  </update>
-  
-  <select id="selectByTid" resultType="com.goafanti.order.bo.OutOutsourceLog">
-  SELECT id, tid, status, remarks, aid, aname, date_format(create_time,'%Y-%m-%d')createTimes FROM outsource_log 
-WHERE tid= #{tid}
-  </select>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.goafanti.common.dao.OutsourceLogMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.OutsourceLog">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 15 09:10:10 CST 2020.
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="tid" jdbcType="INTEGER" property="tid" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
+    <result column="aid" jdbcType="VARCHAR" property="aid" />
+    <result column="aname" jdbcType="VARCHAR" property="aname" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 15 09:10:10 CST 2020.
+    -->
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 15 09:10:10 CST 2020.
+    -->
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 15 09:10:10 CST 2020.
+    -->
+    id, tid, status, remarks, aid, aname, create_time
+  </sql>
+  <select id="selectByExample" parameterType="com.goafanti.common.model.OutsourceLogExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 15 09:10:10 CST 2020.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from outsource_log
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 15 09:10:10 CST 2020.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from outsource_log
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 15 09:10:10 CST 2020.
+    -->
+    delete from outsource_log
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.goafanti.common.model.OutsourceLogExample">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 15 09:10:10 CST 2020.
+    -->
+    delete from outsource_log
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.OutsourceLog">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 15 09:10:10 CST 2020.
+    -->
+    insert into outsource_log (id, tid, status, 
+      remarks, aid, aname, 
+      create_time)
+    values (#{id,jdbcType=INTEGER}, #{tid,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, 
+      #{remarks,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, #{aname,jdbcType=VARCHAR}, 
+      #{createTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.OutsourceLog">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 15 09:10:10 CST 2020.
+    -->
+    insert into outsource_log
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="tid != null">
+        tid,
+      </if>
+      <if test="status != null">
+        status,
+      </if>
+      <if test="remarks != null">
+        remarks,
+      </if>
+      <if test="aid != null">
+        aid,
+      </if>
+      <if test="aname != null">
+        aname,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=INTEGER},
+      </if>
+      <if test="tid != null">
+        #{tid,jdbcType=INTEGER},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="remarks != null">
+        #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="aid != null">
+        #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="aname != null">
+        #{aname,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.goafanti.common.model.OutsourceLogExample" resultType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 15 09:10:10 CST 2020.
+    -->
+    select count(*) from outsource_log
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 15 09:10:10 CST 2020.
+    -->
+    update outsource_log
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=INTEGER},
+      </if>
+      <if test="record.tid != null">
+        tid = #{record.tid,jdbcType=INTEGER},
+      </if>
+      <if test="record.status != null">
+        status = #{record.status,jdbcType=INTEGER},
+      </if>
+      <if test="record.remarks != null">
+        remarks = #{record.remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="record.aid != null">
+        aid = #{record.aid,jdbcType=VARCHAR},
+      </if>
+      <if test="record.aname != null">
+        aname = #{record.aname,jdbcType=VARCHAR},
+      </if>
+      <if test="record.createTime != null">
+        create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 15 09:10:10 CST 2020.
+    -->
+    update outsource_log
+    set id = #{record.id,jdbcType=INTEGER},
+      tid = #{record.tid,jdbcType=INTEGER},
+      status = #{record.status,jdbcType=INTEGER},
+      remarks = #{record.remarks,jdbcType=VARCHAR},
+      aid = #{record.aid,jdbcType=VARCHAR},
+      aname = #{record.aname,jdbcType=VARCHAR},
+      create_time = #{record.createTime,jdbcType=TIMESTAMP}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.OutsourceLog">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 15 09:10:10 CST 2020.
+    -->
+    update outsource_log
+    <set>
+      <if test="tid != null">
+        tid = #{tid,jdbcType=INTEGER},
+      </if>
+      <if test="status != null">
+        status = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="remarks != null">
+        remarks = #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="aid != null">
+        aid = #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="aname != null">
+        aname = #{aname,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.OutsourceLog">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 15 09:10:10 CST 2020.
+    -->
+    update outsource_log
+    set tid = #{tid,jdbcType=INTEGER},
+      status = #{status,jdbcType=INTEGER},
+      remarks = #{remarks,jdbcType=VARCHAR},
+      aid = #{aid,jdbcType=VARCHAR},
+      aname = #{aname,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  
+  <select id="selectByTid" resultType="com.goafanti.order.bo.OutOutsourceLog">
+  SELECT id, tid, status, remarks, aid, aname, date_format(create_time,'%Y-%m-%d %H:%i:%s')createTimes FROM outsource_log 
+WHERE tid= #{tid}
+  </select>
 </mapper>

+ 3 - 3
src/main/java/com/goafanti/common/mapper/TOrderMidMapper.xml

@@ -475,9 +475,9 @@
   select name from department where id= #{orderDep}
   </select>
   <update id="updateCostAmount">
-      update t_order_task a ,t_order_mid b ,t_task_mid c
-    set b.cost_amount= #{count},c.cost_amount=#{count}
-    where a.order_no=b.order_no  and a.id=c.tid and a.id= #{tid}
+      update t_order_task a ,t_task_mid c
+    set c.cost_amount=#{count}
+    where  a.id=c.tid and a.id= #{tid}
   </update>
   
 </mapper>

+ 3 - 3
src/main/java/com/goafanti/common/mapper/TOrderOutsourceMapper.xml

@@ -629,9 +629,9 @@
 	</if>
   </select>
   <select id="selectByTid"  parameterType="java.lang.Integer" resultType="com.goafanti.organization.bo.outProjectBo">
-     select a.id,a.patent_type patentType,c.`type`
-    from t_order_outsource a left join t_order_task b on a.tid=b.id
+     select a.id,a.patent_type patentType,c.`type` projectType
+    from  t_order_task b left join  t_order_outsource a on a.tid=b.id
     left join business_project c on b.commodity_id=c.id
-    where a.tid = #{tid}
+    where b.id = #{tid}
   </select>
 </mapper>

+ 11 - 11
src/main/java/com/goafanti/common/mapper/TTaskMidMapper.xml

@@ -283,17 +283,7 @@
       create_time = #{createTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=INTEGER}
   </update>
-  
-  <update id="updateCostAmount">
-   update t_task_mid
-    <if test="type == 0">
-    set cost_amount = cost_amount + #{costAmount,jdbcType=DECIMAL}
-    </if>
-    <if test="type == 1">
-    set cost_amount = cost_amount - #{costAmount,jdbcType=DECIMAL}
-    </if>
-    where tid = #{tid,jdbcType=INTEGER}
-  </update>
+ 
   <update id="updatePaymentAmount">
   	update t_task_mid
     <if test="type == 0">
@@ -304,4 +294,14 @@
     </if>
     where tid = #{tid,jdbcType=INTEGER}
   </update>
+  <select id="selectByTid" resultType="com.goafanti.common.model.TTaskMid">
+	    select c.tid,c.cost_amount costAmount from t_order_task a left join t_order_task b on a.order_no=b.order_no
+	left join t_task_mid c on b.id=c.tid
+	where a.id= #{tid}
+  </select>
+    <update id="updateCostAmount">
+     update t_order_task a ,t_order_mid b
+    set b.cost_amount= #{count}
+    where  a.order_no=b.order_no and a.id= #{tid}
+  </update>
 </mapper>

+ 11 - 1
src/main/java/com/goafanti/common/mapper/ThirdPartyCompanyMapper.xml

@@ -493,8 +493,18 @@
   <select id="selectByTid" resultType="com.goafanti.organization.bo.OutThirdPartyCompany">
    select a.id,a.tid,a.company_name companyName,a.unit_price unitPrice,a.quantity,a.total_amount totalAmount,a.material,a.urgent,
 	a.patent_name_type patentNameType,a.audit,a.assets,a.income,a.remarks,a.cid,b.cost_reduction costReduction,b.official_cost officialCost,
-	a.type,a.party_amount partyAmount from third_party_company a left join t_order_task b on a.tid=b.id  where tid= #{tid}
+	a.type,a.party_amount partyAmount ,op.amount officialUnitPrice,op.proportion85 reductionAmount
+	from third_party_company a left join t_order_task b on a.tid=b.id  left join official_fee_price op on a.patent_name_type=op.`type` 
+ where tid= #{tid}
   </select>
+  <select id="selectByIdPuls" resultType="com.goafanti.organization.bo.OutThirdPartyCompany">
+  select a.id,a.tid,a.company_name companyName,a.unit_price unitPrice,a.quantity,a.total_amount totalAmount,a.material,a.urgent,
+	a.patent_name_type patentNameType,a.audit,a.assets,a.income,a.remarks,a.cid,b.cost_reduction costReduction,b.official_cost officialCost,
+	a.type,a.party_amount partyAmount ,op.amount officialUnitPrice,op.proportion85 reductionAmount
+	from third_party_company a left join t_order_task b on a.tid=b.id  left join official_fee_price op on a.patent_name_type=op.`type`
+	where a.id= #{id}
+  </select>
+  
    <select id="selectPaymentList" resultType="com.goafanti.organization.bo.outPaymentList">
 			select a.id, c.contract_no contractNo,b.order_no orderNo,d.buyer_name userName, d.dep_name depName,f.party_amount costAmount,
 		a.choose_type chooseType,a.payment_amount paymentAmount,a.application_amount applicationAmount,a.tid,

+ 1 - 2
src/main/java/com/goafanti/common/task/ReleaseUserTask.java

@@ -59,7 +59,7 @@ public class ReleaseUserTask {
 		
 	}
 	
-	
+	@RequestMapping(value = "/open/remindUser", method = RequestMethod.GET)
 	private void pushUserDays() throws InterruptedException {
 		LoggerUtils.debug(getClass(), "==============客户提醒开始============");
 		List<User> userList = userServiceImpl.selectUserByRoleName("营销员","营销经理");
@@ -94,7 +94,6 @@ public class ReleaseUserTask {
 	/**
 	 *将客户和业务转为待释放
 	 */
-	 
 	@RequestMapping(value = "/open/updateUser", method = RequestMethod.GET)
 	public void updateUser(){
 		LoggerUtils.debug(getClass(), "==============客户释放开始============");

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

@@ -184,7 +184,7 @@ public class OutsourceOrgApiController extends CertifyApiController {
 	}
 	
 	/**
-	 * 外包审核
+	 * 外包审核日志
 	 */
 	@RequestMapping(value="/selectOutsourceLog", method = RequestMethod.GET)
 	public Result selectOutsourceLog(Integer tid){

+ 27 - 1
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -1330,10 +1330,36 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		}else {
 			tOrderOutsourceMapper.insertSelective(o);
 		}
+		updateOrderCostAmount(o.getTid());
 		return 1;
 	}
 
-
+	private void updateOrderCostAmount(Integer tid) {
+		//计算项目成本
+		List<OutThirdPartyCompany>list=thirdPartyCompanyMapper.selectByTid(tid);
+		BigDecimal tCount=new BigDecimal(0);
+		for (OutThirdPartyCompany op : list) {
+			tCount=tCount.add(new BigDecimal(op.getTotalAmount()));
+			if(op.getOfficialCost()==1) {
+				BigDecimal sum= new BigDecimal(0);
+				if (op.getCostReduction()==0) {
+					sum= new BigDecimal(op.getOfficialUnitPrice()).multiply(new BigDecimal(op.getQuantity()));
+					tCount=tCount.add(sum);
+				}else if (op.getCostReduction()==1) {
+					sum= new BigDecimal(op.getReductionAmount()).multiply(new BigDecimal(op.getQuantity()));
+					tCount=tCount.add(sum);
+				}
+			}
+		}
+		tOrderMidMapper.updateCostAmount(tid,tCount);
+		//计算订单成本
+		BigDecimal oCount=new BigDecimal(0);
+		List <TTaskMid> tlist=tTaskMidMapper.selectByTid(tid);
+		for (TTaskMid tm : tlist) {
+			oCount=oCount.add(tm.getCostAmount());
+		}
+		tTaskMidMapper.updateCostAmount(tid,oCount);
+	}
 
 	@SuppressWarnings("unchecked")
 	@Override

+ 38 - 0
src/main/java/com/goafanti/organization/bo/OutThirdPartyCompany.java

@@ -9,6 +9,8 @@ public class OutThirdPartyCompany  {
 	private Integer costReduction;
 	
 	private Integer officialCost;
+	private String officialUnitPrice; 
+	private String reductionAmount;
 	
 
 
@@ -356,6 +358,42 @@ public class OutThirdPartyCompany  {
 	public void setOfficialCost(Integer officialCost) {
 		this.officialCost = officialCost;
 	}
+
+
+
+
+
+
+	public String getOfficialUnitPrice() {
+		return officialUnitPrice;
+	}
+
+
+
+
+
+
+	public void setOfficialUnitPrice(String officialUnitPrice) {
+		this.officialUnitPrice = officialUnitPrice;
+	}
+
+
+
+
+
+
+	public String getReductionAmount() {
+		return reductionAmount;
+	}
+
+
+
+
+
+
+	public void setReductionAmount(String reductionAmount) {
+		this.reductionAmount = reductionAmount;
+	}
 	
 	
 

+ 9 - 9
src/main/java/com/goafanti/organization/bo/outOrderPayment.java

@@ -396,15 +396,15 @@ public class outOrderPayment {
 	 /**
 	 * 原总价
 	 */
-	 private BigDecimal initialTotalAmount;
+	 private String initialTotalAmount;
 	 /**
 	 * 原单价
 	 */
-	 private BigDecimal initialUnitPrice;
+	 private String initialUnitPrice;
 	 /**
 		 * 原已付
 		 */
-	 private BigDecimal initialPaymentAmount;
+	 private String initialPaymentAmount;
 	 private String initialCompanyName;
 	 private String createTimes;
 	 
@@ -429,22 +429,22 @@ public class outOrderPayment {
 	public void setInitialQuantity(Integer initialQuantity) {
 		this.initialQuantity = initialQuantity;
 	}
-	public BigDecimal getInitialTotalAmount() {
+	public String getInitialTotalAmount() {
 		return initialTotalAmount;
 	}
-	public void setInitialTotalAmount(BigDecimal initialTotalAmount) {
+	public void setInitialTotalAmount(String initialTotalAmount) {
 		this.initialTotalAmount = initialTotalAmount;
 	}
-	public BigDecimal getInitialUnitPrice() {
+	public String getInitialUnitPrice() {
 		return initialUnitPrice;
 	}
-	public void setInitialUnitPrice(BigDecimal initialUnitPrice) {
+	public void setInitialUnitPrice(String initialUnitPrice) {
 		this.initialUnitPrice = initialUnitPrice;
 	}
-	public BigDecimal getInitialPaymentAmount() {
+	public String getInitialPaymentAmount() {
 		return initialPaymentAmount;
 	}
-	public void setInitialPaymentAmount(BigDecimal initialPaymentAmount) {
+	public void setInitialPaymentAmount(String initialPaymentAmount) {
 		this.initialPaymentAmount = initialPaymentAmount;
 	}
 	public String getInitialCompanyName() {

+ 7 - 5
src/main/java/com/goafanti/organization/bo/outProjectBo.java

@@ -6,7 +6,7 @@ public class outProjectBo {
 	
 	private Integer patentType;
 	
-	private Integer type;
+	private Integer projectType;
 
 	public Integer getId() {
 		return id;
@@ -24,13 +24,15 @@ public class outProjectBo {
 		this.patentType = patentType;
 	}
 
-	public Integer getType() {
-		return type;
+	public Integer getProjectType() {
+		return projectType;
 	}
 
-	public void setType(Integer type) {
-		this.type = type;
+	public void setProjectType(Integer projectType) {
+		this.projectType = projectType;
 	}
+
+
 	
 	
 }

+ 9 - 6
src/main/java/com/goafanti/organization/controller/ThirdPartyCompanyApiController.java

@@ -2,6 +2,8 @@ package com.goafanti.organization.controller;
 
 
 
+import java.math.BigDecimal;
+
 import javax.annotation.Resource;
 import javax.validation.Valid;
 
@@ -66,8 +68,8 @@ public class ThirdPartyCompanyApiController extends BaseApiController{
 		}else if (calculation==2) {
 			thirdPartyCompanyService.calculationPatentUnitPrice(t,patentType);
 		}
-		if(calculation!=0&&t.getUnitPrice()==null) {
-			res.getError().add(buildError("系统未有设置当前选项金额,请核对","系统未有设置当前选项金额,请核对"));
+		if(calculation!=0&&(t.getUnitPrice()==null||t.getUnitPrice().compareTo(new BigDecimal(0))<1)) {
+			res.getError().add(buildError("后台无此项数据记录,请联系管理员","后台无此项数据记录,请联系管理员"));
 			return res;
 		}
 		if (t.getUnitPrice()==null||t.getTotalAmount()==null) {
@@ -272,6 +274,7 @@ public class ThirdPartyCompanyApiController extends BaseApiController{
             		ThirdPartyError.getValueByCode(bindingResult.getFieldError().getField())));
             return res;
         }
+		thirdPartyCompanyService.checkGetAmount(p);
 		if (null==p.getTid()) {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"编号","编号"));
 			return res;
@@ -280,14 +283,14 @@ public class ThirdPartyCompanyApiController extends BaseApiController{
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"类型","类型"));
 			return res;
 		}
-		if (thirdPartyCompanyService.checkPayment(p)) {
-			res.getError().add(buildError("金额超出限制,请核对可输入余额。","金额超出限制,请核对可输入余额。"));
-			return res;
-		}
 		if (p.getChooseType()==1&&thirdPartyCompanyService.checkprojectDun(p)) {
 			res.getError().add(buildError("项目节点未达到可付款状态。","项目节点未达到可付款状态。"));
 			return res;
 		}
+		if (thirdPartyCompanyService.checkPayment(p)) {
+			res.getError().add(buildError("金额超出限制,请核对可输入余额。","金额超出限制,请核对可输入余额。"));
+			return res;
+		}
 		if (!res.getError().isEmpty()) {
             return res;
         }

+ 2 - 0
src/main/java/com/goafanti/organization/service/ThirdPartyCompanyService.java

@@ -104,5 +104,7 @@ public interface ThirdPartyCompanyService {
 
 	boolean addCompanyChekeNumber(ThirdPartyCompany t);
 
+	void checkGetAmount(TOrderPayment p);
+
 
 }

+ 68 - 45
src/main/java/com/goafanti/organization/service/impl/ThirdPartyCompanyServiceImpl.java

@@ -27,7 +27,6 @@ import com.goafanti.common.dao.PatentPriceMapper;
 import com.goafanti.common.dao.PaymentLogMapper;
 import com.goafanti.common.dao.PaymentNodeMapper;
 import com.goafanti.common.dao.SoftWritingPriceMapper;
-import com.goafanti.common.dao.TOrderMidMapper;
 import com.goafanti.common.dao.TOrderOutsourceMapper;
 import com.goafanti.common.dao.TOrderPaymentMapper;
 import com.goafanti.common.dao.TOrderTaskMapper;
@@ -92,8 +91,6 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 	@Autowired
 	private OfficialFeePriceMapper	officialFeePriceMapper;
 	@Autowired
-	private TOrderMidMapper tOrderMidMapper;
-	@Autowired
 	private PatentPriceMapper	patentPriceMapper;
 	@Autowired
 	private TOrderOutsourceMapper	tOrderOutsourceMapper;
@@ -119,20 +116,11 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 				t.setTotalAmount(t.getUnitPrice().multiply(new BigDecimal(t.getQuantity())));
 			}
 		thirdPartyCompanyMapper.insertSelective(t);
-		updateOrderCostAmount(t);
 		return 1;
 	}
 
 
-	private void updateOrderCostAmount(ThirdPartyCompany t) {
-		List<OutThirdPartyCompany>list=thirdPartyCompanyMapper.selectByTid(t.getTid());
-		BigDecimal count=new BigDecimal(0);
-		for (OutThirdPartyCompany op : list) {
-			count=count.add(new BigDecimal(op.getTotalAmount()));
-		}
-		
-		tOrderMidMapper.updateCostAmount(t.getTid(),count);
-	}
+	
 
 
 	@Override
@@ -153,7 +141,6 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 			t.setTotalAmount(t.getUnitPrice().multiply(new BigDecimal(t.getQuantity())));
 		}
 		thirdPartyCompanyMapper.updateByPrimaryKeySelective(t);
-		updateOrderCostAmount(t);
 		return 1; 
 	}
 
@@ -202,22 +189,32 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 		if (StringUtils.isNoneBlank(p.getPartyTimes())) {
 			p.setPartyTime(DateUtils.StringToDate(p.getPartyTimes(), AFTConstants.YYYYMMDD));
 		}
+		if (p.getDunType()!=0) {
+			PaymentNode pn=paymentNodeMapper.selectByPrimaryKey(p.getId());
+			 pn.setPartyTime(null);
+			 paymentNodeMapper.updateByPrimaryKey(pn);
+		}
 		return paymentNodeMapper.updateByPrimaryKeySelective(p);
 	}
 
 
 	@Override
 	public List<OutThirdPartyCompany> selectCompany(Integer tid) {
-		List<OutThirdPartyCompany> list=thirdPartyCompanyMapper.selectByTid(tid);
-		outProjectBo op =null;
-		if(!list.isEmpty()) op=tOrderOutsourceMapper.selectByTid(tid);
-		if (op!=null) {
-			if((op.getType()==1&&op.getPatentType()==0)||(op.getType()==2)) {
+ 		List<OutThirdPartyCompany> list=thirdPartyCompanyMapper.selectByTid(tid);
+		if (!TokenManager.hasRole(AFTConstants.FINANCE)&&!TokenManager.hasRole(AFTConstants.OUTSOURCE_AUDITOR)) {
+			outProjectBo op =null;
+			if(!list.isEmpty()) op=tOrderOutsourceMapper.selectByTid(tid);
+			//外包type
+			if (op!=null) {
 				for (OutThirdPartyCompany oc : list) {
-					oc.setUnitPrice("***");
-					oc.setTotalAmount("***");
+					if(op.getProjectType()==null)op.setProjectType(0);
+					if((op.getProjectType()==1&&oc.getType()==1)||(op.getProjectType()==2)) {
+						oc.setUnitPrice("***");
+						oc.setTotalAmount("***");
+					}
 				}
 			}
+					
 		}
 		return list;
 	}
@@ -235,18 +232,14 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 
 	@Override
 	public int deleteCompany(String id) {
-		ThirdPartyCompany p=new ThirdPartyCompany();
 		if (id.contains(",")) {
 			String []ids =id.split(",");
 			for (String s : ids) {
-				p=thirdPartyCompanyMapper.selectByPrimaryKey(Integer.valueOf(s));;
 				thirdPartyCompanyMapper.deleteByPrimaryKey(Integer.valueOf(s));
 			}
 		}else {
-			p=thirdPartyCompanyMapper.selectByPrimaryKey(Integer.valueOf(id));
 			thirdPartyCompanyMapper.deleteByPrimaryKey(Integer.valueOf(id));
 		}
-		updateOrderCostAmount(p);
 		return 1;
 	}
 
@@ -288,28 +281,38 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 		if(!op.getCompanyName().equals(tpc.getCompanyName()))op.setCompanyName(op.getCompanyName()+"("+tpc.getCompanyName()+")");
 		if (type==0) {//支付种类 0第三方 1催款 2官费
 			op.setInitialQuantity(tpc.getQuantity());
-			op.setInitialTotalAmount(tpc.getTotalAmount());
-			op.setInitialUnitPrice(tpc.getUnitPrice());
-			op.setInitialPaymentAmount(tpc.getPartyAmount());
+			op.setInitialTotalAmount(tpc.getTotalAmount().toString());
+			op.setInitialUnitPrice(tpc.getUnitPrice().toString());
+			op.setInitialPaymentAmount(tpc.getPartyAmount().toString());
 			 
 		}else if (type==1) {
 			PaymentNode pn=paymentNodeMapper.selectByPrimaryKey(tp.getNodeId());
 			op.setInitialQuantity(pn.getQuantity());
-			op.setInitialTotalAmount(pn.getTotalAmount());
-			op.setInitialUnitPrice(pn.getUnitPrice());
-			op.setInitialPaymentAmount(pn.getPartyAmount());
+			op.setInitialTotalAmount(pn.getTotalAmount().toString());
+			op.setInitialUnitPrice(pn.getUnitPrice().toString());
+			op.setInitialPaymentAmount(pn.getPartyAmount().toString());
 		}else if (type==2) {
 			op.setInitialQuantity(tpc.getQuantity());
 			TOrderTask tk=tOrderTaskMapper.selectByPrimaryKey(tp.getTid());
 			OrderOutsourceDtails out=tOrderOutsourceMapper.selectByOrderNo(null, tp.getTid().toString());
 			OfficialFeePrice of=officialFeePriceMapper.selectBytype(out.getPatentNameType());
 			 if (tk.getCostReduction()==0) {
-				op.setInitialUnitPrice(of.getAmount());
+				op.setInitialUnitPrice(of.getAmount().toString());
 			}else {
-				op.setInitialUnitPrice(of.getProportion85());
+				op.setInitialUnitPrice(of.getProportion85().toString());
 			}
-			 op.setInitialTotalAmount(op.getInitialUnitPrice().multiply(new BigDecimal(op.getInitialQuantity())));
+			 op.setInitialTotalAmount(new BigDecimal( op.getInitialUnitPrice()).multiply(new BigDecimal(op.getInitialQuantity())).toString());
 		}
+	if (!TokenManager.hasRole(AFTConstants.FINANCE)&&!TokenManager.hasRole(AFTConstants.OUTSOURCE_AUDITOR)) {
+		outProjectBo ob=tOrderOutsourceMapper.selectByTid(tp.getTid());
+		if (ob!=null) {
+			if((ob.getProjectType()==1&&ob.getPatentType()==0)||(ob.getProjectType()==2)) {
+				op.setInitialUnitPrice("***");
+				op.setInitialTotalAmount("***");
+			}
+		}
+		
+	}
 		return op;
 	}
 
@@ -400,12 +403,16 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 	@Override
 	public List<outOrderPayment> selectOrderPayment(Integer id) {
 		List<outOrderPayment> list=tOrderPaymentMapper.selectByTid(id);
-		outProjectBo op =null;
-		if(!list.isEmpty()) op=tOrderOutsourceMapper.selectByTid(id);
-		if (op.getId()!=null) {
-			if((op.getType()==1&&op.getPatentType()==0)||(op.getType()==2)) {
-				for (outOrderPayment oc : list) {
-					oc.setApplicationAmount("***");
+		if (!TokenManager.hasRole(AFTConstants.FINANCE)&&!TokenManager.hasRole(AFTConstants.OUTSOURCE_AUDITOR)) {
+			outProjectBo op =null;
+			if(!list.isEmpty()) op=tOrderOutsourceMapper.selectByTid(id);
+			if (op!=null) {
+				if((op.getProjectType()==1&&op.getPatentType()==0)||(op.getProjectType()==2)) {
+					for (outOrderPayment oc : list) {
+						if (oc.getChooseType()!=2) {
+							oc.setApplicationAmount("***");
+						}
+					}
 				}
 			}
 		}
@@ -464,7 +471,7 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 	@Override
 	public boolean checkPayment(TOrderPayment p) {
 		BigDecimal total=new BigDecimal(0);
-		BigDecimal a=p.getApplicationAmount();
+		BigDecimal a=p.getApplicationAmount()==null?new BigDecimal(0):p.getApplicationAmount();
 		List<outOrderPayment> list=new ArrayList<>();
 		//支付种类 0第三方 1催款2官费
 		if (p.getChooseType()==0) {
@@ -476,9 +483,7 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 			list=tOrderPaymentMapper.selectList(p.getTpcId(),null,p.getChooseType());
 		}
 		for (outOrderPayment o : list) {
-			if (o.getApplicationAmount()!=null) {
 				a=a.add(new BigDecimal(o.getApplicationAmount()));	
-			}
 		}
 		if (p.getChooseType()==0) {
 			ThirdPartyCompany t=thirdPartyCompanyMapper.selectByPrimaryKey(p.getTpcId());
@@ -487,8 +492,12 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 			PaymentNode n=paymentNodeMapper.selectByPrimaryKey(p.getNodeId());
 			total=n.getTotalAmount();
 		}else if (p.getChooseType()==2) {
-			ThirdPartyCompany t=thirdPartyCompanyMapper.selectByPrimaryKey(p.getTpcId());
-			total=t.getOfficialAmount();
+			OutThirdPartyCompany ot=thirdPartyCompanyMapper.selectByIdPuls(p.getTpcId());
+			if (ot.getCostReduction()==0) {
+				total=new BigDecimal(ot.getOfficialUnitPrice()).multiply(new BigDecimal(ot.getQuantity()));
+			}else {
+				total=new BigDecimal(ot.getReductionAmount()).multiply(new BigDecimal(ot.getQuantity()));
+			}
 		}
 		if (a.compareTo(total) != 1) {
 			return false;
@@ -817,6 +826,20 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 
 
 
+	@Override
+	public void checkGetAmount(TOrderPayment p) {
+		if(p.getApplicationAmount()==null) {
+			ThirdPartyCompany tpc=thirdPartyCompanyMapper.selectByPrimaryKey(p.getTpcId());
+			BigDecimal count =tpc.getUnitPrice().multiply(new BigDecimal(p.getQuantity()));
+			p.setApplicationAmount(count);
+		}
+		
+	}
+
+
+
+
+