Przeglądaj źródła

添加更新状态记录表信息

hxl13994548489 1 rok temu
rodzic
commit
0e54978ffc

+ 8 - 2
src/main/java/com/ydtech/modules/ins/service/InsTaskHistoryService.java

@@ -2,6 +2,7 @@ package com.ydtech.modules.ins.service;
 
 import com.ydtech.modules.ins.dao.InsTaskHistoryDao;
 import com.ydtech.modules.ins.model.InsOrder;
+import com.ydtech.modules.ins.model.InsTaskHistory;
 
 import java.util.Date;
 
@@ -16,6 +17,11 @@ public interface InsTaskHistoryService extends InsTaskHistoryDao {
      * @date: 2023年02月16日 0016
      */
     public Integer insertByOrderStatus(InsOrder order);
-
-
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/8 11:13
+     *  @Description: 金
+     */
+    public void insertByUpdateMethod(InsTaskHistory history);
 }

+ 5 - 0
src/main/java/com/ydtech/modules/ins/service/impl/InsTaskHistoryServiceImpl.java

@@ -58,4 +58,9 @@ public class InsTaskHistoryServiceImpl extends InsTaskHistoryDaoImpl
 
         return null;
     }
+
+    @Override
+    public void insertByUpdateMethod(InsTaskHistory history) {
+        insert(history);
+    }
 }

+ 7 - 0
src/main/java/com/ydtech/modules/order/dao/InsSubOrderUpdateDetailMapper.java

@@ -0,0 +1,7 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.po.InsSubOrderUpdateDetail;
+
+public interface InsSubOrderUpdateDetailMapper extends BaseMapper<InsSubOrderUpdateDetail> {
+}

+ 168 - 0
src/main/java/com/ydtech/modules/order/entity/po/InsSubOrderUpdateDetail.java

@@ -0,0 +1,168 @@
+package com.ydtech.modules.order.entity.po;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 子订单状态更新记录
+ * @TableName ins_sub_order_update_detail
+ */
+@TableName(value ="ins_sub_order_update_detail")
+@Data
+public class InsSubOrderUpdateDetail implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 小订单id
+     */
+    @TableField(value = "sub_order_no")
+    private String subOrderNo;
+
+    /**
+     * 大订单id
+     */
+    @TableField(value = "order_no")
+    private String orderNo;
+
+    /**
+     * 更新方式  1. 手动更新  2. 自动更新
+     */
+    @TableField(value = "update_method")
+    private String updateMethod;
+
+    /**
+     * 更新时间
+     */
+    @TableField(value = "update_time")
+    private Date updateTime;
+
+    /**
+     * 更新人
+     */
+    @TableField(value = "update_user_id")
+    private String updateUserId;
+
+    /**
+     * 跟新人名称
+     */
+    @TableField(value = "update_user_name")
+    private String updateUserName;
+
+    /**
+     * 更新内容
+     */
+    @TableField(value = "update_remark")
+    private String updateRemark;
+
+    /**
+     * 跟新类型 1 待核保更新 2.已核保待缴费更新 3.核保退回跟新
+     */
+    @TableField(value = "update_type")
+    private String updateType;
+
+    /**
+     * 小订单跟新之前状态
+     */
+    @TableField(value = "update_before_status")
+    private String updateBeforeStatus;
+
+    /**
+     * 小订单跟新之后状态
+     */
+    @TableField(value = "update_after_status")
+    private String updateAfterStatus;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        InsSubOrderUpdateDetail other = (InsSubOrderUpdateDetail) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getSubOrderNo() == null ? other.getSubOrderNo() == null : this.getSubOrderNo().equals(other.getSubOrderNo()))
+            && (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo()))
+            && (this.getUpdateMethod() == null ? other.getUpdateMethod() == null : this.getUpdateMethod().equals(other.getUpdateMethod()))
+            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
+            && (this.getUpdateUserId() == null ? other.getUpdateUserId() == null : this.getUpdateUserId().equals(other.getUpdateUserId()))
+            && (this.getUpdateUserName() == null ? other.getUpdateUserName() == null : this.getUpdateUserName().equals(other.getUpdateUserName()))
+            && (this.getUpdateRemark() == null ? other.getUpdateRemark() == null : this.getUpdateRemark().equals(other.getUpdateRemark()))
+            && (this.getUpdateType() == null ? other.getUpdateType() == null : this.getUpdateType().equals(other.getUpdateType()))
+            && (this.getUpdateBeforeStatus() == null ? other.getUpdateBeforeStatus() == null : this.getUpdateBeforeStatus().equals(other.getUpdateBeforeStatus()))
+            && (this.getUpdateAfterStatus() == null ? other.getUpdateAfterStatus() == null : this.getUpdateAfterStatus().equals(other.getUpdateAfterStatus()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getSubOrderNo() == null) ? 0 : getSubOrderNo().hashCode());
+        result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode());
+        result = prime * result + ((getUpdateMethod() == null) ? 0 : getUpdateMethod().hashCode());
+        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
+        result = prime * result + ((getUpdateUserId() == null) ? 0 : getUpdateUserId().hashCode());
+        result = prime * result + ((getUpdateUserName() == null) ? 0 : getUpdateUserName().hashCode());
+        result = prime * result + ((getUpdateRemark() == null) ? 0 : getUpdateRemark().hashCode());
+        result = prime * result + ((getUpdateType() == null) ? 0 : getUpdateType().hashCode());
+        result = prime * result + ((getUpdateBeforeStatus() == null) ? 0 : getUpdateBeforeStatus().hashCode());
+        result = prime * result + ((getUpdateAfterStatus() == null) ? 0 : getUpdateAfterStatus().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(", subOrderNo=").append(subOrderNo);
+        sb.append(", orderNo=").append(orderNo);
+        sb.append(", updateMethod=").append(updateMethod);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append(", updateUserId=").append(updateUserId);
+        sb.append(", updateUserName=").append(updateUserName);
+        sb.append(", updateRemark=").append(updateRemark);
+        sb.append(", updateType=").append(updateType);
+        sb.append(", updateBeforeStatus=").append(updateBeforeStatus);
+        sb.append(", updateAfterStatus=").append(updateAfterStatus);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public InsSubOrderUpdateDetail() {
+    }
+
+    public InsSubOrderUpdateDetail(String subOrderNo, String orderNo, String updateMethod, Date updateTime, String updateUserId, String updateUserName, String updateRemark, String updateType, String updateBeforeStatus, String updateAfterStatus) {
+        this.subOrderNo = subOrderNo;
+        this.orderNo = orderNo;
+        this.updateMethod = updateMethod;
+        this.updateTime = updateTime;
+        this.updateUserId = updateUserId;
+        this.updateUserName = updateUserName;
+        this.updateRemark = updateRemark;
+        this.updateType = updateType;
+        this.updateBeforeStatus = updateBeforeStatus;
+        this.updateAfterStatus = updateAfterStatus;
+    }
+}

+ 15 - 0
src/main/java/com/ydtech/modules/order/service/InsSubOrderUpdateDetailService.java

@@ -0,0 +1,15 @@
+package com.ydtech.modules.order.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.order.entity.InsAreaCompany;
+import com.ydtech.modules.order.entity.po.InsSubOrderUpdateDetail;
+
+/**
+* @author Administrator
+* @description 针对表【ins_sub_order_update_detail(子订单状态更新记录)】的数据库操作Service
+* @createDate 2024-10-08 09:32:57
+*/
+public interface InsSubOrderUpdateDetailService extends IService<InsSubOrderUpdateDetail> {
+
+    void  insertData(InsAreaCompany subOrder, String orderStatus, String newStatus,String  updateMethod);
+}

+ 90 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsSubOrderUpdateDetailServiceImpl.java

@@ -0,0 +1,90 @@
+package com.ydtech.modules.order.service.impl;
+
+import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.ins.model.InsTaskHistory;
+import com.ydtech.modules.ins.service.InsTaskHistoryService;
+import com.ydtech.modules.order.components.InsImagesUploadCacheComponents;
+import com.ydtech.modules.order.dao.InsSubOrderUpdateDetailMapper;
+import com.ydtech.modules.order.entity.InsAreaCompany;
+import com.ydtech.modules.order.entity.po.InsSubOrderUpdateDetail;
+import com.ydtech.modules.order.service.InsSubOrderUpdateDetailService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * @author Administrator
+ * @description 针对表【ins_sub_order_update_detail(子订单状态更新记录)】的数据库操作Service实现
+ * @createDate 2024-10-08 09:32:57
+ */
+@Service
+public class InsSubOrderUpdateDetailServiceImpl extends ServiceImpl<InsSubOrderUpdateDetailMapper, InsSubOrderUpdateDetail>
+        implements InsSubOrderUpdateDetailService {
+
+    @Autowired
+    private InsTaskHistoryService insTaskHistoryService;
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/8 10:10
+     *  @Description:  更新手动或者自动方式
+     *  updateMethod   1. 手动  2. 自动
+     */
+    @Override
+    public void insertData(InsAreaCompany subOrder, String oldStatus, String newStatus,String  updateMethod) {
+        String updateRemark ="";
+        String updateType="";
+        String oldRemark ="";
+        String newRemark ="";
+        String updateMethodRemark ="";
+        //订单状态一致不记录为错误数据
+        if(!oldStatus.equals(newStatus)){
+            if(InsOrderStatusEnum.WAIT_AUDIT.getCode().equals(oldStatus)){
+                updateType="1";
+                oldRemark=InsOrderStatusEnum.WAIT_AUDIT.getDesc()+"状态";
+            }else if(InsOrderStatusEnum.WAIT_PAY.getCode().equals(oldStatus)){
+                updateType="2";
+                oldRemark=InsOrderStatusEnum.WAIT_PAY.getDesc()+"状态";
+            }
+            if(InsOrderStatusEnum.WAIT_AUDIT.getCode().equals(newStatus)){
+                newRemark=InsOrderStatusEnum.WAIT_AUDIT.getDesc()+"状态";
+            }else if(InsOrderStatusEnum.WAIT_PAY.getCode().equals(newStatus)){
+                newRemark=InsOrderStatusEnum.WAIT_PAY.getDesc()+"状态";
+            }else if(InsOrderStatusEnum.TO_BACK.getCode().equals(newStatus)){
+                newRemark=InsOrderStatusEnum.TO_BACK.getDesc()+"状态";
+            }else if(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode().equals(newStatus)){
+                newRemark=InsOrderStatusEnum.ACCEPT_INSURANCE.getDesc()+"状态";
+            }
+            if("1".equals(updateMethod)){
+                updateMethodRemark="手动更新为";
+            }else if("2".equals(updateMethod)){
+                updateMethodRemark="自动更新为";
+            }
+            updateRemark =new BaseController().getUser().getName()+"将子订单"+subOrder.getId()+"的"+oldRemark+updateMethodRemark+newRemark;
+            InsSubOrderUpdateDetail  detail =new InsSubOrderUpdateDetail(subOrder.getId(), subOrder.getOrderno(), updateMethod, new Date(), new BaseController().getUser().getId(), new BaseController().getUser().getName(), updateRemark,updateType, oldStatus, newStatus);
+            this.save(detail);
+            //如果是状态为核保待缴费插入轨迹表
+            if(InsOrderStatusEnum.WAIT_PAY.getCode().equals(oldStatus) &&  InsOrderStatusEnum.ACCEPT_INSURANCE.getCode().equals(newStatus)){
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                //插入轨迹表
+                InsTaskHistory history = new InsTaskHistory();
+                history.setId(String.valueOf(new Date().getTime()));
+                history.setCompany(subOrder.getInscompany());
+                history.setTaskid(subOrder.getOrderno());
+                history.setOperatorid(new BaseController().getUser().getId());
+                history.setOperator(new BaseController().getUser().getName());
+                history.setCreatetime(sdf.format(new Date()));
+                history.setStatus(newStatus);
+                history.setRemark(updateRemark);
+                insTaskHistoryService.insertByUpdateMethod(history);
+            }
+
+        }
+    }
+}

+ 27 - 0
src/main/resources/mapper/modules/order/InsSubOrderUpdateDetailMapper.xml

@@ -0,0 +1,27 @@
+<?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.ydtech.modules.order.dao.InsSubOrderUpdateDetailMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.order.entity.po.InsSubOrderUpdateDetail">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="subOrderNo" column="sub_order_no" jdbcType="VARCHAR"/>
+            <result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
+            <result property="updateMethod" column="update_method" jdbcType="VARCHAR"/>
+            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+            <result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
+            <result property="updateUserName" column="update_user_name" jdbcType="VARCHAR"/>
+            <result property="updateRemark" column="update_remark" jdbcType="VARCHAR"/>
+            <result property="updateType" column="update_type" jdbcType="VARCHAR"/>
+            <result property="updateBeforeStatus" column="update_before_status" jdbcType="VARCHAR"/>
+            <result property="updateAfterStatus" column="update_after_status" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,sub_order_no,order_no,
+        update_method,update_time,update_user_id,
+        update_user_name,update_remark,update_type,
+        update_before_status,update_after_status
+    </sql>
+</mapper>