From 242bea686a5a3cd4c0488cdbe72acdc17fc3b698 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 06 十二月 2024 18:14:16 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/funingyunwei

---
 admin/src/views/workorder/workorderCate.vue                                                                    |    4 
 server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwContractCloudController.java                |    2 
 h5/pages/operation/device.vue                                                                                  |  650 +++++++++++++++++++--------------
 server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwWorkorder.java                     |   39 -
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwAccountServiceImpl.java         |   26 +
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractRevenueServiceImpl.java |    2 
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java        |  266 ++++++++-----
 admin/src/views/Inspection/plan.vue                                                                            |    6 
 admin/src/views/workorder/components/detail.vue                                                                |   31 +
 h5/pages/workOrder/list.vue                                                                                    |    2 
 admin/src/views/workorder/workorderList.vue                                                                    |    5 
 server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwPatrolScheme.java                  |    3 
 server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwContractRevenue.java               |    3 
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwPatrolSchemeServiceImpl.java    |    2 
 server/system_gateway/src/main/resources/application.yml                                                       |    2 
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java           |   39 ++
 admin/src/views/workorder/components/OperaYwWorkorderWindow.vue                                                |   55 ++
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwWorkorderServiceImpl.java       |    1 
 18 files changed, 690 insertions(+), 448 deletions(-)

diff --git a/admin/src/views/Inspection/plan.vue b/admin/src/views/Inspection/plan.vue
index 2dcd367..421f804 100644
--- a/admin/src/views/Inspection/plan.vue
+++ b/admin/src/views/Inspection/plan.vue
@@ -20,8 +20,8 @@
       <ul class="toolbar" v-permissions="['business:ywpatrolscheme:create', 'business:ywpatrolscheme:delete']">
         <li><el-button type="primary" @click="editClick()" icon="el-icon-plus"
             v-permissions="['business:ywpatrolscheme:create']">鏂板缓</el-button></li>
-        <el-button type="primary" plain  :loading="isWorking.export" v-permissions="['business:ywpatrolscheme:exportExcel']"
-          @click="exportExcel">瀵煎嚭</el-button>
+        <el-button type="primary" plain :loading="isWorking.export"
+          v-permissions="['business:ywpatrolscheme:exportExcel']" @click="exportExcel">瀵煎嚭</el-button>
         <!-- <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete"
             v-permissions="['business:ywpatrolscheme:delete']">鍒犻櫎</el-button></li> -->
       </ul>
@@ -29,7 +29,7 @@
         <el-table-column type="selection" width="55"></el-table-column>
 
         <el-table-column prop="title" label="璁″垝鍚嶇О" min-width="100px"></el-table-column>
-        <el-table-column prop="lineId" label="璁″垝缂栧彿" min-width="100px"></el-table-column>
+        <el-table-column prop="code" label="璁″垝缂栧彿" min-width="100px"></el-table-column>
         <el-table-column prop="userName" label="璐熻矗浜哄憳" min-width="100px"></el-table-column>
 
         <el-table-column prop="startDate" label="璁″垝鏃ユ湡" min-width="150px">
diff --git a/admin/src/views/workorder/components/OperaYwWorkorderWindow.vue b/admin/src/views/workorder/components/OperaYwWorkorderWindow.vue
index 3b6d4e3..b524ba3 100644
--- a/admin/src/views/workorder/components/OperaYwWorkorderWindow.vue
+++ b/admin/src/views/workorder/components/OperaYwWorkorderWindow.vue
@@ -1,5 +1,6 @@
 <template>
-  <GlobalWindow width="800px" :title="title" :visible.sync="visible" @close="close" :confirm-working="isWorking" @confirm="confirm">
+  <GlobalWindow width="800px" :title="title" :visible.sync="visible" @close="close" :confirm-working="isWorking"
+    @confirm="confirm">
     <el-form :model="form" ref="form" :rules="rules">
       <el-form-item label="浣嶇疆绫诲瀷" prop="areaType">
         <el-select v-model="form.areaType">
@@ -49,7 +50,7 @@
               <i class="el-icon-plus avatar-uploader-icon"></i>
               <div>鍥剧墖/瑙嗛</div>
             </div>
-          </el-upload>  
+          </el-upload>
           <div v-for="(item, i) in fileList" :key="i" class="item">
             <i @click="handleDelImg(i)" class="el-icon-error close"></i>
             <el-image :src="item.fileurlFull" :preview-src-list="[item.fileurlFull]" v-if="item.type == 0"
@@ -86,12 +87,8 @@
       // 琛ㄥ崟鏁版嵁
       form: {
         id: null,
-        creator: '',
-        createDate: '',
-        editor: '',
         editDate: '',
         floor: '',
-        isdeleted: '',
         title: '',
         remark: '',
         status: '',
@@ -103,7 +100,6 @@
         floorId: '',
         roomId: '',
         userId: '',
-        phone: '',
         submitDate: '',
         cateId: '',
         areaType: '0',
@@ -147,6 +143,37 @@
       // 鏂板缓
       if (target == null) {
         this.$nextTick(() => {
+          this.$refs.form = {
+            id: null,
+            editDate: '',
+            floor: '',
+            title: '',
+            remark: '',
+            status: '',
+            sortnum: '',
+            content: '',
+            getDate: '',
+            projectId: '',
+            buildingId: '',
+            floorId: '',
+            roomId: '',
+            userId: '',
+            submitDate: '',
+            cateId: '',
+            areaType: '0',
+            code: '',
+            dealStatus: '',
+            dispatchUserId: '',
+            dispatchDate: '',
+            dispatchInfo: '',
+            dealUserId: '',
+            dealDate: '',
+            dealInfo: '',
+            dealType: ''
+          }
+          this.buildList = []
+          this.roomList = []
+          this.levelList = []
           this.$refs.form.resetFields()
           this.form[this.configData['field.id']] = null
         })
@@ -179,16 +206,16 @@
     changeBuild(e) {
       this.$set(this.form, 'floorId', '')
       this.$set(this.form, 'roomId', '')
-      if(this.form.areaType == 1){
+      if (this.form.areaType == 1) {
         this.getLevel(e)
-      }else{
+      } else {
         this.getRoom(e)
       }
-      
-      
+
+
     },
     getLevel(buildingId) {
-      getFloorList({ buildingId}).then(res => {
+      getFloorList({ buildingId }).then(res => {
         this.levelList = res
       })
     },
@@ -199,9 +226,9 @@
       })
     },
     changeSel(e) {
-      if(e && e.length == 2){
+      if (e && e.length == 2) {
         this.$set(this.form, 'cateId', e[1])
-      }else{
+      } else {
         this.$set(this.form, 'cateId', '')
       }
     },
diff --git a/admin/src/views/workorder/components/detail.vue b/admin/src/views/workorder/components/detail.vue
index d5337ea..a6908d4 100644
--- a/admin/src/views/workorder/components/detail.vue
+++ b/admin/src/views/workorder/components/detail.vue
@@ -1,12 +1,12 @@
 <template>
-  <GlobalWindow width="920px" title="宸ュ崟璇︽儏" :visible.sync="visible" :confirm-working="isWorking" @close="close"
+  <GlobalWindow width="960px" title="宸ュ崟璇︽儏" :visible.sync="visible" :confirm-working="isWorking" @close="close"
     @confirm="confirm">
     <div class="main">
       <div class="title">
         <span>宸ュ崟璇︽儏</span>
         <div>
           <div class="status primaryColor" v-if="info.dealStatus == 0 || info.dealStatus == null">寰呮寚娲�</div>
-          <div class="status" v-if="info.dealStatus == 1">宸叉寚娲�</div>
+          <div class="status green" v-if="info.dealStatus == 1">宸叉寚娲�</div>
           <div class="status gray" v-if="info.dealStatus == 2">宸插鐞�</div>
         </div>
       </div>
@@ -161,6 +161,7 @@
 import { detailById, dispatchOrder, dealOrder } from '@/api/workorder/ywWorkorder'
 import { getUserList } from '@/api/system/user'
 import { Message, Loading } from 'element-ui'
+import dayjs from 'dayjs'
 export default {
   components: {
     GlobalWindow
@@ -222,6 +223,9 @@
       const { id } = this
       detailById(id).then(res => {
         this.info = res
+        if(this.info.dealStatus == 1){
+          this.$set(this.param, 'getDate',dayjs().format('YYYY-MM-DD HH:mm:ss') )
+        }
       })
     },
     getStaff() {
@@ -300,9 +304,9 @@
     align-items: center;
 
     .status {
-      padding: 0 6px;
-      height: 22px;
-      line-height: 22px;
+      padding: 0 12px;
+      height: 24px;
+      line-height: 24px;
       border-radius: 2px;
       border: 1px solid #00BA92;
       color: #00BA92;
@@ -312,12 +316,17 @@
     }
 
     .primaryColor {
-      border: 1px solid $primary-color;
+      border: 1px solid rgba(63, 126, 239,.2);
+      background-color: rgba(63, 126, 239,.2);
     }
-
+    .green{
+      background-color: rgba(83, 183, 148, .2);
+      border: 1px solid rgba(83, 183, 148, .2);
+    }
     .gray {
-      color: gray;
-      border: 1px solid gray;
+      color: #333333;
+      background-color: rgba(128, 128, 128, .2);
+      border: 1px solid rgba(128, 128, 128, .2);
     }
   }
 
@@ -343,6 +352,10 @@
       width: 100%;
       display: flex;
       align-items: center;
+      .la{
+        margin-bottom: 0;
+        width: 72px;
+      }
     }
 
     .max {
diff --git a/admin/src/views/workorder/workorderCate.vue b/admin/src/views/workorder/workorderCate.vue
index 394d168..80ef24f 100644
--- a/admin/src/views/workorder/workorderCate.vue
+++ b/admin/src/views/workorder/workorderCate.vue
@@ -4,8 +4,8 @@
       <ul class="toolbar" v-permissions="['business:category:create', 'business:category:delete']">
         <li><el-button type="primary" @click="handleEdit()" icon="el-icon-plus"
             v-permissions="['business:category:create']">鏂板缓</el-button></li>
-        <li v-permissions="['business:category:exportExcel']"><el-button type="primary"
-            @click="exportExcel">瀵煎嚭</el-button></li>
+        <!-- <li v-permissions="['business:category:exportExcel']"><el-button type="primary"
+            @click="exportExcel">瀵煎嚭</el-button></li> -->
       </ul>
       <el-table row-key="id" :tree-props="{ children: 'childCategoryList' }" v-loading="isWorking.search"
         :data="dataList" stripe @selection-change="handleSelectionChange">
diff --git a/admin/src/views/workorder/workorderList.vue b/admin/src/views/workorder/workorderList.vue
index 2444c86..a2b0b1e 100644
--- a/admin/src/views/workorder/workorderList.vue
+++ b/admin/src/views/workorder/workorderList.vue
@@ -19,14 +19,14 @@
         </el-select>
       </el-form-item>
       <el-form-item prop="cateId" label="宸ュ崟鍒嗙被">
-        <el-cascader v-model="searchForm.areaIds" @change="changeSel" placeholder="璇烽�夋嫨宸℃鍖哄煙" clearable
+        <el-cascader v-model="searchForm.areaIds" @change="changeSel" placeholder="璇烽�夋嫨宸ュ崟鍒嗙被" clearable
           :options="cateList" :props="{
             label: 'name',
             value: 'id',
             children: 'childCategoryList'
           }"></el-cascader>
       </el-form-item>
-      <el-form-item label="鎻愪氦鏃ユ湡">
+      <el-form-item label="涓婃姤鏃堕棿">
         <el-date-picker v-model="searchForm.selDate" @change="changeSelDate" format="yyyy-MM-dd"
           value-format="yyyy-MM-dd" type="daterange"></el-date-picker>
       </el-form-item>
@@ -168,6 +168,7 @@
         buildingId: '',
         cateId: '',
       }
+      this.buildList = []
       this.search()
     },
     changeSelDate(e) {
diff --git a/h5/pages/operation/device.vue b/h5/pages/operation/device.vue
index 03eb655..80b70b1 100644
--- a/h5/pages/operation/device.vue
+++ b/h5/pages/operation/device.vue
@@ -5,226 +5,281 @@
 				<view class="la"><text class="red">*</text>閫夋嫨璁惧</view>
 				<view class="line">
 					<view class="sel_wrap" @click="showModal = true">
-						<view class="left" :class="param.deviceName ? '' : 'placeholder9'">{{ param.deviceName ? param.deviceName : '璇烽�夋嫨璁惧' }}</view>
+						<view class="left" :class="param.deviceName ? '' : 'placeholder9'">
+							{{ param.deviceName ? param.deviceName : '璇烽�夋嫨璁惧' }}
+						</view>
 						<u-icon name="arrow-right" color="#999999" size="17"></u-icon>
 					</view>
-					<image class="icon" src="@/static/side/scan.png" mode=""></image>
+					<image @click="openQrcode" class="icon" src="@/static/side/scan.png" mode=""></image>
 				</view>
 			</view>
-			<view class="item">
-				<view class="la">璁惧鐘舵��</view>
-				<view class="line">
-					<view class="radio_wrap">
-						<view class="ite" :class="{active: param.status == 0}" @click="statusChange(0)">姝e父</view>
-						<view class="ite" :class="{active: param.status == 1}" @click="statusChange(1)">鎹熷潖</view>
-						<view class="ite" :class="{active: param.status == 2}" @click="statusChange(2)">鎶ュ簾</view>
-					</view>
-				</view>
-			</view>
-			<view class="item">
-				<view class="la">涓婁紶瑙嗛/鍥剧墖</view>
-				<view class="upload_wrap">
-					<view class="upload_file" @click="showUpload = true">
-						<u-icon name="plus" color="rgb(153, 153, 153)" size="28"></u-icon>
-						<view class="mt6">鍥剧墖/瑙嗛</view>
-					</view>
-					<view class="upload_file" v-for="(item, i) in fileList" :key="i">
-						<u-icon class="close" size="20" name="close-circle-fill" color="red"
-							@click="fileDel('fileList', i)"></u-icon>
-						<image v-if="item.type == 0" :src="item.fileurlFull" mode="widthFix"></image>
-						<video v-if="item.type == 1" :src="item.fileurlFull" :controls="false"></video>
-					</view>
-				</view>
-			</view>
-			<view class="item">
-				<view class="la">杩愮淮澶囨敞</view>
-				<view class="line">
-					<textarea v-model="param.content" placeholder="璇疯緭鍏�" placeholder-class="placeholder9" />
-				</view>
-			</view>
+			<view class="item">
+				<view class="la">璁惧鐘舵��</view>
+				<view class="line">
+					<view class="radio_wrap">
+						<view class="ite" :class="{active: param.status == 0}" @click="statusChange(0)">姝e父</view>
+						<view class="ite" :class="{active: param.status == 1}" @click="statusChange(1)">鎹熷潖</view>
+						<view class="ite" :class="{active: param.status == 2}" @click="statusChange(2)">鎶ュ簾</view>
+					</view>
+				</view>
+			</view>
+			<view class="item">
+				<view class="la">涓婁紶瑙嗛/鍥剧墖</view>
+				<view class="upload_wrap">
+					<view class="upload_file" @click="showUpload = true">
+						<u-icon name="plus" color="rgb(153, 153, 153)" size="28"></u-icon>
+						<view class="mt6">鍥剧墖/瑙嗛</view>
+					</view>
+					<view class="upload_file" v-for="(item, i) in fileList" :key="i">
+						<u-icon class="close" size="20" name="close-circle-fill" color="red"
+							@click="fileDel('fileList', i)"></u-icon>
+						<image v-if="item.type == 0" :src="item.fileurlFull" mode="widthFix"></image>
+						<video v-if="item.type == 1" :src="item.fileurlFull" :controls="false"></video>
+					</view>
+				</view>
+			</view>
+			<view class="item">
+				<view class="la">杩愮淮澶囨敞</view>
+				<view class="line">
+					<textarea v-model="param.content" placeholder="璇疯緭鍏�" placeholder-class="placeholder9" />
+				</view>
+			</view>
 		</view>
-		<view class="sub_btn" @click="onSubmit">鎻愪氦</view>
-		<!--  -->
-		<u-popup :show="showUpload" @close="showUpload = false" closeOnClickOverlay>
-			<view class="sel_upload_wrap">
-				<view class="btn" @click="uploadImage">閫夋嫨鍥剧墖</view>
-				<view class="btn" @click="uploadVideo">閫夋嫨瑙嗛</view>
-			</view>
-		</u-popup>
-		<!--  -->
-		<u-popup :show="showModal" @close="showModal = false" :safeAreaInsetBottom="true" :round="10" closeable closeOnClickOverlay>
-			<view class="appr_modal">
-				<view class="title">璇烽�夋嫨璁惧</view>
-				<view class="search_wrap">
-					<image class="mr12 search" src="@/static/home/ic_search@2x.png" mode="widthFix"></image>
-					<input v-model="searchValue" @confirm="getDevice()" type="text" placeholder="鎼滅储璁惧鍚嶇О/缂栧彿" placeholder-class="placeholder9" />
-				</view>
-				<view class="modal_list">
-					<view class="item" v-for="item,i in deviceList" @click="deviceClick(item)">
-						<view class="name">[{{item.code}}] {{ item.name }}</view>
-						<image v-if="activeDevice.id == item.id" src="@/static/radioed.png" mode=""></image>
-					</view>
-				</view>
-				<view class="sub_btn" @click="handleDevice">纭畾閫夋嫨</view>
-			</view>
+		<view class="sub_btn" @click="onSubmit">鎻愪氦</view>
+		<!--  -->
+		<u-popup :show="showUpload" @close="showUpload = false" closeOnClickOverlay>
+			<view class="sel_upload_wrap">
+				<view class="btn" @click="uploadImage">閫夋嫨鍥剧墖</view>
+				<view class="btn" @click="uploadVideo">閫夋嫨瑙嗛</view>
+			</view>
 		</u-popup>
+		<!--  -->
+		<u-popup :show="showModal" @close="showModal = false" :safeAreaInsetBottom="true" :round="10" closeable
+			closeOnClickOverlay>
+			<view class="appr_modal">
+				<view class="title">璇烽�夋嫨璁惧</view>
+				<view class="search_wrap">
+					<image class="mr12 search" src="@/static/home/ic_search@2x.png" mode="widthFix"></image>
+					<input v-model="searchValue" @confirm="getDevice()" type="text" placeholder="鎼滅储璁惧鍚嶇О/缂栧彿"
+						placeholder-class="placeholder9" />
+				</view>
+				<view class="modal_list">
+					<view class="item" v-for="item,i in deviceList" @click="deviceClick(item)">
+						<view class="name">[{{item.code}}] {{ item.name }}</view>
+						<image v-if="activeDevice.id == item.id" src="@/static/radioed.png" mode=""></image>
+					</view>
+				</view>
+				<view class="sub_btn" @click="handleDevice">纭畾閫夋嫨</view>
+			</view>
+		</u-popup>
+		<!--  -->
+		<view class="reader-box" @click="stopScan" v-if="isScaning">
+			<view class="reader" id="reader"></view>
+		</view>
 	</view>
 </template>
 
-<script>
-	import {
-		uploadUrl,
-		ywDevicePost,
-		ywDeviceCreate
-	} from '@/api'
+<script>
+	import {
+		uploadUrl,
+		ywDevicePost,
+		ywDeviceCreate
+	} from '@/api'
 	import dayjs from 'dayjs';
+	import {
+		Html5Qrcode
+	} from 'html5-qrcode';
 	export default {
 		data() {
 			return {
-				param: {status: 0},
-				showUpload: false,
-				showModal: false,
-				fileList: [],
-				
-				searchValue: '',
-				deviceList: [],
-				activeDevice: {}
+				param: {
+					status: 0
+				},
+				showUpload: false,
+				showModal: false,
+				fileList: [],
+
+				searchValue: '',
+				deviceList: [],
+				activeDevice: {},
+
+				html5Qrcode: null,
+				isScaning: false,
 			};
-		},
-		onLoad() {
-			this.getDevice()
-		},
-		methods: {
-			onSubmit() {
-				const { param, fileList } = this
-				
-				if(!param.deviceId) return this.showToast('璇峰厛閫夋嫨瑕佺淮鎶ょ殑璁惧')
-				ywDeviceCreate({
-					...param,
-					userId: uni.getStorageSync('userInfo').id,
-					dealDate: dayjs().format('YYYY-MM-DD HH:mm:ss'),
-					multifileList: fileList
-				}).then(res => {
-					this.showToast('鎻愪氦鎴愬姛')
-					uni.navigateBack()
-				})
-			},
-			getDevice(){
-				ywDevicePost({
-					capacity: 9999,
-					page: 1,
-					model: {
-						name: this.searchValue
-					}
-				}).then(res => {
-					this.deviceList = res.data.records || []
-				})
-			},
-			handleDevice() {
-				const { activeDevice } = this
-				if(!activeDevice.id) return this.showToast('璇峰厛閫夋嫨璁惧')
-				this.$set(this.param, 'deviceId', activeDevice.id)
-				this.$set(this.param, 'deviceName', activeDevice.name)
-				this.showModal = false
-			},
-			deviceClick(item) {
-				this.activeDevice = item
-				this.$forceUpdate()
-			},
-			statusChange(val){
-				this.param.status = val
-			},
-			fileDel(str, i) {
-				this[str].splice(i, 1);
-			},
-			uploadImage() {
-				this.showUpload = false;
-				let token = uni.getStorageSync('token') || '';
-				uni.chooseImage({
-					count: 4,
-					success: chooseImageRes => {
-						uni.showLoading({
-							title: '涓婁紶涓�',
-							mask: true
-						});
-						const tempFilePaths = chooseImageRes.tempFilePaths;
-						let imgs = tempFilePaths.map((value, index) => {
-							return {
-								name: 'file',
-								uri: value
-							};
-						});
-						uni.uploadFile({
-							url: `${uploadUrl}`,
-							files: imgs,
-							name: 'file',
-							formData: {
-								folder: 'YW_DEVICE'
-							},
-							header: {
-								Dm_user_token: token
-							},
-							success: uploadFileRes => {
-								let res = JSON.parse(uploadFileRes.data);
-								if (res.data && res.data.length > 0) {
-									res.data.forEach(i => {
-										i.type = 0;
-										i.fileurl = i.imgaddr;
-										i.fileurlFull = i.url;
-										this.fileList.push(i);
-									});
-								}
-							},
-							fail(err) {
-								console.log('err', err);
-							},
-							complete() {
-								uni.hideLoading();
-								// if (i === chooseImageRes.tempFilePaths.length - 1) {
-								//   uni.hideLoading()
-								// }
-							}
-						});
-					}
-				});
-			},
-			uploadVideo() {
-				this.showUpload = false;
-				let token = uni.getStorageSync('token') || '';
-				uni.chooseVideo({
-					success: chooseImageRes => {
-						uni.showLoading({
-							title: '涓婁紶涓�',
-							mask: true
-						});
-						uni.uploadFile({
-							url: `${uploadUrl}`,
-							filePath: chooseImageRes.tempFilePath,
-							header: {
-								Dm_user_token: token
-							},
-							name: 'file',
-							formData: {
-								folder: 'YW_DEVICE'
-							},
-							success: uploadFileRes => {
-								let res = JSON.parse(uploadFileRes.data);
-								if (res.data && res.data.length > 0) {
-									res.data.forEach(i => {
-										i.type = 1;
-										i.fileurl = i.imgaddr;
-										i.fileurlFull = i.url;
-										this.fileList.push(i);
-									});
-								}
-							},
-							complete() {
-								uni.hideLoading();
-							}
-						});
-					}
-				});
-			}
+		},
+		onLoad() {
+			this.getDevice()
+		},
+		methods: {
+			onSubmit() {
+				const {
+					param,
+					fileList
+				} = this
+
+				if (!param.deviceId) return this.showToast('璇峰厛閫夋嫨瑕佺淮鎶ょ殑璁惧')
+				ywDeviceCreate({
+					...param,
+					userId: uni.getStorageSync('userInfo').id,
+					dealDate: dayjs().format('YYYY-MM-DD HH:mm:ss'),
+					multifileList: fileList
+				}).then(res => {
+					this.showToast('鎻愪氦鎴愬姛')
+					uni.navigateBack()
+				})
+			},
+			getDevice() {
+				ywDevicePost({
+					capacity: 9999,
+					page: 1,
+					model: {
+						name: this.searchValue
+					}
+				}).then(res => {
+					this.deviceList = res.data.records || []
+				})
+			},
+			handleDevice() {
+				const {
+					activeDevice
+				} = this
+				if (!activeDevice.id) return this.showToast('璇峰厛閫夋嫨璁惧')
+				this.$set(this.param, 'deviceId', activeDevice.id)
+				this.$set(this.param, 'deviceName', activeDevice.name)
+				this.showModal = false
+			},
+			deviceClick(item) {
+				this.activeDevice = item
+				this.$forceUpdate()
+			},
+			statusChange(val) {
+				this.param.status = val
+			},
+			fileDel(str, i) {
+				this[str].splice(i, 1);
+			},
+			uploadImage() {
+				this.showUpload = false;
+				let token = uni.getStorageSync('token') || '';
+				uni.chooseImage({
+					count: 4,
+					success: chooseImageRes => {
+						uni.showLoading({
+							title: '涓婁紶涓�',
+							mask: true
+						});
+						const tempFilePaths = chooseImageRes.tempFilePaths;
+						let imgs = tempFilePaths.map((value, index) => {
+							return {
+								name: 'file',
+								uri: value
+							};
+						});
+						uni.uploadFile({
+							url: `${uploadUrl}`,
+							files: imgs,
+							name: 'file',
+							formData: {
+								folder: 'YW_DEVICE'
+							},
+							header: {
+								Dm_user_token: token
+							},
+							success: uploadFileRes => {
+								let res = JSON.parse(uploadFileRes.data);
+								if (res.data && res.data.length > 0) {
+									res.data.forEach(i => {
+										i.type = 0;
+										i.fileurl = i.imgaddr;
+										i.fileurlFull = i.url;
+										this.fileList.push(i);
+									});
+								}
+							},
+							fail(err) {
+								console.log('err', err);
+							},
+							complete() {
+								uni.hideLoading();
+								// if (i === chooseImageRes.tempFilePaths.length - 1) {
+								//   uni.hideLoading()
+								// }
+							}
+						});
+					}
+				});
+			},
+			uploadVideo() {
+				this.showUpload = false;
+				let token = uni.getStorageSync('token') || '';
+				uni.chooseVideo({
+					success: chooseImageRes => {
+						uni.showLoading({
+							title: '涓婁紶涓�',
+							mask: true
+						});
+						uni.uploadFile({
+							url: `${uploadUrl}`,
+							filePath: chooseImageRes.tempFilePath,
+							header: {
+								Dm_user_token: token
+							},
+							name: 'file',
+							formData: {
+								folder: 'YW_DEVICE'
+							},
+							success: uploadFileRes => {
+								let res = JSON.parse(uploadFileRes.data);
+								if (res.data && res.data.length > 0) {
+									res.data.forEach(i => {
+										i.type = 1;
+										i.fileurl = i.imgaddr;
+										i.fileurlFull = i.url;
+										this.fileList.push(i);
+									});
+								}
+							},
+							complete() {
+								uni.hideLoading();
+							}
+						});
+					}
+				});
+			},
+
+			openQrcode() {
+				this.isScaning = true;
+				Html5Qrcode.getCameras().then((devices) => {
+					if (devices && devices.length) {
+						this.html5Qrcode = new Html5Qrcode('reader');
+						this.html5Qrcode.start({
+								facingMode: 'environment'
+							}, {
+								focusMode: 'continuous', //璁剧疆杩炵画鑱氱劍妯″紡
+								fps: 5, //璁剧疆鎵爜璇嗗埆閫熷害
+								qrbox: 280 //璁剧疆浜岀淮鐮佹壂鎻忔澶у皬
+							},
+							(decodeText, decodeResult) => {
+								if (decodeText) { //杩欓噷decodeText灏辨槸閫氳繃鎵弿浜岀淮鐮佸緱鍒扮殑鍐呭
+									this.action(decodeText) //瀵逛簩缁寸爜閫昏緫澶勭悊
+									this.stopScan(); //鍏抽棴鎵爜鍔熻兘
+								}
+							},
+							(err) => {
+								// console.log(err);  //閿欒淇℃伅
+							}
+						);
+					}
+				});
+			},
+
+			stopScan() {
+				console.log('鍋滄鎵爜')
+				this.isScaning = false;
+				if (this.html5Qrcode) {
+					this.html5Qrcode.stop();
+				}
+			}
 		}
 	}
 </script>
@@ -238,13 +293,15 @@
 			}
 
 			.line {
-				display: flex;
-				align-items: center;
-				.icon{
-					width: 52rpx;
-					height: 52rpx;
-					margin-left: 40rpx;
+				display: flex;
+				align-items: center;
+
+				.icon {
+					width: 52rpx;
+					height: 52rpx;
+					margin-left: 40rpx;
 				}
+
 				textarea {
 					box-sizing: border-box;
 					width: 690rpx;
@@ -259,7 +316,7 @@
 				}
 			}
 
-			.sel_wrap {
+			.sel_wrap {
 				flex: 1;
 				height: 90rpx;
 				display: flex;
@@ -267,27 +324,31 @@
 				align-items: center;
 				border-bottom: 1rpx solid #E5E5E5;
 			}
-			.radio_wrap{
-				margin-top: 20rpx;
-				width: 100%;
-				display: flex;
-				justify-content: space-between;
-				.ite{
-					width: 216rpx;
-					height: 68rpx;
-					background: #F7F7F7;
-					border-radius: 36rpx;
-					font-size: 30rpx;
-					display: flex;
-					align-items: center;
-					justify-content: center;
-				}
-				.active{
-					color: $primaryColor;
-					border-color: $primaryColor;
-					background: rgba(0,104,255,0.1);
-				}
+
+			.radio_wrap {
+				margin-top: 20rpx;
+				width: 100%;
+				display: flex;
+				justify-content: space-between;
+
+				.ite {
+					width: 216rpx;
+					height: 68rpx;
+					background: #F7F7F7;
+					border-radius: 36rpx;
+					font-size: 30rpx;
+					display: flex;
+					align-items: center;
+					justify-content: center;
+				}
+
+				.active {
+					color: $primaryColor;
+					border-color: $primaryColor;
+					background: rgba(0, 104, 255, 0.1);
+				}
 			}
+
 			.upload_wrap {
 				display: flex;
 				flex-wrap: wrap;
@@ -333,6 +394,7 @@
 
 		}
 	}
+
 	.sel_upload_wrap {
 		width: 100%;
 		border-top: 1px solid #333333;
@@ -344,6 +406,7 @@
 			text-align: center;
 		}
 	}
+
 	.sub_btn {
 		position: fixed;
 		bottom: 68rpx;
@@ -360,51 +423,78 @@
 		font-size: 32rpx;
 		color: #FFFFFF;
 	}
-	.appr_modal {
-		padding: 36rpx 30rpx 0;
-		height: calc( 100vh - 120rpx );
-		.title {
-			font-weight: 600;
-			font-size: 32rpx;
-			color: #222222;
-			margin-bottom: 40rpx;
-			text-align: center;
-		}
-		
-		.search_wrap {
-			display: flex;
-			align-items: center;
-			width: 100%;
-			height: 76rpx;
-			background: #f2f2f2;
-			border-radius: 38rpx;
-			padding-left: 30rpx;
-			input{
-				flex: 1;
-			}
-			.search {
-				width: 28rpx;
-				height: 28rpx;
-			}
-		}
-		.modal_list{
-			height: calc( 100% - 360rpx );
-			.item{
-				display: flex;
-				align-items: center;
-				justify-content: space-between;
-				height: 100rpx;
-				font-size: 30rpx;
-				border-bottom: 1px solid #E5E5E5;
-				image{
-					width: 40rpx;
-					height: 40rpx;
-				}
-			}
-			.active{
-				color: $primaryColor;
-			}
-		}
-		
-	}
+
+	.appr_modal {
+		padding: 36rpx 30rpx 0;
+		height: calc(100vh - 120rpx);
+
+		.title {
+			font-weight: 600;
+			font-size: 32rpx;
+			color: #222222;
+			margin-bottom: 40rpx;
+			text-align: center;
+		}
+
+		.search_wrap {
+			display: flex;
+			align-items: center;
+			width: 100%;
+			height: 76rpx;
+			background: #f2f2f2;
+			border-radius: 38rpx;
+			padding-left: 30rpx;
+
+			input {
+				flex: 1;
+			}
+
+			.search {
+				width: 28rpx;
+				height: 28rpx;
+			}
+		}
+
+		.modal_list {
+			height: calc(100% - 360rpx);
+
+			.item {
+				display: flex;
+				align-items: center;
+				justify-content: space-between;
+				height: 100rpx;
+				font-size: 30rpx;
+				border-bottom: 1px solid #E5E5E5;
+
+				image {
+					width: 40rpx;
+					height: 40rpx;
+				}
+			}
+
+			.active {
+				color: $primaryColor;
+			}
+		}
+
+	}
+
+	.reader-box {
+		position: fixed;
+		top: 0;
+		bottom: 0;
+		left: 0;
+		right: 0;
+		background-color: rgba(0, 0, 0, 0.5);
+	}
+
+	.reader {
+		width: 100%;
+		// width: 540rpx;
+		// height: 540rpx;
+		position: absolute;
+		top: 50%;
+		left: 50%;
+		transform: translate(-50%, -50%);
+	}
 </style>
\ No newline at end of file
diff --git a/h5/pages/workOrder/list.vue b/h5/pages/workOrder/list.vue
index 7928b55..d2114af 100644
--- a/h5/pages/workOrder/list.vue
+++ b/h5/pages/workOrder/list.vue
@@ -126,7 +126,7 @@
 					model: {
 						...param,
 						queryStatus: activeTab,
-						dispatchUserId: selectAll ? '' : uni.getStorageSync('userInfo').id,
+						dealUserId: selectAll ? '' : uni.getStorageSync('userInfo').id,
 					}
 				}).then(res => {
 					this.list = [...this.list, ...res.data.records]
diff --git a/server/system_gateway/src/main/resources/application.yml b/server/system_gateway/src/main/resources/application.yml
index 0a4b1bc..6503fa3 100644
--- a/server/system_gateway/src/main/resources/application.yml
+++ b/server/system_gateway/src/main/resources/application.yml
@@ -82,7 +82,7 @@
   compression:
     enabled: true
     mime-types: application/json
-  port: 8080
+  port: 10010
 
   tomcat:
     max-swallow-size: -1
diff --git a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwContractCloudController.java b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwContractCloudController.java
index cbea257..b1d01e4 100644
--- a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwContractCloudController.java
+++ b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwContractCloudController.java
@@ -103,7 +103,7 @@
     public ApiResponse<List<YwContract>> list (@RequestBody YwContract model,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         return ApiResponse.success(ywContractService.findList(model));
     }
-    @ApiOperation("鍒楄〃")
+    @ApiOperation("鏍规嵁閫�绉熸棩鏈熸煡璇㈣处鍗曟暟鎹�")
     @PostMapping("/findForBills")
     @CloudRequiredPermission("business:ywcontract:query")
     public ApiResponse<YwContract> findForBills (@RequestBody YwContract model,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwContractRevenue.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwContractRevenue.java
index bc41654..70281cd 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwContractRevenue.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwContractRevenue.java
@@ -92,6 +92,9 @@
     @ExcelColumn(name="鍚堝悓缂栧彿",index = 1,width = 10)
     @TableField(exist = false)
     private String contractCode;
+    @ApiModelProperty(value = "鍚堝悓鐙�鎱�", example = "1")
+    @TableField(exist = false)
+    private String contractStatus;
 
 
     @ApiModelProperty(value = "瀹㈡埛鍚嶇О锛堜粯娆炬柟锛�", example = "1")
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwPatrolScheme.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwPatrolScheme.java
index 4f8b83a..a7c167c 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwPatrolScheme.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwPatrolScheme.java
@@ -56,7 +56,7 @@
     private String remark;
 
     @ApiModelProperty(value = "鐘舵�� 0鍚敤 1绂佺敤", example = "1")
-    @ExcelColumn(name="鐘舵��",index = 9,width = 6,valueMapping = "0=鍚敤;1=鍋滅敤;")
+    @ExcelColumn(name="鐘舵��",index = 8,width = 6,valueMapping = "0=鍚敤;1=鍋滅敤;")
     private Integer status;
 
     @ApiModelProperty(value = "鎺掑簭鐮�", example = "1")
@@ -121,6 +121,5 @@
 
     @ApiModelProperty(value = "瓒呮湡浠诲姟鏁�")
     @TableField(exist = false)
-    @ExcelColumn(name="瓒呮湡浠诲姟鏁�",index = 8,width = 6)
     private Integer timeOutTaskNum;
 }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwWorkorder.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwWorkorder.java
index e0c3601..52b009b 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwWorkorder.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwWorkorder.java
@@ -26,129 +26,103 @@
 
     @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "涓婚敭", example = "1")
-    @ExcelColumn(name="涓婚敭")
     private Integer id;
 
     @ApiModelProperty(value = "鍒涘缓浜虹紪鐮�", example = "1")
-    @ExcelColumn(name="鍒涘缓浜虹紪鐮�")
     private Integer creator;
 
     @ApiModelProperty(value = "鍒涘缓鏃堕棿")
-    @ExcelColumn(name="鍒涘缓鏃堕棿")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createDate;
 
     @ApiModelProperty(value = "鏇存柊浜虹紪鐮�", example = "1")
-    @ExcelColumn(name="鏇存柊浜虹紪鐮�")
     private Integer editor;
 
     @ApiModelProperty(value = "鏇存柊鏃堕棿")
-    @ExcelColumn(name="鏇存柊鏃堕棿")
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date editDate;
 
     @ApiModelProperty(value = "鏄惁鍒犻櫎0鍚� 1鏄�", example = "1")
-    @ExcelColumn(name="鏄惁鍒犻櫎0鍚� 1鏄�")
     private Integer isdeleted;
 
     @ApiModelProperty(value = "鏍囬")
-    @ExcelColumn(name="鏍囬")
     private String title;
 
     @ApiModelProperty(value = "澶囨敞")
-    @ExcelColumn(name="澶囨敞")
     private String remark;
 
     @ApiModelProperty(value = "鐘舵�� 0鍚敤 1绂佺敤", example = "1")
-    @ExcelColumn(name="鐘舵�� 0鍚敤 1绂佺敤")
     private Integer status;
 
     @ApiModelProperty(value = "鎺掑簭鐮�", example = "1")
-    @ExcelColumn(name="鎺掑簭鐮�")
     private Integer sortnum;
 
     @ApiModelProperty(value = "鎯呭喌璇存槑")
-    @ExcelColumn(name="鎯呭喌璇存槑")
     private String content;
 
     @ApiModelProperty(value = "涓婇棬鏃堕棿")
-    @ExcelColumn(name="涓婇棬鏃堕棿")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date getDate;
 
     @ApiModelProperty(value = "鎵�灞為」鐩紪鐮侊紙鍏宠仈yw_project)", example = "1")
-    @ExcelColumn(name="鎵�灞為」鐩紪鐮侊紙鍏宠仈yw_project)")
     private Integer projectId;
 
     @ApiModelProperty(value = "鎵�灞炴ゼ瀹囩紪鐮侊紙鍏宠仈yw_building)", example = "1")
-    @ExcelColumn(name="鎵�灞炴ゼ瀹囩紪鐮侊紙鍏宠仈yw_building)")
     private Integer buildingId;
 
     @ApiModelProperty(value = "鎵�灞炴埧闂寸紪鐮侊紙鍏宠仈yw_room)", example = "1")
-    @ExcelColumn(name="鎵�灞炴埧闂寸紪鐮侊紙鍏宠仈yw_room)")
     private Integer roomId;
     @ApiModelProperty(value = "鎵�灞炴ゼ灞傜紪鐮侊紙鍏宠仈yw_floor)", example = "1")
-    @ExcelColumn(name="鎵�灞炴ゼ灞傜紪鐮侊紙鍏宠仈yw_floor)")
     private Integer floorId;
 
     @ApiModelProperty(value = "鎻愭姤浜虹紪鐮�", example = "1")
-    @ExcelColumn(name="鎻愭姤浜虹紪鐮�")
     private Integer userId;
 
     @ApiModelProperty(value = "鑱旂郴鐢佃瘽")
-    @ExcelColumn(name="鑱旂郴鐢佃瘽")
     private String phone;
 
     @ApiModelProperty(value = "鎻愭姤鏃堕棿")
-    @ExcelColumn(name="鎻愭姤鏃堕棿")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ExcelColumn(name="涓婃姤鏃堕棿",index = 5,width = 16,dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date submitDate;
 
     @ApiModelProperty(value = "宸ュ崟鍒嗙被缂栫爜(鍏宠仈category锛�", example = "1")
-    @ExcelColumn(name="宸ュ崟鍒嗙被缂栫爜(鍏宠仈category锛�")
     private Integer cateId;
 
     @ApiModelProperty(value = "淇濅慨鍖哄煙绫诲瀷 0瀹ゅ唴缁翠慨 1鍏叡鍖哄煙", example = "1")
-    @ExcelColumn(name="淇濅慨鍖哄煙绫诲瀷 0瀹ゅ唴缁翠慨 1鍏叡鍖哄煙")
+    @ExcelColumn(name="浣嶇疆鍖哄煙",valueMapping = "0=瀹ゅ唴缁翠慨;1=鍏叡鍖哄煙;",index = 0,width = 10)
     private Integer areaType;
 
     @ApiModelProperty(value = "宸ュ崟缂栧彿")
-    @ExcelColumn(name="宸ュ崟缂栧彿")
     private String code;
 
     @ApiModelProperty(value = "澶勭悊鐘舵�� 0寰呭鐞� 1宸插垎娲� 2宸插鐞�", example = "1")
-    @ExcelColumn(name="澶勭悊鐘舵�� 0寰呭鐞� 1宸插垎娲� 2宸插鐞�")
+    @ExcelColumn(name="宸ュ崟鐘舵��",index = 7,width = 10,valueMapping = "0=寰呭鐞�;1=宸插垎娲�;1=宸插鐞�;")
     private Integer dealStatus;
 
     @ApiModelProperty(value = "鍒嗘淳浜虹紪鐮�(鍏宠仈system_user)", example = "1")
-    @ExcelColumn(name="鍒嗘淳浜虹紪鐮�(鍏宠仈system_user)")
     private Integer dispatchUserId;
 
     @ApiModelProperty(value = "鍒嗘淳鏃堕棿")
-    @ExcelColumn(name="鍒嗘淳鏃堕棿")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date dispatchDate;
 
     @ApiModelProperty(value = "鍒嗘淳澶勭悊璇存槑")
-    @ExcelColumn(name="鍒嗘淳澶勭悊璇存槑")
     private String dispatchInfo;
 
     @ApiModelProperty(value = "澶勭悊浜虹紪鐮�(鍏宠仈system_user)", example = "1")
-    @ExcelColumn(name="澶勭悊浜虹紪鐮�(鍏宠仈system_user)")
     private Integer dealUserId;
 
     @ApiModelProperty(value = "澶勭悊鏃堕棿")
-    @ExcelColumn(name="澶勭悊鏃堕棿")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date dealDate;
 
     @ApiModelProperty(value = "澶勭悊澶囨敞")
-    @ExcelColumn(name="澶勭悊澶囨敞")
     private String dealInfo;
 
     @ApiModelProperty(value = "澶勭悊鏂瑰紡 0鎸囨淳鍚庡鐞� 1鐩存帴鍥炲", example = "1")
-    @ExcelColumn(name="澶勭悊鏂瑰紡 0鎸囨淳鍚庡鐞� 1鐩存帴鍥炲")
     private Integer dealType;
+
     @ApiModelProperty(value = "椤圭洰鍚嶇О")
     @TableField(exist = false)
     private String projectName;
@@ -158,9 +132,11 @@
     private String queryStatus;
 
     @ApiModelProperty(value = "妤煎畤鍚嶇О")
+    @ExcelColumn(name="妤煎畤",index = 1,width = 10)
     @TableField(exist = false)
     private String buildingName;
     @ApiModelProperty(value = "鎴挎簮鍚嶇О")
+    @ExcelColumn(name="鎴挎簮",index = 2,width = 10)
     @TableField(exist = false)
     private String roomName;
     @ApiModelProperty(value = "妤煎眰鍚嶇О")
@@ -170,6 +146,7 @@
     @TableField(exist = false)
     private String roomNum;
     @ApiModelProperty(value = "鎻愭姤浜哄鍚�")
+    @ExcelColumn(name="涓婃姤浜�",index = 4,width = 10)
     @TableField(exist = false)
     private String creatorName;
     @ApiModelProperty(value = "鎻愭姤浜虹數璇�")
@@ -177,11 +154,13 @@
     private String creatorMobile;
     @ApiModelProperty(value = "澶勭悊浜哄鍚�")
     @TableField(exist = false)
+    @ExcelColumn(name="澶勭悊浜�",index = 6,width = 10)
     private String dealUserName;
     @ApiModelProperty(value = "澶勭悊浜虹粍缁�")
     @TableField(exist = false)
     private String dealUserCompany;
     @ApiModelProperty(value = "绫诲埆鍚嶇О")
+    @ExcelColumn(name="宸ュ崟鍒嗙被",index = 3,width = 10)
     @TableField(exist = false)
     private String categoryName;
     @ApiModelProperty(value = "鍒嗛厤浜哄鍚�")
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
index d2d8aef..2108dd2 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
@@ -25,10 +25,12 @@
 import com.doumee.dao.admin.request.UpdateCompanySortDTO;
 import com.doumee.dao.admin.response.CompanyDTO;
 import com.doumee.dao.business.MemberMapper;
+import com.doumee.dao.business.YwContractMapper;
 import com.doumee.dao.business.dao.CompanyMapper;
 import com.doumee.dao.business.dao.join.CompanyJoinMapper;
 import com.doumee.dao.business.model.Company;
 import com.doumee.dao.business.model.Member;
+import com.doumee.dao.business.model.YwContract;
 import com.doumee.dao.business.vo.CompanyTree;
 import com.doumee.dao.system.model.SystemUser;
 import com.doumee.service.business.CompanyService;
@@ -63,6 +65,9 @@
 
     @Autowired
     private CompanyJoinMapper companyJoinMapper;
+    @Autowired
+    private YwContractMapper ywContractMapper;
+
 
     /**
      * 鍒涘缓璐㈠姟鍏徃
@@ -77,6 +82,13 @@
                 .eq(Company::getType,company.getType())
                 .eq(Company::getIsdeleted,Constants.ZERO)) >0){
             throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝鍚嶇О涓嶈兘閲嶅~");
+        }
+        if(StringUtils.isNotBlank(company.getCode())){
+            if(companyMapper.selectCount(new QueryWrapper<Company>().lambda()
+                    .eq(Company::getCode,company.getCode())
+                    .eq(Company::getIsdeleted,Constants.ZERO)) >0){
+                throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝绾崇◣璇嗗埆鍙蜂笉鑳介噸澶崀");
+            }
         }
         company.setCreateDate(new Date());
         company.setCreator(company.getLoginUserInfo().getId());
@@ -105,6 +117,13 @@
                 .eq(Company::getName,company.getName())
                 .eq(Company::getIsdeleted,Constants.ZERO)) >0){
             throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝缁勭粐鍚嶇О涓嶈兘閲嶅~");
+        }
+        if(StringUtils.isNotBlank(company.getCode())){
+            if(companyMapper.selectCount(new QueryWrapper<Company>().lambda()
+                    .eq(Company::getCode,company.getCode())
+                    .eq(Company::getIsdeleted,Constants.ZERO)) >0){
+                throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝绾崇◣璇嗗埆鍙蜂笉鑳介噸澶崀");
+            }
         }
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         if(user ==null){
@@ -260,6 +279,9 @@
                 .eq(Member::getIsdeleted,Constants.ZERO)) >0){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "瀵逛笉璧凤紝璇ラ儴闂ㄤ笅瀛樺湪浜哄憳淇℃伅锛屼笉鑳借繘琛屽垹闄ゆ搷浣滐紒");
         }
+        if(ywContractMapper.selectCount(new QueryWrapper<YwContract>().lambda().eq(YwContract::getCompanyId,id))>Constants.ZERO){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "褰撳墠鍏徃宸插叧鑱斾笟鍔★紝涓嶅彲鍒犻櫎");
+        }
 
         Company company = new Company();
         company.setId(id);
@@ -308,6 +330,15 @@
                 .eq(Company::getIsdeleted,Constants.ZERO)) >0){
             throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝缁勭粐鍚嶇О涓嶈兘閲嶅~");
         }
+        if(StringUtils.isNotBlank(company.getCode())){
+            if(companyMapper.selectCount(new QueryWrapper<Company>().lambda()
+                    .eq(Company::getCode,company.getCode())
+                    .ne(Company::getId,company.getId())
+                    .eq(Company::getIsdeleted,Constants.ZERO)) >0){
+                throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝绾崇◣璇嗗埆鍙蜂笉鑳介噸澶崀");
+            }
+        }
+
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         if(user == null){
             user = company.getLoginUserInfo();
@@ -367,6 +398,14 @@
                 .eq(Company::getIsdeleted,Constants.ZERO)) >0){
             throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝鍚嶇О涓嶈兘閲嶅~");
         }
+        if(StringUtils.isNotBlank(company.getCode())){
+            if(companyMapper.selectCount(new QueryWrapper<Company>().lambda()
+                    .eq(Company::getCode,company.getCode())
+                    .ne(Company::getId,company.getId())
+                    .eq(Company::getIsdeleted,Constants.ZERO)) >0){
+                throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝绾崇◣璇嗗埆鍙蜂笉鑳介噸澶崀");
+            }
+        }
         companyMapper.updateById(company);
         return company.getId();
     }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwAccountServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwAccountServiceImpl.java
index 0256c8f..5044c23 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwAccountServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwAccountServiceImpl.java
@@ -8,9 +8,11 @@
 import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.Utils;
 import com.doumee.dao.business.YwAccountMapper;
+import com.doumee.dao.business.YwContractRevenueMapper;
 import com.doumee.dao.business.dao.CompanyMapper;
 import com.doumee.dao.business.model.Company;
 import com.doumee.dao.business.model.YwAccount;
+import com.doumee.dao.business.model.YwContractRevenue;
 import com.doumee.dao.business.model.YwProject;
 import com.doumee.service.business.YwAccountService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -18,6 +20,7 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
@@ -37,6 +40,8 @@
     private YwAccountMapper ywAccountMapper;
     @Autowired
     private CompanyMapper companyMapper;
+    @Autowired
+    private YwContractRevenueMapper ywContractRevenueMapper;
 
     @Override
     public Integer create(YwAccount model) {
@@ -49,6 +54,15 @@
                 || !Constants.equalsInteger(ywProject.getType(),Constants.TWO)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝璇烽�夋嫨姝g‘鐨勫叕鍙镐俊鎭紒");
         }
+        if(StringUtils.isNotBlank(model.getTitle())){
+            if(ywAccountMapper.selectCount(new QueryWrapper<YwAccount>().lambda()
+                    .eq(YwAccount::getTitle,model.getTitle())
+                    .eq(YwAccount::getIsdeleted,Constants.ZERO)) >0){
+                throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝鏀舵敮鏉$洰涓嶈兘閲嶅~");
+            }
+        }
+
+
         model.setCreator(model.getLoginUserInfo().getId());
         model.setIsdeleted(Constants.ZERO);
         model.setCreateDate(new Date());
@@ -61,6 +75,9 @@
 
     @Override
     public void deleteById(Integer id, LoginUserInfo user) {
+        if(ywContractRevenueMapper.selectCount(new QueryWrapper<YwContractRevenue>().lambda().eq(YwContractRevenue::getAccountId,id))>Constants.ZERO){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"褰撳墠鏀舵敮璐︽埛宸插叧鑱斾笟鍔★紝涓嶅彲鍒犻櫎");
+        }
         YwAccount model = new YwAccount();
         model.setId(id);
         model.setIsdeleted(Constants.ONE);
@@ -95,6 +112,15 @@
                 || !Constants.equalsInteger(ywProject.getType(),Constants.TWO)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝璇烽�夋嫨姝g‘鐨勫叕鍙镐俊鎭紒");
         }
+        if(StringUtils.isNotBlank(model.getTitle())){
+            if(ywAccountMapper.selectCount(new QueryWrapper<YwAccount>().lambda()
+                    .eq(YwAccount::getTitle,model.getTitle())
+                    .ne(YwAccount::getId,model.getId())
+                    .eq(YwAccount::getIsdeleted,Constants.ZERO)) >0){
+                throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝鏀舵敮鏉$洰涓嶈兘閲嶅~");
+            }
+        }
+
         model.setEditDate(model.getCreateDate());
         model.setEditor(model.getCreator());
         ywAccountMapper.updateById(model);
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractRevenueServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractRevenueServiceImpl.java
index e2e4461..20da8dc 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractRevenueServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractRevenueServiceImpl.java
@@ -268,6 +268,7 @@
                 new MPJLambdaWrapper<YwContractRevenue>().selectAll(YwContractRevenue.class)
                         .selectAs(YwContractBill::getCode,YwContractRevenue::getBillCode)
                         .selectAs(YwContract::getCode,YwContractRevenue::getContractCode)
+                        .selectAs(YwContract::getStatus,YwContractRevenue::getContractStatus)
                         .selectAs(YwCustomer::getName,YwContractRevenue::getCustomerName)
                         .selectAs(SystemUser::getRealname,YwContractRevenue::getRealname)
                         .selectAs(YwAccount::getTitle,YwContractRevenue::getAccountTitle)
@@ -427,6 +428,7 @@
                         .selectAs(YwContractBill::getCode,YwContractRevenue::getBillCode)
                         .selectAs(YwContractBill::getType,YwContractRevenue::getBillType)
                          .selectAs(YwContract::getCode,YwContractRevenue::getContractCode)
+                        .selectAs(YwContract::getStatus,YwContractRevenue::getContractStatus)
                         .selectAs(YwCustomer::getName,YwContractRevenue::getCustomerName)
                         .selectAs(SystemUser::getRealname,YwContractRevenue::getRealname)
                         .leftJoin(YwContractBill.class,YwContractBill::getId,YwContractRevenue::getBillId)
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java
index f9be5d2..f72126a 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java
@@ -31,6 +31,7 @@
 import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -74,12 +75,20 @@
     @Transactional(rollbackFor = {BusinessException.class,Exception.class})
     public Integer create(YwContract model) {
         isParamValidCreated(model);
+
+
         model.setCreator(model.getLoginUserInfo().getId());
         model.setIsdeleted(Constants.ZERO);
         model.setCreateDate(new Date());
-        model.setStatus(Constants.ZERO);
         model.setEditDate(model.getCreateDate());
         model.setEditor(model.getCreator());
+        if(model.getStartDate().getTime() > System.currentTimeMillis()){
+            model.setStatus(Constants.ZERO);
+        }else if(model.getStartDate().getTime() <= System.currentTimeMillis() && model.getEndDate().getTime() > System.currentTimeMillis()){
+            model.setStatus(Constants.ONE);
+        }else{
+            model.setStatus(Constants.TWO);
+        }
         model.setStatus(Constants.ZERO);//寰呮墽琛�
         model.setRemark(getRemarlByParam(model));
         ywContractMapper.insert(model);
@@ -268,7 +277,7 @@
         }
         model.setTotalArea(new BigDecimal(0));
         for(YwRoom r : rooms){
-            model.setTotalArea(model.getTotalArea().add(Constants.formatBigdecimal(r.getArea())));
+            model.setTotalArea(model.getTotalArea().add(Constants.formatBigdecimal(r.getRentArea())));
         }
         model.setRoomList(rooms);
     }
@@ -303,11 +312,12 @@
         BigDecimal fee = Constants.formatBigdecimal(model.getBtFee());
         String str = "閫�绉熸憳瑕侊細鍓╀綑鏈粨娓呰处鍗晎param1}浠斤紝鍏抽棴璐﹀崟{param2}浠姐�愰��绉熸棩{param3}锛岄��绉熻垂鐢ㄥ悎璁¢渶{param4}{param5}鍏冦�傘��";
         str = str.replace("{param1}",model.getBtWaitBill()+"")
-                .replace("{param2}",DateUtil.getDateLongSlash(model.getBtDate()))
-                .replace("{param3}",fee.compareTo(new BigDecimal(0)) >=0?"鏀�":"浠�")
-                .replace("{param4}",(fee.compareTo(new BigDecimal(0)) >=0?
-                        Constants.formatBigdecimal(model.getBtFee()).intValue()
-                        :(Constants.formatBigdecimal(model.getBtFee()).intValue() * -1))+"" );
+                .replace("{param2}",model.getBtCLoseBill()+"")
+                .replace("{param3}",DateUtil.getDateLongSlash(model.getBtDate()))
+                .replace("{param4}",fee.compareTo(new BigDecimal(0)) >=0?"鏀�":"浠�")
+                .replace("{param5}",(fee.compareTo(new BigDecimal(0)) >=0?
+                        Constants.formatBigdecimal2Float(model.getBtFee()).intValue()
+                        :(Constants.formatBigdecimal2Float(model.getBtFee()).intValue() * -1))+"" );
         return  str;
     }
     private String getbackRentLogByParam(YwContract model) {
@@ -352,9 +362,6 @@
         update.setBtFee(param.getBtFee());
         update.setBtRemark(getbackRentRemarkByParam(param));
         ywContractMapper.updateById(update);
-//        if(1==1){
-//            throw new BusinessException(ResponseStatus.NOT_ALLOWED);
-//        }
         dealLogBiz(param,Constants.YwLogType.CONTRACT_BACK, param.getLoginUserInfo().getRealname(),getbackRentLogByParam(param));
         return param.getId();
     }
@@ -409,23 +416,15 @@
                 }
                 if(Constants.equalsInteger(bill.getPayStatus(),Constants.ZERO)
                         ||Constants.equalsInteger(bill.getPayStatus(),Constants.THREE)){
-                    if(bill.getStartDate().getTime()<param.getBtDate().getTime()){
+                    if(bill.getStartDate().getTime()<=param.getBtDate().getTime()){
                         canBills.add(bill);
                     }else{
                         //濡傛灉杩樻病寮�濮嬶紝璐﹀崟鐩存帴鍏抽棴
                         closeBills.add(bill);
                         noBills.add(bill);
                     }
-//                    if(bill.getStartDate().getTime()>param.getEditDate().getTime()){
-//                        //濡傛灉杩樻病寮�濮嬶紝璐﹀崟鐩存帴鍏抽棴
-//                        closeBills.add(bill);
-//                        noBills.add(bill);
-//                    }else{
-//                        canBills.add(bill);
-//                    }
                 }else  if(Constants.equalsInteger(bill.getPayStatus(),Constants.ONE) ){
                     if(bill.getStartDate().getTime()>param.getBtDate().getTime()){
-//                    if(bill.getEndDate().getTime()<param.getEditDate().getTime()){
                         //濡傛灉宸茬粨娓咃紝璐﹀崟鐩存帴鍏抽棴
                         noBills.add(bill);
                     }else{
@@ -449,14 +448,14 @@
 
         BigDecimal totalBackFee = new BigDecimal(0);
         if(canBills.size()>0){
-            //鐩存帴鍏抽棴鍏抽棴璐﹀崟
+            //
             for(YwContractBill b : canBills){
                 BigDecimal fee = new BigDecimal(0);
                 YwContractBill editBill = getEditBillFromListByParam(b,param.getCanBackRentBills());
                 if(editBill != null){
                     //浠樻鐘舵�侊細0=寰呮敹娆撅紱1=宸茬粨娓咃紱2=閮ㄥ垎缁撴竻锛�3=寰呬粯娆撅紱4=寰呴��娆撅紱5=宸插叧闂�
                     //濡傛灉璐﹀崟淇℃伅鍋氫簡缂栬緫锛岄噾棰濊绠� 瀹炴敹閲戦 鍜� 淇敼鍚庡簲鏀堕噾棰濅綔瀵规瘮锛屽垽鏂槸鍚﹀簲璇ラ��娆�
-                    fee = Constants.formatBigdecimal(b.getActReceivableFee()).subtract(editBill.getReceivableFee());
+                    fee = editBill.getReceivableFee().subtract(Constants.formatBigdecimal(b.getActReceivableFee()));
                     if(fee.compareTo(new BigDecimal(0))== 0){
                         //濡傛灉璐圭敤姝eソ锛屽垯淇敼璐﹀崟淇℃伅涓哄凡缁撴竻
                         b.setPayStatus(Constants.ONE);
@@ -488,19 +487,20 @@
                 addBill.setContractId(param.getId());
                 addBill.setType(Constants.ONE);
                 addBill.setStatus(Constants.ZERO);
+                addBill.setTotleFee(addBill.getReceivableFee());
                 if(Constants.equalsInteger(addBill.getFeeType(),Constants.ONE)){
                     addBill.setStartDate(addBill.getPlanPayDate());
                     addBill.setEndDate(addBill.getPlanPayDate());
                 }
                 if(Constants.equalsInteger(addBill.getBillType(),Constants.ZERO)){
                     //濡傛灉鏄敹娆�
-                    totalBackFee = totalBackFee.add(Constants.formatBigdecimal(addBill.getActReceivableFee()));
+//                    totalBackFee = totalBackFee.add(Constants.formatBigdecimal(addBill.getActReceivableFee()));
                     addBill.setPayStatus(Constants.ZERO);
-                    addBill.setBtFee(Constants.formatBigdecimal(addBill.getActReceivableFee()));
+                    addBill.setBtFee(Constants.formatBigdecimal(addBill.getReceivableFee()));
                 }else{
                     //濡傛灉鏄粯娆�
                     addBill.setPayStatus(Constants.THREE);
-                    addBill.setBtFee(Constants.formatBigdecimal(addBill.getActReceivableFee()).multiply(new BigDecimal(-1)));
+                    addBill.setBtFee(Constants.formatBigdecimal(addBill.getReceivableFee()).multiply(new BigDecimal(-1)));
                 }
                 totalBackFee = totalBackFee.add(Constants.formatBigdecimal(addBill.getBtFee()));
                 addBill.setEditDate(param.getEditDate());
@@ -529,12 +529,20 @@
                         yjBill.setEditDate(param.getEditDate());
                         yjBill.setEditor(param.getEditor());
                         yjBill.setReceivableFee(BigDecimal.ZERO);
-                        yjBill.setPayStatus(Constants.FOUR);
-                        yjBill.setPlanPayDate(canBill.getPlanPayDate());
+                        if(Constants.formatBigdecimal(canBill.getActReceivableFee()).compareTo(new BigDecimal(0)) == 0){
+                            //鏈敮浠樼殑鎶奸噾锛岀洿鎺ュ叧闂�
+                            yjBill.setStatus(Constants.ONE);
+                            closeBills.add(yjBill);
+                        }else{
+                            yjBill.setBtFee(Constants.formatBigdecimal(canBill.getActReceivableFee()).multiply(new BigDecimal(-1)));
+                            yjBill.setPayStatus(Constants.FOUR);
+                            yjBill.setPlanPayDate(canBill.getPlanPayDate());
+                            totalBackFee = totalBackFee.add(Constants.formatBigdecimal(yjBill.getBtFee()));
+                            yjNoBills ++;
+                        }
                         ywContractBillMapper.updateById(yjBill);
                     }
                 }
-                yjNoBills ++;
             }
         }
         param.setBtWaitBill(canBills.size() + newBills.size()+yjNoBills);//鏈竻绠楃殑璐﹀崟鏁伴噺
@@ -689,12 +697,16 @@
         }
         int num =1;
         for(int i=0;i<billList1.size();i++){
-            billList1.get(i).setSortnum(num);
-            num++;
+            if(Constants.equalsInteger(billList1.get(i).getCostType(),Constants.ZERO)){
+                billList1.get(i).setSortnum(num);
+                num++;
+            }
         }
         for(int i=0;i<billList2.size();i++){
-            billList2.get(i).setSortnum(num);
-            num++;
+            if(Constants.equalsInteger(billList1.get(i).getCostType(),Constants.ONE)) {
+                billList2.get(i).setSortnum(num);
+                num++;
+            }
         }
         if(model.getId()!=null){
             ywContractBillMapper.insert(billList1);
@@ -840,34 +852,37 @@
         BigDecimal totalFee = new BigDecimal(0);
         DateCompare dateCompare =   DateCompare.dayCompare(bill.getStartDate(),bill.getEndDate(),freeStart, freeEnd);
         if(Constants.equalsInteger(d.getCircleType(),Constants.ZERO)){
-            //0=鍏冩瘡骞崇背澶�
+            //0=鍏冩瘡骞崇背澶� 璐﹀崟閲戦=璐﹀崟鍛ㄦ湡鐨勫ぉ鏁�*绉熻祦闈㈢Н*鍗曚环锛�
             int days = dateCompare.getDay() ;
             BigDecimal areas = getAreasNumBYRooms(model.getRoomList());
             totalFee = new BigDecimal(days).multiply(areas).multiply(Constants.formatBigdecimal(d.getPrice()));//鎬讳环鏍�
         }else  if(Constants.equalsInteger(d.getCircleType(),Constants.ONE)){
-            //1=鍏冩瘡骞崇背鏈�
+            //1=鍏冩瘡骞崇背鏈� 璐﹀崟閲戦=璐﹀崟鍛ㄦ湡鐨勬湀鏁帮紙寮�濮嬫棩鏈熻绠楄嚜鐒舵湀锛�*绉熻祦闈㈢Н*鍗曚环+涓嶆弧涓�涓湀鐨勫ぉ鏁�*绉熻祦闈㈢Н*鍗曚环*12/365锛�
             BigDecimal areas = getAreasNumBYRooms(model.getRoomList());
             BigDecimal month =dateCompare.getMonthFloat();
             totalFee = month.multiply(areas).multiply(Constants.formatBigdecimal(d.getPrice()));//鎬讳环鏍�
         }else  if(Constants.equalsInteger(d.getCircleType(),Constants.TWO)){
-            //2=鍏冩瘡骞崇背骞�
+            //2=鍏冩瘡骞崇背骞� 璐﹀崟閲戦=璐﹀崟鍛ㄦ湡鐨勬湀鏁帮紙寮�濮嬫棩鏈熻绠楄嚜鐒舵湀锛�*鍗曚环*闈㈢Н/12+涓嶆弧涓�涓湀鐨勫ぉ鏁�*绉熻祦闈㈢Н*鍗曚环/365锛�
             BigDecimal areas = getAreasNumBYRooms(model.getRoomList());
-            BigDecimal year =  dateCompare.getYearFloat();
-            totalFee = year.multiply(areas).multiply(Constants.formatBigdecimal(d.getPrice()));//鎬讳环鏍�
+            BigDecimal month = new BigDecimal(dateCompare.getMonth());
+            totalFee = ((month.multiply(Constants.formatBigdecimal(d.getPrice())).divide(new BigDecimal(12),2, RoundingMode.HALF_UP))
+                    .add(new BigDecimal(dateCompare.getMonthDays()).multiply(Constants.formatBigdecimal(d.getPrice())).divide(new BigDecimal(365),2, RoundingMode.HALF_UP)))
+                    .multiply(areas);//鎬讳环鏍�
         }else  if(Constants.equalsInteger(d.getCircleType(),Constants.THREE)){
-            //3=鍏冩瘡澶�
+            //3=鍏冩瘡澶� 璐﹀崟閲戦=璐﹀崟鍛ㄦ湡鐨勫ぉ鏁�*鍗曚环锛�
             int days = dateCompare.getDay() ;
             totalFee = new BigDecimal(days).multiply(Constants.formatBigdecimal(d.getPrice()));//鎬讳环鏍�
         }else  if(Constants.equalsInteger(d.getCircleType(),Constants.FOUR)){
-            //4=鍏冩瘡鏈�
+            //4=鍏冩瘡鏈� 璐﹀崟閲戦=璐﹀崟鍛ㄦ湡鐨勬湀鏁帮紙寮�濮嬫棩鏈熻绠楄嚜鐒舵湀锛�*鍗曚环+涓嶆弧涓�涓湀鐨勫ぉ鏁�*鍗曚环*12/365
             BigDecimal month = dateCompare.getMonthFloat();
             totalFee = month.multiply(Constants.formatBigdecimal(d.getPrice()));//鎬讳环鏍�
         }else  if(Constants.equalsInteger(d.getCircleType(),Constants.FIVE)){
-            //5=鍏冩瘡骞�
-            BigDecimal year =  dateCompare.getYearFloat();
-            totalFee = year.multiply(Constants.formatBigdecimal(d.getPrice()));//鎬讳环鏍�
+            //5=鍏冩瘡骞� 璐﹀崟閲戦=璐﹀崟鍛ㄦ湡鐨勬湀鏁帮紙寮�濮嬫棩鏈熻绠楄嚜鐒舵湀锛�*鍗曚环*闈㈢Н/12+涓嶆弧涓�涓湀鐨勫ぉ鏁�*绉熻祦闈㈢Н*鍗曚环/365锛�
+            BigDecimal month = new BigDecimal(dateCompare.getMonth());
+            totalFee =( month.multiply(Constants.formatBigdecimal(d.getPrice())).divide(new BigDecimal(12),2, RoundingMode.HALF_UP))
+                    .add(new BigDecimal(dateCompare.getMonthDays()).multiply(Constants.formatBigdecimal(d.getPrice())).divide(new BigDecimal(365),2, RoundingMode.HALF_UP));//鎬讳环鏍�
         }else  if(Constants.equalsInteger(d.getCircleType(),Constants.SIX)){
-            //6=鍏冩瘡鍦�
+            //6=鍏冩瘡鍦� 璐﹀崟閲戦=鍗曚环锛涘彧鏈夐�夋嫨涓�娆℃�т粯娆炬椂锛屾墠鑳介�夋嫨璇ュ崟浠风淮搴︼紱
             totalFee =Constants.formatBigdecimal(d.getPrice());
         }
         if(Constants.equalsInteger(model.getRoundedUp(),Constants.ONE)){
@@ -938,7 +953,7 @@
         BigDecimal data= new BigDecimal(0);
         if(roomList!=null){
             for(YwRoom r :roomList){
-                data = data.add(Constants.formatBigdecimal(r.getArea()));
+                data = data.add(Constants.formatBigdecimal(r.getRentArea()));
             }
         }
 
@@ -1132,7 +1147,7 @@
         }
         model.setTotalArea(new BigDecimal(0));
         for(YwRoom r : rooms){
-            model.setTotalArea(model.getTotalArea().add(Constants.formatBigdecimal(r.getArea())));
+            model.setTotalArea(model.getTotalArea().add(Constants.formatBigdecimal(r.getRentArea())));
         }
         model.setRoomList(rooms);
         YwCustomer customer = customerMapper.selectById(model.getRenterId());
@@ -1209,79 +1224,89 @@
     }
     @Override
     public YwContract findById(Integer id) {
+
+        YwContract model =queryDetailInfoById(id);
+        //鏌ヨ鎿嶄綔鏃ュ織璁板綍
+        YwWorkorderLog log = new YwWorkorderLog();
+        log.setJobId(model.getId());
+        log.setIsdeleted(Constants.ZERO);
+        model.setLogList(ywWorkorderLogMapper.selectList(new QueryWrapper<YwWorkorderLog>(log)
+                .lambda()
+                .in(YwWorkorderLog::getObjType,Constants.YwLogType.CONTRACT_BACK.getKey()
+                        ,Constants.YwLogType.CONTRACT_CREATE.getKey()
+                        ,Constants.YwLogType.CONTRACT_UPDATE.getKey())
+                .orderByAsc(YwWorkorderLog::getCreateDate)));
+
+        //鏌ヨ璐﹀崟闆嗗悎
+        queryBillListByModel(model,new Date());
+        return model;
+    }
+    private YwContract queryDetailInfoById(Integer id) {
         MPJLambdaWrapper<YwContract> queryWrapper = new MPJLambdaWrapper<>();
-        queryWrapper.selectAll(YwContract.class )
-                .selectAs(Company::getName,YwContract::getCompanyName )
-                .selectAs(SystemUser::getRealname,YwContract::getUserName )
-                .selectAs(YwCustomer::getName,YwContract::getRenterName )
-                .selectAs(YwProject::getName,YwContract::getProjectName )
-                .select("t3.realname",YwContract::getCreatorName )
-                .select("(select sum(r.area) from yw_contract_room cr left join yw_room r on r.id = cr.room_id where r.isdeleted=0 and cr.contract_id =t.id)",YwContract::getTotalArea )
-                .leftJoin(Company.class,Company::getId,YwContract::getCompanyId)
-                .leftJoin(SystemUser.class,SystemUser::getId,YwContract::getUserId)
-                .leftJoin(SystemUser.class,SystemUser::getId,YwContract::getCreator)
-                .leftJoin(YwProject.class,YwProject::getId,YwContract::getProjectId)
-                .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId)
-                .eq( YwContract::getId,id);
-        YwContract model = ywContractMapper.selectJoinOne(YwContract.class,queryWrapper);
-        if(model != null){
+        queryWrapper.selectAll(YwContract.class)
+                .selectAs(Company::getName, YwContract::getCompanyName)
+                .selectAs(SystemUser::getRealname, YwContract::getUserName)
+                .selectAs(YwCustomer::getName, YwContract::getRenterName)
+                .selectAs(YwProject::getName, YwContract::getProjectName)
+                .select("t3.realname", YwContract::getCreatorName)
+                .select("(select sum(r.area) from yw_contract_room cr left join yw_room r on r.id = cr.room_id where r.isdeleted=0 and cr.contract_id =t.id)", YwContract::getTotalArea)
+                .leftJoin(Company.class, Company::getId, YwContract::getCompanyId)
+                .leftJoin(SystemUser.class, SystemUser::getId, YwContract::getUserId)
+                .leftJoin(SystemUser.class, SystemUser::getId, YwContract::getCreator)
+                .leftJoin(YwProject.class, YwProject::getId, YwContract::getProjectId)
+                .leftJoin(YwCustomer.class, YwCustomer::getId, YwContract::getRenterId)
+                .eq(YwContract::getId, id);
+        YwContract model = ywContractMapper.selectJoinOne(YwContract.class, queryWrapper);
+        if (model == null) {
+                throw  new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
             //鍚堝悓闄勪欢
             initFiles(model);
             //鏌ヨ鎴挎簮淇℃伅鏁版嵁
             MPJLambdaWrapper<YwRoom> rw = new MPJLambdaWrapper<>();
-            rw.selectAll(YwRoom.class )
-                    .selectAs(YwProject::getName,YwRoom::getProjectName)
-                    .selectAs(YwFloor::getName,YwRoom::getFloorName)
-                    .selectAs(YwBuilding::getName,YwRoom::getBuildingName)
-                    .leftJoin(YwProject.class,YwProject::getId,YwRoom::getProjectId)
-                    .leftJoin(YwBuilding.class,YwBuilding::getId,YwRoom::getBuildingId)
-                    .leftJoin(YwFloor.class,YwFloor::getId,YwRoom::getFloor)
-                    .eq(YwRoom::getIsdeleted,Constants.ZERO)
-                    .exists("(select a.id from yw_contract_room a where a.isdeleted=0 and a.type=0 and a.room_id=t.id and a.contract_id="+model.getId()+")");
-            model.setRoomList(roomMapper.selectJoinList(YwRoom.class,rw));
+            rw.selectAll(YwRoom.class)
+                    .selectAs(YwProject::getName, YwRoom::getProjectName)
+                    .selectAs(YwFloor::getName, YwRoom::getFloorName)
+                    .selectAs(YwBuilding::getName, YwRoom::getBuildingName)
+                    .leftJoin(YwProject.class, YwProject::getId, YwRoom::getProjectId)
+                    .leftJoin(YwBuilding.class, YwBuilding::getId, YwRoom::getBuildingId)
+                    .leftJoin(YwFloor.class, YwFloor::getId, YwRoom::getFloor)
+                    .eq(YwRoom::getIsdeleted, Constants.ZERO)
+                    .exists("(select a.id from yw_contract_room a where a.isdeleted=0 and a.type=0 and a.room_id=t.id and a.contract_id=" + model.getId() + ")");
+            model.setRoomList(roomMapper.selectJoinList(YwRoom.class, rw));
             model.setWyFirstCircleStr(Constants.getUnitTypeByNum(model.getWyFirstCircle()));
             model.setZlFirstCircleStr(Constants.getUnitTypeByNum(model.getZlFirstCircle()));
             //鏌ヨ绉熻硟鏉℃淇℃伅
             MPJLambdaWrapper<YwContractDetail> dw = new MPJLambdaWrapper<>();
-            dw.selectAll(YwContractDetail.class )
-                    .eq(YwContractDetail::getIsdeleted,Constants.ZERO)
-                    .eq(YwContractDetail::getContractId,model.getId())
-                    .in(YwContractDetail::getType,Constants.ZERO,Constants.TWO)
+            dw.selectAll(YwContractDetail.class)
+                    .eq(YwContractDetail::getIsdeleted, Constants.ZERO)
+                    .eq(YwContractDetail::getContractId, model.getId())
+                    .in(YwContractDetail::getType, Constants.ZERO, Constants.TWO)
                     .orderByAsc(YwContractDetail::getSortnum);
-            model.setZlDetailList(ywContractDetailMapper.selectJoinList(YwContractDetail.class,dw));
+            model.setZlDetailList(ywContractDetailMapper.selectJoinList(YwContractDetail.class, dw));
             //鏌ヨ鐗╂キ鏉℃淇℃伅
             dw = new MPJLambdaWrapper<>();
-            dw.selectAll(YwContractDetail.class )
-                    .eq(YwContractDetail::getIsdeleted,Constants.ZERO)
-                    .eq(YwContractDetail::getContractId,model.getId())
-                    .in(YwContractDetail::getType,Constants.ONE,Constants.THREE)
+            dw.selectAll(YwContractDetail.class)
+                    .eq(YwContractDetail::getIsdeleted, Constants.ZERO)
+                    .eq(YwContractDetail::getContractId, model.getId())
+                    .in(YwContractDetail::getType, Constants.ONE, Constants.THREE)
                     .orderByAsc(YwContractDetail::getSortnum);
-            model.setWyDetailList(ywContractDetailMapper.selectJoinList(YwContractDetail.class,dw));
+            model.setWyDetailList(ywContractDetailMapper.selectJoinList(YwContractDetail.class, dw));
 
-            //鏌ヨ鎿嶄綔鏃ュ織璁板綍
-            YwWorkorderLog log = new YwWorkorderLog();
-            log.setJobId(model.getId());
-            log.setIsdeleted(Constants.ZERO);
-            model.setLogList(ywWorkorderLogMapper.selectList(new QueryWrapper<YwWorkorderLog>(log)
-                    .lambda()
-                    .in(YwWorkorderLog::getObjType,Constants.YwLogType.CONTRACT_BACK.getKey()
-                            ,Constants.YwLogType.CONTRACT_CREATE.getKey()
-                            ,Constants.YwLogType.CONTRACT_UPDATE.getKey())
-                    .orderByAsc(YwWorkorderLog::getCreateDate)));
-
-            //鏌ヨ璐﹀崟闆嗗悎
-
-            queryBillListByModel(model,new Date());
-        }
         return model;
     }
-    @Override
-    public YwContract findForBills(YwContract model) {
-        queryBillListByModel(model,model.getBtDate());
+
+   @Override
+    public YwContract findForBills(YwContract param) {
+        YwContract model = queryDetailInfoById(param.getId());
+        queryBillListByModel(model,param.getBtDate());
         return model;
 
     }
     private void queryBillListByModel(YwContract model,Date date) {
+        if(date ==null){
+            date = new Date();
+        }
         //鏌ヨ璐﹀崟闆嗗悎
         model.setBillList(ywContractBillMapper.selectJoinList(YwContractBill.class,new MPJLambdaWrapper<YwContractBill>()
                 .selectAll(YwContractBill.class )
@@ -1290,13 +1315,13 @@
                 .eq(  YwContractBill::getContractId,model.getId())
                 .eq(YwContractBill::getIsdeleted,Constants.ZERO)
                 .orderByAsc(YwContractBill::getSortnum,YwContractBill::getCreateDate)));
-
         for (YwContractBill ywContractBill:model.getBillList()) {
-            ywContractBill.setNeedReceivableFee(ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee()));
+            ywContractBill.setNeedReceivableFee(ywContractBill.getReceivableFee());
+//            ywContractBill.setNeedReceivableFee(ywContractBill.getReceivableFee().subtract(ywContractBill.getActReceivableFee()));
         }
         model.setCanBackRentBills(new ArrayList<>());
         long nowStart = Utils.Date.getStart(date).getTime();
-        long nowEnd = Utils.Date.getEnd(date).getTime();
+        long nowEnd = Utils.Date.getDayEnd(date).getTime();
         if(model.getBillList()!=null && model.getBillList().size()>0){
             for(YwContractBill bill: model.getBillList()){
                 //浠樻鐘舵�侊細0=寰呮敹娆撅紱1=宸茬粨娓咃紱2=閮ㄥ垎缁撴竻锛�3=寰呬粯娆撅紱4=寰呴��娆撅紱5=宸插叧闂�
@@ -1307,7 +1332,6 @@
                         continue;
                     }
                     model.getCanBackRentBills().add(bill);
-
                 }else  if(Constants.equalsInteger(bill.getPayStatus(),Constants.ONE) ){
                     if(bill.getEndDate().getTime()<nowStart){
                         //濡傛灉宸茬粨娓咃紝璐﹀崟鐩存帴鍏抽棴
@@ -1318,7 +1342,42 @@
                     model.getCanBackRentBills().add(bill);
                 }
             }
+            for(YwContractBill bill : model.getCanBackRentBills()){
+                YwContractDetail detail = null;
+                if(Constants.equalsInteger(bill.getCostType(),Constants.ZERO)){
+                    detail = getDetailByIdFromList(bill.getDetailId(),model.getZlDetailList());
+                    if(detail!=null&& bill.getStartDate()!=null && bill.getEndDate()!=null
+                            &&(date.getTime() <= bill.getStartDate().getTime() || (date.getTime() >= bill.getStartDate().getTime() && date.getTime()<= bill.getEndDate().getTime()))){
+                        Date odate = bill.getEndDate();
+                        bill.setEndDate(date);
+                        BigDecimal actFee = getTotalFeeByStartEnd(model,detail,bill,model.getZlFreeStartDate(),model.getZlFreeEndDate());
+                        bill.setEndDate(odate);
+                        bill.setNeedReceivableFee(actFee);
+                    }
+                }else if(Constants.equalsInteger(bill.getCostType(),Constants.ONE)){
+                    detail = getDetailByIdFromList(bill.getDetailId(),model.getWyDetailList());
+                    if(detail!=null&& bill.getStartDate()!=null && bill.getEndDate()!=null
+                            &&(date.getTime() <= bill.getStartDate().getTime() || (date.getTime() >= bill.getStartDate().getTime() && date.getTime()<= bill.getEndDate().getTime()))){
+                        Date odate = bill.getEndDate();
+                        bill.setEndDate(date);
+                        BigDecimal actFee = getTotalFeeByStartEnd(model,detail,bill,model.getWyFreeStartDate(),model.getWyFreeEndDate());
+                        bill.setEndDate(odate);
+                        bill.setNeedReceivableFee(actFee);
+                    }
+                }
+            }
         }
+    }
+
+    private YwContractDetail getDetailByIdFromList(Integer detailId, List<YwContractDetail> list) {
+        if(list!=null){
+            for(YwContractDetail d : list){
+                if(Constants.equalsInteger(detailId,d.getId())){
+                    return d;
+                }
+            }
+        }
+        return  null;
     }
 
     @Override
@@ -1445,6 +1504,11 @@
             queryWrapper.ge(YwContract::getWyFreeEndDate, Utils.Date.getStart(pageWrap.getModel().getWyFreeEndDate()));
             queryWrapper.le(YwContract::getWyFreeEndDate, Utils.Date.getEnd(pageWrap.getModel().getWyFreeEndDate()));
         }
+
+
+
+
+
         if (pageWrap.getModel().getZlTotalFee() != null) {
             queryWrapper.eq(YwContract::getZlTotalFee, pageWrap.getModel().getZlTotalFee());
         }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwPatrolSchemeServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwPatrolSchemeServiceImpl.java
index 3ac66ba..171745d 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwPatrolSchemeServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwPatrolSchemeServiceImpl.java
@@ -287,7 +287,7 @@
                 .like(StringUtils.isNotBlank(model.getTitle()),YwPatrolScheme::getTitle,model.getTitle())
                 //鏌ヨ鏈夋椂娈典氦闆嗙殑鏁版嵁
                 .apply(Objects.nonNull(model.getStartDate())&&Objects.nonNull(model.getEndDate()),
-                        " t.START_DATE <= '"+Utils.Date.getStart(pageWrap.getModel().getEndDate())+"' and t.END_DATE >= '"+Utils.Date.getStart(pageWrap.getModel().getStartDate())+"' "
+                        " t.START_DATE <= '"+pageWrap.getModel().getEndDate()+"' and t.END_DATE >= '"+pageWrap.getModel().getStartDate()+"' "
                 )
 //                .ge(Objects.nonNull(model.getStartDate()),YwDeviceRecord::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getStartDate()))
 //                .le(Objects.nonNull(model.getEndDate()),YwDeviceRecord::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getEndDate()))
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwWorkorderServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwWorkorderServiceImpl.java
index 81d8e1e..0505cb3 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwWorkorderServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwWorkorderServiceImpl.java
@@ -404,7 +404,6 @@
                     .like(YwRoom::getRoomNum,pageWrap.getModel().getRoomName())
             );
         }
-
         if (pageWrap.getModel().getCreator() != null) {
             queryWrapper.eq(YwWorkorder::getCreator, pageWrap.getModel().getCreator());
         }

--
Gitblit v1.9.3