分组配置增加以ud_flag字段标识状态

This commit is contained in:
zhangwenqing
2019-06-05 17:49:39 +08:00
parent ad04b41d7a
commit f9768ab910
16 changed files with 86 additions and 37 deletions

View File

@@ -2,7 +2,7 @@ package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
public class IpCommCfgTemplate extends IpAllTemplate{
public class IpCommCfgTemplate extends IpAllNotDoLogTemplate{
@ExcelField(title="ip_group",align=2,sort=10)
private Integer groupId;

View File

@@ -7,7 +7,7 @@ import com.nis.util.excel.ExcelField;
* @author dell
*
*/
public class UrlCommCfgTemplate extends StringAllTemplate{
public class UrlCommCfgTemplate extends StringAllNotDoLogTemplate{
@ExcelField(title="url_group",align=2,sort=10)
private Integer groupId;

View File

@@ -54,7 +54,7 @@ public class IpCommGroupController extends BaseController {
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
List<CommonGroupInfo> policyGroupInfos=commonGroupManageService.findCommonGroupInfosByType(5);
model.addAttribute("page", page);
model.addAttribute("regionList", regionList);
model.addAttribute("serviceList", serviceList);
@@ -81,6 +81,7 @@ public class IpCommGroupController extends BaseController {
HttpServletRequest request, HttpServletResponse response) {
try {
ipCommGroupCfgService.saveIpCommGroupCfg(cfg);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
logger.error("信息保存失败", e);
if (e instanceof MaatConvertException) {
@@ -123,9 +124,9 @@ public class IpCommGroupController extends BaseController {
@RequestMapping(value = { "/delete" })
@RequiresPermissions(value = { "ip:common:config" })
public String delete(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes) {
public String delete(String compileIds, String ids, Integer functionId, RedirectAttributes redirectAttributes) {
try {
ipCommGroupCfgService.delete(ids);
ipCommGroupCfgService.delete(ids, compileIds);
addMessage(redirectAttributes, "success", "delete_success");
} catch (Exception e) {
logger.error("Delete failed", e);

View File

@@ -66,6 +66,7 @@ public class UrlCommGroupController extends BaseController{
HttpServletRequest request,HttpServletResponse response){
try{
urlCommGroupService.saveUrlCommGroupCfg(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) {
@@ -105,11 +106,9 @@ public class UrlCommGroupController extends BaseController{
}
@RequestMapping(value = {"/delete"})
public String delete(Integer isValid
,String ids,Integer functionId
,RedirectAttributes redirectAttributes){
public String delete(String compileIds, String ids, Integer functionId, RedirectAttributes redirectAttributes){
try{
urlCommGroupService.delete(ids);
urlCommGroupService.delete(ids,compileIds);
addMessage(redirectAttributes,"success","delete_success");
}catch(Exception e){
logger.error("Delete failed",e);

View File

@@ -17,5 +17,7 @@ public interface CommonGroupManageDao extends CrudDao<CommonGroupInfo> {
List<CommonGroupInfo> findCommonGroupInfosByType(int groupType);
List<CommonGroupInfo> findGroupInfoList(@Param("ids")String ids);
void updateGroupStatus(@Param("serviceGroupId")String serviceGroupId, @Param("udFlag")Integer udFlag, @Param("groupType")Integer groupType);
}

View File

@@ -172,4 +172,12 @@
r.group_id IN (${ids})
</select>
<update id="updateGroupStatus">
UPDATE
policy_group_info
SET
ud_flag = #{udFlag,jdbcType=INTEGER}
WHERE
service_group_id IN (${serviceGroupId}) AND group_type = #{groupType}
</update>
</mapper>

View File

@@ -489,9 +489,6 @@
<if test="cfgRegionCode != null " >
CFG_REGION_CODE = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="userRegion1 != null and userRegion1 != ''" >
USER_REGION1 = #{userRegion1,jdbcType=VARCHAR},
</if>
<if test="userRegion2 != null and userRegion2 != ''" >
USER_REGION2 = #{userRegion2,jdbcType=VARCHAR},
</if>

View File

@@ -192,7 +192,7 @@
FROM
url_comm_cfg r
WHERE
r.user_region3 IN(${ids}) AND r.is_valid != -1
r.group_id IN(${ids}) AND r.is_valid != -1
</select>
<insert id="insertUrlCommGroupCfg" parameterType="com.nis.domain.basics.UrlCommCfg">
@@ -358,9 +358,6 @@
<if test="groupId != null">
group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="userRegion1 != null and userRegion1 != ''" >
user_region1 = #{userRegion1,jdbcType=VARCHAR},
</if>
<if test="userRegion2 != null and userRegion2 != ''" >
user_region2 = #{userRegion2,jdbcType=VARCHAR},
</if>

View File

@@ -151,4 +151,30 @@ public class CommonGroupManageService extends BaseService{
return false;
}
/**
* 更新分组状态 policy_group_info ud_flag0无有效的域配置 1存在有效的域配置
* @param serviceGroupId
* @param groupType
*/
public void updateGroupStatus(String serviceGroupId, Integer groupType) {
/**
* void updateUdFlag(String groupIds, Integer udFlag, Integer groupType);
*/
Integer udFlag = 0;
if(groupType == 5) { // IP
List<IpCommCfg> list = ipCommGroupCfgDao.getCfgInfoByGroupIds(serviceGroupId);
if(list.size() > 0) {
udFlag = 1; // 可用
}
}else if(groupType == 7) { // URL
List<UrlCommCfg> list = urlCommGroupDao.getCfgInfoByGroupIds(serviceGroupId);
if(list.size() > 0) {
udFlag = 1;
}
}
commonGroupManageDao.updateGroupStatus(serviceGroupId, udFlag, groupType);
}
}

View File

@@ -33,6 +33,8 @@ public class IpCommGroupCfgService extends BaseService {
@Autowired
private IpCommGroupCfgDao ipCommGroupCfgDao;
private CommonGroupManageService groupManageService = SpringContextHolder.getBean(CommonGroupManageService.class);
/**
* @param page
* @param entity
@@ -68,6 +70,10 @@ public class IpCommGroupCfgService extends BaseService {
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void update(IpCommCfg entity){
ipCommGroupCfgDao.update(entity);
// 更新分组状态
groupManageService.updateGroupStatus(entity.getUserRegion1(), 5); // old
groupManageService.updateGroupStatus(entity.getGroupId()+"", 5); // new
}
@@ -106,16 +112,20 @@ public class IpCommGroupCfgService extends BaseService {
entity.getIpCommGroupCfgList().get(i).setGroupId(entity.getGroupId());
ipCommGroupCfgDao.insertForBatch(entity.getIpCommGroupCfgList().get(i));
}
// 更新分组状态
groupManageService.updateGroupStatus(entity.getGroupId()+"", 5);
}
}
public void delete(String ids) {
// TODO 公共组配置删除时 需检索是否被其它业务配置引用,没被引用可删除
public void delete(String ids, String compileIds) {
if(ids==null) {
throw new RuntimeException("ids is null!");
}
ipCommGroupCfgDao.delete(ids);
// 更新分组状态
groupManageService.updateGroupStatus(compileIds, 5);
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)

View File

@@ -17,13 +17,16 @@ import com.nis.util.Constants;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.basics.UrlCommGroupDao;
import com.nis.web.service.CrudService;
import com.nis.web.service.SpringContextHolder;
@Service
public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCommCfg>{
@Autowired
private UrlCommGroupDao urlCommGroupDao;
private CommonGroupManageService groupManageService = SpringContextHolder.getBean(CommonGroupManageService.class);
public Page<UrlCommCfg> findPage(Page<UrlCommCfg> page, UrlCommCfg entity) {
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
entity.setPage(page);
@@ -78,11 +81,9 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
urlCommGroupDao.insertUrlCommGroupCfg(entity.getUrlCommGroupList().get(i));
}
// //修改公共组的标识
// Integer udFlag=urlCommGroupDao.findUrlUdFlag(Integer.parseInt(entity.getUserRegion3()));
// if(udFlag == 0){
// urlCommGroupDao.updateUrlUdFlag(Integer.parseInt(entity.getUserRegion3()), 1);
// }
// 更新分组状态
groupManageService.updateGroupStatus(entity.getGroupId()+"", 7);
}
}
@@ -99,12 +100,18 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
entity.setExprType(0);
}
urlCommGroupDao.update(entity);
// 更新分组状态
groupManageService.updateGroupStatus(entity.getUserRegion1(), 7); // old
groupManageService.updateGroupStatus(entity.getGroupId()+"", 7); // new
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void delete(String ids) {
public void delete(String ids, String groupIds) {
urlCommGroupDao.delete(ids);
// 更新分组状态
groupManageService.updateGroupStatus(groupIds, 7);
}
public List<UrlCommCfg> getByIds(String ids) {