Commit de3de82d authored by dingzhiwei's avatar dingzhiwei
Browse files

初始化Jeepay项目

parent 40dcaf4a
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jeequan.jeepay.core.entity.SysEntitlement;
import org.springframework.stereotype.Service;
import com.jeequan.jeepay.service.mapper.SysEntitlementMapper;
/**
* <p>
* 系统权限表 服务实现类
* </p>
*
* @author [mybatis plus generator]
* @since 2020-06-13
*/
@Service
public class SysEntitlementService extends ServiceImpl<SysEntitlementMapper, SysEntitlement> {
}
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jeequan.jeepay.core.entity.SysLog;
import com.jeequan.jeepay.service.mapper.SysLogMapper;
import org.springframework.stereotype.Service;
/**
* <p>
* 系统操作日志表 服务实现类
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-27
*/
@Service
public class SysLogService extends ServiceImpl<SysLogMapper, SysLog> {
}
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.entity.SysEntitlement;
import com.jeequan.jeepay.core.entity.SysRoleEntRela;
import com.jeequan.jeepay.service.mapper.SysRoleEntRelaMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 系统角色权限关联表 服务实现类
* </p>
*
* @author [mybatis plus generator]
* @since 2020-06-13
*/
@Service
public class SysRoleEntRelaService extends ServiceImpl<SysRoleEntRelaMapper, SysRoleEntRela> {
@Autowired private SysEntitlementService sysEntitlementService;
/** 根据人查询出所有权限ID集合 */
public List<String> selectEntIdsByUserId(Long userId, Byte isAdmin, String system){
if(isAdmin == CS.YES){
List<String> result = new ArrayList<>();
sysEntitlementService.list(SysEntitlement.gw().select(SysEntitlement::getEntId).eq(SysEntitlement::getSystem, system).eq(SysEntitlement::getState, CS.PUB_USABLE)
).stream().forEach(r -> result.add(r.getEntId()));
return result;
}else{
return baseMapper.selectEntIdsByUserId(userId, system);
}
}
/** 重置 角色 - 权限 关联关系 **/
@Transactional
public void resetRela(String roleId, List<String> entIdList){
//1. 删除
this.remove(SysRoleEntRela.gw().eq(SysRoleEntRela::getRoleId, roleId));
//2. 插入
for (String entId : entIdList) {
SysRoleEntRela r = new SysRoleEntRela();
r.setRoleId(roleId); r.setEntId(entId);
this.save(r);
}
}
}
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jeequan.jeepay.core.entity.SysRole;
import com.jeequan.jeepay.core.entity.SysRoleEntRela;
import com.jeequan.jeepay.core.entity.SysUserRoleRela;
import com.jeequan.jeepay.core.exception.BizException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jeequan.jeepay.service.mapper.SysRoleMapper;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 系统角色表 服务实现类
* </p>
*
* @author [mybatis plus generator]
* @since 2020-06-13
*/
@Service
public class SysRoleService extends ServiceImpl<SysRoleMapper, SysRole> {
@Autowired private SysUserRoleRelaService sysUserRoleRelaService;
@Autowired private SysRoleEntRelaService sysRoleEntRelaService;
/** 根据用户查询全部角色集合 **/
public List<String> findListByUser(Long sysUserId){
List<String> result = new ArrayList<>();
sysUserRoleRelaService.list(
SysUserRoleRela.gw().eq(SysUserRoleRela::getUserId, sysUserId)
).stream().forEach(r -> result.add(r.getRoleId()));
return result;
}
@Transactional
public void removeRole(String roleId){
if(sysUserRoleRelaService.count(SysUserRoleRela.gw().eq(SysUserRoleRela::getRoleId, roleId)) > 0){
throw new BizException("当前角色已分配到用户, 不可删除!");
}
//删除当前表
removeById(roleId);
//删除关联表
sysRoleEntRelaService.remove(SysRoleEntRela.gw().eq(SysRoleEntRela::getRoleId, roleId));
}
}
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.entity.SysUserAuth;
import com.jeequan.jeepay.core.utils.StringKit;
import com.jeequan.jeepay.core.model.security.JeeUserDetails;
import com.jeequan.jeepay.service.mapper.SysUserAuthMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
* 操作员认证表 服务实现类
* </p>
*
* @author [mybatis plus generator]
* @since 2020-06-13
*/
@Service
public class SysUserAuthService extends ServiceImpl<SysUserAuthMapper, SysUserAuth> {
/** 根据登录信息查询用户认证信息 **/
public SysUserAuth selectByLogin(String identifier, Byte identityType, String system){
return baseMapper.selectByLogin(identifier, identityType, system);
}
/** 添加用户认证表 **/
@Transactional
public void addUserAuthDefault(Long userId, String loginUserName, String telPhone, String pwdRaw, String system){
String salt = StringKit.getUUID(6); //6位随机数
String userPwd = new BCryptPasswordEncoder().encode(pwdRaw);
/** 用户名登录方式 */
SysUserAuth record = new SysUserAuth(); record.setUserId(userId); record.setCredential(userPwd); record.setSalt(salt);record.setSystem(system);
record.setIdentityType(CS.AUTH_TYPE.LOGIN_USER_NAME);
record.setIdentifier(loginUserName);
save(record);
/** 手机号登录方式 */
record = new SysUserAuth(); record.setUserId(userId); record.setCredential(userPwd); record.setSalt(salt);record.setSystem(system);
record.setIdentityType(CS.AUTH_TYPE.TELPHONE);
record.setIdentifier(telPhone);
save(record);
}
/** 重置密码 */
@Transactional
public void resetAuthInfo(Long resetUserId, String authLoginUserName, String telphone, String newPwd, String system){
//更改登录用户名
// if(StringKit.isNotEmpty(authLoginUserName)){
// SysUserAuth updateRecord = new SysUserAuth();
// updateRecord.setIdentifier(authLoginUserName);
// update(updateRecord, SysUserAuth.gw().eq(SysUserAuth::getSystem, system).eq(SysUserAuth::getUserId, resetUserId).eq(SysUserAuth::getIdentityType, CS.AUTH_TYPE.LOGIN_USER_NAME));
// }
//更新手机号认证
// if(StringKit.isNotEmpty(telphone)){
// SysUserAuth updateRecord = new SysUserAuth();
// updateRecord.setIdentifier(telphone);
// update(updateRecord, SysUserAuth.gw().eq(SysUserAuth::getSystem, system).eq(SysUserAuth::getUserId, resetUserId).eq(SysUserAuth::getIdentityType, CS.AUTH_TYPE.TELPHONE));
// }
//更改密码
if(StringUtils.isNotEmpty(newPwd)){
//根据当前用户ID 查询出用户的所有认证记录
List<SysUserAuth> authList = list(SysUserAuth.gw().eq(SysUserAuth::getSystem, system).eq(SysUserAuth::getUserId, resetUserId));
for (SysUserAuth auth : authList) {
if(StringUtils.isEmpty(auth.getSalt())){ //可能为其他登录方式, 不存在salt
continue;
}
SysUserAuth updateRecord = new SysUserAuth();
updateRecord.setAuthId(auth.getAuthId());
updateRecord.setCredential(new BCryptPasswordEncoder().encode(newPwd));
updateById(updateRecord);
}
}
}
/** 查询当前用户密码是否正确 */
public boolean validateCurrentUserPwd(String pwdRaw){
//根据当前用户ID + 认证方式为 登录用户名的方式 查询一条记录
SysUserAuth auth = getOne(SysUserAuth.gw()
.eq(SysUserAuth::getUserId, JeeUserDetails.getCurrentUserDetails().getSysUser().getSysUserId())
.eq(SysUserAuth::getIdentityType, CS.AUTH_TYPE.LOGIN_USER_NAME)
);
if(auth != null && new BCryptPasswordEncoder().matches(pwdRaw, auth.getCredential())){
return true;
}
return false;
}
}
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jeequan.jeepay.core.entity.SysUserRoleRela;
import com.jeequan.jeepay.service.mapper.SysUserRoleRelaMapper;
import org.springframework.stereotype.Service;
/**
* <p>
* 操作员<->角色 关联表 服务实现类
* </p>
*
* @author [mybatis plus generator]
* @since 2020-06-13
*/
@Service
public class SysUserRoleRelaService extends ServiceImpl<SysUserRoleRelaMapper, SysUserRoleRela> {
}
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.entity.SysUser;
import com.jeequan.jeepay.core.entity.SysUserRoleRela;
import com.jeequan.jeepay.core.exception.BizException;
import com.jeequan.jeepay.core.utils.StringKit;
import com.jeequan.jeepay.service.mapper.SysUserMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
* 系统操作员表 服务实现类
* </p>
*
* @author [mybatis plus generator]
* @since 2020-06-13
*/
@Service
public class SysUserService extends ServiceImpl<SysUserMapper, SysUser> {
@Autowired private SysUserAuthService sysUserAuthService;
@Autowired private SysUserRoleRelaService sysUserRoleRelaService;
/** 添加系统用户 **/
@Transactional
public void addSysUser(SysUser sysUser, String system){
//判断获取到选择的角色集合
// String roleIdListStr = sysUser.extv().getString("roleIdListStr");
// if(StringKit.isEmpty(roleIdListStr)) throw new BizException("请选择角色信息!");
//
// List<String> roleIdList = JSONArray.parseArray(roleIdListStr, String.class);
// if(roleIdList.isEmpty()) throw new BizException("请选择角色信息!");
// 判断数据来源
if( StringUtils.isEmpty(sysUser.getLoginUsername()) ) throw new BizException("登录用户名不能为空!");
if( StringUtils.isEmpty(sysUser.getRealname()) )throw new BizException("姓名不能为空!");
if( StringUtils.isEmpty(sysUser.getTelphone()) ) throw new BizException("手机号不能为空!");
if(sysUser.getSex() == null ) throw new BizException("性别不能为空!");
//登录用户名不可重复
if( count(SysUser.gw().eq(SysUser::getSystem, system).eq(SysUser::getLoginUsername, sysUser.getLoginUsername())) > 0 ){
throw new BizException("登录用户名已存在!");
}
//手机号不可重复
if( count(SysUser.gw().eq(SysUser::getSystem, system).eq(SysUser::getTelphone, sysUser.getTelphone())) > 0 ){
throw new BizException("手机号已存在!");
}
//员工号不可重复
if( count(SysUser.gw().eq(SysUser::getSystem, system).eq(SysUser::getUserNo, sysUser.getUserNo())) > 0 ){
throw new BizException("员工号已存在!");
}
//女 默认头像
if(sysUser.getSex() != null && CS.SEX_FEMALE == sysUser.getSex()){
sysUser.setAvatarUrl("/imgs/defava_f.png");
}else{
sysUser.setAvatarUrl("/imgs/defava_m.png");
}
//1. 插入用户主表
sysUser.setSystem(system); // 系统类型
this.save(sysUser);
Long sysUserId = sysUser.getSysUserId();
//添加到 user_auth表
String authPwd = CS.DEFAULT_PWD;
sysUserAuthService.addUserAuthDefault(sysUserId, sysUser.getLoginUsername(), sysUser.getTelphone(), authPwd, system);
//3. 添加用户角色信息
//saveUserRole(sysUser.getSysUserId(), new ArrayList<>());
}
//修改用户信息
@Transactional
public void updateSysUser(SysUser sysUser){
Long sysUserId = sysUser.getSysUserId();
SysUser dbRecord = getById(sysUserId);
if (dbRecord == null) throw new BizException("该用户不存在");
//修改了手机号, 需要修改auth表信息
if(!dbRecord.getTelphone().equals(sysUser.getTelphone())){
if(count(SysUser.gw().eq(SysUser::getSystem, dbRecord.getSystem()).eq(SysUser::getTelphone, sysUser.getTelphone())) > 0){
throw new BizException("该手机号已关联其他用户!");
}
sysUserAuthService.resetAuthInfo(sysUserId, null, sysUser.getTelphone(), null, dbRecord.getSystem());
}
//修改了手机号, 需要修改auth表信息
if(!dbRecord.getLoginUsername().equals(sysUser.getLoginUsername())){
if(count(SysUser.gw().eq(SysUser::getSystem, dbRecord.getSystem()).eq(SysUser::getLoginUsername, sysUser.getLoginUsername())) > 0){
throw new BizException("该登录用户名已关联其他用户!");
}
sysUserAuthService.resetAuthInfo(sysUserId, sysUser.getLoginUsername(), null, null, dbRecord.getSystem());
}
//修改用户主表
baseMapper.updateById(sysUser);
}
/** 分配用户角色 **/
@Transactional
public void saveUserRole(Long userId, List<String> roleIdList) {
//删除用户之前的 角色信息
sysUserRoleRelaService.remove(SysUserRoleRela.gw().eq(SysUserRoleRela::getUserId, userId));
for (String roleId : roleIdList) {
SysUserRoleRela addRecord = new SysUserRoleRela();
addRecord.setUserId(userId); addRecord.setRoleId(roleId);
sysUserRoleRelaService.save(addRecord);
}
}
}
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.service.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jeequan.jeepay.core.entity.IsvInfo;
/**
* <p>
* 服务商信息表 Mapper 接口
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-27
*/
public interface IsvInfoMapper extends BaseMapper<IsvInfo> {
}
<?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="com.jeequan.jeepay.service.mapper.IsvInfoMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.jeequan.jeepay.core.entity.IsvInfo">
<id column="isv_no" property="isvNo" />
<result column="isv_name" property="isvName" />
<result column="isv_short_name" property="isvShortName" />
<result column="contact_name" property="contactName" />
<result column="contact_tel" property="contactTel" />
<result column="contact_email" property="contactEmail" />
<result column="state" property="state" />
<result column="remark" property="remark" />
<result column="created_uid" property="createdUid" />
<result column="created_by" property="createdBy" />
<result column="created_at" property="createdAt" />
<result column="updated_at" property="updatedAt" />
</resultMap>
</mapper>
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.service.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jeequan.jeepay.core.entity.MchInfo;
/**
* <p>
* 商户信息表 Mapper 接口
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-27
*/
public interface MchInfoMapper extends BaseMapper<MchInfo> {
}
<?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="com.jeequan.jeepay.service.mapper.MchInfoMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.jeequan.jeepay.core.entity.MchInfo">
<id column="mch_no" property="mchNo" />
<result column="mch_name" property="mchName" />
<result column="mch_short_name" property="mchShortName" />
<result column="type" property="type" />
<result column="isv_no" property="isvNo" />
<result column="contact_name" property="contactName" />
<result column="contact_tel" property="contactTel" />
<result column="contact_email" property="contactEmail" />
<result column="private_key" property="privateKey" />
<result column="state" property="state" />
<result column="remark" property="remark" />
<result column="init_user_id" property="initUserId" />
<result column="created_uid" property="createdUid" />
<result column="created_by" property="createdBy" />
<result column="created_at" property="createdAt" />
<result column="updated_at" property="updatedAt" />
</resultMap>
</mapper>
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.service.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jeequan.jeepay.core.entity.MchNotifyRecord;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* 商户通知表 Mapper 接口
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-27
*/
public interface MchNotifyRecordMapper extends BaseMapper<MchNotifyRecord> {
Integer updateNotifyResult(@Param("notifyId") Long notifyId, @Param("state") Byte state, @Param("resResult") String resResult);
}
<?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="com.jeequan.jeepay.service.mapper.MchNotifyRecordMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.jeequan.jeepay.core.entity.MchNotifyRecord">
<id column="notify_id" property="notifyId" />
<result column="order_id" property="orderId" />
<result column="order_type" property="orderType" />
<result column="mch_order_no" property="mchOrderNo" />
<result column="mch_no" property="mchNo" />
<result column="isv_no" property="isvNo" />
<result column="notify_url" property="notifyUrl" />
<result column="res_result" property="resResult" />
<result column="notify_count" property="notifyCount" />
<result column="state" property="state" />
<result column="last_notify_time" property="lastNotifyTime" />
<result column="created_at" property="createdAt" />
<result column="updated_at" property="updatedAt" />
</resultMap>
<!-- 更新商户回调的结果即状态 -->
<update id="updateNotifyResult">
update t_mch_notify_record set res_result = #{resResult},
notify_count = notify_count + 1,
state = #{state},
last_notify_time = now()
where notify_id = #{notifyId}
</update>
</mapper>
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.service.mapper;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jeequan.jeepay.core.entity.MchPayPassage;
import java.util.List;
import java.util.Map;
/**
* <p>
* 商户支付通道表 Mapper 接口
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-27
*/
public interface MchPayPassageMapper extends BaseMapper<MchPayPassage> {
/** 根据支付方式查询可用的支付接口列表 **/
List<JSONObject> selectAvailablePayInterfaceList(Map params);
}
<?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="com.jeequan.jeepay.service.mapper.MchPayPassageMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.jeequan.jeepay.core.entity.MchPayPassage">
<id column="id" property="id" />
<result column="mch_no" property="mchNo" />
<result column="if_code" property="ifCode" />
<result column="way_code" property="wayCode" />
<result column="rate" property="rate" />
<result column="risk_config" property="riskConfig" />
<result column="state" property="state" />
<result column="created_at" property="createdAt" />
<result column="updated_at" property="updatedAt" />
</resultMap>
<!-- 根据支付方式查询可用的支付接口列表 -->
<select id="selectAvailablePayInterfaceList" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.util.Map">
select pid.if_code ifCode, pid.if_name ifName, pid.bg_color bgColor, pid.icon icon, pic.if_params ifParams, pic.if_rate ifRate from t_pay_interface_define pid
inner join t_pay_interface_config pic on pid.if_code = pic.if_code
where JSON_CONTAINS(pid.way_codes, JSON_OBJECT('wayCode', #{wayCode}))
and pid.state = 1
and pic.state = 1
and pic.info_type = #{infoType}
and pic.info_id = #{mchNo}
and (pic.if_params is not null and trim(pic.if_params) != '')
<if test="mchType == 1">
and pid.is_mch_mode = 1
</if>
<if test="mchType == 2">
and pid.is_isv_mode = 1
</if>;
</select>
</mapper>
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.service.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jeequan.jeepay.core.entity.PayInterfaceConfig;
/**
* <p>
* 支付接口配置参数表 Mapper 接口
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-27
*/
public interface PayInterfaceConfigMapper extends BaseMapper<PayInterfaceConfig> {
}
<?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="com.jeequan.jeepay.service.mapper.PayInterfaceConfigMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.jeequan.jeepay.core.entity.PayInterfaceConfig">
<id column="id" property="id" />
<result column="info_type" property="infoType" />
<result column="info_id" property="infoId" />
<result column="if_code" property="ifCode" />
<result column="if_params" property="ifParams" />
<result column="if_rate" property="ifRate" />
<result column="state" property="state" />
<result column="remark" property="remark" />
<result column="created_uid" property="createdUid" />
<result column="created_by" property="createdBy" />
<result column="created_at" property="createdAt" />
<result column="updated_uid" property="updatedUid" />
<result column="updated_by" property="updatedBy" />
<result column="updated_at" property="updatedAt" />
</resultMap>
</mapper>
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.service.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jeequan.jeepay.core.entity.PayInterfaceDefine;
/**
* <p>
* 支付接口定义表 Mapper 接口
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-27
*/
public interface PayInterfaceDefineMapper extends BaseMapper<PayInterfaceDefine> {
}
<?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="com.jeequan.jeepay.service.mapper.PayInterfaceDefineMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.jeequan.jeepay.core.entity.PayInterfaceDefine">
<id column="if_code" property="ifCode" />
<result column="if_name" property="ifName" />
<result column="is_mch_mode" property="isMchMode" />
<result column="is_isv_mode" property="isIsvMode" />
<result column="isv_params" property="isvParams" />
<result column="isvsub_mch_params" property="isvsubMchParams" />
<result column="normal_mch_params" property="normalMchParams" />
<result column="way_codes" property="wayCodes" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler" />
<result column="icon" property="icon" />
<result column="bg_color" property="bgColor" />
<result column="state" property="state" />
<result column="remark" property="remark" />
<result column="created_at" property="createdAt" />
<result column="updated_at" property="updatedAt" />
</resultMap>
</mapper>
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeequan.jeepay.service.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jeequan.jeepay.core.entity.PayOrder;
import java.util.List;
import java.util.Map;
/**
* <p>
* 支付订单表 Mapper 接口
* </p>
*
* @author [mybatis plus generator]
* @since 2021-04-27
*/
public interface PayOrderMapper extends BaseMapper<PayOrder> {
Map payCount(Map param);
List<Map> payTypeCount(Map param);
Map selectTotalCount(Map param);
List<Map> selectOrderCount(Map param);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment