添加支付宝支付修改公司资料等

master
bynt 3 years ago
parent 20b2a4fff0
commit 4e083e754b

@ -0,0 +1,40 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Zheng Jie
* @date 2018-11-24
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Log {
String value() default "";
/**
*
*
* @return
*/
boolean enable() default true;
}

@ -0,0 +1,26 @@
package com.baiye.constant;
/**
*
*
* @author Enzo
* @date : 2021/6/16
*/
public class PayConstants {
private PayConstants() {
}
/**
*
*/
public static final String PAY_TITLE = "投流回跟系统支付订单:";
/**
* key
*/
public static final String OUT_TRADE_NO = "out_trade_no";
}

@ -0,0 +1,34 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.util;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Objects;
/**
* HttpServletRequest
* @author Zheng Jie
* @date 2018-11-24
*/
public class RequestHolder {
public static HttpServletRequest getHttpServletRequest() {
return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
}
}

@ -0,0 +1,37 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.util;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* 2019-01-06
* @author Zheng Jie
*/
public class ThrowableUtil {
/**
*
*/
public static String getStackTrace(Throwable throwable){
StringWriter sw = new StringWriter();
try (PrintWriter pw = new PrintWriter(sw)) {
throwable.printStackTrace(pw);
return sw.toString();
}
}
}

@ -0,0 +1,45 @@
/*
* Copyright 2019-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.model.enums;
/**
* @author: liaojinlong
* @date: 2020/6/11 19:47
* @apiNote:
*/
public enum LogActionType {
/**
*
*/
ADD("新增"),
SELECT("查询"),
UPDATE("更新"),
DELETE("删除");
private String value;
LogActionType(String value) {
this.value = value;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}

@ -11,17 +11,36 @@ public enum ResponseCode {
/**
*
*/
SUCCESS("1", "成功"),
SUCCESS("1", "success"),
/**
*
*/
FAILURE("1", "failure "),
/**
*
*/
PARAMETER_ERROR("1001", "参数错误"),
/**
*
*/
USER_INFORMATION_ERROR("1002", "用户信息错误"),
USER_INFORMATION_ERROR("1002", "用户信息错误,不能通过审核"),
/**
*
*/
ALI_PAY_ERROR("1016","支付宝支付失败"),
/**
*
*/
CALLBACK_FAILED("1017","支付宝支付回调失败"),
/**
*
*/
ACCOUNT_EXPIRED("1020","账号已过期"),
/**
*
*/
@ -32,14 +51,34 @@ public enum ResponseCode {
*/
AXB_CONFIGURATION_ERROR("1015", "axb参数配置错误"),
/**
*
*/
DECRYPTION_FAILED("1012", "数据解析失败"),
/**
* 100%,
*/
RATIO_FAILED("1013", "比率不足100%,无法分配"),
/**
* axb
*/
WRONG_USER_NAME_PASSWORD("1016", "用户名或密码不正确"),
DECRYPTION_FAILED("1012", "数据解析失败"),
/**
*
*
*/
INSUFFICIENT_ACCOUNT_BALANCE("1019", "账户余额不足"),
RATIO_FAILED("1013", "比率不足100%,无法分配");
/**
*
*
*/
NON_SUPER_ADMINISTRATORS_CANNOT_MODIFY_DATA("1018", "非管理员不能修改数据");
private final String code;

@ -0,0 +1,84 @@
package com.baiye.aspect;
import com.baiye.modules.system.domain.Log;
import com.baiye.modules.system.service.LogService;
import com.baiye.util.RequestHolder;
import com.baiye.util.SecurityUtils;
import com.baiye.util.StringUtils;
import com.baiye.util.ThrowableUtil;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
/**
* @author Enzo
* @date : 2022/3/20
*/
@Component
@Aspect
@Slf4j
public class LogAspect {
private final LogService logService;
ThreadLocal<Long> currentTime = new ThreadLocal<>();
public LogAspect(LogService logService) {
this.logService = logService;
}
/**
*
*/
@Pointcut("@annotation(com.baiye.annotation.Log)")
public void logPointcut() {
// 该方法无方法体,主要为了让同类中其他方法使用此切入点
}
/**
* ,使logPointcut()
*
* @param joinPoint join point for advice
*/
@Around("logPointcut()")
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
Object result;
currentTime.set(System.currentTimeMillis());
result = joinPoint.proceed();
Log log = new Log("INFO",System.currentTimeMillis() - currentTime.get());
currentTime.remove();
HttpServletRequest request = RequestHolder.getHttpServletRequest();
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request),joinPoint, log);
return result;
}
/**
*
*
* @param joinPoint join point for advice
* @param e exception
*/
@AfterThrowing(pointcut = "logPointcut()", throwing = "e")
public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
Log log = new Log("ERROR",System.currentTimeMillis() - currentTime.get());
currentTime.remove();
log.setExceptionDetail(ThrowableUtil.getStackTrace(e).getBytes());
HttpServletRequest request = RequestHolder.getHttpServletRequest();
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint)joinPoint, log);
}
public String getUsername() {
try {
return SecurityUtils.getCurrentUsername();
}catch (Exception e){
return "";
}
}
}

@ -0,0 +1,29 @@
package com.baiye.config.properties;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* @author Enzo
*/
@Data
@ConfigurationProperties(prefix = "alipay")
public class AliPayProperties {
@ApiModelProperty("协议")
private String protocol;
@ApiModelProperty("请求地址")
private String gatewayHost;
@ApiModelProperty("签名类型")
private String signType;
@ApiModelProperty("appId")
private String appId;
@ApiModelProperty("应用私钥")
private String merchantPrivateKey;
@ApiModelProperty("支付宝公钥")
private String aliPayPublicKey;
@ApiModelProperty("回调地址")
private String notifyUrl;
@ApiModelProperty("AES密钥")
private String encryptKey;
}

@ -145,6 +145,8 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers( "/api/back/cdrUrl").permitAll()
.antMatchers( "/api/back/status").permitAll()
.antMatchers( "/api/roll/cdrUrl").permitAll()
// 支付回调
.antMatchers( "/pay/aliPay/pay-notify").permitAll()
// 自定义匿名访问所有url放行允许匿名和带Token访问细腻化到每个 Request 类型
// GET
.antMatchers(HttpMethod.GET, anonymousUrls.get(RequestMethodEnum.GET.getType()).toArray(new String[0])).permitAll()

@ -84,4 +84,11 @@ public class Company extends BaseEntity implements Serializable {
@ApiModelProperty("axb请求字段")
@Column(name = "tel_x")
private String telX;
@ApiModelProperty("用户余额")
@Column(name = "user_balance")
private Double userBalance;
}

@ -0,0 +1,81 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.modules.system.domain;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* @author Zheng Jie
* @date 2018-11-24
*/
@Entity
@Getter
@Setter
@Table(name = "sys_log")
@NoArgsConstructor
public class Log implements Serializable {
@Id
@Column(name = "log_id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/** 操作用户 */
private String username;
/** 描述 */
private String description;
/** 方法名 */
private String method;
/** 参数 */
private String params;
/** 日志类型 */
private String logType;
/** 请求ip */
private String requestIp;
/** 地址 */
private String address;
/** 浏览器 */
private String browser;
/** 请求耗时 */
private Long time;
/** 异常详细 */
private byte[] exceptionDetail;
/** 创建日期 */
@CreationTimestamp
private Timestamp createTime;
public Log(String logType, Long time) {
this.logType = logType;
this.time = time;
}
}

@ -0,0 +1,87 @@
package com.baiye.modules.system.domain;
import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* @author Enzo
* @date 2021-10-28
*/
@Getter
@Setter
@Entity
@Table(name = "tb_pay_order")
@EntityListeners(AuditingEntityListener.class)
public class PayOrder implements Serializable {
private static final long serialVersionUID = 2056458673691527927L;
@Id
@Column(name = "id")
@ApiModelProperty(value = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "pay_type")
@ApiModelProperty(value = "支付类型")
private Integer payType;
@Column(name = "order_number")
@ApiModelProperty(value = "订单编号")
private String orderNumber;
@Column(name = "status")
@ApiModelProperty(value = "支付状态")
private Integer status;
@Column(name = "purchaser")
@ApiModelProperty(value = "购买人")
private String purchaser;
@CreatedDate
@Column(name = "order_time")
@ApiModelProperty(value = "下单时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
private Date orderTime;
@Column(name = "pay_time")
@ApiModelProperty(value = "支付时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
private Date payTime;
@ApiModelProperty(value = "创建时间")
@Column(name = "create_time")
@CreationTimestamp
private Date createTime;
@ApiModelProperty(value = "更新时间")
@Column(name = "update_time")
@LastModifiedDate
private Date updateTime;
@Column(name = "amount")
@ApiModelProperty(value = "金额")
private Double amount;
@Column(name = "user_id")
@ApiModelProperty(value = "用户id")
private Long userId;
@Column(name = "company_id")
@ApiModelProperty(value = "公司id")
private Long companyId;
}

@ -21,6 +21,8 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
/**
* @author Enzo
* @date 2022-1-21
@ -45,4 +47,20 @@ public interface CompanyRepository extends JpaRepository<Company, Long>, JpaSpec
@Modifying
@Query(value = "delete from Company where id = ?1")
void deleteCompanyId(Long companyId);
/**
* id
* @param balance
* @param companyId
*/
@Modifying
@Query("UPDATE Company set userBalance = ?1 where id = ?2")
void updateUserBalance(Double balance, Long companyId);
/**
* 0
* @return
*/
@Query(value = "from Company where userBalance < 0")
List<Company> findCompanyAndUserBalanceLessThanZero();
}

@ -0,0 +1,39 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.modules.system.repository;
import com.baiye.modules.system.domain.Log;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
/**
* @author Zheng Jie
* @date 2018-11-24
*/
@Repository
public interface LogRepository extends JpaRepository<Log,Long>, JpaSpecificationExecutor<Log> {
/**
*
* @param logType
*/
@Modifying
@Query(value = "delete from sys_log where log_type = ?1", nativeQuery = true)
void deleteByLogType(String logType);
}

@ -0,0 +1,34 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.modules.system.repository;
import com.baiye.modules.system.domain.PayOrder;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author Enzo
* @date 2022-3-18
*/
public interface PayOrderRepository extends JpaRepository<PayOrder, Long>, JpaSpecificationExecutor<PayOrder> {
/**
*
* @param orderNo
* @return
*/
PayOrder findByOrderNumber(String orderNo);
}

@ -15,6 +15,7 @@
*/
package com.baiye.modules.system.repository;
import cn.hutool.core.date.DateTime;
import com.baiye.modules.system.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@ -226,8 +227,26 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
int deleteByCompanyId(Long companyId);
/**
* id
* id
* @param companyId
* @return
*/
List<User> findByCompanyId(Long companyId);
/**
*
* @param date
* @return
*/
@Query(value = "from User where expirationTime > ?1")
List<User> findUserByTime(DateTime date);
/**
* id
* @param flag
* @param ids
*/
@Modifying
@Query(value = "update User set enabled = ?1 where id in ?2")
void updateStatusByUserIds(Boolean flag, List<Long> ids);
}

@ -0,0 +1,53 @@
package com.baiye.modules.system.rest;
import com.baiye.http.CommonResponse;
import com.baiye.modules.system.service.AliPayService;
import com.baiye.modules.system.service.dto.AliPayPcDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/**
* @author Enzo
*/
@Api(tags = "支付宝支付")
@Slf4j
@RestController
@RequestMapping(value = "/pay/aliPay")
@AllArgsConstructor
public class AliPayController {
private final AliPayService aliPayService;
@ApiOperation(value = "电脑支付")
@PostMapping(value = "/pcPay")
public CommonResponse<String> pcPay(@Validated @RequestBody AliPayPcDTO aliPayPcDTO) {
return CommonResponse.createBySuccess(aliPayService.aliPayPc(aliPayPcDTO));
}
/**
* pc
*
* @param request request
* @return
*/
@RequestMapping(value = "/pay-notify")
public ResponseEntity<String> frontRcvResponse(HttpServletRequest request) {
return new ResponseEntity<>(aliPayService.pcNotifyResponse(request),HttpStatus.OK);
}
}

@ -55,7 +55,7 @@ public class CompanyController {
public ResponseEntity<Object> companyDetails() {
Long companyId = SecurityUtils.getCompanyId();
if (companyId != null) {
CompanyDto companyDto = companyService.findCompanyByUserId(SecurityUtils.getCompanyId());
CompanyDto companyDto = companyService.findCompanyById(SecurityUtils.getCompanyId());
return new ResponseEntity<>(companyDto, HttpStatus.OK);
}
return new ResponseEntity<>(HttpStatus.OK);

@ -0,0 +1,53 @@
package com.baiye.modules.system.rest;
import com.baiye.annotation.Log;
import com.baiye.modules.system.service.PayOrderService;
import com.baiye.modules.system.service.dto.AliPayQueryCriteria;
import com.baiye.modules.system.service.dto.PayOrderDto;
import com.baiye.modules.system.service.dto.UpdateOrderDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author Enzo
* @date : 2022/3/20
*/
@Api(tags = "订单相关")
@Slf4j
@RestController
@RequestMapping(value = "/pay/payOrder")
@AllArgsConstructor
public class PayOrderController {
private final PayOrderService payOrderService;
@ApiOperation("查询订单数据")
@GetMapping(value = "/list")
public ResponseEntity<Object> list(AliPayQueryCriteria criteria, Pageable pageable) {
return new ResponseEntity<>(payOrderService.queryAll(criteria, pageable), HttpStatus.OK);
}
@ApiOperation("新增订单")
@PostMapping("/create")
public ResponseEntity<Object> create(@Validated @RequestBody PayOrderDto resources){
payOrderService.create(resources);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@Log("修改用户使用金额")
@ApiOperation("修改金额")
@PostMapping(value = "/amendmentAmount")
public ResponseEntity<Object> updateAmounts(@RequestBody List<UpdateOrderDto> updateOrderDtoList) {
payOrderService.updateAmount(updateOrderDtoList);
return new ResponseEntity<>(HttpStatus.OK);
}
}

@ -22,6 +22,7 @@ public interface AgentService {
/**
*
* @param agent
* @return
*/
AgentDto create(Agent agent);

@ -0,0 +1,29 @@
package com.baiye.modules.system.service;
import com.baiye.modules.system.service.dto.AliPayPcDTO;
import javax.servlet.http.HttpServletRequest;
/**
* @author Enzo
* @date : 2021/6/16
*/
public interface AliPayService {
/**
* pc
* @param aliPayPcDTO
* @return
*/
String aliPayPc(AliPayPcDTO aliPayPcDTO);
/**
*
* @param request
* @return
*/
String pcNotifyResponse(HttpServletRequest request);
}

@ -5,6 +5,7 @@ import com.baiye.modules.system.service.dto.CompanyDto;
import com.baiye.modules.system.service.dto.CompanyQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
@ -33,7 +34,7 @@ public interface CompanyService {
* @param id
* @return
*/
CompanyDto findCompanyByUserId(Long id);
CompanyDto findCompanyById(Long id);
/**
* id
@ -56,8 +57,28 @@ public interface CompanyService {
*/
void updateCompanyStatus(Integer status, Long id);
/**
*
* @param companyDto
*/
void updateCompany(CompanyDto companyDto);
/**
* id
* @param companyId
*/
void deleteCompanyByCompanyId(Long companyId);
/**
*
* @param balance
* @param companyId
*/
void updateUserBalanceByCompanyId(Double balance, Long companyId);
/**
*
* @return
*/
List<Company> findByCompanyListByBalance();
}

@ -0,0 +1,92 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.modules.system.service;
import com.baiye.modules.system.domain.Log;
import com.baiye.modules.system.service.dto.LogQueryCriteria;
import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* @author Zheng Jie
* @date 2018-11-24
*/
public interface LogService {
/**
*
* @param criteria
* @param pageable
* @return /
*/
Object queryAll(LogQueryCriteria criteria, Pageable pageable);
/**
*
* @param criteria
* @return /
*/
List<Log> queryAll(LogQueryCriteria criteria);
/**
*
* @param criteria
* @param pageable
* @return -
*/
Object queryAllByUser(LogQueryCriteria criteria, Pageable pageable);
/**
*
* @param username
* @param browser
* @param ip IP
* @param joinPoint /
* @param log
*/
@Async
void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, Log log);
/**
*
* @param id ID
* @return Object
*/
Object findByErrDetail(Long id);
/**
*
* @param logs
* @param response /
* @throws IOException /
*/
void download(List<Log> logs, HttpServletResponse response) throws IOException;
/**
*
*/
void delAllByError();
/**
* INFO
*/
void delAllByInfo();
}

@ -0,0 +1,36 @@
package com.baiye.modules.system.service;
import com.baiye.modules.system.service.dto.AliPayQueryCriteria;
import com.baiye.modules.system.service.dto.PayOrderDto;
import com.baiye.modules.system.service.dto.UpdateOrderDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @author Enzo
* @date : 2022/3/20
*/
public interface PayOrderService {
/**
*
* @param criteria
* @param pageable
* @return
*/
Map<String, Object> queryAll(AliPayQueryCriteria criteria, Pageable pageable);
/**
*
* @param updateOrderDtoList
* @return
*/
Boolean updateAmount(List<UpdateOrderDto> updateOrderDtoList);
/**
*
* @param resources
*/
void create(PayOrderDto resources);
}

@ -15,9 +15,11 @@
*/
package com.baiye.modules.system.service;
import cn.hutool.core.date.DateTime;
import com.baiye.model.dto.UserDto;
import com.baiye.modules.system.domain.User;
import com.baiye.modules.system.service.dto.CreateUserDTO;
import com.baiye.modules.system.service.dto.UpdateOrderDto;
import com.baiye.modules.system.service.dto.UserQueryCriteria;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;
@ -46,13 +48,14 @@ public interface UserService {
*
*
* @param resources /
* @return /
*/
User create(User resources);
/**
*
*
* @param resources /
* @throws Exception
*/
void update(User resources) throws Exception;
@ -176,9 +179,10 @@ public interface UserService {
/**
* id
* @param id
* @param flag
* @param ids
*/
void updateUserStatusByCompanyId(Long id);
void updateUserStatusByCompanyId(Boolean flag, List<Long> ids);
/**
*
@ -192,4 +196,17 @@ public interface UserService {
* @param userDTO
*/
void createUserOrFile(CreateUserDTO userDTO);
/**
*
* @param orderDtoList
*/
void updateUserExpirationTime(List<UpdateOrderDto> orderDtoList);
/**
*
* @return
* @param date
*/
List<User> findUserByExpirationTime(DateTime date);
}

@ -0,0 +1,29 @@
package com.baiye.modules.system.service.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author Enzo
* @date : 2022/3/16
*/
@Data
@NoArgsConstructor
public class AliPayPcDTO implements Serializable {
private static final long serialVersionUID = 6500373305956248683L;
@NotNull(message = "金额不能为空")
@DecimalMin(value = "0.01",message = "最小金额0.01")
@ApiModelProperty("充值金额")
private Double amount;
@ApiModelProperty("备注")
private String remark;
}

@ -0,0 +1,49 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.modules.system.service.dto;
import com.baiye.annotation.DataPermission;
import com.baiye.annotation.Query;
import lombok.Data;
import java.sql.Timestamp;
import java.util.List;
/**
* @author Zheng Jie
* @date 2019-03-25
*/
@Data
@DataPermission(fieldName = "id")
public class AliPayQueryCriteria {
@Query
private Integer status;
private Boolean sortBy;
private String sortByStr;
@Query(type = Query.Type.INNER_LIKE)
private String orderNumber;
@Query(type = Query.Type.BETWEEN)
private List<Double> amount;
@Query(type = Query.Type.BETWEEN)
private List<Timestamp> createTime;
}

@ -41,6 +41,9 @@ public class CompanyDto extends BaseDTO implements Serializable {
private Long userId;
@ApiModelProperty("用户余额")
private Double userBalance;
@ApiModelProperty("axb请求字段")
private String xGroup;

@ -18,6 +18,9 @@ package com.baiye.modules.system.service.dto;
import com.baiye.annotation.Query;
import lombok.Data;
import java.sql.Timestamp;
import java.util.List;
/**
* @author Zheng Jie
* @date 2019-04-10
@ -27,4 +30,12 @@ public class CompanyQueryCriteria {
@Query
private Long userId;
@Query(type = Query.Type.INNER_LIKE)
private String companyName;
@Query(type = Query.Type.BETWEEN)
private List<Timestamp> createTime;
}

@ -0,0 +1,47 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.modules.system.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* @author Zheng Jie
* @date 2019-5-22
*/
@Data
public class LogErrorDTO implements Serializable {
private Long id;
private String username;
private String description;
private String method;
private String params;
private String browser;
private String requestIp;
private String address;
private Timestamp createTime;
}

@ -0,0 +1,40 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.modules.system.service.dto;
import com.baiye.annotation.Query;
import lombok.Data;
import java.sql.Timestamp;
import java.util.List;
/**
*
* @author Zheng Jie
* @date 2019-6-4 09:23:07
*/
@Data
public class LogQueryCriteria {
@Query(blurry = "username,description,address,requestIp,method,params")
private String blurry;
@Query
private String logType;
@Query(type = Query.Type.BETWEEN)
private List<Timestamp> createTime;
}

@ -0,0 +1,43 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.modules.system.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* @author Zheng Jie
* @date 2019-5-22
*/
@Data
public class LogSmallDTO implements Serializable {
private static final long serialVersionUID = -4552967950319128982L;
private String description;
private String requestIp;
private Long time;
private String address;
private String browser;
private Timestamp createTime;
}

@ -0,0 +1,74 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.modules.system.service.dto;
import cn.hutool.core.date.DatePattern;
import com.baiye.model.base.BaseDTO;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* @author Zheng Jie
* @date 2019-03-29
*/
@Getter
@Setter
@NoArgsConstructor
public class PayOrderDto extends BaseDTO implements Serializable {
private static final long serialVersionUID = -2035716596706011470L;
@ApiModelProperty(value = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@ApiModelProperty(value = "支付类型")
private Integer payType;
@NotNull
@ApiModelProperty(value = "订单编号")
private String orderNumber;
@ApiModelProperty(value = "支付状态")
private Integer status;
@NotNull
@ApiModelProperty(value = "购买人")
private String purchaser;
@ApiModelProperty(value = "下单时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
private Date orderTime;
@ApiModelProperty(value = "支付时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
private Date payTime;
@NotNull
@ApiModelProperty(value = "金额")
private Double amount;
}

@ -0,0 +1,28 @@
package com.baiye.modules.system.service.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.io.Serializable;
/**
* @author Zheng Jie
* @date 2019-03-29
*/
@Getter
@Setter
@NoArgsConstructor
public class UpdateOrderDto implements Serializable {
private static final long serialVersionUID = -9110566536531791573L;
@ApiModelProperty(value = "公司id")
private Long companyId;
@ApiModelProperty(value = "用户id")
private Long userId;
}

@ -0,0 +1,157 @@
package com.baiye.modules.system.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import com.alipay.easysdk.payment.page.models.AlipayTradePagePayResponse;
import com.baiye.config.properties.AliPayProperties;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.constant.PayConstants;
import com.baiye.exception.BadRequestException;
import com.baiye.model.enums.ResponseCode;
import com.baiye.modules.system.domain.PayOrder;
import com.baiye.modules.system.repository.PayOrderRepository;
import com.baiye.modules.system.service.AliPayService;
import com.baiye.modules.system.service.CompanyService;
import com.baiye.modules.system.service.dto.AliPayPcDTO;
import com.baiye.modules.system.service.dto.CompanyDto;
import com.baiye.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.nio.charset.StandardCharsets;
import java.time.LocalTime;
import java.util.HashMap;
import java.util.Map;
/**
* @author Enzo
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class AliPayServiceImpl implements AliPayService {
private final PayOrderRepository payOrderRepository;
private final CompanyService companyService;
private final AliPayProperties aliPay;
@Value("${snowflake.workerId}")
private int workerId;
@Value("${snowflake.datacenterId}")
private int datacenterId;
@Override
@Transactional(rollbackFor = Exception.class)
public String pcNotifyResponse(HttpServletRequest request) {
log.info("================ the pay notify enter date as {} ================", DateUtil.date());
//获取支付宝GET过来反馈信息
Map<String, String> params = new HashMap<>(DefaultNumberConstants.SIXTEEN_NUMBER);
// 处理乱码问题
checkParam(request, params);
Boolean flag;
try {
flag = Factory.Payment.Common().verifyNotify(params);
//商户订单号
String orderNo = new String(request.getParameter(PayConstants.OUT_TRADE_NO).
getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
//前台回调验证签名 v1 or v2
if (flag != null && flag) {
log.info("========== order verify signature success the orderNumber as {} ==========", orderNo);
PayOrder order = payOrderRepository.findByOrderNumber(orderNo);
if (order != null &&
order.getStatus() == DefaultNumberConstants.ZERO_NUMBER) {
log.info("========== the order notify success date as {} ==========", DateUtil.date());
Long companyId = order.getCompanyId();
order.setPayTime(DateUtil.date());
order.setStatus(DefaultNumberConstants.ONE_NUMBER);
CompanyDto companyById = companyService.findCompanyById(companyId);
if (ObjectUtil.isNotNull(companyById)) {
// 设置充值金额
Double balance = companyById.getUserBalance() != null ?
companyById.getUserBalance() : DefaultNumberConstants.ZERO_NUMBER;
companyService.updateUserBalanceByCompanyId
(NumberUtil.add(balance, order.getAmount()), companyId);
}
payOrderRepository.save(order);
return ResponseCode.SUCCESS.getDesc();
}
}
} catch (Exception e) {
log.error("the pc response error time {}", LocalTime.now());
throw new BadRequestException(ResponseCode.CALLBACK_FAILED.getDesc());
}
return ResponseCode.FAILURE.getDesc();
}
private void checkParam(HttpServletRequest request, Map<String, String> params) {
Map<String, String[]> requestParams = request.getParameterMap();
if (CollectionUtils.isNotEmpty(requestParams.keySet())) {
for (Map.Entry<String, String[]> stringEntry : requestParams.entrySet()) {
String[] values = stringEntry.getValue();
String valueStr = CharSequenceUtil.EMPTY;
for (int i = 0; i < values.length; i++) {
valueStr = (i == values.length - 1) ? valueStr + values[i]
: valueStr + values[i] + StrPool.COMMA;
}
//乱码解决,这段代码在出现乱码时使用
valueStr = new String(valueStr.getBytes
(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
params.put(stringEntry.getKey(), valueStr);
}
}
}
@Override
public String aliPayPc(AliPayPcDTO aliPayPcDTO) {
// 查询记录
try {
// 雪花算法id
String orderNo = String.valueOf
(IdUtil.getSnowflake(workerId, datacenterId).nextId());
// 生成返回对象
AlipayTradePagePayResponse response = Factory.Payment.Page()
.pay(PayConstants.PAY_TITLE + orderNo,
orderNo, aliPayPcDTO.getAmount().toString(),
aliPay.getNotifyUrl());
if (ResponseChecker.success(response)) {
boolean result = savePayOrder(aliPayPcDTO, orderNo);
log.info("============= the save order result {} =============", result);
return response.getBody();
}
} catch (Exception e) {
log.error("the order failed purchaser {} time {}", aliPayPcDTO.getRemark(), LocalTime.now());
throw new BadRequestException(ResponseCode.ALI_PAY_ERROR.getDesc());
}
throw new BadRequestException(ResponseCode.ALI_PAY_ERROR.getDesc());
}
private boolean savePayOrder(AliPayPcDTO aliPayPcDTO, String orderNo) {
PayOrder order = new PayOrder();
order.setPurchaser(SecurityUtils.getCurrentUsername());
order.setOrderNumber(orderNo);
order.setAmount(aliPayPcDTO.getAmount());
order.setUserId(SecurityUtils.getCurrentUserId());
order.setCompanyId(SecurityUtils.getCompanyId());
order.setPayType(DefaultNumberConstants.ONE_NUMBER);
order.setStatus(DefaultNumberConstants.ZERO_NUMBER);
return payOrderRepository.save(order).getId() != null;
}
}

@ -2,8 +2,11 @@ package com.baiye.modules.system.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.exception.BadRequestException;
import com.baiye.exception.EntityExistException;
import com.baiye.model.enums.ResponseCode;
import com.baiye.modules.security.service.OnlineUserService;
import com.baiye.modules.system.domain.Company;
import com.baiye.modules.system.repository.CompanyRepository;
@ -17,7 +20,6 @@ import com.baiye.util.PageUtil;
import com.baiye.util.QueryHelp;
import com.baiye.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
@ -25,6 +27,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
@ -76,7 +79,7 @@ public class CompanyServiceImpl implements CompanyService {
}
@Override
public CompanyDto findCompanyByUserId(Long id) {
public CompanyDto findCompanyById(Long id) {
return companyMapper.toDto(companyRepository.findById(id).orElseGet(Company::new));
}
@ -99,6 +102,9 @@ public class CompanyServiceImpl implements CompanyService {
if (status != null) {
Company company = companyRepository.findById(id).orElseGet(Company::new);
if (company != null) {
if (ObjectUtil.isNull(company.getBusinessLicense()) || ObjectUtil.isNull(company.getLegalPersonIdFront()) || ObjectUtil.isNull(company.getManagerIdFront())){
throw new BadRequestException(ResponseCode.USER_INFORMATION_ERROR.getDesc());
}
userRepository.updateStatusById(Boolean.TRUE, company.getUserId());
}
if (status == DefaultNumberConstants.ONE_NUMBER) {
@ -127,4 +133,14 @@ public class CompanyServiceImpl implements CompanyService {
public void deleteCompanyByCompanyId(Long companyId) {
companyRepository.deleteCompanyId(companyId);
}
@Override
public void updateUserBalanceByCompanyId(Double balance, Long companyId) {
companyRepository.updateUserBalance(balance, companyId);
}
@Override
public List<Company> findByCompanyListByBalance() {
return companyRepository.findCompanyAndUserBalanceLessThanZero();
}
}

@ -0,0 +1,155 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.modules.system.service.impl;
import cn.hutool.core.lang.Dict;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import com.baiye.modules.system.domain.Log;
import com.baiye.modules.system.repository.LogRepository;
import com.baiye.modules.system.service.LogService;
import com.baiye.modules.system.service.dto.LogQueryCriteria;
import com.baiye.modules.system.service.mapstruct.LogErrorMapper;
import com.baiye.modules.system.service.mapstruct.LogSmallMapper;
import com.baiye.util.*;
import lombok.RequiredArgsConstructor;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.*;
/**
* @author Zheng Jie
* @date 2018-11-24
*/
@Service
@RequiredArgsConstructor
public class LogServiceImpl implements LogService {
private static final Logger log = LoggerFactory.getLogger(LogServiceImpl.class);
private final LogRepository logRepository;
private final LogErrorMapper logErrorMapper;
private final LogSmallMapper logSmallMapper;
@Override
public Object queryAll(LogQueryCriteria criteria, Pageable pageable) {
Page<Log> page = logRepository.findAll(((root, criteriaQuery, cb) -> QueryHelp.getPredicate(root, criteria, cb)), pageable);
String status = "ERROR";
if (status.equals(criteria.getLogType())) {
return PageUtil.toPage(page.map(logErrorMapper::toDto));
}
return page;
}
@Override
public List<Log> queryAll(LogQueryCriteria criteria) {
return logRepository.findAll(((root, criteriaQuery, cb) -> QueryHelp.getPredicate(root, criteria, cb)));
}
@Override
public Object queryAllByUser(LogQueryCriteria criteria, Pageable pageable) {
Page<Log> page = logRepository.findAll(((root, criteriaQuery, cb) -> QueryHelp.getPredicate(root, criteria, cb)), pageable);
return PageUtil.toPage(page.map(logSmallMapper::toDto));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, Log log) {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
com.baiye.annotation.Log aopLog = method.getAnnotation(com.baiye.annotation.Log.class);
// 方法路径
String methodName = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()";
StringBuilder params = new StringBuilder("{");
//参数值
List<Object> argValues = new ArrayList<>(Arrays.asList(joinPoint.getArgs()));
//参数名称
for (Object argValue : argValues) {
params.append(argValue).append(" ");
}
// 描述
if (log != null) {
log.setDescription(aopLog.value());
}
assert log != null;
log.setRequestIp(ip);
String loginPath = "login";
if (loginPath.equals(signature.getName())) {
try {
username = new JSONObject(argValues.get(0)).get("username").toString();
} catch (Exception e) {
LogServiceImpl.log.error(e.getMessage(), e);
}
}
log.setAddress(StringUtils.getCityInfo(log.getRequestIp()));
log.setMethod(methodName);
log.setUsername(username);
log.setParams(params.toString() + " }");
log.setBrowser(browser);
logRepository.save(log);
}
@Override
public Object findByErrDetail(Long id) {
Log log = logRepository.findById(id).orElseGet(Log::new);
ValidationUtil.isNull(log.getId(), "Log", "id", id);
byte[] details = log.getExceptionDetail();
return Dict.create().set("exception", new String(ObjectUtil.isNotNull(details) ? details : "".getBytes()));
}
@Override
public void download(List<Log> logs, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (Log log : logs) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("用户名", log.getUsername());
map.put("IP", log.getRequestIp());
map.put("IP来源", log.getAddress());
map.put("描述", log.getDescription());
map.put("浏览器", log.getBrowser());
map.put("请求耗时/毫秒", log.getTime());
map.put("异常详情", new String(ObjectUtil.isNotNull(log.getExceptionDetail()) ? log.getExceptionDetail() : "".getBytes()));
map.put("创建日期", log.getCreateTime());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delAllByError() {
logRepository.deleteByLogType("ERROR");
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delAllByInfo() {
logRepository.deleteByLogType("INFO");
}
}

@ -0,0 +1,127 @@
package com.baiye.modules.system.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.json.JSONUtil;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.exception.BadRequestException;
import com.baiye.model.dto.RoleSmallDto;
import com.baiye.model.dto.UserDto;
import com.baiye.model.enums.ResponseCode;
import com.baiye.modules.system.domain.PayOrder;
import com.baiye.modules.system.repository.PayOrderRepository;
import com.baiye.modules.system.service.CompanyService;
import com.baiye.modules.system.service.PayOrderService;
import com.baiye.modules.system.service.UserService;
import com.baiye.modules.system.service.dto.AliPayQueryCriteria;
import com.baiye.modules.system.service.dto.CompanyDto;
import com.baiye.modules.system.service.dto.PayOrderDto;
import com.baiye.modules.system.service.dto.UpdateOrderDto;
import com.baiye.modules.system.service.mapstruct.PayOrderMapper;
import com.baiye.util.PageUtil;
import com.baiye.util.QueryHelp;
import com.baiye.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
/**
* @author Enzo
* @date : 2022/3/20
*/
@Service
@RequiredArgsConstructor
public class PayOrderServiceImpl implements PayOrderService {
private final UserService userService;
private final CompanyService companyService;
private final PayOrderMapper payOrderMapper;
private final PayOrderRepository payOrderRepository;
@Override
public Map<String, Object> queryAll(AliPayQueryCriteria criteria, Pageable pageable) {
Sort sort = Sort.by(Sort.Direction.DESC, "id");
if (criteria.getSortBy() != null) {
sort = Sort.by(Boolean.TRUE.equals(criteria.getSortBy()) ? Sort.Direction.ASC
: Sort.Direction.DESC, criteria.getSortByStr());
}
PageRequest pageRequest = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), sort);
Page<PayOrder> pageAll = payOrderRepository.findAll(
(root, criteriaQuery, criteriaBuilder) ->
QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageRequest);
return PageUtil.toPage(pageAll.map(payOrderMapper::toDto));
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateAmount(List<UpdateOrderDto> updateOrderDtoList) {
checkPer();
if (CollUtil.isNotEmpty(updateOrderDtoList)) {
// 公司分组
Map<Long, List<UpdateOrderDto>> longListMap = updateOrderDtoList.stream().collect(
Collectors.groupingBy(UpdateOrderDto::getCompanyId));
for (Map.Entry<Long, List<UpdateOrderDto>> longListEntry : longListMap.entrySet()) {
Long companyId = longListEntry.getKey();
List<UpdateOrderDto> orderDtoList = longListEntry.getValue();
CompanyDto companyById =
companyService.findCompanyById(companyId);
List<UpdateOrderDto> dtoList = longListMap.get(companyId);
Double userBalance = companyById.getUserBalance();
Double minusAmount = NumberUtil.mul
(dtoList.size(), DefaultNumberConstants.THIRTY);
double subAmount = NumberUtil.sub(userBalance, minusAmount);
// 判断余额
if (userBalance == null || subAmount <= DefaultNumberConstants.ZERO_NUMBER) {
throw new BadRequestException(ResponseCode.INSUFFICIENT_ACCOUNT_BALANCE.getDesc());
}
// 异步插入数据
CompletableFuture.runAsync(() ->
userService.updateUserExpirationTime(orderDtoList));
// 修改公司余额
companyService.updateUserBalanceByCompanyId(subAmount, companyId);
}
return Boolean.TRUE;
}
return Boolean.FALSE;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(PayOrderDto resources) {
checkPer();
PayOrder payOrder = new PayOrder();
BeanUtil.copyProperties(resources, payOrder);
payOrderRepository.save(payOrder);
}
/**
*
*/
private void checkPer() {
UserDto userDto = JSONUtil.toBean(SecurityUtils.getUser(), UserDto.class);
boolean flag = Boolean.TRUE;
for (RoleSmallDto role : userDto.getRoles()) {
if (role.getId() == DefaultNumberConstants.ONE_NUMBER
|| role.getId() == DefaultNumberConstants.EIGHT_NUMBER) {
flag = Boolean.FALSE;
break;
}
}
if (flag) {
throw new BadRequestException
(ResponseCode.NON_SUPER_ADMINISTRATORS_CANNOT_MODIFY_DATA.getDesc());
}
}
}

@ -17,16 +17,21 @@ package com.baiye.modules.system.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.StrPool;
import com.alibaba.excel.EasyExcelFactory;
import com.baiye.config.properties.FileProperties;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.exception.BadRequestException;
import com.baiye.exception.EntityExistException;
import com.baiye.model.dto.RoleSmallDto;
import com.baiye.model.dto.TreeUserDTO;
import com.baiye.model.dto.UserDto;
import com.baiye.model.dto.UserFavorOfExcel;
import com.baiye.model.enums.ResponseCode;
import com.baiye.modules.security.service.OnlineUserService;
import com.baiye.modules.system.domain.*;
import com.baiye.modules.system.repository.OrganizeRepository;
@ -37,6 +42,7 @@ import com.baiye.modules.system.service.CompanyService;
import com.baiye.modules.system.service.UserService;
import com.baiye.modules.system.service.dto.CompanyDto;
import com.baiye.modules.system.service.dto.CreateUserDTO;
import com.baiye.modules.system.service.dto.UpdateOrderDto;
import com.baiye.modules.system.service.dto.UserQueryCriteria;
import com.baiye.modules.system.service.mapstruct.UserMapper;
import com.baiye.service.UserCacheClean;
@ -81,11 +87,10 @@ public class UserServiceImpl implements UserService {
private final OrganizeRepository organizeRepository;
@Override
@SneakyThrows
@Transactional(rollbackFor = Exception.class)
public Boolean fileCreateUser(MultipartFile file, Long companyId, UserDto userDto){
public Boolean fileCreateUser(MultipartFile file, Long companyId, UserDto userDto) {
List<UserFavorOfExcel> userFavorOfExcels =
EasyExcelFactory.read(file.getInputStream())
.head(UserFavorOfExcel.class)
@ -125,6 +130,17 @@ public class UserServiceImpl implements UserService {
List<TreeUserDTO> users =
Convert.toList(TreeUserDTO.class, page.getContent());
users.forEach(user -> {
Set<RoleSmallDto> roles = user.getRoles();
if (CollUtil.isNotEmpty(roles)) {
for (RoleSmallDto role : roles) {
if (role.getId() == DefaultNumberConstants.EIGHT_NUMBER) {
user.setIsManager(Boolean.TRUE);
}
if (role.getId() == DefaultNumberConstants.ONE_NUMBER) {
user.setIsAdmin(Boolean.TRUE);
}
}
}
List<User> byWhichUserId = userRepository.findByWhichUserId(user.getId());
if (CollUtil.isNotEmpty(byWhichUserId)) {
user.setChildren(Convert.toList(TreeUserDTO.class, byWhichUserId));
@ -135,8 +151,8 @@ public class UserServiceImpl implements UserService {
@Override
@Transactional(rollbackFor = Exception.class)
public void updateUserStatusByCompanyId(Long id) {
userRepository.updateStatusByCompanyId(Boolean.TRUE, id);
public void updateUserStatusByCompanyId(Boolean flag, List<Long> ids) {
userRepository.updateStatusByUserIds(flag, ids);
}
@Override
@ -162,7 +178,7 @@ public class UserServiceImpl implements UserService {
}
}
}
if (flag){
if (flag) {
CompanyDto companyDto = new CompanyDto();
companyDto.setCompanyName(userDTO.getUsername());
companyDto.setStatus(DefaultNumberConstants.ZERO_NUMBER);
@ -191,6 +207,29 @@ public class UserServiceImpl implements UserService {
}
@Override
public void updateUserExpirationTime(List<UpdateOrderDto> orderDtoList) {
if (CollUtil.isNotEmpty(orderDtoList)) {
for (UpdateOrderDto dto : orderDtoList) {
User user = userRepository.findById
(dto.getUserId()).orElseGet(User::new);
if (user != null) {
// 修改过期时间
DateTime dateTime = DateUtil.offsetMonth
(user.getExpirationTime() != null
? user.getExpirationTime() : DateUtil.date(), DefaultNumberConstants.ONE_NUMBER);
user.setExpirationTime(DateUtil.endOfDay(dateTime));
userRepository.save(user);
}
}
}
}
@Override
public List<User> findUserByExpirationTime(DateTime date) {
return userRepository.findUserByTime(date);
}
@Override
public Object queryAll(UserQueryCriteria criteria, Pageable pageable) {
@ -231,7 +270,7 @@ public class UserServiceImpl implements UserService {
@Override
public List<UserDto> findByManager(List<Long> roleIds) {
User user = userRepository.findById(SecurityUtils.getCurrentUserId()).orElseGet(User::new);
List<User> users = userRepository.findAllManage(roleIds,user.getCompanyId());
List<User> users = userRepository.findAllManage(roleIds, user.getCompanyId());
return userMapper.toDto(users);
}
@ -279,11 +318,17 @@ public class UserServiceImpl implements UserService {
if (user3 != null && !user.getId().equals(user3.getId())) {
throw new EntityExistException(User.class, "phone", resources.getPhone());
}
if (user.getExpirationTime() != null &&
user.getExpirationTime().before(DateUtil.date())
&& Boolean.TRUE.equals(resources.getEnabled())) {
throw new BadRequestException(ResponseCode.ACCOUNT_EXPIRED.getDesc());
}
// 如果用户的角色改变
if (!resources.getRoles().equals(user.getRoles())) {
//查询是否已经分配到组
OrganizeUser organizeUser = organizeUserRepository.findByUserId(user.getId());
if (organizeUser != null){
if (organizeUser != null) {
throw new BadRequestException("用户已经分配到组,无法修改用户角色");
}
redisUtils.del(CacheKey.DATA_USER + resources.getId());
@ -335,7 +380,7 @@ public class UserServiceImpl implements UserService {
}
//查询是否已经分配到组
List<OrganizeUser> organizeUserList = organizeUserRepository.findByUserIdIn(ids);
if (CollUtil.isNotEmpty(organizeUserList)){
if (CollUtil.isNotEmpty(organizeUserList)) {
throw new BadRequestException("用户已经分配到组,无法删除");
}
userRepository.deleteAllByIdIn(ids);
@ -345,24 +390,28 @@ public class UserServiceImpl implements UserService {
public UserDto findByName(String userName) {
UserDto convert;
User user = userRepository.findByUsername(userName);
CompanyDto companyByUserId = null;
if (user != null) {
convert = Convert.convert(UserDto.class, user);
Set<Role> roles = user.getRoles();
convert.setIsManager(Boolean.FALSE);
if (user.getCompanyId() != null) {
CompanyDto companyByUserId = companyService.findCompanyByUserId(user.getCompanyId());
companyByUserId = companyService.findCompanyById(user.getCompanyId());
if (companyByUserId != null && companyByUserId.getStatus() != null) {
convert.setCompanyStatus(companyByUserId.getStatus());
}
}
OrganizeUser organizeUser = organizeUserRepository.findByUserId(user.getId());
if (organizeUser != null){
if (organizeUser != null) {
Organize organize = organizeRepository.findOrganizeById(organizeUser.getOrganizeId());
convert.setOrganizeName(organize.getOrganizeName());
}
for (Role role : roles) {
if (role.getId() == DefaultNumberConstants.EIGHT_NUMBER) {
convert.setIsManager(Boolean.TRUE);
if (companyByUserId != null) {
convert.setUserBalance(companyByUserId.getUserBalance());
}
}
if (role.getId() == DefaultNumberConstants.NINE_NUMBER) {
convert.setIsGroup(Boolean.TRUE);
@ -371,7 +420,6 @@ public class UserServiceImpl implements UserService {
convert.setIsOperator(Boolean.TRUE);
}
}
return convert;
}
return null;

@ -0,0 +1,31 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.modules.system.service.mapstruct;
import com.baiye.model.base.BaseMapper;
import com.baiye.modules.system.domain.Log;
import com.baiye.modules.system.service.dto.LogErrorDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author Zheng Jie
* @date 2019-5-22
*/
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface LogErrorMapper extends BaseMapper<LogErrorDTO, Log> {
}

@ -0,0 +1,31 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.modules.system.service.mapstruct;
import com.baiye.model.base.BaseMapper;
import com.baiye.modules.system.domain.Log;
import com.baiye.modules.system.service.dto.LogSmallDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author Zheng Jie
* @date 2019-5-22
*/
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface LogSmallMapper extends BaseMapper<LogSmallDTO, Log> {
}

@ -0,0 +1,33 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.baiye.modules.system.service.mapstruct;
import com.baiye.model.base.BaseMapper;
import com.baiye.modules.system.domain.Dept;
import com.baiye.modules.system.domain.PayOrder;
import com.baiye.modules.system.service.dto.DeptDto;
import com.baiye.modules.system.service.dto.PayOrderDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author Zheng Jie
* @date 2019-03-25
*/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface PayOrderMapper extends BaseMapper<PayOrderDto, PayOrder> {
}

@ -0,0 +1,44 @@
package com.baiye.timed;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import com.baiye.modules.system.domain.Company;
import com.baiye.modules.system.domain.User;
import com.baiye.modules.system.service.CompanyService;
import com.baiye.modules.system.service.UserService;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author Enzo
* @date : 2022/1/22
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class UserBalanceTask {
private final CompanyService companyService;
private final UserService userService;
/**
*
* 7
*/
@Scheduled(cron = "0 0 1 * * ?")
public void checkUserBalance() {
List<User> companyList = userService.findUserByExpirationTime(DateUtil.date());
if (CollUtil.isNotEmpty(companyList)) {
List<Long> userIds = companyList.stream().map(User::getId).collect(Collectors.toList());
userService.updateUserStatusByCompanyId(Boolean.FALSE, userIds);
}
}
}

@ -0,0 +1,40 @@
package com.baiye.util;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.Config;
import com.baiye.config.properties.AliPayProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
/**
* @author Enzo
*/
@Component
@Configuration
@EnableConfigurationProperties({AliPayProperties.class})
public class PayUtils {
private final AliPayProperties aliPay;
public PayUtils(AliPayProperties aliPay) {
this.aliPay = aliPay;
Config config = new Config();
config.protocol = aliPay.getProtocol();
config.gatewayHost = aliPay.getGatewayHost();
config.signType = aliPay.getSignType();
config.appId = aliPay.getAppId();
/**
*
*/
config.merchantPrivateKey = aliPay.getMerchantPrivateKey();
config.alipayPublicKey = aliPay.getAliPayPublicKey();
config.notifyUrl = aliPay.getNotifyUrl();
config.encryptKey = aliPay.getEncryptKey();
Factory.setOptions(config);
}
public AliPayProperties getConfig(){
return aliPay;
}
}

@ -58,6 +58,7 @@ spring:
config:
multi-statement-allow: true
# 登录相关配置
login:
# 登录缓存
@ -138,6 +139,23 @@ roll:
#cdrUrl: https://baiyee.vip/api/roll/cdrUrl
#cdrUrl: http://localhost:8866/api/roll/cdrUrl
alipay:
protocol: https
# 不需要加/gateway.do这是新旧SDK的区别切记
# gatewayHost: openapi.alipaydev.com
gatewayHost: openapi.alipay.com
signType: RSA2
# 填APPID
appId: 2021003125644167
# 填应用私钥注意是应用私钥不要填成公钥了_(:з」∠)_
merchantPrivateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCNIuelR5MHMY3vtl2KEgWUbhHMHuBwxHMVONuUYKlt4grOGJtaPKitgh9MxrvaxmAvH0LilQQKd5T07os9jC2XpNmH0BA6rNVNgBwjWNllqKo+jT8OiKvog9uBuZYfHdkLRhjObrTkSo97jO5Y32591GZHG+cQ/5bgMC0KXlQMOv5piLqUfKYDJ5pWBdS5gqcCkUABZsrW+C8nD7lvOuVglN1AGQiXQzj+Iu3K5xcUg+d3q0nWXhKPpotSolFGSakLEqUja/MnsILVHVw8MYMuq6LxzQ7DQ5fCzMPMIF5kYTynsAV5SoE90ilj1vmmI4aa7dc+9OmG/vXyFuoOEK1bAgMBAAECggEAH0K/9EfqNQmw2ouWJGLhgYLvxjqAk/mvU+AIItFWNdR/eC7TGiWdZvEPZb4PFeIio81Uz0MaZgceozHC/Zry7kfBNufK8HQfus7JbLrdTDsTmk9GzD1RdmreT9l/etztmiWokPDMeFRbe443rM+wdYZ6MP3pLEawcG+7SjSigSKrcpltAJ49NhHyfJxnnCye4mM8PevVGXe4nGv/vKJbAfzl5V8MsSY+SVktj6jOUTSa6nypISvQElyv8jeNH/bTDjg0DOHzL4tUHaVbTqHhtqbNo3n9VuKz4shVAp3I+9PpcTQTueTsM9L0Y+j84bV3VZlTIGGzDUD4qWDhUKPJ4QKBgQDQFNB2vLDJLeGfn+SnCncnr/wQo1xJez+deBqJXoDhDWDuZVcWNaEOWgfDronm8dIedWMYHD//WN0GtA5foAUdlaNq/jeKdJFgzJ/hoOtOveHY1OWqJHiJ/YMRBMuLn/E4Jit7q215JU6Jur1T+70HxrUFTQfY8GWdMvSDFHCKDwKBgQCto24hqgcEDKoR3/sm5sUKqYZTHLeQbniM0D5EcOkBNw7UXGYQSbz7mJ34XQKTfrOL71A+LkjxdMfs5q56yxeOQxR4EBO/Fpz8xPRlud5uIp4eTQVJ8I01meZyvojkF6mO5C4tbcXJOpnpU8ohoeTRu7th0oUYObGUYmn0qzuj9QKBgDCOOtsKSwKXF0hFanjkQ0vakCpdxIJNJVoclayqhc5+bbkTos/G8e9EaP1rtDhVA6Ah6l7M8M4oMWOIDraXw7nUmk60RcekTexVs5VWFLLKMnKDs5gRbKNeqgAFq23Ig+SDW7A/H4uefgY7skRvwPuYjdNP113zMvMM2evgkCZXAoGAP5przvz/EOaqrV2EG93QM3WhdHRCcS9mDP6CsINDdmR6lCM8Z577EJX4128KcIiqsAl7NSuzIG8MhKSDKQuXl07PAqOw+AAKhTSH6XNKHMGldaf01f69WvMCzOkqL5LTUzoWCCH7nxhOJH/CvMsWjBTeMJjyk8seVyIteaf3crkCgYEAmY8OC+Vdo/yop+ooedCnvBC7GVMfcqR6+rIQ+ZnKom7jhByIN6w7eEVAnmNa9dCv/pig7HaYbitWmCNf9tbqFfcdY6e5Svele3amgDM9iqtdJ9Rf1PpDPZw+gmjRIxGs6W8wnl1Sqvpk8pFUA/2xlT6sXpfxra9N09LS0ttU+cU=
# 填支付宝公钥,注意不是生成的应用公钥
aliPayPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyvegkGCrz1i5/K7VzQxvoZm4G73pSPNu9R5ET8YonIuDVoHkHaYvQQizLdRkTyBsYIik8FXsSDmVsw5MLMQ7OAlZ97nQBkz5TxOX6Px766nUpSVoWXoAz6cpIlWnwgir4t1ph88Ph56l+qmqW3gUj/U6MIuzjxBJlijTMHl96its95Nd4cEFx4j+sFuRYob6D0kcemC7xEFuty7bdupda51Z56GYI1YjuUTryTlFOHZbOSThc2ZMzNC1gPG25bn2Lx6sDuPByk4KW4rQ2v7mSfeUuZZRdjtVSC0WV2M2Cv5L8eLFvZRgNYnXrUJYhnRpT+OBAvJZXaWU2nv/bNe/UQIDAQAB
# 回调地址
notifyUrl: http://118.178.137.129:8866/pay/aliPay/pay-notify
# 可设置AES密钥调用AES加解密相关接口时需要可选
encryptKey:
#ribbon:
# #建立连接超时时间
# ConnectTimeout: 50000

@ -142,3 +142,21 @@ roll:
accountSid: dbby_hangzhoubaiyehl
appId: app1
cdrUrl: https://baiyee.vip/api/roll/cdrUrl
alipay:
protocol: https
# 不需要加/gateway.do这是新旧SDK的区别切记
# gatewayHost: openapi.alipaydev.com
gatewayHost: openapi.alipay.com
signType: RSA2
# 填APPID
appId: 2021003125644167
# 填应用私钥注意是应用私钥不要填成公钥了_(:з」∠)_
merchantPrivateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCNIuelR5MHMY3vtl2KEgWUbhHMHuBwxHMVONuUYKlt4grOGJtaPKitgh9MxrvaxmAvH0LilQQKd5T07os9jC2XpNmH0BA6rNVNgBwjWNllqKo+jT8OiKvog9uBuZYfHdkLRhjObrTkSo97jO5Y32591GZHG+cQ/5bgMC0KXlQMOv5piLqUfKYDJ5pWBdS5gqcCkUABZsrW+C8nD7lvOuVglN1AGQiXQzj+Iu3K5xcUg+d3q0nWXhKPpotSolFGSakLEqUja/MnsILVHVw8MYMuq6LxzQ7DQ5fCzMPMIF5kYTynsAV5SoE90ilj1vmmI4aa7dc+9OmG/vXyFuoOEK1bAgMBAAECggEAH0K/9EfqNQmw2ouWJGLhgYLvxjqAk/mvU+AIItFWNdR/eC7TGiWdZvEPZb4PFeIio81Uz0MaZgceozHC/Zry7kfBNufK8HQfus7JbLrdTDsTmk9GzD1RdmreT9l/etztmiWokPDMeFRbe443rM+wdYZ6MP3pLEawcG+7SjSigSKrcpltAJ49NhHyfJxnnCye4mM8PevVGXe4nGv/vKJbAfzl5V8MsSY+SVktj6jOUTSa6nypISvQElyv8jeNH/bTDjg0DOHzL4tUHaVbTqHhtqbNo3n9VuKz4shVAp3I+9PpcTQTueTsM9L0Y+j84bV3VZlTIGGzDUD4qWDhUKPJ4QKBgQDQFNB2vLDJLeGfn+SnCncnr/wQo1xJez+deBqJXoDhDWDuZVcWNaEOWgfDronm8dIedWMYHD//WN0GtA5foAUdlaNq/jeKdJFgzJ/hoOtOveHY1OWqJHiJ/YMRBMuLn/E4Jit7q215JU6Jur1T+70HxrUFTQfY8GWdMvSDFHCKDwKBgQCto24hqgcEDKoR3/sm5sUKqYZTHLeQbniM0D5EcOkBNw7UXGYQSbz7mJ34XQKTfrOL71A+LkjxdMfs5q56yxeOQxR4EBO/Fpz8xPRlud5uIp4eTQVJ8I01meZyvojkF6mO5C4tbcXJOpnpU8ohoeTRu7th0oUYObGUYmn0qzuj9QKBgDCOOtsKSwKXF0hFanjkQ0vakCpdxIJNJVoclayqhc5+bbkTos/G8e9EaP1rtDhVA6Ah6l7M8M4oMWOIDraXw7nUmk60RcekTexVs5VWFLLKMnKDs5gRbKNeqgAFq23Ig+SDW7A/H4uefgY7skRvwPuYjdNP113zMvMM2evgkCZXAoGAP5przvz/EOaqrV2EG93QM3WhdHRCcS9mDP6CsINDdmR6lCM8Z577EJX4128KcIiqsAl7NSuzIG8MhKSDKQuXl07PAqOw+AAKhTSH6XNKHMGldaf01f69WvMCzOkqL5LTUzoWCCH7nxhOJH/CvMsWjBTeMJjyk8seVyIteaf3crkCgYEAmY8OC+Vdo/yop+ooedCnvBC7GVMfcqR6+rIQ+ZnKom7jhByIN6w7eEVAnmNa9dCv/pig7HaYbitWmCNf9tbqFfcdY6e5Svele3amgDM9iqtdJ9Rf1PpDPZw+gmjRIxGs6W8wnl1Sqvpk8pFUA/2xlT6sXpfxra9N09LS0ttU+cU=
# 填支付宝公钥,注意不是生成的应用公钥
aliPayPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyvegkGCrz1i5/K7VzQxvoZm4G73pSPNu9R5ET8YonIuDVoHkHaYvQQizLdRkTyBsYIik8FXsSDmVsw5MLMQ7OAlZ97nQBkz5TxOX6Px766nUpSVoWXoAz6cpIlWnwgir4t1ph88Ph56l+qmqW3gUj/U6MIuzjxBJlijTMHl96its95Nd4cEFx4j+sFuRYob6D0kcemC7xEFuty7bdupda51Z56GYI1YjuUTryTlFOHZbOSThc2ZMzNC1gPG25bn2Lx6sDuPByk4KW4rQ2v7mSfeUuZZRdjtVSC0WV2M2Cv5L8eLFvZRgNYnXrUJYhnRpT+OBAvJZXaWU2nv/bNe/UQIDAQAB
# 回调地址
notifyUrl: https://baiyee.vip/pay/aliPay/pay-notify
# 可设置AES密钥调用AES加解密相关接口时需要可选
encryptKey:

@ -73,7 +73,8 @@ sms:
signName: 百业互联科技
templateCode: SMS_232894146
#hutool雪花算法
snowflake:
workerId: 9
datacenterId: 9

@ -19,7 +19,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@ -14,7 +14,7 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://118.178.137.129:3306/ad-platform?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull
url: jdbc:mysql://118.178.137.129:3306/ad_platform?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull
username: root
password: root
# 初始连接数
@ -73,4 +73,4 @@ save:
corePoolSize: 2
maxPoolSize: 16
queueCapacity: 3
ThreadNamePrefix: SaveFileTaskExecutor-
ThreadNamePrefix: SaveFileTaskExecutor-

Loading…
Cancel
Save