Merge branch 'master' of http://122.51.230.86:3000/dianliang/lanan-system
救援
This commit is contained in:
commit
d1952a5754
@ -47,4 +47,8 @@ public class BaseConstants {
|
||||
public static final String QUALS_INTERIM_PERIOD = "quals_interim_period";
|
||||
/**资质过期通知模板*/
|
||||
public static final String QUALS_EXPIRED = "quals_expired";
|
||||
/** 资产临期通知模板 */
|
||||
public static final String PROPERTY_INTERIM_PERIOD = "property_interim_period";
|
||||
/** 资产过期通知模板 */
|
||||
public static final String PROPERTY_EXPIRED = "property_expired";
|
||||
}
|
||||
|
@ -21,4 +21,12 @@ public class DictBaseConstants {
|
||||
public static final String COMPANY_STAFF_EDU = "company_staff_edu";
|
||||
/**企业资质临期判定时间*/
|
||||
public static final String COMPANY_QUALS_EXPIRED = "company_quals_expired";
|
||||
/** 价值类型 */
|
||||
public static final String COMPANY_COST_TYPE = "company_cost_type";
|
||||
/** 资产状态 */
|
||||
public static final String COMPANY_PROP_STATUS = "company_prop_status";
|
||||
/** 时间周期字典 */
|
||||
public static final String CYCLE_DICT = "cycle_dict";
|
||||
/** 企业资产临期判定时间 */
|
||||
public static final String COMPANY_PROPERTY_EXPIRED = "company_property_expired";
|
||||
}
|
||||
|
@ -29,8 +29,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class CompanyQualsServiceImpl extends ServiceImpl<CompanyQualsMapper, CompanyQuals> implements CompanyQualsService {
|
||||
@Resource
|
||||
private CompanyQualsMapper companyQualsMapper;
|
||||
|
||||
@Resource
|
||||
private DictDataApi dataApi;
|
||||
@ -84,7 +82,7 @@ public class CompanyQualsServiceImpl extends ServiceImpl<CompanyQualsMapper, Com
|
||||
public void noticeCompanyQualsExpired(List<CompanyRespVO> companyRespVOS) {
|
||||
// 构建分页条件
|
||||
LambdaQueryWrapper<CompanyQuals> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Page<CompanyQuals> page = new Page<>(0, BaseConstants.BATCH_SIZE);
|
||||
Page<CompanyQuals> page = new Page<>(1, BaseConstants.BATCH_SIZE);
|
||||
// 获取临期判定时间
|
||||
List<DictDataRespDTO> dictDataList = dataApi.getDictDataList(DictBaseConstants.COMPANY_QUALS_EXPIRED);
|
||||
Long ruleDay = null;
|
||||
@ -110,6 +108,14 @@ public class CompanyQualsServiceImpl extends ServiceImpl<CompanyQualsMapper, Com
|
||||
sendMessage(item, BaseConstants.QUALS_INTERIM_PERIOD, companyRespVOS, day);
|
||||
}
|
||||
});
|
||||
|
||||
// 没有下一页了就退出
|
||||
if (!qualsPage.hasNext()) {
|
||||
break;
|
||||
}
|
||||
|
||||
// 翻页
|
||||
page.setCurrent(page.getCurrent() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,17 @@
|
||||
package cn.iocoder.yudao.module.property.controller.admin;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.property.entity.Property;
|
||||
import cn.iocoder.yudao.module.property.service.PropertyService;
|
||||
import cn.iocoder.yudao.module.property.vo.PropertyReqVO;
|
||||
import cn.iocoder.yudao.module.property.vo.PropertyRespVO;
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
|
||||
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;
|
||||
@ -19,14 +21,24 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 企业管理-资产")
|
||||
/**
|
||||
* 企业管理-资产管理 控制层
|
||||
*
|
||||
* @author 小李
|
||||
* @date 16:41 2024/8/15
|
||||
**/
|
||||
@RestController
|
||||
@Tag(name = "企业管理 - 资产管理")
|
||||
@RequestMapping("/company/property")
|
||||
@Validated
|
||||
public class PropertyController {
|
||||
@ -34,30 +46,49 @@ public class PropertyController {
|
||||
@Resource
|
||||
private PropertyService propertyService;
|
||||
|
||||
/**
|
||||
* 企业管理-资产分页
|
||||
*
|
||||
* @param pageReqVO 查询对象
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 条数
|
||||
* @author 小李
|
||||
* @date 16:15 2024/8/15
|
||||
**/
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得企业管理-资产分页")
|
||||
@PreAuthorize("@ss.hasPermission('company:property:query')")
|
||||
public CommonResult<IPage<?>> getPropertyPage(PropertyReqVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<Property> page = new Page<>(pageNo, pageSize);
|
||||
IPage<Property> pageResult = propertyService.getPropertyPage(pageReqVO, page);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建资产
|
||||
*
|
||||
* @param createReqVO
|
||||
* @author 小李
|
||||
* @date 18:26 2024/8/15
|
||||
**/
|
||||
@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);
|
||||
public CommonResult createProperty(@RequestBody PropertyReqVO createReqVO) {
|
||||
propertyService.createProperty(createReqVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得资产记录
|
||||
*
|
||||
* @param id 资产ID
|
||||
* @author 小李
|
||||
* @date 18:45 2024/8/15
|
||||
**/
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得企业管理-资产")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@ -67,24 +98,66 @@ public class PropertyController {
|
||||
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);
|
||||
/**
|
||||
* 更新资产
|
||||
* @author 小李
|
||||
* @date 18:57 2024/8/15
|
||||
* @param updateReqVO 资产对象
|
||||
**/
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新企业管理-资产")
|
||||
@PreAuthorize("@ss.hasPermission('company:property:update')")
|
||||
public CommonResult<Boolean> updateProperty(@RequestBody PropertyReqVO updateReqVO) {
|
||||
propertyService.updateProperty(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资产
|
||||
* @author 小李
|
||||
* @date 19:20 2024/8/15
|
||||
* @param id 资产ID
|
||||
**/
|
||||
@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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出资产数据
|
||||
* @author 小李
|
||||
* @date 20:02 2024/8/15
|
||||
* @param pageReqVO
|
||||
* @param response
|
||||
**/
|
||||
@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();
|
||||
int pageNo = 1, pageSize = 100;
|
||||
List<Property> list = new ArrayList<>();
|
||||
while (true){
|
||||
Page<Property> page = new Page<>(pageNo, pageSize);
|
||||
IPage<Property> propertyPage = propertyService.getPropertyPage(pageReqVO, page);
|
||||
if (ObjectUtil.isNotEmpty(propertyPage) && !propertyPage.getRecords().isEmpty()){
|
||||
list.addAll(propertyPage.getRecords());
|
||||
pageNo++;
|
||||
}else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "企业管理-资产.xls", "数据", PropertyRespVO.class, list);
|
||||
Map<Integer, Integer> columnWidthMap = new HashMap<>();
|
||||
// 第一列的索引是0,宽度设置为20个字符宽
|
||||
columnWidthMap.put(9, 20);
|
||||
columnWidthMap.put(10, 20);
|
||||
ExcelUtils.write(response, "企业管理-资产.xls", "数据", Property.class, list, columnWidthMap);
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +1,11 @@
|
||||
package cn.iocoder.yudao.module.property.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.property.entity.PropertyPos;
|
||||
import cn.iocoder.yudao.module.property.service.PropertyPosService;
|
||||
import cn.iocoder.yudao.module.property.vo.PropertyPosReqVO;
|
||||
import cn.iocoder.yudao.module.property.vo.PropertyPosRespVO;
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
|
||||
import cn.iocoder.yudao.module.staff.vo.CompanyStaffReqVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -21,11 +16,8 @@ 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 = "管理后台 - 企业管理-资产存放位置")
|
||||
|
@ -1,151 +1,165 @@
|
||||
package cn.iocoder.yudao.module.property.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
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.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.common.DictBaseConstants.*;
|
||||
|
||||
/**
|
||||
* 企业管理-资产 DO
|
||||
*
|
||||
* @author 后台管理员
|
||||
*/
|
||||
* 企业管理-资产管理
|
||||
* @author 小李
|
||||
* @date 16:37 2024/8/15
|
||||
**/
|
||||
@TableName("company_property")
|
||||
@KeySequence("company_property_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ExcelIgnoreUnannotated
|
||||
public class Property extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
/** 主键标识 */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
/**
|
||||
* 企业id
|
||||
*/
|
||||
|
||||
/** 企业id(base_company表中的id) */
|
||||
private String corpId;
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
|
||||
/** 部门id(system_dept表中的id,用来做数据权限控制) */
|
||||
private Long deptId;
|
||||
/**
|
||||
* 存放位置
|
||||
*/
|
||||
|
||||
/** 存放位置id(company_property_pos) */
|
||||
private String posId;
|
||||
/**
|
||||
* 使用人id
|
||||
*/
|
||||
|
||||
/** 使用人id(sys_users) */
|
||||
private String userId;
|
||||
/**
|
||||
* 资产编号
|
||||
*/
|
||||
|
||||
/** 资产编号 */
|
||||
@ExcelProperty("资产编号")
|
||||
private String propNo;
|
||||
/**
|
||||
* 资产名称
|
||||
*/
|
||||
|
||||
/** 资产名称 */
|
||||
@ExcelProperty("资产名称")
|
||||
private String propName;
|
||||
/**
|
||||
* 资产分类
|
||||
*/
|
||||
|
||||
/** 资产分类(分类字典) */
|
||||
@ExcelProperty("资产分类")
|
||||
private String propCatg;
|
||||
/**
|
||||
* 预计使用年限
|
||||
*/
|
||||
|
||||
/** 预计使用年限 */
|
||||
@ExcelProperty("预计使用年限")
|
||||
private Integer useYear;
|
||||
/**
|
||||
* 价值类型
|
||||
*
|
||||
* 枚举 {@link TODO company_cost_type 对应的类}
|
||||
*/
|
||||
|
||||
/** 价值类型 */
|
||||
@ExcelProperty(value = "价值类型", converter = DictConvert.class)
|
||||
@DictFormat(COMPANY_COST_TYPE)
|
||||
private String costType;
|
||||
/**
|
||||
* 资产数量
|
||||
*/
|
||||
|
||||
/** 资产数量 */
|
||||
@ExcelProperty("资产数量")
|
||||
private Integer propNum;
|
||||
/**
|
||||
* 资产原值(元)
|
||||
*/
|
||||
|
||||
/** 资产原值(元) */
|
||||
@ExcelProperty("资产原值")
|
||||
private BigDecimal costTotal;
|
||||
/**
|
||||
* 资产状态
|
||||
*
|
||||
* 枚举 {@link TODO company_prop_status 对应的类}
|
||||
*/
|
||||
|
||||
/** 资产状态 */
|
||||
@ExcelProperty(value = "资产状态", converter = DictConvert.class)
|
||||
@DictFormat(COMPANY_PROP_STATUS)
|
||||
private String propStatus;
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
|
||||
/** 品牌 */
|
||||
@ExcelProperty("品牌")
|
||||
private String brand;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
|
||||
/** 规格型号 */
|
||||
@ExcelProperty("规格型号")
|
||||
private String spec;
|
||||
/**
|
||||
* 生产厂家
|
||||
*/
|
||||
|
||||
/** 生产厂家 */
|
||||
@ExcelProperty("生产厂家")
|
||||
private String factory;
|
||||
/**
|
||||
* 出场序列号/编号
|
||||
*/
|
||||
|
||||
/** 出场序列号/编号 */
|
||||
@ExcelProperty("出场序列号/编号")
|
||||
private String serialNo;
|
||||
/**
|
||||
* 数量计量单位
|
||||
*/
|
||||
|
||||
/** 数量计量单位 */
|
||||
@ExcelProperty("数量计量单位")
|
||||
private String unit;
|
||||
/**
|
||||
* 取得日期
|
||||
*/
|
||||
private LocalDateTime getDate;
|
||||
/**
|
||||
* 出厂日期
|
||||
*/
|
||||
private LocalDate prodDate;
|
||||
/**
|
||||
* 供应商
|
||||
*/
|
||||
|
||||
/** 取得日期 */
|
||||
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ExcelProperty("取得日期")
|
||||
private Date getDate;
|
||||
|
||||
/** 出厂日期 */
|
||||
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ExcelProperty("出厂日期")
|
||||
private Date prodDate;
|
||||
|
||||
/** 供应商 */
|
||||
@ExcelProperty("供应商")
|
||||
private String supplier;
|
||||
/**
|
||||
* 启用日期
|
||||
*/
|
||||
private LocalDate openDate;
|
||||
/**
|
||||
* 净值(元)
|
||||
*/
|
||||
|
||||
/** 启用日期 */
|
||||
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ExcelProperty("启用日期")
|
||||
private Date openDate;
|
||||
|
||||
/** 净值(元) */
|
||||
@ExcelProperty("净值")
|
||||
private BigDecimal netValue;
|
||||
/**
|
||||
* 凭证号
|
||||
*/
|
||||
|
||||
/** 凭证号 */
|
||||
@ExcelProperty("凭证号")
|
||||
private String voucherNo;
|
||||
/**
|
||||
* 维修/保养周期单位
|
||||
*/
|
||||
|
||||
/** 维修/保养周期单位(年/月/天) */
|
||||
@ExcelProperty(value = "维修/保养周期单位", converter = DictConvert.class)
|
||||
@DictFormat(CYCLE_DICT)
|
||||
private String keepCycleType;
|
||||
/**
|
||||
* 维修/保养周期
|
||||
*/
|
||||
|
||||
/** 维修/保养周期(具体数字) */
|
||||
@ExcelProperty("维修/保养周期")
|
||||
private Integer keepCycle;
|
||||
/**
|
||||
* 上次维修/保养日期
|
||||
*/
|
||||
private LocalDate lastKeepDate;
|
||||
/**
|
||||
* 下次维修/保养日期
|
||||
*/
|
||||
private LocalDate nextKeepDate;
|
||||
/**
|
||||
* 附件urls
|
||||
*/
|
||||
|
||||
/** 上次维修/保养日期 */
|
||||
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ExcelProperty("上次维修/保养日期")
|
||||
private Date lastKeepDate;
|
||||
|
||||
/** 下次维修/保养日期 */
|
||||
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ExcelProperty("下次维修/保养日期")
|
||||
private Date nextKeepDate;
|
||||
|
||||
/** 附件urls(infra_file表中的url,多个英文逗号拼接) */
|
||||
@ExcelProperty("附件")
|
||||
private String fileUrls;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ExcelProperty("使用人")
|
||||
private String staffName;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ExcelProperty("存放位置")
|
||||
private String posName;
|
||||
}
|
@ -5,18 +5,23 @@ import cn.iocoder.yudao.module.property.vo.PropertyReqVO;
|
||||
import cn.iocoder.yudao.module.property.vo.PropertyRespVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 企业管理-资产 Mapper
|
||||
*
|
||||
* @author 后台管理员
|
||||
*/
|
||||
* 企业管理-资产管理 mapper
|
||||
* @author 小李
|
||||
* @date 16:40 2024/8/15
|
||||
**/
|
||||
@Mapper
|
||||
public interface PropertyMapper extends BaseMapper<Property> {
|
||||
|
||||
default IPage<PropertyRespVO> selectPage(PropertyReqVO reqVO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业管理-资产分页
|
||||
* @author 小李
|
||||
* @date 16:15 2024/8/15
|
||||
* @param pageReqVO 查询对象
|
||||
**/
|
||||
IPage<Property> getPropertyPage(@Param("map") PropertyReqVO pageReqVO, Page<Property> page);
|
||||
}
|
@ -1,54 +1,66 @@
|
||||
package cn.iocoder.yudao.module.property.service;
|
||||
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyRespVO;
|
||||
import cn.iocoder.yudao.module.property.entity.Property;
|
||||
import cn.iocoder.yudao.module.property.vo.PropertyReqVO;
|
||||
import cn.iocoder.yudao.module.property.vo.PropertyRespVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业管理-资产 Service 接口
|
||||
*
|
||||
* @author 后台管理员
|
||||
*/
|
||||
* 企业管理-资产管理 接口
|
||||
* @author 小李
|
||||
* @date 16:40 2024/8/15
|
||||
**/
|
||||
public interface PropertyService extends IService<Property> {
|
||||
|
||||
/**
|
||||
* 创建企业管理-资产
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
String createProperty(PropertyReqVO createReqVO);
|
||||
* 企业管理-资产分页
|
||||
* @author 小李
|
||||
* @date 16:15 2024/8/15
|
||||
* @param pageReqVO 查询对象
|
||||
**/
|
||||
IPage<Property> getPropertyPage(PropertyReqVO pageReqVO, Page<Property> page);
|
||||
|
||||
/**
|
||||
* 更新企业管理-资产
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateProperty(PropertyReqVO updateReqVO);
|
||||
* 创建资产
|
||||
* @author 小李
|
||||
* @date 18:26 2024/8/15
|
||||
* @param createReqVO
|
||||
**/
|
||||
void createProperty(PropertyReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 删除企业管理-资产
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteProperty(String id);
|
||||
|
||||
/**
|
||||
* 获得企业管理-资产
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 企业管理-资产
|
||||
*/
|
||||
* 获得资产记录
|
||||
* @author 小李
|
||||
* @date 18:45 2024/8/15
|
||||
* @param id 资产ID
|
||||
**/
|
||||
Property getProperty(String id);
|
||||
|
||||
/**
|
||||
* 获得企业管理-资产分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 企业管理-资产分页
|
||||
*/
|
||||
IPage<PropertyRespVO> getPropertyPage(PropertyReqVO pageReqVO);
|
||||
* 更新资产
|
||||
* @author 小李
|
||||
* @date 18:57 2024/8/15
|
||||
* @param updateReqVO 资产对象
|
||||
**/
|
||||
void updateProperty(PropertyReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除资产
|
||||
* @author 小李
|
||||
* @date 19:20 2024/8/15
|
||||
* @param id 资产ID
|
||||
**/
|
||||
void deleteProperty(String id);
|
||||
|
||||
/**
|
||||
* 检测是否有临期、过期资产,有就通知
|
||||
* @author 小李
|
||||
* @date 8:47 2024/8/16
|
||||
* @param adminUsers
|
||||
**/
|
||||
void noticePropertyExpired(List<CompanyRespVO> adminUsers);
|
||||
}
|
@ -1,58 +1,207 @@
|
||||
package cn.iocoder.yudao.module.property.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.BaseConstants;
|
||||
import cn.iocoder.yudao.common.DictBaseConstants;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyRespVO;
|
||||
import cn.iocoder.yudao.module.property.entity.Property;
|
||||
import cn.iocoder.yudao.module.property.mapper.PropertyMapper;
|
||||
import cn.iocoder.yudao.module.property.service.PropertyService;
|
||||
import cn.iocoder.yudao.module.property.vo.PropertyReqVO;
|
||||
import cn.iocoder.yudao.module.property.vo.PropertyRespVO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
||||
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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 org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 企业管理-资产 Service 实现类
|
||||
* 企业管理-资产管理 接口实现类
|
||||
*
|
||||
* @author 后台管理员
|
||||
*/
|
||||
* @author 小李
|
||||
* @date 16:41 2024/8/15
|
||||
**/
|
||||
@Service
|
||||
@Validated
|
||||
public class PropertyServiceImpl extends ServiceImpl<PropertyMapper, Property> implements PropertyService {
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@Resource
|
||||
private DictDataApi dataApi;
|
||||
|
||||
@Resource
|
||||
private NotifyMessageSendApi sendApi;
|
||||
|
||||
/**
|
||||
* 企业管理-资产分页
|
||||
*
|
||||
* @param pageReqVO 查询对象
|
||||
* @author 小李
|
||||
* @date 16:15 2024/8/15
|
||||
**/
|
||||
@Override
|
||||
public String createProperty(PropertyReqVO createReqVO) {
|
||||
// 插入
|
||||
Property property = BeanUtils.toBean(createReqVO, Property.class);
|
||||
baseMapper.insert(property);
|
||||
// 返回
|
||||
return property.getId();
|
||||
public IPage<Property> getPropertyPage(PropertyReqVO pageReqVO, Page<Property> page) {
|
||||
return baseMapper.getPropertyPage(pageReqVO, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建资产
|
||||
*
|
||||
* @param createReqVO
|
||||
* @author 小李
|
||||
* @date 18:26 2024/8/15
|
||||
**/
|
||||
@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);
|
||||
@DSTransactional
|
||||
public void createProperty(PropertyReqVO createReqVO) {
|
||||
// 获取当前登录用户部门ID和企业ID
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
AdminUserRespDTO user = userApi.getUser(userId);
|
||||
createReqVO.setDeptId(user.getDeptId());
|
||||
DeptRespDTO dept = deptApi.getDept(user.getDeptId());
|
||||
createReqVO.setCorpId(dept.getCorpId());
|
||||
|
||||
// 创建资产
|
||||
baseMapper.insert(createReqVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得资产记录
|
||||
*
|
||||
* @param id 资产ID
|
||||
* @author 小李
|
||||
* @date 18:45 2024/8/15
|
||||
**/
|
||||
@Override
|
||||
public Property getProperty(String id) {
|
||||
return baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新资产
|
||||
*
|
||||
* @param updateReqVO 资产对象
|
||||
* @author 小李
|
||||
* @date 18:57 2024/8/15
|
||||
**/
|
||||
@Override
|
||||
public IPage<PropertyRespVO> getPropertyPage(PropertyReqVO pageReqVO) {
|
||||
Page<Property> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
|
||||
return null;
|
||||
public void updateProperty(PropertyReqVO updateReqVO) {
|
||||
baseMapper.updateById(updateReqVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资产
|
||||
*
|
||||
* @param id 资产ID
|
||||
* @author 小李
|
||||
* @date 19:20 2024/8/15
|
||||
**/
|
||||
public void deleteProperty(String id) {
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测是否有临期、过期资产,有就通知
|
||||
*
|
||||
* @param adminUsers
|
||||
* @author 小李
|
||||
* @date 8:47 2024/8/16
|
||||
**/
|
||||
@Override
|
||||
public void noticePropertyExpired(List<CompanyRespVO> adminUsers) {
|
||||
// 构建分页
|
||||
LambdaQueryWrapper<Property> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Page<Property> page = new Page<>(1, BaseConstants.BATCH_SIZE);
|
||||
// 获取临期判定时间
|
||||
List<DictDataRespDTO> dictDataList = dataApi.getDictDataList(DictBaseConstants.COMPANY_PROPERTY_EXPIRED);
|
||||
Long ruleDay = null;
|
||||
if (ObjectUtil.isNotEmpty(dictDataList)) {
|
||||
ruleDay = Long.valueOf(dictDataList.get(0).getValue());
|
||||
}
|
||||
while (ObjectUtil.isNotEmpty(ruleDay)) {
|
||||
// 查询一页数据
|
||||
Page<Property> propertyPage = baseMapper.selectPage(page, queryWrapper);
|
||||
// 分类临期和过期
|
||||
// 这里重新赋值是因为不重新赋值用不了,我也不知道为什么,看到这里的人知道的话可以给我讲讲
|
||||
Long finalRuleDay = ruleDay;
|
||||
propertyPage.getRecords().forEach(item -> {
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
LocalDate nextKeepDate = item.getNextKeepDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
// 计算离当前时间还有多少天
|
||||
Long day = ChronoUnit.DAYS.between(currentDate, nextKeepDate);
|
||||
// 拿到当前记录的管理员ID
|
||||
List<CompanyRespVO> collect = adminUsers.stream().filter(company -> company.getId() == item.getCorpId()).collect(Collectors.toList());
|
||||
if (ObjectUtil.isNotEmpty(collect)) {
|
||||
Long userId = collect.get(0).getUserDTO().getId();
|
||||
// day 小于0是过期了 小于等于finalRuleDay是临期了 其他就正常的
|
||||
if (day < 0) {
|
||||
// 通知管理员
|
||||
sendMessage(item, BaseConstants.PROPERTY_EXPIRED, userId, day);
|
||||
// 通知使用人
|
||||
sendMessage(item, BaseConstants.PROPERTY_EXPIRED, Long.valueOf(item.getUserId()), day);
|
||||
} else if (day <= finalRuleDay) {
|
||||
// 通知管理员
|
||||
sendMessage(item, BaseConstants.PROPERTY_INTERIM_PERIOD, userId, day);
|
||||
// 通知使用人
|
||||
sendMessage(item, BaseConstants.PROPERTY_INTERIM_PERIOD, Long.valueOf(item.getUserId()), day);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// 没有下一页了就退出
|
||||
if (!propertyPage.hasNext()) {
|
||||
break;
|
||||
}
|
||||
|
||||
// 翻页
|
||||
page.setCurrent(page.getCurrent() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送通知
|
||||
*
|
||||
* @param property 发送的资产信息
|
||||
* @param templateCode 使用的模板
|
||||
* @param noticeId 通知到的人
|
||||
* @param day 天数
|
||||
* @author 小李
|
||||
* @date 9:29 2024/8/16
|
||||
**/
|
||||
private void sendMessage(Property property, String templateCode, Long noticeId, Long day) {
|
||||
// 准备发送参数
|
||||
Map<String, Object> templateParams = new HashMap<>();
|
||||
// 什么资产
|
||||
templateParams.put("propertyName", property.getPropName());
|
||||
// 还有多少天过期或已过期多少天,可能是负数,绝对值一下
|
||||
templateParams.put("day", Math.abs(day));
|
||||
|
||||
// 发送
|
||||
sendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
||||
.setUserId(noticeId)
|
||||
.setTemplateCode(templateCode).setTemplateParams(templateParams));
|
||||
}
|
||||
}
|
@ -1,114 +1,27 @@
|
||||
package cn.iocoder.yudao.module.property.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.property.entity.Property;
|
||||
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 java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 企业管理-资产分页 Request VO")
|
||||
/**
|
||||
* 企业管理-资产管理 查询VO
|
||||
* @author 小李
|
||||
* @date 16:37 2024/8/15
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PropertyReqVO extends PageParam {
|
||||
public class PropertyReqVO extends Property {
|
||||
|
||||
@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 LocalDateTime getDate;
|
||||
|
||||
@Schema(description = "出厂日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDateTime prodDate;
|
||||
|
||||
@Schema(description = "供应商")
|
||||
private String supplier;
|
||||
|
||||
@Schema(description = "启用日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDateTime 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 LocalDateTime lastKeepDate;
|
||||
|
||||
@Schema(description = "下次维修/保养日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDateTime nextKeepDate;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDateTime createTime;
|
||||
@Schema(description = "取得日期查询范围")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date[] getDateArray;
|
||||
|
||||
@Schema(description = "启用日期查询范围")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date[] openDateArray;
|
||||
}
|
@ -1,20 +1,13 @@
|
||||
package cn.iocoder.yudao.module.property.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.property.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")
|
||||
/**
|
||||
* 企业管理-资产管理 响应或提交VO
|
||||
* @author 小李
|
||||
* @date 16:38 2024/8/15
|
||||
**/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PropertyRespVO extends Property {
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.staff.controller.admin;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -137,12 +139,19 @@ public class CompanyStaffController {
|
||||
@PreAuthorize("@ss.hasPermission('company:staff:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportCompanyStaffExcel(CompanyStaffReqVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletResponse response) throws IOException {
|
||||
Page<CompanyStaff> page = new Page<>(pageNo, pageSize);
|
||||
IPage<CompanyStaff> staffIPage = staffService.queryListPage(pageReqVO, page);
|
||||
List<CompanyStaff> list = staffIPage.getRecords();
|
||||
int pageNo = 1, pageSize = 100;
|
||||
List<CompanyStaff> list = new ArrayList<>();
|
||||
while (true){
|
||||
Page<CompanyStaff> page = new Page<>(pageNo, pageSize);
|
||||
IPage<CompanyStaff> staffIPage = staffService.queryListPage(pageReqVO, page);
|
||||
if (ObjectUtil.isNotEmpty(staffIPage) && !staffIPage.getRecords().isEmpty()){
|
||||
list.addAll(staffIPage.getRecords());
|
||||
pageNo++;
|
||||
}else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 导出 Excel
|
||||
Map<Integer, Integer> columnWidthMap = new HashMap<>();
|
||||
// 第一列的索引是0,宽度设置为20个字符宽
|
||||
|
@ -1,7 +1,6 @@
|
||||
package cn.iocoder.yudao.module.staff.entity;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
@ -17,11 +16,11 @@ import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.common.DictBaseConstants.*;
|
||||
import static cn.iocoder.yudao.common.DictBaseConstants.COMPANY_STAFF_EDU;
|
||||
import static cn.iocoder.yudao.common.DictBaseConstants.DICT_SYS_USER_SEX;
|
||||
|
||||
/**
|
||||
* 企业管理-员工信息实体
|
||||
|
@ -457,7 +457,7 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
|
||||
@DSTransactional
|
||||
public void updateStaffWorkAndJoinedYears() {
|
||||
LambdaQueryWrapper<CompanyStaff> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Page<CompanyStaff> page = new Page<>(0, BaseConstants.BATCH_SIZE);
|
||||
Page<CompanyStaff> page = new Page<>(1, BaseConstants.BATCH_SIZE);
|
||||
while (true) {
|
||||
// 查询一页的数据
|
||||
Page<CompanyStaff> companyStaffPage = baseMapper.selectPage(page, queryWrapper);
|
||||
@ -483,12 +483,12 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
|
||||
updateBatchById(result);
|
||||
|
||||
// 没有下一页了就退出
|
||||
if (companyStaffPage.getRecords().isEmpty()) {
|
||||
if (!companyStaffPage.hasNext()) {
|
||||
break;
|
||||
}
|
||||
|
||||
// 取一页
|
||||
queryWrapper.gt(CompanyStaff::getId, page.getRecords().get(page.getRecords().size() - 1).getId());
|
||||
page.setCurrent(page.getCurrent() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.scheduled;
|
||||
|
||||
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
||||
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
||||
import cn.iocoder.yudao.module.company.service.CompanyService;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyRespVO;
|
||||
import cn.iocoder.yudao.module.property.service.PropertyService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业资产临期定时通知
|
||||
* @author 小李
|
||||
* @date 8:42 2024/8/16
|
||||
**/
|
||||
@Component
|
||||
@TenantJob
|
||||
@Slf4j
|
||||
public class NoticeCompanyPropertyExpiredJob implements JobHandler {
|
||||
|
||||
@Resource
|
||||
private PropertyService propertyService;
|
||||
|
||||
@Resource
|
||||
private CompanyService companyService;
|
||||
|
||||
@Override
|
||||
public String execute(String param) throws Exception {
|
||||
// 获得所有企业的企业管理员
|
||||
List<CompanyRespVO> companyAndManager = companyService.getCompanyAndManager();
|
||||
|
||||
// 执行定时任务
|
||||
propertyService.noticePropertyExpired(companyAndManager);
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,12 +1,119 @@
|
||||
<?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 namespace="cn.iocoder.yudao.module.property.mapper.PropertyMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.property.entity.Property">
|
||||
<id property="id" column="cp_id" jdbcType="VARCHAR"/>
|
||||
<result property="corpId" column="cp_corp_id" jdbcType="VARCHAR"/>
|
||||
<result property="deptId" column="cp_dept_id" jdbcType="BIGINT"/>
|
||||
<result property="posId" column="cp_pos_id" jdbcType="VARCHAR"/>
|
||||
<result property="userId" column="cp_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="propNo" column="cp_prop_no" jdbcType="VARCHAR"/>
|
||||
<result property="propName" column="cp_prop_name" jdbcType="VARCHAR"/>
|
||||
<result property="propCatg" column="cp_prop_catg" jdbcType="VARCHAR"/>
|
||||
<result property="useYear" column="cp_use_year" jdbcType="INTEGER"/>
|
||||
<result property="costType" column="cp_cost_type" jdbcType="VARCHAR"/>
|
||||
<result property="propNum" column="cp_prop_num" jdbcType="INTEGER"/>
|
||||
<result property="costTotal" column="cp_cost_total" jdbcType="DECIMAL"/>
|
||||
<result property="propStatus" column="cp_prop_status" jdbcType="VARCHAR"/>
|
||||
<result property="brand" column="cp_brand" jdbcType="VARCHAR"/>
|
||||
<result property="spec" column="cp_spec" jdbcType="VARCHAR"/>
|
||||
<result property="factory" column="cp_factory" jdbcType="VARCHAR"/>
|
||||
<result property="serialNo" column="cp_serial_no" jdbcType="VARCHAR"/>
|
||||
<result property="unit" column="cp_unit" jdbcType="VARCHAR"/>
|
||||
<result property="getDate" column="cp_get_date" jdbcType="DATE"/>
|
||||
<result property="prodDate" column="cp_prod_date" jdbcType="DATE"/>
|
||||
<result property="supplier" column="cp_supplier" jdbcType="VARCHAR"/>
|
||||
<result property="openDate" column="cp_open_date" jdbcType="DATE"/>
|
||||
<result property="netValue" column="cp_net_value" jdbcType="DECIMAL"/>
|
||||
<result property="voucherNo" column="cp_voucher_no" jdbcType="VARCHAR"/>
|
||||
<result property="keepCycleType" column="cp_keep_cycle_type" jdbcType="VARCHAR"/>
|
||||
<result property="keepCycle" column="cp_keep_cycle" jdbcType="INTEGER"/>
|
||||
<result property="lastKeepDate" column="cp_last_keep_date" jdbcType="DATE"/>
|
||||
<result property="nextKeepDate" column="cp_next_keep_date" jdbcType="DATE"/>
|
||||
<result property="fileUrls" column="cp_file_urls" jdbcType="VARCHAR"/>
|
||||
<result property="staffName" column="staff_name" jdbcType="VARCHAR" />
|
||||
<result property="posName" column="pos_name" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_SQL">
|
||||
SELECT cp.id AS cp_id,
|
||||
cp.corp_id AS cp_corp_id,
|
||||
cp.dept_id AS cp_dept_id,
|
||||
cp.pos_id AS cp_pos_id,
|
||||
cp.user_id AS cp_user_id,
|
||||
cp.prop_no AS cp_prop_no,
|
||||
cp.prop_name AS cp_prop_name,
|
||||
cp.prop_catg AS cp_prop_catg,
|
||||
cp.use_year AS cp_use_year,
|
||||
cp.cost_type AS cp_cost_type,
|
||||
cp.prop_num AS cp_prop_num,
|
||||
cp.cost_total AS cp_cost_total,
|
||||
cp.prop_status AS cp_prop_status,
|
||||
cp.brand AS cp_brand,
|
||||
cp.spec AS cp_spec,
|
||||
cp.factory AS cp_factory,
|
||||
cp.serial_no AS cp_serial_no,
|
||||
cp.unit AS cp_unit,
|
||||
cp.get_date AS cp_get_date,
|
||||
cp.prod_date AS cp_prod_date,
|
||||
cp.supplier AS cp_supplier,
|
||||
cp.open_date AS cp_open_date,
|
||||
cp.net_value AS cp_net_value,
|
||||
cp.voucher_no AS cp_voucher_no,
|
||||
cp.keep_cycle_type AS cp_keep_cycle_type,
|
||||
cp.keep_cycle AS cp_keep_cycle,
|
||||
cp.last_keep_date AS cp_last_keep_date,
|
||||
cp.next_keep_date AS cp_next_keep_date,
|
||||
cp.file_urls AS cp_file_urls,
|
||||
cs.name AS staff_name,
|
||||
cpp.pos_name AS pos_name
|
||||
FROM company_property cp
|
||||
LEFT JOIN company_staff cs ON cp.user_id = cs.user_id
|
||||
LEFT JOIN company_property_pos cpp ON cp.pos_id = cpp.id
|
||||
WHERE cp.deleted = '0'
|
||||
</sql>
|
||||
|
||||
<select id="getPropertyPage" resultMap="BaseResultMap">
|
||||
<include refid="Base_SQL"/>
|
||||
<if test="map.propNo != null and map.propNo != ''">
|
||||
ANd (cp.prop_no like concat('%', #{map.propNo}, '%'))
|
||||
</if>
|
||||
<if test="map.propName != null and map.propName != ''">
|
||||
AND (cp.prop_name like concat('%', #{map.propName}, '%'))
|
||||
</if>
|
||||
<if test="map.brand != null and map.brand != ''">
|
||||
AND (cp.brand like concat('%', #{map.brand}, '%'))
|
||||
</if>
|
||||
<if test="map.supplier != null and map.supplier != ''">
|
||||
AND (cp.supplier like concat('%', #{map.supplier}, '%'))
|
||||
</if>
|
||||
<if test="map.propCatg != null and map.propCatg != ''">
|
||||
AND (cp.prop_catg = #{map.propCatg})
|
||||
</if>
|
||||
<if test="map.costType != null and map.costType != ''">
|
||||
AND (cp.cost_type = #{map.costType})
|
||||
</if>
|
||||
<if test="map.propStatus != null and map.propStatus != ''">
|
||||
AND (cp.prop_status = #{map.propStatus})
|
||||
</if>
|
||||
<if test="map.voucherNo != null and map.voucherNo != ''">
|
||||
AND (cp.voucher_no like concat('%', #{map.voucherNo}, '%'))
|
||||
</if>
|
||||
<if test="map.factory != null and map.factory != ''">
|
||||
AND (cp.factory like concat('%', #{map.factory}, '%'))
|
||||
</if>
|
||||
<if test="map.posId != null and map.posId != ''">
|
||||
AND (cp.pos_id = #{map.posId})
|
||||
</if>
|
||||
<if test="map.userId != null and map.userId != ''">
|
||||
AND (cp.user_id = #{map.userId})
|
||||
</if>
|
||||
<if test="map.getDateArray != null and map.getDateArray.length > 0">
|
||||
AND (cp.get_date BETWEEN #{map.getDateArray[0]} AND #{map.getDateArray[1]})
|
||||
</if>
|
||||
<if test="map.openDateArray != null and map.openDateArray != ''">
|
||||
AND (cp.open_date BETWEEN #{map.openDateArray[0]} AND #{map.openDateArray[1]})
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user