Commit 9c6d24c4 by “zcwang”

modify:导出字段完善

parent d57b1b0a
...@@ -36,6 +36,7 @@ import com.netease.mail.yanxuan.change.biz.service.rpc.QCService; ...@@ -36,6 +36,7 @@ import com.netease.mail.yanxuan.change.biz.service.rpc.QCService;
import com.netease.mail.yanxuan.change.common.enums.BusinessFormEnum; import com.netease.mail.yanxuan.change.common.enums.BusinessFormEnum;
import com.netease.mail.yanxuan.change.common.enums.ChangeStatusEnum; import com.netease.mail.yanxuan.change.common.enums.ChangeStatusEnum;
import com.netease.mail.yanxuan.change.common.enums.ChangeSubjectEnum; import com.netease.mail.yanxuan.change.common.enums.ChangeSubjectEnum;
import com.netease.mail.yanxuan.change.common.enums.ItemSetupTypeEnum;
import com.netease.mail.yanxuan.change.common.enums.MainSpuStatusEnum; import com.netease.mail.yanxuan.change.common.enums.MainSpuStatusEnum;
import com.netease.mail.yanxuan.change.common.util.DateUtils; import com.netease.mail.yanxuan.change.common.util.DateUtils;
import com.netease.mail.yanxuan.change.common.util.ExcelUtil; import com.netease.mail.yanxuan.change.common.util.ExcelUtil;
...@@ -122,11 +123,6 @@ public class ChangeFlowExportCallback implements DesCallbackService { ...@@ -122,11 +123,6 @@ public class ChangeFlowExportCallback implements DesCallbackService {
List<ChangeFlowExcelDTO> changeFlowExcelDTOList = new ArrayList<>(); List<ChangeFlowExcelDTO> changeFlowExcelDTOList = new ArrayList<>();
// 导出excel,按照商品/供应商和行动项,n*n重复拆分,例2个商品3个行动项,拆分成2*3=6行,其他属性一致 // 导出excel,按照商品/供应商和行动项,n*n重复拆分,例2个商品3个行动项,拆分成2*3=6行,其他属性一致
for (ChangeRecord record : changeRecords) { for (ChangeRecord record : changeRecords) {
ChangeSubjectEnum changeSubjectEnum = ChangeSubjectEnum.getChangeSubjectEnum(record.getChangeSubject());
switch (changeSubjectEnum) {
case PRODUCT:
String changeItemJsonStr = record.getChangeItem();
List<ItemVO> itemVOS = JSON.parseArray(changeItemJsonStr, ItemVO.class);
List<ChangeExecRecord> changeExecRecords = changeExecRecordMapper.selectByChangeRecordId(record.getId()); List<ChangeExecRecord> changeExecRecords = changeExecRecordMapper.selectByChangeRecordId(record.getId());
List<IusUserInfoRsp> userListInfo = new ArrayList<>(); List<IusUserInfoRsp> userListInfo = new ArrayList<>();
try { try {
...@@ -135,6 +131,11 @@ public class ChangeFlowExportCallback implements DesCallbackService { ...@@ -135,6 +131,11 @@ public class ChangeFlowExportCallback implements DesCallbackService {
} catch (Exception ex) { } catch (Exception ex) {
log.info("query user info has ex", ex); log.info("query user info has ex", ex);
} }
ChangeSubjectEnum changeSubjectEnum = ChangeSubjectEnum.getChangeSubjectEnum(record.getChangeSubject());
switch (changeSubjectEnum) {
case PRODUCT:
String changeItemJsonStr = record.getChangeItem();
List<ItemVO> itemVOS = JSON.parseArray(changeItemJsonStr, ItemVO.class);
List<Long> itemIds = itemVOS.stream().map(ItemVO::getItemId).collect(Collectors.toList()); List<Long> itemIds = itemVOS.stream().map(ItemVO::getItemId).collect(Collectors.toList());
// 批量查询spu信息 // 批量查询spu信息
List<SpuTO> spuTOS = itemService.batchQuerySpuInfo(BatchQuerySpuInfoParam.builder().ids(itemIds) List<SpuTO> spuTOS = itemService.batchQuerySpuInfo(BatchQuerySpuInfoParam.builder().ids(itemIds)
...@@ -172,11 +173,14 @@ public class ChangeFlowExportCallback implements DesCallbackService { ...@@ -172,11 +173,14 @@ public class ChangeFlowExportCallback implements DesCallbackService {
} }
Optional<SpuTO> optionalSpuTO = spuTOS.stream().filter(spu -> spu.getId() == itemId).findAny(); Optional<SpuTO> optionalSpuTO = spuTOS.stream().filter(spu -> spu.getId() == itemId).findAny();
if (!optionalSpuTO.isPresent()) { if (!optionalSpuTO.isPresent()) {
changeFlowExcelDTO.setItemSetupType(null);
changeFlowExcelDTO.setBusinessForm(null);
changeFlowExcelDTO.setStatus(null);
} else { } else {
SpuTO spuTO = optionalSpuTO.get(); SpuTO spuTO = optionalSpuTO.get();
Map<String, String> propertyMap = spuTO.getPropertyMap(); Map<String, String> propertyMap = spuTO.getPropertyMap();
changeFlowExcelDTO.setItemSetupType(Integer.valueOf(propertyMap.get("itemSetupType"))); Integer itemSetupType = Integer.valueOf(propertyMap.get("itemSetupType"));
changeFlowExcelDTO.setItemSetupType(ItemSetupTypeEnum.getByType(itemSetupType));
String businessForm = propertyMap.get("businessForm"); String businessForm = propertyMap.get("businessForm");
int business = StringUtils.isBlank(businessForm) ? 0 : Integer.parseInt(businessForm); int business = StringUtils.isBlank(businessForm) ? 0 : Integer.parseInt(businessForm);
changeFlowExcelDTO.setBusinessForm(BusinessFormEnum.getByType(business)); changeFlowExcelDTO.setBusinessForm(BusinessFormEnum.getByType(business));
...@@ -203,15 +207,61 @@ public class ChangeFlowExportCallback implements DesCallbackService { ...@@ -203,15 +207,61 @@ public class ChangeFlowExportCallback implements DesCallbackService {
} }
case SUPPLIER: case SUPPLIER:
// 供应商变更,以行动项循环 // 供应商变更,以行动项循环
for (ChangeExecRecord changeExecRecord : changeExecRecords) {
// 组装通用信息,除商品信息,行动项以外其他字段一致
ChangeFlowExcelDTO changeFlowExcelDTO = this.obtainCommon(record, changeSubjectEnum);
changeFlowExcelDTO.setSupplier(record.getChangeSupplier());
changeFlowExcelDTO.setChangeItem(null);
changeFlowExcelDTO.setSPUId(null);
changeFlowExcelDTO.setQcCategory(null);
changeFlowExcelDTO.setPhyCategory(null);
changeFlowExcelDTO.setItemSetupType(null);
changeFlowExcelDTO.setBusinessForm(null);
changeFlowExcelDTO.setStatus(null);
changeFlowExcelDTO.setFunctionary(null);
changeFlowExcelDTO.setPurchase(null);
changeFlowExcelDTO.setGoodsSqe(null);
changeFlowExcelDTO.setGoodsProjectName(null);
// 组装行动项相关信息
this.obtainChangeExec(changeExecRecord, changeFlowExcelDTO, userListInfo);
changeFlowExcelDTO.setChangeResult(record.getChangeResult());
changeFlowExcelDTO
.setChangeEndTime(record.getState().equals(ChangeStatusEnum.END.getStatus())
? DateUtils.parseLongToString(record.getUpdateTime(), DateUtils.DATE_TIME_FORMAT)
: "");
changeFlowExcelDTOList.add(changeFlowExcelDTO);
}
case OTHER: case OTHER:
default: default:
// 供应商变更,以行动项循环
for (ChangeExecRecord changeExecRecord : changeExecRecords) {
// 组装通用信息,除商品信息,行动项以外其他字段一致
ChangeFlowExcelDTO changeFlowExcelDTO = this.obtainCommon(record, changeSubjectEnum);
changeFlowExcelDTO.setSupplier(null);
changeFlowExcelDTO.setChangeItem(null);
changeFlowExcelDTO.setSPUId(null);
changeFlowExcelDTO.setQcCategory(null);
changeFlowExcelDTO.setPhyCategory(null);
changeFlowExcelDTO.setItemSetupType(null);
changeFlowExcelDTO.setBusinessForm(null);
changeFlowExcelDTO.setStatus(null);
changeFlowExcelDTO.setFunctionary(null);
changeFlowExcelDTO.setPurchase(null);
changeFlowExcelDTO.setGoodsSqe(null);
changeFlowExcelDTO.setGoodsProjectName(null);
// 组装行动项相关信息
this.obtainChangeExec(changeExecRecord, changeFlowExcelDTO, userListInfo);
changeFlowExcelDTO.setChangeResult(record.getChangeResult());
changeFlowExcelDTO
.setChangeEndTime(record.getState().equals(ChangeStatusEnum.END.getStatus())
? DateUtils.parseLongToString(record.getUpdateTime(), DateUtils.DATE_TIME_FORMAT)
: "");
changeFlowExcelDTOList.add(changeFlowExcelDTO);
}
} }
} }
return changeRecords.stream().map(record -> { return changeFlowExcelDTOList;
ChangeFlowExcelDTO changeFlowExcelDTO = new ChangeFlowExcelDTO();
return changeFlowExcelDTO;
}).collect(Collectors.toList());
} }
......
/**
* @(#)ItemSetupTypeEnum.java, 2022/12/20.
* <p/>
* Copyright 2022 Netease, Inc. All rights reserved.
* NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.netease.mail.yanxuan.change.common.enums;
/**
* @Author zcwang
* @Date 2022/12/20
*/
public enum ItemSetupTypeEnum {
normal(0, "正常立项商品"),
special(2, "特殊免立项商品"),
combination(3, "组合装");
private Integer type;
private String desc;
ItemSetupTypeEnum(Integer type, String desc) {
this.type = type;
this.desc = desc;
}
public Integer getType() {
return type;
}
public String getDesc() {
return desc;
}
public static String getByType(Integer type) {
for (ItemSetupTypeEnum value : ItemSetupTypeEnum.values()) {
if (value.getType().equals(type)) {
return value.getDesc();
}
}
return "";
}
}
\ No newline at end of file
...@@ -129,7 +129,7 @@ public class ChangeFlowExcelDTO { ...@@ -129,7 +129,7 @@ public class ChangeFlowExcelDTO {
* 商品立项类型,0-正常立项商品,2-特殊免立项商品 3-组合装 * 商品立项类型,0-正常立项商品,2-特殊免立项商品 3-组合装
*/ */
@Excel(name = "商品立项类型") @Excel(name = "商品立项类型")
private Integer itemSetupType; private String itemSetupType;
/** /**
* 经营形式,0-自营,3-严选贴牌代销,4-他方品牌代销,5-代销2.0 * 经营形式,0-自营,3-严选贴牌代销,4-他方品牌代销,5-代销2.0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment