|
|
@@ -56,9 +56,18 @@ public class AsyncUtils {
|
|
|
private TOrderMidMapper tOrderMidMapper;
|
|
|
@Autowired
|
|
|
private RoleMapper roleMapper;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private ExpenseAccountMapper expenseAccountMapper;
|
|
|
+ @Autowired
|
|
|
+ private TOrderInvoiceMapper tOrderInvoiceMapper;
|
|
|
+ @Autowired
|
|
|
+ private TTaskMemberMapper tTaskMemberMapper;
|
|
|
+ @Autowired
|
|
|
+ private TOrderPaymentMapper tOrderPaymentMapper;
|
|
|
@Autowired
|
|
|
private AdminUserCountMapper adminUserCountMapper;
|
|
|
+ @Autowired
|
|
|
+ private FinanceCountMapper financeCountMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -669,10 +678,97 @@ public class AsyncUtils {
|
|
|
newOrderChangeMapper.updateExamineById(id,OrderChangeProcess.CWZY.getCode());
|
|
|
}
|
|
|
|
|
|
- public void updateFinanceExamineAndDep(String id, String financeId){
|
|
|
+ public void updateFinanceExamineAndDep(String id, String financeId, String depFinanceId){
|
|
|
updateFinanceExamine( id);
|
|
|
tOrderMidMapper.updateFinanceId(id,financeId);
|
|
|
+ //如果切换财务,俩个财务都需要重新计算
|
|
|
+ financeCoutSwitch(financeId,depFinanceId);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void financeCoutSwitch(String financeId, String depFinanceId) {
|
|
|
+ List<FinanceCount> list=new ArrayList<>();
|
|
|
+ financeCountRestart(financeId,list);
|
|
|
+ financeCountRestart(depFinanceId,list);
|
|
|
+ listBatches(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void financeCoutSwitch(String financeId) {
|
|
|
+ List<FinanceCount> list=new ArrayList<>();
|
|
|
+ financeCountRestart(financeId,list);
|
|
|
+ listBatches(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void listBatches(List<FinanceCount> list) {
|
|
|
+ List<FinanceCount> addList=new ArrayList<>();
|
|
|
+ for (int i = 0; i <list.size(); i++) {
|
|
|
+ FinanceCount financeCount = list.get(i);
|
|
|
+ FinanceCount newFc=FinanceCount.initialization(financeCount);
|
|
|
+ addList.add(newFc);
|
|
|
+ if (addList.size()==50||i==list.size()-1){
|
|
|
+ financeCountMapper.insetBatch(addList);
|
|
|
+ addList.clear();
|
|
|
+ try {
|
|
|
+ Thread.sleep(500);
|
|
|
+ } catch (InterruptedException exception) {
|
|
|
+ exception.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ private void financeCountRestart(String financeId, List<FinanceCount> list) {
|
|
|
+ List<FinanceCount> aList=new ArrayList<>();
|
|
|
+ List<FinanceCount> orderList = tOrderNewMapper.selectCountByFinance(financeId);
|
|
|
+ if (!orderList.isEmpty()){
|
|
|
+ aList.addAll(orderList);
|
|
|
+ }
|
|
|
+ List<FinanceCount> expenseList = expenseAccountMapper.selectCountByFinance(financeId);
|
|
|
+ pushFinanceList(aList, expenseList,0);
|
|
|
+ List<FinanceCount> invoiceList =tOrderInvoiceMapper.selectCountByFinance(financeId);
|
|
|
+ pushFinanceList(aList, invoiceList,1);
|
|
|
+ List<FinanceCount> memberList =tTaskMemberMapper.selectCountByFinance(financeId);
|
|
|
+ pushFinanceList(aList, memberList,2);
|
|
|
+ List<FinanceCount> paymentList =tOrderPaymentMapper.selectCountByFinance(financeId);
|
|
|
+ pushFinanceList(aList, paymentList,3);
|
|
|
+ if (!aList.isEmpty()){
|
|
|
+ list.addAll(aList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param list
|
|
|
+ * @param minList
|
|
|
+ * @param type
|
|
|
+ */
|
|
|
+ private void pushFinanceList(List<FinanceCount> list, List<FinanceCount> minList,Integer type) {
|
|
|
+ if (!minList.isEmpty()){
|
|
|
+ for (FinanceCount expense : minList) {
|
|
|
+ boolean flag=true;
|
|
|
+ for (FinanceCount e : list) {
|
|
|
+ if (e.getDateTime().getTime()==expense.getDateTime().getTime()){
|
|
|
+ if (type==0){
|
|
|
+ e.setExpenseCount(expense.getExpenseCount());
|
|
|
+ e.setExpenseUnauditedCount(expense.getExpenseUnauditedCount());
|
|
|
+ }else if (type==1){
|
|
|
+ e.setInvoiceCount(expense.getInvoiceCount());
|
|
|
+ e.setInvoiceUnauditedCount(expense.getInvoiceUnauditedCount());
|
|
|
+ }else if (type==2){
|
|
|
+ e.setMemberCount(expense.getMemberCount());
|
|
|
+ e.setMemberUnauditedCount(expense.getMemberUnauditedCount());
|
|
|
+ }else if (type==3){
|
|
|
+ e.setPaymentCount(expense.getPaymentCount());
|
|
|
+ e.setPaymentUnauditedCount(expense.getPaymentUnauditedCount());
|
|
|
+ }
|
|
|
+ flag=false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag){
|
|
|
+ list.add(expense);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void updateAdminUserOrderCount(List<AdminUserCount> tramsferList) {
|