 package com.leanwo.activiti.rest.db;

import javax.inject.Inject;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.leanwo.activiti.db.AccountManagementService;
import com.leanwo.activiti.dto.BaseResponse;


/**
 * @author YangZhiJie
 * @date 2022/05/29
 */

@RestController
@RequestMapping("/workflow-prodog/AccountManagementResource")
public class AccountManagementResource {

    private static Logger logger = LoggerFactory.getLogger(AccountManagementResource.class);

    @Inject
    private AccountManagementService accountManagementService; 
    
    
    /**
     * 重新加载账套
     * @param accountId
     * @return
     */
    @RequestMapping(value = "/reloadAccountManagement", method = RequestMethod.GET)
    @ResponseBody
    public BaseResponse reloadAccountManagement() {
        BaseResponse baseResponse = new BaseResponse();
        try {
            accountManagementService.loadAccountManagement(true);
            baseResponse.setErrorCode(0);
        }catch(Exception ex) {
            logger.error("重新加载账套信息失败。", ex);
            baseResponse.setErrorCode(1);
            baseResponse.setErrorMessage(ex.getMessage());
        }
        return baseResponse;
    }
    
}
