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 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()); } }); } }