Browse Source

fix: 资产管理入库单导出接口修改

zhongwei
haungxing 4 months ago
parent
commit
8aef0a14e6
  1. 6
      hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SpWarehouseInExportVO.java
  2. 24
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpWarehouseInServiceImpl.java

6
hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SpWarehouseInExportVO.java

@ -20,14 +20,14 @@ public class SpWarehouseInExportVO {
@ApiModelProperty(value = "单据号") @ApiModelProperty(value = "单据号")
private String code; private String code;
@ExcelProperty(value = "仓库名称", index = 1) @ExcelProperty(value = "仓库库房", index = 1)
@ApiModelProperty(value = "仓库名称") @ApiModelProperty(value = "仓库名称")
private String warehouseName; private String warehouseName;
@ApiModelProperty(value = "入库类型") @ApiModelProperty(value = "入库类型")
private Long type; private Long type;
@ExcelProperty(value = "入库类型", index = 2) @ExcelProperty(value = "入库类型", index = 2)
@ApiModelProperty(value = "入库类型名") @ApiModelProperty(value = "入库类型名")
private String typeName; private String typeName;
@ -36,7 +36,7 @@ public class SpWarehouseInExportVO {
@ApiModelProperty(value = "入库人") @ApiModelProperty(value = "入库人")
private String userName; private String userName;
@ExcelProperty(value = "创建时间", index = 4) @ExcelProperty(value = "制单时间", index = 4)
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date createTime; private Date createTime;
} }

24
hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpWarehouseInServiceImpl.java

@ -5,6 +5,7 @@ import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.converters.longconverter.LongStringConverter; import com.alibaba.excel.converters.longconverter.LongStringConverter;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -22,6 +23,7 @@ import com.hnac.hzims.spare.vo.SpWarehouseInVO;
import com.hnac.hzims.spare.vo.WtSpBasicVO; import com.hnac.hzims.spare.vo.WtSpBasicVO;
import com.hnac.hzims.spare.vo.WtSpManagementVO; import com.hnac.hzims.spare.vo.WtSpManagementVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
@ -29,9 +31,11 @@ import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
import org.springblade.system.feign.IDictBizClient; import org.springblade.system.feign.IDictBizClient;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -44,10 +48,7 @@ import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 服务实现类 * 服务实现类
@ -56,6 +57,7 @@ import java.util.Map;
*/ */
@Service @Service
@AllArgsConstructor @AllArgsConstructor
@Slf4j
public class SpWarehouseInServiceImpl extends ServiceImpl<SpWarehouseInMapper, SpWarehouseInEntity> implements ISpWarehouseInService { public class SpWarehouseInServiceImpl extends ServiceImpl<SpWarehouseInMapper, SpWarehouseInEntity> implements ISpWarehouseInService {
private static final Logger logger = LoggerFactory.getLogger(SpWarehouseInServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(SpWarehouseInServiceImpl.class);
@ -300,14 +302,12 @@ public class SpWarehouseInServiceImpl extends ServiceImpl<SpWarehouseInMapper, S
params.put("warehouseId",warehouseInVO.getStorageRoom()); params.put("warehouseId",warehouseInVO.getStorageRoom());
} }
params.put("tenantId", AuthUtil.getTenantId()); params.put("tenantId", AuthUtil.getTenantId());
IPage<SpWarehouseInVO> page = new Page<>(); List<SpWarehouseInVO> warehouseInPage = baseMapper.selectPageList(null, params);
List<SpWarehouseInVO> warehouseInPage = baseMapper.selectPageList(page, params);
// 导入列表 // 导入列表
List<SpWarehouseInExportVO> warehouseInExportList = new ArrayList<>(); List<SpWarehouseInExportVO> warehouseInExportList = new ArrayList<>();
// 数据处理 // 数据处理
warehouseInPage.forEach(warehouse -> { warehouseInPage.forEach(warehouse -> {
SpWarehouseInExportVO exportVO = new SpWarehouseInExportVO(); new SpWarehouseInExportVO();
BeanUtils.copyProperties(warehouse, exportVO);
int type = warehouse.getType().intValue(); int type = warehouse.getType().intValue();
// 入库类型 // 入库类型
String typeName; String typeName;
@ -321,9 +321,11 @@ public class SpWarehouseInServiceImpl extends ServiceImpl<SpWarehouseInMapper, S
typeName = WarehouseInType.OLD.getName(); typeName = WarehouseInType.OLD.getName();
} }
warehouse.setTypeName(typeName); warehouse.setTypeName(typeName);
// 时间格式 String userName = Optional.ofNullable(warehouse.getCreateUser()).map(UserCache::getUser).map(User::getName).orElse(null);
// warehouse.setStartTime(DateUtil.format(plan.getScheduledStartTime(), DateUtil.PATTERN_DATE)); warehouse.setUserName(userName);
// warehouse.setEndTime(DateUtil.format(plan.getScheduledEndTime(), DateUtil.PATTERN_DATE)); log.info("入库数据为:{}", JSON.toJSONString(warehouse));
SpWarehouseInExportVO exportVO = BeanUtil.copy(warehouse,SpWarehouseInExportVO.class);
warehouseInExportList.add(exportVO);
}); });
// 设置响应头 // 设置响应头
// URLEncoder.encode防止中文乱码 // URLEncoder.encode防止中文乱码

Loading…
Cancel
Save