Browse Source

新增法务催款日志开发

anderx 4 years ago
parent
commit
d038025ac3

+ 5 - 0
src/main/java/com/goafanti/common/dao/TOrderLegalAffairsMapper.java

@@ -1,6 +1,9 @@
 package com.goafanti.common.dao;
 
 import com.goafanti.common.model.TOrderLegalAffairs;
+import com.goafanti.order.bo.OutLegalAffairsLogBo;
+
+import java.util.List;
 
 public interface TOrderLegalAffairsMapper {
     int deleteByPrimaryKey(Integer id);
@@ -14,4 +17,6 @@ public interface TOrderLegalAffairsMapper {
     int updateByPrimaryKeySelective(TOrderLegalAffairs record);
 
     int updateByPrimaryKey(TOrderLegalAffairs record);
+
+    List<OutLegalAffairsLogBo> lagalAffairsLogList(String orderNo);
 }

+ 24 - 4
src/main/java/com/goafanti/common/mapper/TOrderLegalAffairsMapper.xml

@@ -10,9 +10,11 @@
     <result column="attachment_url" jdbcType="VARCHAR" property="attachmentUrl" />
     <result column="operation_time" jdbcType="DATE" property="operationTime" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="aid" jdbcType="VARCHAR" property="aid" />
   </resultMap>
   <sql id="Base_Column_List">
-    id, order_no, `type`, `status`, remarks, attachment_url, operation_time, create_time
+    id, order_no, `type`, `status`, remarks, attachment_url, operation_time, create_time, 
+    aid
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select 
@@ -20,6 +22,7 @@
     from t_order_legal_affairs
     where id = #{id,jdbcType=INTEGER}
   </select>
+
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
     delete from t_order_legal_affairs
     where id = #{id,jdbcType=INTEGER}
@@ -27,10 +30,10 @@
   <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderLegalAffairs" useGeneratedKeys="true">
     insert into t_order_legal_affairs (order_no, `type`, `status`, 
       remarks, attachment_url, operation_time, 
-      create_time)
+      create_time, aid)
     values (#{orderNo,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, 
       #{remarks,jdbcType=VARCHAR}, #{attachmentUrl,jdbcType=VARCHAR}, #{operationTime,jdbcType=DATE}, 
-      #{createTime,jdbcType=TIMESTAMP})
+      #{createTime,jdbcType=TIMESTAMP}, #{aid,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderLegalAffairs" useGeneratedKeys="true">
     insert into t_order_legal_affairs
@@ -56,6 +59,9 @@
       <if test="createTime != null">
         create_time,
       </if>
+      <if test="aid != null">
+        aid,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="orderNo != null">
@@ -79,6 +85,9 @@
       <if test="createTime != null">
         #{createTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="aid != null">
+        #{aid,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderLegalAffairs">
@@ -105,6 +114,9 @@
       <if test="createTime != null">
         create_time = #{createTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="aid != null">
+        aid = #{aid,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -116,7 +128,15 @@
       remarks = #{remarks,jdbcType=VARCHAR},
       attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
       operation_time = #{operationTime,jdbcType=DATE},
-      create_time = #{createTime,jdbcType=TIMESTAMP}
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      aid = #{aid,jdbcType=VARCHAR}
     where id = #{id,jdbcType=INTEGER}
   </update>
+  <select id="lagalAffairsLogList" resultType="com.goafanti.order.bo.OutLegalAffairsLogBo">
+    select a.id,a.order_no orderNo,a.`type` ,a.status,a.remarks ,a.attachment_url attachmentUrl,
+           date_format(a.operation_time ,'%Y-%m-%d')operationDate,date_format(a.create_time ,'%Y-%m-%d %H:%i:%S')createDate,
+           b.name adminName,c.buyer_name userName
+    from t_order_legal_affairs a left join admin b on a.aid=b.id left join t_order_mid c on a.order_no =c.order_no
+    where a.order_no = #{orderNo}
+  </select>
 </mapper>

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

@@ -399,7 +399,7 @@
     a.total_amount totalAmount ,a.settlement_amount  settlementAmount ,b.order_receivables orderReceivables,b.legal_affairs legalAffairs,
     b.order_arrears orderArrears,b.dun_start_time dunStartTime,date_format(b.dun_start_time,'%Y-%m-%d %H:%i:%S')dunStartTimes
     <if test="type==1 or type==2 or type==3">
-      ,b.operation_time operationTime,b.`type`
+      ,b.operation_time operationTime,date_format(b.operation_time,'%Y-%m-%d %H:%i:%S')operationDate,b.legal_affairs_type `type`
     </if>
     from t_order_new a left join t_order_mid b on a.order_no =b.order_no
     <if test="shiro == 2">

+ 19 - 3
src/main/java/com/goafanti/common/model/TOrderLegalAffairs.java

@@ -19,12 +19,12 @@ public class TOrderLegalAffairs implements Serializable {
     private String orderNo;
 
     /**
-     * 法务状态 0法务催收中 1延期法务 2已完成法务
+     * 法务分类 0法务催收中 1延期法务 2已完成法务
      */
     private Integer type;
 
     /**
-     * 0否 1已回款 2已诉讼 3已坏账处理
+     * 法务状态 0否 1已回款 2已诉讼 3已坏账处理
      */
     private Integer status;
 
@@ -48,6 +48,11 @@ public class TOrderLegalAffairs implements Serializable {
      */
     private Date createTime;
 
+    /**
+     * 操作人
+     */
+    private String aid;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -114,6 +119,14 @@ public class TOrderLegalAffairs implements Serializable {
         this.createTime = createTime;
     }
 
+    public String getAid() {
+        return aid;
+    }
+
+    public void setAid(String aid) {
+        this.aid = aid;
+    }
+
     @Override
     public boolean equals(Object that) {
         if (this == that) {
@@ -133,7 +146,8 @@ public class TOrderLegalAffairs implements Serializable {
             && (this.getRemarks() == null ? other.getRemarks() == null : this.getRemarks().equals(other.getRemarks()))
             && (this.getAttachmentUrl() == null ? other.getAttachmentUrl() == null : this.getAttachmentUrl().equals(other.getAttachmentUrl()))
             && (this.getOperationTime() == null ? other.getOperationTime() == null : this.getOperationTime().equals(other.getOperationTime()))
-            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getAid() == null ? other.getAid() == null : this.getAid().equals(other.getAid()));
     }
 
     @Override
@@ -148,6 +162,7 @@ public class TOrderLegalAffairs implements Serializable {
         result = prime * result + ((getAttachmentUrl() == null) ? 0 : getAttachmentUrl().hashCode());
         result = prime * result + ((getOperationTime() == null) ? 0 : getOperationTime().hashCode());
         result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getAid() == null) ? 0 : getAid().hashCode());
         return result;
     }
 
@@ -165,6 +180,7 @@ public class TOrderLegalAffairs implements Serializable {
         sb.append(", attachmentUrl=").append(attachmentUrl);
         sb.append(", operationTime=").append(operationTime);
         sb.append(", createTime=").append(createTime);
+        sb.append(", aid=").append(aid);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

+ 94 - 0
src/main/java/com/goafanti/order/bo/OutLegalAffairsLogBo.java

@@ -0,0 +1,94 @@
+package com.goafanti.order.bo;
+
+public class OutLegalAffairsLogBo {
+    private Integer id;
+    private String orderNo;
+    private String attachmentUrl;
+    private String adminName;
+    private String userName;
+    private String operationDate;
+    private String remarks;
+    private Integer type;
+    private Integer status;
+    private String createDate;
+
+    public String getAdminName() {
+        return adminName;
+    }
+
+    public void setAdminName(String adminName) {
+        this.adminName = adminName;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public String getAttachmentUrl() {
+        return attachmentUrl;
+    }
+
+    public void setAttachmentUrl(String attachmentUrl) {
+        this.attachmentUrl = attachmentUrl;
+    }
+
+    public String getOperationDate() {
+        return operationDate;
+    }
+
+    public void setOperationDate(String operationDate) {
+        this.operationDate = operationDate;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getCreateDate() {
+        return createDate;
+    }
+
+    public void setCreateDate(String createDate) {
+        this.createDate = createDate;
+    }
+}

+ 5 - 5
src/main/java/com/goafanti/order/bo/OutOrderLegalAffairsBo.java

@@ -8,16 +8,16 @@ import java.util.Date;
 public class OutOrderLegalAffairsBo extends OutOrderLegalAffairsListBo {
 
     @Excel(name = "法务时间")
-    private Date operationTime;
+    private String  operationDate;
     @Excel(name = "法务类型",readConverterExp = "0=法务催收中,1=延期法务,2=已完成法务")
     private Integer type;
 
-    public Date getOperationTime() {
-        return operationTime;
+    public String getOperationDate() {
+        return operationDate;
     }
 
-    public void setOperationTime(Date operationTime) {
-        this.operationTime = operationTime;
+    public void setOperationDate(String operationDate) {
+        this.operationDate = operationDate;
     }
 
     public Integer getType() {

+ 1 - 0
src/main/java/com/goafanti/order/bo/OutOrderLegalAffairsListBo.java

@@ -32,6 +32,7 @@ public class OutOrderLegalAffairsListBo {
     private Integer legalAffairs;
     private Integer daysRemaining;
     private Date operationTime;
+    private String operationDate;
 
     private Integer type;
 

+ 17 - 36
src/main/java/com/goafanti/order/controller/LegalAffairsApiController.java

@@ -1,6 +1,7 @@
 package com.goafanti.order.controller;
 
 import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.enums.ActivityFields;
@@ -27,8 +28,7 @@ public class LegalAffairsApiController extends CertifyApiController {
     @Autowired
     private LegalAffairsService legalAffairsService;
 
-    @Value(value = "${upload.path}")
-    private String uploadPath = null;
+
 
     /**
      * 订单催款转交法务
@@ -71,39 +71,7 @@ public class LegalAffairsApiController extends CertifyApiController {
      */
     @RequestMapping(value = "/orderList/Exprot",method = RequestMethod.GET)
     public Result orderListExprot(InputOrderListBo in){
-        List<OutOrderLegalAffairsListBo> use = legalAffairsService.getLegalAffairsOrder(in);
-        NewExcelUtil newExcelUtil;
-        List<Object> list=new ArrayList<>();
-        String tile= new String();
-        if (in.getType()==0){
-            for (OutOrderLegalAffairsListBo out : use) {
-                OutOrderLegalAffairsSalesmanBo bo = new OutOrderLegalAffairsSalesmanBo();
-                BeanUtils.copyProperties(out,bo);
-                list.add(bo);
-            }
-            newExcelUtil=new NewExcelUtil<>(OutOrderLegalAffairsSalesmanBo.class);
-            tile="订单催款列表";
-        }else {
-            for (OutOrderLegalAffairsListBo out : use) {
-                OutOrderLegalAffairsBo bo = new OutOrderLegalAffairsBo();
-                BeanUtils.copyProperties(out,bo);
-                list.add(bo);
-            }
-            newExcelUtil=new NewExcelUtil<>(OutOrderLegalAffairsBo.class);
-            if(in.getType()==1){tile="法务催款列表";}
-            else if(in.getType()==2){tile="延期法务列表";}
-            else if(in.getType()==3){tile="已完成法务列表";}
-        }
-        StringBuffer sb=new StringBuffer("搜索条件=》");
-        if (in.getUserName()!=null)sb=sb.append("客户名称:").append(in.getUserName()).append(",");
-        if (in.getLegalAffairs()!=null)sb=sb.append("转交法务:").append(in.getLegalAffairs()==0?"未转交":"已转交").append(",");
-        if (in.getContractNo()!=null)sb=sb.append("合同编号:").append(in.getContractNo()).append(",");
-        if (in.getDepName()!=null)sb=sb.append("订单部门:").append(in.getDepName()).append(",");
-        if (in.getStartTime()!=null&&in.getEndTime()!=null){
-            sb=sb.append("催款启动时间:").append(in.getStartTime()).append("~").append(in.getEndTime()).append(",");
-
-        }
-        return newExcelUtil.exportExcel(list,tile,uploadPath,sb.substring(0,sb.length()-1));
+        return legalAffairsService.orderListExprot(in);
     }
     /**
      * 订单催款日志列表(法务)
@@ -150,13 +118,26 @@ public class LegalAffairsApiController extends CertifyApiController {
                     OrderLegalAffairsState.getFieldDesc(bindingResult.getFieldError().getField())));
             return res;
         }
-
         res.data(legalAffairsService.addLagalAffairsLog(in));
         return res;
+    }
 
+    /**
+     * 法务记录列表
+     * @return
+     */
+    @RequestMapping(value = "/lagalAffairsLogList",method = RequestMethod.GET)
+    public Result lagalAffairsLogList(String orderNo){
+        Result res =new Result();
+        if (orderNo==null){
+            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,ErrorConstants.PARAM_EMPTY_ERROR,"订单编号"));
+        }
+        res.data(legalAffairsService.lagalAffairsLogList(orderNo));
+        return res;
     }
 
 
 
 
+
 }

+ 5 - 0
src/main/java/com/goafanti/order/service/LegalAffairsService.java

@@ -1,5 +1,6 @@
 package com.goafanti.order.service;
 
+import com.goafanti.common.bo.Result;
 import com.goafanti.order.bo.*;
 
 import java.util.List;
@@ -22,4 +23,8 @@ public interface LegalAffairsService {
     int addDunOrder(InputDunOrder in);
 
     int addLagalAffairsLog(InputOrderLegalAffairs in);
+
+    List<OutLegalAffairsLogBo> lagalAffairsLogList(String orderNo);
+
+    Result orderListExprot(InputOrderListBo in);
 }

+ 49 - 0
src/main/java/com/goafanti/order/service/impl/LegalAffairsServiceImpl.java

@@ -1,11 +1,13 @@
 package com.goafanti.order.service.impl;
 
+import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.model.TDunLog;
 import com.goafanti.common.model.TOrderLegalAffairs;
 import com.goafanti.common.model.TOrderMid;
 import com.goafanti.common.utils.DateUtils;
+import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
@@ -13,6 +15,7 @@ import com.goafanti.order.bo.*;
 import com.goafanti.order.enums.NewProjectStatus;
 import com.goafanti.order.service.LegalAffairsService;
 import org.apache.poi.ss.formula.functions.Now;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -32,6 +35,8 @@ public class LegalAffairsServiceImpl extends BaseMybatisDao<TOrderMidMapper> imp
     private TOrderLegalAffairsMapper tOrderLegalAffairsMapper;
     @Autowired
     private AdminMapper adminMapper;
+    @Value(value = "${upload.path}")
+    private String uploadPath = null;
 
 
 
@@ -154,6 +159,7 @@ public class LegalAffairsServiceImpl extends BaseMybatisDao<TOrderMidMapper> imp
         la.setType(in.getType());
         la.setStatus(in.getStatus());
         la.setAttachmentUrl(in.getAttachmentUrl());
+        la.setAid(TokenManager.getAdminId());
         la.setOperationTime(DateUtils.StringToDate(in.getDate(),AFTConstants.YYYYMMDD));
         TOrderMid tm = new TOrderMid();
         tm.setOrderNo(in.getOrderNo());
@@ -162,4 +168,47 @@ public class LegalAffairsServiceImpl extends BaseMybatisDao<TOrderMidMapper> imp
         tOrderMidMapper.updateByOrderNo(tm);
         return tOrderLegalAffairsMapper.insertSelective(la);
     }
+
+    @Override
+    public List<OutLegalAffairsLogBo> lagalAffairsLogList(String orderNo) {
+        return tOrderLegalAffairsMapper.lagalAffairsLogList(orderNo);
+    }
+
+    @Override
+    public Result orderListExprot(InputOrderListBo in) {
+        List<OutOrderLegalAffairsListBo> use = getLegalAffairsOrder(in);
+        NewExcelUtil newExcelUtil;
+        List<Object> list=new ArrayList<>();
+        String tile= new String();
+        if (in.getType()==0){
+            for (OutOrderLegalAffairsListBo out : use) {
+                OutOrderLegalAffairsSalesmanBo bo = new OutOrderLegalAffairsSalesmanBo();
+                BeanUtils.copyProperties(out,bo);
+                list.add(bo);
+            }
+            newExcelUtil=new NewExcelUtil<>(OutOrderLegalAffairsSalesmanBo.class);
+            tile="订单催款列表";
+        }else {
+            for (OutOrderLegalAffairsListBo out : use) {
+                OutOrderLegalAffairsBo bo = new OutOrderLegalAffairsBo();
+                BeanUtils.copyProperties(out,bo);
+                list.add(bo);
+            }
+            newExcelUtil=new NewExcelUtil<>(OutOrderLegalAffairsBo.class);
+            if(in.getType()==1){tile="法务催款列表";}
+            else if(in.getType()==2){tile="延期法务列表";}
+            else if(in.getType()==3){tile="已完成法务列表";}
+        }
+        StringBuffer sb=new StringBuffer("搜索条件=》");
+        if (in.getUserName()!=null)sb=sb.append("客户名称:").append(in.getUserName()).append(",");
+        if (in.getLegalAffairs()!=null)sb=sb.append("转交法务:").append(in.getLegalAffairs()==0?"未转交":"已转交").append(",");
+        if (in.getContractNo()!=null)sb=sb.append("合同编号:").append(in.getContractNo()).append(",");
+        if (in.getDepName()!=null)sb=sb.append("订单部门:").append(in.getDepName()).append(",");
+        if (in.getStartTime()!=null&&in.getEndTime()!=null){
+            if (in.getType()==0)sb=sb.append("催款启动时间:");
+            if (in.getType()==1||in.getType()==2||in.getType()==3)sb=sb.append("法务时间:");
+            sb=sb.append(in.getStartTime()).append("~").append(in.getEndTime()).append(",");
+        }
+        return newExcelUtil.exportExcel(list,tile,uploadPath,sb.substring(0,sb.length()-1));
+    }
 }