Prechádzať zdrojové kódy

feat: export for mah

shc 1 rok pred
rodič
commit
bb2852403d

+ 61 - 0
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/WmPayOffController.java

@@ -316,6 +316,67 @@ public class WmPayOffController {
 		return exportList;
 	}
 
+	/**
+	 * 结算包结算导出
+	 *
+	 * @param input 输入参数
+	 * @return excel模型
+	 */
+	@ApiOperation(value = "积分包结算导出", notes = "积分包结算导出")
+	@ResponseExcel(name = "exportPackageSettle", sheet = "积分包结算数据")
+	@SysLog("积分包结算导出")
+	@GetMapping("/exportPackageSettleByMAH")
+	public List<WmScorePackageSettleExcelModel> exportPackageSettleByMAH(WmScorePackageSettleInput input) {
+
+		input.setMahSettleDeptId(SecurityUtils.getUser().getDeptId());
+		input.setPackageFinishStatus("1");
+		input.setTypeid("4");
+		input.setSettleFlag("1");
+		List<WmScorePackageSettleOutput> list = wmScorePackageService.listPackageSettleList(new Page<>(1, 9999), input).getRecords();
+		List<WmScorePackageSettleExcelModel> exportList = new ArrayList<>();
+		if (CollectionUtil.isEmpty(list)) {
+			return Collections.emptyList();
+		}
+
+		// 获取所有税源地的发票类目信息
+		List<SysDictItem> invoiceCategoryList =
+				dictItemService.list(Wrappers.<SysDictItem>lambdaQuery()
+						.in(SysDictItem::getType, SubjectLocation.getAllInvoices()));
+		Map<String, Map<String, String>> collect = invoiceCategoryList.stream().collect(Collectors.groupingBy(SysDictItem::getType, Collectors.toMap(SysDictItem::getValue, SysDictItem::getLabel)));
+
+		// 转换为导出实体
+		for (int i = 0; i < list.size(); i++) {
+			WmScorePackageSettleOutput settleOutput = list.get(i);
+			WmScorePackageSettleExcelModel export = new WmScorePackageSettleExcelModel();
+			export.setNumber(i + 1);
+			export.setScorePackageName(settleOutput.getScorePackageName());
+			export.setPackageType1(PackageTypeEnum.type1Resolve(settleOutput.getPackageType1()).getName2());
+			export.setPackageEntName(settleOutput.getPackageEntName());
+			export.setCreateTime(settleOutput.getCreateTime());
+			export.setPackageFinishStatus(PackageFinishStatusEnum.resolve(settleOutput.getPackageFinishStatus()).getName());
+			export.setScore(settleOutput.getScore());
+
+			SubjectLocation subjectLocation = settleOutput.getSubjectLocation();
+			if (subjectLocation != null) {
+				export.setSubType(subjectLocation.getDescription());
+				// 获取当前税源地的发票类目
+				Map<String, String> subInvoice = collect.get(subjectLocation.getInvoiceType());
+				// 根据发票类目value获取发票类目名称
+				String cate = String.valueOf(settleOutput.getInvoiceCategory());
+				String invoice = subInvoice.getOrDefault(cate, "") ;
+				export.setInvoiceCategory(invoice);
+			}
+			export.setUserNames(settleOutput.getUserNames());
+			export.setSettleAmount(settleOutput.getSettleAmount());
+			export.setActualAmount(settleOutput.getActualAmount());
+			export.setSettleStatus(SettleStatusEnum.resolve(settleOutput.getSettleStatus()).getName());
+			export.setBelongDate(settleOutput.getBelongDate());
+			exportList.add(export);
+		}
+
+		return exportList;
+	}
+
 	@ApiOperation(value = "结算", notes = "结算")
 	@SysLog("结算")
 	@PostMapping("/saveSettleInfo")