Merge remote-tracking branch 'origin/main'

This commit is contained in:
wangyilin 2024-09-14 09:54:47 +08:00
commit 0a6f824a8f
20 changed files with 619 additions and 4 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -12,13 +12,14 @@ export default defineAppConfig({
navigationBarBackgroundColor: '#4e87ff', navigationBarBackgroundColor: '#4e87ff',
navigationBarTitleText: '', navigationBarTitleText: '',
navigationBarTextStyle:'white', navigationBarTextStyle:'white',
backgroundColor: "#008080"
}, },
subpackages: [ subpackages: [
{ {
root: "subPages", root: "subPages",
pages: [ pages: [
'pages/policeManager/index', 'pages/policeManager/index',
'pages/policeDetails/index',
'pages/myProject/myProject', 'pages/myProject/myProject',
'pages/projectDetails/projectDetails', 'pages/projectDetails/projectDetails',
'pages/form/form' 'pages/form/form'

View File

@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '项目详情',
})

View File

@ -0,0 +1,53 @@
.projectDetails{
height: 100vh;
overflow: hidden;
background: #f1f1f1;
display: flex;
flex-direction: column;
.projectDetailsItem{
height: 18%;
margin: 20px;
border-radius: 10px;
background: #ffffff;
padding: 15px;
font-size: 28px;
line-height: 65px;
color: #333333;
.projectDetailsIndex{
.content{
color: #9b9b9f;
}
}
}
.projectDetailsTableDrop{
height: 80%;
.projectDetailsTable{
margin: 20px;
border-radius: 10px;
background: #ffffff;
padding: 15px;
font-size: 28px;
line-height: 50px;
color: #333333;
.projectDetailsTableItem{
//display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
font-size: 24px;
margin-bottom: 15px
}
}
}
.projectDetailsButton{
position: fixed;
bottom: 19px;
display: flex;
-webkit-justify-content: space-around;
margin-bottom: 10rpx;
right: 0;
width: 100%;
}
}

View File

@ -0,0 +1,133 @@
<template>
<view class="projectDetails">
<view class="projectDetailsItem">
<view style="display: flex;justify-content: space-between">
<text style="font-size: 18px">{{ nameValue ? nameValue : '' }}{{ '-----' + detailsList?.name }}项目</text>
<!--<text>进行中</text>-->
</view>
<view class="projectDetailsIndex">
<nut-row>
<nut-col :span="12">
<view class="content">工作人员数量:{{ detailsList?.staffTotal }}</view>
</nut-col>
<nut-col :span="12">
<view class="content">保安人员数量:{{ detailsList?.securityUserTotal }}</view>
</nut-col>
</nut-row>
<nut-row>
<nut-col :span="12">
<view class="content">服务区域面积:{{ detailsList?.serviceArea }}</view>
</nut-col>
<nut-col :span="12">
<view class="content">楼栋数量:{{ detailsList?.buildingTotal }}</view>
</nut-col>
</nut-row>
<nut-row>
<nut-col :span="16">
<view class="content">证件号{{ detailsList?.idNumber }}</view>
</nut-col>
<nut-col :span="8">
<view class="content">户数:{{ detailsList?.houseTotal }}</view>
</nut-col>
</nut-row>
</view>
</view>
<!--表格-->
<view class="projectDetailsTableDrop">
<view style="padding: 0 12px">项目人员</view>
<scroll-view :scroll-y="true" style="height: 80%;" @scrolltoupper="upper" @scrolltolower="lower"
:scroll-into-view="toView" :scroll-top="scrollTop" :refresherEnabled="true"
@refresherrefresh="onRefresherRefresh" :refresher-triggered="isRefresher"
>
<view class="projectDetailsTable" v-for="(item,index) in projectData" :key="index">
<view>
<view class="projectDetailsTableItem">
<view>
<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>
</view>
<view style="display: flex;justify-content: space-between">
<text>保安证件:{{ item.securityNumber ? item.securityNumber : '125241256451' }}</text>
<text>出生年月:{{ dayjs(item.dateOfBirth).format('YYYY-MM-DD') }}</text>
</view>
<view style="display: flex;justify-content: space-between">
<text>创建时间:{{ item.createTime }}</text>
<text>身份证:{{ item.idCard }}</text>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
</view>
</template>
<script setup lang="ts">
import Taro, {useLoad} from "@tarojs/taro";
import './index.scss'
import {ref} from "vue";
import api from "@/request/index";
import * as dayjs from 'dayjs'
const detailsList = ref()
const nameValue = ref('')
const projectData = ref<Records<string>[]>([])
useLoad(async (options: MyProjectList) => {
nameValue.value = options.name
detailsList.value = await JSON.parse(options.item)
await projectDetailsTable()
})
const projectDetailsTable = async () => {
// if (total.value === projectData.value.length) return
Taro.showLoading({
title: '加载中',
})
const queryParams = {
params: {
serviceProjectId: detailsList.value?.snowFlakeId,
},
page: {
size: 4,
current: current.value
}
}
const resp = await api.post<ProjectData>('/miniProgramUser/securityUserPager', queryParams)
projectData.value = [...projectData.value, ...resp?.data.records]
total.value = resp?.data.total
isRefresher.value = false
Taro.hideLoading()
}
const formAdd = () => {
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(detailsList.value)}`})
}
const total = ref<any>(null)
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) => {
projectData.value = []
total.value = null
current.value = 1 //
isRefresher.value = true
console.log('自定义下拉刷新被触发:', e)
projectDetailsTable()
}
</script>

View File

@ -13,7 +13,9 @@
<text>电话{{ item?.contactPersonInfo.telephone }}</text> <text>电话{{ item?.contactPersonInfo.telephone }}</text>
</view> </view>
<view class="project"> <view class="project">
<view v-for="(items,index) in item.serviceProjectList" :key="index">{{ items.name }}</view> <view @click="projectClick(items,item?.name)" v-for="(items,index) in item.serviceProjectList" :key="index">
{{ items.name }}
</view>
</view> </view>
</view> </view>
</view> </view>
@ -35,6 +37,14 @@ const getMyServiceProject = async () => {
myProjectList.value = resp.data myProjectList.value = resp.data
console.log(resp.data) console.log(resp.data)
} }
const projectClick = (items: ServiceProjectList, name: string) => {
console.log(name, JSON.stringify(items))
Taro.navigateTo({
url: `/subPages/pages/policeDetails/index?name=${name}&item=${JSON.stringify(items)}`,
})
}
onMounted(async () => { onMounted(async () => {
await getMyServiceProject() await getMyServiceProject()
}) })

View File

@ -1,8 +1,12 @@
package com.changhu.module.miniProgram.controller; package com.changhu.module.miniProgram.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams; 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.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.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid; import jakarta.validation.Valid;
@ -29,4 +33,10 @@ public class MiniProgramUserController {
public void register(@RequestBody @Valid MiniProgramUserRegisterParams params) { public void register(@RequestBody @Valid MiniProgramUserRegisterParams params) {
miniProgramUserService.register(params); miniProgramUserService.register(params);
} }
@Operation(summary = "服务项目保安人员分页")
@PostMapping("/securityUserPager")
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return miniProgramUserService.securityUserPager(queryParams);
}
} }

View File

@ -3,13 +3,14 @@ package com.changhu.module.miniProgram.controller;
import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.annotation.UserType; 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.pojo.vo.IndexServiceProjectListVo;
import com.changhu.module.miniProgram.service.ProjectManageIndexService; import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List; import java.util.List;
@ -32,4 +33,16 @@ public class ProjectManageIndexController {
public List<IndexServiceProjectListVo> getMyServiceProjectList() { public List<IndexServiceProjectListVo> getMyServiceProjectList() {
return projectManageIndexService.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);
}
} }

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1,8 +1,12 @@
package com.changhu.module.miniProgram.service; package com.changhu.module.miniProgram.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser; import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams; 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 (小程序用户) 服务类 * mini_program_user (小程序用户) 服务类
@ -17,4 +21,12 @@ public interface MiniProgramUserService extends IService<MiniProgramUser> {
* @param params 参数 * @param params 参数
*/ */
void register(MiniProgramUserRegisterParams params); void register(MiniProgramUserRegisterParams params);
/**
* 服务项目内的保安人员分页
*
* @param queryParams 查询参数
* @return 保安人员
*/
Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams);
} }

View File

@ -1,5 +1,6 @@
package com.changhu.module.miniProgram.service; package com.changhu.module.miniProgram.service;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import java.util.List; import java.util.List;
@ -16,4 +17,18 @@ public interface ProjectManageIndexService {
* @return 服务项目列表 * @return 服务项目列表
*/ */
List<IndexServiceProjectListVo> getMyServiceProjectList(); List<IndexServiceProjectListVo> getMyServiceProjectList();
/**
* 根据id删除保安人员
*
* @param securityUserId 保安人员id
*/
void deleteSecurityUserByServiceProjectId(Long securityUserId);
/**
* 保存或更新保安人员
*
* @param params 保安人员参数
*/
void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params);
} }

View File

@ -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> {
}

View File

@ -4,13 +4,19 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.SnowFlakeIdUtil; import com.changhu.common.utils.SnowFlakeIdUtil;
import com.changhu.module.miniProgram.mapper.MiniProgramUserMapper; 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.MiniProgramUser;
import com.changhu.module.miniProgram.pojo.entity.SecurityUser;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams; 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.module.miniProgram.service.MiniProgramUserService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -26,6 +32,9 @@ public class MiniProgramUserServiceImpl extends ServiceImpl<MiniProgramUserMappe
@Autowired @Autowired
private WxMaService wxMaService; private WxMaService wxMaService;
@Autowired
private SecurityUserMapper securityUserMapper;
@Override @Override
public void register(MiniProgramUserRegisterParams params) { public void register(MiniProgramUserRegisterParams params) {
MiniProgramUser miniProgramUser = BeanUtil.copyProperties(params, MiniProgramUser.class); MiniProgramUser miniProgramUser = BeanUtil.copyProperties(params, MiniProgramUser.class);
@ -47,4 +56,9 @@ public class MiniProgramUserServiceImpl extends ServiceImpl<MiniProgramUserMappe
throw new MessageException(); throw new MessageException();
} }
} }
@Override
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return securityUserMapper.securityUserPager(queryParams.getPage(), queryParams.getParams());
}
} }

View File

@ -1,13 +1,20 @@
package com.changhu.module.miniProgram.service.impl; 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.common.utils.UserUtil;
import com.changhu.module.management.mapper.ServiceProjectMapper; 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.pojo.vo.IndexServiceProjectListVo;
import com.changhu.module.miniProgram.service.ProjectManageIndexService; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Optional;
/** /**
* @author 20252 * @author 20252
@ -24,4 +31,47 @@ public class ProjectManageIndexServiceImpl implements ProjectManageIndexService
public List<IndexServiceProjectListVo> getMyServiceProjectList() { public List<IndexServiceProjectListVo> getMyServiceProjectList() {
return serviceProjectMapper.getServiceProjectList(null, UserUtil.getUserId()); 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();
}
}
} }

View File

@ -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 {
}

View File

@ -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>