|
|
|
@ -5,6 +5,7 @@ import com.alibaba.excel.ExcelWriter;
|
|
|
|
|
import com.alibaba.excel.converters.longconverter.LongStringConverter; |
|
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet; |
|
|
|
|
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.metadata.IPage; |
|
|
|
|
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.WtSpManagementVO; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
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.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.BeanUtil; |
|
|
|
|
import org.springblade.system.entity.Dept; |
|
|
|
|
import org.springblade.system.feign.IDictBizClient; |
|
|
|
|
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.feign.IUserClient; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
@ -44,10 +48,7 @@ import java.io.IOException;
|
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 服务实现类 |
|
|
|
@ -56,6 +57,7 @@ import java.util.Map;
|
|
|
|
|
*/ |
|
|
|
|
@Service |
|
|
|
|
@AllArgsConstructor |
|
|
|
|
@Slf4j |
|
|
|
|
public class SpWarehouseInServiceImpl extends ServiceImpl<SpWarehouseInMapper, SpWarehouseInEntity> implements ISpWarehouseInService { |
|
|
|
|
|
|
|
|
|
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("tenantId", AuthUtil.getTenantId()); |
|
|
|
|
IPage<SpWarehouseInVO> page = new Page<>(); |
|
|
|
|
List<SpWarehouseInVO> warehouseInPage = baseMapper.selectPageList(page, params); |
|
|
|
|
List<SpWarehouseInVO> warehouseInPage = baseMapper.selectPageList(null, params); |
|
|
|
|
// 导入列表
|
|
|
|
|
List<SpWarehouseInExportVO> warehouseInExportList = new ArrayList<>(); |
|
|
|
|
// 数据处理
|
|
|
|
|
warehouseInPage.forEach(warehouse -> { |
|
|
|
|
SpWarehouseInExportVO exportVO = new SpWarehouseInExportVO(); |
|
|
|
|
BeanUtils.copyProperties(warehouse, exportVO); |
|
|
|
|
new SpWarehouseInExportVO(); |
|
|
|
|
int type = warehouse.getType().intValue(); |
|
|
|
|
// 入库类型
|
|
|
|
|
String typeName; |
|
|
|
@ -321,9 +321,11 @@ public class SpWarehouseInServiceImpl extends ServiceImpl<SpWarehouseInMapper, S
|
|
|
|
|
typeName = WarehouseInType.OLD.getName(); |
|
|
|
|
} |
|
|
|
|
warehouse.setTypeName(typeName); |
|
|
|
|
// 时间格式
|
|
|
|
|
// warehouse.setStartTime(DateUtil.format(plan.getScheduledStartTime(), DateUtil.PATTERN_DATE));
|
|
|
|
|
// warehouse.setEndTime(DateUtil.format(plan.getScheduledEndTime(), DateUtil.PATTERN_DATE));
|
|
|
|
|
String userName = Optional.ofNullable(warehouse.getCreateUser()).map(UserCache::getUser).map(User::getName).orElse(null); |
|
|
|
|
warehouse.setUserName(userName); |
|
|
|
|
log.info("入库数据为:{}", JSON.toJSONString(warehouse)); |
|
|
|
|
SpWarehouseInExportVO exportVO = BeanUtil.copy(warehouse,SpWarehouseInExportVO.class); |
|
|
|
|
warehouseInExportList.add(exportVO); |
|
|
|
|
}); |
|
|
|
|
// 设置响应头
|
|
|
|
|
// URLEncoder.encode防止中文乱码
|
|
|
|
|