Skip to content

Commit

Permalink
Merge pull request #7 from roncoo/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
leslie52 authored Aug 15, 2016
2 parents 660d083 + c240294 commit a764002
Show file tree
Hide file tree
Showing 59 changed files with 586 additions and 826 deletions.
8 changes: 8 additions & 0 deletions UPDATELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
###### v0.0.4-2016.8.15
1. 修复权限模块bug
2. 修改对账模块配置文件路径
3. 去除登录指引
4. 修复网关界面轮询bug

----------------------------------------------------------------------------------

###### v0.0.3-2016.8.7
1. 修改taglib.jsp路径
2. 更新maven 依赖jar包,去除javaee-api.jar
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.roncoo.pay.common</groupId>
<artifactId>roncoo-pay</artifactId>
<version>0.0.3-SNAPSHOT</version>
<version>0.0.4-SNAPSHOT</version>
<packaging>pom</packaging>

<name>roncoo-pay</name>
Expand Down
4 changes: 2 additions & 2 deletions roncoo-pay-app-notify/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>com.roncoo.pay.common</groupId>
<artifactId>roncoo-pay</artifactId>
<version>0.0.3-SNAPSHOT</version>
<version>0.0.4-SNAPSHOT</version>
</parent>
<groupId>com.roncoo.pay.common</groupId>
<artifactId>roncoo-pay-app-notify</artifactId>
<version>0.0.3-SNAPSHOT</version>
<version>0.0.4-SNAPSHOT</version>
<name>roncoo-app-notify</name>
<url>http://maven.apache.org</url>
<properties>
Expand Down
2 changes: 1 addition & 1 deletion roncoo-pay-app-reconciliation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.roncoo.pay.common</groupId>
<artifactId>roncoo-pay</artifactId>
<version>0.0.3-SNAPSHOT</version>
<version>0.0.4-SNAPSHOT</version>
</parent>
<groupId>com.roncoo.pay.app</groupId>
<artifactId>roncoo-pay-app-reconciliation</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd">

<!-- 定时任务 -->
<bean id="reconciliationTask" class="com.roncoo.app.reconciliation.ReconciliationTask" />
<bean id="reconciliationTask" class="com.roncoo.pay.app.reconciliation.ReconciliationTask" />
<task:scheduled-tasks>
<!-- 每天上午10点15分触发 -->
<task:scheduled ref="reconciliationTask" method="main" cron="0 15 10 * * ?" />
Expand Down
2 changes: 1 addition & 1 deletion roncoo-pay-app-settlement/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.roncoo.pay.common</groupId>
<artifactId>roncoo-pay</artifactId>
<version>0.0.3-SNAPSHOT</version>
<version>0.0.4-SNAPSHOT</version>
</parent>
<groupId>com.roncoo.pay.app</groupId>
<artifactId>roncoo-pay-app-settlement</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion roncoo-pay-common-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.roncoo.pay.common</groupId>
<artifactId>roncoo-pay</artifactId>
<version>0.0.3-SNAPSHOT</version>
<version>0.0.4-SNAPSHOT</version>
</parent>
<artifactId>roncoo-pay-common-core</artifactId>
<name>roncoo-pay-common-core</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public static Map<String, Map<String, Object>> toMap() {
for (int num = 0; num < ary.length; num++) {
Map<String, Object> map = new HashMap<String, Object>();
String key = ary[num].name();
map.put("value", ary[num].name());
map.put("desc", ary[num].getDesc());
enumMap.put(key, map);
}
Expand Down
2 changes: 1 addition & 1 deletion roncoo-pay-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.roncoo.pay.common</groupId>
<artifactId>roncoo-pay</artifactId>
<version>0.0.3-SNAPSHOT</version>
<version>0.0.4-SNAPSHOT</version>
</parent>

<groupId>com.roncoo.pay.service</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,8 @@ public interface PmsRolePermissionDao extends PermissionBaseDao<PmsRolePermissio
* @return
*/
public List<PmsRolePermission> listByRoleIds(String roleIdsStr);

public void deleteByRoleIdAndPermissionId(Long roleId, Long permissionId);

public void deleteByRoleId(Long roleId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
package com.roncoo.pay.permission.dao.impl;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

Expand Down Expand Up @@ -54,4 +56,15 @@ public List<PmsRolePermission> listByRoleIds(String roleIdsStr) {
List<String> roldIds = Arrays.asList(roleIdsStr.split(","));
return super.getSqlSession().selectList(getStatement("listByRoleIds"), roldIds);
}

public void deleteByRoleIdAndPermissionId(Long roleId, Long permissionId){
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("roleId", roleId);
paramMap.put("permissionId", permissionId);
super.getSqlSession().delete(getStatement("deleteByRoleIdAndPermissionId"), paramMap);
}

public void deleteByRoleId(Long roleId){
super.getSqlSession().delete(getStatement("deleteByRoleId"), roleId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ public interface PmsMenuRoleService {
*/
public void deleteByRoleId(Long roleId);

public void saveRoleMenu(Long roleId, String roleMenuStr);

}
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,10 @@ public interface PmsPermissionService {
* @return
*/
String getPermissionIdsByRoleId(Long roleId);

/**
* 查询所有的权限
*/
List<PmsPermission> listAll();

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,10 @@ public interface PmsRolePermissionService {
* @return
*/
PageBean listPage(PageParam pageParam, PmsRolePermission pmsRolePermission);

/**
* 保存角色和权限之间的关联关系
*/
void saveRolePermission(Long roleId, String rolePermissionStr);

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.druid.util.StringUtils;
import com.roncoo.pay.permission.dao.PmsMenuRoleDao;
import com.roncoo.pay.permission.entity.PmsMenuRole;
import com.roncoo.pay.permission.service.PmsMenuRoleService;
Expand Down Expand Up @@ -62,4 +64,20 @@ public void deleteByRoleId(Long roleId) {
pmsMenuRoleDao.deleteByRoleId(roleId);
}

@Transactional(rollbackFor = Exception.class)
public void saveRoleMenu(Long roleId, String roleMenuStr){
// 删除原来的角色与权限关联
pmsMenuRoleDao.deleteByRoleId(roleId);
if (!StringUtils.isEmpty(roleMenuStr)) {
// 创建新的关联
String[] menuIds = roleMenuStr.split(",");
for (int i = 0; i < menuIds.length; i++) {
Long menuId = Long.valueOf(menuIds[i]);
PmsMenuRole item = new PmsMenuRole();
item.setMenuId(menuId);
item.setRoleId(roleId);
pmsMenuRoleDao.insert(item);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.roncoo.pay.permission.service.impl;

import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
Expand All @@ -25,6 +26,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.roncoo.pay.common.core.enums.PublicStatusEnum;
import com.roncoo.pay.common.core.page.PageBean;
import com.roncoo.pay.common.core.page.PageParam;
import com.roncoo.pay.permission.dao.PmsOperatorDao;
Expand Down Expand Up @@ -153,16 +155,16 @@ public void saveOperator(PmsOperator pmsOperator, String roleOperatorStr) {
pmsOperatorDao.insert(pmsOperator);
// 保存角色关联信息
if (StringUtils.isNotBlank(roleOperatorStr) && roleOperatorStr.length() > 0) {
saveOrUpdateOperatorRole(pmsOperator.getId(), roleOperatorStr);
saveOrUpdateOperatorRole(pmsOperator, roleOperatorStr);
}
}

/**
* 保存用户和角色之间的关联关系
*/
private void saveOrUpdateOperatorRole(long operatorId, String roleIdsStr) {
private void saveOrUpdateOperatorRole(PmsOperator pmsOperator, String roleIdsStr) {
// 删除原来的角色与操作员关联
List<PmsOperatorRole> listPmsOperatorRoles = pmsOperatorRoleDao.listByOperatorId(operatorId);
List<PmsOperatorRole> listPmsOperatorRoles = pmsOperatorRoleDao.listByOperatorId(pmsOperator.getId());
Map<Long, PmsOperatorRole> delMap = new HashMap<Long, PmsOperatorRole>();
for (PmsOperatorRole pmsOperatorRole : listPmsOperatorRoles) {
delMap.put(pmsOperatorRole.getRoleId(), pmsOperatorRole);
Expand All @@ -174,8 +176,11 @@ private void saveOrUpdateOperatorRole(long operatorId, String roleIdsStr) {
long roleId = Long.parseLong(roleIds[i]);
if (delMap.get(roleId) == null) {
PmsOperatorRole pmsOperatorRole = new PmsOperatorRole();
pmsOperatorRole.setOperatorId(operatorId);
pmsOperatorRole.setOperatorId(pmsOperator.getId());
pmsOperatorRole.setRoleId(roleId);
pmsOperatorRole.setCreater(pmsOperator.getCreater());
pmsOperatorRole.setCreateTime(new Date());
pmsOperatorRole.setStatus(PublicStatusEnum.ACTIVE.name());
pmsOperatorRoleDao.insert(pmsOperatorRole);
} else {
delMap.remove(roleId);
Expand All @@ -186,7 +191,7 @@ private void saveOrUpdateOperatorRole(long operatorId, String roleIdsStr) {
Iterator<Long> iterator = delMap.keySet().iterator();
while (iterator.hasNext()) {
long roleId = iterator.next();
pmsOperatorRoleDao.deleteByRoleIdAndOperatorId(roleId, operatorId);
pmsOperatorRoleDao.deleteByRoleIdAndOperatorId(roleId, pmsOperator.getId());
}
}

Expand All @@ -201,7 +206,7 @@ private void saveOrUpdateOperatorRole(long operatorId, String roleIdsStr) {
public void updateOperator(PmsOperator pmsOperator, String roleOperatorStr) {
pmsOperatorDao.update(pmsOperator);
// 更新角色信息
this.saveOrUpdateOperatorRole(pmsOperator.getId(), roleOperatorStr);
this.saveOrUpdateOperatorRole(pmsOperator, roleOperatorStr);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,11 @@ public String getPermissionIdsByRoleId(Long roleId) {
return actionIds.toString();
}

/**
* 查询所有的权限
*/
public List<PmsPermission> listAll() {
Map<String, Object> paramMap = new HashMap<String, Object>();
return pmsPermissionDao.listBy(paramMap);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@

import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.druid.util.StringUtils;
import com.roncoo.pay.common.core.page.PageBean;
Expand Down Expand Up @@ -134,5 +136,25 @@ public PageBean listPage(PageParam pageParam, PmsRolePermission pmsRolePermissio
Map<String, Object> paramMap = new HashMap<String, Object>();
return pmsRolePermissionDao.listPage(pageParam, paramMap);
}

/**
* 保存角色和权限之间的关联关系
*/
@Transactional(rollbackFor = Exception.class)
public void saveRolePermission(Long roleId, String rolePermissionStr){
// 删除原来的角色与权限关联
pmsRolePermissionDao.deleteByRoleId(roleId);
if (!StringUtils.isEmpty(rolePermissionStr)) {
// 创建新的关联
String[] permissionIds = rolePermissionStr.split(",");
for (int i = 0; i < permissionIds.length; i++) {
Long permissionId = Long.valueOf(permissionIds[i]);
PmsRolePermission item = new PmsRolePermission();
item.setPermissionId(permissionId);
item.setRoleId(roleId);
pmsRolePermissionDao.insert(item);
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import com.roncoo.pay.reconciliation.fileDown.service.FileDown;
import com.roncoo.pay.reconciliation.utils.FileUtils;
import com.roncoo.pay.reconciliation.utils.SignHelper;
import com.roncoo.pay.reconciliation.utils.WechatBaseUtils;
import com.roncoo.pay.reconciliation.utils.WeiXinBaseUtils;
import com.roncoo.pay.reconciliation.utils.https.HttpClientUtil;
import com.roncoo.pay.reconciliation.utils.https.HttpResponse;
import com.roncoo.pay.trade.utils.WeixinConfigUtil;
Expand Down Expand Up @@ -136,7 +136,7 @@ public String generateXml() {
params.put("bill_date", bill_date);
params.put("bill_type", bill_type);
// 随机字符串,不长于32,调用随机数函数生成,将得到的值转换为字符串
params.put("nonce_str", WechatBaseUtils.createNoncestr());
params.put("nonce_str", WeiXinBaseUtils.createNoncestr());

// 过滤空值
for (Iterator<Entry<String, String>> it = params.entrySet().iterator(); it.hasNext();) {
Expand All @@ -148,7 +148,7 @@ public String generateXml() {

String sign = SignHelper.getSign(params, appSecret);
params.put("sign", sign.toUpperCase());
return WechatBaseUtils.arrayToXml(params);
return WeiXinBaseUtils.arrayToXml(params);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @版本:V1.0
*
*/
public class WechatBaseUtils {
public class WeiXinBaseUtils {
private static String chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
where ID = #{id} and VERSION = #{version}
</update>

<delete id="deleteById" parameterType="long">
<delete id="deleteByPrimaryKey" parameterType="long">
delete from
<include refid="pms_menu" />
where ID = #{id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@
</select>

<select id="listByRoleId" parameterType="long" resultType="com.roncoo.pay.permission.entity.PmsMenuRole">
select * from
select d.id as "id",
d.role_id as "roleId",
d.menu_id as "menuId"
from
<include refid="pms_menu_role" />
d
where role_id = #{roleId}
</select>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<!-- Pms权限管理:操作员表 -->
<sql id="pms_operator"> PMS_OPERATOR </sql>
<sql id="pms_operator_role"> PMS_OPERATOR_ROLE </sql>
<sql id="pms_role_operator"> PMS_ROLE_OPERATOR </sql>

<resultMap id="beanMap" type="com.roncoo.pay.permission.entity.PmsOperator">
<id column="id" property="id" jdbcType="INTEGER" />
Expand Down Expand Up @@ -72,7 +72,7 @@
order by ID
</select>

<delete id="deleteById" parameterType="Long">
<delete id="deleteByPrimaryKey" parameterType="Long">
delete from
<include refid="pms_operator" />
where ID = #{id}
Expand All @@ -82,7 +82,7 @@
<!-- Equal query -->
<if test="loginName != null and loginName != ''"> and login_name = #{loginName}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="status != null and status != ''"> and type = #{type}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<!-- Like query -->
<if test="realName != null and realName != ''"> and REALNAME like CONCAT(CONCAT('%', #{realName}), '%')</if>
</sql>
Expand Down Expand Up @@ -110,7 +110,7 @@
select O.* from
<include refid="pms_operator" />
O LEFT JOIN
<include refid="pms_operator_role" />
<include refid="pms_role_operator" />
RO ON
O.ID = RO.operator_id WHERE RO.role_id = #{roleId}
</select>
Expand Down
Loading

0 comments on commit a764002

Please sign in to comment.