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

订单中间表新增会员字段,修改合同变更,发起,新增时触发修改中间表,修改订单列表获取项目分类

anderx лет назад: 3
Родитель
Сommit
9299da5ca1

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

@@ -45,4 +45,6 @@ public interface TOrderMidMapper {
     List<ErrorDunListBo> selectErrorDun();
 
     void updateErrorDun();
+
+    int judgeProjectType(String orderNo);
 }

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

@@ -24,12 +24,13 @@
     <result column="legal_affairs_type" jdbcType="INTEGER" property="legalAffairsType" />
     <result column="operation_time" jdbcType="DATE" property="operationTime" />
     <result column="legal_affairs_status" jdbcType="INTEGER" property="legalAffairsStatus" />
+    <result column="project_type" jdbcType="INTEGER" property="projectType" />
   </resultMap>
   <sql id="Base_Column_List">
     id, order_no, salesman_id, finance_id, salesman_name, finance_name, final_receivables,
     final_Receivables_time, invoice_amount, create_time, buyer_name, order_receivables,
     order_arrears, payment_amount, cost_amount, dep_name, province_name, legal_affairs,
-    dun_start_time, legal_affairs_type, operation_time, legal_affairs_status
+    dun_start_time, legal_affairs_type, operation_time, legal_affairs_status, project_type
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
@@ -49,7 +50,7 @@
       order_arrears, payment_amount, cost_amount,
       dep_name, province_name, legal_affairs,
       dun_start_time, legal_affairs_type, operation_time,
-      legal_affairs_status)
+      legal_affairs_status, project_type)
     values (#{orderNo,jdbcType=VARCHAR}, #{salesmanId,jdbcType=VARCHAR}, #{financeId,jdbcType=VARCHAR},
       #{salesmanName,jdbcType=VARCHAR}, #{financeName,jdbcType=VARCHAR}, #{finalReceivables,jdbcType=DECIMAL},
       #{finalReceivablesTime,jdbcType=TIMESTAMP}, #{invoiceAmount,jdbcType=DECIMAL},
@@ -57,7 +58,7 @@
       #{orderArrears,jdbcType=DECIMAL}, #{paymentAmount,jdbcType=DECIMAL}, #{costAmount,jdbcType=DECIMAL},
       #{depName,jdbcType=VARCHAR}, #{provinceName,jdbcType=VARCHAR}, #{legalAffairs,jdbcType=INTEGER},
       #{dunStartTime,jdbcType=TIMESTAMP}, #{legalAffairsType,jdbcType=INTEGER}, #{operationTime,jdbcType=DATE},
-      #{legalAffairsStatus,jdbcType=INTEGER})
+      #{legalAffairsStatus,jdbcType=INTEGER}, #{projectType,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderMid" useGeneratedKeys="true">
     insert into t_order_mid
@@ -125,6 +126,9 @@
       <if test="legalAffairsStatus != null">
         legal_affairs_status,
       </if>
+      <if test="projectType != null">
+        project_type,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="orderNo != null">
@@ -190,6 +194,9 @@
       <if test="legalAffairsStatus != null">
         #{legalAffairsStatus,jdbcType=INTEGER},
       </if>
+      <if test="projectType != null">
+        #{projectType,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderMid">
@@ -258,6 +265,9 @@
       <if test="legalAffairsStatus != null">
         legal_affairs_status = #{legalAffairsStatus,jdbcType=INTEGER},
       </if>
+      <if test="projectType != null">
+        project_type = #{projectType,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -283,7 +293,8 @@
       dun_start_time = #{dunStartTime,jdbcType=TIMESTAMP},
       legal_affairs_type = #{legalAffairsType,jdbcType=INTEGER},
       operation_time = #{operationTime,jdbcType=DATE},
-      legal_affairs_status = #{legalAffairsStatus,jdbcType=INTEGER}
+      legal_affairs_status = #{legalAffairsStatus,jdbcType=INTEGER},
+      project_type = #{projectType,jdbcType=INTEGER}
     where id = #{id,jdbcType=INTEGER}
   </update>
   <select id="selectByOrderNo" resultMap="BaseResultMap">
@@ -399,6 +410,9 @@
       <if test="legalAffairsStatus != null">
         legal_affairs_status = #{legalAffairsStatus,jdbcType=INTEGER},
       </if>
+      <if test="projectType != null">
+        project_type = #{projectType,jdbcType=INTEGER},
+      </if>
     </set>
     where order_no = #{orderNo,jdbcType=VARCHAR}
   </update>
@@ -541,4 +555,9 @@
     set a.order_receivables=b.money,a.order_arrears =(b.money-c.settlement_amount)
     where a.order_no =b.order_no and a.order_no =c.order_no and a.order_receivables !=b.money;
   </update>
+  <select id="judgeProjectType" resultType="java.lang.Integer">
+    select count(*) from t_order_new a left join t_order_task b on a.order_no =b.order_no
+                                       left join business_project c on b.commodity_id =c.id left join business_category d on c.cid =d.id
+    where d.sort =6 and a.order_no = #{orderNo}
+  </select>
 </mapper>

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

@@ -839,7 +839,7 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
   <select id="selectOrderNewListByPage" resultType="com.goafanti.order.bo.TOrderNewBo">
   	select a.order_no as orderNo,a.create_time as createTime, date_format(a.sign_time,'%Y-%m-%d' ) as signDate,a.delete_sign deleteSign,
   	a.contract_no as contractNo, b.nickname as userName ,a.process_status as processStatus,a.total_amount as totalAmount,
-  	a.order_status as orderStatus, a.liquidation_status as liquidationStatus,a.approval,c.salesman_name as salesmanName,
+  	a.order_status as orderStatus, a.liquidation_status as liquidationStatus,a.approval,c.salesman_name as salesmanName,c.project_type projectType,
   	dep.name as depName,c.finance_name as financeName,c.invoice_amount invoiceAmount,a.settlement_amount settlementAmount
   	<if test="specially == 2">
   	,f.name as initiateName ,e.reason ,date_format(e.create_time,'%Y-%m-%d' ) as backDate,e.id as backId

+ 11 - 96
src/main/java/com/goafanti/common/model/TOrderMid.java

@@ -119,6 +119,11 @@ public class TOrderMid implements Serializable {
      */
     private Integer legalAffairsStatus;
 
+    /**
+     * 会员 0否 1是
+     */
+    private Integer projectType;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -297,101 +302,11 @@ public class TOrderMid implements Serializable {
         this.legalAffairsStatus = legalAffairsStatus;
     }
 
-    @Override
-    public boolean equals(Object that) {
-        if (this == that) {
-            return true;
-        }
-        if (that == null) {
-            return false;
-        }
-        if (getClass() != that.getClass()) {
-            return false;
-        }
-        TOrderMid other = (TOrderMid) that;
-        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
-            && (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo()))
-            && (this.getSalesmanId() == null ? other.getSalesmanId() == null : this.getSalesmanId().equals(other.getSalesmanId()))
-            && (this.getFinanceId() == null ? other.getFinanceId() == null : this.getFinanceId().equals(other.getFinanceId()))
-            && (this.getSalesmanName() == null ? other.getSalesmanName() == null : this.getSalesmanName().equals(other.getSalesmanName()))
-            && (this.getFinanceName() == null ? other.getFinanceName() == null : this.getFinanceName().equals(other.getFinanceName()))
-            && (this.getFinalReceivables() == null ? other.getFinalReceivables() == null : this.getFinalReceivables().equals(other.getFinalReceivables()))
-            && (this.getFinalReceivablesTime() == null ? other.getFinalReceivablesTime() == null : this.getFinalReceivablesTime().equals(other.getFinalReceivablesTime()))
-            && (this.getInvoiceAmount() == null ? other.getInvoiceAmount() == null : this.getInvoiceAmount().equals(other.getInvoiceAmount()))
-            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
-            && (this.getBuyerName() == null ? other.getBuyerName() == null : this.getBuyerName().equals(other.getBuyerName()))
-            && (this.getOrderReceivables() == null ? other.getOrderReceivables() == null : this.getOrderReceivables().equals(other.getOrderReceivables()))
-            && (this.getOrderArrears() == null ? other.getOrderArrears() == null : this.getOrderArrears().equals(other.getOrderArrears()))
-            && (this.getPaymentAmount() == null ? other.getPaymentAmount() == null : this.getPaymentAmount().equals(other.getPaymentAmount()))
-            && (this.getCostAmount() == null ? other.getCostAmount() == null : this.getCostAmount().equals(other.getCostAmount()))
-            && (this.getDepName() == null ? other.getDepName() == null : this.getDepName().equals(other.getDepName()))
-            && (this.getProvinceName() == null ? other.getProvinceName() == null : this.getProvinceName().equals(other.getProvinceName()))
-            && (this.getLegalAffairs() == null ? other.getLegalAffairs() == null : this.getLegalAffairs().equals(other.getLegalAffairs()))
-            && (this.getDunStartTime() == null ? other.getDunStartTime() == null : this.getDunStartTime().equals(other.getDunStartTime()))
-            && (this.getLegalAffairsType() == null ? other.getLegalAffairsType() == null : this.getLegalAffairsType().equals(other.getLegalAffairsType()))
-            && (this.getOperationTime() == null ? other.getOperationTime() == null : this.getOperationTime().equals(other.getOperationTime()))
-            && (this.getLegalAffairsStatus() == null ? other.getLegalAffairsStatus() == null : this.getLegalAffairsStatus().equals(other.getLegalAffairsStatus()));
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
-        result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode());
-        result = prime * result + ((getSalesmanId() == null) ? 0 : getSalesmanId().hashCode());
-        result = prime * result + ((getFinanceId() == null) ? 0 : getFinanceId().hashCode());
-        result = prime * result + ((getSalesmanName() == null) ? 0 : getSalesmanName().hashCode());
-        result = prime * result + ((getFinanceName() == null) ? 0 : getFinanceName().hashCode());
-        result = prime * result + ((getFinalReceivables() == null) ? 0 : getFinalReceivables().hashCode());
-        result = prime * result + ((getFinalReceivablesTime() == null) ? 0 : getFinalReceivablesTime().hashCode());
-        result = prime * result + ((getInvoiceAmount() == null) ? 0 : getInvoiceAmount().hashCode());
-        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
-        result = prime * result + ((getBuyerName() == null) ? 0 : getBuyerName().hashCode());
-        result = prime * result + ((getOrderReceivables() == null) ? 0 : getOrderReceivables().hashCode());
-        result = prime * result + ((getOrderArrears() == null) ? 0 : getOrderArrears().hashCode());
-        result = prime * result + ((getPaymentAmount() == null) ? 0 : getPaymentAmount().hashCode());
-        result = prime * result + ((getCostAmount() == null) ? 0 : getCostAmount().hashCode());
-        result = prime * result + ((getDepName() == null) ? 0 : getDepName().hashCode());
-        result = prime * result + ((getProvinceName() == null) ? 0 : getProvinceName().hashCode());
-        result = prime * result + ((getLegalAffairs() == null) ? 0 : getLegalAffairs().hashCode());
-        result = prime * result + ((getDunStartTime() == null) ? 0 : getDunStartTime().hashCode());
-        result = prime * result + ((getLegalAffairsType() == null) ? 0 : getLegalAffairsType().hashCode());
-        result = prime * result + ((getOperationTime() == null) ? 0 : getOperationTime().hashCode());
-        result = prime * result + ((getLegalAffairsStatus() == null) ? 0 : getLegalAffairsStatus().hashCode());
-        return result;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append(getClass().getSimpleName());
-        sb.append(" [");
-        sb.append("Hash = ").append(hashCode());
-        sb.append(", id=").append(id);
-        sb.append(", orderNo=").append(orderNo);
-        sb.append(", salesmanId=").append(salesmanId);
-        sb.append(", financeId=").append(financeId);
-        sb.append(", salesmanName=").append(salesmanName);
-        sb.append(", financeName=").append(financeName);
-        sb.append(", finalReceivables=").append(finalReceivables);
-        sb.append(", finalReceivablesTime=").append(finalReceivablesTime);
-        sb.append(", invoiceAmount=").append(invoiceAmount);
-        sb.append(", createTime=").append(createTime);
-        sb.append(", buyerName=").append(buyerName);
-        sb.append(", orderReceivables=").append(orderReceivables);
-        sb.append(", orderArrears=").append(orderArrears);
-        sb.append(", paymentAmount=").append(paymentAmount);
-        sb.append(", costAmount=").append(costAmount);
-        sb.append(", depName=").append(depName);
-        sb.append(", provinceName=").append(provinceName);
-        sb.append(", legalAffairs=").append(legalAffairs);
-        sb.append(", dunStartTime=").append(dunStartTime);
-        sb.append(", legalAffairsType=").append(legalAffairsType);
-        sb.append(", operationTime=").append(operationTime);
-        sb.append(", legalAffairsStatus=").append(legalAffairsStatus);
-        sb.append(", serialVersionUID=").append(serialVersionUID);
-        sb.append("]");
-        return sb.toString();
+    public Integer getProjectType() {
+        return projectType;
+    }
+
+    public void setProjectType(Integer projectType) {
+        this.projectType = projectType;
     }
 }

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

@@ -48,14 +48,18 @@ public class TOrderNewBo extends TOrderNew{
 	private Integer dunStatus;
 	private BigDecimal appropriationRatio;
 	private BigDecimal setUpAmount;
-	
+
 	private List<?> dunList;
 	private List<?> taskList;
 	/**
 	 * 是否变更 0否 1是
 	 */
 	private Integer ischange;
-	
+
+
+
+
+
 	public String getDunSubject() {
 		if(getDunType()!=null&&getProjectType()!=null)return NewOrderDunType.getValueByCode(Integer.valueOf(""+getProjectType()+getDunType()));
 		if(dunSubject!=null)return OrderDunSubject.getValueByCode(Integer.valueOf(dunSubject));
@@ -135,7 +139,7 @@ public class TOrderNewBo extends TOrderNew{
 			return DateFormatUtils.format(super.getCreateTime(), AFTConstants.YYYYMMDDHHMMSS);
 		}
 	}
-	
+
 	public String getUpdateDate() {
 		if (super.getUpdateTime() == null) {
 			return null;
@@ -368,5 +372,5 @@ public class TOrderNewBo extends TOrderNew{
 	public void setNickname(String nickname) {
 		this.nickname = nickname;
 	}
-	
+
 }

+ 10 - 17
src/main/java/com/goafanti/order/service/impl/OrderChangeServiceImpl.java

@@ -13,6 +13,7 @@ import java.util.UUID;
 
 import javax.servlet.http.HttpServletResponse;
 
+import com.goafanti.common.dao.*;
 import com.goafanti.common.model.*;
 import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.apache.poi.xssf.usermodel.XSSFRow;
@@ -27,23 +28,6 @@ import com.goafanti.admin.bo.AdminListBo;
 import com.goafanti.common.bo.Error;
 import com.goafanti.common.bo.OrderExamineBo;
 import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.dao.AdminMapper;
-import com.goafanti.common.dao.NewOrderChangeMapper;
-import com.goafanti.common.dao.NewOrderDunMapper;
-import com.goafanti.common.dao.NewOrderRefundMapper;
-import com.goafanti.common.dao.OrderChangeLogMapper;
-import com.goafanti.common.dao.OrderExamineMapper;
-import com.goafanti.common.dao.OrderRefundInvoiceMapper;
-import com.goafanti.common.dao.OrganizationManagementMapper;
-import com.goafanti.common.dao.TChangeDunMapper;
-import com.goafanti.common.dao.TChangeTaskMapper;
-import com.goafanti.common.dao.TOrderBillNewMapper;
-import com.goafanti.common.dao.TOrderInvoiceMapper;
-import com.goafanti.common.dao.TOrderLogMapper;
-import com.goafanti.common.dao.TOrderNewMapper;
-import com.goafanti.common.dao.TOrderTaskMapper;
-import com.goafanti.common.dao.TTaskMidMapper;
-import com.goafanti.common.dao.UserLockReleaseMapper;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.utils.DateUtils;
@@ -123,6 +107,8 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 	private UserLockReleaseMapper	userLockReleaseMapper;
 	@Autowired
 	private PushOrderService pushOrderService;
+	@Autowired
+	private TOrderMidMapper tOrderMidMapper;
 
 	Logger							logger	= LoggerFactory.getLogger(OrderChangeServiceImpl.class);
 
@@ -476,6 +462,13 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		orderNew.setOrderNo(nb.getOrderNo());
 		orderNew.setDeleteSign(0);
 		orderNew.setPrimaryOrder(newOrderNo);
+		int i =tOrderMidMapper.judgeProjectType(nb.getOrderNo());
+		if (i>0){
+			TOrderMid tm=new TOrderMid();
+			tm.setOrderNo(nb.getOrderNo());
+			tm.setProjectType(1);
+			tOrderMidMapper.updateByOrderNo(tm);
+		}
 		tOrderNewMapper.updateByPrimaryKeySelective(orderNew);
 	}
 

+ 15 - 0
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -137,6 +137,8 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	private PushOrderService pushOrderService;
 	@Autowired
 	private BusinessProjectMapper businessProjectMapper;
+	@Autowired
+	private BusinessCategoryMapper businessCategoryMapper;
 
 	Logger							logger	= LoggerFactory.getLogger(OrderNewServiceImpl.class);
 
@@ -194,6 +196,13 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		if (b.getType()==5){
 			int i=tOrderTaskMapper.getHighNewRetrial(order.getOrderNo());
 			if (i>0) highNewRetrial =1;
+			BusinessCategory bc =businessCategoryMapper.selectByPrimaryKey(b.getCid());
+			if (bc !=null && bc.getSort().equals(6)){
+				TOrderMid tom=new TOrderMid();
+				tom.setOrderNo(t.getOrderNo());
+				tom.setProjectType(1);
+				tOrderMidMapper.updateByOrderNo(tom);
+			}
 		}
 		tm.setHighNewRetrial(highNewRetrial);
 		tTaskMidMapper.insertSelective(tm);
@@ -388,6 +397,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		Admin admin=adminMapper.selectFinanceAdminByOrderDep(t.getOrderDep());
 		Admin a=adminMapper.selectAllByid(TokenManager.getAdminId());
 		User u=userMapper.selectByPrimaryKey(t.getBuyerId());
+
 		if (tm==null) tm=new TOrderMid();
 			tm.setOrderNo(t.getOrderNo());
 		if (u!=null&&u.getNickname()!=null) {
@@ -401,6 +411,11 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			tm.setSalesmanId(a.getId());
 			tm.setSalesmanName(a.getName());
 		}
+		//判断订单是否为会员订单
+		int i =tOrderMidMapper.judgeProjectType(t.getOrderNo());
+		if (i>0){
+			tm.setProjectType(1);
+		}
 		tm.setDepName(tOrderMidMapper.selectDepNameByDepid(t.getOrderDep()));
 		if (tm.getId()!=null) {
 			tOrderMidMapper.updateByPrimaryKeySelective(tm);

+ 1 - 1
src/main/resources/props/config_local.properties

@@ -1,6 +1,6 @@
 dev.name=local
 jdbc.driverClassName=com.mysql.jdbc.Driver
-jdbc.url=jdbc\:mysql://localhost:3306/aft20220225?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 jdbc.username=root
 jdbc.password=123456
 #jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false