完善操控配置功能,修改配置更新界面属性位置
This commit is contained in:
@@ -9,18 +9,38 @@ public class ManipulatCfgExport extends CfgIndexInfo {
|
||||
*/
|
||||
private static final long serialVersionUID = -842585769617969577L;
|
||||
|
||||
@ExcelField(title="action_export",dictType="SERVICE_ACTION",sort=2)
|
||||
@ExcelField(title="block_type",dictType="SERVICE_ACTION",sort=2)
|
||||
private String actionExport;
|
||||
|
||||
@ExcelField(title="response_code",sort=2)
|
||||
@ExcelField(title="method_export",dictType="SERVICE_ACTION",sort=3)
|
||||
private String methodExport;
|
||||
|
||||
@ExcelField(title="response_code",sort=3)
|
||||
private String responseCode;
|
||||
|
||||
@ExcelField(title="profile_info",sort=10)
|
||||
private String profileInfo;
|
||||
|
||||
private Integer action;
|
||||
|
||||
public String getResponseCode() {
|
||||
return responseCode;
|
||||
}
|
||||
public void setResponseCode(String responseCode) {
|
||||
this.responseCode = responseCode;
|
||||
}
|
||||
public String getMethodExport() {
|
||||
return methodExport;
|
||||
}
|
||||
public void setMethodExport(String methodExport) {
|
||||
this.methodExport = methodExport;
|
||||
}
|
||||
public String getProfileInfo() {
|
||||
return profileInfo;
|
||||
}
|
||||
public void setProfileInfo(String profileInfo) {
|
||||
this.profileInfo = profileInfo;
|
||||
}
|
||||
public String getActionExport() {
|
||||
return actionExport;
|
||||
}
|
||||
@@ -28,4 +48,11 @@ public class ManipulatCfgExport extends CfgIndexInfo {
|
||||
this.actionExport = actionExport;
|
||||
}
|
||||
|
||||
public Integer getAction() {
|
||||
return action;
|
||||
}
|
||||
public void setAction(Integer action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1915,7 +1915,7 @@ public class BaseController {
|
||||
// 代理-操控业务
|
||||
if(regionDict.getAction() != null) {
|
||||
cfg.setUserRegion5(regionDict.getAction()+"");
|
||||
if(regionDict.getAction()!=48 && regionDict.getAction()!=80) {
|
||||
if(regionDict.getAction()==85 || regionDict.getAction()==90) {
|
||||
cfg.setUserRegion4(profileId+"");
|
||||
}
|
||||
}
|
||||
@@ -2064,7 +2064,7 @@ public class BaseController {
|
||||
// 代理-操控业务
|
||||
if(regionDict.getAction() != null) {
|
||||
cfg.setUserRegion5(regionDict.getAction()+"");
|
||||
if(regionDict.getAction()!=48 && regionDict.getAction()!=80) {
|
||||
if(regionDict.getAction()==85 || regionDict.getAction()==90) {
|
||||
cfg.setUserRegion4(profileId+"");
|
||||
}
|
||||
}
|
||||
@@ -2231,7 +2231,7 @@ public class BaseController {
|
||||
// 代理-操控业务
|
||||
if(regionDict.getAction() != null) {
|
||||
cfg.setUserRegion5(regionDict.getAction()+"");
|
||||
if(regionDict.getAction()!=48 && regionDict.getAction()!=80) {
|
||||
if(regionDict.getAction()==85 || regionDict.getAction()==90) {
|
||||
cfg.setUserRegion4(profileId+"");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.callback.ProxyFileHijackCfg;
|
||||
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
|
||||
import com.nis.domain.callback.ProxyFileResponsePageCfg;
|
||||
import com.nis.domain.callback.ProxyFileStrategyCfg;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
@@ -63,6 +67,7 @@ public class ManipulatPolicyController extends BaseController {
|
||||
/*List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg());
|
||||
model.addAttribute("allProxyFileStrategys", allProxyFileStrategys);*/
|
||||
|
||||
manipulatPolicyService.setFileRegion(model);
|
||||
return "/cfg/proxy/control/manipulatPolicyList";
|
||||
}
|
||||
|
||||
@@ -115,6 +120,7 @@ public class ManipulatPolicyController extends BaseController {
|
||||
entity.getNtcSubscribeIdCfgList().add(subscribeIdCfg);
|
||||
}
|
||||
initUpdateFormCondition(model, entity);
|
||||
manipulatPolicyService.setFileRegion(model);
|
||||
} else {
|
||||
// 设置http各类配置的配置域类型
|
||||
HttpUrlCfg urlCfg = new HttpUrlCfg();
|
||||
@@ -319,18 +325,24 @@ public class ManipulatPolicyController extends BaseController {
|
||||
Map<String, String> redirectDict = DictUtils.getDictMap("REDIRECT_RESPONSE_CODE"); // Redirect
|
||||
Map<String, String> replaceDict = DictUtils.getDictMap("CONTROL_REPLACE_ZONE"); // Replace
|
||||
|
||||
// 用于检索引用的文件配置信息
|
||||
ProxyFileResponsePageCfg searchResponseFile = new ProxyFileResponsePageCfg();
|
||||
ProxyFileHijackCfg searchHijackFile = new ProxyFileHijackCfg();
|
||||
ProxyFileInsertScriptCfg searchInsertFile = new ProxyFileInsertScriptCfg();
|
||||
|
||||
Properties prop = getMsgProp();
|
||||
List<ManipulatCfgExport> baseLists = new ArrayList<ManipulatCfgExport>();
|
||||
for (CfgIndexInfo source : ipLists) {
|
||||
ManipulatCfgExport str = new ManipulatCfgExport();
|
||||
BeanUtils.copyProperties(source, str);
|
||||
|
||||
str.setActionExport("action_manipulate");
|
||||
if(str.getUserRegion5().equals("85")) {
|
||||
str.setActionExport("action_hijack");
|
||||
str.setMethodExport("action_hijack");
|
||||
}else if(str.getUserRegion5().equals("90")) {
|
||||
str.setActionExport("action_insert");
|
||||
str.setMethodExport("action_insert");
|
||||
}else {
|
||||
str.setActionExport(str.getUserRegion5());
|
||||
str.setMethodExport(str.getUserRegion5());
|
||||
}
|
||||
|
||||
if(str.getIsAudit()!=0){
|
||||
@@ -367,23 +379,35 @@ public class ManipulatPolicyController extends BaseController {
|
||||
}
|
||||
|
||||
if (str.getUserRegion5().equals("16") || str.getUserRegion5().equals("48")) {
|
||||
if (!StringUtil.isEmpty(str.getUserRegion4())) { // 是否存在文件策略
|
||||
ProxyFileStrategyCfg file = new ProxyFileStrategyCfg();
|
||||
file.setCompileId(Integer.valueOf(str.getUserRegion4()));
|
||||
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(file);
|
||||
if (!StringUtil.isEmpty(str.getUserRegion3())) { // 是否存在文件策略
|
||||
searchResponseFile.setCompileId(Integer.valueOf(str.getUserRegion3()));
|
||||
List<ProxyFileResponsePageCfg> allProxyFileStrategys = proxyFileResponsePageService.getProxyFileResponsePageCfgList(searchResponseFile);
|
||||
if (allProxyFileStrategys != null && allProxyFileStrategys.size() > 0) {
|
||||
str.setUserRegion2(allProxyFileStrategys.get(0).getCfgDesc());
|
||||
str.setUserRegion1(allProxyFileStrategys.get(0).getFileDesc());
|
||||
}
|
||||
str.setUserRegion4(null);
|
||||
str.setUserRegion3(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(str.getUserRegion5().equals("16") || str.getUserRegion5().equals("48") || str.getUserRegion5().equals("85") ||
|
||||
str.getUserRegion5().equals("90")) {
|
||||
if(str.getUserRegion5().equals("85") || str.getUserRegion5().equals("90")) {
|
||||
str.setUserRegion1(null);
|
||||
if(str.getUserRegion5().equals("85")) {
|
||||
Page<ProxyFileHijackCfg> page = proxyFileHijackService.findPage(new Page<ProxyFileHijackCfg>(request, response, "a"), searchHijackFile);
|
||||
List<ProxyFileHijackCfg> list = page.getList();
|
||||
if(list != null && list.size() > 0) {
|
||||
str.setProfileInfo(list.get(0).getCfgDesc());
|
||||
}
|
||||
//str.setUserRegion1(null);
|
||||
str.setUserRegion4(null);
|
||||
}else if(str.getUserRegion5().equals("90")) {
|
||||
Page<ProxyFileInsertScriptCfg> page = proxyFileInsertScriptService.findPage(new Page<ProxyFileInsertScriptCfg>(request, response, "a"), searchInsertFile);
|
||||
List<ProxyFileInsertScriptCfg> list = page.getList();
|
||||
if(list != null && list.size() > 0) {
|
||||
str.setProfileInfo(list.get(0).getCfgDesc());
|
||||
}
|
||||
str.setUserRegion4(null);
|
||||
}
|
||||
str.setUserRegion5(null);
|
||||
@@ -405,7 +429,7 @@ public class ManipulatPolicyController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
String cfgIndexInfoNoExport = ",block_type,policy_name,group_name,&action_export:block_type-responseCode:response_code-userregion1:response_content-userregion2:redirect_url-userregion3:replace_zone-userregion4:replaced_content-userregion5:replace_content-";
|
||||
String cfgIndexInfoNoExport = ",policy_name,group_name,&method_export:method-responseCode:response_code-userregion1:response_content-userregion2:redirect_url-userregion3:replace_zone-userregion4:replaced_content-userregion5:replace_content-";
|
||||
|
||||
String httpUrlCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
|
||||
@@ -24,4 +24,6 @@ public interface ProxyFileHijackDao extends CrudDao<ProxyFileHijackCfg>{
|
||||
public int update(ProxyFileHijackCfg entity);
|
||||
|
||||
List<ProxyFileHijackCfg> findByList(@Param("ids")String ids);
|
||||
|
||||
public List<ProxyFileHijackCfg> findHijackFiles(ProxyFileHijackCfg hijackSearch);
|
||||
}
|
||||
|
||||
@@ -326,5 +326,22 @@
|
||||
left join request_info ri on a.request_id=ri.id
|
||||
where a.CFG_ID in (${ids})
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findHijackFiles" parameterType="com.nis.domain.callback.ProxyFileHijackCfg" resultMap="ProxyFileHijackCfg">
|
||||
SELECT
|
||||
<include refid="ProxyFileHijackCfgColumn" />
|
||||
FROM
|
||||
pxy_profile_hijack_files a
|
||||
<where>
|
||||
<if test="isValid != null">
|
||||
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND a.IS_VALID != -1
|
||||
</if>
|
||||
<if test="isAudit != null">
|
||||
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -27,4 +27,6 @@ public interface ProxyFileInsertScriptDao extends CrudDao<ProxyFileInsertScriptC
|
||||
public int update(ProxyFileInsertScriptCfg entity);
|
||||
|
||||
List<ProxyFileInsertScriptCfg> findByList(@Param("ids")String ids);
|
||||
|
||||
public List<ProxyFileInsertScriptCfg> findInsertFiles(ProxyFileInsertScriptCfg insertSearch);
|
||||
}
|
||||
|
||||
@@ -320,5 +320,22 @@
|
||||
left join request_info ri on a.request_id=ri.id
|
||||
where a.CFG_ID in (${ids})
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findInsertFiles" parameterType="com.nis.domain.callback.ProxyFileInsertScriptCfg" resultMap="ProxyFileInsertScriptCfg">
|
||||
SELECT
|
||||
<include refid="ProxyFileInsertScriptCfgColumn" />
|
||||
FROM
|
||||
pxy_profile_insert_scripts a
|
||||
<where>
|
||||
<if test="isValid != null">
|
||||
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND a.IS_VALID != -1
|
||||
</if>
|
||||
<if test="isAudit != null">
|
||||
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -2571,7 +2571,7 @@ public abstract class BaseService {
|
||||
actionParam.setMethod("block");
|
||||
actionParam.setCode(Integer.valueOf(_cfg.getUserRegion1()));
|
||||
actionParam.setMessage(_cfg.getUserRegion2());
|
||||
actionParam.setHtml_profile(Integer.valueOf(_cfg.getUserRegion4()));
|
||||
actionParam.setHtml_profile(0);
|
||||
}else if(regionDict.getAction().equals(85)) {
|
||||
actionParam.setMethod("hijack");
|
||||
actionParam.setHijack_profile(Integer.valueOf(_cfg.getUserRegion4()));
|
||||
@@ -2720,7 +2720,7 @@ public abstract class BaseService {
|
||||
actionParam.setMethod("block");
|
||||
actionParam.setCode(Integer.valueOf(_cfg.getUserRegion1()));
|
||||
actionParam.setMessage(_cfg.getUserRegion2());
|
||||
actionParam.setHtml_profile(Integer.valueOf(_cfg.getUserRegion4()));
|
||||
actionParam.setHtml_profile(0);
|
||||
}else if(regionDict.getAction().equals(85)) {
|
||||
actionParam.setMethod("hijack");
|
||||
actionParam.setHijack_profile(Integer.valueOf(_cfg.getUserRegion4()));
|
||||
@@ -2851,7 +2851,7 @@ public abstract class BaseService {
|
||||
actionParam.setMethod("block");
|
||||
actionParam.setCode(Integer.valueOf(cfg.getUserRegion1()));
|
||||
actionParam.setMessage(cfg.getUserRegion2());
|
||||
actionParam.setHtml_profile(Integer.valueOf(cfg.getUserRegion4()));
|
||||
actionParam.setHtml_profile(0);
|
||||
}else if(regionDict.getAction().equals(85)) {
|
||||
actionParam.setMethod("hijack");
|
||||
actionParam.setHijack_profile(Integer.valueOf(cfg.getUserRegion4()));
|
||||
@@ -3293,8 +3293,8 @@ public abstract class BaseService {
|
||||
}else if(cfg.getUserRegion5().equals("16")) {
|
||||
actionParam.setMethod("block");
|
||||
actionParam.setCode(Integer.valueOf(cfg.getUserRegion1()));
|
||||
actionParam.setMessage(cfg.getUserRegion2());
|
||||
actionParam.setHtml_profile(Integer.valueOf(cfg.getUserRegion4()));
|
||||
actionParam.setMessage(StringUtils.isNotBlank(cfg.getUserRegion2())?cfg.getUserRegion2():"");
|
||||
actionParam.setHtml_profile(Integer.valueOf(StringUtils.isNotBlank(cfg.getUserRegion3())?cfg.getUserRegion3():"0"));
|
||||
}else if(cfg.getUserRegion5().equals("85")) {
|
||||
actionParam.setMethod("hijack");
|
||||
actionParam.setHijack_profile(Integer.valueOf(cfg.getUserRegion4()));
|
||||
|
||||
@@ -6,10 +6,15 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.callback.ProxyFileHijackCfg;
|
||||
@@ -45,6 +50,7 @@ import com.nis.web.dao.configuration.ProxyFileStrategyDao;
|
||||
import com.nis.web.dao.configuration.StringCfgDao;
|
||||
import com.nis.web.dao.configuration.WebsiteCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
@@ -520,8 +526,8 @@ public class ManipulatPolicyService extends CrudService<WebsiteCfgDao,CfgIndexIn
|
||||
if(Integer.valueOf(entity.getUserRegion5()).equals(16)){
|
||||
actionParam.setMethod("block");
|
||||
actionParam.setCode(Integer.valueOf(entity.getUserRegion1()));
|
||||
actionParam.setMessage(entity.getUserRegion2());
|
||||
actionParam.setHtml_profile(Integer.valueOf(entity.getUserRegion4()));
|
||||
actionParam.setMessage(StringUtils.isNotBlank(entity.getUserRegion2())?entity.getUserRegion2():"");
|
||||
actionParam.setHtml_profile(Integer.valueOf(StringUtils.isNotBlank(entity.getUserRegion3())?entity.getUserRegion3():"0"));
|
||||
}
|
||||
// Redirect
|
||||
if(Integer.valueOf(entity.getUserRegion5()).equals(48)){
|
||||
@@ -550,6 +556,8 @@ public class ManipulatPolicyService extends CrudService<WebsiteCfgDao,CfgIndexIn
|
||||
}
|
||||
|
||||
userRegion = gsonToJson(actionParam);
|
||||
//userRegion = StringEscapeUtils.unescapeJava(userRegion);
|
||||
|
||||
if(StringUtil.isEmpty(userRegion)){
|
||||
userRegion = Constants.USER_REGION_PLACEHOLDER;
|
||||
}
|
||||
@@ -605,19 +613,37 @@ public class ManipulatPolicyService extends CrudService<WebsiteCfgDao,CfgIndexIn
|
||||
}else if(source == 85) {
|
||||
ProxyFileHijackCfg searchEntity = new ProxyFileHijackCfg();
|
||||
searchEntity.setIsAudit(1);
|
||||
List<ProxyFileHijackCfg> list = proxyFileHijackDao.findPage(searchEntity);
|
||||
List<ProxyFileHijackCfg> list = proxyFileHijackDao.findHijackFiles(searchEntity);
|
||||
for (BaseCfg cfg : list) {
|
||||
resultList.add(cfg);
|
||||
}
|
||||
}else if(source == 90) {
|
||||
ProxyFileInsertScriptCfg searchEntity = new ProxyFileInsertScriptCfg();
|
||||
searchEntity.setIsAudit(1);
|
||||
List<ProxyFileInsertScriptCfg> list = proxyFileInsertDao.findPage(searchEntity);
|
||||
List<ProxyFileInsertScriptCfg> list = proxyFileInsertDao.findInsertFiles(searchEntity);
|
||||
for (BaseCfg cfg : list) {
|
||||
resultList.add(cfg);
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
public void setFileRegion(Model model) {
|
||||
|
||||
ProxyFileStrategyCfg searchEntity = new ProxyFileStrategyCfg();
|
||||
searchEntity.setIsAudit(1);
|
||||
ProxyFileHijackCfg hijackSearch = new ProxyFileHijackCfg();
|
||||
searchEntity.setIsAudit(1);
|
||||
ProxyFileInsertScriptCfg insertSearch = new ProxyFileInsertScriptCfg();
|
||||
searchEntity.setIsAudit(1);
|
||||
|
||||
List<ProxyFileStrategyCfg> resFileList = proxyFileDao.fingResPages(searchEntity);
|
||||
List<ProxyFileHijackCfg> hajackFilelist = proxyFileHijackDao.findHijackFiles(hijackSearch);
|
||||
List<ProxyFileInsertScriptCfg> InsertFilelist = proxyFileInsertDao.findInsertFiles(insertSearch);
|
||||
|
||||
model.addAttribute("allResponseFiles", resFileList);
|
||||
model.addAttribute("allHijackFiles", hajackFilelist);
|
||||
model.addAttribute("allInsertFiles", InsertFilelist);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user