租赁管理
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package com.mhd.basic.domain.lease.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 租赁管理对象 container
|
||||
*
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class Lease extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("货主名称")
|
||||
private String cargoOwnerName;
|
||||
|
||||
@ApiModelProperty(value = "租赁方式(整租/散租)")
|
||||
private String leaseType;
|
||||
|
||||
@ApiModelProperty("租赁面积(m²)")
|
||||
private BigDecimal leaseArea;
|
||||
|
||||
@ApiModelProperty("开始日期")
|
||||
private Date startDate;
|
||||
|
||||
@ApiModelProperty("结束日期")
|
||||
private Date endDate;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.mhd.basic.domain.lease.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.basic.domain.lease.entity.Lease;
|
||||
import com.mhd.basic.domain.lease.repository.po.LeasePO;
|
||||
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 租赁管理Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
public interface ILeaseService extends IService<Lease>
|
||||
{
|
||||
/**
|
||||
* 分页查询租赁管理列表
|
||||
*/
|
||||
public List<LeasePO> queryList(LeaseDO leaseDO);
|
||||
|
||||
/**
|
||||
* 新增租赁管理
|
||||
*/
|
||||
public Boolean insert(LeaseDO leaseDO);
|
||||
|
||||
/**
|
||||
* 修改租赁管理
|
||||
*/
|
||||
public Boolean update(LeaseDO leaseDO);
|
||||
|
||||
/**
|
||||
* 批量删除租赁管理
|
||||
*/
|
||||
public Boolean delete(Long[] leaseIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询租赁管理
|
||||
*/
|
||||
public LeasePO getInfo(Long leaseId);
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.mhd.basic.domain.lease.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.basic.domain.lease.entity.Lease;
|
||||
import com.mhd.basic.domain.lease.repository.po.LeasePO;
|
||||
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 租赁管理Mapper接口
|
||||
*
|
||||
*/
|
||||
public interface LeaseMapper extends BaseMapper<Lease>
|
||||
{
|
||||
/**
|
||||
* 查询租赁管理列表
|
||||
*/
|
||||
public List<LeasePO> queryList(LeaseDO leaseDO);
|
||||
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
package com.mhd.basic.domain.lease.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.basic.domain.lease.entity.Lease;
|
||||
import com.mhd.basic.domain.lease.repository.facade.ILeaseService;
|
||||
import com.mhd.basic.domain.lease.repository.mapper.LeaseMapper;
|
||||
import com.mhd.basic.domain.lease.repository.po.LeasePO;
|
||||
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 容器管理Service业务层处理
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
public class LeaseImpl extends ServiceImpl<LeaseMapper, Lease> implements ILeaseService {
|
||||
@Autowired
|
||||
private LeaseMapper leaseMapper;
|
||||
|
||||
/**
|
||||
* 查询容器管理列表
|
||||
*/
|
||||
@Override
|
||||
public List<LeasePO> queryList(LeaseDO leaseDO)
|
||||
{
|
||||
return leaseMapper.queryList(leaseDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增容器管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(LeaseDO leaseDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Lease lease = new Lease();
|
||||
BeanUtils.copyProperties(leaseDO,lease);
|
||||
return this.save(lease);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改容器管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(LeaseDO leaseDO) {
|
||||
Lease lease = new Lease();
|
||||
BeanUtils.copyProperties(leaseDO,lease);
|
||||
return this.updateById(lease);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除容器管理
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean delete(Long[] leaseIds ) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
List<Lease> list = new ArrayList<>();
|
||||
for (Long id : leaseIds) {
|
||||
Lease lease = new Lease();
|
||||
lease.setId(id);
|
||||
lease.setDelFlag(2);
|
||||
lease.setUpdateBy(loginUser.getUserid());
|
||||
lease.setUpdateByName(loginUser.getUsername());
|
||||
lease.setUpdateTime(new Date());
|
||||
list.add(lease);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改容器管理
|
||||
*/
|
||||
@Override
|
||||
public LeasePO getInfo(Long leaseId) {
|
||||
Lease lease = this.getById(leaseId);
|
||||
LeasePO leasePO = new LeasePO();
|
||||
BeanUtils.copyProperties(lease,leasePO);
|
||||
return leasePO;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @description 校验唯一
|
||||
// * @author ZhouGY
|
||||
// * @date 2024/5/9 21:10
|
||||
// * @param containerDO
|
||||
// */
|
||||
// private void verifyUniqueness(ContainerDO containerDO){
|
||||
// LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
// Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
// if (topOrganizationId == null || topOrganizationId == 0 ){
|
||||
// throw new ServiceException("获取当前登陆人组织失败!");
|
||||
// }
|
||||
// int count = leaseMapper.selectCount(new QueryWrapper<Container>().lambda()
|
||||
// .eq(Container::getTopOrganizationId, topOrganizationId)
|
||||
// .eq(Container::getContainerCode,containerDO.getContainerCode())
|
||||
// .eq(Container::getOrganizationId, containerDO.getOrganizationId())
|
||||
// .ne(containerDO.getContainerId() != null, Container::getContainerId, containerDO.getContainerId() )
|
||||
// .eq(Container::getDelFlag,1));
|
||||
// if (count > 0){
|
||||
// throw new ServiceException("容器编码【" + containerDO.getContainerCode() + "】已存在");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package com.mhd.basic.domain.lease.repository.po;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 租赁管理对象 container
|
||||
*
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class LeasePO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("货主名称")
|
||||
private String cargoOwnerName;
|
||||
|
||||
@ApiModelProperty(value = "租赁方式(整租/散租)")
|
||||
private String leaseType;
|
||||
|
||||
@ApiModelProperty("租赁面积(m²)")
|
||||
private BigDecimal leaseArea;
|
||||
|
||||
@ApiModelProperty("开始日期")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date startDate;
|
||||
|
||||
@ApiModelProperty("结束日期")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date endDate;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.mhd.basic.domain.lease.repository.todo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 租赁管理对象 container
|
||||
*
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class LeaseDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("货主名称")
|
||||
private String cargoOwnerName;
|
||||
|
||||
@ApiModelProperty(value = "租赁方式(整租/散租)")
|
||||
private String leaseType;
|
||||
|
||||
@ApiModelProperty("租赁面积(m²)")
|
||||
private BigDecimal leaseArea;
|
||||
|
||||
@ApiModelProperty("开始日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date startDate;
|
||||
|
||||
@ApiModelProperty("结束日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date endDate;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
package com.mhd.basic.domain.lease.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.mhd.basic.domain.container.entity.Container;
|
||||
import com.mhd.basic.domain.container.repository.facade.IContainerService;
|
||||
import com.mhd.basic.domain.container.repository.po.ContainerPO;
|
||||
import com.mhd.basic.domain.container.repository.todo.ContainerDO;
|
||||
import com.mhd.basic.domain.lease.entity.Lease;
|
||||
import com.mhd.basic.domain.lease.repository.facade.ILeaseService;
|
||||
import com.mhd.basic.domain.lease.repository.po.LeasePO;
|
||||
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 租赁管理
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class LeaseDomainService {
|
||||
|
||||
@Autowired
|
||||
private ILeaseService leaseService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询租赁管理列表
|
||||
*/
|
||||
public List<LeasePO> queryList(LeaseDO leaseDO) {
|
||||
return leaseService.queryList(leaseDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增租赁管理
|
||||
*/
|
||||
public Boolean insert(LeaseDO leaseDO) {
|
||||
|
||||
return leaseService.insert(leaseDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改租赁管理
|
||||
*/
|
||||
public Boolean update(LeaseDO leaseDO) {
|
||||
return leaseService.update(leaseDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除租赁管理
|
||||
*/
|
||||
public Boolean delete(Long[] leaseIds) {
|
||||
return leaseService.delete(leaseIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取租赁管理详细信息
|
||||
*/
|
||||
public LeasePO getInfo(Long leaseId)
|
||||
{
|
||||
return leaseService.getInfo(leaseId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 批量作废租赁
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/13 9:46
|
||||
* @param leaseIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean nullifyByIds(List<Long> leaseIds) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
return leaseService.update(new UpdateWrapper<Lease>().lambda()
|
||||
.set(Lease::getUpdateBy, loginUser.getUserid())
|
||||
.set(Lease::getUpdateTime, new Date())
|
||||
.in(Lease::getId, leaseIds)
|
||||
.eq(Lease::getDelFlag, 1));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user