工器具数据导出

This commit is contained in:
hongchao 2025-03-04 15:07:41 +08:00
parent 33992fef85
commit 50b26aefe7
6 changed files with 92 additions and 64 deletions

View File

@ -17,6 +17,7 @@ import com.bonus.material.lease.service.ILeaseApplyInfoService;
import com.bonus.material.lease.service.ILeaseTaskService;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.domain.vo.MaTypeVo;
import com.bonus.material.ma.domain.vo.MaTypeVoLevelTwo;
import com.bonus.material.ma.domain.vo.StandardConfigDetailsVo;
import com.bonus.system.api.RemoteFileService;
import com.itextpdf.text.Paragraph;
@ -199,14 +200,9 @@ public class LeaseTaskController extends BaseController {
@SysLog(title = "工器具物资类型", businessType = OperaType.EXPORT, module = "->导出物资类型")
@PostMapping("/export")
public void export(HttpServletResponse response) {
List<Integer> parentIds = service.selectParentId();
List<MaTypeVo> maTypeVos = new ArrayList<>();
ExcelUtil<MaTypeVo> util = new ExcelUtil<>(MaTypeVo.class);
for (Integer parentId : parentIds) {
maTypeVos.addAll(service.getListByParentId(parentId.longValue()));
}
util.exportExcel(response, maTypeVos, "物资类型管理数据");
List<MaTypeVoLevelTwo> maTypeVos = service.selectParentId();
ExcelUtil<MaTypeVoLevelTwo> util = new ExcelUtil<>(MaTypeVoLevelTwo.class);
util.exportExcel(response, maTypeVos, "工器具数据");
}

View File

@ -6,6 +6,7 @@ import com.bonus.material.lease.domain.LeaseApplyDetails;
import com.bonus.material.lease.domain.vo.LeaseDeptInfo;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.domain.vo.MaTypeVo;
import com.bonus.material.ma.domain.vo.MaTypeVoLevelTwo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -89,9 +90,7 @@ public interface LeaseTaskMapper {
/**
* 根据level层级和typeID 查询父级ID
*/
List<Integer> selectParentId();
List<MaTypeVo> getListByTypeName(@Param("typeId") Long typeId);
List<MaTypeVoLevelTwo> selectParentId();
void updateLeaseTaskStatus(@Param("taskId") Long taskId, @Param("taskStatus") int taskStatus);

View File

@ -8,6 +8,7 @@ import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
import com.bonus.material.lease.domain.vo.LeaseDeptInfo;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.domain.vo.MaTypeVo;
import com.bonus.material.ma.domain.vo.MaTypeVoLevelTwo;
import java.util.List;
@ -77,7 +78,7 @@ public interface ILeaseTaskService {
*/
LeaseDeptInfo getCode();
List<Integer> selectParentId();
List<MaTypeVoLevelTwo> selectParentId();
/**
@ -87,9 +88,6 @@ public interface ILeaseTaskService {
*/
List<Type> getEquipmentThreeTypes();
List<MaTypeVo> getListByParentId(Long typeId);
LeaseApplyInfo getApplyInfo(Long taskId);

View File

@ -22,6 +22,7 @@ import com.bonus.material.lease.mapper.LeaseTaskMapper;
import com.bonus.material.lease.service.ILeaseTaskService;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.domain.vo.MaTypeVo;
import com.bonus.material.ma.domain.vo.MaTypeVoLevelTwo;
import com.bonus.material.task.domain.TmTask;
import com.bonus.material.task.domain.TmTaskAgreement;
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
@ -487,21 +488,9 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
}
@Override
public List<Integer> selectParentId() {
public List<MaTypeVoLevelTwo> selectParentId() {
return mapper.selectParentId();
}
/**
* 根据组织树parent_id查询结果
*
* @param typeId 父级id
*/
@Override
public List<MaTypeVo> getListByParentId(Long typeId) {
return mapper.getListByTypeName(typeId);
}
/**
* 根据id查询领用任务信息
*

View File

@ -0,0 +1,65 @@
package com.bonus.material.ma.domain.vo;
import com.bonus.common.core.annotation.Excel;
import com.bonus.material.ma.domain.Type;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
/**
* @author : 阮世耀
* @version : 1.0
* @PackagePath: com.bonus.material.ma.vo
* @CreateTime: 2024-10-14 17:47
* @Description: 物资类型列表展示VO
*/
@Getter
@Setter
public class MaTypeVoLevelTwo {
/** 类型ID */
@ApiModelProperty(value = "类型ID")
private Long typeId;
/** 上级ID */
@ApiModelProperty(value = "上级ID")
private Long parentId;
@Excel(name = "物资名称", sort = 1)
@ApiModelProperty(value = "物资名称")
private String materialName;
@Excel(name = "规格型号", sort = 2)
@ApiModelProperty(value = "规格型号")
private String typeName;
/** 计量单位名称 */
@ApiModelProperty(value = "计量单位名称")
@Excel(name = "计量单位",sort = 3)
private String unitName;
/** 管理方式(0编号 1计数) */
@Excel(name = "管理方式", readConverterExp = "0=编号,1=计数",sort = 4)
@ApiModelProperty(value = "管理方式(0编号 1计数)")
private String manageType;
/** 层级 */
@ApiModelProperty(value = "层级")
private String level;
/** 外部租赁单价 */
@Excel(name = "外部租赁单价",sort = 7)
@ApiModelProperty(value = "外部租赁单价")
private BigDecimal rentPrice;
/** 内部租赁单价 */
@Excel(name = "内部租赁单价",sort = 6)
@ApiModelProperty(value = "内部租赁单价")
private BigDecimal leasePrice;
/** 实时库存 */
@Excel(name = "实时库存",sort = 5)
@ApiModelProperty(value = "实时库存")
private BigDecimal storageNum;
}

View File

@ -581,47 +581,28 @@
FROM ma_type m
</select>
<select id="selectParentId" resultType="java.lang.Integer">
<select id="selectParentId" resultType="com.bonus.material.ma.domain.vo.MaTypeVoLevelTwo">
SELECT DISTINCT
mt2.type_id
mt.type_name AS typeName,
mt2.type_name AS materialName,
mt3.type_name AS materialType,
mt4.type_name AS itemType,
mt.manage_type as manageType,
mt.unit_name as unitName,
mt.lease_price as leasePrice,
mt.rent_price as rentPrice,
mt.LEVEL as level,
mt.storage_num as storageNum
FROM
ma_type mt
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
where mt2.type_id is not null
ma_type mt
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
where mt2.type_id is not null and mt.del_flag = '0'
and mt.`level` = 4 and mt2.`level` = 3 and mt3.`level` = 2 and mt4.`level` = 1
</select>
<select id="getListByTypeName" resultType="com.bonus.material.ma.domain.vo.MaTypeVo">
SELECT DISTINCT
m3.type_name AS itemType,
m2.type_name AS materialType,
m1.type_name AS materialName,
m.type_id AS typeId,
m.type_name AS typeName,
m.parent_id as parentId,
m.manage_type as manageType,
m.unit_name as unitName,
m.lease_price as leasePrice,
m.rent_price as rentPrice,
m.eff_time as effTime,
m.buy_price as buyPrice,
m.LEVEL as level,
m.rated_load as ratedLoad,
m.test_load as testLoad,
m.holding_time as holdingTime,
m.remark as remark,
m.fac_model AS facModel
FROM
ma_type m
LEFT JOIN ma_type m1 ON m.parent_id = m1.type_id and m1.del_flag = '0'
LEFT JOIN ma_type m2 ON m1.parent_id = m2.type_id and m2.del_flag = '0'
LEFT JOIN ma_type m3 ON m2.parent_id = m3.type_id and m3.del_flag = '0'
WHERE m.parent_id = #{typeId} and m.del_flag = '0'
GROUP BY m.type_id
</select>
<update id="updateLeaseTaskStatus">
update tm_task
<trim prefix="SET" suffixOverrides=",">