车间能级提升-智能设备管理系统
zhuguifei
2025-03-04 d4e5744f3df7c90b44a900d1f61f5850b199b47d
完成维修工单评价功能
已添加14个文件
已修改5个文件
1541 ■■■■■ 文件已修改
eims-ui/apps/web-antd/src/api/eims/repair-fb/index.ts 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui/apps/web-antd/src/api/eims/repair-fb/model.d.ts 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui/apps/web-antd/src/utils/render.tsx 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui/apps/web-antd/src/views/eims/repair-fb/data.tsx 217 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui/apps/web-antd/src/views/eims/repair-fb/fb-preview-drawer.vue 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui/apps/web-antd/src/views/eims/repair-fb/index.vue 231 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui/apps/web-antd/src/views/eims/repair-fb/repair-fb-drawer.vue 170 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui/apps/web-antd/src/views/eims/repair-res/index.vue 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsRepairFbController.java 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsRepairFb.java 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsRepairRes.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairFbBo.java 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairResBo.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsRepairFbVo.java 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsRepairResVo.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsRepairFbMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsRepairFbService.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairFbServiceImpl.java 146 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsRepairFbMapper.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui/apps/web-antd/src/api/eims/repair-fb/index.ts
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,61 @@
import type { RepairFbVO } from './model';
import type { ID, IDS } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
enum Api {
  repairFbExport = '/eims/repairFb/export',
  repairFbList = '/eims/repairFb/list',
  root = '/eims/repairFb'
}
/**
 * æŸ¥è¯¢ç»´ä¿®è¯„价列表
 * @param query
 * @returns {*}
 */
export function listRepairFb(params?: any) {
  return requestClient.get<RepairFbVO[]>(Api.repairFbList, { params });
}
/**
 * æŸ¥è¯¢ç»´ä¿®è¯„价详细
 * @param repairFbId
 */
export function getRepairFb(repairFbId: ID) {
  return requestClient.get<RepairFbVO>(`${Api.root}/${repairFbId}`);
}
/**
 * æ–°å¢žç»´ä¿®è¯„ä»·
 * @param data
 */
export function addRepairFb(data: any) {
  return requestClient.postWithMsg<void>(Api.root, data);
}
/**
 * ä¿®æ”¹ç»´ä¿®è¯„ä»·
 * @param data
 */
export function updateRepairFb(data: any) {
  return requestClient.putWithMsg<void>(Api.root, data);
}
/**
 * åˆ é™¤ç»´ä¿®è¯„ä»·
 * @param repairFbId
 */
export function delRepairFb(repairFbId: IDS) {
  return requestClient.deleteWithMsg<void>(`${Api.root}/${repairFbId}`);
}
/**
 * å¯¼å‡º
 * @param
 */
export function repairFbExport(data: any) {
  return commonExport(Api.repairFbExport, data);
}
eims-ui/apps/web-antd/src/api/eims/repair-fb/model.d.ts
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,67 @@
export interface RepairFbVO {
  /**
   *
   */
  id: number | string;
  /**
   * ç»´ä¿®å·¥å•id
   */
  resId: number | string;
  /**
   * ç»´ä¿®å·¥å•code
   */
  resCode: string;
  /**
   * åé¦ˆç»“æžœ
   */
  fbResult: string;
  /**
   * åé¦ˆäºº
   */
  fbUser: number;
  /**
   * åé¦ˆäººéƒ¨é—¨
   */
  fbDept: number;
  /**
   * åé¦ˆæ—¶é—´
   */
  fbTime: string;
  /**
   * ç»´ä¿®åŠæ—¶æ€§(字典)
   */
  repairTimeliness: number | string;
  /**
   * æœåŠ¡æ€åº¦
   */
  serviceAttitude: number | string;
  /**
   * ç»´ä¿®çŽ°åœº6s
   */
  repairSs: number | string;
  /**
   * ç»´ä¿®æ»¡æ„åº¦
   */
  repairSatisfaction: number | string;
  /**
   * æ„è§æˆ–建议
   */
  suggestions: string;
  /**
   * å¤‡æ³¨
   */
  remark: string;
}
eims-ui/apps/web-antd/src/utils/render.tsx
@@ -22,10 +22,10 @@
  QuarkIcon,
  SafariIcon,
  UcIcon,
  WindowsIcon,
  WindowsIcon
} from '@vben/icons';
import { Tag } from 'ant-design-vue';
import { Rate, Tag } from 'ant-design-vue';
import { DictTag } from '#/components/dict';
@@ -102,7 +102,7 @@
    DELETE: 'red',
    GET: 'green',
    POST: 'blue',
    PUT: 'orange',
    PUT: 'orange'
  };
  const color = colors[method] ?? 'default';
@@ -123,12 +123,7 @@
 * @param [gap] é—´éš”
 * @returns render
 */
export function renderDictTags(
  value: string[],
  dicts: DictData[],
  wrap = true,
  gap = 1,
) {
export function renderDictTags(value: string[], dicts: DictData[], wrap = true, gap = 1) {
  if (!Array.isArray(value)) {
    return <div>{value}</div>;
  }
@@ -151,12 +146,7 @@
  const dictInfo = getDict(dictName);
  return renderDictTag(value, dictInfo);
}
export function renderIconSpan(
  icon: ComponentType,
  value: string,
  center = false,
  marginLeft = '2px',
) {
export function renderIconSpan(icon: ComponentType, value: string, center = false, marginLeft = '2px') {
  const justifyCenter = center ? 'justify-center' : '';
  return (
@@ -172,7 +162,7 @@
  { icon: LinuxIcon, value: 'linux' },
  { icon: OSXIcon, value: 'osx' },
  { icon: AndroidIcon, value: 'android' },
  { icon: IPhoneIcon, value: 'iphone' },
  { icon: IPhoneIcon, value: 'iphone' }
];
/**
@@ -191,16 +181,14 @@
  { icon: QQIcon, value: 'qq' },
  { icon: DingtalkIcon, value: 'dingtalk' },
  { icon: UcIcon, value: 'uc' },
  { icon: BaiduIcon, value: 'baidu' },
  { icon: BaiduIcon, value: 'baidu' }
];
export function renderOsIcon(os: string, center = false) {
  if (!os) {
    return;
  }
  let current = osOptions.find((item) =>
    os.toLocaleLowerCase().includes(item.value),
  );
  let current = osOptions.find((item) => os.toLocaleLowerCase().includes(item.value));
  // windows要特殊处理
  if (os.toLocaleLowerCase().includes('windows')) {
    current = osOptions[0];
@@ -217,9 +205,7 @@
  if (!browser) {
    return;
  }
  const current = browserOptions.find((item) =>
    browser.toLocaleLowerCase().includes(item.value),
  );
  const current = browserOptions.find((item) => browser.toLocaleLowerCase().includes(item.value));
  if (current) {
    return renderIconSpan(current.icon, browser, center, '5px');
  }
@@ -227,3 +213,11 @@
  const defaultIcon = DefaultBrowserIcon;
  return renderIconSpan(defaultIcon, browser, center, '5px');
}
export function renderRate(value: string) {
  if (!value) {
    return null;
  }
  return <Rate disabled value={Number(value)}></Rate>;
}
eims-ui/apps/web-antd/src/views/eims/repair-fb/data.tsx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,217 @@
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { DescItem } from '#/components/description';
import { getPopupContainer } from '@vben/utils';
import { Rate } from 'ant-design-vue';
import { type FormSchemaGetter } from '#/adapter/form';
export const querySchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    fieldName: 'resCode',
    label: '维修单号'
  },
  {
    component: 'TreeSelect',
    // åœ¨drawer里更新 è¿™é‡Œä¸éœ€è¦é»˜è®¤çš„componentProps
    defaultValue: undefined,
    fieldName: 'resDept',
    label: '维修部门'
    // rules: 'selectRequired',
  },
  {
    component: 'Select',
    componentProps: {
      showSearch: true,
      allowClear: true,
      getPopupContainer
    },
    fieldName: 'resUser',
    label: '维修人'
  }
];
export const columns: VxeGridProps['columns'] = [
  { type: 'checkbox', width: 60, fixed: 'left' },
  {
    title: '维修单号',
    field: 'resCode',
    minWidth: 160,
    fixed: 'left'
  },
  {
    title: '结果',
    field: 'fbResult',
    minWidth: 200
  },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 200
  }
];
export const drawerSchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    dependencies: {
      show: () => false,
      triggerFields: ['']
    },
    fieldName: 'id'
  },
  {
    component: 'Input',
    dependencies: {
      show: () => false,
      triggerFields: ['']
    },
    fieldName: 'resId'
  },
  {
    component: 'Input',
    fieldName: 'resCode',
    componentProps: {
      readonly: true
    },
    label: '维修工单'
  },
  {
    component: 'Textarea',
    formItemClass: 'items-baseline',
    fieldName: 'fbResult',
    label: '结果反馈'
  },
  {
    component: 'Rate',
    fieldName: 'repairSatisfaction',
    label: '维修满意度'
  },
  {
    component: 'Rate',
    fieldName: 'repairTimeliness',
    label: '维修及时性'
  },
  {
    component: 'Rate',
    fieldName: 'serviceAttitude',
    label: '维修及态度'
  },
  {
    component: 'Rate',
    fieldName: 'repairSs',
    label: '维修现场6S'
  },
  {
    component: 'Textarea',
    formItemClass: 'items-baseline',
    fieldName: 'suggestions',
    label: '意见或建议'
  },
  {
    component: 'TreeSelect',
    // åœ¨drawer里更新 è¿™é‡Œä¸éœ€è¦é»˜è®¤çš„componentProps
    defaultValue: undefined,
    fieldName: 'fbDept',
    label: '评价人部门',
    rules: 'selectRequired'
  },
  {
    component: 'Select',
    componentProps: {
      showSearch: true,
      allowClear: true,
      getPopupContainer
    },
    fieldName: 'fbUser',
    label: '评价人',
    rules: 'selectRequired'
  },
  {
    component: 'DatePicker',
    componentProps: {
      format: 'YYYY-MM-DD HH:mm:ss',
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      getPopupContainer
    },
    fieldName: 'fbTime',
    label: '评价时间'
  }
];
export const descSchema: DescItem[] = [
  {
    field: 'resCode',
    label: '维修工单',
    labelMinWidth: 80
  },
  {
    field: 'fbResult',
    label: '结果反馈'
  },
  {
    field: 'repairSatisfaction',
    label: '维修满意度',
    render(value) {
      return (
        <div class="flex items-center">
          <Rate disabled value={Number(value)}></Rate>
        </div>
      );
    }
  },
  {
    field: 'repairTimeliness',
    label: '维修及时性',
    render(value) {
      return (
        <div class="flex items-center">
          <Rate disabled value={Number(value)}></Rate>
        </div>
      );
    }
  },
  {
    field: 'serviceAttitude',
    label: '维修及态度',
    render(value) {
      return (
        <div class="flex items-center">
          <Rate disabled value={Number(value)}></Rate>
        </div>
      );
    }
  },
  {
    field: 'repairSs',
    label: '维修现场6s',
    render(value) {
      return (
        <div class="flex items-center">
          <Rate disabled value={Number(value)}></Rate>
        </div>
      );
    }
  },
  {
    field: 'suggestions',
    label: '意见或建议'
  },
  {
    field: 'fbDeptName',
    label: '评价人部门'
  },
  {
    field: 'fbUserName',
    label: '评价人'
  },
  {
    field: 'fbTime',
    label: '评价时间'
  }
];
eims-ui/apps/web-antd/src/views/eims/repair-fb/fb-preview-drawer.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
<script setup lang="ts">
import { useVbenDrawer } from '@vben/common-ui';
import { getRepairFb } from '#/api/eims/repair-fb';
import { Description, useDescription } from '#/components/description';
import { descSchema } from '#/views/eims/repair-fb/data';
const [BasicDrawer, drawerApi] = useVbenDrawer({
  onOpenChange: handleOpenChange
});
const [registerDescription, { setDescProps }] = useDescription({
  column: 1,
  schema: descSchema
});
async function handleOpenChange(open: boolean) {
  if (!open) {
    return null;
  }
  const { id } = drawerApi.getData() as { id?: number | string };
  if (id) {
    const record = await getRepairFb(id);
    setDescProps({ data: record }, true);
  }
}
</script>
<template>
  <BasicDrawer :footer="false" class="w-[600px]" title="评价明细">
    <Description @register="registerDescription" />
  </BasicDrawer>
</template>
eims-ui/apps/web-antd/src/views/eims/repair-fb/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,231 @@
<script setup lang="ts">
import type { Recordable } from '@vben/types';
import { onMounted } from 'vue';
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { addFullName, getPopupContainer, getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table';
import { delRepairFb, listRepairFb, repairFbExport } from '#/api/eims/repair-fb';
import { getDeptTree, userList } from '#/api/system/user';
import { commonDownloadExcel } from '#/utils/file/download';
import { columns, querySchema } from './data';
import repairFbDrawer from './repair-fb-drawer.vue';
const formOptions: VbenFormProps = {
  commonConfig: {
    labelWidth: 80,
    componentProps: {
      allowClear: true
    }
  },
  schema: querySchema(),
  collapsed: true,
  wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
  // æ—¥æœŸé€‰æ‹©æ ¼å¼åŒ–
  fieldMappingTime: [['startTime', ['params[beginStartTime]', 'params[endStartTime]'], ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59']]]
};
const gridOptions: VxeGridProps = {
  checkboxConfig: {
    // é«˜äº®
    highlight: true,
    // ç¿»é¡µæ—¶ä¿ç•™é€‰ä¸­çŠ¶æ€
    reserve: true
    // ç‚¹å‡»è¡Œé€‰ä¸­
    // trigger: 'row'
  },
  columns,
  height: 'auto',
  keepSource: true,
  pagerConfig: {},
  proxyConfig: {
    ajax: {
      query: async ({ page }, formValues = {}) => {
        return await listRepairFb({
          pageNum: page.currentPage,
          pageSize: page.pageSize,
          ...formValues
        });
      }
    }
  },
  rowConfig: {
    isHover: true,
    keyField: 'id'
  },
  sortConfig: {
    // è¿œç¨‹æŽ’序
    remote: true,
    // æ”¯æŒå¤šå­—段排序 é»˜è®¤å…³é—­
    multiple: true
  },
  id: 'eims-repair-fb-index'
};
const [BasicTable, tableApi] = useVbenVxeGrid({
  formOptions,
  gridOptions,
  gridEvents: {
    sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams),
    cellClick: (e: any) => {
      const { row } = e;
    }
  }
});
const [RepairFbDrawer, repairFbDrawerApi] = useVbenDrawer({
  connectedComponent: repairFbDrawer
});
function handleAdd() {
  repairFbDrawerApi.setData({ });
  repairFbDrawerApi.open();
}
async function handleEdit(record: Recordable<any>) {
  repairFbDrawerApi.setData({ id: record.id });
  repairFbDrawerApi.open();
}
async function handleDelete(row: Recordable<any>) {
  await delRepairFb(row.id);
  await tableApi.query();
}
function handleMultiDelete() {
  const rows = tableApi.grid.getCheckboxRecords();
  const ids = rows.map((row: any) => row.id);
  Modal.confirm({
    title: '提示',
    okType: 'danger',
    content: `确认删除选中的${ids.length}条记录吗?`,
    onOk: async () => {
      await delRepairFb(ids);
      await tableApi.query();
    }
  });
}
function handleDownloadExcel() {
  commonDownloadExcel(repairFbExport, '维修评价记录', tableApi.formApi.form.values, {
    fieldMappingTime: formOptions.fieldMappingTime
  });
}
onMounted(async () => {
  await setupDeptSelect();
});
/**
 * ç”¨æˆ·çš„加载
 */
async function setupUserOptions(deptId: any) {
  const params = { deptId };
  const userPageResult = await userList({
    pageNum: 1,
    pageSize: 500,
    ...params
  });
  const options = userPageResult.rows.map((item) => ({
    label: item.nickName || item.userName,
    value: item.userId
  }));
  // ç­›é€‰
  const filterOption = (input: string, option: any) => {
    return option.label.toLowerCase().includes(input.toLowerCase());
  };
  const placeholder = options.length > 0 ? '请选择' : '该部门下暂无用户';
  tableApi.formApi.updateSchema([
    {
      componentProps: { options, placeholder, filterOption },
      fieldName: 'resUser'
    }
  ]);
}
/**
 * åˆå§‹åŒ–部门选择
 */
async function setupDeptSelect() {
  // updateSchema
  const deptTree = await getDeptTree();
  // é€‰ä¸­åŽæ˜¾ç¤ºåœ¨è¾“入框的值 å³çˆ¶èŠ‚ç‚¹ / å­èŠ‚ç‚¹
  addFullName(deptTree, 'label', ' / ');
  tableApi.formApi.updateSchema([
    {
      componentProps: (formModel) => ({
        class: 'w-full',
        fieldNames: {
          key: 'id',
          value: 'id',
          children: 'children'
        },
        getPopupContainer,
        async onSelect(deptId: number | string) {
          /** æ ¹æ®éƒ¨é—¨ID加载用户 */
          await setupUserOptions(deptId);
          /** å˜åŒ–后需要重新选择用户 */
          formModel.reqUser = undefined;
        },
        placeholder: '请选择',
        showSearch: true,
        treeData: deptTree,
        treeDefaultExpandAll: true,
        treeLine: { showLeafIcon: false },
        // ç­›é€‰çš„字段
        treeNodeFilterProp: 'label',
        // é€‰ä¸­åŽæ˜¾ç¤ºåœ¨è¾“入框的值
        treeNodeLabelProp: 'fullName'
      }),
      fieldName: 'resDept'
    }
  ]);
}
</script>
<template>
  <Page :auto-content-height="true">
    <div class="flex h-full gap-[8px]">
      <BasicTable class="flex-1 overflow-hidden" table-title="维修工单列表">
        <template #toolbar-tools>
          <Space>
            <a-button v-access:code="['eims:repairFb:export']" @click="handleDownloadExcel">
              {{ $t('pages.common.export') }}
            </a-button>
            <a-button
              :disabled="!vxeCheckboxChecked(tableApi)"
              danger
              type="primary"
              v-access:code="['eims:repairFb:remove']"
              @click="handleMultiDelete"
            >
              {{ $t('pages.common.delete') }}
            </a-button>
            <a-button type="primary" v-access:code="['eims:repairFb:add']" @click="handleAdd"> {{ $t('pages.common.add') }}</a-button>
          </Space>
        </template>
        <template #action="{ row }">
          <Space>
            <ghost-button v-access:code="['eims:repairFb:edit']" @click.stop="handleEdit(row)">
              {{ $t('pages.common.edit') }}
            </ghost-button>
            <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认删除?" @confirm="handleDelete(row)">
              <ghost-button danger v-access:code="['eims:repairFb:remove']" @click.stop="">
                {{ $t('pages.common.delete') }}
              </ghost-button>
            </Popconfirm>
          </Space>
        </template>
      </BasicTable>
    </div>
    <RepairFbDrawer @reload="tableApi.query()" />
  </Page>
</template>
eims-ui/apps/web-antd/src/views/eims/repair-fb/repair-fb-drawer.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,170 @@
<script setup lang="ts">
import type { RepairFbVO } from '#/api/eims/repair-fb/model';
import { computed, ref } from 'vue';
import { useVbenDrawer } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { addFullName, cloneDeep, getPopupContainer } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { addRepairFb, getRepairFb, updateRepairFb } from '#/api/eims/repair-fb';
import { getDeptTree, userList } from '#/api/system/user';
import { drawerSchema } from './data';
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const title = computed(() => {
  return isUpdate.value ? `${$t('pages.common.edit')}评价` : `${$t('pages.common.add')}评价`;
});
const [BasicForm, formApi] = useVbenForm({
  commonConfig: {
    formItemClass: 'col-span-2',
    componentProps: {
      class: 'w-full'
    },
    labelWidth: 120
  },
  schema: drawerSchema(),
  showDefaultActions: false,
  wrapperClass: 'grid-cols-2'
});
const [BasicDrawer, drawerApi] = useVbenDrawer({
  onCancel: handleCancel,
  onConfirm: handleConfirm,
  async onOpenChange(isOpen) {
    if (!isOpen) {
      return null;
    }
    drawerApi.drawerLoading(true);
    const { id } = drawerApi.getData() as { id?: number | string };
    // æ•°æ®ä»Ž repair_res index ä¼ è¿‡æ¥
    const repairFb = drawerApi.getData() as RepairFbVO;
    if (repairFb?.fbDept) {
      await setupUserOptions(repairFb.fbDept);
    }
    if (repairFb) {
      await formApi.setValues(repairFb);
    }
    isUpdate.value = !!id;
    // åˆå§‹åŒ–
    await setupDeptSelect();
    // æ›´æ–° && èµ‹å€¼
    if (isUpdate.value && id) {
      const record = await getRepairFb(id);
      if (record.fbDept) {
        await setupUserOptions(record.fbDept);
      }
      record.repairSatisfaction = Number(record.repairSatisfaction);
      record.repairSs = Number(record.repairSs);
      record.serviceAttitude = Number(record.serviceAttitude);
      record.repairTimeliness = Number(record.repairTimeliness);
      await formApi.setValues(record);
    }
    drawerApi.drawerLoading(false);
  }
});
/**
 * ç”¨æˆ·çš„加载
 */
async function setupUserOptions(deptId: any) {
  const params = { deptId };
  const userPageResult = await userList({
    pageNum: 1,
    pageSize: 500,
    ...params
  });
  const options = userPageResult.rows.map((item) => ({
    label: item.nickName || item.userName,
    value: item.userId
  }));
  // ç­›é€‰
  const filterOption = (input: string, option: any) => {
    return option.label.toLowerCase().includes(input.toLowerCase());
  };
  const placeholder = options.length > 0 ? '请选择' : '该部门下暂无用户';
  formApi.updateSchema([
    {
      componentProps: { options, placeholder, filterOption },
      fieldName: 'fbUser'
    }
  ]);
}
/**
 * åˆå§‹åŒ–部门选择
 */
async function setupDeptSelect() {
  // updateSchema
  const deptTree = await getDeptTree();
  // é€‰ä¸­åŽæ˜¾ç¤ºåœ¨è¾“入框的值 å³çˆ¶èŠ‚ç‚¹ / å­èŠ‚ç‚¹
  addFullName(deptTree, 'label', ' / ');
  formApi.updateSchema([
    {
      componentProps: (formModel) => ({
        class: 'w-full',
        fieldNames: {
          key: 'id',
          value: 'id',
          children: 'children'
        },
        getPopupContainer,
        async onSelect(deptId: number | string) {
          /** æ ¹æ®éƒ¨é—¨ID加载用户 */
          await setupUserOptions(deptId);
          /** å˜åŒ–后需要重新选择用户 */
          formModel.fbUser = undefined;
        },
        placeholder: '请选择',
        showSearch: true,
        treeData: deptTree,
        treeDefaultExpandAll: true,
        treeLine: { showLeafIcon: false },
        // ç­›é€‰çš„字段
        treeNodeFilterProp: 'label',
        // é€‰ä¸­åŽæ˜¾ç¤ºåœ¨è¾“入框的值
        treeNodeLabelProp: 'fullName'
      }),
      fieldName: 'fbDept'
    }
  ]);
}
async function handleConfirm() {
  try {
    drawerApi.drawerLoading(true);
    const { valid } = await formApi.validate();
    if (!valid) {
      return;
    }
    const data = cloneDeep(await formApi.getValues());
    await (isUpdate.value ? updateRepairFb(data) : addRepairFb(data));
    emit('reload');
    await handleCancel();
  } catch (error) {
    console.error(error);
  } finally {
    drawerApi.drawerLoading(false);
  }
}
async function handleCancel() {
  drawerApi.close();
  await formApi.resetForm();
}
</script>
<template>
  <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]">
    <BasicForm />
  </BasicDrawer>
</template>
eims-ui/apps/web-antd/src/views/eims/repair-res/index.vue
@@ -12,7 +12,7 @@
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table';
import { delRepairRes, listRepairRes, repairResExport, updateRepairRes } from '#/api/eims/repair-res';
import { delRepairRes, listRepairRes, repairResExport } from '#/api/eims/repair-res';
import { getDeptTree, userList } from '#/api/system/user';
import { REPAIR_RES_STATUS } from '#/constants/dict';
import { commonDownloadExcel } from '#/utils/file/download';
@@ -20,6 +20,9 @@
import RepairRecord from '../repair-record/index.vue';
import { columns, querySchema } from './data';
import repairResDrawer from './repair-res-drawer.vue';
import repairFbDrawer from '../repair-fb/repair-fb-drawer.vue'
import fbPreviewDrawer from '../repair-fb/fb-preview-drawer.vue'
const userStore = useUserStore();
const userId = userStore.userInfo?.userId;
@@ -94,6 +97,25 @@
  connectedComponent: repairResDrawer
});
const [RepairFbDrawer, repairFbDrawerApi] = useVbenDrawer({
  connectedComponent: repairFbDrawer
});
const [FbPreviewDrawer, fbPreviewDrawerApi] = useVbenDrawer({
  connectedComponent: fbPreviewDrawer
});
function handleAddFb(record: Recordable<any>) {
  repairFbDrawerApi.setData({ resId: record.id, resCode: record.resCode, fbUser: userId, fbDept: deptId});
  repairFbDrawerApi.open();
}
function handleDetailFb(record: Recordable<any>) {
  fbPreviewDrawerApi.setData({ id: record.fbId });
  fbPreviewDrawerApi.open();
}
function handleAdd() {
  repairResDrawerApi.setData({ resUser: userId, resDept: deptId });
  repairResDrawerApi.open();
@@ -112,17 +134,21 @@
const { hasAccessByRoles } = useAccess();
const isSuperAdmin = computed(() => hasAccessByRoles(['superadmin']));
function pingjiaAdd(row: any) {
  return (isSuperAdmin.value || row.reqUser === userId) && row.status === REPAIR_RES_STATUS.WANCHENG && !row.fbId;
}
function pingjiaDetail(row: any) {
  return (isSuperAdmin.value || row.reqUser === userId) && row.status === REPAIR_RES_STATUS.WANCHENG && row.fbId;
}
function weixiu(row: any) {
  return (isSuperAdmin.value || row.resUser === userId) && row.status === REPAIR_RES_STATUS.YIJIEDAN;
}
function wancheng(row: any) {
  return (isSuperAdmin.value || row.resUser === userId) && row.status === REPAIR_RES_STATUS.WEIXIU;
}
async function handleRepairStatus(record: Recordable<any>, status: string) {
  record.status = status;
  handleConfirm(record);
}
async function handleDelete(row: Recordable<any>) {
@@ -148,15 +174,6 @@
  commonDownloadExcel(repairResExport, '维修工单记录', tableApi.formApi.form.values, {
    fieldMappingTime: formOptions.fieldMappingTime
  });
}
async function handleConfirm(data: any) {
  try {
    await updateRepairRes(data);
  } catch (error) {
    console.error(error);
  } finally {
  }
}
onMounted(async () => {
@@ -255,6 +272,8 @@
        <template #action="{ row }">
          <Space>
            <ghost-button v-if="pingjiaAdd(row)" class="btn-success" v-access:code="['eims:repairRes:edit']" @click.stop="handleAddFb(row)"> è¯„ä»· </ghost-button>
            <ghost-button v-if="pingjiaDetail(row)" class="btn-success" v-access:code="['eims:repairRes:edit']" @click.stop="handleDetailFb(row)"> é˜…评 </ghost-button>
            <ghost-button
              v-if="weixiu(row)"
              class="btn-success"
@@ -287,5 +306,7 @@
      <RepairRecord :res-id="resId" class="h-1/3" table-title="维修记录" />
    </div>
    <RepairResDrawer @reload="tableApi.query()" />
    <RepairFbDrawer @reload="tableApi.query()" />
    <FbPreviewDrawer />
  </Page>
</template>
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsRepairFbController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,107 @@
package org.dromara.eims.controller;
import java.util.List;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.dromara.eims.service.IEimsRepairResService;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.web.core.BaseController;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.eims.domain.vo.EimsRepairFbVo;
import org.dromara.eims.domain.bo.EimsRepairFbBo;
import org.dromara.eims.service.IEimsRepairFbService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
 * ç»´ä¿®è¯„ä»·
 *
 * @author zhuguifei
 * @date 2025-02-28
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/eims/repairFb")
public class EimsRepairFbController extends BaseController {
    private final IEimsRepairFbService eimsRepairFbService;
    private final IEimsRepairResService repairResService;
    /**
     * æŸ¥è¯¢ç»´ä¿®è¯„价列表
     */
    @SaCheckPermission("eims:repairFb:list")
    @GetMapping("/list")
    public TableDataInfo<EimsRepairFbVo> list(EimsRepairFbBo bo, PageQuery pageQuery) {
        return eimsRepairFbService.queryPageList(bo, pageQuery);
    }
    /**
     * å¯¼å‡ºç»´ä¿®è¯„价列表
     */
    @SaCheckPermission("eims:repairFb:export")
    @Log(title = "维修评价", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(EimsRepairFbBo bo, HttpServletResponse response) {
        List<EimsRepairFbVo> list = eimsRepairFbService.queryList(bo);
        ExcelUtil.exportExcel(list, "维修评价", EimsRepairFbVo.class, response);
    }
    /**
     * èŽ·å–ç»´ä¿®è¯„ä»·è¯¦ç»†ä¿¡æ¯
     *
     * @param id ä¸»é”®
     */
    @SaCheckPermission("eims:repairFb:query")
    @GetMapping("/{id}")
    public R<EimsRepairFbVo> getInfo(@NotNull(message = "主键不能为空")
                                     @PathVariable Long id) {
        return R.ok(eimsRepairFbService.queryById(id));
    }
    /**
     * æ–°å¢žç»´ä¿®è¯„ä»·
     */
    @SaCheckPermission("eims:repairFb:add")
    @Log(title = "维修评价", businessType = BusinessType.INSERT)
    @RepeatSubmit()
    @PostMapping()
    public R<Void> add(@Validated(AddGroup.class) @RequestBody EimsRepairFbBo bo) {
        return toAjax(eimsRepairFbService.insertByBo(bo));
    }
    /**
     * ä¿®æ”¹ç»´ä¿®è¯„ä»·
     */
    @SaCheckPermission("eims:repairFb:edit")
    @Log(title = "维修评价", businessType = BusinessType.UPDATE)
    @RepeatSubmit()
    @PutMapping()
    public R<Void> edit(@Validated(EditGroup.class) @RequestBody EimsRepairFbBo bo) {
        return toAjax(eimsRepairFbService.updateByBo(bo));
    }
    /**
     * åˆ é™¤ç»´ä¿®è¯„ä»·
     *
     * @param ids ä¸»é”®ä¸²
     */
    @SaCheckPermission("eims:repairFb:remove")
    @Log(title = "维修评价", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public R<Void> remove(@NotEmpty(message = "主键不能为空")
                          @PathVariable Long[] ids) {
        return toAjax(eimsRepairFbService.deleteWithValidByIds(List.of(ids), true));
    }
}
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsRepairFb.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,95 @@
package org.dromara.eims.domain;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serial;
/**
 * ç»´ä¿®è¯„价对象 eims_repair_fb
 *
 * @author zhuguifei
 * @date 2025-02-28
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("eims_repair_fb")
public class EimsRepairFb extends BaseEntity {
    @Serial
    private static final long serialVersionUID = 1L;
    /**
     *
     */
    @TableId(value = "id")
    private Long id;
    /**
     * ç»´ä¿®å·¥å•id
     */
    private Long resId;
    /**
     * ç»´ä¿®å·¥å•code
     */
    private String resCode;
    /**
     * åé¦ˆç»“æžœ
     */
    private String fbResult;
    /**
     * åé¦ˆäºº
     */
    private Long fbUser;
    /**
     * åé¦ˆäººéƒ¨é—¨
     */
    private Long fbDept;
    /**
     * åé¦ˆæ—¶é—´
     */
    private Date fbTime;
    /**
     * ç»´ä¿®åŠæ—¶æ€§(字典)
     */
    private String repairTimeliness;
    /**
     * æœåŠ¡æ€åº¦
     */
    private String serviceAttitude;
    /**
     * ç»´ä¿®çŽ°åœº6s
     */
    private String repairSs;
    /**
     * ç»´ä¿®æ»¡æ„åº¦
     */
    private String repairSatisfaction;
    /**
     * æ„è§æˆ–建议
     */
    private String suggestions;
    /**
     * å¤‡æ³¨
     */
    private String remark;
}
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsRepairRes.java
@@ -101,4 +101,10 @@
    private String remark;
    /**
     * è¯„ä»·id
     */
    private Long fbId;
}
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairFbBo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,90 @@
package org.dromara.eims.domain.bo;
import org.dromara.eims.domain.EimsRepairFb;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
 * ç»´ä¿®è¯„价业务对象 eims_repair_fb
 *
 * @author zhuguifei
 * @date 2025-02-28
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = EimsRepairFb.class, reverseConvertGenerate = false)
public class EimsRepairFbBo extends BaseEntity {
    /**
     *
     */
    @NotNull(message = "不能为空", groups = { EditGroup.class })
    private Long id;
    /**
     * ç»´ä¿®å·¥å•id
     */
    private Long resId;
    private String resCode;
    /**
     * åé¦ˆç»“æžœ
     */
    private String fbResult;
    /**
     * åé¦ˆäºº
     */
    private Long fbUser;
    /**
     * åé¦ˆäººéƒ¨é—¨
     */
    private Long fbDept;
    /**
     * åé¦ˆæ—¶é—´
     */
    private Date fbTime;
    /**
     * ç»´ä¿®åŠæ—¶æ€§(字典)
     */
    private String repairTimeliness;
    /**
     * æœåŠ¡æ€åº¦
     */
    private String serviceAttitude;
    /**
     * ç»´ä¿®çŽ°åœº6s
     */
    private String repairSs;
    /**
     * ç»´ä¿®æ»¡æ„åº¦
     */
    private String repairSatisfaction;
    /**
     * æ„è§æˆ–建议
     */
    private String suggestions;
    /**
     * å¤‡æ³¨
     */
    private String remark;
}
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairResBo.java
@@ -100,6 +100,12 @@
    private String remark;
    /**
     * è¯„ä»·id
     */
    private Long fbId;
    //辅助字段
    /**
     * éœ€è¦æ‰¹é‡æ·»åŠ çš„æŠ¥ä¿®å•å·
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsRepairFbVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,125 @@
package org.dromara.eims.domain.vo;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.eims.domain.EimsRepairFb;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
 * ç»´ä¿®è¯„价视图对象 eims_repair_fb
 *
 * @author zhuguifei
 * @date 2025-02-28
 */
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = EimsRepairFb.class)
public class EimsRepairFbVo implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    /**
     *
     */
    @ExcelProperty(value = "")
    private Long id;
    /**
     * ç»´ä¿®å·¥å•id
     */
    @ExcelProperty(value = "维修工单id")
    private Long resId;
    /**
     * ç»´ä¿®å·¥å•code
     */
    @ExcelProperty(value = "维修工单code")
    private String resCode;
    /**
     * åé¦ˆç»“æžœ
     */
    @ExcelProperty(value = "反馈结果")
    private String fbResult;
    /**
     * åé¦ˆäºº
     */
    @ExcelProperty(value = "反馈人")
    private Long fbUser;
    @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "fbUser")
    private String fbUserName;
    /**
     * åé¦ˆäººéƒ¨é—¨
     */
    @ExcelProperty(value = "反馈人部门")
    private Long fbDept;
    @Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "fbDept")
    private String fbDeptName;
    /**
     * åé¦ˆæ—¶é—´
     */
    @ExcelProperty(value = "反馈时间")
    private Date fbTime;
    /**
     * ç»´ä¿®åŠæ—¶æ€§(字典)
     */
    @ExcelProperty(value = "维修及时性(字典)")
    private String repairTimeliness;
    /**
     * æœåŠ¡æ€åº¦
     */
    @ExcelProperty(value = "服务态度")
    private String serviceAttitude;
    /**
     * ç»´ä¿®çŽ°åœº6s
     */
    @ExcelProperty(value = "维修现场6s")
    private String repairSs;
    /**
     * ç»´ä¿®æ»¡æ„åº¦
     */
    @ExcelProperty(value = "维修满意度")
    private String repairSatisfaction;
    /**
     * æ„è§æˆ–建议
     */
    @ExcelProperty(value = "意见或建议")
    private String suggestions;
    /**
     * å¤‡æ³¨
     */
    @ExcelProperty(value = "备注")
    private String remark;
}
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsRepairResVo.java
@@ -128,6 +128,11 @@
    @ExcelProperty(value = "备注")
    private String remark;
    /**
     * è¯„ä»·id
     */
    private Long fbId;
    // å…³è”表字段
    private  String reqType;//报修类型
@@ -143,4 +148,5 @@
    private String reqCode;//报修编码
}
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsRepairFbMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package org.dromara.eims.mapper;
import org.dromara.eims.domain.EimsRepairFb;
import org.dromara.eims.domain.vo.EimsRepairFbVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
 * ç»´ä¿®è¯„ä»·Mapper接口
 *
 * @author zhuguifei
 * @date 2025-02-28
 */
public interface EimsRepairFbMapper extends BaseMapperPlus<EimsRepairFb, EimsRepairFbVo> {
}
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsRepairFbService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,68 @@
package org.dromara.eims.service;
import org.dromara.eims.domain.vo.EimsRepairFbVo;
import org.dromara.eims.domain.bo.EimsRepairFbBo;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
/**
 * ç»´ä¿®è¯„ä»·Service接口
 *
 * @author zhuguifei
 * @date 2025-02-28
 */
public interface IEimsRepairFbService {
    /**
     * æŸ¥è¯¢ç»´ä¿®è¯„ä»·
     *
     * @param id ä¸»é”®
     * @return ç»´ä¿®è¯„ä»·
     */
    EimsRepairFbVo queryById(Long id);
    /**
     * åˆ†é¡µæŸ¥è¯¢ç»´ä¿®è¯„价列表
     *
     * @param bo        æŸ¥è¯¢æ¡ä»¶
     * @param pageQuery åˆ†é¡µå‚æ•°
     * @return ç»´ä¿®è¯„价分页列表
     */
    TableDataInfo<EimsRepairFbVo> queryPageList(EimsRepairFbBo bo, PageQuery pageQuery);
    /**
     * æŸ¥è¯¢ç¬¦åˆæ¡ä»¶çš„维修评价列表
     *
     * @param bo æŸ¥è¯¢æ¡ä»¶
     * @return ç»´ä¿®è¯„价列表
     */
    List<EimsRepairFbVo> queryList(EimsRepairFbBo bo);
    /**
     * æ–°å¢žç»´ä¿®è¯„ä»·
     *
     * @param bo ç»´ä¿®è¯„ä»·
     * @return æ˜¯å¦æ–°å¢žæˆåŠŸ
     */
    Boolean insertByBo(EimsRepairFbBo bo);
    /**
     * ä¿®æ”¹ç»´ä¿®è¯„ä»·
     *
     * @param bo ç»´ä¿®è¯„ä»·
     * @return æ˜¯å¦ä¿®æ”¹æˆåŠŸ
     */
    Boolean updateByBo(EimsRepairFbBo bo);
    /**
     * æ ¡éªŒå¹¶æ‰¹é‡åˆ é™¤ç»´ä¿®è¯„价信息
     *
     * @param ids     å¾…删除的主键集合
     * @param isValid æ˜¯å¦è¿›è¡Œæœ‰æ•ˆæ€§æ ¡éªŒ
     * @return æ˜¯å¦åˆ é™¤æˆåŠŸ
     */
    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairFbServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,146 @@
package org.dromara.eims.service.impl;
import org.dromara.common.core.service.RepairResService;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.eims.domain.EimsRepairRes;
import org.dromara.eims.mapper.EimsRepairResMapper;
import org.springframework.stereotype.Service;
import org.dromara.eims.domain.bo.EimsRepairFbBo;
import org.dromara.eims.domain.vo.EimsRepairFbVo;
import org.dromara.eims.domain.EimsRepairFb;
import org.dromara.eims.mapper.EimsRepairFbMapper;
import org.dromara.eims.service.IEimsRepairFbService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
 * ç»´ä¿®è¯„ä»·Service业务层处理
 *
 * @author zhuguifei
 * @date 2025-02-28
 */
@RequiredArgsConstructor
@Service
public class EimsRepairFbServiceImpl implements IEimsRepairFbService {
    private final EimsRepairFbMapper baseMapper;
    private final EimsRepairResMapper repairResMapper;
    /**
     * æŸ¥è¯¢ç»´ä¿®è¯„ä»·
     *
     * @param id ä¸»é”®
     * @return ç»´ä¿®è¯„ä»·
     */
    @Override
    public EimsRepairFbVo queryById(Long id){
        return baseMapper.selectVoById(id);
    }
    /**
     * åˆ†é¡µæŸ¥è¯¢ç»´ä¿®è¯„价列表
     *
     * @param bo        æŸ¥è¯¢æ¡ä»¶
     * @param pageQuery åˆ†é¡µå‚æ•°
     * @return ç»´ä¿®è¯„价分页列表
     */
    @Override
    public TableDataInfo<EimsRepairFbVo> queryPageList(EimsRepairFbBo bo, PageQuery pageQuery) {
        LambdaQueryWrapper<EimsRepairFb> lqw = buildQueryWrapper(bo);
        Page<EimsRepairFbVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
        return TableDataInfo.build(result);
    }
    /**
     * æŸ¥è¯¢ç¬¦åˆæ¡ä»¶çš„维修评价列表
     *
     * @param bo æŸ¥è¯¢æ¡ä»¶
     * @return ç»´ä¿®è¯„价列表
     */
    @Override
    public List<EimsRepairFbVo> queryList(EimsRepairFbBo bo) {
        LambdaQueryWrapper<EimsRepairFb> lqw = buildQueryWrapper(bo);
        return baseMapper.selectVoList(lqw);
    }
    private LambdaQueryWrapper<EimsRepairFb> buildQueryWrapper(EimsRepairFbBo bo) {
        Map<String, Object> params = bo.getParams();
        LambdaQueryWrapper<EimsRepairFb> lqw = Wrappers.lambdaQuery();
        lqw.eq(bo.getResId() != null, EimsRepairFb::getResId, bo.getResId());
        lqw.eq(bo.getFbUser() != null, EimsRepairFb::getFbUser, bo.getFbUser());
        lqw.eq(bo.getFbDept() != null, EimsRepairFb::getFbDept, bo.getFbDept());
        lqw.eq(bo.getFbTime() != null, EimsRepairFb::getFbTime, bo.getFbTime());
        lqw.eq(StringUtils.isNotBlank(bo.getRepairTimeliness()), EimsRepairFb::getRepairTimeliness, bo.getRepairTimeliness());
        lqw.eq(StringUtils.isNotBlank(bo.getServiceAttitude()), EimsRepairFb::getServiceAttitude, bo.getServiceAttitude());
        lqw.eq(StringUtils.isNotBlank(bo.getRepairSs()), EimsRepairFb::getRepairSs, bo.getRepairSs());
        lqw.eq(StringUtils.isNotBlank(bo.getRepairSatisfaction()), EimsRepairFb::getRepairSatisfaction, bo.getRepairSatisfaction());
        return lqw;
    }
    /**
     * æ–°å¢žç»´ä¿®è¯„ä»·
     *
     * @param bo ç»´ä¿®è¯„ä»·
     * @return æ˜¯å¦æ–°å¢žæˆåŠŸ
     */
    @Transactional(rollbackFor = Exception.class)
    @Override
    public Boolean insertByBo(EimsRepairFbBo bo) {
        EimsRepairFb add = MapstructUtils.convert(bo, EimsRepairFb.class);
        validEntityBeforeSave(add);
        boolean flag = baseMapper.insert(add) > 0;
        if (flag) {
            bo.setId(add.getId());
            //新增时更新repair_res表评价id
            EimsRepairRes eimsRepairRes = repairResMapper.selectById(bo.getResId());
            eimsRepairRes.setFbId(add.getId());
            repairResMapper.updateById(eimsRepairRes);
        }
        return flag;
    }
    /**
     * ä¿®æ”¹ç»´ä¿®è¯„ä»·
     *
     * @param bo ç»´ä¿®è¯„ä»·
     * @return æ˜¯å¦ä¿®æ”¹æˆåŠŸ
     */
    @Override
    public Boolean updateByBo(EimsRepairFbBo bo) {
        EimsRepairFb update = MapstructUtils.convert(bo, EimsRepairFb.class);
        validEntityBeforeSave(update);
        return baseMapper.updateById(update) > 0;
    }
    /**
     * ä¿å­˜å‰çš„æ•°æ®æ ¡éªŒ
     */
    private void validEntityBeforeSave(EimsRepairFb entity){
        //TODO åšä¸€äº›æ•°æ®æ ¡éªŒ,如唯一约束
    }
    /**
     * æ ¡éªŒå¹¶æ‰¹é‡åˆ é™¤ç»´ä¿®è¯„价信息
     *
     * @param ids     å¾…删除的主键集合
     * @param isValid æ˜¯å¦è¿›è¡Œæœ‰æ•ˆæ€§æ ¡éªŒ
     * @return æ˜¯å¦åˆ é™¤æˆåŠŸ
     */
    @Override
    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
        if(isValid){
            //TODO åšä¸€äº›ä¸šåŠ¡ä¸Šçš„æ ¡éªŒ,判断是否需要校验
        }
        return baseMapper.deleteByIds(ids) > 0;
    }
}
eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsRepairFbMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
<?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="org.dromara.eims.mapper.EimsRepairFbMapper">
</mapper>