Procházet zdrojové kódy

差旅报销流程H5相关

chenjun před 1 rokem
rodič
revize
6b1fc8dc44

+ 2 - 1
client_h5/package.json

@@ -22,7 +22,8 @@
     "qs": "^6.12.1",
     "vant": "^4.8.11",
     "vue": "^3.4.19",
-    "vue-router": "^4.2.5"
+    "vue-router": "^4.2.5",
+    "dayjs": "^1.11.10"
   },
   "devDependencies": {
     "@types/node": "^20.11.20",

+ 33 - 0
client_h5/src/pages/travelCost/index.scss

@@ -0,0 +1,33 @@
+.van-cell-group {
+  margin: 0px;
+}
+.van-overlay {
+  background: rgba(0,0,0,0.3);
+}
+.add_btn {
+  background-color: #1989fa;
+  padding: 5px 10px;
+  border: 0px;
+  outline: none;
+  font-size: 13px;
+  color: #fff;
+  border-radius: 2px;
+}
+.detail-popup {
+  >.title {
+    font-size: 15px;
+    padding-left: 10px;
+  }
+  >.fixed-btn {
+    padding: 15px;
+  }
+}
+  :deep(.van-swipe-cell__right) {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+    >button {
+      height: 50%;
+    }
+  }

+ 386 - 0
client_h5/src/pages/travelCost/index.vue

@@ -0,0 +1,386 @@
+
+<template>
+  <flow-form :data="formData" @submit="submitNextActivity">
+    <card title="基础信息">
+      <van-form required="auto" ref="form" :readonly="formRead">
+        <van-cell-group inset>
+          <van-field
+            v-model="formData.userNickname"
+            name="报销人"
+            label="报销人"
+            placeholder="报销人"
+            readonly
+            :rules="[{ required: true, message: '未获取报销人' }]"
+          />
+          <van-field
+            v-model="formData.deptName"
+            name="所在部门"
+            label="所在部门"
+            placeholder="所在部门"
+            readonly
+            :rules="[{ required: true, message: '未获取所在部门' }]"
+          />
+          <van-field
+            v-model="formData.applyTime"
+            :formatter="formatDate"
+            name="申请时间"
+            label="申请时间"
+            placeholder="申请时间"
+            readonly
+            :rules="[{ required: true, message: '请填写申请时间' }]"
+          />
+          <van-field
+            v-model="formData.travelCostNo"
+            name="报销单号"
+            label="报销单号"
+            placeholder="报销单号"
+            readonly
+            :rules="[{ required: true, message: '未获取报销单号' }]"
+          />
+          <van-field
+            v-model="formData.startTime"
+            name="起始时间"
+            label="起始时间"
+            placeholder="起始时间"
+            readonly
+            :rules="[{ required: true, message: '未获取起始时间' }]"
+          />
+          <van-field
+            v-model="formData.endTime"
+            name="截止时间"
+            label="截止时间"
+            placeholder="截止时间"
+            readonly
+            :rules="[{ required: true, message: '未获取截止时间' }]"
+          />
+          <van-field
+            v-model="formData.travelPlace"
+            name="出差的地点"
+            label="出差的地点"
+            placeholder="出差的地点"
+            :rules="[{ required: true, message: '请填写出差的地点' }]"
+          />
+          <van-field
+            v-model="formData.projectName"
+            name="项目名称"
+            label="项目名称"
+            readonly
+            placeholder="项目名称"
+            :rules="[{ required: true, message: '未获取项目' }]"
+          />
+          <van-field
+            v-model="formData.travelPlace"
+            name="付款单位"
+            label="付款单位"
+            placeholder="付款单位"
+            :rules="[{ required: true, message: '未获取付款单位' }]"
+          />
+          <van-field name="是否抵用借款" label="是否抵用借款">
+            <template #input>
+              <van-checkbox v-model="formData.dybyCheckBox" shape="square" />
+            </template>
+          </van-field>
+          <van-field
+            v-model="formData.boatCarAmout"
+            name="车船费合计(元)"
+            label="车船费合计(元)"
+            placeholder="车船费合计(元)"
+            :rules="[{ required: true, message: '未获取车船费' }]"
+          />
+          <van-field
+            v-model="formData.subsidyAmount"
+            name="途中补贴合计(元)"
+            label="途中补贴合计(元)"
+            placeholder="途中补贴合计(元)"
+            :rules="[{ required: true, message: '为获取途中补贴' }]"
+          />
+          <van-field
+            v-model="formData.otherAmount"
+            name="其他费用合计(元)"
+            label="其他费用合计(元)"
+            placeholder="其他费用合计(元)"
+            :rules="[{ required: true, message: '未获取其他费用' }]"
+          />
+          <van-field
+            v-model="formData.carAmount"
+            name="其中市内车费(元)"
+            label="其中市内车费(元)"
+            placeholder="其中市内车费(元)"
+            :rules="[{ required: true, message: '未获取其中市内车费' }]"
+          />
+          <van-field
+            v-model="formData.totalAmount"
+            name="报销总金额"
+            label="报销总金额(元)"
+            placeholder="报销总金额"
+            :rules="[{ required: true, message: '未获取报销总金额' }]"
+          />
+          <van-field
+            v-model="formData.totalAmountCn"
+            name="大写单据总金额"
+            label="大写单据总金额"
+            placeholder="大写单据总金额"
+            :rules="[{ required: true, message: '未获取大写单据总金额' }]"
+          />
+          <van-field
+            v-model="formData.remark"
+            name="报销备注"
+            label="报销备注"
+            placeholder="报销备注"
+            type="textarea"
+            rows="3"
+            autosize
+            :rules="[{ required: true, message: '未获取报销备注' }]"
+          />
+        </van-cell-group>
+      </van-form>
+    </card>
+    <card title="车船费">
+      <template #right>
+        <button class="add_btn" @click="popupShow = true" v-if="!formRead">
+          新增
+        </button>
+      </template>
+      <template #default>
+        <div v-for="(item, index) in formData.boatCarList" :key="index">
+          <van-swipe-cell :disabled="formRead">
+            <card-cell>
+              <van-cell
+                title="出发日期"
+                :value="formatDate(item.departDate, 'YYYY-MM-DD')"
+              />
+              <van-cell title="出发地点" :value="item.departPlace" />
+              <van-cell
+                title="到达日期"
+                :value="formatDate(item.arriveDate, 'YYYY-MM-DD')"
+              />
+              <van-cell title="到达地点" :value="item.arrivePlace" />
+              <van-cell
+                title="交通工具"
+                :value="
+                  getDictLabel(
+                    DICT_TYPE.WF_TRAVEL_COST_VEHICLE_TYPE,
+                    item.vehicle
+                  )
+                "
+              />
+              <van-cell title="单据张数" :value="item.invoiceNums" />
+              <van-cell title="车船费" :value="item.amount" />
+              <van-cell title="备注" :value="item.remark" />
+            </card-cell>
+          </van-swipe-cell>
+        </div>
+      </template>
+    </card>
+    <card title="其他费用">
+      <template #right>
+        <button class="add_btn" @click="popupShow = true" v-if="!formRead">
+          新增
+        </button>
+      </template>
+      <template #default>
+        <div v-for="(item, index) in formData.otherList" :key="index">
+          <van-swipe-cell :disabled="formRead">
+            <card-cell>
+              <van-cell
+                title="费用类型"
+                :value="
+                  getDictLabel(
+                    DICT_TYPE.WF_TRAVEL_COST_OTHER_TYPE,
+                    item.costType
+                  )
+                "
+              />
+              <van-cell
+                title="发生日期"
+                :value="formatDate(item.costDate, 'YYYY-MM-DD')"
+              />
+              <van-cell title="地点" :value="item.costPlace" />
+              <van-cell title="单据张数" :value="item.invoiceNums" />
+              <van-cell title="金额" :value="item.amount" />
+              <van-cell title="备注" :value="item.remark" />
+            </card-cell>
+          </van-swipe-cell>
+        </div>
+      </template>
+    </card>
+  </flow-form>
+</template>
+
+<script setup lang="ts">
+import { useRoute } from "vue-router";
+import { FlowDTO, getNextActivity } from "@/service/flow";
+import reqest from "@/utils/request";
+import FlowForm from "@/components/flowForm.vue";
+import Card from "@/components/card.vue";
+import CardCell from "@/components/cardCell.vue";
+import { showSuccessToast, showFailToast } from "vant";
+import { formatDate } from "@/utils/formatTime";
+import { getDictOptions, getDictLabel, DICT_TYPE } from "@/utils/dict";
+
+const popupShow = ref<boolean>(false);
+const form = ref(null);
+const route = useRoute();
+interface FormDataType {
+  instanceId: string;
+  id: string;
+  userNickname: string;
+  deptName: string;
+  applyTime: any;
+  travelCostNo: string;
+  startTime: any;
+  endTime: any;
+  travelPlace: string;
+  projectName: string;
+  companyName: string;
+  dybx: any;
+  dybyCheckBox: boolean;
+  totalAmount: number | null;
+  totalAmountCn: string;
+  boatCarAmout: string;
+  otherAmount: string;
+  carAmount: string;
+  remark: string;
+  boatCarList: {
+    travelCostId: string;
+    departDate: any;
+    departPlace: string;
+    arriveDate: any;
+    arrivePlace: string;
+    invoiceNums: number;
+    vehicle: number;
+    amount: number;
+    remark: string;
+  }[];
+  otherList: {
+    travelCostId: string;
+    costDate: any;
+    costType: string;
+    costPlace: string;
+    invoiceNums: number;
+    vehicle: number;
+    amount: number;
+    remark: string;
+  }[];
+}
+const formData = ref<FormDataType>({
+  instanceId: "",
+  id: "",
+  userNickname: "",
+  deptName: "",
+  applyTime: null,
+  travelCostNo: "",
+  startTime: null,
+  endTime: null,
+  travelPlace: "",
+  projectName: "",
+  companyName: "",
+  dybx: null,
+  dybyCheckBox: false,
+  totalAmount: null,
+  totalAmountCn: "",
+  boatCarAmout: "",
+  otherAmount: "",
+  carAmount: "",
+  remark: "",
+  boatCarList: [],
+  otherList: []
+});
+
+const formRead = ref(false);
+const { activityInstanceId, participant, flowInstanceId, read, _o } =
+  route.query as {
+    activityInstanceId: string;
+    participant: string;
+    flowInstanceId: string;
+    read: string;
+    _o: string;
+  };
+const activityData: FlowDTO = {
+  activityInstanceId,
+  participantId: participant,
+  flowOpinion: "",
+};
+
+const submitNextActivity = async (activeOpinion: any) => {
+  form.value.validate().then(async () => {
+    //工作流转件
+    activityData.activityInstanceId = activityInstanceId;
+    activityData.participantId = participant;
+    activityData.flowOpinion = JSON.stringify(activeOpinion);
+    const result = await getNextActivity(jsonToFormData(activityData));
+    // getNextActivity(activityData).then(result => {
+    //   console.log(result)
+    // }).catch((err) => {
+    //   console.error(err)
+    // })
+  });
+};
+const jsonToFormData = (json: any): FormData | null => {
+  const keys: string[] = Object.keys(json);
+  if (keys.length > 0) {
+    const formData = new FormData();
+    keys.forEach((key) => {
+      formData.append(
+        key,
+        json[key] instanceof Object ? JSON.stringify(json[key]) : json[key]
+      );
+    });
+    return formData;
+  }
+  return null;
+};
+
+/** 初始化表单数据 */
+const initFormData = async () => {
+  const result = await reqest.get(
+    `/business/TravelCost/mobileAdd?flowInstanceId=${flowInstanceId}`
+  );
+  formData.value = result.data;
+  formData.value.applyTime = formatDate(formData.value.applyTime);
+  formData.value.startTime = formatDate(formData.value.startTime, "YYYY-MM-DD");
+  formData.value.endTime = formatDate(formData.value.endTime, "YYYY-MM-DD");
+  if (formData.value.dybx === 1) {
+    formData.value.dybyCheckBox = true;
+  } else {
+    formData.value.dybyCheckBox = false;
+  }
+  totalBoatCarAmount()
+  totalOtherAmount()
+};
+/** 车船费合计计算 */
+const totalBoatCarAmount = () => {
+  let amonut = 0;
+  formData.value.boatCarList.forEach((obj: { amount: any }) => {
+    amonut += Number(obj.amount);
+  });
+  formData.value.boatCarAmout = amonut.toFixed(2);
+};
+
+/** 其他费用合计计算 */
+const totalOtherAmount = () => {
+  let amonut = 0;
+  let carAmount = 0;
+  formData.value.otherList.forEach(
+    (obj: { costType: string; amount: any }) => {
+      amonut += Number(obj.amount);
+      if (obj.costType == "1") {
+        carAmount += Number(obj.amount);
+      }
+    }
+  );
+  formData.value.otherAmount = amonut.toFixed(2);
+  formData.value.carAmount = carAmount.toFixed(2);
+};
+/** 初始化 */
+onMounted(() => {
+  initFormData();
+  if (read === "1" || _o === "v") {
+    formRead.value = true;
+  }
+});
+</script>
+
+<style lang="scss" scoped>
+@import "./index.scss";
+</style>

+ 8 - 0
client_h5/src/router/routes.ts

@@ -61,6 +61,14 @@ const routes: RouteRecordRaw[] = [
         },
         component: () => import("@/pages/attendanceNote/index.vue"),
       },
+      {
+        path: "travelCost",
+        name: "TravelCost",
+        meta: {
+          title: "差旅报销",
+        },
+        component: () => import("@/pages/travelCost/index.vue"),
+      },
       {
         path: "recruit",
         name: "Recruit",

+ 2 - 0
client_h5/src/utils/dict.ts

@@ -168,6 +168,8 @@ export enum DICT_TYPE {
     WF_COMMON_COST_TYPE = 'WF_COMMON_COST_TYPE',
     WF_SEAL_TYPE = 'WF_SEAL_TYPE',
     WF_SEAL_NAME = 'WF_SEAL_NAME',
+    WF_TRAVEL_COST_OTHER_TYPE = 'WF_TRAVEL_COST_OTHER_TYPE',
+    WF_TRAVEL_COST_VEHICLE_TYPE = 'WF_TRAVEL_COST_VEHICLE_TYPE',
     FINANCE_STATUS = 'finance_status',
     PROJECT_STATUS = 'project_status',
     CONTRACT_COST_STATUS = 'CONTRACT_COST_STATUS',

+ 223 - 0
client_h5/src/utils/formatTime.ts

@@ -0,0 +1,223 @@
+import dayjs from 'dayjs'
+
+/**
+ * 时间日期转换
+ * @param date 当前时间,new Date() 格式
+ * @param format 需要转换的时间格式字符串
+ * @description format 字符串随意,如 `YYYY-mm、YYYY-mm-dd`
+ * @description format 季度:"YYYY-mm-dd HH:MM:SS QQQQ"
+ * @description format 星期:"YYYY-mm-dd HH:MM:SS WWW"
+ * @description format 几周:"YYYY-mm-dd HH:MM:SS ZZZ"
+ * @description format 季度 + 星期 + 几周:"YYYY-mm-dd HH:MM:SS WWW QQQQ ZZZ"
+ * @returns 返回拼接后的时间字符串
+ */
+export function formatDate(date: Date | number, format?: string): string {
+  // 日期不存在,则返回空
+  if (!date) {
+    return ''
+  }
+  // 日期存在,则进行格式化
+  if (format === undefined) {
+    format = 'YYYY-MM-DD HH:mm:ss'
+  }
+  return dayjs(date).format(format)
+}
+
+/**
+ * 获取当前的日期+时间
+ */
+export function getNowDateTime() {
+  return dayjs()
+}
+
+/**
+ * 获取当前日期是第几周
+ * @param dateTime 当前传入的日期值
+ * @returns 返回第几周数字值
+ */
+export function getWeek(dateTime: Date): number {
+  const temptTime = new Date(dateTime.getTime())
+  // 周几
+  const weekday = temptTime.getDay() || 7
+  // 周1+5天=周六
+  temptTime.setDate(temptTime.getDate() - weekday + 1 + 5)
+  let firstDay = new Date(temptTime.getFullYear(), 0, 1)
+  const dayOfWeek = firstDay.getDay()
+  let spendDay = 1
+  if (dayOfWeek != 0) spendDay = 7 - dayOfWeek + 1
+  firstDay = new Date(temptTime.getFullYear(), 0, 1 + spendDay)
+  const d = Math.ceil((temptTime.valueOf() - firstDay.valueOf()) / 86400000)
+  return Math.ceil(d / 7)
+}
+
+/**
+ * 将时间转换为 `几秒前`、`几分钟前`、`几小时前`、`几天前`
+ * @param param 当前时间,new Date() 格式或者字符串时间格式
+ * @param format 需要转换的时间格式字符串
+ * @description param 10秒:  10 * 1000
+ * @description param 1分:   60 * 1000
+ * @description param 1小时: 60 * 60 * 1000
+ * @description param 24小时:60 * 60 * 24 * 1000
+ * @description param 3天:   60 * 60* 24 * 1000 * 3
+ * @returns 返回拼接后的时间字符串
+ */
+export function formatPast(param: string | Date, format = 'YYYY-mm-dd HH:MM:SS'): string {
+  // 传入格式处理、存储转换值
+  let t: any, s: number
+  // 获取js 时间戳
+  let time: number = new Date().getTime()
+  // 是否是对象
+  typeof param === 'string' || 'object' ? (t = new Date(param).getTime()) : (t = param)
+  // 当前时间戳 - 传入时间戳
+  time = Number.parseInt(`${time - t}`)
+  if (time < 10000) {
+    // 10秒内
+    return '刚刚'
+  } else if (time < 60000 && time >= 10000) {
+    // 超过10秒少于1分钟内
+    s = Math.floor(time / 1000)
+    return `${s}秒前`
+  } else if (time < 3600000 && time >= 60000) {
+    // 超过1分钟少于1小时
+    s = Math.floor(time / 60000)
+    return `${s}分钟前`
+  } else if (time < 86400000 && time >= 3600000) {
+    // 超过1小时少于24小时
+    s = Math.floor(time / 3600000)
+    return `${s}小时前`
+  } else if (time < 259200000 && time >= 86400000) {
+    // 超过1天少于3天内
+    s = Math.floor(time / 86400000)
+    return `${s}天前`
+  } else {
+    // 超过3天
+    const date = typeof param === 'string' || 'object' ? new Date(param) : param
+    return formatDate(date, format)
+  }
+}
+
+/**
+ * 时间问候语
+ * @param param 当前时间,new Date() 格式
+ * @description param 调用 `formatAxis(new Date())` 输出 `上午好`
+ * @returns 返回拼接后的时间字符串
+ */
+export function formatAxis(param: Date): string {
+  const hour: number = new Date(param).getHours()
+  if (hour < 6) return '凌晨好'
+  else if (hour < 9) return '早上好'
+  else if (hour < 12) return '上午好'
+  else if (hour < 14) return '中午好'
+  else if (hour < 17) return '下午好'
+  else if (hour < 19) return '傍晚好'
+  else if (hour < 22) return '晚上好'
+  else return '夜里好'
+}
+
+/**
+ * 将毫秒,转换成时间字符串。例如说,xx 分钟
+ *
+ * @param ms 毫秒
+ * @returns {string} 字符串
+ */
+export function formatPast2(ms) {
+  const day = Math.floor(ms / (24 * 60 * 60 * 1000))
+  const hour = Math.floor(ms / (60 * 60 * 1000) - day * 24)
+  const minute = Math.floor(ms / (60 * 1000) - day * 24 * 60 - hour * 60)
+  const second = Math.floor(ms / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60)
+  if (day > 0) {
+    return day + '天' + hour + '小时' + minute + '分钟'
+  }
+  if (hour > 0) {
+    return hour + '小时' + minute + '分钟'
+  }
+  if (minute > 0) {
+    return minute + '分钟'
+  }
+  if (second > 0) {
+    return second + '秒'
+  } else {
+    return 0 + '秒'
+  }
+}
+
+/**
+ * element plus 的时间 Formatter 实现,使用 YYYY-MM-DD HH:mm:ss 格式
+ *
+ * @param row 行数据
+ * @param column 字段
+ * @param cellValue 字段值
+ */
+// @ts-ignore
+export const dateFormatter = (row, column, cellValue) => {
+  if (!cellValue) {
+    return
+  }
+  return formatDate(cellValue)
+}
+
+/**
+ * element plus 的时间 Formatter 实现,使用 YYYY-MM-DD 格式
+ *
+ * @param row 行数据
+ * @param column 字段
+ * @param cellValue 字段值
+ */
+// @ts-ignore
+export const dateFormatter2 = (row, column, cellValue) => {
+  if (!cellValue) {
+    return
+  }
+  return formatDate(cellValue, 'YYYY-MM-DD')
+}
+
+/**
+ * 设置起始日期,时间为00:00:00
+ * @param param 传入日期
+ * @returns 带时间00:00:00的日期
+ */
+export function beginOfDay(param: Date) {
+  return new Date(param.getFullYear(), param.getMonth(), param.getDate(), 0, 0, 0)
+}
+
+/**
+ * 设置结束日期,时间为23:59:59
+ * @param param 传入日期
+ * @returns 带时间23:59:59的日期
+ */
+export function endOfDay(param: Date) {
+  return new Date(param.getFullYear(), param.getMonth(), param.getDate(), 23, 59, 59)
+}
+
+/**
+ * 计算两个日期间隔天数
+ * @param param1 日期1
+ * @param param2 日期2
+ */
+export function betweenDay(param1: Date, param2: Date) {
+  param1 = convertDate(param1)
+  param2 = convertDate(param2)
+  // 计算差值
+  return Math.floor((param2.getTime() - param1.getTime()) / (24 * 3600 * 1000))
+}
+
+/**
+ * 日期计算
+ * @param param1 日期
+ * @param param2 添加的时间
+ */
+export function addTime(param1: Date, param2: number) {
+  param1 = convertDate(param1)
+  return new Date(param1.getTime() + param2)
+}
+
+/**
+ * 日期转换
+ * @param param 日期
+ */
+export function convertDate(param: Date | string) {
+  if (typeof param === 'string') {
+    return new Date(param)
+  }
+  return param
+}

+ 2 - 0
zjugis-business/src/main/java/com/zjugis/business/converter/travelcost/TravelCostConvert.java

@@ -26,4 +26,6 @@ public interface TravelCostConvert {
     TravelCostDO convert(TravelCostUpdateReqVO reqVO);
 
     TravelCostUpdateReqVO convert(TravelCostDO entity);
+
+    TravelCostRespVO convert01(TravelCostDO entity);
 }

+ 4 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/travelcost/controller/TravelCostController.java

@@ -65,6 +65,10 @@ public class TravelCostController extends BaseController {
         return resultPage(map);
     }
 
+    @GetMapping("/mobileAdd")
+    public CommonResult<TravelCostRespVO> mobileAdd(String activityTemplateId, String flowInstanceId, String userId) {
+        return CommonResult.success(travelCostService.flowAdd(flowInstanceId, userId));
+    }
 
     @PostMapping("/update")
     @Operation(summary = "更新差旅报销流程")

+ 18 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/travelcost/controller/vo/TravelCostRespVO.java

@@ -1,7 +1,14 @@
 package com.zjugis.business.flow.travelcost.controller.vo;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.zjugis.business.flow.travelcost.entity.TravelCostBoatCarDO;
+import com.zjugis.business.flow.travelcost.entity.TravelCostOtherDO;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
 
 /**
  * @Author 陈俊
@@ -28,4 +35,15 @@ public class TravelCostRespVO extends TravelCostBaseVO{
 
     @Schema(description = "出差同行人姓名")
     private String partnerNames;
+
+    @Schema(description = "申请时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    @Schema(description = "车船费", requiredMode = Schema.RequiredMode.REQUIRED)
+    private List<TravelCostBoatCarDO> boatCarList;
+
+    @Schema(description = "其他费用", requiredMode = Schema.RequiredMode.REQUIRED)
+    private List<TravelCostOtherDO> otherList;
 }

+ 8 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/travelcost/service/TravelCostService.java

@@ -96,4 +96,12 @@ public interface TravelCostService {
      * @return
      */
     List<TravelCostDO> getFinanceCostExcelList(FinanceCostRequest pageReqVO);
+
+    /**
+     * 流程数据添加
+     * @param flowInstanceId
+     * @param userId
+     * @return
+     */
+    TravelCostRespVO flowAdd(String flowInstanceId, String userId);
 }

+ 40 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/travelcost/service/TravelCostServiceImpl.java

@@ -285,6 +285,46 @@ public class TravelCostServiceImpl implements TravelCostService {
         return travelCostDao.getFinanceCostExcelList(pageReqVO, commonService.getDeptCondition(pageReqVO.getDeptId()));
     }
 
+    @Override
+    public TravelCostRespVO flowAdd(String flowInstanceId, String userId) {
+        if (StringUtils.isNotBlank(SecurityFrameworkUtils.getLoginUserId())) {
+            userId = SecurityFrameworkUtils.getLoginUserId();
+        }
+        CommonResult<IFlowInstance> flowResult = workflowClient.flowInstance(flowInstanceId);
+        if (flowResult.isSuccess()) {
+            IFlowInstance flowInstance = flowResult.getData();
+            TravelCostDO entity = findByInstanceId(flowInstanceId);
+            if (Objects.isNull(entity)) {
+                entity = new TravelCostDO();
+                entity.setInstanceId(flowInstanceId);
+                entity.setUserId(userId);
+                entity.setTravelCostNo(flowInstance.getCode());
+                entity.setApplyTime(LocalDateTime.now());
+                entity.setCreateTime(LocalDateTime.now());
+                entity.setFlowStatus(FLOW_NOT_START);
+                entity.setPaymentCompanyId("4e99393c-c0ea-4146-a7fb-56fb8019c477");
+                CommonResult<AdminUserRespDTO> result = adminUserApi.getUser(userId);
+                if (result.isSuccess()) {
+                    entity.setUserNickname(result.getData().getNickname());
+                    entity.setDeptId(result.getData().getDeptId());
+                    entity.setDeptName(result.getData().getDeptName());
+                }
+                travelCostDao.insert(entity);
+            }
+            TravelCostRespVO respVO = TravelCostConvert.INSTANCE.convert01(entity);
+            if (StringUtils.isNotBlank(entity.getProjectId())) {
+                Project project = projectService.selectById(entity.getProjectId());
+                respVO.setProjectName(project.getXmmc());
+            }
+            List<TravelCostOtherDO> otherList = travelCostOtherService.getListByTravelCostId(entity.getId());
+            List<TravelCostBoatCarDO> boatCarList = travelCostBoatCarService.getListByTravelCostId(entity.getId());
+            respVO.setOtherList(otherList);
+            respVO.setBoatCarList(boatCarList);
+            return respVO;
+        }
+        return null;
+    }
+
     private PageResult<TravelCostRespVO> getTravelCostRespVOPageResult(PageResult<TravelCostDO> pageResult) {
         PageResult<TravelCostRespVO> travelCostRespVOPageResult = TravelCostConvert.INSTANCE.convertPage(pageResult);
         if (pageResult.getTotal() > 0) {