运维模块补充
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
package org.dromara.system.api;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.dromara.system.api.domain.vo.RemoteProjectVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
@ -22,4 +25,13 @@ public interface RemoteProjectService {
|
||||
* @param userId
|
||||
*/
|
||||
void validAuth(Long projectId, Long userId);
|
||||
|
||||
/**
|
||||
* 判断项目是否存在
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
RemoteProjectVo getById(Long projectId);
|
||||
|
||||
void validAuth(List<Long> projectIdList, Long userId);
|
||||
}
|
||||
|
||||
@ -0,0 +1,159 @@
|
||||
package org.dromara.system.api.domain.vo;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 项目视图对象 project
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-03-04
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class RemoteProjectVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 项目简称
|
||||
*/
|
||||
private String shortName;
|
||||
|
||||
/**
|
||||
* 父项目id
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 项目图片
|
||||
*/
|
||||
private String picUrl;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private String lng;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private String lat;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
private String projectType;
|
||||
|
||||
/**
|
||||
* 项目阶段
|
||||
*/
|
||||
private String projectStage;
|
||||
|
||||
/**
|
||||
* 项目地址
|
||||
*/
|
||||
private String projectSite;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private String principal;
|
||||
|
||||
/**
|
||||
* 负责人电话
|
||||
*/
|
||||
private String principalPhone;
|
||||
|
||||
/**
|
||||
* 实际容量
|
||||
*/
|
||||
private String actual;
|
||||
|
||||
/**
|
||||
* 计划容量
|
||||
*/
|
||||
private String plan;
|
||||
|
||||
/**
|
||||
* 开工时间
|
||||
*/
|
||||
private String onStreamTime;
|
||||
|
||||
/**
|
||||
* 打卡范围(09:00,18:00)
|
||||
*/
|
||||
private String punchRange;
|
||||
|
||||
/**
|
||||
* 打卡时间开始
|
||||
*/
|
||||
private String playCardStart;
|
||||
|
||||
/**
|
||||
* 打卡时间结束
|
||||
*/
|
||||
private String playCardEnd;
|
||||
|
||||
/**
|
||||
* 设计总量
|
||||
*/
|
||||
private Long designTotal;
|
||||
|
||||
/**
|
||||
* 安全协议书
|
||||
*/
|
||||
private String securityAgreement;
|
||||
|
||||
/**
|
||||
* 招标文件
|
||||
*/
|
||||
private String tenderFiles;
|
||||
|
||||
/**
|
||||
* 显示隐藏(0显示 1隐藏)
|
||||
*/
|
||||
private String showHidden;
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
private Long sort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@ -1,11 +1,23 @@
|
||||
package org.dromara.system.dubbo;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.system.api.RemoteProjectService;
|
||||
import org.dromara.system.api.domain.vo.RemoteProjectVo;
|
||||
import org.dromara.system.domain.BusProject;
|
||||
import org.dromara.system.domain.BusUserProjectRelevancy;
|
||||
import org.dromara.system.service.IBusProjectService;
|
||||
import org.dromara.system.service.IBusUserProjectRelevancyService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025-09-11 18:33
|
||||
@ -32,4 +44,17 @@ public class RemoteProjectServiceImpl implements RemoteProjectService {
|
||||
public void validAuth(Long projectId, Long userId) {
|
||||
projectService.validAuth(projectId, userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteProjectVo getById(Long projectId) {
|
||||
BusProject byId = projectService.getById(projectId);
|
||||
RemoteProjectVo remoteProjectVo = new RemoteProjectVo();
|
||||
BeanUtils.copyProperties(byId, remoteProjectVo);
|
||||
return remoteProjectVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validAuth(List<Long> projectIdList, Long userId) {
|
||||
projectService.validAuth(projectIdList, userId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,106 @@
|
||||
package org.dromara.personnel.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.personnel.domain.vo.OpsWorkWageVo;
|
||||
import org.dromara.personnel.domain.bo.OpsWorkWageBo;
|
||||
import org.dromara.personnel.service.IOpsWorkWageService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 工种薪水
|
||||
* 前端访问路由地址为:/personnel/workWage
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-17
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/workWage")
|
||||
public class OpsWorkWageController extends BaseController {
|
||||
|
||||
private final IOpsWorkWageService opsWorkWageService;
|
||||
|
||||
/**
|
||||
* 查询工种薪水列表
|
||||
*/
|
||||
@SaCheckPermission("personnel:workWage:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<OpsWorkWageVo> list(OpsWorkWageBo bo, PageQuery pageQuery) {
|
||||
return opsWorkWageService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出工种薪水列表
|
||||
*/
|
||||
@SaCheckPermission("personnel:workWage:export")
|
||||
@Log(title = "工种薪水", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(OpsWorkWageBo bo, HttpServletResponse response) {
|
||||
List<OpsWorkWageVo> list = opsWorkWageService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "工种薪水", OpsWorkWageVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工种薪水详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("personnel:workWage:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<OpsWorkWageVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(opsWorkWageService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工种薪水
|
||||
*/
|
||||
@SaCheckPermission("personnel:workWage:add")
|
||||
@Log(title = "工种薪水", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody OpsWorkWageBo bo) {
|
||||
return toAjax(opsWorkWageService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工种薪水
|
||||
*/
|
||||
@SaCheckPermission("personnel:workWage:edit")
|
||||
@Log(title = "工种薪水", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody OpsWorkWageBo bo) {
|
||||
return toAjax(opsWorkWageService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工种薪水
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("personnel:workWage:remove")
|
||||
@Log(title = "工种薪水", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("ids") Long[] ids) {
|
||||
return toAjax(opsWorkWageService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package org.dromara.personnel.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 工种薪水对象 ops_work_wage
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-17
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("ops_work_wage")
|
||||
public class OpsWorkWage extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 工种
|
||||
*/
|
||||
private String workType;
|
||||
|
||||
/**
|
||||
* 是否是特种兵(1是 2否)
|
||||
*/
|
||||
private String isSpecialType;
|
||||
|
||||
/**
|
||||
* 工资计算方式(1计时 2计件)
|
||||
*/
|
||||
private String wageCalculationType;
|
||||
|
||||
/**
|
||||
* 工资标准
|
||||
*/
|
||||
private Long wage;
|
||||
|
||||
/**
|
||||
* 工资计量单位
|
||||
*/
|
||||
private String wageMeasureUnit;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package org.dromara.personnel.domain.bo;
|
||||
|
||||
import org.dromara.personnel.domain.OpsWorkWage;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 工种薪水业务对象 ops_work_wage
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-17
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = OpsWorkWage.class, reverseConvertGenerate = false)
|
||||
public class OpsWorkWageBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@NotNull(message = "项目id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 工种
|
||||
*/
|
||||
@NotBlank(message = "工种不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String workType;
|
||||
|
||||
/**
|
||||
* 是否是特种兵(1是 2否)
|
||||
*/
|
||||
private String isSpecialType;
|
||||
|
||||
/**
|
||||
* 工资计算方式(1计时 2计件)
|
||||
*/
|
||||
@NotBlank(message = "工资计算方式(1计时 2计件)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String wageCalculationType;
|
||||
|
||||
/**
|
||||
* 工资标准
|
||||
*/
|
||||
@NotNull(message = "工资标准不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long wage;
|
||||
|
||||
/**
|
||||
* 工资计量单位
|
||||
*/
|
||||
@NotBlank(message = "工资计量单位不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String wageMeasureUnit;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@NotBlank(message = "备注不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package org.dromara.personnel.domain.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025/4/10 11:16
|
||||
*/
|
||||
@Getter
|
||||
public enum BusWageMeasureUnitEnum {
|
||||
|
||||
TIME("计时:元/每天", "1"),
|
||||
PIECE("计件:元/每个", "2");
|
||||
|
||||
private final String text;
|
||||
|
||||
private final String value;
|
||||
|
||||
BusWageMeasureUnitEnum(String text, String value) {
|
||||
this.text = text;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
package org.dromara.personnel.domain.vo;
|
||||
|
||||
import org.dromara.personnel.domain.OpsWorkWage;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 工种薪水视图对象 ops_work_wage
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-17
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = OpsWorkWage.class)
|
||||
public class OpsWorkWageVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@ExcelProperty(value = "项目id")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 工种
|
||||
*/
|
||||
@ExcelProperty(value = "工种")
|
||||
private String workType;
|
||||
|
||||
/**
|
||||
* 是否是特种兵(1是 2否)
|
||||
*/
|
||||
@ExcelProperty(value = "是否是特种兵", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "1=是,2=否")
|
||||
private String isSpecialType;
|
||||
|
||||
/**
|
||||
* 工资计算方式(1计时 2计件)
|
||||
*/
|
||||
@ExcelProperty(value = "工资计算方式", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "1=计时,2=计件")
|
||||
private String wageCalculationType;
|
||||
|
||||
/**
|
||||
* 工资标准
|
||||
*/
|
||||
@ExcelProperty(value = "工资标准")
|
||||
private Long wage;
|
||||
|
||||
/**
|
||||
* 工资计量单位
|
||||
*/
|
||||
@ExcelProperty(value = "工资计量单位")
|
||||
private String wageMeasureUnit;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package org.dromara.personnel.mapper;
|
||||
|
||||
import org.dromara.personnel.domain.OpsWorkWage;
|
||||
import org.dromara.personnel.domain.vo.OpsWorkWageVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 工种薪水Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-17
|
||||
*/
|
||||
public interface OpsWorkWageMapper extends BaseMapperPlus<OpsWorkWage, OpsWorkWageVo> {
|
||||
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package org.dromara.personnel.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.personnel.domain.OpsUserFiles;
|
||||
import org.dromara.personnel.domain.vo.OpsUserFilesVo;
|
||||
import org.dromara.personnel.domain.bo.OpsUserFilesBo;
|
||||
@ -15,7 +16,7 @@ import java.util.List;
|
||||
* @author LionLi
|
||||
* @date 2025-09-17
|
||||
*/
|
||||
public interface IOpsUserFilesService {
|
||||
public interface IOpsUserFilesService extends IService<OpsUserFiles> {
|
||||
|
||||
/**
|
||||
* 查询运维人员文件
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
package org.dromara.personnel.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.personnel.domain.OpsUser;
|
||||
import org.dromara.personnel.domain.OpsUserFiles;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.personnel.domain.bo.OpsUserBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@ -14,7 +17,7 @@ import java.util.List;
|
||||
* @author LionLi
|
||||
* @date 2025-09-16
|
||||
*/
|
||||
public interface IOpsUserService {
|
||||
public interface IOpsUserService extends IService<OpsUser> {
|
||||
|
||||
/**
|
||||
* 查询运维人员
|
||||
|
||||
@ -0,0 +1,70 @@
|
||||
package org.dromara.personnel.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.personnel.domain.OpsWorkWage;
|
||||
import org.dromara.personnel.domain.vo.OpsWorkWageVo;
|
||||
import org.dromara.personnel.domain.bo.OpsWorkWageBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工种薪水Service接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-17
|
||||
*/
|
||||
public interface IOpsWorkWageService extends IService<OpsWorkWage> {
|
||||
|
||||
/**
|
||||
* 查询工种薪水
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 工种薪水
|
||||
*/
|
||||
OpsWorkWageVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询工种薪水列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 工种薪水分页列表
|
||||
*/
|
||||
TableDataInfo<OpsWorkWageVo> queryPageList(OpsWorkWageBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的工种薪水列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 工种薪水列表
|
||||
*/
|
||||
List<OpsWorkWageVo> queryList(OpsWorkWageBo bo);
|
||||
|
||||
/**
|
||||
* 新增工种薪水
|
||||
*
|
||||
* @param bo 工种薪水
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(OpsWorkWageBo bo);
|
||||
|
||||
/**
|
||||
* 修改工种薪水
|
||||
*
|
||||
* @param bo 工种薪水
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(OpsWorkWageBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除工种薪水信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package org.dromara.personnel.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@ -9,6 +10,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.personnel.domain.OpsWorkWage;
|
||||
import org.dromara.personnel.mapper.OpsWorkWageMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.personnel.domain.bo.OpsUserFilesBo;
|
||||
import org.dromara.personnel.domain.vo.OpsUserFilesVo;
|
||||
@ -29,7 +32,7 @@ import java.util.Collection;
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class OpsUserFilesServiceImpl implements IOpsUserFilesService {
|
||||
public class OpsUserFilesServiceImpl extends ServiceImpl<OpsUserFilesMapper, OpsUserFiles> implements IOpsUserFilesService {
|
||||
|
||||
private final OpsUserFilesMapper baseMapper;
|
||||
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
package org.dromara.personnel.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdcardUtil;
|
||||
import cn.hutool.core.util.PhoneUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
@ -13,9 +17,15 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.personnel.domain.OpsUserFiles;
|
||||
import org.dromara.personnel.domain.OpsWorkWage;
|
||||
import org.dromara.personnel.mapper.OpsWorkWageMapper;
|
||||
import org.dromara.personnel.service.IOpsUserFilesService;
|
||||
import org.dromara.personnel.service.IOpsWorkWageService;
|
||||
import org.dromara.system.api.RemoteProjectService;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
import org.dromara.system.api.utils.IdCardEncryptorUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.personnel.domain.bo.OpsUserBo;
|
||||
@ -37,13 +47,21 @@ import java.util.Collection;
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class OpsUserServiceImpl implements IOpsUserService {
|
||||
public class OpsUserServiceImpl extends ServiceImpl<OpsUserMapper, OpsUser> implements IOpsUserService {
|
||||
|
||||
private final OpsUserMapper baseMapper;
|
||||
|
||||
private final RemoteProjectService remoteProjectService;
|
||||
@Autowired
|
||||
private RemoteProjectService remoteProjectService;
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
@Autowired
|
||||
private IdCardEncryptorUtil idCardEncryptorUtil;
|
||||
|
||||
@Autowired
|
||||
private IOpsWorkWageService opsWorkWageService;
|
||||
@Autowired
|
||||
private IOpsUserFilesService opsUserFilesService;
|
||||
|
||||
/**
|
||||
* 查询运维人员
|
||||
@ -52,7 +70,7 @@ public class OpsUserServiceImpl implements IOpsUserService {
|
||||
* @return 运维人员
|
||||
*/
|
||||
@Override
|
||||
public OpsUserVo queryById(Long id){
|
||||
public OpsUserVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@ -130,7 +148,7 @@ public class OpsUserServiceImpl implements IOpsUserService {
|
||||
@Override
|
||||
public Boolean insertByBo(OpsUserBo bo) {
|
||||
OpsUser add = MapstructUtils.convert(bo, OpsUser.class);
|
||||
validEntityBeforeSave(add);
|
||||
validEntityBeforeSave(add, true);
|
||||
Long userId = LoginHelper.getUserId();
|
||||
remoteProjectService.validAuth(bo.getProjectId(), userId);
|
||||
String phone = add.getPhone();
|
||||
@ -138,10 +156,15 @@ public class OpsUserServiceImpl implements IOpsUserService {
|
||||
if (userVo == null) {
|
||||
throw new ServiceException("当前用户未在系统注册", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
add.setSysUserId(userVo.getUserId());
|
||||
String encrypt = idCardEncryptorUtil.encrypt(bo.getSfzNumber());
|
||||
add.setSfzNumber(encrypt);
|
||||
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
if (!flag) {
|
||||
throw new ServiceException("新增施工人员失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
bo.setId(add.getId());
|
||||
return flag;
|
||||
}
|
||||
|
||||
@ -154,15 +177,45 @@ public class OpsUserServiceImpl implements IOpsUserService {
|
||||
@Override
|
||||
public Boolean updateByBo(OpsUserBo bo) {
|
||||
OpsUser update = MapstructUtils.convert(bo, OpsUser.class);
|
||||
validEntityBeforeSave(update);
|
||||
validEntityBeforeSave(update, false);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(OpsUser entity){
|
||||
private void validEntityBeforeSave(OpsUser entity, Boolean create) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
// 校验项目id和对应项目是否存在
|
||||
Long projectId = entity.getProjectId();
|
||||
// 校验分包公司id和对应项目是否存在
|
||||
String typeOfWork = entity.getTypeOfWork();
|
||||
String wageMeasureUnit = entity.getWageMeasureUnit();
|
||||
String phone = entity.getPhone();
|
||||
String sfzNumber = entity.getSfzNumber();
|
||||
if (projectId == null) {
|
||||
throw new ServiceException("项目 id 不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
if (remoteProjectService.getById(projectId) == null) {
|
||||
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(wageMeasureUnit) && StringUtils.isNotEmpty(typeOfWork)) {
|
||||
LambdaQueryWrapper<OpsWorkWage> lqw = Wrappers.lambdaQuery(OpsWorkWage.class)
|
||||
.eq(OpsWorkWage::getProjectId, projectId)
|
||||
.eq(OpsWorkWage::getWorkType, typeOfWork)
|
||||
.eq(OpsWorkWage::getWageMeasureUnit, wageMeasureUnit);
|
||||
long count = opsWorkWageService.getBaseMapper().selectCount(lqw);
|
||||
if (count <= 0) {
|
||||
throw new ServiceException("当前工种没有定义工资标准,请前往工种薪水设置进行设置后再选择", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotEmpty(phone) && !PhoneUtil.isPhone(phone)) {
|
||||
throw new ServiceException("手机号码格式不正确", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(sfzNumber) && !IdcardUtil.isValidCard(sfzNumber)) {
|
||||
throw new ServiceException("身份证号码格式不正确", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -174,9 +227,38 @@ public class OpsUserServiceImpl implements IOpsUserService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
Long userId = LoginHelper.getUserId();
|
||||
List<OpsUser> constructionUserList = this.listByIds(ids);
|
||||
if (isValid) {
|
||||
// 做一些业务上的校验,判断是否需要校验
|
||||
// 获取项目id列表
|
||||
List<Long> projectIdList = constructionUserList.stream().map(OpsUser::getProjectId).toList();
|
||||
// 判断是否有权限操作对应项目下的内容
|
||||
remoteProjectService.validAuth(projectIdList, userId);
|
||||
// 判断待删除的人员是否存在于班组
|
||||
// LambdaQueryWrapper<BusProjectTeamMember> projectTeamMemberLqw = Wrappers.lambdaQuery(BusProjectTeamMember.class)
|
||||
// .in(BusProjectTeamMember::getMemberId, ids);
|
||||
// if (projectTeamMemberService.count(projectTeamMemberLqw) > 0) {
|
||||
// throw new ServiceException("删除施工人员信息失败,施工人员存在于班组中", HttpStatus.BAD_REQUEST);
|
||||
// }
|
||||
}
|
||||
// 判断对应数据是否都存在
|
||||
if (constructionUserList.size() != ids.size()) {
|
||||
throw new ServiceException("删除施工人员信息失败,数据缺失", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
// 批量删除施工人员下的文件信息
|
||||
LambdaQueryWrapper<OpsUserFiles> constructionUserFileLqw = Wrappers.lambdaQuery(OpsUserFiles.class)
|
||||
.in(OpsUserFiles::getOpsUserId, ids);
|
||||
List<OpsUserFiles> fileList = opsUserFilesService.list(constructionUserFileLqw);
|
||||
if (CollUtil.isNotEmpty(fileList)) {
|
||||
boolean removeFile = opsUserFilesService.remove(constructionUserFileLqw);
|
||||
if (!removeFile) {
|
||||
throw new ServiceException("删除施工人员信息失败,施工人员文件信息删除失败", HttpStatus.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,193 @@
|
||||
package org.dromara.personnel.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.personnel.domain.enums.BusWageMeasureUnitEnum;
|
||||
import org.dromara.system.api.RemoteProjectService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.personnel.domain.bo.OpsWorkWageBo;
|
||||
import org.dromara.personnel.domain.vo.OpsWorkWageVo;
|
||||
import org.dromara.personnel.domain.OpsWorkWage;
|
||||
import org.dromara.personnel.mapper.OpsWorkWageMapper;
|
||||
import org.dromara.personnel.service.IOpsWorkWageService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 工种薪水Service业务层处理
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-17
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class OpsWorkWageServiceImpl extends ServiceImpl<OpsWorkWageMapper,OpsWorkWage> implements IOpsWorkWageService {
|
||||
|
||||
private final OpsWorkWageMapper baseMapper;
|
||||
|
||||
@Autowired
|
||||
private RemoteProjectService remoteProjectService;
|
||||
|
||||
/**
|
||||
* 查询工种薪水
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 工种薪水
|
||||
*/
|
||||
@Override
|
||||
public OpsWorkWageVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询工种薪水列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 工种薪水分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<OpsWorkWageVo> queryPageList(OpsWorkWageBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<OpsWorkWage> lqw = buildQueryWrapper(bo);
|
||||
Page<OpsWorkWageVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的工种薪水列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 工种薪水列表
|
||||
*/
|
||||
@Override
|
||||
public List<OpsWorkWageVo> queryList(OpsWorkWageBo bo) {
|
||||
LambdaQueryWrapper<OpsWorkWage> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<OpsWorkWage> buildQueryWrapper(OpsWorkWageBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<OpsWorkWage> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(OpsWorkWage::getId);
|
||||
lqw.eq(bo.getProjectId() != null, OpsWorkWage::getProjectId, bo.getProjectId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getWorkType()), OpsWorkWage::getWorkType, bo.getWorkType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getIsSpecialType()), OpsWorkWage::getIsSpecialType, bo.getIsSpecialType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getWageCalculationType()), OpsWorkWage::getWageCalculationType, bo.getWageCalculationType());
|
||||
lqw.eq(bo.getWage() != null, OpsWorkWage::getWage, bo.getWage());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getWageMeasureUnit()), OpsWorkWage::getWageMeasureUnit, bo.getWageMeasureUnit());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工种薪水
|
||||
*
|
||||
* @param bo 工种薪水
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(OpsWorkWageBo bo) {
|
||||
OpsWorkWage add = MapstructUtils.convert(bo, OpsWorkWage.class);
|
||||
validEntityBeforeSave(add,true);
|
||||
// 判断是否存在
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<OpsWorkWage>()
|
||||
.eq(OpsWorkWage::getProjectId, bo.getProjectId())
|
||||
.eq(OpsWorkWage::getWorkType, bo.getWorkType())
|
||||
.eq(OpsWorkWage::getWageCalculationType, bo.getWageCalculationType()));
|
||||
if (count > 0) {
|
||||
throw new ServiceException("该项目已存在该工种薪水信息", HttpStatus.CONFLICT);
|
||||
}
|
||||
// 填充默认值
|
||||
String wageCalculationType = bo.getWageCalculationType();
|
||||
switch (wageCalculationType) {
|
||||
case "1":
|
||||
add.setWageMeasureUnit(BusWageMeasureUnitEnum.TIME.getValue());
|
||||
break;
|
||||
case "2":
|
||||
add.setWageMeasureUnit(BusWageMeasureUnitEnum.PIECE.getValue());
|
||||
break;
|
||||
default:
|
||||
throw new ServiceException("工资计算方式错误", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工种薪水
|
||||
*
|
||||
* @param bo 工种薪水
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(OpsWorkWageBo bo) {
|
||||
OpsWorkWage update = MapstructUtils.convert(bo, OpsWorkWage.class);
|
||||
validEntityBeforeSave(update,false);
|
||||
// 判断是否存在
|
||||
OpsWorkWage oldWorkWage = baseMapper.selectById(update.getId());
|
||||
if (oldWorkWage == null) {
|
||||
throw new ServiceException("修改工种薪水失败,数据不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(OpsWorkWage entity, Boolean create){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
// 做一些数据校验,如唯一约束
|
||||
Long userId = LoginHelper.getUserId();
|
||||
Long projectId = entity.getProjectId();
|
||||
if (create) {
|
||||
if (projectId == null) {
|
||||
throw new ServiceException("项目id不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
if (projectId != null && remoteProjectService.getById(projectId) == null) {
|
||||
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
remoteProjectService.validAuth(projectId, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除工种薪水信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
// 获取当前登录用户
|
||||
Long userId = LoginHelper.getUserId();
|
||||
// 获取待删除数据详情
|
||||
List<OpsWorkWage> workWageList = baseMapper.selectByIds(ids);
|
||||
if (isValid) {
|
||||
// TODO 做一些业务上的校验,判断是否需要校验
|
||||
List<Long> projectIdList = workWageList.stream().map(OpsWorkWage::getProjectId).toList();
|
||||
remoteProjectService.validAuth(projectIdList, userId);
|
||||
}
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
<?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="org.dromara.personnel.mapper.OpsWorkWageMapper">
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user