lsw 1 yıl önce
ebeveyn
işleme
bf40a74a9c

+ 43 - 14
app/common/common.scss

@@ -433,7 +433,7 @@
 		font-size: 16px;
 	}
 }
-.ql-editor.ql-blank:before{
+.ql-editor.ql-blank:before {
 	font-style: normal !important;
 }
 /**底部按钮操作******/
@@ -451,6 +451,25 @@
 	}
 }
 .position {
+	padding: 15px;
+	.audits {
+		margin-top: -10px;
+		margin-bottom: 15px;
+		.audit {
+			float: left;
+			padding: 5px 15px;
+			border-radius: 30px;
+			background-color: white;
+			margin-right: 12px;
+			font-size: 14px;
+			color: $font-c;
+			&.active {
+				color: white;
+				background-color: $main-color;
+			}
+		}
+		overflow: hidden;
+	}
 	.item {
 		border-radius: 7px;
 		background-color: white;
@@ -463,10 +482,14 @@
 			.title {
 				font-size: 17px;
 				float: left;
-				width: 78%;
+				width: 71%;
 			}
-			.salary {
+			.audit {
 				float: right;
+				font-size: 14px;
+				.icon {
+					padding-right: 3px;
+				}
 			}
 		}
 		.desc {
@@ -481,18 +504,24 @@
 				border-radius: 3px;
 				margin-right: 7px;
 			}
-			image {
-				width: 20px;
-				height: 20px;
-				border-radius: 50%;
-				margin-right: 5px;
-				float: left;
-				background-color: #a1a1a1;
+			.state {
+				font-size: 13px;
+				padding-right: 5px;
 			}
 		}
-		.op {
-			float: right;
-			font-size: 15px;
+		.date {
+			font-size: 13px;
+		}
+		.flex {
+			border-top: 1px solid $line;
+			padding-top: 10px;
+			font-size: 14px;
 		}
 	}
-}
+}
+.br {
+	border-right: 1px solid $line;
+}
+.danger {
+	color: #f44336;
+}

+ 86 - 30
app/pages/job/position/manage/list.vue

@@ -1,29 +1,42 @@
 <template>
 	<view>
 		<view class="tab">
-			<u-tabs :list="tab" :current="current" @click="click"></u-tabs>
+			<u-tabs :list="type" @click="click($event, 'type')"></u-tabs>
 		</view>
-		<view class="main">
-			<view class="position">
-				<view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
-					<view class="top">
-						<view class="title omit">{{ item.title }}</view>
-						<view class="op">
-							<text class="icon">&#xe622;</text>
-							<text>审核中</text>
-						</view>
+		<view class="position">
+			<view class="audits">
+				<view class="audit" :class="{ active: current == index }" v-for="(item, index) in audit" :key="index" @click="click({ index: index }, 'audit')">{{ item.name }}</view>
+			</view>
+			<view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
+				<view class="top">
+					<view class="title omit">{{ item.title }}</view>
+					<view class="audit" v-if="item.audit == 0">
+						<text class="icon">&#xe642;</text>
+						<text>审核中</text>
+					</view>
+					<view class="audit" style="color: #4caf50" v-if="item.audit == 1">
+						<text class="icon">&#xe612;</text>
+						<text>审核通过</text>
 					</view>
-					<view class="desc">
-						<text class="tag">{{ item.experience == '不限' ? '经验不限' : item.experience }}</text>
-						<text class="tag">{{ item.salary }}</text>
+					<view class="audit" v-if="item.audit == 2">
+						<text class="icon">&#xec72;</text>
+						<text>审核不通过</text>
 					</view>
-					<view class="date">{{ item.createTime }}</view>
 				</view>
-				<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
-				<u-empty v-if="!loadMore && list.length == 0"></u-empty>
+				<view class="desc">
+					<text class="state" :style="{ color: item.state == 0 ? '#4CAF50' : '#F44336' }">{{ item.state == 0 ? '已启用' : '已关闭' }}</text>
+					<text class="tag">发布于:{{ item.createTime }}</text>
+				</view>
+				<view class="flex">
+					<view class="f br">简历</view>
+					<view class="f br" @click.stop="manageState(item)">{{ item.state == 0 ? '关闭' : '启用' }}</view>
+					<view class="f danger" @click.stop="manageRemove(item)">删除</view>
+				</view>
 			</view>
+			<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
+			<u-empty v-if="!loadMore && list.length == 0"></u-empty>
 		</view>
-		<u-action-sheet round="20" :actions="actions" @select="selectClick" cancelText="取消" :show="show" @close="show = false"></u-action-sheet>
+		<u-action-sheet round="20" :actions="type" @select="selectClick" cancelText="取消" :show="show" @close="show = false"></u-action-sheet>
 		<view class="mfooter">
 			<button class="btn" @click="show = true">
 				<text class="icon">&#xe7c4;</text>
@@ -37,17 +50,21 @@
 export default {
 	data() {
 		return {
-			user: this.getUser(),
-			tab: [{ name: '全职' }, { name: '兼职' }],
+			type: [
+				{ name: '全职', value: 0 },
+				{ name: '兼职', value: 1 }
+			],
+			audit: [
+				{ name: '全部', value: '' },
+				{ name: '待审核', value: 0 },
+				{ name: '审核通过', value: 1 },
+				{ name: '未通过', value: 2 }
+			],
+			current: 0,
 			list: [],
-			param: { pageNum: 1, pageSize: 10, types: '全职', orderByColumn: 'createTime', isAsc: 'desc' },
+			param: { pageNum: 1, pageSize: 10, type: 0 },
 			loadMore: true,
-			show: false,
-			current: 0,
-			actions: [
-				{ name: '全职', type: 0 },
-				{ name: '兼职', type: 1 }
-			]
+			show: false
 		};
 	},
 	onLoad(e) {
@@ -68,15 +85,54 @@ export default {
 				}
 			});
 		},
-		select(item) {
-			this.param.types = item;
+		click(e, tag) {
+			this.param[tag] = this[tag][e.index].value;
+			if (tag == 'audit') {
+				this.current = e.index;
+			}
 			this.refresh();
 		},
+		selectClick(e) {
+			uni.navigateTo({ url: '/pages/job/position/manage/push?type=' + e.value });
+		},
 		detail(item) {
 			uni.navigateTo({ url: '/pages/job/position/manage/push?id=' + item.id });
 		},
-		selectClick(e) {
-			uni.navigateTo({ url: '/pages/job/position/manage/push?type=' + e.type });
+		manageState(item) {
+			uni.showModal({
+				title: '提示',
+				content: item.state == 0 ? '确定关闭该职位' : '确定启用该职位',
+				success: (res) => {
+					if (res.confirm) {
+						this.http.request({
+							url: '/app/position/manage/state',
+							data: { id: item.id, state: item.state == 0 ? 1 : 0 },
+							method: 'POST',
+							success: (res) => {
+								uni.showToast({ title: '操作成功' });
+								item.state = item.state == 0 ? 1 : 0;
+							}
+						});
+					}
+				}
+			});
+		},
+		manageRemove(item) {
+			uni.showModal({
+				title: '提示',
+				content: '确定删除该职位?删除后包括已投递简历也全部清除',
+				success: (res) => {
+					if (res.confirm) {
+						this.http.request({
+							url: '/app/position/manage/remove/' + item.id,
+							success: (res) => {
+								uni.showToast({ title: '删除成功' });
+								this.list.splice(this.list.indexOf(item), 1);
+							}
+						});
+					}
+				}
+			});
 		},
 		//刷新数据
 		refresh() {

+ 15 - 27
app/pages/job/position/manage/push.vue

@@ -12,10 +12,10 @@
 			</picker>
 		</view>
 		<view class="form_group">
-			<view class="lable re">职位描述</view>
+			<view class="lable re">职位描述(要求)</view>
 			<leditor ref="editor" v-model="item.contents" placeholder="请输入职位描述"></leditor>
 		</view>
-		<view class="form_group">
+		<view class="form_group" v-if="item.type == 0">
 			<view class="lable re">经验要求</view>
 			<picker :range="dict.experience" @change="picker($event, 'experience')">
 				<input placeholder="请选择" v-model="item.experience" :disabled="true" />
@@ -30,7 +30,7 @@
 		</view>
 		<view v-else>
 			<view class="form_group">
-				<view class="lable re">{{ lable }}金额(元)</view>
+				<view class="lable re">兼职金额(元)</view>
 				<input type="number" placeholder="请输入" v-model="item.salary" />
 			</view>
 			<view class="form_group">
@@ -41,7 +41,7 @@
 				</picker>
 			</view>
 			<view class="form_group">
-				<view class="lable re">{{ lable }}时间</view>
+				<view class="lable re">兼职时间</view>
 			</view>
 			<view class="form_group" style="display: flex">
 				<view class="start">
@@ -58,19 +58,15 @@
 			</view>
 		</view>
 		<view class="form_group">
-			<view class="lable re">工作地点</view>
-			<picker :disabled="true" @click="chooseLocation()" v-if="item.type == 0">
-				<input placeholder="请选择" v-model="item.location" :disabled="true" />
-				<view class="icon more">&#xe8f2;</view>
-			</picker>
-			<picker :range="dict.location" @change="picker($event, 'location')" v-else>
-				<input placeholder="请选择" v-model="item.location" :disabled="true" />
+			<view class="lable" :class="item.type == 0 ? 're' : ''">{{ item.type == 0 ? '工作地点' : '兼职地点' }}</view>
+			<picker :disabled="true" @click="chooseLocation()">
+				<input :placeholder="item.type == 0 ? '请选择' : '留空不限工作地点'" v-model="item.location" :disabled="true" />
 				<view class="icon more">&#xe8f2;</view>
 			</picker>
 			<input placeholder="请输入楼层/单元室/门牌号" v-model="item.mph" v-if="item.address" />
 			<view class="bz">请仔细确认位置点,否置会影响求职者导航</view>
 		</view>
-		<button class="btn" @click="save()">保存</button>
+		<button class="btn" @click="save()">{{ item.id ? '编辑' : '保存' }}</button>
 	</view>
 </template>
 <script>
@@ -89,13 +85,15 @@ export default {
 				location: this.util.getData('address'),
 				unit: this.util.getData('unit')
 			},
-			rule: [],
-			userState: ''
+			rule: []
 		};
 	},
 	onLoad(e) {
 		if (e.type) {
 			this.item.type = e.type;
+			setTimeout(() => {
+				uni.setNavigationBarTitle({ title: e.type == 0 ? '发布全职' : '发布兼职' });
+			}, 300);
 		}
 		if (e.id) {
 			this.http.request({
@@ -103,6 +101,7 @@ export default {
 				success: (res) => {
 					this.item = res.data.data;
 					this.$refs.editor.setContents();
+					uni.setNavigationBarTitle({ title: this.item.type == 0 ? '编辑全职' : '编辑兼职' });
 				}
 			});
 		}
@@ -119,16 +118,6 @@ export default {
 			} else {
 				this.item[tag] = this.dict[tag][e.detail.value];
 			}
-			if (this.item.positionName == '选择职位') {
-				this.item.positionName = '';
-				uni.navigateTo({
-					url: '/pages/position/select'
-				});
-			}
-			if (this.item.location == '选择工作地点') {
-				this.item.location = '';
-				this.chooseLocation();
-			}
 			this.$forceUpdate();
 		},
 		go(url) {
@@ -159,13 +148,12 @@ export default {
 				});
 				return false;
 			} */
-			this.item.type = 0;
 			this.http.request({
-				url: '/app/position/edit',
+				url: this.item.id ? '/app/position/manage/edit' : '/app/position/manage/add',
 				data: this.item,
 				method: 'POST',
 				success: (res) => {
-					uni.showToast({ title: '发布成功' });
+					uni.showToast({ title: '操作成功' });
 					setTimeout(() => {
 						uni.$emit('position');
 						uni.navigateBack();

+ 0 - 110
app/pages/serve/index.scss

@@ -1,110 +0,0 @@
-.main {
-	padding: 5px 15px 25px 15px;
-	.banner {
-		box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2);
-		border-radius: 5px;
-	}
-	.news {
-		margin-top: 10px;
-		background-color: #cfe7fd;
-		border-radius: 7px;
-		overflow: hidden;
-		padding: 12px;
-		box-shadow:$box-shadow;
-		.gg {
-			font-weight: bold;
-			margin-bottom: 5px;
-			border-bottom: 1px solid $line;
-			padding-bottom: 10px;
-			.title {
-				margin-left: 10px;
-			}
-			.bor {
-				width: 5px;
-				height: 12px;
-				background-color: $main-color;
-				border-radius: 20px;
-				float: left;
-				margin-top: -16px;
-			}
-			.more {
-				float: right;
-				font-size: 14px;
-				font-weight: normal;
-				margin-top: -20px;
-			}
-		}
-		.item {
-			padding-top: 9px;
-			font-size: 14px;
-			overflow: hidden;
-			.title {
-				float: left;
-				width: 80%;
-			}
-			.date {
-				float: right;
-			}
-		}
-	}
-	.menu {
-		margin-top: 10px;
-		overflow: hidden;
-		background-color: white;
-		border-radius: 10px;
-		.cd {
-			float: left;
-			width: 25%;
-			text-align: center;
-			.out {
-				padding: 5px;
-				.int {
-					padding: 8px 5px 8px 5px;
-					.icon {
-						font-size: 30px;
-						width: 50px;
-						height: 50px;
-						margin: 0 auto;
-						color: white;
-						border-radius: 8px;
-						line-height: 52px;
-						box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-					}
-					.title {
-						font-size: 14px;
-						padding-top: 5px;
-					}
-				}
-			}
-		}
-	}
-	.hengfu {
-		width: 100%;
-		border-radius: 7px;
-		margin-top: 10px;
-		box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2);
-	}
-	.ad {
-		.item {
-			float: left;
-			width: 50%;
-			overflow: hidden;
-			.out {
-				padding: 10px 10px 10px 10px;
-				.int {
-					overflow: hidden;
-					border-radius: 7px;
-					image {
-						border-radius: 7px;
-						box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2);
-					}
-				}
-			}
-		}
-		.it {
-			overflow: hidden;
-			border-radius: 7px;
-			box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2);
-		}
-	}
-}

+ 126 - 52
app/pages/serve/index.vue

@@ -9,7 +9,7 @@
 			<view class="cd">
 				<view class="out">
 					<view class="int">
-						<view class="icon" style="background-color: #f44336;">&#xe6be;</view>
+						<view class="icon" style="background-color: #f44336">&#xe6be;</view>
 						<view class="title">失业登记</view>
 					</view>
 				</view>
@@ -17,7 +17,7 @@
 			<view class="cd">
 				<view class="out">
 					<view class="int">
-						<view class="icon" style="background-color: #4CAF50">&#xe64a;</view>
+						<view class="icon" style="background-color: #4caf50">&#xe64a;</view>
 						<view class="title">就业补贴</view>
 					</view>
 				</view>
@@ -41,7 +41,7 @@
 			<view class="cd" @click="go('/pages/index/index')">
 				<view class="out">
 					<view class="int">
-						<view class="icon" style="background-color: #03A9F4">&#xe725;</view>
+						<view class="icon" style="background-color: #03a9f4">&#xe725;</view>
 						<view class="title">结算广场</view>
 					</view>
 				</view>
@@ -57,7 +57,7 @@
 			<view class="cd" @click="go('/pages/clsd/job/part_time')">
 				<view class="out">
 					<view class="int">
-						<view class="icon" style="background-color: #FF5722">&#xe62a;</view>
+						<view class="icon" style="background-color: #ff5722">&#xe62a;</view>
 						<view class="title">兼职岗位</view>
 					</view>
 				</view>
@@ -72,7 +72,7 @@
 			</view>
 		</view>
 		<!--新闻-->
-		<view class="news" @click="webview('https://chenglantimes.com/tzgg')">
+		<view class="news" @click="go('/pages/news/index')">
 			<view class="gg">
 				<view class="title">最新资讯</view>
 				<view class="bor"></view>
@@ -117,57 +117,131 @@
 	</view>
 </template>
 <script>
-	export default {
-		data() {
-			return {
-				ip: this.http.ip,
-				user: {},
-				jobs: [1, 2, 3, 4, 5, 6],
-				bannerList: [],
-				noticeList: []
-			};
+export default {
+	data() {
+		return {
+			ip: this.http.ip,
+			user: {},
+			jobs: [1, 2, 3, 4, 5, 6],
+			bannerList: [],
+			noticeList: []
+		};
+	},
+	onShow() {
+		if (this.hasLogin()) {
+			//this.getUserInfo();
+		}
+	},
+	onLoad() {
+		this.getData();
+	},
+	methods: {
+		getUserInfo() {
+			this.http.request({
+				url: '/app/user/info',
+				success: (res) => {
+					this.user = res.data.data;
+				}
+			});
 		},
-		onShow() {
-			if (this.hasLogin()) {
-				//this.getUserInfo();
-			}
+		getData() {
+			this.http.request({
+				url: '/app/home/index',
+				success: (res) => {
+					this.contract = res.data.data.contract;
+					this.bannerList = res.data.data.bannerList;
+					res.data.data.noticeList.forEach((item) => {
+						this.noticeList.push(item.title);
+					});
+				}
+			});
 		},
-		onLoad() {
-			this.getData();
+		go(url) {
+			uni.navigateTo({ url: url });
 		},
-		methods: {
-			getUserInfo() {
-				this.http.request({
-					url: '/app/user/info',
-					success: (res) => {
-						this.user = res.data.data;
-					}
-				});
-			},
-			getData() {
-				this.http.request({
-					url: '/app/home/index',
-					success: (res) => {
-						this.contract = res.data.data.contract;
-						this.bannerList = res.data.data.bannerList;
-						res.data.data.noticeList.forEach((item) => {
-							this.noticeList.push(item.title);
-						});
-					}
-				});
-			},
-			go(url) {
-				uni.navigateTo({ url: url });
-			},
-			webview(src) {
-				uni.navigateTo({
-					url: '/pages/other/webview?src=' + src
-				})
-			}
+		webview(src) {
+			uni.navigateTo({
+				url: '/pages/other/webview?src=' + src
+			});
 		}
-	};
+	}
+};
 </script>
 
 <style lang="scss">
-	@import 'index.scss';
-</style>
+.banner {
+	margin-top: -10px;
+}
+.news {
+	margin-top: 10px;
+	background-color: #cfe7fd;
+	border-radius: 7px;
+	overflow: hidden;
+	padding: 12px;
+	box-shadow: $box-shadow;
+	.gg {
+		font-weight: bold;
+		margin-bottom: 5px;
+		border-bottom: 1px solid $line;
+		padding-bottom: 10px;
+		.title {
+			margin-left: 10px;
+		}
+		.bor {
+			width: 5px;
+			height: 12px;
+			background-color: $main-color;
+			border-radius: 20px;
+			float: left;
+			margin-top: -16px;
+		}
+		.more {
+			float: right;
+			font-size: 14px;
+			font-weight: normal;
+			margin-top: -20px;
+		}
+	}
+	.item {
+		padding-top: 9px;
+		font-size: 14px;
+		overflow: hidden;
+		.title {
+			float: left;
+			width: 80%;
+		}
+		.date {
+			float: right;
+		}
+	}
+}
+.hengfu {
+	width: 100%;
+	border-radius: 7px;
+	margin-top: 10px;
+	box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2);
+}
+.ad {
+	.item {
+		float: left;
+		width: 50%;
+		overflow: hidden;
+		.out {
+			padding: 10px 10px 10px 10px;
+			.int {
+				overflow: hidden;
+				border-radius: 7px;
+				image {
+					border-radius: 7px;
+					box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2);
+				}
+			}
+		}
+	}
+	.it {
+		overflow: hidden;
+		border-radius: 7px;
+		box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2);
+	}
+}
+</style>

+ 28 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/work/api/Api_PositionController.java

@@ -4,6 +4,8 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.web.work.api.config.BaseController;
 import com.ruoyi.web.work.domain.Position;
+import com.ruoyi.web.work.domain.dto.PositionDto;
+import com.ruoyi.web.work.domain.dto.PositionStateDto;
 import com.ruoyi.web.work.service.IPositionService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -23,6 +25,15 @@ public class Api_PositionController extends BaseController {
     @Autowired
     private IPositionService positionService;
 
+    @GetMapping("/list")
+    public TableDataInfo list(Position position) {
+        position.setState(0);
+        position.setAudit(1);
+        startPage();
+        List<Position> list = positionService.manageList(position);
+        return getDataTable(list);
+    }
+
     @GetMapping("/manage/list")
     public TableDataInfo manageList(Position position) {
         position.setUserId(getUser().getId());
@@ -36,9 +47,24 @@ public class Api_PositionController extends BaseController {
         return positionService.manageDetail(id);
     }
 
+    @PostMapping("/manage/add")
+    public AjaxResult manageAdd(@Validated @RequestBody PositionDto dto) {
+        return positionService.manageAdd(dto);
+    }
+
     @PostMapping("/manage/edit")
-    public AjaxResult edit(@Validated @RequestBody Position position) {
-        return positionService.edit(position);
+    public AjaxResult manageEdit(@Validated @RequestBody PositionDto dto) {
+        return positionService.manageEdit(dto);
     }
 
+
+    @GetMapping("/manage/remove/{id}")
+    public AjaxResult manageRemove(@PathVariable("id") Long id) {
+        return positionService.manageRemove(id);
+    }
+
+    @PostMapping("/manage/state")
+    public AjaxResult manageState(@Validated @RequestBody PositionStateDto dto) {
+        return positionService.manageState(dto);
+    }
 }

+ 94 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/dto/PositionDto.java

@@ -0,0 +1,94 @@
+package com.ruoyi.web.work.domain.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+
+/**
+ * @author lsw
+ * @date 2024-06-07
+ */
+@Data
+@Accessors(chain = true)
+public class PositionDto {
+
+    private Long id;
+
+    @NotNull(message = "职位类型为空")
+    @Min(value = 0, message = "类型 只能是 全职 或者 兼职")
+    @Max(value = 1, message = "类型 只能是 全职 或者 兼职")
+    @ApiModelProperty(value = "类型: 0全职 1兼职")
+    private Integer type;
+
+    @NotBlank(message = "职位名称不能为空")
+    @ApiModelProperty(value = "职位名称")
+    private String title;
+
+    @NotBlank(message = "职位描述不能为空")
+    @ApiModelProperty(value = "职位描述")
+    private String contents;
+
+    @NotNull(message = "职位分类不能为空")
+    @ApiModelProperty(value = "职位分类id")
+    private Long positionId;
+
+    @NotBlank(message = "职位分类名称不能为空")
+    @ApiModelProperty(value = "职位分类名称")
+    private String positionName;
+
+    @ApiModelProperty(value = "经验要求")
+    private String experience;
+
+    @NotBlank(message = "薪资范围不能为空")
+    @ApiModelProperty(value = "薪资范围")
+    private String salary;
+
+    @ApiModelProperty(value = "最小薪资")
+    private Integer min;
+
+    @ApiModelProperty(value = "最大薪资")
+    private Integer max;
+
+    @ApiModelProperty(value = "职位关键字")
+    private String tags;
+
+    @ApiModelProperty(value = "城市名称")
+    private String cityName;
+
+    @ApiModelProperty(value = "地区ancestors")
+    private String ancestors;
+
+    @ApiModelProperty(value = "地区名称")
+    private String regionName;
+
+    @ApiModelProperty(value = "地点名")
+    private String location;
+
+    @ApiModelProperty(value = "详细地址")
+    private String address;
+
+    @ApiModelProperty(value = "楼层/单元室/门牌号")
+    private String mph;
+
+    @ApiModelProperty(value = "经度")
+    private String longitude;
+
+    @ApiModelProperty(value = "维度")
+    private String latitude;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @ApiModelProperty(value = "开始时间")
+    private Date startDate;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @ApiModelProperty(value = "结束时间")
+    private Date endDate;
+
+}

+ 20 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/dto/PositionStateDto.java

@@ -0,0 +1,20 @@
+package com.ruoyi.web.work.domain.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+
+@Data
+public class PositionStateDto {
+
+
+    @NotNull(message = "参数错误")
+    private Long id;
+
+    @NotNull(message = "参数错误")
+    @Min(value = 0, message = "参数错误")
+    @Max(value = 1, message = "参数错误")
+    private Integer state;
+}

+ 32 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/IPositionService.java

@@ -3,6 +3,8 @@ package com.ruoyi.web.work.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.web.work.domain.Position;
+import com.ruoyi.web.work.domain.dto.PositionDto;
+import com.ruoyi.web.work.domain.dto.PositionStateDto;
 
 import java.util.List;
 
@@ -15,7 +17,20 @@ public interface IPositionService extends IService<Position> {
 
     List<Position> manageList(Position position);
 
-    AjaxResult edit(Position position);
+    /**
+     * 发布职位
+     *
+     * @param dto
+     * @return
+     */
+    AjaxResult manageAdd(PositionDto dto);
+
+    /**
+     * 编辑职位
+     * @param dto
+     * @return
+     */
+    AjaxResult manageEdit(PositionDto dto);
 
     /**
      * 管理职位详情
@@ -24,4 +39,20 @@ public interface IPositionService extends IService<Position> {
      * @return
      */
     AjaxResult manageDetail(Long id);
+
+    /**
+     * 删除职位
+     *
+     * @param id
+     * @return
+     */
+    AjaxResult manageRemove(Long id);
+
+    /**
+     * 职位关闭或启用
+     *
+     * @param dto
+     * @return
+     */
+    AjaxResult manageState(PositionStateDto dto);
 }

+ 51 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/PositionServiceImpl.java

@@ -6,9 +6,12 @@ import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.web.work.api.util.AppUtil;
 import com.ruoyi.web.work.domain.Column;
 import com.ruoyi.web.work.domain.Position;
+import com.ruoyi.web.work.domain.dto.PositionDto;
+import com.ruoyi.web.work.domain.dto.PositionStateDto;
 import com.ruoyi.web.work.mapper.PositionMapper;
 import com.ruoyi.web.work.service.IColumnService;
 import com.ruoyi.web.work.service.IPositionService;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -37,8 +40,9 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
     }
 
     @Override
-    public AjaxResult edit(Position position) {
-        position.setUserId(AppUtil.getUser().getId());
+    public AjaxResult manageAdd(PositionDto dto) {
+        Position position = new Position();
+        BeanUtils.copyProperties(dto, position);
         Column region = columnService.selectRegion(new Column().setTitle(position.getRegionName()).setLevel(3));
         if (region != null) {
             position.setAncestors(region.getAncestors() + "," + region.getId());
@@ -49,6 +53,9 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
             position.setMin(Integer.parseInt(salary[0]));
             position.setMax(Integer.parseInt(salary[1]));
         }
+        position.setUserId(AppUtil.getUser().getId());
+        position.setState(0);
+        position.setAudit(1);
         if (!save(position)) {
             throw new ServiceException("发布职位失败");
         }
@@ -56,6 +63,23 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
     }
 
     @Override
+    public AjaxResult manageEdit(PositionDto dto) {
+        Position position = getById(dto.getId());
+        if (position == null || !position.getUserId().equals(AppUtil.getUser().getId())) {
+            return AjaxResult.error("职位不存在或非法操作");
+        }
+        if (position.getAudit() == 1) {
+            return AjaxResult.error("该职位已审核通过不允许编辑");
+        }
+        BeanUtils.copyProperties(dto, position);
+        position.setUserId(AppUtil.getUser().getId());
+        if (!updateById(position)) {
+            throw new ServiceException("编辑职位失败");
+        }
+        return AjaxResult.success();
+    }
+
+    @Override
     public AjaxResult manageDetail(Long id) {
         Position position = getById(id);
         if (position == null || !position.getUserId().equals(AppUtil.getUser().getId())) {
@@ -63,4 +87,29 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
         }
         return AjaxResult.success(position);
     }
+
+    @Override
+    public AjaxResult manageRemove(Long id) {
+        Position position = getById(id);
+        if (position == null || !position.getUserId().equals(AppUtil.getUser().getId())) {
+            return AjaxResult.error("职位不存在或非法操作");
+        }
+        if (!removeById(id)) {
+            throw new ServiceException("删除职位失败,请联系平台");
+        }
+        return AjaxResult.success();
+    }
+
+    @Override
+    public AjaxResult manageState(PositionStateDto dto) {
+        Position position = getById(dto.getId());
+        if (position == null || !position.getUserId().equals(AppUtil.getUser().getId())) {
+            return AjaxResult.error("职位不存在或非法操作");
+        }
+        position.setState(dto.getState());
+        if (!updateById(position)) {
+            throw new ServiceException("启用或关闭职位失败,请联系平台");
+        }
+        return AjaxResult.success();
+    }
 }

+ 1 - 0
ruoyi-admin/src/main/resources/mapper/work/PositionMapper.xml

@@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>
             <if test="userId != null "> and user_id = #{userId}</if>
             <if test="type != null "> and type = #{type}</if>
+            <if test="audit != null "> and audit = #{audit}</if>
             <if test="title != null  and title != ''"> and title like concat('%', #{name}, '%')</if>
         </where>
     </select>