This commit is contained in:
Bunny 2024-01-05 10:17:38 +08:00
parent 71f2b5e30a
commit 42d05894fa
4 changed files with 26 additions and 13 deletions

View File

@ -122,6 +122,14 @@
<artifactId>wechatpay-apache-httpclient</artifactId> <artifactId>wechatpay-apache-httpclient</artifactId>
<version>0.4.8</version> <version>0.4.8</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.webjars.npm/spark-md5 -->
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>spark-md5</artifactId>
<version>3.0.0</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
</project> </project>

View File

@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -26,9 +27,9 @@ import java.util.Map;
@Slf4j @Slf4j
public class EmployeeController { public class EmployeeController {
@Autowired @Resource
private EmployeeService employeeService; private EmployeeService employeeService;
@Autowired @Resource
private JwtProperties jwtProperties; private JwtProperties jwtProperties;
/** /**

View File

@ -13,17 +13,19 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils; import org.springframework.util.DigestUtils;
import javax.annotation.Resource;
@Service @Service
public class EmployeeServiceImpl implements EmployeeService { public class EmployeeServiceImpl implements EmployeeService {
@Autowired @Resource
private EmployeeMapper employeeMapper; private EmployeeMapper employeeMapper;
/** /**
* 员工登录 * 员工登录
* *
* @param employeeLoginDTO * @param employeeLoginDTO 登录信息
* @return * @return Employee
*/ */
public Employee login(EmployeeLoginDTO employeeLoginDTO) { public Employee login(EmployeeLoginDTO employeeLoginDTO) {
String username = employeeLoginDTO.getUsername(); String username = employeeLoginDTO.getUsername();
@ -45,11 +47,13 @@ public class EmployeeServiceImpl implements EmployeeService {
throw new PasswordErrorException(MessageConstant.PASSWORD_ERROR); throw new PasswordErrorException(MessageConstant.PASSWORD_ERROR);
} }
if (employee.getStatus() == StatusConstant.DISABLE) {
// 账号被锁定 // 账号被锁定
if (employee.getStatus() == StatusConstant.DISABLE) {
throw new AccountLockedException(MessageConstant.ACCOUNT_LOCKED); throw new AccountLockedException(MessageConstant.ACCOUNT_LOCKED);
} }
// 3返回实体对象 // 3返回实体对象
return employee; return employee;
} }

View File

@ -1,8 +1,8 @@
sky: sky:
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
host: localhost host: 106.15.251.123
port: 3306 port: 3305
database: sky_take_out database: sky_take_out
username: root username: root
password: root password: "02120212"