# Conflicts:
#	dl-module-base/src/main/java/cn/iocoder/yudao/common/BaseConstants.java
#	dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarMainServiceImpl.java
This commit is contained in:
PQZ 2024-08-09 08:19:15 +08:00
commit bfe3cb2f5f
65 changed files with 2924 additions and 34 deletions

View File

@ -31,4 +31,12 @@ public class BaseConstants {
public static final String COMPUTE_TYPE_BY = "by";
/**计算下次检测时间*/
public static final String COMPUTE_TYPE_JC = "jc";
/**企业管理-员工管理表名称*/
public static final String COMPANY_STAFF = "company_staff";
/**员工标识*/
public static final String COMPANY_SING_STAFF = "staff";
/** 标签默认外观 */
public static final String LABEL_TYPE = "default";
/** 唯一推广码生成长度 */
public static final Integer UNIQUE_CODE_LEN = 6;
}

View File

@ -0,0 +1,10 @@
package cn.iocoder.yudao.common;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
import cn.iocoder.yudao.module.system.enums.ErrorCodeConstants;
public interface CommonErrorCodeConstants extends ErrorCodeConstants {
/** 企业管理-员工管理 */
ErrorCode UNIQUE_CODE_CREATE_REPEAT = new ErrorCode(2_002_000_000, "唯一推广码生成失败");
}

View File

@ -0,0 +1,90 @@
package cn.iocoder.yudao.module.custom.controller.admin;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.custom.entity.Property;
import cn.iocoder.yudao.module.custom.service.PropertyService;
import cn.iocoder.yudao.module.custom.vo.PropertyReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 企业管理-资产")
@RestController
@RequestMapping("/company/property")
@Validated
public class PropertyController {
@Resource
private PropertyService propertyService;
@PostMapping("/create")
@Operation(summary = "创建企业管理-资产")
@PreAuthorize("@ss.hasPermission('company:property:create')")
public CommonResult<String> createProperty(@RequestBody PropertyReqVO createReqVO) {
return success(propertyService.createProperty(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新企业管理-资产")
@PreAuthorize("@ss.hasPermission('company:property:update')")
public CommonResult<Boolean> updateProperty(@RequestBody PropertyReqVO updateReqVO) {
propertyService.updateProperty(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除企业管理-资产")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('company:property:delete')")
public CommonResult<Boolean> deleteProperty(@RequestParam("id") String id) {
propertyService.deleteProperty(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得企业管理-资产")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('company:property:query')")
public CommonResult<PropertyRespVO> getProperty(@RequestParam("id") String id) {
Property property = propertyService.getProperty(id);
return success(BeanUtils.toBean(property, PropertyRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得企业管理-资产分页")
@PreAuthorize("@ss.hasPermission('company:property:query')")
public CommonResult<IPage<PropertyRespVO>> getPropertyPage(PropertyReqVO pageReqVO) {
IPage<PropertyRespVO> pageResult = propertyService.getPropertyPage(pageReqVO);
return success(pageResult);
}
@GetMapping("/export-excel")
@Operation(summary = "导出企业管理-资产 Excel")
@PreAuthorize("@ss.hasPermission('company:property:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportPropertyExcel(PropertyReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<PropertyRespVO> list = propertyService.getPropertyPage(pageReqVO).getRecords();
// 导出 Excel
ExcelUtils.write(response, "企业管理-资产.xls", "数据", PropertyRespVO.class, list);
}
}

View File

@ -0,0 +1,90 @@
package cn.iocoder.yudao.module.custom.controller.admin;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.custom.entity.PropertyDealDO;
import cn.iocoder.yudao.module.custom.service.PropertyDealService;
import cn.iocoder.yudao.module.custom.vo.PropertyDealReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyDealRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 企业管理-资产处置单/变动单")
@RestController
@RequestMapping("/company/property-deal")
@Validated
public class PropertyDealController {
@Resource
private PropertyDealService propertyDealService;
@PostMapping("/create")
@Operation(summary = "创建企业管理-资产处置单/变动单")
@PreAuthorize("@ss.hasPermission('company:property-deal:create')")
public CommonResult<String> createPropertyDeal(@RequestBody PropertyDealReqVO createReqVO) {
return success(propertyDealService.createPropertyDeal(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新企业管理-资产处置单/变动单")
@PreAuthorize("@ss.hasPermission('company:property-deal:update')")
public CommonResult<Boolean> updatePropertyDeal(@RequestBody PropertyDealReqVO updateReqVO) {
propertyDealService.updatePropertyDeal(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除企业管理-资产处置单/变动单")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('company:property-deal:delete')")
public CommonResult<Boolean> deletePropertyDeal(@RequestParam("id") String id) {
propertyDealService.deletePropertyDeal(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得企业管理-资产处置单/变动单")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('company:property-deal:query')")
public CommonResult<PropertyDealRespVO> getPropertyDeal(@RequestParam("id") String id) {
PropertyDealDO propertyDeal = propertyDealService.getPropertyDeal(id);
return success(BeanUtils.toBean(propertyDeal, PropertyDealRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得企业管理-资产处置单/变动单分页")
@PreAuthorize("@ss.hasPermission('company:property-deal:query')")
public CommonResult<IPage<PropertyDealRespVO>> getPropertyDealPage(PropertyDealReqVO pageReqVO) {
IPage<PropertyDealRespVO> propertyDealPage = propertyDealService.getPropertyDealPage(pageReqVO);
return success(propertyDealPage);
}
@GetMapping("/export-excel")
@Operation(summary = "导出企业管理-资产处置单/变动单 Excel")
@PreAuthorize("@ss.hasPermission('company:property-deal:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportPropertyDealExcel(PropertyDealReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<PropertyDealRespVO> list = propertyDealService.getPropertyDealPage(pageReqVO).getRecords();
// 导出 Excel
ExcelUtils.write(response, "企业管理-资产处置单/变动单.xls", "数据", PropertyDealRespVO.class,list);
}
}

View File

@ -0,0 +1,90 @@
package cn.iocoder.yudao.module.custom.controller.admin;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.custom.entity.PropertyDealItemDO;
import cn.iocoder.yudao.module.custom.service.PropertyDealItemService;
import cn.iocoder.yudao.module.custom.vo.PropertyDealItemReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyDealItemRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 企业管理-资产处置子")
@RestController
@RequestMapping("/company/property-deal-item")
@Validated
public class PropertyDealItemController {
@Resource
private PropertyDealItemService propertyDealItemService;
@PostMapping("/create")
@Operation(summary = "创建企业管理-资产处置子")
@PreAuthorize("@ss.hasPermission('company:property-deal-item:create')")
public CommonResult<String> createPropertyDealItem(@RequestBody PropertyDealItemReqVO createReqVO) {
return success(propertyDealItemService.createPropertyDealItem(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新企业管理-资产处置子")
@PreAuthorize("@ss.hasPermission('company:property-deal-item:update')")
public CommonResult<Boolean> updatePropertyDealItem(@RequestBody PropertyDealItemReqVO updateReqVO) {
propertyDealItemService.updatePropertyDealItem(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除企业管理-资产处置子")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('company:property-deal-item:delete')")
public CommonResult<Boolean> deletePropertyDealItem(@RequestParam("id") String id) {
propertyDealItemService.deletePropertyDealItem(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得企业管理-资产处置子")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('company:property-deal-item:query')")
public CommonResult<PropertyDealItemRespVO> getPropertyDealItem(@RequestParam("id") String id) {
PropertyDealItemDO propertyDealItem = propertyDealItemService.getPropertyDealItem(id);
return success(BeanUtils.toBean(propertyDealItem, PropertyDealItemRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得企业管理-资产处置子分页")
@PreAuthorize("@ss.hasPermission('company:property-deal-item:query')")
public CommonResult<IPage<PropertyDealItemRespVO>> getPropertyDealItemPage(PropertyDealItemReqVO pageReqVO) {
IPage<PropertyDealItemRespVO> propertyDealItemPage = propertyDealItemService.getPropertyDealItemPage(pageReqVO);
return success(propertyDealItemPage);
}
@GetMapping("/export-excel")
@Operation(summary = "导出企业管理-资产处置子 Excel")
@PreAuthorize("@ss.hasPermission('company:property-deal-item:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportPropertyDealItemExcel(PropertyDealItemReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<PropertyDealItemRespVO> list = propertyDealItemService.getPropertyDealItemPage(pageReqVO).getRecords();
// 导出 Excel
ExcelUtils.write(response, "企业管理-资产处置子.xls", "数据", PropertyDealItemRespVO.class,list);
}
}

View File

@ -0,0 +1,90 @@
package cn.iocoder.yudao.module.custom.controller.admin;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.custom.entity.PropertyKeep;
import cn.iocoder.yudao.module.custom.service.PropertyKeepService;
import cn.iocoder.yudao.module.custom.vo.PropertyKeepReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyKeepRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 资产维修/保养记录")
@RestController
@RequestMapping("/company/property-keep")
@Validated
public class PropertyKeepController {
@Resource
private PropertyKeepService propertyKeepService;
@PostMapping("/create")
@Operation(summary = "创建资产维修/保养记录")
@PreAuthorize("@ss.hasPermission('company:property-keep:create')")
public CommonResult<String> createPropertyKeep(@RequestBody PropertyKeepReqVO createReqVO) {
return success(propertyKeepService.createPropertyKeep(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新资产维修/保养记录")
@PreAuthorize("@ss.hasPermission('company:property-keep:update')")
public CommonResult<Boolean> updatePropertyKeep(@RequestBody PropertyKeepReqVO updateReqVO) {
propertyKeepService.updatePropertyKeep(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除资产维修/保养记录")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('company:property-keep:delete')")
public CommonResult<Boolean> deletePropertyKeep(@RequestParam("id") String id) {
propertyKeepService.deletePropertyKeep(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得资产维修/保养记录")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('company:property-keep:query')")
public CommonResult<PropertyKeepRespVO> getPropertyKeep(@RequestParam("id") String id) {
PropertyKeep propertyKeep = propertyKeepService.getPropertyKeep(id);
return success(BeanUtils.toBean(propertyKeep, PropertyKeepRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得资产维修/保养记录分页")
@PreAuthorize("@ss.hasPermission('company:property-keep:query')")
public CommonResult<IPage<PropertyKeepRespVO>> getPropertyKeepPage(PropertyKeepReqVO pageReqVO) {
IPage<PropertyKeepRespVO> pageResult = propertyKeepService.getPropertyKeepPage(pageReqVO);
return success(pageResult);
}
@GetMapping("/export-excel")
@Operation(summary = "导出资产维修/保养记录 Excel")
@PreAuthorize("@ss.hasPermission('company:property-keep:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportPropertyKeepExcel(PropertyKeepReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<PropertyKeepRespVO> list = propertyKeepService.getPropertyKeepPage(pageReqVO).getRecords();
// 导出 Excel
ExcelUtils.write(response, "资产维修/保养记录.xls", "数据", PropertyKeepRespVO.class, list);
}
}

View File

@ -0,0 +1,90 @@
package cn.iocoder.yudao.module.custom.controller.admin;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.custom.entity.PropertyPosDO;
import cn.iocoder.yudao.module.custom.service.PropertyPosService;
import cn.iocoder.yudao.module.custom.vo.PropertyPosReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyPosRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 企业管理-资产存放位置")
@RestController
@RequestMapping("/company/property-pos")
@Validated
public class PropertyPosController {
@Resource
private PropertyPosService propertyPosService;
@PostMapping("/create")
@Operation(summary = "创建企业管理-资产存放位置")
@PreAuthorize("@ss.hasPermission('company:property-pos:create')")
public CommonResult<String> createPropertyPos(@RequestBody PropertyPosReqVO createReqVO) {
return success(propertyPosService.createPropertyPos(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新企业管理-资产存放位置")
@PreAuthorize("@ss.hasPermission('company:property-pos:update')")
public CommonResult<Boolean> updatePropertyPos(@RequestBody PropertyPosReqVO updateReqVO) {
propertyPosService.updatePropertyPos(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除企业管理-资产存放位置")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('company:property-pos:delete')")
public CommonResult<Boolean> deletePropertyPos(@RequestParam("id") String id) {
propertyPosService.deletePropertyPos(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得企业管理-资产存放位置")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('company:property-pos:query')")
public CommonResult<PropertyPosRespVO> getPropertyPos(@RequestParam("id") String id) {
PropertyPosDO propertyPos = propertyPosService.getPropertyPos(id);
return success(BeanUtils.toBean(propertyPos, PropertyPosRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得企业管理-资产存放位置分页")
@PreAuthorize("@ss.hasPermission('company:property-pos:query')")
public CommonResult<IPage<PropertyPosRespVO>> getPropertyPosPage(PropertyPosReqVO pageReqVO) {
IPage<PropertyPosRespVO> pageResult = propertyPosService.getPropertyPosPage(pageReqVO);
return success(pageResult);
}
@GetMapping("/export-excel")
@Operation(summary = "导出企业管理-资产存放位置 Excel")
@PreAuthorize("@ss.hasPermission('company:property-pos:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportPropertyPosExcel(PropertyPosReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<PropertyPosRespVO> list = propertyPosService.getPropertyPosPage(pageReqVO).getRecords();
// 导出 Excel
ExcelUtils.write(response, "企业管理-资产存放位置.xls", "数据", PropertyPosRespVO.class,list);
}
}

View File

@ -0,0 +1,150 @@
package cn.iocoder.yudao.module.custom.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
import java.time.LocalDate;
/**
* 企业管理-资产 DO
*
* @author 后台管理员
*/
@TableName("company_property")
@KeySequence("company_property_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Property extends TenantBaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.INPUT)
private String id;
/**
* 企业id
*/
private String corpId;
/**
* 部门id
*/
private Long deptId;
/**
* 存放位置
*/
private String posId;
/**
* 使用人id
*/
private String userId;
/**
* 资产编号
*/
private String propNo;
/**
* 资产名称
*/
private String propName;
/**
* 资产分类
*/
private String propCatg;
/**
* 预计使用年限
*/
private Integer useYear;
/**
* 价值类型
*
* 枚举 {@link TODO company_cost_type 对应的类}
*/
private String costType;
/**
* 资产数量
*/
private Integer propNum;
/**
* 资产原值
*/
private BigDecimal costTotal;
/**
* 资产状态
*
* 枚举 {@link TODO company_prop_status 对应的类}
*/
private String propStatus;
/**
* 品牌
*/
private String brand;
/**
* 规格型号
*/
private String spec;
/**
* 生产厂家
*/
private String factory;
/**
* 出场序列号/编号
*/
private String serialNo;
/**
* 数量计量单位
*/
private String unit;
/**
* 取得日期
*/
private LocalDate getDate;
/**
* 出厂日期
*/
private LocalDate prodDate;
/**
* 供应商
*/
private String supplier;
/**
* 启用日期
*/
private LocalDate openDate;
/**
* 净值
*/
private BigDecimal netValue;
/**
* 凭证号
*/
private String voucherNo;
/**
* 维修/保养周期单位
*/
private String keepCycleType;
/**
* 维修/保养周期
*/
private Integer keepCycle;
/**
* 上次维修/保养日期
*/
private LocalDate lastKeepDate;
/**
* 下次维修/保养日期
*/
private LocalDate nextKeepDate;
/**
* 附件urls
*/
private String fileUrls;
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.custom.entity;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.time.LocalDate;
/**
* 企业管理-资产处置单/变动单 DO
*
* @author 后台管理员
*/
@TableName("company_property_deal")
@KeySequence("company_property_deal_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PropertyDealDO extends BaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.INPUT)
private String id;
/**
* 企业idbase_company表中的id
*/
private String corpId;
/**
* 部门idsystem_dept表中的id用来做数据权限控制
*/
private Long deptId;
/**
* 数据类型
*
* 枚举 {@link TODO property_data_type 对应的类}
*/
private String dataType;
/**
* 处置/变动单号
*/
private String dealNo;
/**
* 处置/变动日期
*/
private LocalDate dealDate;
}

View File

@ -0,0 +1,81 @@
package cn.iocoder.yudao.module.custom.entity;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* 企业管理-资产处置子 DO
*
* @author 后台管理员
*/
@TableName("company_property_deal_item")
@KeySequence("company_property_deal_item_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PropertyDealItemDO extends BaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.INPUT)
private String id;
/**
* 处置单/变动单id
*/
private String dealId;
/**
* 资产id
*/
private String propertyId;
/**
* 处置方式
*
* 枚举 {@link TODO company_deal_way 对应的类}
*/
private String dealWay;
/**
* 原企业id
*/
private String oldCorpId;
/**
* 调入企业id
*/
private String corpId;
/**
* 原部门id
*/
private Long oldDeptId;
/**
* 调入部门id
*/
private Long deptId;
/**
* 原存放地id
*/
private String oldPosId;
/**
* 调入存放地id
*/
private String posId;
/**
* 原使用人id
*/
private Long oldUserId;
/**
* 调入使用人id
*/
private Long userId;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,49 @@
package cn.iocoder.yudao.module.custom.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.time.LocalDate;
/**
* 资产维修/保养记录 DO
*
* @author 后台管理员
*/
@TableName("company_property_keep")
@KeySequence("company_property_keep_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PropertyKeep extends TenantBaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.INPUT)
private String id;
/**
* 资产id
*/
private String propertyId;
/**
* 维修/保养日期
*/
private LocalDate keepDate;
/**
* 备注
*/
private String remark;
/**
* 附件urls
*/
private String fileUrls;
}

View File

@ -0,0 +1,59 @@
package cn.iocoder.yudao.module.custom.entity;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
/**
* 企业管理-资产存放位置 DO
*
* @author vinjor-m
*/
@TableName("company_property_pos")
@KeySequence("company_property_pos_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PropertyPosDO extends BaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.INPUT)
private String id;
/**
* 企业idbase_company表中的id
*/
private String corpId;
/**
* 部门idsystem_dept表中的id用来做数据权限控制
*/
private Long deptId;
/**
* 存放地名称
*/
private String posName;
/**
* 存放地地址
*/
private String address;
/**
* 面积
*/
private BigDecimal area;
/**
* 存放类型
*
* 枚举 {@link TODO company_deposit_type 对应的类}
*/
private String depositType;
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.custom.mapper;
import cn.iocoder.yudao.module.custom.entity.PropertyDealItemDO;
import cn.iocoder.yudao.module.custom.vo.PropertyDealItemReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyDealItemRespVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
/**
* 企业管理-资产处置子 Mapper
*
* @author 后台管理员
*/
@Mapper
public interface PropertyDealItemMapper extends BaseMapper<PropertyDealItemDO> {
default IPage<PropertyDealItemRespVO> selectPage(PropertyDealItemReqVO reqVO) {
return null;
}
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.custom.mapper;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.custom.entity.PropertyDealDO;
import cn.iocoder.yudao.module.custom.vo.PropertyDealReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyDealRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
/**
* 企业管理-资产处置单/变动单 Mapper
*
* @author 后台管理员
*/
@Mapper
public interface PropertyDealMapper extends BaseMapperX<PropertyDealDO> {
default IPage<PropertyDealRespVO> selectPage(PropertyDealReqVO reqVO) {
return null;
}
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.custom.mapper;
import cn.iocoder.yudao.module.custom.entity.PropertyKeep;
import cn.iocoder.yudao.module.custom.vo.PropertyKeepReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyKeepRespVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
/**
* 资产维修/保养记录 Mapper
*
* @author 后台管理员
*/
@Mapper
public interface PropertyKeepMapper extends BaseMapper<PropertyKeep> {
default IPage<PropertyKeepRespVO> selectPage(PropertyKeepReqVO reqVO) {
return null;
}
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.custom.mapper;
import cn.iocoder.yudao.module.custom.entity.Property;
import cn.iocoder.yudao.module.custom.vo.PropertyReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyRespVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
/**
* 企业管理-资产 Mapper
*
* @author 后台管理员
*/
@Mapper
public interface PropertyMapper extends BaseMapper<Property> {
default IPage<PropertyRespVO> selectPage(PropertyReqVO reqVO) {
return null;
}
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.custom.mapper;
import cn.iocoder.yudao.module.custom.entity.PropertyPosDO;
import cn.iocoder.yudao.module.custom.vo.PropertyPosReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyPosRespVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
/**
* 企业管理-资产存放位置 Mapper
*
* @author vinjor-m
*/
@Mapper
public interface PropertyPosMapper extends BaseMapper<PropertyPosDO> {
default IPage<PropertyPosRespVO> selectPage(PropertyPosReqVO reqVO) {
return null;
}
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.custom.service;
import cn.iocoder.yudao.module.custom.entity.PropertyDealItemDO;
import cn.iocoder.yudao.module.custom.vo.PropertyDealItemReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyDealItemRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 企业管理-资产处置子 Service 接口
*
* @author 后台管理员
*/
public interface PropertyDealItemService extends IService<PropertyDealItemDO> {
/**
* 创建企业管理-资产处置子
*
* @param createReqVO 创建信息
* @return 编号
*/
String createPropertyDealItem(PropertyDealItemReqVO createReqVO);
/**
* 更新企业管理-资产处置子
*
* @param updateReqVO 更新信息
*/
void updatePropertyDealItem(PropertyDealItemReqVO updateReqVO);
/**
* 删除企业管理-资产处置子
*
* @param id 编号
*/
void deletePropertyDealItem(String id);
/**
* 获得企业管理-资产处置子
*
* @param id 编号
* @return 企业管理-资产处置子
*/
PropertyDealItemDO getPropertyDealItem(String id);
/**
* 获得企业管理-资产处置子分页
*
* @param pageReqVO 分页查询
* @return 企业管理-资产处置子分页
*/
IPage<PropertyDealItemRespVO> getPropertyDealItemPage(PropertyDealItemReqVO pageReqVO);
}

View File

@ -0,0 +1,54 @@
package cn.iocoder.yudao.module.custom.service;
import cn.iocoder.yudao.module.custom.entity.PropertyDealDO;
import cn.iocoder.yudao.module.custom.vo.PropertyDealReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyDealRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 企业管理-资产处置单/变动单 Service 接口
*
* @author 后台管理员
*/
public interface PropertyDealService extends IService<PropertyDealDO> {
/**
* 创建企业管理-资产处置单/变动单
*
* @param createReqVO 创建信息
* @return 编号
*/
String createPropertyDeal(PropertyDealReqVO createReqVO);
/**
* 更新企业管理-资产处置单/变动单
*
* @param updateReqVO 更新信息
*/
void updatePropertyDeal(PropertyDealReqVO updateReqVO);
/**
* 删除企业管理-资产处置单/变动单
*
* @param id 编号
*/
void deletePropertyDeal(String id);
/**
* 获得企业管理-资产处置单/变动单
*
* @param id 编号
* @return 企业管理-资产处置单/变动单
*/
PropertyDealDO getPropertyDeal(String id);
/**
* 获得企业管理-资产处置单/变动单分页
*
* @param pageReqVO 分页查询
* @return 企业管理-资产处置单/变动单分页
*/
IPage<PropertyDealRespVO> getPropertyDealPage(PropertyDealReqVO pageReqVO);
}

View File

@ -0,0 +1,54 @@
package cn.iocoder.yudao.module.custom.service;
import cn.iocoder.yudao.module.custom.entity.PropertyKeep;
import cn.iocoder.yudao.module.custom.vo.PropertyKeepReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyKeepRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 资产维修/保养记录 Service 接口
*
* @author 后台管理员
*/
public interface PropertyKeepService extends IService<PropertyKeep> {
/**
* 创建资产维修/保养记录
*
* @param createReqVO 创建信息
* @return 编号
*/
String createPropertyKeep(PropertyKeepReqVO createReqVO);
/**
* 更新资产维修/保养记录
*
* @param updateReqVO 更新信息
*/
void updatePropertyKeep(PropertyKeepReqVO updateReqVO);
/**
* 删除资产维修/保养记录
*
* @param id 编号
*/
void deletePropertyKeep(String id);
/**
* 获得资产维修/保养记录
*
* @param id 编号
* @return 资产维修/保养记录
*/
PropertyKeep getPropertyKeep(String id);
/**
* 获得资产维修/保养记录分页
*
* @param pageReqVO 分页查询
* @return 资产维修/保养记录分页
*/
IPage<PropertyKeepRespVO> getPropertyKeepPage(PropertyKeepReqVO pageReqVO);
}

View File

@ -0,0 +1,54 @@
package cn.iocoder.yudao.module.custom.service;
import cn.iocoder.yudao.module.custom.entity.PropertyPosDO;
import cn.iocoder.yudao.module.custom.vo.PropertyPosReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyPosRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 企业管理-资产存放位置 Service 接口
*
* @author vinjor-m
*/
public interface PropertyPosService extends IService<PropertyPosDO> {
/**
* 创建企业管理-资产存放位置
*
* @param createReqVO 创建信息
* @return 编号
*/
String createPropertyPos(PropertyPosReqVO createReqVO);
/**
* 更新企业管理-资产存放位置
*
* @param updateReqVO 更新信息
*/
void updatePropertyPos(PropertyPosReqVO updateReqVO);
/**
* 删除企业管理-资产存放位置
*
* @param id 编号
*/
void deletePropertyPos(String id);
/**
* 获得企业管理-资产存放位置
*
* @param id 编号
* @return 企业管理-资产存放位置
*/
PropertyPosDO getPropertyPos(String id);
/**
* 获得企业管理-资产存放位置分页
*
* @param pageReqVO 分页查询
* @return 企业管理-资产存放位置分页
*/
IPage<PropertyPosRespVO> getPropertyPosPage(PropertyPosReqVO pageReqVO);
}

View File

@ -0,0 +1,54 @@
package cn.iocoder.yudao.module.custom.service;
import cn.iocoder.yudao.module.custom.entity.Property;
import cn.iocoder.yudao.module.custom.vo.PropertyReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 企业管理-资产 Service 接口
*
* @author 后台管理员
*/
public interface PropertyService extends IService<Property> {
/**
* 创建企业管理-资产
*
* @param createReqVO 创建信息
* @return 编号
*/
String createProperty(PropertyReqVO createReqVO);
/**
* 更新企业管理-资产
*
* @param updateReqVO 更新信息
*/
void updateProperty(PropertyReqVO updateReqVO);
/**
* 删除企业管理-资产
*
* @param id 编号
*/
void deleteProperty(String id);
/**
* 获得企业管理-资产
*
* @param id 编号
* @return 企业管理-资产
*/
Property getProperty(String id);
/**
* 获得企业管理-资产分页
*
* @param pageReqVO 分页查询
* @return 企业管理-资产分页
*/
IPage<PropertyRespVO> getPropertyPage(PropertyReqVO pageReqVO);
}

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.custom.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.entity.CustomerCar;
import cn.iocoder.yudao.module.custom.mapper.CarMainMapper;
@ -18,7 +19,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
@ -74,9 +74,10 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
if(brandAndModel.size()>1){
//填入了型号
carMain.setCarModel(brandAndModel.get(1));
}else {
carMain.setCarModel("");
}
//todo 计算下次保养时间下次保养里程下次年检时间保险到期时间
baseMapper.insert(carMain);
// 返回
return CommonResult.success("新增成功");
@ -109,7 +110,10 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
if(brandAndModel.size()>1){
//填入了型号
carMain.setCarModel(brandAndModel.get(1));
}else {
carMain.setCarModel("");
}
//todo 计算下次保养时间下次保养里程下次年检时间保险到期时间
baseMapper.updateById(carMain);
return CommonResult.success("修改成功");
}
@ -285,6 +289,4 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
}
}

View File

@ -0,0 +1,56 @@
package cn.iocoder.yudao.module.custom.service.impl;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.custom.entity.PropertyDealItemDO;
import cn.iocoder.yudao.module.custom.mapper.PropertyDealItemMapper;
import cn.iocoder.yudao.module.custom.service.PropertyDealItemService;
import cn.iocoder.yudao.module.custom.vo.PropertyDealItemReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyDealItemRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 企业管理-资产处置子 Service 实现类
*
* @author 后台管理员
*/
@Service
@Validated
public class PropertyDealItemServiceImpl extends ServiceImpl<PropertyDealItemMapper, PropertyDealItemDO> implements PropertyDealItemService {
@Override
public String createPropertyDealItem(PropertyDealItemReqVO createReqVO) {
// 插入
PropertyDealItemDO propertyDealItem = BeanUtils.toBean(createReqVO, PropertyDealItemDO.class);
baseMapper.insert(propertyDealItem);
// 返回
return propertyDealItem.getId();
}
@Override
public void updatePropertyDealItem(PropertyDealItemReqVO updateReqVO) {
// 更新
PropertyDealItemDO updateObj = BeanUtils.toBean(updateReqVO, PropertyDealItemDO.class);
baseMapper.updateById(updateObj);
}
@Override
public void deletePropertyDealItem(String id) {
// 删除
baseMapper.deleteById(id);
}
@Override
public PropertyDealItemDO getPropertyDealItem(String id) {
return baseMapper.selectById(id);
}
@Override
public IPage<PropertyDealItemRespVO> getPropertyDealItemPage(PropertyDealItemReqVO pageReqVO) {
return baseMapper.selectPage(pageReqVO);
}
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.custom.service.impl;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.custom.entity.PropertyDealDO;
import cn.iocoder.yudao.module.custom.mapper.PropertyDealMapper;
import cn.iocoder.yudao.module.custom.service.PropertyDealService;
import cn.iocoder.yudao.module.custom.vo.PropertyDealReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyDealRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 企业管理-资产处置单/变动单 Service 实现类
*
* @author 后台管理员
*/
@Service
@Validated
public class PropertyDealServiceImpl extends ServiceImpl<PropertyDealMapper,PropertyDealDO> implements PropertyDealService {
@Override
public String createPropertyDeal(PropertyDealReqVO createReqVO) {
// 插入
PropertyDealDO propertyDeal = BeanUtils.toBean(createReqVO, PropertyDealDO.class);
baseMapper.insert(propertyDeal);
// 返回
return propertyDeal.getId();
}
@Override
public void updatePropertyDeal(PropertyDealReqVO updateReqVO) {
// 更新
PropertyDealDO updateObj = BeanUtils.toBean(updateReqVO, PropertyDealDO.class);
baseMapper.updateById(updateObj);
}
@Override
public void deletePropertyDeal(String id) {
// 删除
baseMapper.deleteById(id);
}
@Override
public PropertyDealDO getPropertyDeal(String id) {
return baseMapper.selectById(id);
}
@Override
public IPage<PropertyDealRespVO> getPropertyDealPage(PropertyDealReqVO pageReqVO) {
return baseMapper.selectPage(pageReqVO);
}
}

View File

@ -0,0 +1,56 @@
package cn.iocoder.yudao.module.custom.service.impl;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.custom.entity.PropertyKeep;
import cn.iocoder.yudao.module.custom.mapper.PropertyKeepMapper;
import cn.iocoder.yudao.module.custom.service.PropertyKeepService;
import cn.iocoder.yudao.module.custom.vo.PropertyKeepReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyKeepRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 资产维修/保养记录 Service 实现类
*
* @author 后台管理员
*/
@Service
@Validated
public class PropertyKeepServiceImpl extends ServiceImpl<PropertyKeepMapper, PropertyKeep> implements PropertyKeepService {
@Override
public String createPropertyKeep(PropertyKeepReqVO createReqVO) {
// 插入
PropertyKeep propertyKeep = BeanUtils.toBean(createReqVO, PropertyKeep.class);
baseMapper.insert(propertyKeep);
// 返回
return propertyKeep.getId();
}
@Override
public void updatePropertyKeep(PropertyKeepReqVO updateReqVO) {
// 更新
PropertyKeep updateObj = BeanUtils.toBean(updateReqVO, PropertyKeep.class);
baseMapper.updateById(updateObj);
}
@Override
public void deletePropertyKeep(String id) {
// 删除
baseMapper.deleteById(id);
}
@Override
public PropertyKeep getPropertyKeep(String id) {
return baseMapper.selectById(id);
}
@Override
public IPage<PropertyKeepRespVO> getPropertyKeepPage(PropertyKeepReqVO pageReqVO) {
return baseMapper.selectPage(pageReqVO);
}
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.custom.service.impl;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.custom.entity.PropertyPosDO;
import cn.iocoder.yudao.module.custom.mapper.PropertyPosMapper;
import cn.iocoder.yudao.module.custom.service.PropertyPosService;
import cn.iocoder.yudao.module.custom.vo.PropertyPosReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyPosRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 企业管理-资产存放位置 Service 实现类
*
* @author vinjor-m
*/
@Service
@Validated
public class PropertyPosServiceImpl extends ServiceImpl<PropertyPosMapper, PropertyPosDO> implements PropertyPosService {
@Override
public String createPropertyPos(PropertyPosReqVO createReqVO) {
// 插入
PropertyPosDO propertyPos = BeanUtils.toBean(createReqVO, PropertyPosDO.class);
baseMapper.insert(propertyPos);
// 返回
return propertyPos.getId();
}
@Override
public void updatePropertyPos(PropertyPosReqVO updateReqVO) {
// 更新
PropertyPosDO updateObj = BeanUtils.toBean(updateReqVO, PropertyPosDO.class);
baseMapper.updateById(updateObj);
}
@Override
public void deletePropertyPos(String id) {
// 删除
baseMapper.deleteById(id);
}
@Override
public PropertyPosDO getPropertyPos(String id) {
return baseMapper.selectById(id);
}
@Override
public IPage<PropertyPosRespVO> getPropertyPosPage(PropertyPosReqVO pageReqVO) {
return baseMapper.selectPage(pageReqVO);
}
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.custom.service.impl;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.custom.entity.Property;
import cn.iocoder.yudao.module.custom.mapper.PropertyMapper;
import cn.iocoder.yudao.module.custom.service.PropertyService;
import cn.iocoder.yudao.module.custom.vo.PropertyReqVO;
import cn.iocoder.yudao.module.custom.vo.PropertyRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 企业管理-资产 Service 实现类
*
* @author 后台管理员
*/
@Service
@Validated
public class PropertyServiceImpl extends ServiceImpl<PropertyMapper, Property> implements PropertyService {
@Override
public String createProperty(PropertyReqVO createReqVO) {
// 插入
Property property = BeanUtils.toBean(createReqVO, Property.class);
baseMapper.insert(property);
// 返回
return property.getId();
}
@Override
public void updateProperty(PropertyReqVO updateReqVO) {
// 更新
Property updateObj = BeanUtils.toBean(updateReqVO, Property.class);
baseMapper.updateById(updateObj);
}
@Override
public void deleteProperty(String id) {
// 删除
baseMapper.deleteById(id);
}
@Override
public Property getProperty(String id) {
return baseMapper.selectById(id);
}
@Override
public IPage<PropertyRespVO> getPropertyPage(PropertyReqVO pageReqVO) {
return baseMapper.selectPage(pageReqVO);
}
}

View File

@ -0,0 +1,63 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 企业管理-资产处置子分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PropertyDealItemReqVO extends PageParam {
@Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "18095")
private String id;
@Schema(description = "处置单/变动单id", example = "12936")
private String dealId;
@Schema(description = "资产id", example = "14421")
private String propertyId;
@Schema(description = "处置方式")
private String dealWay;
@Schema(description = "原企业id", example = "17291")
private String oldCorpId;
@Schema(description = "调入企业id", example = "21009")
private String corpId;
@Schema(description = "原部门id", example = "23846")
private Long oldDeptId;
@Schema(description = "调入部门id", example = "3881")
private Long deptId;
@Schema(description = "原存放地id", example = "8837")
private String oldPosId;
@Schema(description = "调入存放地id", example = "28147")
private String posId;
@Schema(description = "原使用人id", example = "23983")
private Long oldUserId;
@Schema(description = "调入使用人id", example = "918")
private Long userId;
@Schema(description = "备注", example = "你说的对")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 企业管理-资产处置子 Response VO")
@Data
@ExcelIgnoreUnannotated
public class PropertyDealItemRespVO {
@Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "18095")
@ExcelProperty("主键标识")
private String id;
@Schema(description = "处置单/变动单id", example = "12936")
@ExcelProperty("处置单/变动单id")
private String dealId;
@Schema(description = "资产id", example = "14421")
@ExcelProperty("资产id")
private String propertyId;
@Schema(description = "处置方式")
@ExcelProperty(value = "处置方式", converter = DictConvert.class)
@DictFormat("company_deal_way") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private String dealWay;
@Schema(description = "原企业id", example = "17291")
@ExcelProperty("原企业id")
private String oldCorpId;
@Schema(description = "调入企业id", example = "21009")
@ExcelProperty("调入企业id")
private String corpId;
@Schema(description = "原部门id", example = "23846")
@ExcelProperty("原部门id")
private Long oldDeptId;
@Schema(description = "调入部门id", example = "3881")
@ExcelProperty("调入部门id")
private Long deptId;
@Schema(description = "原存放地id", example = "8837")
@ExcelProperty("原存放地id")
private String oldPosId;
@Schema(description = "调入存放地id", example = "28147")
@ExcelProperty("调入存放地id")
private String posId;
@Schema(description = "原使用人id", example = "23983")
@ExcelProperty("原使用人id")
private Long oldUserId;
@Schema(description = "调入使用人id", example = "918")
@ExcelProperty("调入使用人id")
private Long userId;
@Schema(description = "备注", example = "你说的对")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 企业管理-资产处置单/变动单分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PropertyDealReqVO extends PageParam {
@Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "18095")
private String id;
@Schema(description = "企业idbase_company表中的id", example = "21595")
private String corpId;
@Schema(description = "部门idsystem_dept表中的id用来做数据权限控制", example = "19510")
private Long deptId;
@Schema(description = "数据类型", example = "1")
private String dataType;
@Schema(description = "处置/变动单号")
private String dealNo;
@Schema(description = "处置/变动日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDate[] dealDate;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 企业管理-资产处置单/变动单 Response VO")
@Data
@ExcelIgnoreUnannotated
public class PropertyDealRespVO {
@Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "29577")
@ExcelProperty("主键标识")
private String id;
@Schema(description = "企业idbase_company表中的id", example = "21595")
@ExcelProperty("企业idbase_company表中的id")
private String corpId;
@Schema(description = "部门idsystem_dept表中的id用来做数据权限控制", example = "19510")
@ExcelProperty("部门idsystem_dept表中的id用来做数据权限控制")
private Long deptId;
@Schema(description = "数据类型", example = "1")
@ExcelProperty(value = "数据类型", converter = DictConvert.class)
@DictFormat("property_data_type") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private String dataType;
@Schema(description = "处置/变动单号")
@ExcelProperty("处置/变动单号")
private String dealNo;
@Schema(description = "处置/变动日期")
@ExcelProperty("处置/变动日期")
private LocalDate dealDate;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,41 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
@Schema(description = "管理后台 - 资产维修/保养记录分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PropertyKeepReqVO extends PageParam {
@Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "22729")
private String id;
@Schema(description = "资产id", example = "20917")
private String propertyId;
@Schema(description = "维修/保养日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private LocalDate keepDate;
@Schema(description = "备注", example = "你说的对")
private String remark;
@Schema(description = "附件urls")
private String fileUrls;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private LocalDateTime createTime;
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.module.custom.entity.Property;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 资产维修/保养记录 Response VO")
@Data
@ExcelIgnoreUnannotated
public class PropertyKeepRespVO extends Property {
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,46 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 企业管理-资产存放位置分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PropertyPosReqVO extends PageParam {
@Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "18095")
private String id;
@Schema(description = "企业idbase_company表中的id", example = "5018")
private String corpId;
@Schema(description = "部门idsystem_dept表中的id用来做数据权限控制", example = "25943")
private Long deptId;
@Schema(description = "存放地名称", example = "王五")
private String posName;
@Schema(description = "存放地地址")
private String address;
@Schema(description = "面积")
private BigDecimal area;
@Schema(description = "存放类型", example = "2")
private String depositType;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,51 @@
package cn.iocoder.yudao.module.custom.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 企业管理-资产存放位置 Response VO")
@Data
@ExcelIgnoreUnannotated
public class PropertyPosRespVO {
@Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "19336")
@ExcelProperty("主键标识")
private String id;
@Schema(description = "企业idbase_company表中的id", example = "5018")
@ExcelProperty("企业idbase_company表中的id")
private String corpId;
@Schema(description = "部门idsystem_dept表中的id用来做数据权限控制", example = "25943")
@ExcelProperty("部门idsystem_dept表中的id用来做数据权限控制")
private Long deptId;
@Schema(description = "存放地名称", example = "王五")
@ExcelProperty("存放地名称")
private String posName;
@Schema(description = "存放地地址")
@ExcelProperty("存放地地址")
private String address;
@Schema(description = "面积")
@ExcelProperty("面积")
private BigDecimal area;
@Schema(description = "存放类型", example = "2")
@ExcelProperty(value = "存放类型", converter = DictConvert.class)
@DictFormat("company_deposit_type") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private String depositType;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,115 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
@Schema(description = "管理后台 - 企业管理-资产分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PropertyReqVO extends PageParam {
@Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "22729")
private String id;
@Schema(description = "企业id", example = "9124")
private String corpId;
@Schema(description = "部门id", example = "2480")
private Long deptId;
@Schema(description = "存放位置", example = "7241")
private String posId;
@Schema(description = "使用人id", example = "6217")
private String userId;
@Schema(description = "资产编号")
private String propNo;
@Schema(description = "资产名称", example = "芋艿")
private String propName;
@Schema(description = "资产分类")
private String propCatg;
@Schema(description = "预计使用年限")
private Integer useYear;
@Schema(description = "价值类型", example = "01")
private String costType;
@Schema(description = "资产数量")
private Integer propNum;
@Schema(description = "资产原值(元)")
private BigDecimal costTotal;
@Schema(description = "资产状态", example = "02")
private String propStatus;
@Schema(description = "品牌")
private String brand;
@Schema(description = "规格型号")
private String spec;
@Schema(description = "生产厂家")
private String factory;
@Schema(description = "出场序列号/编号")
private String serialNo;
@Schema(description = "数量计量单位")
private String unit;
@Schema(description = "取得日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private LocalDate[] getDate;
@Schema(description = "出厂日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private LocalDate[] prodDate;
@Schema(description = "供应商")
private String supplier;
@Schema(description = "启用日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private LocalDate[] openDate;
@Schema(description = "净值(元)")
private BigDecimal netValue;
@Schema(description = "凭证号")
private String voucherNo;
@Schema(description = "维修/保养周期单位", example = "2")
private String keepCycleType;
@Schema(description = "维修/保养周期")
private Integer keepCycle;
@Schema(description = "上次维修/保养日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private LocalDate[] lastKeepDate;
@Schema(description = "下次维修/保养日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private LocalDate[] nextKeepDate;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private LocalDateTime createTime;
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.module.custom.entity.Property;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 企业管理-资产 Response VO")
@Data
@ExcelIgnoreUnannotated
public class PropertyRespVO extends Property {
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,12 @@
<?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="cn.iocoder.yudao.module.company.dal.mysql.propertydealitem.PropertyDealItemMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,12 @@
<?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="cn.iocoder.yudao.module.company.dal.mysql.propertydeal.PropertyDealMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,12 @@
<?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="cn.iocoder.yudao.module.company.dal.mysql.propertykeep.PropertyKeepMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,12 @@
<?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="cn.iocoder.yudao.module.company.dal.mysql.property.PropertyMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,12 @@
<?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="cn.iocoder.yudao.module.company.dal.mysql.property.PropertyPosMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -15,6 +15,12 @@
点亮企业管理库
</description>
<dependencies>
<!-- 引用基础库 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>dl-module-base</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-system-api</artifactId>

View File

@ -0,0 +1,53 @@
package cn.iocoder.yudao.module.staff.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
import cn.iocoder.yudao.module.staff.service.CompanyStaffChangeService;
import cn.iocoder.yudao.module.staff.vo.CompanyStaffChangeRespVO;
import cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* 企业管理-员工交接记录 控制层
* @author 小李
* @date 16:19 2024/8/8
**/
@RestController
@RequestMapping("/company/staffChange")
@Tag(name = "管理后台 - 企业管理 - 员工交接")
@Validated
public class CompanyStaffChangeController {
@Resource
private CompanyStaffChangeService staffChangeService;
@PostMapping("/create")
@Operation(summary = "创建企业管理-员工交接表信息")
@PreAuthorize("@ss.hasPermission('company:staff:change')")
public CommonResult<String> createStaffChange(@RequestBody CompanyStaffChangeRespVO staffChangeRespVO){
staffChangeService.createChangeStaff(staffChangeRespVO);
return CommonResult.ok();
}
/**
* 查询交接双方信息
* @author 小李
* @date 18:26 2024/8/8
* @param id 接收方员工ID
**/
@GetMapping("/changeItem")
@Operation(summary = "查询企业管理-员工交接表信息及交接双方")
@PreAuthorize("@ss.hasPermission('company:staff:query')")
public CommonResult<CompanyStaffChangeRespVO> getChangeStaff(@RequestParam("id") String id){
return success(staffChangeService.getChangeStaff(id));
}
}

View File

@ -1,20 +1,20 @@
package cn.iocoder.yudao.module.staff.controller.admin;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.label.entity.Label;
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
import cn.iocoder.yudao.module.staff.vo.CompanyStaffReqVO;
import cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -55,7 +54,7 @@ public class CompanyStaffController {
@GetMapping("/page")
@Operation(summary = "获得企业管理-员工信息表信息分页")
@PreAuthorize("@ss.hasPermission('company:staff:query')")
public CommonResult<IPage<?>> getCompanyPage(CompanyStaffReqVO pageReqVO,
public CommonResult<IPage<?>> getCompanyStaffPage(CompanyStaffReqVO pageReqVO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Page<CompanyStaff> page = new Page<>(pageNo, pageSize);
@ -71,7 +70,7 @@ public class CompanyStaffController {
@PostMapping("/create")
@Operation(summary = "创建企业管理-员工信息表信息")
@PreAuthorize("@ss.hasPermission('company:staff:create')")
public CommonResult<String> createCompany(@RequestBody CompanyStaffRespVO staffRespVO) {
public CommonResult<String> createCompanyStaff(@RequestBody CompanyStaffRespVO staffRespVO) {
staffService.saveStaff(staffRespVO);
return CommonResult.ok();
}
@ -85,7 +84,7 @@ public class CompanyStaffController {
@PutMapping("/update")
@Operation(summary = "更新企业管理-员工信息表信息")
@PreAuthorize("@ss.hasPermission('company:staff:update')")
public CommonResult<Boolean> updateCompany(@RequestBody CompanyStaffRespVO staffRespVO) {
public CommonResult<Boolean> updateCompanyStaff(@RequestBody CompanyStaffRespVO staffRespVO) {
staffService.updateStaff(staffRespVO);
return CommonResult.ok();
}
@ -100,7 +99,7 @@ public class CompanyStaffController {
@Operation(summary = "删除企业管理-员工信息表信息")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('company:staff:delete')")
public CommonResult<Boolean> deleteCompany(@RequestParam("id") String id) {
public CommonResult<Boolean> deleteCompanyStaff(@RequestParam("id") String id) {
staffService.deleteStaff(id);
return success(true);
}
@ -115,16 +114,13 @@ public class CompanyStaffController {
@Operation(summary = "获得企业管理-员工信息表信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('company:staff:query')")
public CommonResult<CompanyStaffRespVO> getCompany(@RequestParam("id") String id) {
CompanyStaff staff = staffService.getById(id);
CompanyStaffRespVO staffRespVO = BeanUtils.toBean(staff, CompanyStaffRespVO.class);
if(StringUtils.isNotEmpty(staffRespVO.getFileIds())){
staffRespVO.setFileIdArray(Arrays.asList(staff.getFileIds().split(StrUtil.COMMA)));
}
public CommonResult<CompanyStaffRespVO> getCompanyStaff(@RequestParam("id") String id) {
CompanyStaffRespVO staffRespVO = staffService.getCompanyStaffById(id);
return success(staffRespVO);
}
/**
* 导出员工信息表
* @author 小李
* @date 18:01 2024/8/6
* @param pageReqVO 查询条件--暂时导出所有
@ -134,7 +130,7 @@ public class CompanyStaffController {
@Operation(summary = "导出企业管理-员工信息表 Excel")
@PreAuthorize("@ss.hasPermission('company:staff:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportCompanyExcel(CompanyStaffReqVO pageReqVO,
public void exportCompanyStaffExcel(CompanyStaffReqVO pageReqVO,
HttpServletResponse response) throws IOException {
List<CompanyStaff> list = staffService.list();
// 导出 Excel
@ -144,4 +140,25 @@ public class CompanyStaffController {
columnWidthMap.put(10, 20);
ExcelUtils.write(response, "企业信息表.xls", "数据", CompanyStaff.class, list,columnWidthMap);
}
/**
* 获取当前功能的标签
* @author 小李
* @date 14:59 2024/8/7
**/
@GetMapping("/labels")
public CommonResult<List<Label>> getLabels(){
return success(staffService.getLabels());
}
/**
* 获取当前登录用户部门下所有员工信息
* @author 小李
* @date 15:54 2024/8/8
**/
@GetMapping("/list")
public CommonResult<List<CompanyStaff>> getStaffList(){
return success(staffService.getStaffList());
}
}

View File

@ -7,11 +7,13 @@ import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
/**
* 企业管理-员工信息实体
@ -24,7 +26,7 @@ import java.time.LocalDate;
@ExcelIgnoreUnannotated
public class CompanyStaff extends TenantBaseDO {
/** 主键标识 */
@TableId(type = IdType.INPUT)
@TableId(type = IdType.ASSIGN_ID)
private String id;
/** 企业idbase_company表中的id */
@ -57,16 +59,20 @@ public class CompanyStaff extends TenantBaseDO {
private String address;
/** 工作日期 */
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ExcelProperty("工作日期")
private LocalDate workDate;
private Date workDate;
/** 工龄 */
@ExcelProperty("工龄")
private BigDecimal workYear;
/** 入职日期 */
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ExcelProperty("入职日期")
private LocalDate joinedDate;
private Date joinedDate;
/** 司龄 */
@ExcelProperty("司龄")
@ -84,6 +90,6 @@ public class CompanyStaff extends TenantBaseDO {
@ExcelProperty("唯一推广码")
private String uniqueCode;
/** 附件idsinfra_file表中的id,多个英文逗号拼接) */
private String fileIds;
/** 附件urlsinfra_file表中的url,多个英文逗号拼接) */
private String fileUrls;
}

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.module.staff.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 企业管理-员工交接记录
* @author 小李
* @date 15:33 2024/8/8
**/
@TableName("company_staff_change")
@Data
@EqualsAndHashCode(callSuper = true)
public class CompanyStaffChange extends TenantBaseDO {
/** 主键标识 */
@TableId(type = IdType.ASSIGN_ID)
private String id;
/** 原用户idsystem_users表的id */
private Long oldUserId;
/** 新用户idsystem_users表的id */
private Long newUserId;
/** 交接时间 */
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date changeTime;
/** 附件urlsinfra_file表中的url多个英文逗号拼接 */
private String fileUrls;
/** 备注 */
private String remark;
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.staff.entity;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 唯一推广码使用记录表
* @author 小李
* @date 9:53 2024/8/8
**/
@TableName("unique_code")
@Data
public class UniqueCode {
/** 唯一推广码(须保证全平台唯一,规则:字母+数字;字母全大写) */
private String uniqueCode;
}

View File

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.staff.mapper;
import cn.iocoder.yudao.module.staff.entity.CompanyStaffChange;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 企业管理-员工交接记录
* @author 小李
* @date 15:38 2024/8/8
**/
@Mapper
public interface CompanyStaffChangeMapper extends BaseMapper<CompanyStaffChange> {
}

View File

@ -8,8 +8,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 企业管理-员工信息表
* @author 小李

View File

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.staff.mapper;
import cn.iocoder.yudao.module.staff.entity.UniqueCode;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 唯一推广码使用记录表
* @author 小李
* @date 9:56 2024/8/8
**/
@Mapper
public interface UniqueCodeMapper extends BaseMapper<UniqueCode> {
}

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.staff.service;
import cn.iocoder.yudao.module.staff.entity.CompanyStaffChange;
import cn.iocoder.yudao.module.staff.vo.CompanyStaffChangeRespVO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* 企业管理-员工交接记录 接口
* @author 小李
* @date 15:40 2024/8/8
**/
public interface CompanyStaffChangeService extends IService<CompanyStaffChange> {
/**
* 创建交接记录
* @author 小李
* @date 16:15 2024/8/8
* @param staffChangeRespVO
**/
void createChangeStaff(CompanyStaffChangeRespVO staffChangeRespVO);
/**
* 查询交接双方信息
* @author 小李
* @date 18:26 2024/8/8
* @param id 接收方员工ID
**/
CompanyStaffChangeRespVO getChangeStaff(String id);
}

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.staff.service;
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
import cn.iocoder.yudao.module.label.entity.Label;
import cn.iocoder.yudao.module.staff.vo.CompanyStaffReqVO;
import cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -8,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.Valid;
import java.util.List;
/**
* 企业管理-员工信息表 服务
@ -47,4 +49,26 @@ public interface CompanyStaffService extends IService<CompanyStaff> {
* @param id 员工ID
**/
void deleteStaff(String id);
/**
* 获取当前功能的标签
* @author 小李
* @date 14:59 2024/8/7
**/
List<Label> getLabels();
/**
* 查询员工
* @author 小李
* @date 17:59 2024/8/6
* @param id
**/
CompanyStaffRespVO getCompanyStaffById(String id);
/**
* 获取当前登录用户部门下所有员工信息
* @author 小李
* @date 15:54 2024/8/8
**/
List<CompanyStaff> getStaffList();
}

View File

@ -0,0 +1,21 @@
package cn.iocoder.yudao.module.staff.service;
import cn.iocoder.yudao.module.staff.entity.UniqueCode;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 唯一推广码使用记录表 服务
* @author 小李
* @date 9:58 2024/8/8
**/
public interface UniqueCodeService extends IService<UniqueCode> {
/**
* 新增唯一推广码
* @author 小李
* @date 9:59 2024/8/8
* @param uniqueCode
*
* @return*/
int insertUniqueCode(String uniqueCode);
}

View File

@ -0,0 +1,64 @@
package cn.iocoder.yudao.module.staff.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
import cn.iocoder.yudao.module.staff.entity.CompanyStaffChange;
import cn.iocoder.yudao.module.staff.mapper.CompanyStaffChangeMapper;
import cn.iocoder.yudao.module.staff.service.CompanyStaffChangeService;
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
import cn.iocoder.yudao.module.staff.vo.CompanyStaffChangeRespVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 企业管理-员工交接记录 接口实现类
* @author 小李
* @date 15:40 2024/8/8
**/
@Service
public class CompanyStaffChangeServiceImpl extends ServiceImpl<CompanyStaffChangeMapper, CompanyStaffChange> implements CompanyStaffChangeService {
@Resource
private CompanyStaffService staffService;
/**
* 创建交接记录
* @author 小李
* @date 16:15 2024/8/8
* @param staffChangeRespVO
**/
public void createChangeStaff(CompanyStaffChangeRespVO staffChangeRespVO){
baseMapper.insert(staffChangeRespVO);
// TODO 交接工作记录待完成
}
/**
* 查询交接双方信息
* @author 小李
* @date 18:26 2024/8/8
* @param id 接收方员工ID
**/
@Override
public CompanyStaffChangeRespVO getChangeStaff(String id){
/** 构造返回对象 */
CompanyStaffChangeRespVO result = null;
// 1 根据当前ID获取员工记录
CompanyStaff newStaff = staffService.getOne(new QueryWrapper<CompanyStaff>().eq("id", id));
// 2 根据获取的员工信息中的userId获取交接记录
CompanyStaffChange staffChange = baseMapper.selectOne(new QueryWrapper<CompanyStaffChange>().eq("new_user_id", newStaff.getUserId()));
if (ObjectUtil.isNotEmpty(staffChange)){
result = new CompanyStaffChangeRespVO();
BeanUtil.copyProperties(staffChange, result);
// 3 根据交接记录中老员工的userId查老员工信息
CompanyStaff oldStaff = staffService.getOne(new QueryWrapper<CompanyStaff>().eq("user_id", staffChange.getOldUserId()));
result.setNewStaff(newStaff);
result.setOldStaff(oldStaff);
}
return result;
}
}

View File

@ -1,19 +1,48 @@
package cn.iocoder.yudao.module.staff.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.iocoder.yudao.common.BaseConstants;
import cn.iocoder.yudao.common.CommonErrorCodeConstants;
import cn.iocoder.yudao.framework.common.util.io.FileUtils;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.company.entity.Company;
import cn.iocoder.yudao.module.company.service.CompanyService;
import cn.iocoder.yudao.module.infra.api.file.FileApi;
import cn.iocoder.yudao.module.staff.entity.UniqueCode;
import cn.iocoder.yudao.module.staff.service.UniqueCodeService;
import cn.iocoder.yudao.module.label.entity.BusiLabel;
import cn.iocoder.yudao.module.label.entity.Label;
import cn.iocoder.yudao.module.label.service.BusiLabelService;
import cn.iocoder.yudao.module.label.service.LabelService;
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
import cn.iocoder.yudao.module.staff.mapper.CompanyStaffMapper;
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
import cn.iocoder.yudao.module.staff.vo.CompanyStaffReqVO;
import cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
/**
* 企业管理-员工信息表 服务实现类
*
* @author 小李
* @date 16:29 2024/8/6
**/
@ -23,30 +52,299 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
@Resource
private CompanyStaffMapper staffMapper;
@Resource
private AdminUserApi adminUserApi;
@Resource
private LabelService labelService;
@Resource
private CompanyService companyService;
@Resource
private BusiLabelService busiLabelService;
@Resource
private UniqueCodeService uniqueCodeService;
/**
* 获得企业管理-员工信息表分页
* @author 小李
* @date 17:11 2024/8/6
*
* @param pageReqVO 分页查询
* @param page 分页对象
* @author 小李
* @date 17:11 2024/8/6
**/
@Override
public IPage<CompanyStaff> queryListPage(CompanyStaffReqVO pageReqVO, Page<CompanyStaff> page) {
return staffMapper.selectListPage(pageReqVO, page);
}
/**
* 新增企业管理-员工管理信息
*
* @param staffRespVO 员工对象
* @author 小李
* @date 13:57 2024/8/7
**/
@Override
@DSTransactional
public void saveStaff(CompanyStaffRespVO staffRespVO) {
/** 获取当前登录用户的信息 */
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
AdminUserRespDTO user = adminUserApi.getUser(loginUser.getId());
/** 创建UserDTO用于给sys_user插入数据 */
UserDTO userDTO = new UserDTO();
userDTO.setUsername(staffRespVO.getLoginAccount());
userDTO.setPassword(staffRespVO.getPassword());
userDTO.setNickname(staffRespVO.getName());
userDTO.setDeptId(user.getDeptId());
userDTO.setMobile(staffRespVO.getTel());
// 获取sys_users中刚插入记录ID给准备添加的员工
Long userId = adminUserApi.createUser(userDTO);
staffRespVO.setUserId(userId);
// 设置新增员工部门
staffRespVO.setDeptId(user.getDeptId());
/** 插入标签库 */
if (ObjectUtil.isNotEmpty(staffRespVO.getLabelsArray())) {
// 1 获取标签库中的存在的数据
List<Label> labels = getLabelsByLabelName(staffRespVO.getLabelsArray());
// 2 如果有标签库中没有的数据就添加到标签库
if (labels.size() < staffRespVO.getLabelsArray().size()) {
// 2.1 所有存在的标签的LabelName
List<String> names = labels.stream().map(Label::getLabelName).collect(Collectors.toList());
// 2.2 获取新的标签的名称
List<String> newNames = staffRespVO.getLabelsArray().stream().filter(item -> !names.contains(item)).collect(Collectors.toList());
// 2.3 构建新标签对象批量插入
List<Label> newLabels = createLabels(newNames);
labelService.saveBatch(newLabels);
}
}
/** 插入员工库 */
// 1 获取当前登录用户的企业信息给添加的员工
Company company = companyService.getOne(new QueryWrapper<Company>().eq("mobile_phone", user.getMobile()));
staffRespVO.setCorpId(company.getId());
// 2 生成唯一推广码
int count = 0;
// 3 生成时判断是否重复重复就重新生成最多生成6次
while (true) {
// 重复生成和长度一样的次数还是重复就抛异常
if (count == BaseConstants.UNIQUE_CODE_LEN) {
throw exception(CommonErrorCodeConstants.UNIQUE_CODE_CREATE_REPEAT);
}
String code = RandomUtil.randomStringUpper(BaseConstants.UNIQUE_CODE_LEN);
// 直接新增唯一推码 新增成功就是可以用反之就是重复
int flag = uniqueCodeService.insertUniqueCode(code);
if (flag != 0) {
staffRespVO.setUniqueCode(code);
break;
}
count++;
}
// 3 保存员工信息到数据库
this.save(staffRespVO);
/** 插入标签到业务标签表 */
if (ObjectUtil.isNotEmpty(staffRespVO.getLabelsArray())) {
// 1 获取所有标签信息
List<Label> labels = getLabelsByLabelName(staffRespVO.getLabelsArray());
// 构建业务标签对象批量插入
List<BusiLabel> busiLabels = createBusiLabels(labels, staffRespVO.getId());
busiLabelService.saveBatch(busiLabels);
}
}
/**
* 更新员工信息
*
* @param staffRespVO 员工对象
* @author 小李
* @date 11:06 2024/8/8
**/
@Override
@DSTransactional
public void updateStaff(CompanyStaffRespVO staffRespVO) {
/** 修改标签 */
if (ObjectUtil.isNotEmpty(staffRespVO.getLabelsArray())) {
/** 检查是否需要新增标签 */
// 1 获取标签
List<Label> labels = getLabelsByLabelName(staffRespVO.getLabelsArray());
List<String> oldLabelNames = labels.stream().map(item -> item.getLabelName()).collect(Collectors.toList());
List<String> newLabelNames = staffRespVO.getLabelsArray().stream().filter(item -> !oldLabelNames.contains(item)).collect(Collectors.toList());
// 2 如果有就新增标签
if (ObjectUtil.isNotEmpty(newLabelNames)) {
// 2.1 获取需要新增的标签名新增标签
List<Label> newLabels = createLabels(newLabelNames);
labelService.saveBatch(newLabels);
}
@Override
public void deleteStaff(String id) {
/** 检查是否需要更新业务标签 */
// 1 获取业务标签表中旧数据
List<BusiLabel> busiLabels = getBusiLabelsByMainId(staffRespVO.getId());
// 2 检查是否需要更新数据, 如果有就更新
List<BusiLabel> oldBusiLabels = busiLabels.stream().filter(item -> !staffRespVO.getLabelsArray().contains(item.getLabelName())).collect(Collectors.toList());
List<String> oldBusiLabelNames = oldBusiLabels.stream().map(item -> item.getLabelName()).collect(Collectors.toList());
List<String> busiLabelNames = busiLabels.stream().map(item -> item.getLabelName()).collect(Collectors.toList());
List<String> newBusiLabelNames = staffRespVO.getLabelsArray().stream().filter(item -> !busiLabelNames.contains(item)).collect(Collectors.toList());
// 2.1 是否要需要删除
if (ObjectUtil.isNotEmpty(oldBusiLabelNames)) {
// 删除需要更新的旧数据
busiLabelService.removeBatchByIds(oldBusiLabels);
}
// 2.2 是否需要新增业务标签
if (ObjectUtil.isNotEmpty(newBusiLabelNames)) {
// 构建新数据新增
List<Label> newLabel = getLabelsByLabelName(newBusiLabelNames);
List<BusiLabel> newBusiLabel = createBusiLabels(newLabel, staffRespVO.getId());
busiLabelService.saveBatch(newBusiLabel);
}
}
/** 修改员工表 */
baseMapper.updateById(staffRespVO);
}
/**
* 删除员工
*
* @param id 员工ID
* @author 小李
* @date 10:42 2024/8/8
**/
@Override
@DSTransactional
public void deleteStaff(String id) {
/** 获取删除记录详细信息 */
CompanyStaff staff = baseMapper.selectById(id);
/** 删除sys_users记录 */
adminUserApi.deleteUser(staff.getUserId());
/** 删除业务标签表记录 */
busiLabelService.remove(new QueryWrapper<BusiLabel>().eq("main_id", staff.getId()));
/** 删除唯一推广码表记录 */
uniqueCodeService.remove(new QueryWrapper<UniqueCode>().eq("unique_code", staff.getUniqueCode()));
/** 删除员工表记录 */
baseMapper.deleteById(id);
}
/**
* 查询员工
*
* @param id
* @author 小李
* @date 17:59 2024/8/6
**/
@Override
public CompanyStaffRespVO getCompanyStaffById(String id) {
// 获取修改员工的详细信息
CompanyStaff staff = baseMapper.selectById(id);
// 构建员工响应对象
CompanyStaffRespVO staffRespVO = BeanUtil.toBean(staff, CompanyStaffRespVO.class);
// 查询业务标签表中属于员工的标签
List<BusiLabel> busiLabels = busiLabelService.list(new QueryWrapper<BusiLabel>().eq("main_id", staff.getId()));
// 取出标签名给员工响应对象
if (ObjectUtil.isNotEmpty(busiLabels)) {
List<String> labelsArray = busiLabels.stream().map(item -> item.getLabelName()).collect(Collectors.toList());
staffRespVO.setLabelsArray(labelsArray);
}
return staffRespVO;
}
/**
* 获取当前功能的标签
*
* @author 小李
* @date 14:59 2024/8/7
**/
@Override
public List<Label> getLabels() {
return labelService.list(new QueryWrapper<Label>().eq("system_code", BaseConstants.COMPANY_STAFF));
}
/**
* 根据标签名集合获取标签
*
* @param labelNames 标签名集合
* @author 小李
* @date 11:48 2024/8/8
**/
private List<Label> getLabelsByLabelName(List<String> labelNames) {
return labelService.list(new LambdaQueryWrapper<Label>().and(item -> {
item.in(Label::getLabelName, labelNames).eq(Label::getSystemCode, BaseConstants.COMPANY_STAFF);
}));
}
/**
* 根据员工ID获取业务标签
*
* @param mainId 员工ID
* @author 小李
* @date 11:48 2024/8/8
**/
private List<BusiLabel> getBusiLabelsByMainId(String mainId) {
return busiLabelService.list(new QueryWrapper<BusiLabel>().eq("main_id", mainId));
}
/**
* 根据标签名信息创建标签
*
* @param names 标签名集合
* @author 小李
* @date 11:52 2024/8/8
**/
private List<Label> createLabels(List<String> names) {
return names.stream().map(item -> {
Label label = new Label();
label.setLabelName(item);
label.setType(BaseConstants.COMPANY_SING_STAFF);
label.setLabelDesc(BaseConstants.COMPANY_SING_STAFF);
label.setLabelType(BaseConstants.LABEL_TYPE);
label.setSystemCode(BaseConstants.COMPANY_STAFF);
return label;
}).collect(Collectors.toList());
}
/**
* 根据标签信息创建业务标签
*
* @param labels 标签名集合
* @param id 员工ID
* @author 小李
* @date 11:52 2024/8/8
**/
private List<BusiLabel> createBusiLabels(List<Label> labels, String id) {
return labels.stream().map(item -> {
BusiLabel label = new BusiLabel();
label.setMainTable(BaseConstants.COMPANY_STAFF);
label.setMainId(id);
label.setLabelId(item.getId());
label.setLabelType(item.getLabelType());
label.setLabelName(item.getLabelName());
label.setLabelContent(item.getLabelName());
label.setSystemCode(BaseConstants.COMPANY_STAFF);
return label;
}).collect(Collectors.toList());
}
/**
* 获取当前登录用户部门下所有员工信息
* @author 小李
* @date 15:54 2024/8/8
**/
@Override
public List<CompanyStaff> getStaffList(){
// 获取当前登录用户的信息取出部门
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Long id = loginUser.getId();
AdminUserRespDTO user = adminUserApi.getUser(id);
Long deptId = user.getDeptId();
// 获取所有该部门下的员工信息
return baseMapper.selectList(new QueryWrapper<CompanyStaff>().eq("dept_id", deptId));
}
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.staff.service.impl;
import cn.iocoder.yudao.module.staff.entity.UniqueCode;
import cn.iocoder.yudao.module.staff.mapper.UniqueCodeMapper;
import cn.iocoder.yudao.module.staff.service.UniqueCodeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* 唯一推广码使用记录表 服务实现类
* @author 小李
* @date 9:58 2024/8/8
**/
@Service
public class UniqueCodeServiceImpl extends ServiceImpl<UniqueCodeMapper, UniqueCode> implements UniqueCodeService {
/**
* 检查唯一推广码是否存在于数据库
* @author 小李
* @date 9:59 2024/8/8
* @param uniqueCode
*
* @return*/
@Override
public int insertUniqueCode(String uniqueCode){
UniqueCode code = new UniqueCode();
code.setUniqueCode(uniqueCode);
return baseMapper.insert(code);
}
}

View File

@ -0,0 +1,13 @@
package cn.iocoder.yudao.module.staff.vo;
import cn.iocoder.yudao.module.staff.entity.CompanyStaffChange;
import lombok.Data;
/**
* 企业管理-员工交接记录VO
* @author 小李
* @date 15:36 2024/8/8
**/
@Data
public class CompanyStaffChangeReqVO extends CompanyStaffChange {
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.staff.vo;
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
import cn.iocoder.yudao.module.staff.entity.CompanyStaffChange;
import lombok.Data;
/**
* 企业管理-员工交接记录响应或提交VO
* @author 小李
* @date 15:37 2024/8/8
**/
@Data
public class CompanyStaffChangeRespVO extends CompanyStaffChange {
/** 交出方员工信息 */
private CompanyStaff oldStaff;
/** 接收方员工信息 */
private CompanyStaff newStaff;
}

View File

@ -1,7 +1,13 @@
package cn.iocoder.yudao.module.staff.vo;
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 员工查询VO
@ -10,4 +16,12 @@ import lombok.Data;
**/
@Data
public class CompanyStaffReqVO extends CompanyStaff {
@Schema(description = "工作日期查询范围")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] workDateArray;
@Schema(description = "入职日期查询范围")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] joinedDateArray;
}

View File

@ -14,7 +14,17 @@ import java.util.List;
public class CompanyStaffRespVO extends CompanyStaff {
/**
* 员工附件IDS
*/
List<String> fileIdArray;
* 登录账号
**/
private String loginAccount;
/**
* 登录密码
**/
private String password;
/**
* 员工标签
**/
List<String> labelsArray;
}

View File

@ -0,0 +1,6 @@
<?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="cn.iocoder.yudao.module.staff.mapper.CompanyStaffChangeMapper">
</mapper>

View File

@ -3,7 +3,79 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.staff.mapper.CompanyStaffMapper">
<select id="selectListPage" resultType="cn.iocoder.yudao.module.staff.entity.CompanyStaff">
select * from company_staff
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.staff.entity.CompanyStaff">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="corpId" column="corp_id" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="BIGINT"/>
<result property="deptId" column="dept_id" jdbcType="BIGINT"/>
<result property="workNo" column="work_no" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="tel" column="tel" jdbcType="VARCHAR"/>
<result property="sex" column="sex" jdbcType="VARCHAR"/>
<result property="address" column="address" jdbcType="VARCHAR"/>
<result property="workDate" column="work_date" jdbcType="DATE"/>
<result property="workYear" column="work_year" jdbcType="DECIMAL"/>
<result property="joinedDate" column="joined_date" jdbcType="DATE"/>
<result property="joinedYear" column="joined_year" jdbcType="DECIMAL"/>
<result property="education" column="education" jdbcType="VARCHAR"/>
<result property="content" column="content" jdbcType="VARCHAR"/>
<result property="uniqueCode" column="unique_code" jdbcType="VARCHAR"/>
<result property="fileUrls" column="file_urls" jdbcType="VARCHAR"/>
<result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/>
<result property="deleted" column="deleted" jdbcType="BIT"/>
<result property="creator" column="creator" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updater" column="updater" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_SQL">
select
id,corp_id,user_id,
dept_id,work_no,name,
tel,sex,address,
work_date,work_year,joined_date,
joined_year,education,content,
unique_code,file_urls,tenant_id,
deleted,creator,create_time,
updater,update_time
from company_staff cs where deleted = '0'
</sql>
<select id="selectListPage" resultMap="BaseResultMap">
<include refid="Base_SQL" />
<if test="map.name != null and map.name != ''">
and cs.name like concat('%', #{map.name}, '%')
</if>
<if test="map.workNo != null and map.workNo != ''">
and cs.work_no like concat('%', #{map.workNo}, '%')
</if>
<if test="map.tel != null and map.tel != ''">
and cs.tel like concat('%', #{map.tel}, '%')
</if>
<if test="map.sex != null and map.sex != ''">
and cs.sex = #{map.sex}
</if>
<if test="map.address != null and map.address != ''">
and cs.address like concat('%', #{map.address}, '%')
</if>
<if test="map.workYear != null">
and cs.work_year = #{map.workYear}
</if>
<if test="map.joinedYear != null">
and cs.joined_year = #{map.joinedYear}
</if>
<if test="map.education != null">
and cs.education = #{map.education}
</if>
<if test="map.uniqueCode != null and map.uniqueCode != ''">
and cs.unique_code like concat('%', #{map.uniqueCode}, '%')
</if>
<if test="map.workDateArray.length > 0">
and cs.work_date between #{map.workDateArray[0]} and #{map.workDateArray[1]}
</if>
<if test="map.joinedDateArray.length > 0">
and cs.joined_date between #{map.joinedDateArray[0]} and #{map.joinedDateArray[1]}
</if>
</select>
</mapper>

View File

@ -0,0 +1,6 @@
<?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="cn.iocoder.yudao.module.staff.mapper.UniqueCodeMapper">
</mapper>