From cb19937239b42f51c6e8525450d08e93225117bc Mon Sep 17 00:00:00 2001 From: zhuguifei <zhuguifei@zhuguifeideiMac.local> Date: 星期三, 14 五月 2025 13:16:02 +0800 Subject: [PATCH] 新增部分移动端接口 --- eims-ui-mobile/src/service/mobile.ts | 12 + eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/MobileServiceImpl.java | 122 +++++++++++ eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairResServiceImpl.java | 13 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IMobileService.java | 18 + eims-ui-mobile/src/pages/home/index.vue | 409 +++++++++++++++++++++++++----------- eims-ui-mobile/src/pages/inspect/insp-record.vue | 2 eims-ui-mobile/src/pages/repair/req-list.vue | 5 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/MobileController.java | 39 +++ 8 files changed, 484 insertions(+), 136 deletions(-) diff --git a/eims-ui-mobile/src/pages/home/index.vue b/eims-ui-mobile/src/pages/home/index.vue index b04275b..8033aef 100644 --- a/eims-ui-mobile/src/pages/home/index.vue +++ b/eims-ui-mobile/src/pages/home/index.vue @@ -8,149 +8,180 @@ } </route> <template> - <view - class="bg-base overflow-hidden" - :style="{ - marginTop: safeAreaInsets?.top + 'px', - }" + <z-paging + ref="paging" + v-model="dataList" + @query="queryList" + show-refresher-update-time + hide-empty-view > - <view class="bg-white h-[80rpx] px-2 flex items-center justify-between"> - <view class="flex items-center" @click="handleUserInfo"> - <wd-icon name="user" size="40rpx" class="icon-color-base"></wd-icon> - <text class="ml-1 text-color-base">{{ realName }}</text> - </view> - - <view class="flex items-center"> - <wd-icon name="notification" size="40rpx" class="icon-color-base mr-3" @click="handleInfo"></wd-icon> - <wd-icon name="tips" size="40rpx" class="icon-color-base mr-3" @click="handleInfo"></wd-icon> - <wd-icon name="app" size="40rpx" class="icon-color-base" @click="handleInfo"></wd-icon> - </view> - </view> - - <view class="bg-white py-2 px-2"> - <wd-img class="w-full h-[260rpx]" src="/static/images/pic4.jpeg" /> - </view> - <view class="bg-noti flex flex-row"> - <wd-notice-bar - text="杩欐槸涓�鏉℃秷鎭彁绀轰俊鎭紝杩欐槸涓�鏉℃秷鎭彁绀轰俊鎭紝杩欐槸涓�鏉℃秷鎭彁绀轰俊鎭�" - prefix="clock" - type="info" - :scrollable="false" - custom-class="flex-1 overflow-hidden" - /> - <wd-button type="text" class="w-[120rpx]">鏌ョ湅</wd-button> - </view> - - <view class="bg-white"> - <wd-card type="rectangle"> - <template #title> - <view class="flex items-center menu-title-box"> - <view class="menu-indicator"></view> - <view class="ml-1 text-xs">鏁版嵁鎬昏</view> - </view> - </template> - <view class="flex flex-row justify-around"> - <view class="flex flex-col justify-center"> - <text class="text-lg text-center">0</text> - <text class="text-color-gray">璁惧鎬绘暟</text> - </view> - <view class="flex flex-col justify-center"> - <text class="text-lg text-center">0</text> - <text class="text-color-gray">鏁呴殰璁惧鏁�</text> - </view> - <view class="flex flex-col justify-center"> - <text class="text-lg text-center">0</text> - <text class="text-color-gray">鏈慨澶嶆晠闅�</text> - </view> + <template #top> + <view class="bg-white h-[80rpx] px-2 flex items-center justify-between"> + <view class="flex items-center" @click="handleUserInfo"> + <wd-icon name="user" size="40rpx" class="icon-color-base"></wd-icon> + <text class="ml-1 text-color-base">{{ realName }}</text> </view> - </wd-card> - </view> - <view class="bg-white mt-2"> - <wd-card type="rectangle"> - <template #title> - <view class="flex items-center menu-title-box"> - <view class="menu-indicator"></view> - <view class="ml-1 text-xs">蹇嵎鎿嶄綔</view> - </view> - </template> - <wd-grid :column="4"> - <wd-grid-item - use-slot - class="flex justify-center items-center" - v-for="(item, index) in commonMenu" - :key="item.id" - @click.stop="goItemPage(item.path)" - > - <image class="slot-img text-center" :src="item.icon" /> - <text>{{ item.name }}</text> - </wd-grid-item> - </wd-grid> - </wd-card> - </view> - <view class="bg-white mt-2"> - <wd-card type="rectangle"> - <template #title> - <view class="flex items-center menu-title-box"> - <view class="menu-indicator"></view> - <view class="ml-1 text-xs">璁惧绠$悊</view> - </view> - </template> - <wd-grid :column="4"> - <wd-grid-item - use-slot - class="flex justify-center items-center" - v-for="(item, index) in inspectMenu" - :key="item.id" - @click.stop="goItemPage(item.path)" - > - <image class="slot-img text-center" :src="item.icon" /> - <text>{{ item.name }}</text> - </wd-grid-item> - </wd-grid> - </wd-card> - </view> - <view class="bg-white mt-2"> - <wd-card type="rectangle"> - <template #title> - <view class="flex items-center menu-title-box"> - <view class="menu-indicator"></view> - <view class="ml-1 text-xs">鍙拌处鐩稿叧</view> - </view> - </template> - <wd-grid :column="4"> - <wd-grid-item - use-slot - class="flex justify-center items-center" - v-for="(item, index) in equMenu" - @click.stop="goItemPage(item.path)" - > - <image class="slot-img text-center" :src="item.icon" /> - <text>{{ item.name }}</text> - </wd-grid-item> - </wd-grid> - </wd-card> - </view> + <view class="flex items-center"> + <wd-icon + name="notification" + size="40rpx" + class="icon-color-base mr-3" + @click="handleInfo" + ></wd-icon> + <wd-icon + name="tips" + size="40rpx" + class="icon-color-base mr-3" + @click="handleInfo" + ></wd-icon> + <wd-icon name="app" size="40rpx" class="icon-color-base" @click="handleInfo"></wd-icon> + </view> + </view> - </view> + </template> + <view class="bg-base overflow-hidden"> + + <view class="bg-white py-2 px-2"> + <wd-img class="w-full h-[260rpx]" src="/static/images/pic4.jpeg" /> + </view> + <view class="bg-noti flex flex-row"> + <wd-notice-bar + text="杩欐槸涓�鏉℃秷鎭彁绀轰俊鎭紝杩欐槸涓�鏉℃秷鎭彁绀轰俊鎭紝杩欐槸涓�鏉℃秷鎭彁绀轰俊鎭�" + prefix="clock" + type="info" + :scrollable="false" + custom-class="flex-1 overflow-hidden" + /> + <wd-button type="text" class="w-[120rpx]">鏌ョ湅</wd-button> + </view> + + <view class="bg-white"> + <wd-card type="rectangle"> + <template #title> + <view class="flex items-center menu-title-box"> + <view class="menu-indicator"></view> + <view class="ml-1 text-xs">鏁版嵁鎬昏</view> + </view> + </template> + <view class="flex flex-row justify-around"> + <view class="flex flex-col justify-center"> + <text class="text-lg text-center">{{ equTotal }}</text> + <text class="text-color-gray">璁惧鎬绘暟</text> + </view> + <view class="flex flex-col justify-center"> + <text class="text-lg text-center">{{ fixtureTotal }}</text> + <text class="text-color-gray">宸ュ叿鎬绘暟</text> + </view> + <view class="flex flex-col justify-center"> + <text class="text-lg text-center">{{ faultTotal }}</text> + <text class="text-color-gray">鏈慨澶嶆晠闅�</text> + </view> + </view> + </wd-card> + </view> + <view class="bg-white mt-2"> + <wd-card type="rectangle"> + <template #title> + <view class="flex items-center menu-title-box"> + <view class="menu-indicator"></view> + <view class="ml-1 text-xs">蹇嵎鎿嶄綔</view> + </view> + </template> + <wd-grid :column="4"> + <wd-grid-item + use-slot + class="flex justify-center items-center" + v-for="(item, index) in commonMenu" + :key="item.id" + @click.stop="goItemPage(item)" + > + <image class="slot-img text-center" :src="item.icon" /> + <text>{{ item.name }}</text> + </wd-grid-item> + </wd-grid> + </wd-card> + </view> + <view class="bg-white mt-2"> + <wd-card type="rectangle"> + <template #title> + <view class="flex items-center menu-title-box"> + <view class="menu-indicator"></view> + <view class="ml-1 text-xs">璁惧绠$悊</view> + </view> + </template> + <wd-grid :column="4"> + <wd-grid-item + use-slot + class="flex justify-center items-center" + v-for="(item, index) in inspectMenu" + :key="item.id" + @click.stop="goItemPage(item)" + > + <image class="slot-img text-center" :src="item.icon" /> + <text>{{ item.name }}</text> + </wd-grid-item> + </wd-grid> + </wd-card> + </view> + <view class="bg-white mt-2"> + <wd-card type="rectangle"> + <template #title> + <view class="flex items-center menu-title-box"> + <view class="menu-indicator"></view> + <view class="ml-1 text-xs">鍙拌处鐩稿叧</view> + </view> + </template> + <wd-grid :column="4"> + <wd-grid-item + use-slot + class="flex justify-center items-center" + v-for="(item, index) in equMenu" + @click.stop="goItemPage(item)" + > + <image class="slot-img text-center" :src="item.icon" /> + <text>{{ item.name }}</text> + </wd-grid-item> + </wd-grid> + </wd-card> + </view> + + <view class="w-full h-[100rpx]"></view> + </view> + </z-paging> </template> <script lang="ts" setup> import { getAllMenusApi } from '@/service/menu' import { useUserStore } from '@/store' import { tabbarStore } from '@/components/fg-tabbar/tabbar' +import { getEquList } from '@/service/equ' +import { getRepairResList } from '@/service/repair' +import { getFixtureList } from '@/service/fixture' +import { receiveOrderRepair } from '@/service/mobile' +import { useToast, useMessage } from 'wot-design-uni' +import { ref } from 'vue' + +const message = useMessage() +const toast = useToast() defineOptions({ name: 'Home', }) const userStore = useUserStore() +const equTotal = ref(0) +const faultTotal = ref(0) +const fixtureTotal = ref(0) + +const paging = ref(null) +const dataList = ref([]) + // 鑾峰彇灞忓箷杈圭晫鍒板畨鍏ㄥ尯鍩熻窛绂� const { safeAreaInsets } = uni.getSystemInfoSync() const getAllMenus = async () => { const menuList = await getAllMenusApi() - console.error(menuList) } function handleInfo() { uni.showToast({ @@ -159,25 +190,55 @@ }) } -const goItemPage = (path: string) => { - const url = `/${path}` - uni.navigateTo({ - url, - }) +const queryList = (pageNum?: number, pageSize?: number) => { + getEquList({ pageNum, pageSize }) + .then((res: any) => { + equTotal.value = res?.total || 0 + queryRepairResList() + queryFixtureList() + paging.value.complete(true) + }) + .catch((res) => { + paging.value.complete(true) + }) +} + +const goItemPage = (item: any) => { + if (!item?.custom) { + const url = `/${item.path}` + uni.navigateTo({ + url, + }) + } else { + switch (item.name) { + case '鎺ュ崟缁翠慨': + handleSelectReq() + break + } + } } onLoad(() => { // getAllMenus() + queryEquList() + queryRepairResList() + queryFixtureList() }) - const commonMenu = reactive([ { id: 1, name: '鏁呴殰鎶ヤ慨', - icon: '/static/ico/ico20.png', + icon: '/static/ico/ico7.png', path: 'pages/repair/repair-add', - } + }, + { + id: 2, + custom: true, + name: '鎺ュ崟缁翠慨', + icon: '/static/ico/ico8.png', + path: 'pages/repair/repair-add', + }, ]) const equMenu = reactive([ @@ -240,6 +301,94 @@ } const realName = computed(() => userStore?.userInfo?.realName) + +/** + * 閫夋嫨鎶ヤ慨鍗� + */ +function handleSelectReq() { + uni.navigateTo({ + url: '/pages/repair/req-list', + events: { + // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹� + selectReq: function (data) { + // 閫夋嫨鎶ヤ慨鍗曞悗锛屼慨鏀规姤淇崟鐘舵�佸拰鏂板缁翠慨宸ュ崟 + const resCode = `WXD${data.data.code.slice(3)}` + const deptId = userStore?.userInfo?.deptId + const userId = userStore?.userInfo?.userId + const resData = { + reqId: data.data.id, + reqCode: data.data.code, + reqUser: data.data.reqUser, + reqDept: data.data.reqDept, + resCode, + status: '1', + resUser: userId, + resDept: deptId, + } + receiveOrderRepair(resData) + .then((res: any) => { + if (res?.id) { + toast.success(res?.msg || '鎿嶄綔鎴愬姛') + uni.navigateTo({ + url: `/pages/repair/res-detail?id=${res?.id}`, + }) + } else { + toast.error(res?.msg || '鐢熸垚缁翠慨宸ュ崟澶辫触锛岃閲嶈瘯') + } + }) + .catch((res) => { + toast.error(res?.msg || '鐢熸垚缁翠慨宸ュ崟澶辫触锛岃閲嶈瘯') + }) + }, + }, + success: function (res) { + // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹� + res.eventChannel.emit('OnSelectReq', { data: '缁翠慨鍗曢〉闈㈤�夋嫨鎶ヤ慨鍗�' }) + }, + }) +} + +function queryEquList() { + getEquList({ + page: 1, + size: 10, + }) + .then((res: any) => { + equTotal.value = res?.total || 0 + }) + .catch((err) => { + console.log(err) + }) +} + +function queryRepairResList() { + getRepairResList({ + page: 1, + size: 10, + status: '2', + }) + .then((res: any) => { + faultTotal.value = res?.total || 0 + }) + .catch((res) => {}) +} + +function queryFixtureList() { + getFixtureList({ + page: 1, + size: 10, + }) + .then((res: any) => { + fixtureTotal.value = res?.total || 0 + }) + .catch((res) => {}) +} + +function goToDetail(item) { + uni.navigateTo({ + url: `/pages/repair/res-detail?id=${item.id}`, + }) +} </script> <style lang="scss" scoped> diff --git a/eims-ui-mobile/src/pages/inspect/insp-record.vue b/eims-ui-mobile/src/pages/inspect/insp-record.vue index e17e7bf..99efef5 100644 --- a/eims-ui-mobile/src/pages/inspect/insp-record.vue +++ b/eims-ui-mobile/src/pages/inspect/insp-record.vue @@ -119,7 +119,7 @@ <view class="w-full h-[24rpx]"></view> <wd-cell> <template #title> - <text class="text-color-gray">鍏跺畠</text> + <text class="text-color-gray">鍏朵粬</text> </template> </wd-cell> <view class="w-full h-[1px] bg-base"></view> diff --git a/eims-ui-mobile/src/pages/repair/req-list.vue b/eims-ui-mobile/src/pages/repair/req-list.vue index 190468e..75916b9 100644 --- a/eims-ui-mobile/src/pages/repair/req-list.vue +++ b/eims-ui-mobile/src/pages/repair/req-list.vue @@ -24,7 +24,7 @@ } </route> <template> - <z-paging ref="paging" v-model="dataList" @query="queryList" show-refresher-update-time> + <z-paging ref="paging" v-model="dataList" :auto="false" @query="queryList" show-refresher-update-time> <template #top> <wd-drop-menu v-if="!isSelectReq"> <wd-drop-menu-item @@ -264,6 +264,7 @@ // 鍙樉绀烘湭鎺ュ崟鏁版嵁 status.value = 0 console.log('OnSelectReq', data) + reloadData() }) }) @@ -272,6 +273,8 @@ reqTypeList.value.push(...rList) const sList: any = await getDictInfo(DICT_REPAIR_REQ_STATUS) statusList.value.push(...sList) + + reloadData() } onLoad(() => { diff --git a/eims-ui-mobile/src/service/mobile.ts b/eims-ui-mobile/src/service/mobile.ts new file mode 100644 index 0000000..e6596d4 --- /dev/null +++ b/eims-ui-mobile/src/service/mobile.ts @@ -0,0 +1,12 @@ +import { http } from '@/utils/http' +/** + * 姝ら〉闈㈡帴鍙d负绉诲姩绔壒娈婇渶姹傛柊澧炴帴鍙� + */ + +/** + * 鎺ュ崟缁翠慨-缁勫悎api + * @param data + */ +export const receiveOrderRepair = (data: any) => { + return http.post<void>('/eims/mobile/receiveOrderRepair', data) +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/MobileController.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/MobileController.java new file mode 100644 index 0000000..74d8919 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/MobileController.java @@ -0,0 +1,39 @@ +package org.dromara.eims.controller; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import lombok.RequiredArgsConstructor; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.web.core.BaseController; +import org.dromara.eims.domain.bo.EimsRepairResBo; +import org.dromara.eims.domain.vo.EimsRepairResVo; +import org.dromara.eims.service.IEimsRepairResService; +import org.dromara.eims.service.IMobileService; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 绉诲姩绔痗ontroller + * 涓昏鐢ㄤ簬涓�浜涚壒娈婃搷浣滐細 濡傚揩鎹锋帴鍗曠淮淇紙涓�娆¤姹傚涓帴鍙o紝涓轰繚璇佸師瀛愭�ф柊澧炵殑鎺ュ彛锛� + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/eims/mobile") +public class MobileController extends BaseController { + private final IMobileService mobileService; + + @Log(title = "鎺ュ崟缁翠慨-缁勫悎api", businessType = BusinessType.OTHER) + @RepeatSubmit() + @PostMapping("receiveOrderRepair") + public R<EimsRepairResVo> receiveOrderRepair(@Validated(AddGroup.class) @RequestBody EimsRepairResBo bo) { + EimsRepairResVo eimsRepairResVo = mobileService.receiveOrderRepair(bo); + return R.ok(eimsRepairResVo); + } +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IMobileService.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IMobileService.java new file mode 100644 index 0000000..f3be0a3 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IMobileService.java @@ -0,0 +1,18 @@ +package org.dromara.eims.service; + +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.eims.domain.bo.EimsRepairResBo; +import org.dromara.eims.domain.vo.EimsRepairResVo; + +import java.util.Collection; +import java.util.List; + + +public interface IMobileService { + /** + * 鎺ュ崟缁翠慨 + * @param bo + */ + EimsRepairResVo receiveOrderRepair(EimsRepairResBo bo); +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairResServiceImpl.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairResServiceImpl.java index c697818..dd6e024 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairResServiceImpl.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairResServiceImpl.java @@ -69,13 +69,18 @@ if(reqVo.getEquId()!=null){ EimsEquVo equVo = equMapper.selectVoById(reqVo.getEquId()); - resVo.setAssetNo(equVo.getAssetNo()); - resVo.setEquName(equVo.getEquName()); + if(equVo!=null){ + resVo.setAssetNo(equVo.getAssetNo()); + resVo.setEquName(equVo.getEquName()); + } + } if(reqVo.getFixtureId()!=null){ EimsFixtureVo fixtureVo = fixtureMapper.selectVoById(reqVo.getFixtureId()); - resVo.setFixtureName(fixtureVo.getFixtureName()); - resVo.setAssetNo(fixtureVo.getAssetNo()); + if(fixtureVo!=null){ + resVo.setFixtureName(fixtureVo.getFixtureName()); + resVo.setAssetNo(fixtureVo.getAssetNo()); + } } diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/MobileServiceImpl.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/MobileServiceImpl.java new file mode 100644 index 0000000..abae820 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/MobileServiceImpl.java @@ -0,0 +1,122 @@ +package org.dromara.eims.service.impl; + +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; +import org.dromara.common.core.constant.DictConstants; +import org.dromara.common.core.domain.model.LoginUser; +import org.dromara.common.core.service.RepairResService; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.SpringUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.satoken.utils.LoginHelper; +import org.dromara.eims.domain.EimsRepairRecord; +import org.dromara.eims.domain.EimsRepairReq; +import org.dromara.eims.domain.EimsRepairRes; +import org.dromara.eims.domain.bo.EimsRepairResBo; +import org.dromara.eims.domain.vo.EimsEquVo; +import org.dromara.eims.domain.vo.EimsFixtureVo; +import org.dromara.eims.domain.vo.EimsRepairReqVo; +import org.dromara.eims.domain.vo.EimsRepairResVo; +import org.dromara.eims.mapper.*; +import org.dromara.eims.service.IEimsRepairResService; +import org.dromara.eims.service.IMobileService; +import org.dromara.eims.utils.DataFilterUtil; +import org.dromara.system.domain.SysDept; +import org.dromara.system.domain.vo.SysDeptVo; +import org.dromara.system.mapper.SysDeptMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; + + +@RequiredArgsConstructor +@Service +public class MobileServiceImpl implements IMobileService { + private final EimsRepairResMapper repairResMapper; + private final EimsRepairReqMapper reqMapper; + private final EimsRepairRecordMapper recordMapper; + + + @Transactional(rollbackFor = Exception.class) + @Override + public synchronized EimsRepairResVo receiveOrderRepair(EimsRepairResBo bo) { + /** + * TODO 娉ㄦ剰鎺ュ彛璋冩暣鍚庨渶璋冩暣锛堟鎿嶄綔鍘熸湰涓虹Щ鍔ㄧ渚濇浼犻�掓暟鎹皟鐢ㄦ帴鍙o紝鐜颁负淇濊瘉鍘熷瓙鎬т竴娆℃�ц皟鐢ㄥ涓帴鍙o級 + */ + //1.鏂板缁翠慨宸ュ崟 + EimsRepairRes add = MapstructUtils.convert(bo, EimsRepairRes.class); + boolean flag = repairResMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + // 鏂板缁翠慨宸ュ崟鐨勬椂鍊欐洿鏂版姤淇崟鏁版嵁 + EimsRepairReqVo reqVo = reqMapper.selectVoById(bo.getReqId()); + reqVo.setRepairId(add.getId()); + reqVo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.YIJIEDAN); + EimsRepairReq req = MapstructUtils.convert(reqVo, EimsRepairReq.class); + reqMapper.updateById(req); + + //灏嗘柊澧炴姤淇崟鏃剁淮淇褰曠殑缁翠慨宸ュ崟id鏇存柊 + LambdaQueryWrapper<EimsRepairRecord> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(EimsRepairRecord::getReqId, add.getReqId()); + EimsRepairRecord one = recordMapper.selectOne(queryWrapper); + if(one!=null){ + one.setResId(add.getId()); + recordMapper.updateById(one); + } + //鐢熸垚缁翠慨璁板綍 + EimsRepairRecord record = new EimsRepairRecord(); + record.setReqId(add.getReqId()); + record.setResId(add.getId()); + record.setHandleTime(new Date()); + //鎺ュ崟鐘舵�� + record.setOpera(DictConstants.REPAIR_RECORD_HANDLE_DETAIL.YIJIEDAN); + record.setOperaUser(add.getCreateBy()); + record.setOperaResult("鐢熸垚缁翠慨宸ュ崟"); + //鏂板鏃剁敓鎴愯褰� + recordMapper.insert(record); + } + + //2.鏇存柊缁翠慨宸ュ崟 + LoginUser loginUser = LoginHelper.getLoginUser(); + bo.setStartTime(new Date()); + bo.setStatus("2"); + EimsRepairRes update = MapstructUtils.convert(bo, EimsRepairRes.class); + + EimsRepairResVo resVo = repairResMapper.selectVoById(bo.getId()); + String status = resVo.getStatus(); + //缁翠慨宸ュ崟寮�濮嬬淮淇紝鍚屾鏇存柊鎶ヤ慨鍗� 浠ュ強 缁翠慨璁板綍 + if (bo.getStatus().equals(DictConstants.REPAIR_RES_STATUS_DETAIL.WEIXIU) && + status.equals(DictConstants.REPAIR_RES_STATUS_DETAIL.YIJIEDAN)) { + //2.1.璁剧疆寮�濮嬬淮淇椂闂村拰鐘舵�� TODO + + //2.2鏇存柊鎶ヤ慨鍗曚负缁翠慨鐘舵�� + EimsRepairReqVo reqVo = reqMapper.selectVoById(bo.getReqId()); + reqVo.setStatus(DictConstants.REPAIR_REQ_STATUS_DETAIL.WEIXIU); + EimsRepairReq req = MapstructUtils.convert(reqVo, EimsRepairReq.class); + reqMapper.updateById(req); + + //2.3鐢熸垚缁翠慨璁板綍 + EimsRepairRecord record = new EimsRepairRecord(); + record.setResId(bo.getId()); + record.setReqId(bo.getReqId()); + record.setHandleTime(new Date()); + record.setOpera(DictConstants.REPAIR_RECORD_HANDLE_DETAIL.WEIXIU); + assert loginUser != null; + record.setOperaUser(loginUser.getUserId()); + record.setOperaResult("寮�濮嬬淮淇�"); + recordMapper.insert(record); + } + repairResMapper.updateById(update); + return repairResMapper.selectVoById(update.getId()); + + } +} -- Gitblit v1.9.3