Merge branch 'main' of http://175.6.124.250:3100/luozhun/policeSecurity
This commit is contained in:
commit
25c3e2a911
|
@ -1,5 +1,6 @@
|
|||
import Taro from "@tarojs/taro";
|
||||
import {ApiOptions} from "../../types/request";
|
||||
import {type} from "os";
|
||||
|
||||
const requestInterceptor = (chain: Taro.Chain) => {
|
||||
const requestParams = chain.requestParams
|
||||
|
@ -28,6 +29,8 @@ class CustomRequest {
|
|||
title: '请求中...',
|
||||
}).then()
|
||||
}
|
||||
|
||||
console.log(params,method)
|
||||
Taro.request<JsonResult<T>, object>({
|
||||
url: this.BASE_API + url,
|
||||
data: params,
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {ref} from "vue";
|
||||
import {onMounted, ref, watch} from "vue";
|
||||
import {SEX} from "@/enums";
|
||||
import {FormRules} from "@nutui/nutui-taro/dist/types/__VUE/form/types";
|
||||
import api from "@/request";
|
||||
|
@ -69,7 +69,7 @@ const formData = ref<formDate>({
|
|||
remark:'',
|
||||
homeAddress: ''
|
||||
})
|
||||
const serviceProjectId = ref('')
|
||||
const serviceProjectId = ref('') //新增带过来的id
|
||||
const pickerValue = ref(new Date())
|
||||
const formRef = ref(null)
|
||||
|
||||
|
@ -94,7 +94,13 @@ const rules: FormRules = {
|
|||
};
|
||||
|
||||
useLoad((options)=>{
|
||||
formData.value = JSON.parse(options.item)
|
||||
serviceProjectId.value = JSON.parse(options.item).snowFlakeId
|
||||
console.log(serviceProjectId.value)
|
||||
})
|
||||
|
||||
watch(()=>formData.value,(res)=>{
|
||||
console.log(res)
|
||||
})
|
||||
const openDate = ()=>{
|
||||
showPicker.value = true
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
<view class="myProjectIndex">地址:
|
||||
<text>{{ item?.provinceName }}{{ item.cityName }}{{ item.districtsName }}{{ item.streetName }}</text>
|
||||
</view>
|
||||
<view style="display: flex;justify-content: space-between">
|
||||
<text>联系人:{{ item?.contactPersonInfo.name }}</text>
|
||||
<text>电话:{{ item?.contactPersonInfo.telephone }}</text>
|
||||
</view>
|
||||
<view class="project">
|
||||
<view @click="projectClick(items,item?.name)" v-for="(items,index) in item.serviceProjectList" :key="index">
|
||||
{{ items.name }}
|
||||
|
@ -30,9 +34,7 @@ const getMyServiceProject = async () => {
|
|||
}
|
||||
|
||||
const projectClick = (items: ServiceProjectList, name: string) => {
|
||||
console.log(name, JSON.stringify(items))
|
||||
Taro.navigateTo({
|
||||
|
||||
url: `/subPages/pages/projectDetails/projectDetails?name=${name}&item=${JSON.stringify(items)}`,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
.projectDetailsItem{
|
||||
height: 18%;
|
||||
margin: 20px;
|
||||
margin: 10px 20px 10px 20px;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
padding: 15px;
|
||||
|
@ -14,6 +13,10 @@
|
|||
line-height: 65px;
|
||||
color: #333333;
|
||||
.projectDetailsIndex{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
line-height: 44rpx;
|
||||
margin-bottom: 20px;
|
||||
.content{
|
||||
color: #9b9b9f;
|
||||
}
|
||||
|
@ -35,7 +38,16 @@
|
|||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
font-size: 24px;
|
||||
margin-bottom: 15px
|
||||
margin-bottom: 15px;
|
||||
.projectDetailsTableIndex{
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
text-align: center;
|
||||
view{
|
||||
width: 70px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +60,12 @@
|
|||
right: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.nutPopup{
|
||||
width: 300px;
|
||||
height: 100px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,24 @@
|
|||
<template>
|
||||
<view class="projectDetails">
|
||||
<view class="projectDetailsItem">
|
||||
<view class="projectDetailsItem" style="line-height: 50rpx">
|
||||
<view>
|
||||
<view style="display: flex;justify-content: space-between">
|
||||
<text style="font-size: 18px">{{ nameValue ? nameValue : '' }}{{ '-----' + detailsList?.name }}项目</text>
|
||||
<!--<text>进行中</text>-->
|
||||
<text>进行中</text>
|
||||
</view>
|
||||
<view>
|
||||
<view style="float: left;width: 50%;" class="content">经理名称:{{ detailsList?.projectManagerMiniProgramUserInfo.name }}</view>
|
||||
<view class="content">手机号:{{ detailsList?.projectManagerMiniProgramUserInfo.telephone }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="projectDetailsItem">
|
||||
<view class="projectDetailsIndex">
|
||||
<nut-row>
|
||||
<nut-col :span="24">
|
||||
<view class="content">保安证件号:{{ detailsList?.idNumber }}</view>
|
||||
</nut-col>
|
||||
</nut-row>
|
||||
<nut-row>
|
||||
<nut-col :span="12">
|
||||
<view class="content">工作人员数量:{{ detailsList?.staffTotal }}</view>
|
||||
|
@ -23,10 +36,7 @@
|
|||
</nut-col>
|
||||
</nut-row>
|
||||
<nut-row>
|
||||
<nut-col :span="16">
|
||||
<view class="content">证件号:{{ detailsList?.idNumber }}</view>
|
||||
</nut-col>
|
||||
<nut-col :span="8">
|
||||
<nut-col :span="4">
|
||||
<view class="content">户数:{{ detailsList?.houseTotal }}</view>
|
||||
</nut-col>
|
||||
</nut-row>
|
||||
|
@ -34,8 +44,8 @@
|
|||
</view>
|
||||
<!--表格-->
|
||||
<view class="projectDetailsTableDrop">
|
||||
<view style="padding: 0 12px">项目人员</view>
|
||||
<scroll-view :scroll-y="true" style="height: 80%;" @scrolltoupper="upper" @scrolltolower="lower"
|
||||
<view style="padding: 0 12px">项目人员({{total}})</view>
|
||||
<scroll-view :scroll-y="true" style="height: 80%;" @scrolltolower="lower"
|
||||
:scroll-into-view="toView" :scroll-top="scrollTop" :refresherEnabled="true"
|
||||
@refresherrefresh="onRefresherRefresh" :refresher-triggered="isRefresher"
|
||||
>
|
||||
|
@ -46,7 +56,7 @@
|
|||
<view style="display: flex;justify-content: space-between">
|
||||
<text>姓名:{{ item?.name?item?.name:'创建者' }}</text>
|
||||
<text>性别:{{ item.sex?.label?item.sex?.label:' 隐藏' }}</text>
|
||||
<text>职位:{{ item.workPost?item.workPost:'创建者' }}</text>
|
||||
<text>职位:{{ item.workPost?item.workPost:'无' }}</text>
|
||||
</view>
|
||||
<view style="display: flex;justify-content: space-between">
|
||||
<text>保安证件:{{ item.securityNumber?item.securityNumber:'125241256451' }}</text>
|
||||
|
@ -57,8 +67,10 @@
|
|||
<text>身份证:{{ item.idCard }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<nut-button style="width: 25%" size="small" type="info">删除</nut-button>
|
||||
<view class="projectDetailsTableIndex" >
|
||||
<view style="color: #3a6bbe" @click="detail(item)">详情</view>
|
||||
<view style="color: #ffa60d" @click="projectEdit(item)">编辑</view>
|
||||
<view style="color: red" @click="deleteUssrID(item.snowFlakeId)">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -70,25 +82,53 @@
|
|||
<nut-button style="width: 45%" type="info" @click="formAdd">项目人员录入</nut-button>
|
||||
<nut-button style="width: 45%" type="info">二维码录入</nut-button>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<nut-dialog
|
||||
content="是否确认删除该用户?"
|
||||
:onOk="dialogOk"
|
||||
v-model:visible="confirmVisible"
|
||||
/>
|
||||
</view>
|
||||
<view>
|
||||
<nut-dialog no-cancel-btn content="详情" v-model:visible="detailVisible">
|
||||
<slot>
|
||||
<view style="margin-bottom: 5px">
|
||||
<view>籍贯:{{content.nativePlace}}</view>
|
||||
<view>公司:{{content.securityUnitName}}</view>
|
||||
<view>家庭地址:{{content.homeAddress}}</view>
|
||||
<view>备注:{{content.remark}}</view>
|
||||
</view>
|
||||
</slot>
|
||||
</nut-dialog>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import Taro, {useLoad} from "@tarojs/taro";
|
||||
import Taro, {useLoad,useDidShow} from "@tarojs/taro";
|
||||
import './projectDetails.scss'
|
||||
import {ref} from "vue";
|
||||
import api from "@/request/index";
|
||||
import * as dayjs from 'dayjs'
|
||||
import {type} from "os";
|
||||
const detailsList = ref()
|
||||
const nameValue = ref('')
|
||||
const projectData = ref<Records<string>[]>([])
|
||||
const projectData = ref<Records[]>([])
|
||||
|
||||
const content = ref<Records>({} as any)
|
||||
// 控制模态框的显示状态
|
||||
const confirmVisible = ref(false);
|
||||
const detailVisible = ref(false)
|
||||
useLoad(async (options: MyProjectList) => {
|
||||
console.log(JSON.parse(options.item),'111111111111',options.name)
|
||||
nameValue.value = options.name
|
||||
detailsList.value = await JSON.parse(options.item)
|
||||
await projectDetailsTable()
|
||||
})
|
||||
useDidShow(async () => {
|
||||
initServiceProjectSecurityUserList()
|
||||
})
|
||||
const projectDetailsTable = async () => {
|
||||
// if (total.value === projectData.value.length) return
|
||||
Taro.showLoading({
|
||||
await Taro.showLoading({
|
||||
title: '加载中',
|
||||
})
|
||||
const queryParams = {
|
||||
|
@ -114,29 +154,56 @@ const current = ref(1)
|
|||
const isRefresher = ref(false)
|
||||
const scrollTop = ref(0)
|
||||
const toView = ref('demo2')
|
||||
const upper = (e) => {
|
||||
console.log('到顶了:', e)
|
||||
}
|
||||
// 滚动到底部/右边时触发
|
||||
const lower = (e) => {
|
||||
if (total.value === projectData.value.length) return
|
||||
if (total.value > projectData.value.length) {
|
||||
console.log('触底了:', e)
|
||||
current.value = current.value + 1
|
||||
projectDetailsTable()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// 自定义下拉刷新被触发
|
||||
const onRefresherRefresh = (e) => {
|
||||
const initServiceProjectSecurityUserList = () => {
|
||||
projectData.value = []
|
||||
total.value = null
|
||||
current.value = 1 //重置
|
||||
isRefresher.value = true
|
||||
console.log('自定义下拉刷新被触发:', e)
|
||||
projectDetailsTable()
|
||||
|
||||
}
|
||||
// 自定义下拉刷新被触发
|
||||
const onRefresherRefresh = (e) => {
|
||||
initServiceProjectSecurityUserList()
|
||||
}
|
||||
|
||||
const securityUserId = ref<string>('')
|
||||
|
||||
// 删除
|
||||
const deleteUssrID = (snowFlakeId:string)=>{
|
||||
confirmVisible.value = true
|
||||
securityUserId.value = snowFlakeId
|
||||
}
|
||||
|
||||
// 二次删除
|
||||
const dialogOk = async ()=>{
|
||||
await api.delete(`/projectManageIndex/deleteSecurityUserByServiceProjectId`,{securityUserId:securityUserId.value},{
|
||||
header:{
|
||||
"content-type":'application/x-www-form-urlencoded'
|
||||
}
|
||||
})
|
||||
initServiceProjectSecurityUserList()
|
||||
}
|
||||
|
||||
|
||||
// 详情
|
||||
const detail = (item)=>{
|
||||
detailVisible.value = true
|
||||
content.value = item
|
||||
}
|
||||
const projectEdit = (item)=>{
|
||||
console.log(111)
|
||||
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(item)}`})
|
||||
}
|
||||
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
||||
|
|
|
@ -33,5 +33,12 @@ interface ServiceProjectList {
|
|||
snowFlakeId?: string;
|
||||
staffTotal?: number;
|
||||
type?:string;
|
||||
projectManagerMiniProgramUserInfo?:ProgramUserInfo
|
||||
}
|
||||
interface ProgramUserInfo{
|
||||
idCard: null
|
||||
name: string
|
||||
telephone: string
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
interface Records<T>{
|
||||
interface Records{
|
||||
createTime?: string;
|
||||
dateOfBirth?: string;
|
||||
homeAddress?: string;
|
||||
|
@ -10,16 +10,17 @@ interface Records<T>{
|
|||
securityUnitId?: string;
|
||||
securityUnitName?: string;
|
||||
serviceProjectId?: string;
|
||||
snowFlakeId:string;
|
||||
workPost?:string;
|
||||
sex?:Sex
|
||||
}
|
||||
interface ProjectData<T> {
|
||||
current?:string;
|
||||
pages?:string;
|
||||
records?: Records<T>;
|
||||
records?: Records[];
|
||||
size?: string;
|
||||
total?: string;
|
||||
data: Records<T>;
|
||||
data: Records[];
|
||||
}
|
||||
|
||||
interface Sex {
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package com.changhu.module.miniProgram.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
|
||||
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
|
||||
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
|
||||
import com.changhu.module.miniProgram.service.MiniProgramUserService;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
|
@ -29,4 +33,10 @@ public class MiniProgramUserController {
|
|||
public void register(@RequestBody @Valid MiniProgramUserRegisterParams params) {
|
||||
miniProgramUserService.register(params);
|
||||
}
|
||||
|
||||
@Operation(summary = "服务项目保安人员分页")
|
||||
@PostMapping("/securityUserPager")
|
||||
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
|
||||
return miniProgramUserService.securityUserPager(queryParams);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,13 +3,14 @@ package com.changhu.module.miniProgram.controller;
|
|||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
|
||||
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
|
||||
import com.changhu.module.miniProgram.service.ProjectManageIndexService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -32,4 +33,16 @@ public class ProjectManageIndexController {
|
|||
public List<IndexServiceProjectListVo> getMyServiceProjectList() {
|
||||
return projectManageIndexService.getMyServiceProjectList();
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id删除保安人员")
|
||||
@DeleteMapping("/deleteSecurityUserByServiceProjectId")
|
||||
public void deleteSecurityUserById(@RequestParam @Schema(description = "保安人员id") Long securityUserId) {
|
||||
projectManageIndexService.deleteSecurityUserByServiceProjectId(securityUserId);
|
||||
}
|
||||
|
||||
@Operation(summary = "保存或更新保安人员")
|
||||
@PostMapping("/saveOrUpdateSecurityUser")
|
||||
public void saveOrUpdateSecurityUser(@RequestBody SaveOrUpdateSecurityUserParams params) {
|
||||
projectManageIndexService.saveOrUpdateSecurityUser(params);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.changhu.module.miniProgram.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.module.miniProgram.pojo.entity.SecurityUser;
|
||||
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
|
||||
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* security_user (保安人员) 固化类
|
||||
* author: luozhun
|
||||
* desc 由groovy脚本自动生成
|
||||
*/
|
||||
@Mapper
|
||||
public interface SecurityUserMapper extends BaseMapper<SecurityUser> {
|
||||
/**
|
||||
* 服务项目内的保安人员分页
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param params 查询参数
|
||||
* @return 人员
|
||||
*/
|
||||
Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@Param("page") Page<ServiceProjectSecurityUserPagerVo> page,
|
||||
@Param("params") ServiceProjectSecurityUserPagerQueryParams params);
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package com.changhu.module.miniProgram.pojo.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
|
||||
/**
|
||||
* 保安人员 实体类
|
||||
* author: luozhun
|
||||
* desc 由groovy脚本自动生成
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(autoResultMap = true)
|
||||
public class SecurityUser extends BaseEntity implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 所属保安单位id
|
||||
*/
|
||||
private Long securityUnitId;
|
||||
|
||||
/**
|
||||
* 服务项目id
|
||||
*/
|
||||
private Long serviceProjectId;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String telephone;
|
||||
|
||||
/**
|
||||
* 工作岗位
|
||||
*/
|
||||
private String workPost;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 籍贯
|
||||
*/
|
||||
private String nativePlace;
|
||||
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 出生日期
|
||||
*/
|
||||
private java.time.LocalDate dateOfBirth;
|
||||
|
||||
/**
|
||||
* 保安证号
|
||||
*/
|
||||
private String securityNumber;
|
||||
|
||||
/**
|
||||
* 家庭住址
|
||||
*/
|
||||
private String homeAddress;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.changhu.module.miniProgram.pojo.params;
|
||||
|
||||
import com.changhu.common.db.enums.Sex;
|
||||
import com.changhu.common.validator.annotation.IdCard;
|
||||
import com.changhu.common.validator.annotation.IsMobile;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/12 上午9:57
|
||||
* @desc SaveOrUpdateSecurityUserParams...
|
||||
*/
|
||||
@Data
|
||||
public class SaveOrUpdateSecurityUserParams {
|
||||
@Schema(description = "id")
|
||||
private Long snowFlakeId;
|
||||
|
||||
@NotNull(message = "服务项目不能为空")
|
||||
@Schema(description = "服务项目id")
|
||||
private Long serviceProjectId;
|
||||
|
||||
@NotBlank(message = "名字不能为空")
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@NotBlank(message = "手机号不能为空")
|
||||
@IsMobile
|
||||
@Schema(description = "手机号")
|
||||
private String telephone;
|
||||
|
||||
@Schema(description = "工作岗位")
|
||||
private String workPost;
|
||||
|
||||
@NotNull(message = "性别不能为空")
|
||||
@Schema(description = "性别")
|
||||
private Sex sex;
|
||||
|
||||
@Schema(description = "籍贯")
|
||||
private String nativePlace;
|
||||
|
||||
@NotBlank(message = "身份证不能为空")
|
||||
@IdCard
|
||||
@Schema(description = "身份证")
|
||||
private String idCard;
|
||||
|
||||
@Schema(description = "出生日期")
|
||||
private java.time.LocalDate dateOfBirth;
|
||||
|
||||
@Schema(description = "保安证号")
|
||||
private String securityNumber;
|
||||
|
||||
@Schema(description = "家庭住址")
|
||||
private String homeAddress;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.changhu.module.miniProgram.pojo.queryParams;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/12 上午9:41
|
||||
* @desc ServiceProjectSecurityUserPagerQueryParams...
|
||||
*/
|
||||
@Data
|
||||
public class ServiceProjectSecurityUserPagerQueryParams {
|
||||
@Schema(description = "服务项目id")
|
||||
private Long serviceProjectId;
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.changhu.module.miniProgram.pojo.vo;
|
||||
|
||||
import com.changhu.common.db.enums.Sex;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/12 上午9:41
|
||||
* @desc ServiceProjectSecurityUserPagerVo...
|
||||
*/
|
||||
@Data
|
||||
public class ServiceProjectSecurityUserPagerVo {
|
||||
@Schema(description = "id")
|
||||
private Long snowFlakeId;
|
||||
|
||||
@Schema(description = "所属保安单位id")
|
||||
private Long securityUnitId;
|
||||
@Schema(description = "保安单位名字")
|
||||
private String securityUnitName;
|
||||
|
||||
@Schema(description = "服务项目id")
|
||||
private Long serviceProjectId;
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String telephone;
|
||||
;
|
||||
|
||||
@Schema(description = "工作岗位")
|
||||
private String workPost;
|
||||
|
||||
@Schema(description = "性别")
|
||||
private Sex sex;
|
||||
|
||||
@Schema(description = "籍贯")
|
||||
private String nativePlace;
|
||||
|
||||
@Schema(description = "身份证")
|
||||
private String idCard;
|
||||
|
||||
@Schema(description = "出生日期")
|
||||
private java.time.LocalDate dateOfBirth;
|
||||
|
||||
@Schema(description = "保安证号")
|
||||
private String securityNumber;
|
||||
|
||||
@Schema(description = "家庭住址")
|
||||
private String homeAddress;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
}
|
|
@ -1,8 +1,12 @@
|
|||
package com.changhu.module.miniProgram.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
|
||||
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
|
||||
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
|
||||
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
|
||||
/**
|
||||
* mini_program_user (小程序用户) 服务类
|
||||
|
@ -17,4 +21,12 @@ public interface MiniProgramUserService extends IService<MiniProgramUser> {
|
|||
* @param params 参数
|
||||
*/
|
||||
void register(MiniProgramUserRegisterParams params);
|
||||
|
||||
/**
|
||||
* 服务项目内的保安人员分页
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @return 保安人员
|
||||
*/
|
||||
Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.changhu.module.miniProgram.service;
|
||||
|
||||
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
|
||||
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -16,4 +17,18 @@ public interface ProjectManageIndexService {
|
|||
* @return 服务项目列表
|
||||
*/
|
||||
List<IndexServiceProjectListVo> getMyServiceProjectList();
|
||||
|
||||
/**
|
||||
* 根据id删除保安人员
|
||||
*
|
||||
* @param securityUserId 保安人员id
|
||||
*/
|
||||
void deleteSecurityUserByServiceProjectId(Long securityUserId);
|
||||
|
||||
/**
|
||||
* 保存或更新保安人员
|
||||
*
|
||||
* @param params 保安人员参数
|
||||
*/
|
||||
void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.changhu.module.miniProgram.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.changhu.module.miniProgram.pojo.entity.SecurityUser;
|
||||
|
||||
/**
|
||||
* security_user (保安人员) 服务类
|
||||
* author: luozhun
|
||||
* desc 由groovy脚本自动生成
|
||||
*/
|
||||
public interface SecurityUserService extends IService<SecurityUser> {
|
||||
|
||||
}
|
|
@ -4,13 +4,19 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
|
|||
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.utils.SnowFlakeIdUtil;
|
||||
import com.changhu.module.miniProgram.mapper.MiniProgramUserMapper;
|
||||
import com.changhu.module.miniProgram.mapper.SecurityUserMapper;
|
||||
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
|
||||
import com.changhu.module.miniProgram.pojo.entity.SecurityUser;
|
||||
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
|
||||
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
|
||||
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
|
||||
import com.changhu.module.miniProgram.service.MiniProgramUserService;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -26,6 +32,9 @@ public class MiniProgramUserServiceImpl extends ServiceImpl<MiniProgramUserMappe
|
|||
@Autowired
|
||||
private WxMaService wxMaService;
|
||||
|
||||
@Autowired
|
||||
private SecurityUserMapper securityUserMapper;
|
||||
|
||||
@Override
|
||||
public void register(MiniProgramUserRegisterParams params) {
|
||||
MiniProgramUser miniProgramUser = BeanUtil.copyProperties(params, MiniProgramUser.class);
|
||||
|
@ -47,4 +56,9 @@ public class MiniProgramUserServiceImpl extends ServiceImpl<MiniProgramUserMappe
|
|||
throw new MessageException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
|
||||
return securityUserMapper.securityUserPager(queryParams.getPage(), queryParams.getParams());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
package com.changhu.module.miniProgram.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
import com.changhu.module.management.mapper.ServiceProjectMapper;
|
||||
import com.changhu.module.miniProgram.pojo.entity.SecurityUser;
|
||||
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
|
||||
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
|
||||
import com.changhu.module.miniProgram.service.ProjectManageIndexService;
|
||||
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
|
@ -24,4 +31,47 @@ public class ProjectManageIndexServiceImpl implements ProjectManageIndexService
|
|||
public List<IndexServiceProjectListVo> getMyServiceProjectList() {
|
||||
return serviceProjectMapper.getServiceProjectList(null, UserUtil.getUserId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSecurityUserByServiceProjectId(Long securityUserId) {
|
||||
boolean b = Db.removeById(securityUserId, SecurityUser.class);
|
||||
if (!b) {
|
||||
throw new MessageException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params) {
|
||||
SecurityUser securityUser = BeanUtil.copyProperties(params, SecurityUser.class);
|
||||
//填充保安单位
|
||||
securityUser.setSecurityUnitId(UserUtil.getUnitId());
|
||||
//新增的情况
|
||||
Long snowFlakeId = securityUser.getSnowFlakeId();
|
||||
if (snowFlakeId == null) {
|
||||
//判断是否已经存在
|
||||
boolean exists = Db.lambdaQuery(SecurityUser.class)
|
||||
.eq(SecurityUser::getServiceProjectId, securityUser.getServiceProjectId())
|
||||
.eq(SecurityUser::getIdCard, securityUser.getIdCard())
|
||||
.exists();
|
||||
if (exists) {
|
||||
throw new MessageException("服务项目下已经存在该人员");
|
||||
}
|
||||
} else {
|
||||
//如果修改了身份证 需要查重
|
||||
SecurityUser byId = Db.getById(snowFlakeId, SecurityUser.class);
|
||||
if (!securityUser.getIdCard().equals(byId.getIdCard())) {
|
||||
boolean exists = Db.lambdaQuery(SecurityUser.class)
|
||||
.eq(SecurityUser::getServiceProjectId, securityUser.getServiceProjectId())
|
||||
.eq(SecurityUser::getIdCard, securityUser.getIdCard())
|
||||
.exists();
|
||||
if (exists) {
|
||||
throw new MessageException("服务项目下已经存在该人员");
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean b = Db.saveOrUpdate(securityUser);
|
||||
if (!b) {
|
||||
throw new MessageException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.changhu.module.miniProgram.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.changhu.module.miniProgram.mapper.SecurityUserMapper;
|
||||
import com.changhu.module.miniProgram.pojo.entity.SecurityUser;
|
||||
import com.changhu.module.miniProgram.service.SecurityUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* security_user (保安人员) 服务实现类
|
||||
* author: luozhun
|
||||
* desc 由groovy脚本自动生成
|
||||
*/
|
||||
@Service
|
||||
public class SecurityUserServiceImpl extends ServiceImpl<SecurityUserMapper, SecurityUser> implements SecurityUserService {
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.changhu.module.miniProgram.mapper.SecurityUserMapper">
|
||||
<select id="securityUserPager"
|
||||
resultType="com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo">
|
||||
select su.*,
|
||||
sun.name as 'securityUnitName'
|
||||
from security_unit sun
|
||||
join security_user su on su.security_unit_id = sun.snow_flake_id and su.delete_flag = 0
|
||||
where sun.delete_flag = 0
|
||||
and su.service_project_id = #{params.serviceProjectId}
|
||||
order by su.create_time desc
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue