| | |
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.config.SystemConfigDao;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.system.SystemConfig;
|
| | | import com.yeshi.fanli.exception.NotExistObjectException;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | |
|
| | |
| | | private SystemConfigDao systemConfigDao;
|
| | |
|
| | | @Resource
|
| | | private SystemService systemService;
|
| | | private BusinessSystemService businessSystemService;
|
| | |
|
| | | public int getCount(System system,String key) {
|
| | | public int getCount(BusinessSystem system,String key) {
|
| | | Long lcount;
|
| | | if(system!=null){
|
| | | lcount = systemConfigDao.getCount("select count(sc.id) from SystemConfig sc left join sc.systems s where s.id=? and sc.name like ?",new Serializable[]{system.getId(),"%"+key+"%"});
|
| | |
| | | return lcount.intValue();
|
| | | }
|
| | |
|
| | | public List<SystemConfig> getSystemConfigList(int index,System system, String key) {
|
| | | public List<SystemConfig> getSystemConfigList(int index,BusinessSystem system, String key) {
|
| | |
|
| | | int start =index * Constant.PAGE_SIZE;
|
| | | List<SystemConfig> list;
|
| | |
| | | }
|
| | |
|
| | | public void addSystemConfig(SystemConfig sc) {
|
| | | Set<System> systems = sc.getSystems();
|
| | | Set<System> newSystems=new HashSet<System>();
|
| | | for (System system : systems) {
|
| | | Set<BusinessSystem> systems = sc.getSystems();
|
| | | Set<BusinessSystem> newSystems=new HashSet<BusinessSystem>();
|
| | | for (BusinessSystem system : systems) {
|
| | | String platform = Utils.getMap().get(String.valueOf(system.getPlatform()));
|
| | | String packages = system.getPackageName();
|
| | | System find = systemService.getSystem(platform, packages);
|
| | | BusinessSystem find = businessSystemService.getBusinessSystem(platform, packages);
|
| | | if(find != null){
|
| | | newSystems.add(find);
|
| | | }
|
| | |
| | | systemConfigDao.save(sc);
|
| | | }
|
| | |
|
| | | public void deleteSystem(long id, System system) throws NotExistObjectException {
|
| | | public void deleteSystem(long id, BusinessSystem system) throws NotExistObjectException {
|
| | | SystemConfig find = systemConfigDao.find(SystemConfig.class, id);
|
| | | if(find==null){
|
| | | throw new NotExistObjectException("不存在该子系统");
|
| | |
| | | systemConfigDao.update(find);
|
| | | }
|
| | |
|
| | | public void addSystem(long id, System system) throws NotExistObjectException {
|
| | | public void addSystem(long id, BusinessSystem system) throws NotExistObjectException {
|
| | | SystemConfig find = systemConfigDao.find(SystemConfig.class, id);
|
| | | if(find==null){
|
| | | throw new NotExistObjectException("不存在该子系统");
|
| | |
| | | throw new NotExistObjectException("不存在该对象");
|
| | | }
|
| | | sc.setUpdatetime(java.lang.System.currentTimeMillis());
|
| | | Set<System> newSystems=new HashSet<System>();
|
| | | Set<System> systems = sc.getSystems();
|
| | | for (System system : systems) {
|
| | | Set<BusinessSystem> newSystems=new HashSet<BusinessSystem>();
|
| | | Set<BusinessSystem> systems = sc.getSystems();
|
| | | for (BusinessSystem system : systems) {
|
| | | String platform = Utils.getMap().get(String.valueOf(system.getPlatform()));
|
| | | String packages = system.getPackageName();
|
| | | System sfind = systemService.getSystem(platform, packages);
|
| | | BusinessSystem sfind = businessSystemService.getBusinessSystem(platform, packages);
|
| | | if(sfind != null){
|
| | | newSystems.add(sfind);
|
| | | }
|
| | |
| | | return list.get(0).getValue();
|
| | | }
|
| | | @Cacheable(value={"childSystemCache"}, key="#p0+#system.id")
|
| | | public String get(String key, System system) {
|
| | | public String get(String key, BusinessSystem system) {
|
| | | if(system==null || system.getId()==0){
|
| | | return "";
|
| | | }
|