Commit 812fc881 authored by gaopengxuan's avatar gaopengxuan

客商名称与科目名称完善

parent d4190cc9
...@@ -2,6 +2,7 @@ package com.tianyi.sync.mapper.master; ...@@ -2,6 +2,7 @@ package com.tianyi.sync.mapper.master;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.tianyi.sync.model.AccountNameModel;
import com.tianyi.sync.model.DataSyncModel; import com.tianyi.sync.model.DataSyncModel;
import com.tianyi.sync.model.ParmDataModel; import com.tianyi.sync.model.ParmDataModel;
import com.tianyi.sync.model.GroupDataSyncModel; import com.tianyi.sync.model.GroupDataSyncModel;
...@@ -17,4 +18,6 @@ public interface QueryMasterMapper { ...@@ -17,4 +18,6 @@ public interface QueryMasterMapper {
List<GroupDataSyncModel> queryGroupSingle(String period,List<String> singlePlug); List<GroupDataSyncModel> queryGroupSingle(String period,List<String> singlePlug);
List<AccountNameModel> queryAccountName();
} }
package com.tianyi.sync.model;
import java.io.Serializable;
public class AccountNameModel implements Serializable {
private String code;
private String displayname;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return displayname;
}
public void setName(String name) {
this.displayname = name;
}
}
...@@ -48,6 +48,9 @@ public class GroupSyncServiceimpl implements GroupSyncService { ...@@ -48,6 +48,9 @@ public class GroupSyncServiceimpl implements GroupSyncService {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
//String lastMonth = DateUtils.getYearAndMonthLast(); //String lastMonth = DateUtils.getYearAndMonthLast();
String lastMonth = "2024-09"; String lastMonth = "2024-09";
String[] timeParts = lastMonth.split("-");
String year = timeParts[0]; // 年份部分
String month = String.valueOf(Integer.parseInt(timeParts[1])); // 月份部分
ParmDataModel parmDataModel = new ParmDataModel(); ParmDataModel parmDataModel = new ParmDataModel();
parmDataModel.setPeriod(lastMonth); parmDataModel.setPeriod(lastMonth);
String period = parmDataModel.getPeriod(); String period = parmDataModel.getPeriod();
...@@ -88,6 +91,8 @@ public class GroupSyncServiceimpl implements GroupSyncService { ...@@ -88,6 +91,8 @@ public class GroupSyncServiceimpl implements GroupSyncService {
} }
} }
// 单边抵消c3特殊处理 // 单边抵消c3特殊处理
Map<String, String> C3_02_value = new HashMap<>(); Map<String, String> C3_02_value = new HashMap<>();
C3_02_value.put("Inc99", "Dec99"); C3_02_value.put("Inc99", "Dec99");
...@@ -231,17 +236,17 @@ public class GroupSyncServiceimpl implements GroupSyncService { ...@@ -231,17 +236,17 @@ public class GroupSyncServiceimpl implements GroupSyncService {
dataSyncList.addAll(list02); dataSyncList.addAll(list02);
if (isReverse) { if (isReverse) {
// 反向处理:money = money01 - money02 // 反向处理:money = money01 - money02
addSyncModel(dataSyncList, plugAccount, c1, destC2, entityCode, icpCode, money01 - money02); addSyncModel(dataSyncList, plugAccount,year,month, c1, destC2, entityCode, icpCode, money01 - money02);
// 如果 money01 == 0,添加第二个模型 // 如果 money01 == 0,添加第二个模型
if (money01 == 0) { if (money01 == 0) {
addSyncModel(dataSyncList, plugAccount, c1, destC2, icpCode, entityCode, money01 - money02); addSyncModel(dataSyncList, plugAccount,year,month, c1, destC2, icpCode, entityCode, money01 - money02);
} }
} else { } else {
// 正向处理:money = money02 - money01 // 正向处理:money = money02 - money01
addSyncModel(dataSyncList, plugAccount, c1, destC2, entityCode, icpCode, money02 - money01); addSyncModel(dataSyncList, plugAccount,year,month, c1, destC2, entityCode, icpCode, money02 - money01);
// 如果 money01 == 0,添加第二个模型 // 如果 money01 == 0,添加第二个模型
if (money01 == 0) { if (money01 == 0) {
addSyncModel(dataSyncList, plugAccount, c1, destC2, icpCode, entityCode, money02 - money01); addSyncModel(dataSyncList, plugAccount,year,month, c1, destC2, icpCode, entityCode, money02 - money01);
} }
} }
} }
...@@ -253,17 +258,17 @@ public class GroupSyncServiceimpl implements GroupSyncService { ...@@ -253,17 +258,17 @@ public class GroupSyncServiceimpl implements GroupSyncService {
dataSyncList.addAll(filteredList02); dataSyncList.addAll(filteredList02);
if (isReverse) { if (isReverse) {
// 反向处理:money = money01 - money02 // 反向处理:money = money01 - money02
addSyncModel(dataSyncList, plugAccount, destC1, destC2, entityCode, icpCode, money01 - money02); addSyncModel(dataSyncList, plugAccount, year,month,destC1, destC2, entityCode, icpCode, money01 - money02);
// 如果 money01 == 0,添加第二个模型 // 如果 money01 == 0,添加第二个模型
if (money01 == 0) { if (money01 == 0) {
addSyncModel(dataSyncList, plugAccount, destC1, destC2, icpCode, entityCode, money01 - money02); addSyncModel(dataSyncList, plugAccount,year,month, destC1, destC2, icpCode, entityCode, money01 - money02);
} }
} else { } else {
// 正向处理:money = money02 - money01 // 正向处理:money = money02 - money01
addSyncModel(dataSyncList, plugAccount, destC1, destC2, entityCode, icpCode, money02 - money01); addSyncModel(dataSyncList, plugAccount, year,month,destC1, destC2, entityCode, icpCode, money02 - money01);
// 如果 money01 == 0,添加第二个模型 // 如果 money01 == 0,添加第二个模型
if (money01 == 0) { if (money01 == 0) {
addSyncModel(dataSyncList, plugAccount, destC1, destC2, icpCode, entityCode, money02 - money01); addSyncModel(dataSyncList, plugAccount,year,month, destC1, destC2, icpCode, entityCode, money02 - money01);
} }
} }
} }
...@@ -340,6 +345,14 @@ public class GroupSyncServiceimpl implements GroupSyncService { ...@@ -340,6 +345,14 @@ public class GroupSyncServiceimpl implements GroupSyncService {
// 单边抵消方法处理同步数据 // 单边抵消方法处理同步数据
private List<GroupDataSyncModel> processSyncModel(GroupDataSyncModel model, List<String> singlePlug01, List<String> singlePlug02, private List<GroupDataSyncModel> processSyncModel(GroupDataSyncModel model, List<String> singlePlug01, List<String> singlePlug02,
String c3Value, String entity, String entityName) { String c3Value, String entity, String entityName) {
//获取科目名称
List<AccountNameModel> accountNameList = queryMasterMapper.queryAccountName();
Map<String, String> accountNameMap = new HashMap<>();
for (AccountNameModel accountNameModel : accountNameList) {
accountNameMap.put(accountNameModel.getCode(), accountNameModel.getName());
}
accountNameMap.put("NB2221028","各单位上交增值税");
accountNameMap.put("NB41040102","调整年初未分配利润");
List<GroupDataSyncModel> dataSyncList = new ArrayList<>(); List<GroupDataSyncModel> dataSyncList = new ArrayList<>();
// 获取对应的 account02 // 获取对应的 account02
int index = singlePlug01.indexOf(model.getAccount()); int index = singlePlug01.indexOf(model.getAccount());
...@@ -348,7 +361,7 @@ public class GroupSyncServiceimpl implements GroupSyncService { ...@@ -348,7 +361,7 @@ public class GroupSyncServiceimpl implements GroupSyncService {
GroupDataSyncModel syncModel = new GroupDataSyncModel(); GroupDataSyncModel syncModel = new GroupDataSyncModel();
BeanUtils.copyProperties(model, syncModel); BeanUtils.copyProperties(model, syncModel);
syncModel.setAccount(account02Value); syncModel.setAccount(account02Value);
syncModel.setAccountname(null); syncModel.setAccountname(accountNameMap.get(account02Value));
// 如果 c3 有值,进行设置 // 如果 c3 有值,进行设置
if (c3Value != null) { if (c3Value != null) {
syncModel.setC3(c3Value); syncModel.setC3(c3Value);
...@@ -453,10 +466,12 @@ public class GroupSyncServiceimpl implements GroupSyncService { ...@@ -453,10 +466,12 @@ public class GroupSyncServiceimpl implements GroupSyncService {
} }
} }
private void addSyncModel(List<GroupDataSyncModel> dataSyncList, String plugAccount, private void addSyncModel(List<GroupDataSyncModel> dataSyncList,String plugAccount,String year,String month,
String destC1, String destC2, String entityCode, String destC1, String destC2, String entityCode,
String icpCode, double money) { String icpCode, double money) {
GroupDataSyncModel syncModel = new GroupDataSyncModel(); GroupDataSyncModel syncModel = new GroupDataSyncModel();
syncModel.setYear(year);
syncModel.setMonth(month);
syncModel.setAccount(plugAccount); syncModel.setAccount(plugAccount);
syncModel.setICP("[ICP_None]"); syncModel.setICP("[ICP_None]");
syncModel.setC1(destC1); syncModel.setC1(destC1);
......
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
<insert id="addAll"> <insert id="addAll">
INSERT INTO elim INSERT INTO elim
( `year`, `month`, entitycode, entityname, accountcode, icpcode,icpname, orivalue,c1,c2,c3,c4,ytenant_id) ( `year`, `month`, entitycode, entityname, accountcode, accountname, icpcode,icpname, orivalue,c1,c2,c3,c4,ytenant_id)
VALUES VALUES
<foreach collection="groupFallDataModelList" item="item" index="index" separator=","> <foreach collection="groupFallDataModelList" item="item" index="index" separator=",">
(#{item.year},#{item.month},#{item.entitycode},#{item.entityname},#{item.accountcode},#{item.icpcode},#{item.icpname},#{item.orivalue}, (#{item.year},#{item.month},#{item.entitycode},#{item.entityname},#{item.accountcode},#{item.accountname},#{item.icpcode},#{item.icpname},#{item.orivalue},
#{item.c1},#{item.c2},#{item.c3},#{item.c4},#{item.ytenantId}) #{item.c1},#{item.c2},#{item.c3},#{item.c4},#{item.ytenantId})
</foreach> </foreach>
</insert> </insert>
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
accbook.name as entityname, accbook.name as entityname,
account_t, account_t,
case when account_t like 'CF%' then cash.name case when account_t like 'CF%' then cash.name
else accsubject.name else accsubject.displayname
end accountname, end accountname,
icp_t, icp_t,
accbook2.name as icpname, accbook2.name as icpname,
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
accbook.name as entityname, accbook.name as entityname,
account_t, account_t,
case when account_t like 'CF%' then cash.name case when account_t like 'CF%' then cash.name
else accsubject.name else accsubject.displayname
end accountname, end accountname,
icp_t, icp_t,
accbook2.name as icpname, accbook2.name as icpname,
...@@ -208,4 +208,13 @@ ...@@ -208,4 +208,13 @@
</foreach> </foreach>
</select> </select>
<select id="queryAccountName" resultType="com.tianyi.sync.model.AccountNameModel">
select
code,displayname
from
fiepub.epub_accsubject
where
accsubjectchart = '1749640561330487304'
</select>
</mapper> </mapper>
\ No newline at end of file
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