Commit b9ec9417 by “zcwang”

modify: 导出发起人改为和详情一致

parent d0be4d39
Pipeline #44727 passed with stages
in 1 minute 51 seconds
......@@ -55,7 +55,9 @@ import com.netease.mail.yanxuan.change.dal.meta.model.vo.ItemVO;
import com.netease.mail.yanxuan.change.integration.excel.ChangeFlowExcelDTO;
import com.netease.mail.yanxuan.change.integration.excel.ChangeFlowExcelVo;
import com.netease.mail.yanxuan.change.integration.flow.UserQueryDTO;
import com.netease.mail.yanxuan.change.integration.flow.ius.req.IusDepartmentReq;
import com.netease.mail.yanxuan.change.integration.flow.ius.rsp.IusUserInfoRsp;
import com.netease.mail.yanxuan.change.integration.flow.ius.rsp.SecondaryDepartments;
import com.netease.mail.yanxuan.change.integration.item.SimplePhyCateGoryResultCo;
import com.netease.mail.yanxuan.change.integration.item.meta.SpuTO;
import com.netease.mail.yanxuan.change.integration.item.param.BatchQuerySpuInfoParam;
......@@ -124,15 +126,21 @@ public class ChangeFlowExportCallback implements DesCallbackService {
if (CollectionUtils.isEmpty(changeRecords)) {
return Lists.newArrayList();
}
// 提前查询所有创建人及行动项用户名
List<String> allExecUserEmailList = new ArrayList<>();
// 过滤不为供应商的创建人
List<String> creatorList = changeRecords.stream()
.filter(c -> !CreateSourceEnum.TONG_ZHOU.getType().equals(c.getCreateSource()))
.map(ChangeRecord::getCreator).collect(Collectors.toList());
HashMap<String, List<SecondaryDepartments>> orgMap = null;
if (CollectionUtils.isNotEmpty(creatorList)) {
allExecUserEmailList.addAll(creatorList);
// 查询创建人部门名
IusDepartmentReq iusDepartmentReq = new IusDepartmentReq();
iusDepartmentReq.setUids(new ArrayList<>(creatorList));
iusDepartmentReq.setIcac(true);
orgMap = iusService.queryDepartment(iusDepartmentReq);
}
// 提前查询所有创建人及行动项用户名
List<String> allExecUserEmailList = new ArrayList<>();
for (ChangeRecord changeRecord : changeRecords) {
List<ChangeExecRecord> changeExecRecords = changeExecRecordMapper.selectByChangeRecordId(changeRecord.getId());
List<String> collect = changeExecRecords.stream()
......@@ -193,7 +201,7 @@ public class ChangeFlowExportCallback implements DesCallbackService {
for (ChangeExecRecord changeExecRecord : changeExecRecords) {
Long itemId = itemVO.getItemId();
// 组装通用信息,除商品信息,行动项以外其他字段一致
ChangeFlowExcelDTO changeFlowExcelDTO = this.obtainCommon(record, changeSubjectEnum, userListInfo);
ChangeFlowExcelDTO changeFlowExcelDTO = this.obtainCommon(record, changeSubjectEnum, orgMap);
changeFlowExcelDTO.setSupplier("/");
changeFlowExcelDTO.setChangeItem(itemVO.getItemName());
changeFlowExcelDTO.setSPUId(itemId);
......@@ -260,7 +268,7 @@ public class ChangeFlowExportCallback implements DesCallbackService {
// 供应商变更,以行动项循环
for (ChangeExecRecord changeExecRecord : changeExecRecords) {
// 组装通用信息,除商品信息,行动项以外其他字段一致
ChangeFlowExcelDTO changeFlowExcelDTO = this.obtainCommon(record, changeSubjectEnum, userListInfo);
ChangeFlowExcelDTO changeFlowExcelDTO = this.obtainCommon(record, changeSubjectEnum, orgMap);
changeFlowExcelDTO.setSupplier(StringUtils.isBlank(record.getChangeSupplier())? "/": record.getChangeSupplier());
changeFlowExcelDTO.setChangeItem(null);
changeFlowExcelDTO.setSPUId(null);
......@@ -344,8 +352,7 @@ public class ChangeFlowExportCallback implements DesCallbackService {
* @param changeSubjectEnum
* @return
*/
private ChangeFlowExcelDTO obtainCommon(ChangeRecord record, ChangeSubjectEnum changeSubjectEnum,
List<IusUserInfoRsp> userListInfo) {
private ChangeFlowExcelDTO obtainCommon(ChangeRecord record, ChangeSubjectEnum changeSubjectEnum, HashMap<String, List<SecondaryDepartments>> orgMap) {
ChangeFlowExcelDTO changeFlowExcelDTO = new ChangeFlowExcelDTO();
changeFlowExcelDTO.setFlowId(record.getFlowId());
String createTimeStr = DateUtils.parseLongToString(record.getCreateTime(), DateUtils.DATE_TIME_FORMAT);
......@@ -354,7 +361,16 @@ public class ChangeFlowExportCallback implements DesCallbackService {
if (CreateSourceEnum.TONG_ZHOU.getType().equals(record.getCreateSource())) {
changeFlowExcelDTO.setChangeCreator(record.getCreateSupplier());
} else {
List<SecondaryDepartments> creator = orgMap.get(record.getCreator());
// 供应商查询不到数据,不会覆盖,展示供应商id
if (!CollectionUtils.isEmpty(creator)) {
Optional<SecondaryDepartments> anyOrg = creator.stream().filter(o -> o.getOrgPosLevel() == 97).findAny();
String orgName = "无三级部门";
if (anyOrg.isPresent()) {
orgName = anyOrg.get().getOrgPosName();
}
changeFlowExcelDTO.setChangeCreator(creator.get(0).getUserName() + "(" + orgName + ")");
}
}
changeFlowExcelDTO.setChangeSubject(changeSubjectEnum.getDesc());
ChangeType parentChangeType = changeTypeService.getChangeTypeById(record.getParentChangeClassId());
......
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