master
kira 6 years ago
parent c32c4f5832
commit 7da2f2ae24

@ -4,12 +4,13 @@ import au.com.royalpay.payment.manage.management.sysconfig.beans.FuncInfo;
import au.com.royalpay.payment.manage.management.sysconfig.beans.PartnerModuleInfo;
import au.com.royalpay.payment.manage.management.sysconfig.core.PermissionPartnerManager;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.PermissionClientModuleMapper;
import au.com.royalpay.payment.manage.mappers.system.PermissionPartnerFunctionMapper;
import au.com.royalpay.payment.manage.mappers.system.PermissionPartnerModuleMapper;
import au.com.royalpay.payment.manage.mappers.system.SysPermissionClientModulesMapper;
import au.com.royalpay.payment.manage.permission.manager.scanner.PermissionNode;
import au.com.royalpay.payment.manage.permission.manager.scanner.PermissionPartnerReader;
import au.com.royalpay.payment.manage.system.core.PermissionClientModulesService;
import au.com.royalpay.payment.manage.system.core.SystemPackageCacheSupport;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
@ -41,10 +42,12 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
@Resource
private PermissionPartnerReader permissionPartnerReader;
@Resource
private PermissionClientModuleMapper permissionClientModuleMapper;
private SysPermissionClientModulesMapper sysPermissionClientModulesMapper;
@Resource
private PermissionClientModulesService permissionClientModulesService;
@Resource
private SystemPackageCacheSupport systemPackageCacheSupport;
@Resource
private ClientMapper clientMapper;
@Override
@ -130,6 +133,7 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
}
@Override
@Transactional
public void saveOrUpdateModule(String moduleName, PartnerModuleInfo module) {
JSONObject mod = permissionPartnerModuleMapper.find(moduleName);
if (mod == null) {
@ -151,6 +155,9 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
module.initObject(mod);
permissionPartnerModuleMapper.update(mod);
sysPermissionClientModulesMapper.updateFunctionValid(mod.getString("id"),mod.getBooleanValue("initialize"));
systemPackageCacheSupport.clearClientPermissionAll();
}
@ -158,7 +165,7 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
public void checkAndDeleteModule(String moduleName) {
List<JSONObject> funcs = permissionPartnerFunctionMapper.listByModule(moduleName);
if (funcs.isEmpty()) {
permissionClientModuleMapper.delete(moduleName);
sysPermissionClientModulesMapper.delete(moduleName);
permissionPartnerModuleMapper.delete(moduleName);
} else {

@ -1,26 +0,0 @@
package au.com.royalpay.payment.manage.mappers.system;
import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonAnyFormatVisitor;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* Created by yixian on 2017-02-28.
*/
@AutoMapper(tablename = "sys_permission_partner_modules_clients", pkName = "id")
public interface PermissionClientModuleMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject clientmodules);
void delete(@Param("module_name") String moduleName);
}

@ -22,8 +22,7 @@ public interface SysPermissionClientModulesMapper {
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject module);
@AutoSql(type = SqlType.DELETE)
void delete(@Param("id") Long id);
void delete(@Param("module_name") String moduleName);
@AutoSql(type = SqlType.SELECT)
List<JSONObject> listByClientId(@Param("client_id") int client_id);
@ -37,6 +36,8 @@ public interface SysPermissionClientModulesMapper {
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid = 1")
List<JSONObject> listValidByClientId(@Param("client_id") int client_id);
void updateFunctionValid(@Param("module_id") String module_id, @Param("is_valid") boolean is_valid);
}

@ -1,70 +1,5 @@
package au.com.royalpay.payment.manage.merchants.core.impls;
import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import au.com.royalpay.payment.manage.mappers.risk.RiskAttentionMerchantsMapper;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.context.MessageSource;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMethod;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig;
import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment;
import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi;
@ -104,7 +39,6 @@ import au.com.royalpay.payment.manage.mappers.system.MailSendMapper;
import au.com.royalpay.payment.manage.mappers.system.MailUnsubMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.mappers.system.PermissionClientModuleMapper;
import au.com.royalpay.payment.manage.mappers.system.PermissionPartnerModuleMapper;
import au.com.royalpay.payment.manage.mappers.system.SysWxMerchantApplyMapper;
import au.com.royalpay.payment.manage.merchants.beans.ActivityPosterBuilder;
@ -176,9 +110,73 @@ import au.com.royalpay.payment.tools.utils.QRCodeUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import au.com.royalpay.payment.tools.websocket.notify.PartnerPageEvent;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.context.MessageSource;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMethod;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission;
/**
* partner manage Created by yixian on 2016-06-28.
*/
@ -293,8 +291,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Resource
private PermissionPartnerModuleMapper permissionPartnerModuleMapper;
@Resource
private PermissionClientModuleMapper permissionClientModuleMapper;
@Resource
private PermissionPartnerManagerImpl permissionPartnerManagerImpl;
@Resource
private RiskAttentionMerchantsMapper riskAttentionMerchantsMapper;

@ -18,4 +18,9 @@ public class SystemPackageCacheSupport {
public void clearClientPermission(int client_id){
}
@CacheEvict(value = ":system:client_permission:",allEntries = true)
public void clearClientPermissionAll(){
}
}

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.PermissionClientModuleMapper">
<delete id="delete">
delete from sys_permission_partner_modules_clients
where module_id = (SELECT id from sys_permission_partner_modules where module_name=#{module_name})
</delete>
</mapper>

@ -17,4 +17,15 @@
where pmc.client_moniker = #{client_moniker}
</select>
<update id="updateFunctionValid">
update sys_permission_partner_modules_clients
set is_valid =#{is_valid}
where module_id = #{module_id}
</update>
<delete id="delete">
delete from sys_permission_partner_modules_clients
where module_id = (SELECT id from sys_permission_partner_modules where module_name=#{module_name})
</delete>
</mapper>
Loading…
Cancel
Save