/**
*
*/
package com.bjsasc.modules.flow.service;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.bjsasc.modules.a.entity.ATestProcessCenter;
import com.bjsasc.modules.a.service.ATestProcessCenterService;
import com.jeesite.common.utils.SpringUtils;
/**
* 说明:流程中转Controller调用业务系统service层方法,配置在此类中
*
* @author zhangxh
* @date 2020-04-20
* @version v1.0
*/
@Component
public class CommonService {
private static final Logger LOGGER = Logger.getLogger(CommonService.class);
/**
* 将所有要注入的service类通过静态内部类加载并实例化
*/
private static final class StaticService {
// 测试service类
private static ATestProcessCenterService aTestProcessCenterService = SpringUtils.getBean(ATestProcessCenterService.class);
}
/**
* 更新业务数据,绑定流程实例id
*
* @param entityClassName
* 实体类名(如:ATestProcessCenter,不区分大小写)
* @param id
* 业务数据数据库主键id
* @param workId
* 流程实例id
*/
public static void toUpdate(String entityClassName, String id, String workId) {
if ("ATestProcessCenter".equalsIgnoreCase(entityClassName)) {
toUpdateATestProcessCenter(id, workId);
}
}
private static void toUpdateATestProcessCenter(String id, String workId) {
ATestProcessCenter apCenter = new ATestProcessCenter();
apCenter.setId(id);
apCenter.setHorizonWorkId(workId);
LOGGER.info("【log】:更新业务数据,绑定流程实例id");
StaticService.aTestProcessCenterService.update(apCenter);
}
}
Spring自动注入改用静态内部类实现
于 2020-05-24 01:12:13 首次发布