zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.changhong.epc.parsing.service.loop.impl;
 
import com.changhong.epc.bean.admin.Account;
import com.changhong.epc.bean.form.FormDataEntity;
import com.changhong.epc.config.tool.MybatisTool;
import com.changhong.epc.constter.system.businesscode.BudgetBusinessMeaningCode;
import com.changhong.epc.parsing.service.account.OrderAccountService;
import com.changhong.epc.parsing.service.loop.GmAccountService;
import com.changhong.epc.parsing.service.util.IFromOperate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.ui.ModelMap;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * 通用记账服务
 */
@Component("gmAccountServiceImpl")
@Slf4j
public class GmAccountServiceImpl extends LoopSuper implements GmAccountService,BudgetBusinessMeaningCode {
 
    @Resource(name="orderAccountServiceImpl")
    private OrderAccountService orderAccountService;
 
    @Resource(name = "fromOperate")
    private IFromOperate iFromOperate;
 
    @Override
    public void businessHandle() {
        AccountIncrement();
    }
 
    @Override
    public String getThreadName() {
        return "通用记账服务";
    }
 
    @Override
    protected void doService() {
        MybatisTool.setAdminDataSource();
        businessHandle();
    }
 
    @Override
    public void AccountIncrement() {
        log.debug("开始记账------------>");
        List<Account> list = orderAccountService.getAccount();
        log.debug("本次记账数据:"+list.size()+"条");
        list.stream().forEach(o->{
            try {
                orderAccountService.buchfuhrung(o);
            }catch (Exception e){
                FormDataEntity formDataEntity = new FormDataEntity(o.getFormId() ,Integer.parseInt(o.getDataRowNum()),o.getTenantId());
                formDataEntity.setMap(new ModelMap(ORDERSTATUS, 49));
                iFromOperate.updateFormData(formDataEntity);
                orderAccountService.updateAccountState(o.getId(),8,null);
                log.debug("记账异常id:"+o.getId());
            }
        });
    }
 
}