Browse Source

备件台账导出更换xml 因为数据量大

master
songguoqiang 4 months ago
parent
commit
12795f689c
  1. 18
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/ItemAccountsController.java
  2. 10
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsExcelVO.java
  3. 18
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsExportReqVO.java
  4. 2
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java
  5. 2
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsService.java
  6. 5
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsServiceImpl.java
  7. 46
      win-module-eam/win-module-eam-biz/src/main/resources/mapper/itemaccounts/ItemAccountsMapper.xml

18
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/ItemAccountsController.java

@ -139,21 +139,13 @@ public class ItemAccountsController {
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public void exportItemAccountsExcel(@Valid ItemAccountsExportReqVO exportReqVO, public void exportItemAccountsExcel(@Valid ItemAccountsExportReqVO exportReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
List<ItemAccountsDO> list = itemAccountsService.getItemAccountsList(exportReqVO); List<ItemAccountsExcelVO> list = itemAccountsService.getExportList(exportReqVO);
// 导出 Excel // 导出 Excel
List<ItemAccountsExcelVO> datas = ItemAccountsConvert.INSTANCE.convertList02(list); //List<ItemAccountsExcelVO> datas = ItemAccountsConvert.INSTANCE.convertList02(list);
for(ItemAccountsExcelVO vo:datas){
ItemDO itemDO = itemService.getByNumber(vo.getItemNumber());
vo.setItemName(itemDO.getName());
LocationDO locationDO = locationService.getByNumber(vo.getLocationNumber());
vo.setLocationName(locationDO.getName());
LocationAreaDO locationAreaDO = locationAreaService.getByNumber(vo.getAreaNumber());
vo.setAreaName(locationAreaDO.getName());
}
Map<Integer, String[]> mapDropDown = new HashMap<>(); Map<Integer, String[]> mapDropDown = new HashMap<>();
String[] type = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.ITEM_ACCOUNT_LOCATION_TYPE); // String[] type = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.ITEM_ACCOUNT_LOCATION_TYPE);
mapDropDown.put(7, type); // mapDropDown.put(7, type);
ExcelUtils.write(response, "备件台账.xls", "数据", ItemAccountsExcelVO.class, datas,mapDropDown); ExcelUtils.write(response, "备件台账.xls", "数据", ItemAccountsExcelVO.class, list,mapDropDown);
} }
@GetMapping("/get-import-template") @GetMapping("/get-import-template")

10
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsExcelVO.java

@ -6,6 +6,8 @@ import com.win.framework.excel.core.annotations.DictFormat;
import com.win.framework.excel.core.convert.DictConvert; import com.win.framework.excel.core.convert.DictConvert;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -16,6 +18,7 @@ import java.time.LocalDateTime;
* @author 超级管理员 * @author 超级管理员
*/ */
@Data @Data
@ToString(callSuper = true)
public class ItemAccountsExcelVO { public class ItemAccountsExcelVO {
@ExcelProperty("备件编号") @ExcelProperty("备件编号")
@ -39,8 +42,7 @@ public class ItemAccountsExcelVO {
@ExcelProperty("库存数量") @ExcelProperty("库存数量")
private BigDecimal qty; private BigDecimal qty;
@DictFormat("item_account_location_type") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 @ExcelProperty(value = "库存类型")
@ExcelProperty(value = "库存类型", converter = DictConvert.class)
private String type; private String type;
@ExcelProperty("ABC分类") @ExcelProperty("ABC分类")
@ -56,10 +58,6 @@ public class ItemAccountsExcelVO {
private String project; private String project;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@ExcelIgnore
private String isInAccount;
} }

18
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsExportReqVO.java

@ -1,6 +1,9 @@
package com.win.module.eam.controller.itemaccounts.vo; package com.win.module.eam.controller.itemaccounts.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.*; import lombok.*;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import com.win.framework.common.pojo.PageParam; import com.win.framework.common.pojo.PageParam;
@ -12,4 +15,19 @@ public class ItemAccountsExportReqVO {
@Schema(description = "备件编号") @Schema(description = "备件编号")
private String itemNumber; private String itemNumber;
private String itemName;
private String areaNumber;
private String locationNumber;
private String type;
private String project;
} }

2
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java

@ -10,6 +10,7 @@ import com.win.framework.mybatis.core.mapper.BaseMapperX;
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX; import com.win.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.win.framework.mybatis.core.util.QueryWrapperUtils; import com.win.framework.mybatis.core.util.QueryWrapperUtils;
import com.win.module.eam.controller.itemaccounts.vo.ItemAccountsCreateReqVO; import com.win.module.eam.controller.itemaccounts.vo.ItemAccountsCreateReqVO;
import com.win.module.eam.controller.itemaccounts.vo.ItemAccountsExcelVO;
import com.win.module.eam.controller.itemaccounts.vo.ItemAccountsExportReqVO; import com.win.module.eam.controller.itemaccounts.vo.ItemAccountsExportReqVO;
import com.win.module.eam.controller.itemaccounts.vo.ItemAccountsPageReqVO; import com.win.module.eam.controller.itemaccounts.vo.ItemAccountsPageReqVO;
import com.win.module.eam.convert.itemaccounts.ItemAccountsConvert; import com.win.module.eam.convert.itemaccounts.ItemAccountsConvert;
@ -285,6 +286,7 @@ public interface ItemAccountsMapper extends BaseMapperX<ItemAccountsDO> {
* @return * @return
*/ */
IPage<ItemAccountsDO> getAppPage(Page<ItemAccountsPageReqVO> page, @Param("vo") ItemAccountsPageReqVO reqVO); IPage<ItemAccountsDO> getAppPage(Page<ItemAccountsPageReqVO> page, @Param("vo") ItemAccountsPageReqVO reqVO);
List<ItemAccountsExcelVO> getExportList(@Param("vo") ItemAccountsExportReqVO reqVO);
/** /**
* 获取所有模具列表包括维修中和正常的 * 获取所有模具列表包括维修中和正常的

2
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsService.java

@ -100,6 +100,8 @@ public interface ItemAccountsService {
*/ */
List<ItemAccountsDO> getItemAccountsList(ItemAccountsExportReqVO exportReqVO); List<ItemAccountsDO> getItemAccountsList(ItemAccountsExportReqVO exportReqVO);
List<ItemAccountsExcelVO> getExportList(ItemAccountsExportReqVO exportReqVO);
/** /**
* 导入备件台账主信息 * 导入备件台账主信息
* *

5
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsServiceImpl.java

@ -340,6 +340,11 @@ public class ItemAccountsServiceImpl implements ItemAccountsService {
return itemAccountsMapper.selectList(exportReqVO); return itemAccountsMapper.selectList(exportReqVO);
} }
@Override
public List<ItemAccountsExcelVO> getExportList(ItemAccountsExportReqVO exportReqVO) {
return itemAccountsMapper.getExportList(exportReqVO);
}
@Override @Override
@Transactional @Transactional
public List<ItemAccountsErrorVO> importItemAccountsList(List<ItemAccountsImportExcelVO> datas, Integer mode, boolean updatePart) { public List<ItemAccountsErrorVO> importItemAccountsList(List<ItemAccountsImportExcelVO> datas, Integer mode, boolean updatePart) {

46
win-module-eam/win-module-eam-biz/src/main/resources/mapper/itemaccounts/ItemAccountsMapper.xml

@ -56,4 +56,50 @@
order by d.create_time order by d.create_time
</select> </select>
<select id="getExportList"
parameterType="com.win.module.eam.controller.itemaccounts.vo.ItemAccountsExportReqVO"
resultType="com.win.module.eam.controller.itemaccounts.vo.ItemAccountsExcelVO">
SELECT
d.area_number as 'areaNumber',
d.location_number as 'locationNumber',
d.item_number as 'itemNumber',
i.`name` as 'itemName',
c.label as type,
d.qty,
i.uom,
i.specifications,
i.project,
c1.label as 'classification',
i.use_place as 'usePlace',
d.create_time as 'createTime',
l.`name` as 'locationName',
a.name as 'areaName'
FROM
basic_item_accounts d
join basic_item i on d.item_number = i.number and i.deleted = 0
join system_dict_data c on d.type = c.`value` and c.dict_type = 'item_account_location_type'
join system_dict_data c1 on i.classification = c1.`value` and c1.dict_type = 'classification'
left join basic_location l on d.location_number = l.number and l.deleted = 0
left join basic_factory_area a on d.area_number = a.number and a.deleted = 0
WHERE
d.deleted = 0 and d.available = 'TRUE'
<if test="vo.itemNumber != null and vo.itemNumber != ''">
and d.item_number LIKE CONCAT('%', #{vo.itemNumber}, '%')
</if>
<if test="vo.type != null and vo.type != ''">
and d.type = #{vo.type}
</if>
<if test="vo.locationNumber != null and vo.locationNumber != ''">
and d.location_number = #{vo.locationNumber}
</if>
<if test="vo.areaNumber != null and vo.areaNumber != ''">
and d.area_number = #{vo.areaNumber}
</if>
<if test="vo.project != null and vo.project != ''">
and i.project LIKE CONCAT('%', #{vo.project}, '%')
</if>
order by d.create_time desc
</select>
</mapper> </mapper>

Loading…
Cancel
Save