更新组状态方法修改

This commit is contained in:
wangxin
2019-06-10 14:10:00 +08:00
parent b22cfec67f
commit 2f74cd03cc
11 changed files with 364 additions and 41 deletions

View File

@@ -5,6 +5,8 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.web.dao.basics.PolicyGroupInfoDao;
import org.apache.commons.collections.CollectionUtils;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
@@ -32,9 +34,11 @@ public class IpCommGroupCfgService extends BaseService {
@Autowired
private IpCommGroupCfgDao ipCommGroupCfgDao;
@Autowired
private PolicyGroupInfoDao policyGroupInfoDao;
private CommonGroupManageService groupManageService = SpringContextHolder.getBean(CommonGroupManageService.class);
/**
* @param page
* @param entity
@@ -69,11 +73,13 @@ public class IpCommGroupCfgService extends BaseService {
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void update(IpCommCfg entity){
List<PolicyGroupInfo> policyGroupInfosOld=policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1());
List<PolicyGroupInfo> policyGroupInfosNew=policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString());
ipCommGroupCfgDao.update(entity);
// 更新分组状态
groupManageService.updateGroupStatus(entity.getUserRegion1(), 5); // old
groupManageService.updateGroupStatus(entity.getGroupId()+"", 5); // new
groupManageService.updateGroupStatus(policyGroupInfosOld, 5); // old
groupManageService.updateGroupStatus(policyGroupInfosNew, 5); // new
}
@@ -87,10 +93,10 @@ public class IpCommGroupCfgService extends BaseService {
//新增
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveIpCommGroupCfg(CfgIndexInfo entity) {
//TODO 组配置更新时 需检索是否被其它配置引用,若被引用需调用相应服务接口更新配置
Date createTime=new Date();
if(CollectionUtils.isNotEmpty(entity.getIpCommGroupCfgList())) {
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString());
for (int i = 0; i < entity.getIpCommGroupCfgList().size(); i++) {
BeanUtils.copyProperties(entity, entity.getIpCommGroupCfgList().get(i), new String[]{"cfgId","userregion3"});
Integer regionId = 0;
@@ -113,19 +119,22 @@ public class IpCommGroupCfgService extends BaseService {
ipCommGroupCfgDao.insertForBatch(entity.getIpCommGroupCfgList().get(i));
}
// 更新分组状态
groupManageService.updateGroupStatus(entity.getGroupId()+"", 5);
groupManageService.updateGroupStatus(policyGroupInfos, 5);
//TODO 组配置更新时 需检索是否被其它配置引用,若被引用需调用相应服务接口更新配置
//transObjGroupToMaat(policyGroupInfos);
}
}
public void delete(String ids, String compileIds) {
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(compileIds);
if(ids==null) {
throw new RuntimeException("ids is null!");
}
ipCommGroupCfgDao.delete(ids);
// 更新分组状态
groupManageService.updateGroupStatus(compileIds, 5);
groupManageService.updateGroupStatus(policyGroupInfos, 5);
//transObjGroupToMaat(policyGroupInfos);
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
@@ -174,5 +183,4 @@ public class IpCommGroupCfgService extends BaseService {
cfgs.clear();
cfgs=null;
}
}