上传文件至 src/main/java/co/jp/mamol/myapp/service
This commit is contained in:
20
src/main/java/co/jp/mamol/myapp/service/LoginService.java
Normal file
20
src/main/java/co/jp/mamol/myapp/service/LoginService.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package co.jp.mamol.myapp.service;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import co.jp.mamol.myapp.repository.UserRepository;
|
||||||
|
import co.jp.mamol.myapp.model.UserModel;
|
||||||
|
@Service
|
||||||
|
public class LoginService {
|
||||||
|
|
||||||
|
final UserRepository userRepository;
|
||||||
|
|
||||||
|
public LoginService(UserRepository userRepository) {
|
||||||
|
this.userRepository = userRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserModel findUser(String userid) {
|
||||||
|
|
||||||
|
return (UserModel) userRepository.findUserById(userid);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package co.jp.mamol.myapp.service;
|
||||||
|
|
||||||
|
import co.jp.mamol.myapp.model.DepartmentModel;
|
||||||
|
import co.jp.mamol.myapp.model.SizaiModel;
|
||||||
|
import co.jp.mamol.myapp.repository.OrderDeliverRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class OrderDeliverService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
OrderDeliverRepository orderDeliverRepository;
|
||||||
|
|
||||||
|
// BL 3001
|
||||||
|
public List<DepartmentModel> deptList(){
|
||||||
|
|
||||||
|
return orderDeliverRepository.deptList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// BL 3002
|
||||||
|
public List<SizaiModel> approvaleList(String deptId){
|
||||||
|
|
||||||
|
return orderDeliverRepository.approvaledList(deptId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// BL 3004
|
||||||
|
public boolean orderAct(int id){
|
||||||
|
|
||||||
|
return orderDeliverRepository.orderAct(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// BL 3003
|
||||||
|
public List<SizaiModel> orderedList(String deptId){
|
||||||
|
|
||||||
|
return orderDeliverRepository.orderedList(deptId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// BL 3005
|
||||||
|
public boolean deleverAct(int id){
|
||||||
|
|
||||||
|
return orderDeliverRepository.deleverAct(id);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package co.jp.mamol.myapp.service;
|
||||||
|
|
||||||
|
import co.jp.mamol.myapp.model.UserModel;
|
||||||
|
import co.jp.mamol.myapp.repository.UserRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PasswordMigrationService {
|
||||||
|
|
||||||
|
private final UserRepository userRepository;
|
||||||
|
private PasswordEncoder passwordEncoder;
|
||||||
|
|
||||||
|
|
||||||
|
public PasswordMigrationService(UserRepository userRepository) {
|
||||||
|
this.userRepository = userRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public PasswordMigrationService(UserRepository userRepository, PasswordEncoder passwordEncoder) {
|
||||||
|
|
||||||
|
this.userRepository = userRepository;
|
||||||
|
this.passwordEncoder = passwordEncoder;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void migrateExistingPasswords() {
|
||||||
|
|
||||||
|
System.out.println("PasswordMigrationService.migrateExistingPasswords");
|
||||||
|
List<UserModel> usersToMigrate = userRepository.findAllUsersForPasswordMigration();
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
if (usersToMigrate.isEmpty()) {
|
||||||
|
System.out.println("No users to migrate");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (UserModel user : usersToMigrate){
|
||||||
|
String plainPassword = user.getPassword();
|
||||||
|
|
||||||
|
if (plainPassword != null && !plainPassword.isEmpty()) {
|
||||||
|
|
||||||
|
if (plainPassword.length() == 60 && plainPassword.matches("^\\$2[aby]\\$\\d{2}\\$.*")) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
42
src/main/java/co/jp/mamol/myapp/service/StoreService.java
Normal file
42
src/main/java/co/jp/mamol/myapp/service/StoreService.java
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package co.jp.mamol.myapp.service;
|
||||||
|
|
||||||
|
import co.jp.mamol.myapp.model.SizaiModel;
|
||||||
|
import co.jp.mamol.myapp.model.SoukoModel;
|
||||||
|
import co.jp.mamol.myapp.repository.StoreRepository;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class StoreService {
|
||||||
|
|
||||||
|
final StoreRepository storeRepository;
|
||||||
|
|
||||||
|
public StoreService(StoreRepository storeRepository) {
|
||||||
|
this.storeRepository = storeRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
// BL 4001
|
||||||
|
public SizaiModel getSizaiById(int id) {
|
||||||
|
|
||||||
|
return storeRepository.getSizaiById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// BL 4002
|
||||||
|
public List<SoukoModel> getSoukoList() {
|
||||||
|
|
||||||
|
return storeRepository.getSoukoList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// BL 4003
|
||||||
|
public boolean inStoreAct(SizaiModel sizai){
|
||||||
|
|
||||||
|
return storeRepository.inStoreAct(sizai);
|
||||||
|
}
|
||||||
|
|
||||||
|
// BL 4004
|
||||||
|
public boolean outStoreAct(SizaiModel sizai){
|
||||||
|
|
||||||
|
return storeRepository.outStoreAct(sizai);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user