修改登录信息,定时计费模型
This commit is contained in:
parent
858819a855
commit
fad5e342ad
2
pom.xml
2
pom.xml
@ -37,7 +37,7 @@
|
|||||||
<poi.version>4.1.2</poi.version>
|
<poi.version>4.1.2</poi.version>
|
||||||
<common-pool.version>2.6.2</common-pool.version>
|
<common-pool.version>2.6.2</common-pool.version>
|
||||||
<commons-collections.version>3.2.2</commons-collections.version>
|
<commons-collections.version>3.2.2</commons-collections.version>
|
||||||
<alipay.sdk>4.15.14.ALL</alipay.sdk>
|
<alipay.sdk>4.22.37.ALL</alipay.sdk>
|
||||||
<commons-beanutils.sdk>1.9.3</commons-beanutils.sdk>
|
<commons-beanutils.sdk>1.9.3</commons-beanutils.sdk>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,7 @@ public class TokenController
|
|||||||
public R<?> login(@RequestBody LoginBody form)
|
public R<?> login(@RequestBody LoginBody form)
|
||||||
{
|
{
|
||||||
// 用户登录
|
// 用户登录
|
||||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(),0);
|
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(),0,form.getTenantId());
|
||||||
// 获取登录token
|
// 获取登录token
|
||||||
return R.ok(tokenService.createToken(userInfo));
|
return R.ok(tokenService.createToken(userInfo));
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ public class TokenController
|
|||||||
return R.fail(HttpStatus.ERROR_STATUS, "验证码错误");
|
return R.fail(HttpStatus.ERROR_STATUS, "验证码错误");
|
||||||
}
|
}
|
||||||
// 用户登录
|
// 用户登录
|
||||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), "123456",1);
|
LoginUser userInfo = sysLoginService.login(form.getUsername(), "123456",1,form.getTenantId());
|
||||||
// 获取登录token
|
// 获取登录token
|
||||||
redisService.deleteObject("pcToken:"+form.getUsername());
|
redisService.deleteObject("pcToken:"+form.getUsername());
|
||||||
return R.ok(tokenService.createToken(userInfo));
|
return R.ok(tokenService.createToken(userInfo));
|
||||||
|
|||||||
@ -17,6 +17,8 @@ public class LoginBody
|
|||||||
*/
|
*/
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
public String getUsername()
|
public String getUsername()
|
||||||
{
|
{
|
||||||
return username;
|
return username;
|
||||||
@ -36,4 +38,12 @@ public class LoginBody
|
|||||||
{
|
{
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTenantId() {
|
||||||
|
return tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTenantId(String tenantId) {
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public class SysLoginService
|
|||||||
/**
|
/**
|
||||||
* 登录
|
* 登录
|
||||||
*/
|
*/
|
||||||
public LoginUser login(String username, String password,Integer type)
|
public LoginUser login(String username, String password,Integer type,String tenantId)
|
||||||
{
|
{
|
||||||
// 用户名或密码为空 错误
|
// 用户名或密码为空 错误
|
||||||
if (StringUtils.isAnyBlank(username, password))
|
if (StringUtils.isAnyBlank(username, password))
|
||||||
@ -54,7 +54,7 @@ public class SysLoginService
|
|||||||
throw new BaseException("用户名不在指定范围");
|
throw new BaseException("用户名不在指定范围");
|
||||||
}
|
}
|
||||||
// 查询用户信息
|
// 查询用户信息
|
||||||
R<LoginUser> userResult = remoteUserService.getUserInfo(username);
|
R<LoginUser> userResult = remoteUserService.getUserInfo(username+"&"+tenantId);
|
||||||
|
|
||||||
if (R.FAIL == userResult.getCode())
|
if (R.FAIL == userResult.getCode())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -63,8 +63,9 @@ public class SysProfileController extends BaseController
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
public AjaxResult profile()
|
public AjaxResult profile()
|
||||||
{
|
{
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser();
|
||||||
String username = SecurityUtils.getUsername();
|
String username = SecurityUtils.getUsername();
|
||||||
SysUser user = userService.selectUserByUserName(username);
|
SysUser user = userService.selectUserByUserName(username,loginUser.getTenantId());
|
||||||
AjaxResult ajax = AjaxResult.success(user);
|
AjaxResult ajax = AjaxResult.success(user);
|
||||||
ajax.put("roleGroup", userService.selectUserRoleGroup(username));
|
ajax.put("roleGroup", userService.selectUserRoleGroup(username));
|
||||||
ajax.put("postGroup", userService.selectUserPostGroup(username));
|
ajax.put("postGroup", userService.selectUserPostGroup(username));
|
||||||
@ -109,8 +110,9 @@ public class SysProfileController extends BaseController
|
|||||||
@PutMapping("/updatePwd")
|
@PutMapping("/updatePwd")
|
||||||
public AjaxResult updatePwd(String oldPassword, String newPassword)
|
public AjaxResult updatePwd(String oldPassword, String newPassword)
|
||||||
{
|
{
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser();
|
||||||
String username = SecurityUtils.getUsername();
|
String username = SecurityUtils.getUsername();
|
||||||
SysUser user = userService.selectUserByUserName(username);
|
SysUser user = userService.selectUserByUserName(username,loginUser.getTenantId());
|
||||||
String password = user.getPassword();
|
String password = user.getPassword();
|
||||||
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
||||||
{
|
{
|
||||||
@ -123,7 +125,6 @@ public class SysProfileController extends BaseController
|
|||||||
if (userService.resetUserPwd(username, SecurityUtils.encryptPassword(newPassword)) > 0)
|
if (userService.resetUserPwd(username, SecurityUtils.encryptPassword(newPassword)) > 0)
|
||||||
{
|
{
|
||||||
// 更新缓存用户密码
|
// 更新缓存用户密码
|
||||||
LoginUser loginUser = tokenService.getLoginUser();
|
|
||||||
loginUser.getSysUser().setPassword(SecurityUtils.encryptPassword(newPassword));
|
loginUser.getSysUser().setPassword(SecurityUtils.encryptPassword(newPassword));
|
||||||
tokenService.setLoginUser(loginUser);
|
tokenService.setLoginUser(loginUser);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
|
|||||||
@ -76,11 +76,11 @@ public class SysUserController extends BaseController {
|
|||||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||||
@PreAuthorize(hasPermi = "system:user:import")
|
@PreAuthorize(hasPermi = "system:user:import")
|
||||||
@PostMapping("/importData")
|
@PostMapping("/importData")
|
||||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
|
public AjaxResult importData(MultipartFile file, boolean updateSupport,String tenantId) throws Exception {
|
||||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
List<SysUser> userList = util.importExcel(file.getInputStream());
|
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||||
String operName = SecurityUtils.getUsername();
|
String operName = SecurityUtils.getUsername();
|
||||||
String message = userService.importUser(userList, updateSupport, operName);
|
String message = userService.importUser(userList, updateSupport, operName,tenantId);
|
||||||
return AjaxResult.success(message);
|
return AjaxResult.success(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,10 @@ public class SysUserController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/info/{username}")
|
@GetMapping("/info/{username}")
|
||||||
public R<LoginUser> info(@PathVariable("username") String username) {
|
public R<LoginUser> info(@PathVariable("username") String username) {
|
||||||
SysUser sysUser = userService.selectUserByUserName(username);
|
|
||||||
|
String[] split = username.split("&");
|
||||||
|
|
||||||
|
SysUser sysUser = userService.selectUserByUserName(split[0],split[1]);
|
||||||
if (StringUtils.isNull(sysUser)) {
|
if (StringUtils.isNull(sysUser)) {
|
||||||
return R.fail("用户名或密码错误");
|
return R.fail("用户名或密码错误");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ public interface SysUserMapper {
|
|||||||
* @param userName 用户名
|
* @param userName 用户名
|
||||||
* @return 用户对象信息
|
* @return 用户对象信息
|
||||||
*/
|
*/
|
||||||
public SysUser selectUserByUserName(String userName);
|
public SysUser selectUserByUserName(@Param("userName")String userName,@Param("tenantId")String tenantId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户ID查询用户
|
* 通过用户ID查询用户
|
||||||
|
|||||||
@ -40,7 +40,7 @@ public interface ISysUserService {
|
|||||||
* @param userName 用户名
|
* @param userName 用户名
|
||||||
* @return 用户对象信息
|
* @return 用户对象信息
|
||||||
*/
|
*/
|
||||||
public SysUser selectUserByUserName(String userName);
|
public SysUser selectUserByUserName(String userName,String tenantId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户ID查询用户
|
* 通过用户ID查询用户
|
||||||
@ -187,5 +187,5 @@ public interface ISysUserService {
|
|||||||
* @param operName 操作用户
|
* @param operName 操作用户
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName,String tenantId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,9 +99,9 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
* @return 用户对象信息
|
* @return 用户对象信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysUser selectUserByUserName(String userName)
|
public SysUser selectUserByUserName(String userName,String tenantId)
|
||||||
{
|
{
|
||||||
return userMapper.selectUserByUserName(userName);
|
return userMapper.selectUserByUserName(userName,tenantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -416,7 +416,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName)
|
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName,String tenantId)
|
||||||
{
|
{
|
||||||
if (StringUtils.isNull(userList) || userList.size() == 0)
|
if (StringUtils.isNull(userList) || userList.size() == 0)
|
||||||
{
|
{
|
||||||
@ -432,7 +432,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 验证是否存在这个用户
|
// 验证是否存在这个用户
|
||||||
SysUser u = userMapper.selectUserByUserName(user.getUserName());
|
SysUser u = userMapper.selectUserByUserName(user.getUserName(),tenantId);
|
||||||
if (StringUtils.isNull(u))
|
if (StringUtils.isNull(u))
|
||||||
{
|
{
|
||||||
user.setPassword(SecurityUtils.encryptPassword(password));
|
user.setPassword(SecurityUtils.encryptPassword(password));
|
||||||
|
|||||||
@ -158,7 +158,7 @@
|
|||||||
|
|
||||||
<select id="selectUserByUserName" parameterType="java.lang.String" resultMap="SysUserResult">
|
<select id="selectUserByUserName" parameterType="java.lang.String" resultMap="SysUserResult">
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
where u.user_name = #{userName}
|
where u.user_name = #{userName} and u.tenant_id =#{tenantId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||||
@ -193,6 +193,7 @@
|
|||||||
<if test="sex != null and sex != ''">sex,</if>
|
<if test="sex != null and sex != ''">sex,</if>
|
||||||
<if test="password != null and password != ''">password,</if>
|
<if test="password != null and password != ''">password,</if>
|
||||||
<if test="status != null and status != ''">status,</if>
|
<if test="status != null and status != ''">status,</if>
|
||||||
|
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
|
||||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
<if test="remark != null and remark != ''">remark,</if>
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
create_time
|
create_time
|
||||||
@ -210,6 +211,7 @@
|
|||||||
<if test="sex != null and sex != ''">#{sex},</if>
|
<if test="sex != null and sex != ''">#{sex},</if>
|
||||||
<if test="password != null and password != ''">#{password},</if>
|
<if test="password != null and password != ''">#{password},</if>
|
||||||
<if test="status != null and status != ''">#{status},</if>
|
<if test="status != null and status != ''">#{status},</if>
|
||||||
|
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
|
||||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
<if test="remark != null and remark != ''">#{remark},</if>
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
sysdate()
|
sysdate()
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
package com.xhpc.charging.station.mapper;
|
package com.xhpc.charging.station.mapper;
|
||||||
|
|
||||||
import com.xhpc.common.domain.XhpcTimingChargingCacheRateModel;
|
import com.xhpc.common.domain.*;
|
||||||
import com.xhpc.common.domain.XhpcTimingChargingModel;
|
|
||||||
import com.xhpc.common.domain.XhpcTimingChargingTime;
|
|
||||||
import com.xhpc.common.domain.XhpcTtimingChargingRate;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -17,10 +14,9 @@ public interface XhpcTimingChargingModelMapper {
|
|||||||
|
|
||||||
List<Map<String, Object>> list(@Param("status") Integer status,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("chargingStationId") Long chargingStationId,@Param("tenantId")String tenantId);
|
List<Map<String, Object>> list(@Param("status") Integer status,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("chargingStationId") Long chargingStationId,@Param("tenantId")String tenantId);
|
||||||
|
|
||||||
|
|
||||||
int insertXhpcTimingChargingModel(XhpcTimingChargingModel xhpcTimingChargingModel);
|
int insertXhpcTimingChargingModel(XhpcTimingChargingModel xhpcTimingChargingModel);
|
||||||
|
|
||||||
int insertXhpcTtimingChargingRate(XhpcTtimingChargingRate xhpcTtimingChargingRate);
|
int insertXhpcTtimingChargingRate(XhpcTimingChargingRate xhpcTtimingChargingRate);
|
||||||
|
|
||||||
int insertXhpcTimingChargingTime(XhpcTimingChargingTime xhpcTimingChargingTime);
|
int insertXhpcTimingChargingTime(XhpcTimingChargingTime xhpcTimingChargingTime);
|
||||||
|
|
||||||
@ -41,4 +37,13 @@ public interface XhpcTimingChargingModelMapper {
|
|||||||
List<Map<String, Object>> getXhpcTimingChargingTimeTypeList(@Param("timingChargingModelId") Long timingChargingModelId);
|
List<Map<String, Object>> getXhpcTimingChargingTimeTypeList(@Param("timingChargingModelId") Long timingChargingModelId);
|
||||||
|
|
||||||
Map<String, Object> getXhpcTimingChargingModelMapById(@Param("timingChargingModelId")Long timingChargingModelId,@Param("tenantId")String tenantId);
|
Map<String, Object> getXhpcTimingChargingModelMapById(@Param("timingChargingModelId")Long timingChargingModelId,@Param("tenantId")String tenantId);
|
||||||
|
|
||||||
|
List<XhpcTimingChargingCacheRateModel> getXhpcTimingChargingModelId();
|
||||||
|
|
||||||
|
int insertXhpcRateModel(XhpcRateModel xhpcRateModel);
|
||||||
|
|
||||||
|
List<XhpcTimingChargingRate> getRateTimingChargingModelId(@Param("timingChargingModelId") Long timingChargingModelId);
|
||||||
|
|
||||||
|
List<XhpcTimingChargingTime> getTimeTimingChargingModelId(@Param("timingChargingModelId") Long timingChargingModelId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,8 @@ package com.xhpc.charging.station.service;
|
|||||||
import com.xhpc.common.api.dto.XhpcChargingStationDto;
|
import com.xhpc.common.api.dto.XhpcChargingStationDto;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
import com.xhpc.common.domain.XhpcChargingStation;
|
import com.xhpc.common.domain.XhpcChargingStation;
|
||||||
|
import com.xhpc.common.domain.XhpcRate;
|
||||||
|
import com.xhpc.common.domain.XhpcRateTime;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -232,4 +234,20 @@ public interface IXhpcChargingStationService {
|
|||||||
*/
|
*/
|
||||||
Map<String, Object> getLandUser(Long userId);
|
Map<String, Object> getLandUser(Long userId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除该场站之前费率、费率时段
|
||||||
|
*/
|
||||||
|
void updateXhpcRateTimeChargingStationId(Long chargingStationId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加费率
|
||||||
|
*/
|
||||||
|
void insertXhpcRate(XhpcRate xhpcRate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加费率时段
|
||||||
|
*/
|
||||||
|
void insertXhpcRateTime(XhpcRateTime xhpcRateTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,5 +27,5 @@ public interface IXhpcTimingChargingModelService {
|
|||||||
|
|
||||||
int updateXhpcTimingChargingModel(XhpcTimingChargingModel xhpcTimingChargingModel);
|
int updateXhpcTimingChargingModel(XhpcTimingChargingModel xhpcTimingChargingModel);
|
||||||
|
|
||||||
void getXhpcTimingChargingModelCron();
|
R getXhpcTimingChargingModelCron();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,6 +73,35 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
|||||||
return xhpcChargingStationMapper.getLandUser(userId);
|
return xhpcChargingStationMapper.getLandUser(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除该场站之前费率、费率时段
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void updateXhpcRateTimeChargingStationId(Long chargingStationId) {
|
||||||
|
xhpcChargingStationMapper.updateXhpcRateTime(chargingStationId);
|
||||||
|
xhpcChargingStationMapper.updateXhpcRate(chargingStationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加费率
|
||||||
|
*
|
||||||
|
* @param xhpcRate
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void insertXhpcRate(XhpcRate xhpcRate) {
|
||||||
|
xhpcChargingStationMapper.insertXhpcRate(xhpcRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加费率时段
|
||||||
|
*
|
||||||
|
* @param xhpcRateTime
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void insertXhpcRateTime(XhpcRateTime xhpcRateTime) {
|
||||||
|
xhpcChargingStationMapper.insertXhpcRateTime(xhpcRateTime);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存电站状态
|
* 保存电站状态
|
||||||
*
|
*
|
||||||
@ -902,6 +931,7 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
|||||||
XhpcRateModel xhpcRateModel = new XhpcRateModel();
|
XhpcRateModel xhpcRateModel = new XhpcRateModel();
|
||||||
BeanUtils.copyProperties(xhpcChargingStationDto, xhpcRateModel);
|
BeanUtils.copyProperties(xhpcChargingStationDto, xhpcRateModel);
|
||||||
xhpcRateModel.setRemark("修改");
|
xhpcRateModel.setRemark("修改");
|
||||||
|
xhpcRateModel.setCreateTime(new Date());
|
||||||
int i = xhpcChargingStationMapper.insertXhpcRateModel(xhpcRateModel);
|
int i = xhpcChargingStationMapper.insertXhpcRateModel(xhpcRateModel);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
return AjaxResult.error("1005", "费率计费模型添加失败");
|
return AjaxResult.error("1005", "费率计费模型添加失败");
|
||||||
|
|||||||
@ -2,17 +2,17 @@ package com.xhpc.charging.station.service;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.xhpc.charging.station.mapper.XhpcTimingChargingModelMapper;
|
import com.xhpc.charging.station.mapper.XhpcTimingChargingModelMapper;
|
||||||
|
import com.xhpc.common.api.PowerPileService;
|
||||||
|
import com.xhpc.common.api.SmsService;
|
||||||
import com.xhpc.common.api.dto.XhpcRateDto;
|
import com.xhpc.common.api.dto.XhpcRateDto;
|
||||||
import com.xhpc.common.api.dto.XhpcRateTimeDto;
|
import com.xhpc.common.api.dto.XhpcRateTimeDto;
|
||||||
import com.xhpc.common.api.dto.XhpcTimingChargingModelDto;
|
import com.xhpc.common.api.dto.XhpcTimingChargingModelDto;
|
||||||
import com.xhpc.common.core.domain.R;
|
import com.xhpc.common.core.domain.R;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
|
||||||
import com.xhpc.common.core.web.service.BaseService;
|
import com.xhpc.common.core.web.service.BaseService;
|
||||||
import com.xhpc.common.data.redis.CacheRateModel;
|
import com.xhpc.common.data.redis.CacheRateModel;
|
||||||
import com.xhpc.common.domain.*;
|
import com.xhpc.common.domain.*;
|
||||||
import com.xhpc.common.security.service.TokenService;
|
import com.xhpc.common.security.service.TokenService;
|
||||||
import com.xhpc.system.api.model.LoginUser;
|
import com.xhpc.system.api.model.LoginUser;
|
||||||
import org.checkerframework.checker.units.qual.A;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -35,6 +35,12 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
|
|||||||
private XhpcTimingChargingModelMapper xhpcTimingChargingModelMapper;
|
private XhpcTimingChargingModelMapper xhpcTimingChargingModelMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TokenService tokenService;
|
private TokenService tokenService;
|
||||||
|
@Autowired
|
||||||
|
private PowerPileService powerPileService;
|
||||||
|
@Autowired
|
||||||
|
private IXhpcChargingStationService xhpcChargingStationService;
|
||||||
|
@Autowired
|
||||||
|
private SmsService smsService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> list(HttpServletRequest request, String reason, Integer status, String startTime, String endTime, Long chargingStationId) {
|
public List<Map<String, Object>> list(HttpServletRequest request, String reason, Integer status, String startTime, String endTime, Long chargingStationId) {
|
||||||
@ -158,7 +164,7 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
|
|||||||
for (int k = 0; k < xhpcRateList.size(); k++) {
|
for (int k = 0; k < xhpcRateList.size(); k++) {
|
||||||
//存费率信息,并存储Map,费率时段使用,找到费率id
|
//存费率信息,并存储Map,费率时段使用,找到费率id
|
||||||
XhpcRateDto xhpcRateDto = xhpcRateList.get(k);
|
XhpcRateDto xhpcRateDto = xhpcRateList.get(k);
|
||||||
XhpcTtimingChargingRate xhpcTtimingChargingRate = new XhpcTtimingChargingRate();
|
XhpcTimingChargingRate xhpcTtimingChargingRate = new XhpcTimingChargingRate();
|
||||||
xhpcTtimingChargingRate.setChargingStationId(chargingStationId);
|
xhpcTtimingChargingRate.setChargingStationId(chargingStationId);
|
||||||
if ("00".equals(xhpcRateDto.getId()) || "01".equals(xhpcRateDto.getId()) || "02".equals(xhpcRateDto.getId()) || "03".equals(xhpcRateDto.getId())) {
|
if ("00".equals(xhpcRateDto.getId()) || "01".equals(xhpcRateDto.getId()) || "02".equals(xhpcRateDto.getId()) || "03".equals(xhpcRateDto.getId())) {
|
||||||
|
|
||||||
@ -391,8 +397,101 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getXhpcTimingChargingModelCron() {
|
@Transactional
|
||||||
|
public R getXhpcTimingChargingModelCron() {
|
||||||
|
//顺序排列
|
||||||
|
List<XhpcTimingChargingCacheRateModel> list = xhpcTimingChargingModelMapper.getXhpcTimingChargingModelId();
|
||||||
|
if(list !=null && list.size()>0){
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
XhpcTimingChargingCacheRateModel timingCharging = list.get(i);
|
||||||
|
if(timingCharging !=null && timingCharging.getTfPricesSeq() !=null) {
|
||||||
|
String[] tfPricesSeq = timingCharging.getTfPricesSeq().split(",");
|
||||||
|
if(tfPricesSeq.length==48){
|
||||||
|
CacheRateModel cacheRateModel = new CacheRateModel();
|
||||||
|
cacheRateModel.setLossRate(0);
|
||||||
|
cacheRateModel.setT1Price(timingCharging.getOnePrice());
|
||||||
|
cacheRateModel.setT1SvcPrice(timingCharging.getOneSvcPrice());
|
||||||
|
cacheRateModel.setT2Price(timingCharging.getTwoPrice());
|
||||||
|
cacheRateModel.setT2SvcPrice(timingCharging.getTwoSvcPrice());
|
||||||
|
cacheRateModel.setT3Price(timingCharging.getThreePrice());
|
||||||
|
cacheRateModel.setT3SvcPrice(timingCharging.getThreeSvcPrice());
|
||||||
|
cacheRateModel.setT4Price(timingCharging.getFourPrice());
|
||||||
|
cacheRateModel.setT4SvcPrice(timingCharging.getFourSvcPrice());
|
||||||
|
cacheRateModel.setTfPricesSeq(tfPricesSeq);
|
||||||
|
|
||||||
|
//添加费率计费模型
|
||||||
|
XhpcRateModel xhpcRateModel = new XhpcRateModel();
|
||||||
|
xhpcRateModel.setRemark("修改");
|
||||||
|
xhpcRateModel.setCreateTime(new Date());
|
||||||
|
int k = xhpcTimingChargingModelMapper.insertXhpcRateModel(xhpcRateModel);
|
||||||
|
if(k==0){
|
||||||
|
return R.fail("场站修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
Long chargingStationId = timingCharging.getChargingStationId();
|
||||||
|
Long rateModelId = xhpcRateModel.getRateModelId();
|
||||||
|
Long timingChargingModelId = timingCharging.getTimingChargingModelId();
|
||||||
|
//修改场站费率
|
||||||
|
XhpcChargingStation xhpcChargingStation = xhpcChargingStationService.selectXhpcChargingStationById(chargingStationId);
|
||||||
|
xhpcChargingStation.setRateModelId(rateModelId);
|
||||||
|
xhpcChargingStationService.updateXhpcChargingStation(xhpcChargingStation);
|
||||||
|
//删除该场站之前费率、费率时段
|
||||||
|
xhpcChargingStationService.updateXhpcRateTimeChargingStationId(chargingStationId);
|
||||||
|
//添加费率
|
||||||
|
List<XhpcTimingChargingRate> timingChargingRate = xhpcTimingChargingModelMapper.getRateTimingChargingModelId(timingChargingModelId);
|
||||||
|
if(timingChargingModelId ==null || timingChargingRate.size()==0){
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return R.fail("费率查询为空");
|
||||||
|
}
|
||||||
|
for (int j = 0; j < timingChargingRate.size(); j++) {
|
||||||
|
XhpcTimingChargingRate xhpcTimingChargingRate = timingChargingRate.get(j);
|
||||||
|
XhpcRate xhpcRate = new XhpcRate();
|
||||||
|
xhpcRate.setChargingStationId(chargingStationId);
|
||||||
|
xhpcRate.setName(xhpcTimingChargingRate.getName());
|
||||||
|
xhpcRate.setPowerFee(xhpcTimingChargingRate.getPowerFee());
|
||||||
|
xhpcRate.setServiceFee(xhpcTimingChargingRate.getServiceFee());
|
||||||
|
xhpcRate.setRateModelId(rateModelId);
|
||||||
|
xhpcRate.setRateValue(xhpcTimingChargingRate.getRateValue());
|
||||||
|
xhpcRate.setTenantId(xhpcTimingChargingRate.getTenantId());
|
||||||
|
xhpcChargingStationService.insertXhpcRate(xhpcRate);
|
||||||
|
}
|
||||||
|
//添加费率时段
|
||||||
|
List<XhpcTimingChargingTime> timingChargingTime = xhpcTimingChargingModelMapper.getTimeTimingChargingModelId(timingChargingModelId);
|
||||||
|
if(timingChargingTime ==null || timingChargingTime.size()==0){
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return R.fail("费率时段为空");
|
||||||
|
}
|
||||||
|
for (int j = 0; j < timingChargingTime.size(); j++) {
|
||||||
|
XhpcTimingChargingTime xhpcTimingChargingTime = timingChargingTime.get(j);
|
||||||
|
XhpcRateTime xhpcRateTime = new XhpcRateTime();
|
||||||
|
xhpcRateTime.setChargingStationId(chargingStationId);
|
||||||
|
xhpcRateTime.setRateId(xhpcTimingChargingTime.getTimingChargingRateId());
|
||||||
|
xhpcRateTime.setStartTime(xhpcTimingChargingTime.getStartTime());
|
||||||
|
xhpcRateTime.setEndTime(xhpcTimingChargingTime.getEndTime());
|
||||||
|
xhpcRateTime.setRateModelId(rateModelId);
|
||||||
|
xhpcRateTime.setSort(xhpcTimingChargingTime.getSort());
|
||||||
|
xhpcRateTime.setType(xhpcTimingChargingTime.getType());
|
||||||
|
xhpcRateTime.setRateValue(xhpcTimingChargingTime.getRateValue());
|
||||||
|
xhpcRateTime.setCreateTime(Calendar.getInstance().getTime());
|
||||||
|
xhpcChargingStationService.insertXhpcRateTime(xhpcRateTime);
|
||||||
|
}
|
||||||
|
R r =powerPileService.setStationRateModel(chargingStationId,rateModelId,cacheRateModel);
|
||||||
|
if (r.getCode() != 200) {
|
||||||
|
//数据回滚-手动回滚
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
//短信通知
|
||||||
|
HashMap<String, String> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("phone", timingCharging.getPhone());
|
||||||
|
paramMap.put("content", "【小华计费模型】尊敬的用户,计费模型"+timingChargingModelId+"更新失败,请快速处理");
|
||||||
|
smsService.sendNotice(paramMap);
|
||||||
|
return R.fail("添加费率入缓存失败,请稍后在试");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return R.fail("添加费率入缓存失败,请稍后在试");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XhpcRateTimeDto[] bubbleSort(XhpcRateTimeDto[] args) {
|
public static XhpcRateTimeDto[] bubbleSort(XhpcRateTimeDto[] args) {
|
||||||
|
|||||||
@ -19,8 +19,43 @@
|
|||||||
<result property="updateBy" column="update_by"/>
|
<result property="updateBy" column="update_by"/>
|
||||||
<result property="remark" column="remark"/>
|
<result property="remark" column="remark"/>
|
||||||
<result property="tenantId" column="tenant_id"/>
|
<result property="tenantId" column="tenant_id"/>
|
||||||
|
<result property="phone" column="phone"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="CacheRatetMap" type="com.xhpc.common.domain.XhpcTimingChargingCacheRateModel">
|
||||||
|
<result property="timingChargingCacheRateModelId" column="timing_charging_cache_rate_model_id"/>
|
||||||
|
<result property="timingChargingModelId" column="timing_charging_model_id"/>
|
||||||
|
<result property="onePrice" column="one_price"/>
|
||||||
|
<result property="oneSvcPrice" column="one_svc_price"/>
|
||||||
|
<result property="twoPrice" column="two_price"/>
|
||||||
|
<result property="twoSvcPrice" column="two_svc_price"/>
|
||||||
|
<result property="threePrice" column="three_price"/>
|
||||||
|
<result property="threeSvcPrice" column="three_svc_price"/>
|
||||||
|
<result property="fourPrice" column="four_price"/>
|
||||||
|
<result property="fourSvcPrice" column="four_svc_price"/>
|
||||||
|
<result property="lossRate" column="loss_rate"/>
|
||||||
|
<result property="tfPricesSeq" column="tf_prices_seq"/>
|
||||||
|
<result property="pp" column="pp"/>
|
||||||
|
<result property="status" column="status"/>
|
||||||
|
<result property="delFlag" column="del_flag"/>
|
||||||
|
<result property="tenantId" column="tenant_id"/>
|
||||||
|
<result property="chargingStationId" column="charging_station_id"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="TimingChargingRateMap" type="com.xhpc.common.domain.XhpcTimingChargingRate">
|
||||||
|
<result property="timingChargingRateId" column="timing_charging_cache_rate_model_id"/>
|
||||||
|
<result property="chargingStationId" column="timing_charging_model_id"/>
|
||||||
|
<result property="powerFee" column="one_price"/>
|
||||||
|
<result property="serviceFee" column="one_svc_price"/>
|
||||||
|
<result property="name" column="two_price"/>
|
||||||
|
<result property="status" column="two_svc_price"/>
|
||||||
|
<result property="delFlag" column="three_price"/>
|
||||||
|
<result property="timingChargingModelId" column="three_svc_price"/>
|
||||||
|
<result property="rateValue" column="four_price"/>
|
||||||
|
<result property="tenantId" column="four_svc_price"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
<select id="list" resultType="map">
|
<select id="list" resultType="map">
|
||||||
select
|
select
|
||||||
tcm.timing_charging_model_id as timingChargingModelId,
|
tcm.timing_charging_model_id as timingChargingModelId,
|
||||||
@ -83,7 +118,10 @@
|
|||||||
update_by,
|
update_by,
|
||||||
</if>
|
</if>
|
||||||
<if test="null != remark and '' != remark">
|
<if test="null != remark and '' != remark">
|
||||||
remark
|
remark,
|
||||||
|
</if>
|
||||||
|
<if test="null != phone and '' != phone">
|
||||||
|
phone
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
@ -118,12 +156,15 @@
|
|||||||
#{updateBy},
|
#{updateBy},
|
||||||
</if>
|
</if>
|
||||||
<if test="null != remark and '' != remark">
|
<if test="null != remark and '' != remark">
|
||||||
#{remark}
|
#{remark},
|
||||||
|
</if>
|
||||||
|
<if test="null != phone and '' != phone">
|
||||||
|
#{phone}
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertXhpcTtimingChargingRate" parameterType="com.xhpc.common.domain.XhpcTtimingChargingRate" useGeneratedKeys="true" keyProperty="timingChargingRateId">
|
<insert id="insertXhpcTtimingChargingRate" parameterType="com.xhpc.common.domain.XhpcTimingChargingRate" useGeneratedKeys="true" keyProperty="timingChargingRateId">
|
||||||
insert into xhpc_timing_charging_rate
|
insert into xhpc_timing_charging_rate
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="null != powerFee">
|
<if test="null != powerFee">
|
||||||
@ -514,4 +555,72 @@
|
|||||||
and tcm.tenant_id=#{tenantId}
|
and tcm.tenant_id=#{tenantId}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getXhpcTimingChargingModelId" resultMap="CacheRatetMap">
|
||||||
|
select
|
||||||
|
crm.*,
|
||||||
|
tcm.charging_station_id chargingStationId,
|
||||||
|
tcm.phone phone
|
||||||
|
from xhpc_timing_charging_cache_rate_model crm
|
||||||
|
left join xhpc_timing_charging_model tcm on crm.timing_charging_model_id = tcm.timing_charging_model_id and tcm.number<4 and tcm.status =0 and tcm.del_flag =0
|
||||||
|
where crm.del_flag=0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertXhpcRateModel" parameterType="com.xhpc.common.domain.XhpcRateModel" useGeneratedKeys="true"
|
||||||
|
keyProperty="rateModelId">
|
||||||
|
insert into xhpc_rate_model
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="null != status ">
|
||||||
|
status,
|
||||||
|
</if>
|
||||||
|
<if test="null != delFlag ">
|
||||||
|
del_flag,
|
||||||
|
</if>
|
||||||
|
<if test="null != createTime ">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
<if test="null != createBy and '' != createBy">
|
||||||
|
create_by,
|
||||||
|
</if>
|
||||||
|
<if test="null != updateTime ">
|
||||||
|
update_time,
|
||||||
|
</if>
|
||||||
|
<if test="null != updateBy and '' != updateBy">
|
||||||
|
update_by,
|
||||||
|
</if>
|
||||||
|
<if test="null != remark and '' != remark">
|
||||||
|
remark
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="null != status ">
|
||||||
|
#{status},
|
||||||
|
</if>
|
||||||
|
<if test="null != delFlag ">
|
||||||
|
#{delFlag},
|
||||||
|
</if>
|
||||||
|
<if test="null != createTime ">
|
||||||
|
#{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="null != createBy and '' != createBy">
|
||||||
|
#{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="null != updateTime ">
|
||||||
|
#{updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="null != updateBy and '' != updateBy">
|
||||||
|
#{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="null != remark and '' != remark">
|
||||||
|
#{remark}
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="getRateTimingChargingModelId" resultMap="TimingChargingRateMap">
|
||||||
|
select * from xhpc_timing_charging_rate where del_flag =0 and timing_charging_model_id =#{timingChargingModelId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -97,9 +97,4 @@ public class XhpcSettingConfig extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String tenantId;
|
private String tenantId;
|
||||||
|
|
||||||
/**
|
|
||||||
*租户id
|
|
||||||
*/
|
|
||||||
private String filePrefix;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,4 +42,8 @@ public class XhpcTimingChargingCacheRateModel extends BaseEntity {
|
|||||||
private Integer delFlag;
|
private Integer delFlag;
|
||||||
|
|
||||||
private String tenantId;
|
private String tenantId;
|
||||||
|
|
||||||
|
private Long chargingStationId;
|
||||||
|
|
||||||
|
private String phone;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,4 +54,6 @@ public class XhpcTimingChargingModel extends BaseEntity {
|
|||||||
* 租户id
|
* 租户id
|
||||||
*/
|
*/
|
||||||
private String tenantId;
|
private String tenantId;
|
||||||
|
|
||||||
|
private String phone;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import java.math.BigDecimal;
|
|||||||
* @date 2022/2/22 15:02
|
* @date 2022/2/22 15:02
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class XhpcTtimingChargingRate extends BaseEntity {
|
public class XhpcTimingChargingRate extends BaseEntity {
|
||||||
|
|
||||||
/** 费率id */
|
/** 费率id */
|
||||||
private Long timingChargingRateId;
|
private Long timingChargingRateId;
|
||||||
@ -3,6 +3,8 @@ package com.xhpc.payment.controller;
|
|||||||
import com.xhpc.common.core.domain.R;
|
import com.xhpc.common.core.domain.R;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
import com.xhpc.common.domain.XhpcSettingConfig;
|
import com.xhpc.common.domain.XhpcSettingConfig;
|
||||||
|
import com.xhpc.common.log.annotation.Log;
|
||||||
|
import com.xhpc.common.log.enums.BusinessType;
|
||||||
import com.xhpc.common.util.UserTypeUtil;
|
import com.xhpc.common.util.UserTypeUtil;
|
||||||
import com.xhpc.payment.service.IXhpcSettingConfigService;
|
import com.xhpc.payment.service.IXhpcSettingConfigService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@ -34,11 +36,11 @@ public class XhpcSettingConfigController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/info")
|
@GetMapping("/info")
|
||||||
@ApiOperation(value = "充值订单详情")
|
@ApiOperation(value = "充值订单详情")
|
||||||
public R info(HttpServletRequest request, @RequestParam Integer status) {
|
public R info(@RequestParam Integer status) {
|
||||||
if(status ==null){
|
if(status ==null){
|
||||||
return R.fail("类型为空");
|
return R.fail("类型为空");
|
||||||
}
|
}
|
||||||
return R.ok(xhpcSettingConfigService.getXhpcSettingConfigStatus(request,status));
|
return R.ok(xhpcSettingConfigService.getXhpcSettingConfigStatus(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,8 +49,8 @@ public class XhpcSettingConfigController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/updateXhpcSettingConfig")
|
@PostMapping("/updateXhpcSettingConfig")
|
||||||
@ApiOperation(value = "支付配置修改")
|
@Log(title = "支付配置修改", businessType = BusinessType.UPDATE)
|
||||||
public R updateXhpcSettingConfig(HttpServletRequest request,XhpcSettingConfig xhpcSettingConfig) {
|
public R updateXhpcSettingConfig(@RequestBody XhpcSettingConfig xhpcSettingConfig) {
|
||||||
|
|
||||||
if(xhpcSettingConfig.getStatus() ==null){
|
if(xhpcSettingConfig.getStatus() ==null){
|
||||||
return R.fail("类型为空");
|
return R.fail("类型为空");
|
||||||
@ -76,33 +78,33 @@ public class XhpcSettingConfigController {
|
|||||||
if(xhpcSettingConfig.getWxTransfersUrl()==null || "".equals(xhpcSettingConfig.getWxTransfersUrl())){
|
if(xhpcSettingConfig.getWxTransfersUrl()==null || "".equals(xhpcSettingConfig.getWxTransfersUrl())){
|
||||||
return R.fail("微信用户个人付款地址为空");
|
return R.fail("微信用户个人付款地址为空");
|
||||||
}
|
}
|
||||||
if(xhpcSettingConfig.getWxApiclientCertPem()==null || "".equals(xhpcSettingConfig.getWxApiclientCertPem())){
|
// if(xhpcSettingConfig.getWxApiclientCertPem()==null || "".equals(xhpcSettingConfig.getWxApiclientCertPem())){
|
||||||
return R.fail("微信证书p12为空");
|
// return R.fail("微信证书p12为空");
|
||||||
}
|
// }
|
||||||
if(xhpcSettingConfig.getWxApiclientKeyPem()==null || "".equals(xhpcSettingConfig.getWxApiclientKeyPem())){
|
// if(xhpcSettingConfig.getWxApiclientKeyPem()==null || "".equals(xhpcSettingConfig.getWxApiclientKeyPem())){
|
||||||
return R.fail("微信证书key.pem为空");
|
// return R.fail("微信证书key.pem为空");
|
||||||
}else{
|
// }else{
|
||||||
String[] split = xhpcSettingConfig.getWxApiclientKeyPem().split(".");
|
// String[] split = xhpcSettingConfig.getWxApiclientKeyPem().split(".");
|
||||||
if(split.length>1){
|
// if(split.length>1){
|
||||||
if(!"pem".equals(split[1])){
|
// if(!"pem".equals(split[1])){
|
||||||
return R.fail("请上传key.pem类型证书");
|
// return R.fail("请上传key.pem类型证书");
|
||||||
}
|
// }
|
||||||
}else{
|
// }else{
|
||||||
return R.fail("请上传key.pem类型证书");
|
// return R.fail("请上传key.pem类型证书");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if(xhpcSettingConfig.getWxAppCertPublicKey()==null || "".equals(xhpcSettingConfig.getWxAppCertPublicKey())){
|
// if(xhpcSettingConfig.getWxAppCertPublicKey()==null || "".equals(xhpcSettingConfig.getWxAppCertPublicKey())){
|
||||||
return R.fail("微信证书cret.pem为空");
|
// return R.fail("微信证书cret.pem为空");
|
||||||
}else{
|
// }else{
|
||||||
String[] split = xhpcSettingConfig.getWxApiclientKeyPem().split("\\.");
|
// String[] split = xhpcSettingConfig.getWxApiclientKeyPem().split("\\.");
|
||||||
if(split.length>1){
|
// if(split.length>1){
|
||||||
if(!"pem".equals(split[1])){
|
// if(!"pem".equals(split[1])){
|
||||||
return R.fail("请上传cret.pem类型证书");
|
// return R.fail("请上传cret.pem类型证书");
|
||||||
}
|
// }
|
||||||
}else{
|
// }else{
|
||||||
return R.fail("请上传cret.pem类型证书");
|
// return R.fail("请上传cret.pem类型证书");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}else{
|
}else{
|
||||||
if(xhpcSettingConfig.getZfbAppId()==null || "".equals(xhpcSettingConfig.getZfbAppId())){
|
if(xhpcSettingConfig.getZfbAppId()==null || "".equals(xhpcSettingConfig.getZfbAppId())){
|
||||||
return R.fail("支付宝小程序AppId为空");
|
return R.fail("支付宝小程序AppId为空");
|
||||||
@ -113,45 +115,45 @@ public class XhpcSettingConfigController {
|
|||||||
if(xhpcSettingConfig.getZfbCallbackUrl()==null || "".equals(xhpcSettingConfig.getZfbCallbackUrl())){
|
if(xhpcSettingConfig.getZfbCallbackUrl()==null || "".equals(xhpcSettingConfig.getZfbCallbackUrl())){
|
||||||
return R.fail("支付宝回调地址为空");
|
return R.fail("支付宝回调地址为空");
|
||||||
}
|
}
|
||||||
if(xhpcSettingConfig.getZfbAppCertPublicKey()==null || "".equals(xhpcSettingConfig.getZfbAppCertPublicKey())){
|
// if(xhpcSettingConfig.getZfbAppCertPublicKey()==null || "".equals(xhpcSettingConfig.getZfbAppCertPublicKey())){
|
||||||
return R.fail("支付宝应用公钥证书路径为空");
|
// return R.fail("支付宝应用公钥证书路径为空");
|
||||||
}else{
|
// }else{
|
||||||
String[] split = xhpcSettingConfig.getZfbAppCertPublicKey().split("\\.");
|
// String[] split = xhpcSettingConfig.getZfbAppCertPublicKey().split("\\.");
|
||||||
if(split.length>1){
|
// if(split.length>1){
|
||||||
if(!"crt".equals(split[1])){
|
// if(!"crt".equals(split[1])){
|
||||||
return R.fail("请上传支付宝公钥.crt类型证书");
|
// return R.fail("请上传支付宝公钥.crt类型证书");
|
||||||
}
|
// }
|
||||||
}else{
|
// }else{
|
||||||
return R.fail("请上传支付宝应用公钥.crt类型证书");
|
// return R.fail("请上传支付宝应用公钥.crt类型证书");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if(xhpcSettingConfig.getZfbAlipayCertPublicKeyRsa()==null || "".equals(xhpcSettingConfig.getZfbAlipayCertPublicKeyRsa())){
|
// if(xhpcSettingConfig.getZfbAlipayCertPublicKeyRsa()==null || "".equals(xhpcSettingConfig.getZfbAlipayCertPublicKeyRsa())){
|
||||||
return R.fail("支付宝公钥证书路径为空");
|
// return R.fail("支付宝公钥证书路径为空");
|
||||||
}else{
|
// }else{
|
||||||
String[] split = xhpcSettingConfig.getZfbAlipayCertPublicKeyRsa().split("\\.");
|
// String[] split = xhpcSettingConfig.getZfbAlipayCertPublicKeyRsa().split("\\.");
|
||||||
if(split.length>1){
|
// if(split.length>1){
|
||||||
if(!"crt".equals(split[1])){
|
// if(!"crt".equals(split[1])){
|
||||||
return R.fail("请上传支付宝公钥.crt类型证书");
|
// return R.fail("请上传支付宝公钥.crt类型证书");
|
||||||
}
|
// }
|
||||||
}else{
|
// }else{
|
||||||
return R.fail("请上传支付宝公钥.crt类型证书");
|
// return R.fail("请上传支付宝公钥.crt类型证书");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if(xhpcSettingConfig.getZfbAlipayRootCert()==null || "".equals(xhpcSettingConfig.getZfbAlipayRootCert())){
|
// if(xhpcSettingConfig.getZfbAlipayRootCert()==null || "".equals(xhpcSettingConfig.getZfbAlipayRootCert())){
|
||||||
return R.fail("支付宝根证书路径为空");
|
// return R.fail("支付宝根证书路径为空");
|
||||||
}else{
|
// }else{
|
||||||
String[] split = xhpcSettingConfig.getZfbAlipayRootCert().split("\\.");
|
// String[] split = xhpcSettingConfig.getZfbAlipayRootCert().split("\\.");
|
||||||
if(split.length>1){
|
// if(split.length>1){
|
||||||
if(!"crt".equals(split[1])){
|
// if(!"crt".equals(split[1])){
|
||||||
return R.fail("请上传支付宝根.crt类型证书");
|
// return R.fail("请上传支付宝根.crt类型证书");
|
||||||
}
|
// }
|
||||||
}else{
|
// }else{
|
||||||
return R.fail("请上传支付宝根.crt类型证书");
|
// return R.fail("请上传支付宝根.crt类型证书");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
//查询
|
//查询
|
||||||
Map<String, Object> xhpcSettingConfigStatus = xhpcSettingConfigService.getXhpcSettingConfigStatus(request, xhpcSettingConfig.getStatus());
|
Map<String, Object> xhpcSettingConfigStatus = xhpcSettingConfigService.getXhpcSettingConfigStatus(xhpcSettingConfig.getStatus());
|
||||||
if(xhpcSettingConfigStatus !=null){
|
if(xhpcSettingConfigStatus !=null){
|
||||||
xhpcSettingConfig.setSettingConfigId(Long.valueOf(xhpcSettingConfigStatus.get("settingConfigId").toString()));
|
xhpcSettingConfig.setSettingConfigId(Long.valueOf(xhpcSettingConfigStatus.get("settingConfigId").toString()));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,6 @@ public interface IXhpcSettingConfigService {
|
|||||||
|
|
||||||
R updateXhpcSettingConfig(XhpcSettingConfig xhpcSettingConfig);
|
R updateXhpcSettingConfig(XhpcSettingConfig xhpcSettingConfig);
|
||||||
|
|
||||||
Map<String,Object> getXhpcSettingConfigStatus(HttpServletRequest request,Integer status);
|
Map<String,Object> getXhpcSettingConfigStatus(Integer status);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,9 +52,9 @@ public class XhpcSettingConfigImpl implements IXhpcSettingConfigService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> getXhpcSettingConfigStatus(HttpServletRequest request, Integer status) {
|
public Map<String,Object> getXhpcSettingConfigStatus(Integer status) {
|
||||||
|
|
||||||
LoginUser logUser = tokenService.getLoginUser(request);
|
LoginUser logUser = tokenService.getLoginUser();
|
||||||
if(logUser==null){
|
if(logUser==null){
|
||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,6 @@
|
|||||||
<result column="update_by" property="updateBy"/>
|
<result column="update_by" property="updateBy"/>
|
||||||
<result column="remark" property="remark"/>
|
<result column="remark" property="remark"/>
|
||||||
<result column="tenant_id" property="tenantId"/>
|
<result column="tenant_id" property="tenantId"/>
|
||||||
<result column="file_prefix" property="filePrefix"/>
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="getXhpcSettingConfigTenantId" resultMap="XhpcSettingConfigResult">
|
<select id="getXhpcSettingConfigTenantId" resultMap="XhpcSettingConfigResult">
|
||||||
|
|||||||
@ -227,17 +227,17 @@
|
|||||||
wx_payment_url as wxPaymentUrl,
|
wx_payment_url as wxPaymentUrl,
|
||||||
wx_callback_url as wxCallbackUrl,
|
wx_callback_url as wxCallbackUrl,
|
||||||
wx_transfers_url as wxTransfersUrl,
|
wx_transfers_url as wxTransfersUrl,
|
||||||
concat("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png") as wxApiclientCertPem,
|
wx_apiclient_cert_pem as wxApiclientCertPem,
|
||||||
concat("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png") as wxApiclientKeyPem,
|
wx_apiclient_key_pem as wxApiclientKeyPem,
|
||||||
concat("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png") as wxAppCertPublicKey,
|
wx_app_cert_public_key as wxAppCertPublicKey,
|
||||||
</if>
|
</if>
|
||||||
<if test="status==2">
|
<if test="status==2">
|
||||||
zfb_app_id as zfbAppId,
|
zfb_app_id as zfbAppId,
|
||||||
zfb_private_key as zfbPrivateKey,
|
zfb_private_key as zfbPrivateKey,
|
||||||
zfb_callback_url as zfbCallbackUrl,
|
zfb_callback_url as zfbCallbackUrl,
|
||||||
concat("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png") as zfbAppCertPublicKey,
|
zfb_app_cert_public_key as zfbAppCertPublicKey,
|
||||||
concat("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png") as zfbAlipayCertPublicKeyRsa,
|
zfb_alipay_cert_public_key_rsa as zfbAlipayCertPublicKeyRsa,
|
||||||
concat("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png") as zfbAlipayRootCert,
|
zfb_alipay_root_cert as zfbAlipayRootCert,
|
||||||
zhb_server_url as zhbServerUrl,
|
zhb_server_url as zhbServerUrl,
|
||||||
</if>
|
</if>
|
||||||
status as status,
|
status as status,
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.xhpc.user.controller;
|
package com.xhpc.user.controller;
|
||||||
|
|
||||||
import cn.hutool.core.util.URLUtil;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alipay.api.AlipayClient;
|
import com.alipay.api.AlipayClient;
|
||||||
@ -254,8 +253,6 @@ public class XhpcAppUserController extends BaseController {
|
|||||||
R r = settingConfigService.settingConfig(2, tenantId);
|
R r = settingConfigService.settingConfig(2, tenantId);
|
||||||
if(r !=null && r.getCode()==200){
|
if(r !=null && r.getCode()==200){
|
||||||
Map<String, Object> map = (Map<String, Object>)r.getData();
|
Map<String, Object> map = (Map<String, Object>)r.getData();
|
||||||
String filePrefix = map.get("filePrefix").toString();
|
|
||||||
logger.info("filePrefix>>>>>>>>>>"+filePrefix);
|
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
CertAlipayRequest certAlipayRequest = new CertAlipayRequest();
|
CertAlipayRequest certAlipayRequest = new CertAlipayRequest();
|
||||||
/** 支付宝网关 **/
|
/** 支付宝网关 **/
|
||||||
@ -265,11 +262,11 @@ public class XhpcAppUserController extends BaseController {
|
|||||||
/** 应用私钥, 如何获取请参考:https://opensupport.alipay.com/support/helpcenter/207/201602471154?ant_source=antsupport **/
|
/** 应用私钥, 如何获取请参考:https://opensupport.alipay.com/support/helpcenter/207/201602471154?ant_source=antsupport **/
|
||||||
certAlipayRequest.setPrivateKey(map.get("zfbPrivateKey").toString());
|
certAlipayRequest.setPrivateKey(map.get("zfbPrivateKey").toString());
|
||||||
/** 应用公钥证书路径,下载后保存位置的绝对路径 **/
|
/** 应用公钥证书路径,下载后保存位置的绝对路径 **/
|
||||||
certAlipayRequest.setCertPath(filePrefix+map.get("zfbAppCertPublicKey").toString());
|
certAlipayRequest.setCertPath(map.get("zfbAppCertPublicKey").toString());
|
||||||
/** 支付宝公钥证书路径,下载后保存位置的绝对路径 **/
|
/** 支付宝公钥证书路径,下载后保存位置的绝对路径 **/
|
||||||
certAlipayRequest.setAlipayPublicCertPath(filePrefix+map.get("zfbAlipayCertPublicKeyRsa").toString());
|
certAlipayRequest.setAlipayPublicCertPath(map.get("zfbAlipayCertPublicKeyRsa").toString());
|
||||||
/** 支付宝根证书路径,下载后保存位置的绝对路径 **/
|
/** 支付宝根证书路径,下载后保存位置的绝对路径 **/
|
||||||
certAlipayRequest.setRootCertPath(filePrefix+map.get("zfbAlipayRootCert").toString());
|
certAlipayRequest.setRootCertPath(map.get("zfbAlipayRootCert").toString());
|
||||||
/** 设置签名类型 **/
|
/** 设置签名类型 **/
|
||||||
certAlipayRequest.setSignType("RSA2");
|
certAlipayRequest.setSignType("RSA2");
|
||||||
/** 设置请求格式,固定值json **/
|
/** 设置请求格式,固定值json **/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user