Commit 21c6c7c3 authored by gaopengxuan's avatar gaopengxuan

现金流量表添加标识字段

parent aeb1aea9
...@@ -27,6 +27,8 @@ public class CashFlowModel implements Serializable { ...@@ -27,6 +27,8 @@ public class CashFlowModel implements Serializable {
private String icpname; private String icpname;
private String cashflow;
public String getPeriod() { public String getPeriod() {
return period; return period;
} }
...@@ -114,4 +116,12 @@ public class CashFlowModel implements Serializable { ...@@ -114,4 +116,12 @@ public class CashFlowModel implements Serializable {
public void setIcpname(String icpname) { public void setIcpname(String icpname) {
this.icpname = icpname; this.icpname = icpname;
} }
public String getCashflow() {
return cashflow;
}
public void setCashflow(String cashflowflag) {
this.cashflow = cashflowflag;
}
} }
...@@ -38,23 +38,37 @@ public class CashFlowServiceImpl implements CashFlowService { ...@@ -38,23 +38,37 @@ public class CashFlowServiceImpl implements CashFlowService {
StopWatch stopWatch = new StopWatch(); StopWatch stopWatch = new StopWatch();
stopWatch.start(); stopWatch.start();
String period= DateUtils.getYearAndMonthLast(); String period= DateUtils.getYearAndMonthLast();
//String period="2024-10"; //String period="2024-08";
List<String> stringList=fallSlaveMapper.getCodeList().stream().map(v->v.replaceAll("[a-zA-Z]", StringUtils.EMPTY)).collect(Collectors.toList()); List<String> stringList=fallSlaveMapper.getCodeList().stream().map(v->v.replaceAll("[a-zA-Z]", StringUtils.EMPTY)).collect(Collectors.toList());
List<CashFlowModel> cashFlowModels=new ArrayList<>(); List<CashFlowModel> cashFlowModels=new ArrayList<>();
stringList.forEach(v->{ stringList.forEach(v->{
List<CashFlowModel> cashFlowModelList=cashFlowMapper.getCashFlowInfo(period, v); List<CashFlowModel> cashFlowModelList=cashFlowMapper.getCashFlowInfo(period, v);
for (CashFlowModel model : cashFlowModelList) { for (CashFlowModel model : cashFlowModelList) {
String originalMonth = model.getPeriod(); // 获取月份,例如"2024-10" String originalMonth = model.getPeriod(); // 获取月份,例如"2024-10"
String accountName = model.getItemname();
if (originalMonth != null && originalMonth.contains("-")) { if (originalMonth != null && originalMonth.contains("-")) {
// 替换 "-" 为 "",得到 "202410" // 替换 "-" 为 "",得到 "202410"
String formattedMonth = originalMonth.replace("-", ""); String formattedMonth = originalMonth.replace("-", "");
model.setPeriod(formattedMonth); // 设置转换后的月份 model.setPeriod(formattedMonth); // 设置转换后的月份
} }
// 判断 accountName 的最后四个字符,根据条件设置 itemType
if (accountName != null && accountName.length() >= 4) {
String cashflowChars = accountName.substring(accountName.length() - 4); // 获取最后四个字符
if ("票据结算".equals(cashflowChars)) {
model.setCashflow("02"); // 设置为 '02'
} else if ("内部结算".equals(cashflowChars)) {
model.setCashflow("03"); // 设置为 '03'
} else {
model.setCashflow("01"); // 默认设置为 '01'
}
}
} }
cashFlowModels.addAll(cashFlowModelList); cashFlowModels.addAll(cashFlowModelList);
}); });
String yearm = period.replace("-", "");
if (!CollectionUtils.isEmpty(cashFlowModels)){ if (!CollectionUtils.isEmpty(cashFlowModels)){
fallSlaveMapper.deleteCashFlow(period); fallSlaveMapper.deleteCashFlow(yearm);
fallSlaveMapper.save(cashFlowModels); fallSlaveMapper.save(cashFlowModels);
} }
stopWatch.stop(); stopWatch.stop();
......
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
</select> </select>
<insert id="save"> <insert id="save">
INSERT INTO INSERT INTO
elimtable.free_query_cashflow(yearm,accbook,voucher,direction,money,itemcode,itemname,entityname,entitycode,icpcode,icpname) elimtable.free_query_cashflow(yearm,accbook,voucher,direction,money,itemcode,itemname,entityname,entitycode,icpcode,icpname,cashflow)
values values
<foreach collection="cashFlowModels" index="index" item="item" separator=","> <foreach collection="cashFlowModels" index="index" item="item" separator=",">
(#{item.period},#{item.entitycode},#{item.voucher},#{item.direction},#{item.money},#{item.itemcode},#{item.itemname},#{item.entityname},#{item.entitycode},#{item.icpcode},#{item.icpname}) (#{item.period},#{item.entitycode},#{item.voucher},#{item.direction},#{item.money},#{item.itemcode},#{item.itemname},#{item.entityname},#{item.entitycode},#{item.icpcode},#{item.icpname},#{item.cashflow})
</foreach> </foreach>
</insert> </insert>
......
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