于俊龙 2 周之前
父节点
当前提交
b8f7e49412
共有 37 个文件被更改,包括 1019 次插入727 次删除
  1. 0 7
      farm-common-biz/src/main/java/jp/yamoto/farm/common/biz/domain/bo/VerifyCodeParamBo.java
  2. 5 0
      farm-common/src/main/java/jp/yamoto/farm/common/constant/Constants.java
  3. 1 1
      farm-common/src/main/java/jp/yamoto/farm/common/core/controller/BaseController.java
  4. 127 0
      farm-common/src/main/java/jp/yamoto/farm/common/core/domain/entity/FarmerUserInfo.java
  5. 0 126
      farm-common/src/main/java/jp/yamoto/farm/common/core/domain/entity/MastNokaLoginInfo.java
  6. 3 40
      farm-common/src/main/java/jp/yamoto/farm/common/core/domain/model/LoginBody.java
  7. 53 6
      farm-common/src/main/java/jp/yamoto/farm/common/core/domain/model/LoginUser.java
  8. 46 0
      farm-common/src/main/java/jp/yamoto/farm/common/core/service/TokenService.java
  9. 10 0
      farm-common/src/main/java/jp/yamoto/farm/common/enums/AuthStatusEnum.java
  10. 1 1
      farm-common/src/main/java/jp/yamoto/farm/common/interceptor/mybatis/MyBatisInterceptor.java
  11. 14 0
      farm-common/src/main/java/jp/yamoto/farm/common/security/filter/JwtAuthenticationTokenFilter.java
  12. 35 49
      farm-common/src/main/java/jp/yamoto/farm/common/utils/DecryptUtils.java
  13. 1 1
      farm-common/src/main/java/jp/yamoto/farm/common/utils/SecurityUtils.java
  14. 25 0
      farm-crm-biz/src/main/java/jp/yamoto/farm/crm/biz/sys/domain/SysUserParam.java
  15. 1 1
      farm-crm-biz/src/main/java/jp/yamoto/farm/crm/biz/sys/security/UserDetailsServiceImpl.java
  16. 1 1
      farm-crm-biz/src/main/java/jp/yamoto/farm/crm/biz/sys/service/impl/SysRoleServiceImpl.java
  17. 2 6
      farm-crm/src/main/java/jp/yamoto/farm/crm/web/controller/system/SysLoginController.java
  18. 1 1
      farm-crm/src/main/java/jp/yamoto/farm/crm/web/controller/system/SysMenuController.java
  19. 55 63
      farm-crm/src/main/java/jp/yamoto/farm/crm/web/controller/system/SysProfileController.java
  20. 2 1
      farm-crm/src/main/java/jp/yamoto/farm/crm/web/controller/system/SysUserController.java
  21. 4 2
      farm-crm/src/main/resources/application.yml
  22. 6 0
      farm-sankin-biz/pom.xml
  23. 23 0
      farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/auth/domain/AuthResetPwdBo.java
  24. 23 0
      farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/auth/domain/AuthSecondVerifyBo.java
  25. 17 0
      farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/auth/domain/AuthSendVerifyCodeBo.java
  26. 0 112
      farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/auth/service/AuthLoginService.java
  27. 249 0
      farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/auth/service/AuthService.java
  28. 10 13
      farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/auth/service/UserDetailsServiceImpl.java
  29. 45 0
      farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/mapper/FarmerUserMapper.java
  30. 0 37
      farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/mapper/MastNokaMapper.java
  31. 0 28
      farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/service/IMastNokaService.java
  32. 0 52
      farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/service/impl/MastNokaServiceImpl.java
  33. 93 0
      farm-sankin-biz/src/main/resources/mapper/sankin/FarmerUserMapper.xml
  34. 0 52
      farm-sankin-biz/src/main/resources/mapper/sankin/MastNokaMapper.xml
  35. 49 17
      farm-sankin/src/main/java/jp/yamoto/farm/sankin/web/controller/AuthController.java
  36. 8 3
      farm-sankin/src/main/resources/application.yml
  37. 109 107
      farm-sankin/src/main/resources/i18n/messages.properties

+ 0 - 7
farm-common-biz/src/main/java/jp/yamoto/farm/common/biz/domain/bo/VerifyCodeParamBo.java

@@ -1,7 +0,0 @@
-package jp.yamoto.farm.common.biz.domain.bo;
-
-/**
- * ユーザー認証
- */
-public class VerifyCodeParamBo {
-}

+ 5 - 0
farm-common/src/main/java/jp/yamoto/farm/common/constant/Constants.java

@@ -111,6 +111,11 @@ public class Constants
     public static final String LOGIN_USER_KEY = "login_user_key";
 
     /**
+     * Login User Key
+     */
+    public static final String LOGIN_TEMP_USER_KEY = "login_temp_user_key";
+
+    /**
      * User Id
      */
     public static final String JWT_USERID = "userid";

+ 1 - 1
farm-common/src/main/java/jp/yamoto/farm/common/core/controller/BaseController.java

@@ -180,7 +180,7 @@ public class BaseController
     /**
      * ログインユーザIDの取得
      */
-    public Long getUserId()
+    public String getUserId()
     {
         return getLoginUser().getUserId();
     }

+ 127 - 0
farm-common/src/main/java/jp/yamoto/farm/common/core/domain/entity/FarmerUserInfo.java

@@ -0,0 +1,127 @@
+package jp.yamoto.farm.common.core.domain.entity;
+
+import jp.yamoto.farm.common.core.domain.BaseEntity;
+import lombok.Data;
+
+/**
+ * 農家マスタ
+ */
+@Data
+public class FarmerUserInfo extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * ID
+     */
+    private String id;
+
+    /**
+     * 農家ID
+     */
+    private String farmerId;
+
+    /**
+     * 農家名
+     */
+    private String farmerName;
+
+    /**
+     * 農家名(カナ)
+     */
+    private String farmerNameKn;
+
+    /**
+     * 電話番号
+     */
+    private String phoneNumber;
+
+    /**
+     * メールアドレス
+     */
+    private String mailAddress;
+    /**
+     * 郵便番号
+     */
+    private String postalCode;
+
+    /**
+     * 都道府県
+     */
+    private String prefecture;
+
+    /**
+     * 市区町村
+     */
+    private String city;
+
+    /**
+     * 町域・番地
+     */
+    private String townStreetArea;
+
+    /**
+     * ビル等
+     */
+    private String buildingEtc;
+
+    /**
+     * 住所
+     */
+    private String address;
+
+    /**
+     * 代表者名
+     */
+    private String representativeName;
+
+    /**
+     * 代表者名(カナ)
+     */
+    private String representativeNameKn;
+
+    /**
+     * 発行者
+     */
+    private String issuedBy;
+
+    /**
+     * 発行日
+     */
+    private String issuedDate;
+
+    /**
+     * ログイン回数
+     */
+    private Integer loginCnt;
+
+    /**
+     * らくうるカートID
+     */
+    private String rakuuruCartId;
+
+    /**
+     * らくうるカートパスワード
+     */
+    private String rakuuruCartPwd;
+
+    /**
+     * パスワード
+     */
+    private String userPassword;
+
+    /**
+     * 廃止フラグ(利用状態)
+     */
+    private Integer discontinuedFlg;
+
+    /**
+     * 廃止日
+     */
+    private String discontinuedDate;
+
+    /**
+     * リビジョン
+     */
+    private Integer version;
+}

+ 0 - 126
farm-common/src/main/java/jp/yamoto/farm/common/core/domain/entity/MastNokaLoginInfo.java

@@ -1,126 +0,0 @@
-package jp.yamoto.farm.common.core.domain.entity;
-
-import jp.yamoto.farm.common.core.domain.BaseEntity;
-
-/**
- * 農家マスタ
- */
-public class MastNokaLoginInfo extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    private Long nokaId;
-
-    /**
-     * 農家ID
-     */
-    private String nokaCd;
-
-    /**
-     * 農家名
-     */
-    private String nokaMei;
-
-    /**
-     * 農家名(カナ)
-     */
-    private String nokaMeiKn;
-
-    private String tenwabango;
-
-    private String mailAddress;
-
-    private String jukyo;
-
-    private Integer version;
-
-    /**
-     * パスワード
-     */
-    private String userPwd;
-
-    /**
-     * ステータス
-     */
-    private Integer status;
-
-    public Long getNokaId() {
-        return nokaId;
-    }
-
-    public void setNokaId(Long nokaId) {
-        this.nokaId = nokaId;
-    }
-
-    public String getNokaCd() {
-        return nokaCd;
-    }
-
-    public void setNokaCd(String nokaCd) {
-        this.nokaCd = nokaCd;
-    }
-
-    public String getNokaMei() {
-        return nokaMei;
-    }
-
-    public void setNokaMei(String nokaMei) {
-        this.nokaMei = nokaMei;
-    }
-
-    public String getNokaMeiKn() {
-        return nokaMeiKn;
-    }
-
-    public void setNokaMeiKn(String nokaMeiKn) {
-        this.nokaMeiKn = nokaMeiKn;
-    }
-
-    public String getUserPwd() {
-        return userPwd;
-    }
-
-    public void setUserPwd(String userPwd) {
-        this.userPwd = userPwd;
-    }
-
-    public Integer getStatus() {
-        return status;
-    }
-
-    public void setStatus(Integer status) {
-        this.status = status;
-    }
-
-    public String getTenwabango() {
-        return tenwabango;
-    }
-
-    public void setTenwabango(String tenwabango) {
-        this.tenwabango = tenwabango;
-    }
-
-    public String getMailAddress() {
-        return mailAddress;
-    }
-
-    public void setMailAddress(String mailAddress) {
-        this.mailAddress = mailAddress;
-    }
-
-    public String getJukyo() {
-        return jukyo;
-    }
-
-    public void setJukyo(String jukyo) {
-        this.jukyo = jukyo;
-    }
-
-    public Integer getVersion() {
-        return version;
-    }
-
-    public void setVersion(Integer version) {
-        this.version = version;
-    }
-}

+ 3 - 40
farm-common/src/main/java/jp/yamoto/farm/common/core/domain/model/LoginBody.java

@@ -1,10 +1,13 @@
 package jp.yamoto.farm.common.core.domain.model;
 
+import lombok.Data;
+
 /**
  * ユーザーログインオブジェクト
  * 
  * @author nextosd
  */
+@Data
 public class LoginBody
 {
     /**
@@ -26,44 +29,4 @@ public class LoginBody
      * UUID
      */
     private String uuid;
-
-    public String getUsername()
-    {
-        return username;
-    }
-
-    public void setUsername(String username)
-    {
-        this.username = username;
-    }
-
-    public String getPassword()
-    {
-        return password;
-    }
-
-    public void setPassword(String password)
-    {
-        this.password = password;
-    }
-
-    public String getCode()
-    {
-        return code;
-    }
-
-    public void setCode(String code)
-    {
-        this.code = code;
-    }
-
-    public String getUuid()
-    {
-        return uuid;
-    }
-
-    public void setUuid(String uuid)
-    {
-        this.uuid = uuid;
-    }
 }

+ 53 - 6
farm-common/src/main/java/jp/yamoto/farm/common/core/domain/model/LoginUser.java

@@ -1,8 +1,7 @@
 package jp.yamoto.farm.common.core.domain.model;
 
 import com.alibaba.fastjson2.annotation.JSONField;
-import jp.yamoto.farm.common.core.domain.entity.MastNokaLoginInfo;
-import jp.yamoto.farm.common.core.domain.entity.SysUser;
+import jp.yamoto.farm.common.enums.AuthStatusEnum;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.userdetails.UserDetails;
 import java.util.Collection;
@@ -20,7 +19,7 @@ public class LoginUser<T> implements UserDetails
     /**
      * User Id
      */
-    private Long userId;
+    private String userId;
 
     private String userCode;
 
@@ -29,6 +28,21 @@ public class LoginUser<T> implements UserDetails
     private String password;
 
     /**
+     * 二次認証が必要かどうか
+     */
+    private Boolean isSecondAuth;
+
+    /**
+     * 一時トークン、二次認証時に使用
+     */
+    private String tempToken;
+
+    /**
+     * 認証ステータス
+     */
+    private AuthStatusEnum authStatus;
+
+    /**
      * Token
      */
     private String token;
@@ -77,8 +91,9 @@ public class LoginUser<T> implements UserDetails
     {
     }
 
-    public LoginUser(Long userId, String userCode, String username, String password,  T user, Set<String> permissions)
+    public LoginUser(Boolean isSecondAuth, String userId, String userCode, String username, String password,  T user, Set<String> permissions)
     {
+        this.isSecondAuth = isSecondAuth;
         this.userId = userId;
         this.userCode = userCode;
         this.username = username;
@@ -87,12 +102,12 @@ public class LoginUser<T> implements UserDetails
         this.permissions = permissions;
     }
 
-    public Long getUserId()
+    public String getUserId()
     {
         return userId;
     }
 
-    public void setUserId(Long userId)
+    public void setUserId(String userId)
     {
         this.userId = userId;
     }
@@ -236,6 +251,38 @@ public class LoginUser<T> implements UserDetails
         this.user = user;
     }
 
+    public String getTempToken() {
+        return tempToken;
+    }
+
+    public void setTempToken(String tempToken) {
+        this.tempToken = tempToken;
+    }
+
+    public AuthStatusEnum getAuthStatus() {
+        return authStatus;
+    }
+
+    public void setAuthStatus(AuthStatusEnum authStatus) {
+        this.authStatus = authStatus;
+    }
+
+    public Boolean getSecondAuth() {
+        return isSecondAuth;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public void setSecondAuth(Boolean secondAuth) {
+        isSecondAuth = secondAuth;
+    }
+
     @Override
     public Collection<? extends GrantedAuthority> getAuthorities()
     {

+ 46 - 0
farm-common/src/main/java/jp/yamoto/farm/common/core/service/TokenService.java

@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
@@ -47,6 +48,9 @@ public class TokenService
     @Value("${token.expireTime}")
     private int expireTime;
 
+    @Value("${token.tempExpireTime}")
+    private long tokenTempExpireTime = 10;
+
     /**
      * トークンの自動更新トークン有効時間(分)
      */
@@ -203,6 +207,48 @@ public class TokenService
     }
 
     /**
+     * トークンの作成
+     *
+     * @param loginUser ユーザー情報
+     * @return トークン
+     */
+    public String createTempToken(LoginUser loginUser)
+    {
+        String token = generateToken(loginUser.getUsername(), tokenTempExpireTime);
+        loginUser.setTempToken(token);
+        setUserAgent(loginUser);
+
+        return token;
+    }
+
+    /**
+     * 一時的トークンを生成するには
+     * @param username
+     * @param expireTime
+     * @return
+     */
+    private String generateToken(String username, long expireTime) {
+        Date now = new Date();
+        Date expiryDate = new Date(now.getTime() + expireTime * MILLIS_MINUTE);
+
+        return Jwts.builder()
+                .setSubject(username)
+                .setIssuedAt(now)
+                .setExpiration(expiryDate)
+                .signWith(SignatureAlgorithm.HS512, secret)
+                .compact();
+    }
+
+    public boolean validateToken(String token) {
+        try {
+            Jwts.parser().setSigningKey(secret).parseClaimsJws(token);
+            return true;
+        } catch (Exception e) {
+            return false;
+        }
+    }
+
+    /**
      * トークンからのユーザー名の取得
      *
      * @param token トークン

+ 10 - 0
farm-common/src/main/java/jp/yamoto/farm/common/enums/AuthStatusEnum.java

@@ -0,0 +1,10 @@
+package jp.yamoto.farm.common.enums;
+
+/**
+ * 二次認証
+ */
+public enum AuthStatusEnum {
+    PENDING_FIRST_FACTOR,    // 一次認証
+    PENDING_SECOND_FACTOR,   // 二次認証
+    COMPLETED                // 認証完了
+}

+ 1 - 1
farm-common/src/main/java/jp/yamoto/farm/common/interceptor/mybatis/MyBatisInterceptor.java

@@ -146,7 +146,7 @@ public class MyBatisInterceptor implements Interceptor {
             if (principal != null && principal instanceof LoginUser) {
                 LoginUser loginUser = (LoginUser) authentication.getPrincipal();
                 if (loginUser != null) {
-                    loginUserId = loginUser.getUserId().toString();
+                    loginUserId = loginUser.getUserId();
                 }
             }
             return loginUserId;

+ 14 - 0
farm-common/src/main/java/jp/yamoto/farm/common/security/filter/JwtAuthenticationTokenFilter.java

@@ -1,11 +1,16 @@
 package jp.yamoto.farm.common.security.filter;
 
+import com.alibaba.fastjson2.JSON;
 import jakarta.servlet.FilterChain;
 import jakarta.servlet.ServletException;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
+import jp.yamoto.farm.common.constant.HttpStatus;
+import jp.yamoto.farm.common.core.domain.AjaxResult;
 import jp.yamoto.farm.common.core.domain.model.LoginUser;
+import jp.yamoto.farm.common.enums.AuthStatusEnum;
 import jp.yamoto.farm.common.utils.SecurityUtils;
+import jp.yamoto.farm.common.utils.ServletUtils;
 import jp.yamoto.farm.common.utils.StringUtils;
 import jp.yamoto.farm.common.core.service.TokenService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -36,6 +41,15 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
         if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication()))
         {
             tokenService.verifyToken(loginUser);
+
+            // 二次認証
+            if (loginUser.getSecondAuth() == true && loginUser.getAuthStatus() != AuthStatusEnum.COMPLETED) {
+                int code = HttpStatus.UNAUTHORIZED;
+                String msg = StringUtils.format("リクエストアクセス:{}、認証に失敗しました、システムリソースにアクセスできません", request.getRequestURI());
+                ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg)));
+                return;
+            }
+
             UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities());
             authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
             SecurityContextHolder.getContext().setAuthentication(authenticationToken);

+ 35 - 49
farm-common/src/main/java/jp/yamoto/farm/common/utils/DecryptUtils.java

@@ -28,25 +28,17 @@ public class DecryptUtils {
      * AES 暗号化
      */
     public static String encryptAES(String data) throws Exception {
-        String key = AppConfig.getDecryptFieldKey();
-        byte[] keyBytes = Base64.getDecoder().decode(key);
-        SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, AES_ALGORITHM);
+        byte[] keyBytes = hexStringToByteArray(AppConfig.getDecryptFieldKey());
+        byte[] ivBytes = hexStringToByteArray(AppConfig.getDecryptFieldIv());
 
-        byte[] iv = new byte[16];
-        SecureRandom secureRandom = new SecureRandom();
-        secureRandom.nextBytes(iv);
-        IvParameterSpec ivSpec = new IvParameterSpec(iv);
+        SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, AES_ALGORITHM);
+        IvParameterSpec ivParameterSpec = new IvParameterSpec(ivBytes);
 
         Cipher cipher = Cipher.getInstance(AES_CBC_PKCS5_PADDING);
-        cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivSpec);
+        cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec);
 
         byte[] encrypted = cipher.doFinal(data.getBytes(Constants.UTF8));
-
-        byte[] combined = new byte[iv.length + encrypted.length];
-        System.arraycopy(iv, 0, combined, 0, iv.length);
-        System.arraycopy(encrypted, 0, combined, iv.length, encrypted.length);
-
-        return Base64.getEncoder().encodeToString(combined);
+        return Base64.getEncoder().encodeToString(encrypted);
     }
 
     /**
@@ -54,21 +46,17 @@ public class DecryptUtils {
      *
      */
     public static String decryptAES(String encryptedData) throws Exception {
-        String key = AppConfig.getDecryptFieldKey();
-        byte[] combined = Base64.getDecoder().decode(encryptedData);
-        byte[] keyBytes = Base64.getDecoder().decode(key);
-        SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, AES_ALGORITHM);
+        byte[] keyBytes = hexStringToByteArray(AppConfig.getDecryptFieldKey());
+        byte[] ivBytes = hexStringToByteArray(AppConfig.getDecryptFieldIv());
 
-        byte[] iv = new byte[16];
-        byte[] encrypted = new byte[combined.length - 16];
-        System.arraycopy(combined, 0, iv, 0, 16);
-        System.arraycopy(combined, 16, encrypted, 0, encrypted.length);
+        SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, AES_ALGORITHM);
+        IvParameterSpec ivParameterSpec = new IvParameterSpec(ivBytes);
 
-        IvParameterSpec ivSpec = new IvParameterSpec(iv);
         Cipher cipher = Cipher.getInstance(AES_CBC_PKCS5_PADDING);
-        cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivSpec);
+        cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec);
 
-        byte[] decrypted = cipher.doFinal(encrypted);
+        byte[] encryptedBytes = Base64.getDecoder().decode(encryptedData);
+        byte[] decrypted = cipher.doFinal(encryptedBytes);
         return new String(decrypted, Constants.UTF8);
     }
 
@@ -86,37 +74,13 @@ public class DecryptUtils {
      * 注意:復号中に例外が発生した場合、スタックトレースを出力し、空文字列を返します。
      */
     public static String decryptField(String encryptedText) {
-        //return encryptedText;
         try {
             if (StringUtils.isEmpty(encryptedText)) {
                 return encryptedText;
             }
 
-//            // URLセーフなBase64エンコードを標準Base64エンコードに変換
-//            String base64Encoded = encryptedText.replace('-', '+').replace('_', '/');
-//            // Base64エンコードの長さを4の倍数にパディング
-//            while (base64Encoded.length() % 4 != 0) {
-//                base64Encoded += "=";
-//            }
-
             return decryptAES(encryptedText);
 
-//
-//            // Base64文字列をデコード
-//            byte[] encryptedBytes = Base64.getDecoder().decode(base64Encoded);
-//            // バイト配列を文字列に変換
-//            String encryptedString = new String(encryptedBytes);
-//
-//            // AES復号器を初期化
-//            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
-//            SecretKeySpec secretKeySpec = new SecretKeySpec(AppConfig.getDecryptFieldKey().getBytes(), "AES");
-//            IvParameterSpec ivParameterSpec = new IvParameterSpec(AppConfig.getDecryptFieldIv().getBytes());
-//
-//            cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec);
-//
-//            // 復号
-//            byte[] decryptedBytes = cipher.doFinal(Base64.getDecoder().decode(encryptedString));
-//            return new String(decryptedBytes);
         } catch (Exception e) {
             // 例外が発生した場合、スタックトレースを出力し、空文字列を返す
             e.printStackTrace();
@@ -124,4 +88,26 @@ public class DecryptUtils {
             return encryptedText;
         }
     }
+
+    public static byte[] hexStringToByteArray(String hexString) {
+        int len = hexString.length();
+        byte[] data = new byte[len / 2];
+        for (int i = 0; i < len; i += 2) {
+            data[i / 2] = (byte) ((Character.digit(hexString.charAt(i), 16) << 4)
+                    + Character.digit(hexString.charAt(i + 1), 16));
+        }
+        return data;
+    }
+
+    public static void main(String[] args){
+        String s = "59KDbersTvuTdyh8uklt158e9utyh9s7";
+        String iv = "q3KanypB7RB5Rqom32tdzyaecgeq938u";
+        byte[] bytes = hexStringToByteArray(s);
+       // byte[] bytes = s.getBytes(java.nio.charset.StandardCharsets.UTF_8);
+        System.out.println(bytes.length);
+
+        byte[] ivbytes = hexStringToByteArray(iv);
+        System.out.println(ivbytes.length);
+
+    }
 }

+ 1 - 1
farm-common/src/main/java/jp/yamoto/farm/common/utils/SecurityUtils.java

@@ -25,7 +25,7 @@ public class SecurityUtils
     /**
      * User ID
      **/
-    public static Long getUserId()
+    public static String getUserId()
     {
         try
         {

+ 25 - 0
farm-crm-biz/src/main/java/jp/yamoto/farm/crm/biz/sys/domain/SysUserParam.java

@@ -0,0 +1,25 @@
+package jp.yamoto.farm.crm.biz.sys.domain;
+
+import jp.yamoto.farm.common.annotation.DecryptField;
+import lombok.Data;
+
+/**
+ * ユーザーオブジェクト sys_user
+ *
+ * @author nextosd
+ */
+@Data
+public class SysUserParam {
+
+    /**
+     * ユーザーの古いパスワード
+     */
+    @DecryptField
+    private String oldPassword;
+    /**
+     * ユーザーの新パスワード
+     */
+    @DecryptField
+    private String newPassword;
+
+}

+ 1 - 1
farm-crm-biz/src/main/java/jp/yamoto/farm/crm/biz/sys/security/UserDetailsServiceImpl.java

@@ -63,6 +63,6 @@ public class UserDetailsServiceImpl implements UserDetailsService
 
     public UserDetails createLoginUser(SysUser user)
     {
-        return new LoginUser<SysUser>(user.getUserId(), user.getUserName(), user.getNickName(), user.getPassword(), user, permissionService.getMenuPermission(user));
+        return new LoginUser<SysUser>(false, ConvertUtils.toStr(user.getUserId()), user.getUserName(), user.getNickName(), user.getPassword(), user, permissionService.getMenuPermission(user));
     }
 }

+ 1 - 1
farm-crm-biz/src/main/java/jp/yamoto/farm/crm/biz/sys/service/impl/SysRoleServiceImpl.java

@@ -191,7 +191,7 @@ public class SysRoleServiceImpl implements ISysRoleService
     @Override
     public void checkRoleDataScope(Long... roleIds)
     {
-        if (!SysUser.isAdmin(SecurityUtils.getUserId()))
+        if (!SysUser.isAdmin(ConvertUtils.toLong(SecurityUtils.getUserId())))
         {
             for (Long roleId : roleIds)
             {

+ 2 - 6
farm-crm/src/main/java/jp/yamoto/farm/crm/web/controller/system/SysLoginController.java

@@ -38,9 +38,6 @@ public class SysLoginController
     @Autowired
     private SysPermissionService permissionService;
 
-    @Autowired
-    private TokenService tokenService;
-
     /**
      * ログイン
      * 
@@ -48,8 +45,7 @@ public class SysLoginController
      * @return 結果
      */
     @PostMapping("/login")
-    public AjaxResult login(@RequestBody LoginBody loginBody)
-    {
+    public AjaxResult login(@RequestBody LoginBody loginBody){
         // Token
         String token = loginService.login(loginBody.getUsername(), loginBody.getPassword());
         return AjaxResult.success(ValueUtils.newMap(Constants.TOKEN, token));
@@ -129,7 +125,7 @@ public class SysLoginController
     @GetMapping("/route")
     public AjaxResult getRouters()
     {
-        Long userId = SecurityUtils.getUserId();
+        Long userId = ConvertUtils.toLong(SecurityUtils.getUserId());
         List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
         return AjaxResult.success(menuService.buildMenus(menus));
     }

+ 1 - 1
farm-crm/src/main/java/jp/yamoto/farm/crm/web/controller/system/SysMenuController.java

@@ -40,7 +40,7 @@ public class SysMenuController extends BaseController {
     @PreAuthorize("@ss.hasPermi('system:menu:list')")
     @GetMapping("/list")
     public AjaxResult list(SysMenu menu) {
-        List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
+        List<SysMenu> menus = menuService.selectMenuList(menu, ConvertUtils.toLong(getUserId()));
         return success(menus);
     }
 

+ 55 - 63
farm-crm/src/main/java/jp/yamoto/farm/crm/web/controller/system/SysProfileController.java

@@ -12,8 +12,11 @@ import jp.yamoto.farm.common.utils.SecurityUtils;
 import jp.yamoto.farm.common.utils.StringUtils;
 import jp.yamoto.farm.common.utils.file.FileUploadUtils;
 import jp.yamoto.farm.common.utils.file.MimeTypeUtils;
+import jp.yamoto.farm.common.validator.utils.ValidatorGroup;
+import jp.yamoto.farm.crm.biz.sys.domain.SysUserParam;
 import jp.yamoto.farm.crm.biz.sys.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
@@ -24,14 +27,14 @@ import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
 /**
- * 个人信息 业务处理
- * 
+ * ユーザー情報 コントロール
+ *
  * @author nextosd
  */
 @RestController
 @RequestMapping("/api/system/user/profile")
-public class SysProfileController extends BaseController
-{
+public class SysProfileController extends BaseController {
+
     @Autowired
     private ISysUserService userService;
 
@@ -39,98 +42,87 @@ public class SysProfileController extends BaseController
     private TokenService tokenService;
 
     /**
-     * 个人信息
+     * ユーザー情報
      */
     @GetMapping
-    public AjaxResult profile()
-    {
-        LoginUser<SysUser> loginUser = getLoginUser();
-        SysUser user = loginUser.getUser();
+    public AjaxResult profile() {
+        LoginUser loginUser = getLoginUser();
+        SysUser user = userService.selectUserByUserName(loginUser.getUsername());
         AjaxResult ajax = AjaxResult.success(user);
-        ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
         return ajax;
     }
 
     /**
-     * 修改用户
+     * ユーザー情報を更新
      */
-    @Log(title = "个人信息", businessType = BusinessType.UPDATE)
+    @Log(title = "ユーザー情報", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult updateProfile(@RequestBody SysUser user)
-    {
+    public AjaxResult updateProfile(@Validated({ValidatorGroup.UpdateGroup.class}) @RequestBody SysUser user) {
         LoginUser<SysUser> loginUser = getLoginUser();
         SysUser currentUser = loginUser.getUser();
         currentUser.setNickName(user.getNickName());
-        currentUser.setEmail(user.getEmail());
-        currentUser.setPhonenumber(user.getPhonenumber());
-        currentUser.setSex(user.getSex());
-        if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
-        {
-            return error("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在");
-        }
-        if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
-        {
-            return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在");
-        }
-        if (userService.updateUserProfile(currentUser) > 0)
-        {
-            // 更新缓存用户信息
+        currentUser.setVersion(null);
+
+        int result = userService.updateUserProfile(currentUser);
+        if (result > 0) {
+            // キャッシュのユーザー情報を更新
+            loginUser.setUser(userService.selectUserByUserName(loginUser.getUsername()));
             tokenService.setLoginUser(loginUser);
-            return success();
         }
-        return error("修改个人信息异常,请联系管理员");
+        return success();
     }
 
     /**
-     * 重置密码
+     * パスワードをリセット
      */
-    @Log(title = "个人信息", businessType = BusinessType.UPDATE)
-    @PutMapping("/updatePwd")
-    public AjaxResult updatePwd(String oldPassword, String newPassword)
-    {
+    @Log(title = "ユーザー情報", businessType = BusinessType.UPDATE)
+    @PostMapping("/updatePwd")
+    public AjaxResult updatePwd(SysUserParam sysUserParam) {
+        String oldPassword = sysUserParam.getOldPassword();
+        String newPassword = sysUserParam.getNewPassword();
+
         LoginUser<SysUser> loginUser = getLoginUser();
-        String userName = loginUser.getUsername();
-        String password = loginUser.getPassword();
-        if (!SecurityUtils.matchesPassword(oldPassword, password))
-        {
-            return error("修改密码失败,旧密码错误");
+        SysUser user = userService.selectUserByUserName(loginUser.getUser().getUserName());
+        String userName = user.getUserName();
+        String password = user.getPassword();
+        if (!SecurityUtils.matchesPassword(oldPassword, password)) {
+            return error("パスワードの変更に失敗しました: 古いパスワードが間違っています。");
         }
-        if (SecurityUtils.matchesPassword(newPassword, password))
-        {
-            return error("新密码不能与旧密码相同");
+        if (SecurityUtils.matchesPassword(newPassword, password)) {
+            return error("新しいパスワードは古いパスワードと異なる必要があります。");
         }
         newPassword = SecurityUtils.encryptPassword(newPassword);
-        if (userService.resetUserPwd(userName, newPassword) > 0)
-        {
-            // 更新缓存用户密码
+        if (userService.resetUserPwd(userName, newPassword) > 0) {
+            // キャッシュのユーザーのパスワードを更新
             loginUser.getUser().setPassword(newPassword);
             tokenService.setLoginUser(loginUser);
             return success();
         }
-        return error("修改密码异常,请联系管理员");
+        return error("パスワードの変更中に異常が発生しました。管理者に連絡してください。");
     }
 
     /**
-     * 头像上传
+     * アバターをアップロード
      */
-    @Log(title = "用户头像", businessType = BusinessType.UPDATE)
+    @Log(title = "ユーザーのアバター", businessType = BusinessType.UPDATE)
     @PostMapping("/avatar")
-    public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
-    {
-        if (!file.isEmpty())
-        {
+    public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) {
+        if (!file.isEmpty()) {
             LoginUser<SysUser> loginUser = getLoginUser();
-            String avatar = FileUploadUtils.upload(AppConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
-            if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
-            {
-                AjaxResult ajax = AjaxResult.success();
-                ajax.put("imgUrl", avatar);
-                // 更新缓存用户头像
-                loginUser.getUser().setAvatar(avatar);
-                tokenService.setLoginUser(loginUser);
-                return ajax;
+            try {
+                String avatar = FileUploadUtils.upload(AppConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
+                if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) {
+                    AjaxResult ajax = AjaxResult.success();
+                    ajax.put("imgUrl", avatar);
+                    // キャッシュのユーザーのアバターを更新
+                    loginUser.getUser().setAvatar(avatar);
+                    tokenService.setLoginUser(loginUser);
+                    return ajax;
+                }
+            } catch (Exception ex) {
+                return AjaxResult.error("画像のアップロード中に異常が発生しました。管理者に連絡してください");
             }
         }
-        return error("上传图片异常,请联系管理员");
+        return AjaxResult.error("画像のアップロード中に異常が発生しました。管理者に連絡してください");
     }
 }

+ 2 - 1
farm-crm/src/main/java/jp/yamoto/farm/crm/web/controller/system/SysUserController.java

@@ -10,6 +10,7 @@ import jp.yamoto.farm.common.core.domain.entity.SysRole;
 import jp.yamoto.farm.common.core.domain.entity.SysUser;
 import jp.yamoto.farm.common.core.page.TableDataInfo;
 import jp.yamoto.farm.common.enums.BusinessType;
+import jp.yamoto.farm.common.utils.ConvertUtils;
 import jp.yamoto.farm.common.utils.SecurityUtils;
 import jp.yamoto.farm.common.utils.StringUtils;
 import jp.yamoto.farm.common.utils.poi.ExcelUtil;
@@ -167,7 +168,7 @@ public class SysUserController extends BaseController
     @DeleteMapping("/{userIds}")
     public AjaxResult remove(@PathVariable Long[] userIds)
     {
-        if (ArrayUtils.contains(userIds, getUserId()))
+        if (ArrayUtils.contains(userIds, ConvertUtils.toLong(getUserId())))
         {
             return error("現在のユーザーは削除できません");
         }

+ 4 - 2
farm-crm/src/main/resources/application.yml

@@ -15,9 +15,9 @@ farm:
   # 検証コードタイプmath数値計算char文字検証
   captchaType: math
   # 暗号化に使用する秘密鍵(16バイト)
-  decryptFieldKey: 59KDbersTvuTdyh3
+  decryptFieldKey: 59KDbersTvuTdyh8uklt158e9utyh9s7
   # 初期化ベクトル(IV、16バイト)
-  decryptFieldIv: q3KanypB7RB5Rqom
+  decryptFieldIv: q3KanypB7RB5Rqom32tdzyaecgeq938u
   # ホワイトURLリスト
   whiteUrlList:
     - /crm/organization/**
@@ -135,6 +135,8 @@ token:
   secret: abcde13455654rstabtcaste
   # トークン有効期間(デフォルト120分)
   expireTime: 120
+  # 一時的トークン有効期間(デフォルト10分)
+  tempExpireTime: 10
   # トークン自動更新有効期限
   automaticRenewalTokenMin: 30
 

+ 6 - 0
farm-sankin-biz/pom.xml

@@ -23,6 +23,12 @@
             <artifactId>farm-common-biz</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 23 - 0
farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/auth/domain/AuthResetPwdBo.java

@@ -0,0 +1,23 @@
+package jp.yamoto.farm.sankin.biz.auth.domain;
+
+import jp.yamoto.farm.common.validator.annotation.LmNotBlank;
+import lombok.Data;
+
+/**
+ * パスワード再設定
+ */
+@Data
+public class AuthResetPwdBo {
+
+    /**
+     * 新しいパスワード
+     */
+    @LmNotBlank(params = {"{newPassword}"})
+    private String newPassword;
+
+    /**
+     * 新しいパスワード(確認用)
+     */
+    @LmNotBlank(params = {"{confimPassword}"})
+    private String confimPassword;
+}

+ 23 - 0
farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/auth/domain/AuthSecondVerifyBo.java

@@ -0,0 +1,23 @@
+package jp.yamoto.farm.sankin.biz.auth.domain;
+
+import jp.yamoto.farm.common.validator.annotation.LmNotBlank;
+import lombok.Data;
+
+/**
+ * 二次認証
+ */
+@Data
+public class AuthSecondVerifyBo {
+
+    /**
+     *
+     */
+    @LmNotBlank(params = {"{tempToken}"})
+    private String tempToken;
+
+    /**
+     * 認証コード
+     */
+    @LmNotBlank(params = {"{verifyCode}"})
+    private String verifyCode;
+}

+ 17 - 0
farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/auth/domain/AuthSendVerifyCodeBo.java

@@ -0,0 +1,17 @@
+package jp.yamoto.farm.sankin.biz.auth.domain;
+
+import jp.yamoto.farm.common.validator.annotation.LmNotBlank;
+import lombok.Data;
+
+/**
+ * 認証コードを送信
+ */
+@Data
+public class AuthSendVerifyCodeBo {
+
+    /**
+     * メールアドレス
+     */
+    @LmNotBlank(params = {"{mailAddress}"})
+    private String mailAddress;
+}

+ 0 - 112
farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/auth/service/AuthLoginService.java

@@ -1,112 +0,0 @@
-package jp.yamoto.farm.sankin.biz.auth.service;
-
-import jakarta.annotation.Resource;
-import jp.yamoto.farm.common.config.AppConfig;
-import jp.yamoto.farm.common.constant.Constants;
-import jp.yamoto.farm.common.constant.UserConstants;
-import jp.yamoto.farm.common.core.domain.model.LoginUser;
-import jp.yamoto.farm.common.core.service.TokenService;
-import jp.yamoto.farm.common.exception.ServiceException;
-import jp.yamoto.farm.common.exception.user.UserNotExistsException;
-import jp.yamoto.farm.common.exception.user.UserPasswordNotMatchException;
-import jp.yamoto.farm.common.manager.AsyncManager;
-import jp.yamoto.farm.common.manager.factory.AsyncFactory;
-import jp.yamoto.farm.common.security.context.AuthenticationContextHolder;
-import jp.yamoto.farm.common.utils.MessageUtils;
-import jp.yamoto.farm.common.utils.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.authentication.BadCredentialsException;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.stereotype.Component;
-
-/**
- * 農家 ログイン検証方法
- * 
- * @author nextosd
- */
-@Component
-public class AuthLoginService
-{
-    @Autowired
-    private TokenService tokenService;
-
-    @Resource
-    private AuthenticationManager authenticationManager;
-
-    @Autowired
-    private AppConfig appConfig;
-
-    /**
-     * ログイン検証
-     * 
-     * @param username ユーザー名
-     * @param password パスワード
-     * @return
-     */
-    public String login(String username, String password)
-    {
-        // ログイン前チェック
-        loginPreCheck(username, password);
-        // ユーザー認証
-        Authentication authentication = null;
-        try
-        {
-            UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
-            AuthenticationContextHolder.setContext(authenticationToken);
-            authentication = authenticationManager.authenticate(authenticationToken);
-        }
-        catch (Exception e)
-        {
-            if (e instanceof BadCredentialsException)
-            {
-                AsyncManager.me().execute(AsyncFactory.recordLogininfor(appConfig.getName(), username, Constants.LOGIN_FAIL, MessageUtils.message("E0004")));
-                throw new UserPasswordNotMatchException();
-            }
-            else
-            {
-                AsyncManager.me().execute(AsyncFactory.recordLogininfor(appConfig.getName(), username, Constants.LOGIN_FAIL, e.getMessage()));
-                throw new ServiceException(e.getMessage());
-            }
-        }
-        finally
-        {
-            AuthenticationContextHolder.clearContext();
-        }
-        AsyncManager.me().execute(AsyncFactory.recordLogininfor(appConfig.getName(), username, Constants.LOGIN_SUCCESS, MessageUtils.message("I0008")));
-        LoginUser loginUser = (LoginUser) authentication.getPrincipal();
-
-        // token
-        return tokenService.createToken(loginUser);
-    }
-
-    /**
-     * ログイン前チェック
-     * @param username ユーザー名
-     * @param password ユーザーパスワード
-     */
-    public void loginPreCheck(String username, String password)
-    {
-        // ユーザー名またはパスワードがNULLのエラー
-        if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password))
-        {
-            AsyncManager.me().execute(AsyncFactory.recordLogininfor(appConfig.getName(), username, Constants.LOGIN_FAIL, MessageUtils.message("E0052")));
-            throw new UserNotExistsException();
-        }
-        // パスワードが指定された範囲内でなければエラー
-        if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
-                || password.length() > UserConstants.PASSWORD_MAX_LENGTH)
-        {
-            AsyncManager.me().execute(AsyncFactory.recordLogininfor(appConfig.getName(), username, Constants.LOGIN_FAIL, MessageUtils.message("E0004")));
-            throw new UserPasswordNotMatchException();
-        }
-        // ユーザー名が指定された範囲外のエラー
-        if (username.length() < UserConstants.USERNAME_MIN_LENGTH
-                || username.length() > UserConstants.USERNAME_MAX_LENGTH)
-        {
-            AsyncManager.me().execute(AsyncFactory.recordLogininfor(appConfig.getName(), username, Constants.LOGIN_FAIL, MessageUtils.message("E0004")));
-            throw new UserPasswordNotMatchException();
-        }
-    }
-}

+ 249 - 0
farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/auth/service/AuthService.java

@@ -0,0 +1,249 @@
+package jp.yamoto.farm.sankin.biz.auth.service;
+
+import jakarta.annotation.Resource;
+import jp.yamoto.farm.common.config.AppConfig;
+import jp.yamoto.farm.common.constant.Constants;
+import jp.yamoto.farm.common.constant.UserConstants;
+import jp.yamoto.farm.common.core.domain.entity.FarmerUserInfo;
+import jp.yamoto.farm.common.core.domain.model.LoginUser;
+import jp.yamoto.farm.common.core.service.TokenService;
+import jp.yamoto.farm.common.enums.AuthStatusEnum;
+import jp.yamoto.farm.common.exception.ServiceException;
+import jp.yamoto.farm.common.exception.user.UserNotExistsException;
+import jp.yamoto.farm.common.exception.user.UserPasswordNotMatchException;
+import jp.yamoto.farm.common.manager.AsyncManager;
+import jp.yamoto.farm.common.manager.factory.AsyncFactory;
+import jp.yamoto.farm.common.security.context.AuthenticationContextHolder;
+import jp.yamoto.farm.common.utils.MessageUtils;
+import jp.yamoto.farm.common.utils.SecurityUtils;
+import jp.yamoto.farm.common.utils.StringUtils;
+import jp.yamoto.farm.common.utils.ValueUtils;
+import jp.yamoto.farm.sankin.biz.auth.domain.AuthResetPwdBo;
+import jp.yamoto.farm.sankin.biz.auth.domain.AuthSecondVerifyBo;
+import jp.yamoto.farm.sankin.biz.auth.domain.AuthSendVerifyCodeBo;
+import jp.yamoto.farm.sankin.biz.mapper.FarmerUserMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.stereotype.Component;
+
+/**
+ * 農家 認証
+ * 
+ * @author nextosd
+ */
+@Component
+public class AuthService
+{
+    @Autowired
+    private TokenService tokenService;
+
+    @Resource
+    private AuthenticationManager authenticationManager;
+
+    @Autowired
+    private AppConfig appConfig;
+
+    @Autowired
+    private FarmerUserMapper farmerMapper;
+
+    /**
+     * ログイン検証
+     * 
+     * @param username ユーザー名
+     * @param password パスワード
+     * @return
+     */
+    public String login(String username, String password)
+    {
+        // ログイン前チェック
+        loginPreCheck(username, password);
+        // ユーザー認証
+        Authentication authentication = null;
+        try
+        {
+            UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
+            AuthenticationContextHolder.setContext(authenticationToken);
+            authentication = authenticationManager.authenticate(authenticationToken);
+        }
+        catch (Exception e)
+        {
+            if (e instanceof BadCredentialsException)
+            {
+                AsyncManager.me().execute(AsyncFactory.recordLogininfor(appConfig.getName(), username, Constants.LOGIN_FAIL, MessageUtils.message("E0004")));
+                throw new UserPasswordNotMatchException();
+            }
+            else
+            {
+                AsyncManager.me().execute(AsyncFactory.recordLogininfor(appConfig.getName(), username, Constants.LOGIN_FAIL, e.getMessage()));
+                throw new ServiceException(e.getMessage());
+            }
+        }
+        finally
+        {
+            AuthenticationContextHolder.clearContext();
+        }
+        AsyncManager.me().execute(AsyncFactory.recordLogininfor(appConfig.getName(), username, Constants.LOGIN_SUCCESS, MessageUtils.message("I0008")));
+        LoginUser loginUser = (LoginUser) authentication.getPrincipal();
+
+        loginUser.setAuthStatus(AuthStatusEnum.PENDING_SECOND_FACTOR);
+
+        // 一時的 token
+        return tokenService.createTempToken(loginUser);
+    }
+
+    /**
+     * 二次認証
+     * @param authSecondBo
+     * @return
+     */
+    public String authenticateSecond(AuthSecondVerifyBo authSecondBo){
+        // check temp token
+        if (!tokenService.validateToken(authSecondBo.getTempToken())) {
+            // 認証トークンが無効です。
+            throw new ServiceException(MessageUtils.message("E0044"));
+        }
+
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+
+        // 認証ステータスチェック
+        if (loginUser.getAuthStatus() != AuthStatusEnum.PENDING_SECOND_FACTOR) {
+            throw new ServiceException(MessageUtils.message("E0003", "一時的トークン"));
+        }
+
+        // TODO 認証コードチェック
+        boolean isValid = true; //emailService.verifyCode(user.getEmail(), request.getVerificationCode());
+
+        if (isValid) {
+            loginUser.setTempToken(null);
+            loginUser.setAuthStatus(AuthStatusEnum.COMPLETED);
+            // token
+            return tokenService.createToken(loginUser);
+        } else {
+            // E0045=認証トークンの有効期限が切れました。
+            throw new ServiceException(MessageUtils.message("E0045"));
+        }
+    }
+
+    /**
+     * 認証コードを再送信する
+     */
+    public void resendVerificationCode(String tempToken) {
+        // check temp token
+        if (!tokenService.validateToken(tempToken)) {
+            // 認証トークンが無効です。
+            throw new ServiceException(MessageUtils.message("E0044"));
+        }
+
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+
+        // TODO 認証コードを再送信する
+       // emailService.generateAndSendVerificationCode(user.getEmail());
+    }
+
+    /**
+     * パスワード再設定
+     * @param authResetPwdBo
+     */
+    public void resetPwd(AuthResetPwdBo authResetPwdBo){
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+
+        if(ValueUtils.isNotEqual(authResetPwdBo.getNewPassword(), authResetPwdBo.getConfimPassword())){
+            // E0048 確認用のパスワードと新パスワードが一致しません。
+            throw new ServiceException(MessageUtils.message("E0048"));
+        }
+
+        farmerMapper.resetUserPwd(loginUser.getUserId(), SecurityUtils.encryptPassword(authResetPwdBo.getNewPassword()));
+
+        FarmerUserInfo farmerUserInfo = farmerMapper.selectUserByUserName(loginUser.getUsername());
+        loginUser.setUser(farmerUserInfo);
+
+        tokenService.setLoginUser(loginUser);
+    }
+
+    /**
+     * 認証コードを送信します。
+     * @param authSendVerifyCodeBo
+     */
+    public String sendAuthCode(AuthSendVerifyCodeBo authSendVerifyCodeBo){
+        // メールアドレス 必須入力
+        if(ValueUtils.isEmpty(authSendVerifyCodeBo.getMailAddress())){
+            // E0003={0}は必須入力です。
+            throw new ServiceException(MessageUtils.message("E0003", MessageUtils.message("mailAddress")));
+        }
+
+        // ユーザー メールアドレス
+        FarmerUserInfo user = farmerMapper.selectUserByMailAddress(authSendVerifyCodeBo.getMailAddress());
+
+        if(user == null){
+            // E0062 確認用のパスワードと新パスワードが一致しません。
+            throw new ServiceException(MessageUtils.message("E0062", authSendVerifyCodeBo.getMailAddress()));
+        }
+
+        // TODO 認証コードを送信
+
+        // ユーザー認証
+        Authentication authentication = null;
+        try
+        {
+            UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getFarmerId(), user.getUserPassword());
+            AuthenticationContextHolder.setContext(authenticationToken);
+            authentication = authenticationManager.authenticate(authenticationToken);
+        }
+        catch (Exception e)
+        {
+            if (e instanceof BadCredentialsException)
+            {
+                AsyncManager.me().execute(AsyncFactory.recordLogininfor(appConfig.getName(), user.getFarmerId(), Constants.LOGIN_FAIL, MessageUtils.message("E0004")));
+                throw new UserPasswordNotMatchException();
+            }
+            else
+            {
+                AsyncManager.me().execute(AsyncFactory.recordLogininfor(appConfig.getName(), user.getFarmerId(), Constants.LOGIN_FAIL, e.getMessage()));
+                throw new ServiceException(e.getMessage());
+            }
+        }
+        finally
+        {
+            AuthenticationContextHolder.clearContext();
+        }
+        AsyncManager.me().execute(AsyncFactory.recordLogininfor(appConfig.getName(), user.getFarmerId(), Constants.LOGIN_SUCCESS, MessageUtils.message("I0010")));
+        LoginUser loginUser = (LoginUser) authentication.getPrincipal();
+
+        loginUser.setAuthStatus(AuthStatusEnum.PENDING_SECOND_FACTOR);
+
+        // 一時的 token
+        return tokenService.createTempToken(loginUser);
+    }
+
+    /**
+     * ログイン前チェック
+     * @param username ユーザー名
+     * @param password ユーザーパスワード
+     */
+    public void loginPreCheck(String username, String password)
+    {
+        // ユーザー名またはパスワードがNULLのエラー
+        if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password))
+        {
+            AsyncManager.me().execute(AsyncFactory.recordLogininfor(appConfig.getName(), username, Constants.LOGIN_FAIL, MessageUtils.message("E0052")));
+            throw new UserNotExistsException();
+        }
+        // パスワードが指定された範囲内でなければエラー
+        if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
+                || password.length() > UserConstants.PASSWORD_MAX_LENGTH)
+        {
+            AsyncManager.me().execute(AsyncFactory.recordLogininfor(appConfig.getName(), username, Constants.LOGIN_FAIL, MessageUtils.message("E0004")));
+            throw new UserPasswordNotMatchException();
+        }
+        // ユーザー名が指定された範囲外のエラー
+        if (username.length() < UserConstants.USERNAME_MIN_LENGTH
+                || username.length() > UserConstants.USERNAME_MAX_LENGTH)
+        {
+            AsyncManager.me().execute(AsyncFactory.recordLogininfor(appConfig.getName(), username, Constants.LOGIN_FAIL, MessageUtils.message("E0004")));
+            throw new UserPasswordNotMatchException();
+        }
+    }
+}

+ 10 - 13
farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/auth/service/UserDetailsServiceImpl.java

@@ -1,13 +1,13 @@
 package jp.yamoto.farm.sankin.biz.auth.service;
 
-import jp.yamoto.farm.common.core.domain.entity.MastNokaLoginInfo;
+import jp.yamoto.farm.common.core.domain.entity.FarmerUserInfo;
 import jp.yamoto.farm.common.core.domain.model.LoginUser;
 import jp.yamoto.farm.common.core.service.SysPasswordService;
 import jp.yamoto.farm.common.enums.UserStatus;
 import jp.yamoto.farm.common.exception.ServiceException;
 import jp.yamoto.farm.common.utils.MessageUtils;
 import jp.yamoto.farm.common.utils.StringUtils;
-import jp.yamoto.farm.sankin.biz.service.IMastNokaService;
+import jp.yamoto.farm.sankin.biz.mapper.FarmerUserMapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -27,7 +27,7 @@ public class UserDetailsServiceImpl implements UserDetailsService
     private static final Logger log = LoggerFactory.getLogger(UserDetailsServiceImpl.class);
 
     @Autowired
-    private IMastNokaService userService;
+    private FarmerUserMapper farmerUserMapper;
     
     @Autowired
     private SysPasswordService passwordService;
@@ -35,27 +35,24 @@ public class UserDetailsServiceImpl implements UserDetailsService
     @Override
     public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException
     {
-        MastNokaLoginInfo user = userService.selectUserByUserName(username);
+        FarmerUserInfo user = farmerUserMapper.selectUserByUserName(username);
         if (StringUtils.isNull(user))
         {
             log.info("ログインユーザ:{}は存在しません.", username);
-            throw new ServiceException(MessageUtils.message("user.not.exists"));
+            throw new ServiceException(MessageUtils.message("E0050", username));
         }
-
-        else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
+        else if (UserStatus.DISABLE.getCode().equals(user.getDiscontinuedFlg()))
         {
             log.info("ログインユーザ:{}が停止されました", username);
-            throw new ServiceException(MessageUtils.message("user.blocked"));
+            throw new ServiceException(MessageUtils.message("E0049"));
         }
-
-        passwordService.validate(user.getUserPwd());
+        passwordService.validate(user.getUserPassword());
 
         return createLoginUser(user);
     }
 
-    public UserDetails createLoginUser(MastNokaLoginInfo user)
+    public UserDetails createLoginUser(FarmerUserInfo user)
     {
-
-        return new LoginUser<MastNokaLoginInfo>(user.getNokaId(), user.getNokaCd(), user.getNokaMei(), user.getUserPwd(), user, null);
+        return new LoginUser<FarmerUserInfo>(true, user.getId(), user.getFarmerId(), user.getFarmerName(), user.getUserPassword(), user, null);
     }
 }

+ 45 - 0
farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/mapper/FarmerUserMapper.java

@@ -0,0 +1,45 @@
+package jp.yamoto.farm.sankin.biz.mapper;
+
+import jp.yamoto.farm.common.core.domain.entity.FarmerUserInfo;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 農家 ユーザーテーブル データ層
+ *
+ * @author nextosd
+ */
+public interface FarmerUserMapper {
+
+    /**
+     * ユーザーネームでユーザーを查詢
+     *
+     * @param userName ユーザーネーム
+     * @return ユーザーオブジェクト情報
+     */
+    public FarmerUserInfo selectUserByUserName(String userName);
+
+    /**
+     * メールアドレスでユーザーを検索する
+     *
+     * @param mailAddress メールアドレス
+     * @return ユーザーオブジェクト情報
+     */
+    public FarmerUserInfo selectUserByMailAddress(String mailAddress);
+
+    /**
+     * ユーザーIDでユーザーを查詢
+     *
+     * @param id ユーザーID
+     * @return ユーザーオブジェクト情報
+     */
+    public FarmerUserInfo selectUserById(String id);
+
+    /**
+     * ユーザーパスワードをリセット
+     *
+     * @param userName ユーザーネーム
+     * @param userPwd パスワード
+     * @return 結果
+     */
+    public int resetUserPwd(@Param("userName") String userName, @Param("userPwd") String userPwd);
+}

+ 0 - 37
farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/mapper/MastNokaMapper.java

@@ -1,37 +0,0 @@
-package jp.yamoto.farm.sankin.biz.mapper;
-
-import jp.yamoto.farm.common.core.domain.entity.MastNokaLoginInfo;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * 農家 ユーザーテーブル データ層
- *
- * @author nextosd
- */
-public interface MastNokaMapper {
-
-    /**
-     * ユーザーネームでユーザーを查詢
-     *
-     * @param nokaCd ユーザーネーム
-     * @return ユーザーオブジェクト情報
-     */
-    public MastNokaLoginInfo selectUserByUserName(String nokaCd);
-
-    /**
-     * ユーザーIDでユーザーを查詢
-     *
-     * @param nokaId ユーザーID
-     * @return ユーザーオブジェクト情報
-     */
-    public MastNokaLoginInfo selectUserById(Long nokaId);
-
-    /**
-     * ユーザーパスワードをリセット
-     *
-     * @param nokaCd ユーザーネーム
-     * @param userPwd パスワード
-     * @return 結果
-     */
-    public int resetUserPwd(@Param("nokaCd") String nokaCd, @Param("userPwd") String userPwd);
-}

+ 0 - 28
farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/service/IMastNokaService.java

@@ -1,28 +0,0 @@
-package jp.yamoto.farm.sankin.biz.service;
-
-import jp.yamoto.farm.common.core.domain.entity.MastNokaLoginInfo;
-
-/**
- * ユーザー・ビジネス・レベル
- * 
- * @author nextosd
- */
-public interface IMastNokaService
-{
-    /**
-     * ユーザー名でユーザーを検索する
-     *
-     * @param userName ユーザー名
-     * @return ユーザー情報
-     */
-    public MastNokaLoginInfo selectUserByUserName(String userName);
-
-    /**
-     * ユーザーのパスワードをリセットする
-     *
-     * @param userName ユーザー名
-     * @param password パスワード
-     * @return 結果
-     */
-    public int resetUserPwd(String userName, String password);
-}

+ 0 - 52
farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/service/impl/MastNokaServiceImpl.java

@@ -1,52 +0,0 @@
-package jp.yamoto.farm.sankin.biz.service.impl;
-
-import jakarta.validation.Validator;
-import jp.yamoto.farm.common.core.domain.entity.MastNokaLoginInfo;
-import jp.yamoto.farm.sankin.biz.mapper.MastNokaMapper;
-import jp.yamoto.farm.sankin.biz.service.IMastNokaService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-/**
- * 農家 ユーザー
- * 
- * @author nextosd
- */
-@Service
-public class MastNokaServiceImpl implements IMastNokaService
-{
-    private static final Logger log = LoggerFactory.getLogger(MastNokaServiceImpl.class);
-
-    @Autowired
-    private MastNokaMapper mastNokaMapper;
-
-    @Autowired
-    protected Validator validator;
-
-    /**
-     * ユーザー名でユーザーを検索する
-     *
-     * @param userName ユーザー名
-     * @return ユーザー情報
-     */
-    @Override
-    public MastNokaLoginInfo selectUserByUserName(String userName)
-    {
-        return mastNokaMapper.selectUserByUserName(userName);
-    }
-
-    /**
-     * ユーザーのパスワードをリセットする
-     *
-     * @param userName ユーザー名
-     * @param password パスワード
-     * @return 結果
-     */
-    @Override
-    public int resetUserPwd(String userName, String password)
-    {
-        return mastNokaMapper.resetUserPwd(userName, password);
-    }
-}

+ 93 - 0
farm-sankin-biz/src/main/resources/mapper/sankin/FarmerUserMapper.xml

@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="jp.yamoto.farm.sankin.biz.mapper.FarmerUserMapper">
+
+    <resultMap type="FarmerUserInfo" id="MastFarmerResult">
+        <result property="id" column="id"/>
+        <result property="farmerId" column="farmer_id"/>
+        <result property="farmerName" column="farmer_name"/>
+        <result property="farmerNameKn" column="farmer_name_kn"/>
+        <result property="phoneNumber" column="phone_number"/>
+        <result property="mailAddress" column="mail_address"/>
+        <result property="postalCode" column="postal_code"/>
+        <result property="prefecture" column="prefecture"/>
+        <result property="city" column="city"/>
+        <result property="townStreetArea" column="town_street_area"/>
+        <result property="buildingEtc" column="building_etc"/>
+        <result property="address" column="address"/>
+        <result property="representativeName" column="representative_name"/>
+        <result property="representativeNameKn" column="representative_name_kn"/>
+        <result property="issuedBy" column="issued_by"/>
+        <result property="issuedDate" column="issued_date"/>
+        <result property="loginCnt" column="login_cnt"/>
+        <result property="rakuuruCartId" column="rakuuru_cart_id"/>
+        <result property="rakuuruCartPwd" column="rakuuru_cart_pwd"/>
+        <result property="userPassword" column="user_password"/>
+        <result property="discontinuedFlg" column="discontinued_flg"/>
+        <result property="discontinuedDate" column="discontinued_date"/>
+        <result property="createTime" column="create_time"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createPgId" column="create_pg_id"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updatePgId" column="update_pg_id"/>
+        <result property="version" column="version"/>
+
+    </resultMap>
+	
+	<sql id="selectUserVo">
+        select
+            id,
+            farmer_id,
+            farmer_name,
+            farmer_name_kn,
+            phone_number,
+            mail_address,
+            postal_code,
+            prefecture,
+            city,
+            town_street_area,
+            building_etc,
+            address,
+            representative_name,
+            representative_name_kn,
+            issued_by,
+            issued_date,
+            login_cnt,
+            rakuuru_cart_id,
+            rakuuru_cart_pwd,
+            user_password,
+            discontinued_flg,
+            discontinued_date,
+            create_time,
+            create_by,
+            create_pg_id,
+            update_time,
+            update_by,
+            update_pg_id,
+            version
+        from mast_farmer
+    </sql>
+	
+	<select id="selectUserByUserName" parameterType="String" resultMap="MastFarmerResult">
+	    <include refid="selectUserVo"/>
+		where farmer_id = #{userName}
+	</select>
+	
+	<select id="selectUserById" parameterType="String" resultMap="MastFarmerResult">
+		<include refid="selectUserVo"/>
+        where id = #{id}
+	</select>
+
+    <select id="selectUserByMailAddress" parameterType="String" resultMap="MastFarmerResult">
+        <include refid="selectUserVo"/>
+        where mail_address = #{mailAddress}
+    </select>
+
+	<update id="resetUserPwd">
+ 		update mast_farmer set user_password = #{userPwd} where farmer_id = #{userName}
+	</update>
+	
+</mapper> 

+ 0 - 52
farm-sankin-biz/src/main/resources/mapper/sankin/MastNokaMapper.xml

@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="jp.yamoto.farm.sankin.biz.mapper.MastNokaMapper">
-
-    <resultMap type="MastNokaLoginInfo" id="MastNokaResult">
-        <id     property="nokaCd"       column="noka_cd"      />
-        <result property="nokaMei"      column="noka_mei"    />
-        <result property="nokaMeiKn"    column="noka_mei_kn"    />
-        <result property="tenwabango"   column="tenwabango"        />
-		<result property="mailAddress"  column="mail_address"        />
-		<result property="jukyo"        column="jukyo"        />
-        <result property="userPwd"      column="user_pwd"  />
-        <result property="createBy"     column="create_by"    />
-        <result property="createTime"   column="create_time"  />
-        <result property="updateBy"     column="update_by"    />
-        <result property="updateTime"   column="update_time"  />
-        <result property="version"      column="version"       />
-    </resultMap>
-	
-	<sql id="selectUserVo">
-        select
-            u.noka_cd,
-            u.noka_mei,
-            u.noka_mei_kn,
-            u.tenwabango,
-            u.mail_address,
-            u.jukyo,
-            u.user_pwd,
-            u.status,
-            u.create_by,
-            u.create_time,
-            u.version
-        from mast_noka u
-    </sql>
-	
-	<select id="selectUserByUserName" parameterType="String" resultMap="MastNokaResult">
-	    <include refid="selectUserVo"/>
-		where u.noka_cd = #{nokaCd}
-	</select>
-	
-	<select id="selectUserById" parameterType="Long" resultMap="MastNokaResult">
-		<include refid="selectUserVo"/>
-		where u.noka_id = #{nokaId}
-	</select>
-
-	<update id="resetUserPwd" parameterType="MastNokaLoginInfo">
- 		update mast_noka set user_pwd = #{userPwd} where noka_cd = #{nokaCd}
-	</update>
-	
-</mapper> 

+ 49 - 17
farm-sankin/src/main/java/jp/yamoto/farm/sankin/web/controller/AuthController.java

@@ -1,14 +1,17 @@
 package jp.yamoto.farm.sankin.web.controller;
 
 import jp.yamoto.farm.common.biz.domain.vo.UserInfoVo;
-import jp.yamoto.farm.common.constant.Constants;
 import jp.yamoto.farm.common.core.domain.AjaxResult;
-import jp.yamoto.farm.common.core.domain.entity.MastNokaLoginInfo;
+import jp.yamoto.farm.common.core.domain.entity.FarmerUserInfo;
 import jp.yamoto.farm.common.core.domain.model.LoginBody;
 import jp.yamoto.farm.common.core.domain.model.LoginUser;
 import jp.yamoto.farm.common.utils.SecurityUtils;
-import jp.yamoto.farm.sankin.biz.auth.service.AuthLoginService;
+import jp.yamoto.farm.sankin.biz.auth.domain.AuthSecondVerifyBo;
+import jp.yamoto.farm.sankin.biz.auth.domain.AuthResetPwdBo;
+import jp.yamoto.farm.sankin.biz.auth.domain.AuthSendVerifyCodeBo;
+import jp.yamoto.farm.sankin.biz.auth.service.AuthService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 /**
@@ -21,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
 public class AuthController
 {
     @Autowired
-    private AuthLoginService loginService;
+    private AuthService authService;
 
     /**
      * ログイン方法
@@ -34,32 +37,61 @@ public class AuthController
     {
         AjaxResult ajax = AjaxResult.success();
         // Token
-        String token = loginService.login(loginBody.getUsername(), loginBody.getPassword());
-        ajax.put(Constants.TOKEN, token);
-        return ajax;
+        String token = authService.login(loginBody.getUsername(), loginBody.getPassword());
+
+        return AjaxResult.success(token);
+    }
+
+    /**
+     * 二次認証
+     */
+    @PostMapping("/loginByCode")
+    public AjaxResult authVerifySecond(@RequestBody @Validated AuthSecondVerifyBo authSecondBo) {
+        return AjaxResult.success(authService.authenticateSecond(authSecondBo));
     }
 
     /**
-     * ユーザーにメールを送信
+     * パスワード再発行用の認証コードを送信します。
+     * 登録しているメールアドレスを入力してください
+     * 認証コードを送信
      */
-//    @PostMapping("/sendMailToUser")
-//    public AjaxResult doLoginByEmail(@RequestBody UserLoginParam userLoginParam) {
-//        return AjaxResult.success(organizationService.sendMailToUser(userLoginParam));
-//    }
+    @PostMapping("/sendAuthCode")
+    public AjaxResult sendAuthCode(@RequestBody AuthSendVerifyCodeBo authSendVerifyCodeBo) {
+        authService.sendAuthCode(authSendVerifyCodeBo);
+        return AjaxResult.success();
+    }
+
+    /**
+     * 認証コードを再送信する
+     */
+    @PostMapping("/resendAuthCode")
+    public AjaxResult resendVerification(@RequestParam String tempToken) {
+        authService.resendVerificationCode(tempToken);
+        return AjaxResult.success();
+    }
+
+    /**
+     * パスワード再設定
+     */
+    @PostMapping("/resetPwd")
+    public AjaxResult resetPwd(@RequestBody @Validated AuthResetPwdBo userResetPwdBo) {
+        authService.resetPwd(userResetPwdBo);
+        return AjaxResult.success();
+    }
 
     /**
      * ユーザー情報を取得
      *
      * @return ユーザー情報
      */
-    @GetMapping("getInfo")
+    @GetMapping("userInfo")
     public AjaxResult getInfo() {
-        LoginUser<MastNokaLoginInfo> loginUser = SecurityUtils.getLoginUser();
-        MastNokaLoginInfo user = loginUser.getUser();
+        LoginUser<FarmerUserInfo> loginUser = SecurityUtils.getLoginUser();
+        FarmerUserInfo user = loginUser.getUser();
 
         UserInfoVo userInfoVo = new UserInfoVo();
-        userInfoVo.setUserName(user.getNokaMei());
-        userInfoVo.setUserId(user.getNokaCd());
+        userInfoVo.setUserName(user.getFarmerName());
+        userInfoVo.setUserId(user.getFarmerId());
 
         AjaxResult ajax = AjaxResult.success(userInfoVo);
 

+ 8 - 3
farm-sankin/src/main/resources/application.yml

@@ -13,12 +13,15 @@ farm:
   # 検証コードタイプmath数値計算char文字検証
   captchaType: math
   # 暗号化に使用する秘密鍵(16バイト)
-  decryptFieldKey: 59KDbersTvuTdyh3
+  decryptFieldKey: 59KDbersTvuTdyh8uklt158e9utyh9s7
   # 初期化ベクトル(IV、16バイト)
-  decryptFieldIv: q3KanypB7RB5Rqom
+  decryptFieldIv: q3KanypB7RB5Rqom32tdzyaecgeq938u
   # ホワイトURLリスト
   whiteUrlList:
-    - /sankin/organization/**
+    - /api/auth/login
+    - /api/auth/loginByCode
+    - /api/auth/sendAuthCode
+    - /api/auth/resendAuthCode
 
 # 開発環境の構成
 server:
@@ -135,6 +138,8 @@ token:
   expireTime: 30
   # トークン自動更新有効期限
   automaticRenewalTokenMin: 30
+  # 一時的トークン有効期間(デフォルト10分)
+  tempExpireTime: 10
 
 # MyBatis
 mybatis:

+ 109 - 107
farm-sankin/src/main/resources/i18n/messages.properties

@@ -1,115 +1,117 @@
-E0001=入力された{0}は既に登録されています。
-E0002=パスワードを設定する際は、長さは8~20で、英大文字と小文字、数字、記号(#?!@$%^&*-)を組み合わせて入力してください。
-E0003={0}は必須入力です。
-E0004=ユーザー名またはパスワードが間違っています。
-E0005=現在ログイン中のユーザーは削除できません。
-E0006=枝番は999になるので、登録できません。
-E0007=該当データは既に別のユーザーより更新されました。
-E0008=メールアドレスの形式が正しくありません。
-E0009={0}ファイルを選択してください。
-E0010=ユーザー名が間違っています。
-E0011=該当検定種類は既に紐付けされているため、完全に削除することはできません。
-E0012={0}の重複登録はできません。
-E0013=該当検定種類は既に紐付けされているため、並び順を修正することはできません。
-E0014={0}は10件を上回ってはならない。
-E0015=認証情報が誤っているため、<br>成績情報の取得ができませんでした。
-E0016={0}は存在しません。
-E0017=ご入力いただいた成績情報は引継ぎされていません。
-E0018={0}が割り当てられているため、削除できません。
-E0019=並び順は順番ではないので、修正してください。
-E0020=生涯学習アカウントを取得してから再度ログインしてください。
-E0021=アカウントがロックされています。<br>※30分後にロックが自動解除されますので、解除後に再度ログインをお試しください。
-E0022=ご入力いただいた成績情報は既に別プロファイルより{0}されました。
-E0023={0}は必須選択してください。
-E0024=ファイルのサイズは{0}以下を選択してください。
-E0025={0}ファイルのサイズが0Mであるか、データの件数が0件であるか。データを追加した後、再度アップロードしてください。
-E0026={0}のフォーマット({1})が不正です。正しいフォーマットのCSVファイルを選択してください。
-E0027=アップロード対象が{0}の場合、{1}以外ファイル({2})を選択しないでください。
-E0028={0}ファイルの{1}項目個数が{2}個ではありません。項目個数を調整して、再度アップロードしてください。
-E0029={0}が入力されていません。
-E0030={0}の桁数は{1}桁以上になる。
-E0031=「検定種類」と「検定ごとの受験特定ID」の組み合わせが重複しています。
-E0032=CSVファイルの中身の{0}と{1}が不一致です。
-E0033={0}の整合性が不正です。
-E0034=「検定種類」と「検定ごとの受験特定ID」の組み合わせは成績ヘッダ情報に存在ありません。
-E0035=検定種類が重複しています。
-E0036={0}に既に存在あります。
-E0037={0}が{1}以外になる。
-E0038=下記の引継ぎ情報は既に紐付けされました。
-E0039=該当「検定種類」は検定種類情報に存在ありません。
-E0040=並び順は順番ではないです。
-E0041=並び順は重複になる。
-E0042=試験基本情報は既に削除されております。そのため、システム管理者にご連絡いただき、情報を追加した後、再度紐付けを行ってください。
-E0043=最新ではないメールのログインリンクをクリックした際のエラー
-E0044=認証トークンが無効です。
-E0045=認証トークンの有効期限が切れました。
-E0046=システム管理者のユーザーには操作を許可しません。
-E0047=ファイルは変更されているので、もう一度選択してください。
-E0048=確認用のパスワードと新パスワードが一致しません。
-E0049=ユーザーは禁止されています。管理者にお問い合わせください。
-E0050=ログインユーザー:{0}が存在しません。
-E0051={0}の桁数は{1}桁以上、もしくはサロゲートペアが含まれ最長バイト数を超過
-E0052=ユーザー名またはパスワードは入力必要です。
-E0053=パスワードが{0}回間違えており、アカウントは{1}分ロックされています。
-E0054=ロールにアクセスする権限がありません。
-E0055={0}に存在しません。
-E0056={0}は日付フォーマットではありません。
-E0057=「検定種類」と「検定ごとの受験特定ID」の組み合わせは複数のファイルで取り込むことはできません。
-E0058=Excel以外のファイルは選択できません。
-E0059=該当検定種類は既に紐付けされているため、{0}することはできません。
-E0060=認証項目マスタにおける認証項目の個数が変更されたため、<br>紐付けを行うことができませんでした。
-E0061=残念ながら、アクセスIPはシステムブラックリストに登録されています.
+E0001=\u5165\u529B\u3055\u308C\u305F{0}\u306F\u65E2\u306B\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u3059\u3002
+E0002=\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u8A2D\u5B9A\u3059\u308B\u969B\u306F\u3001\u9577\u3055\u306F8\uFF5E20\u3067\u3001\u82F1\u5927\u6587\u5B57\u3068\u5C0F\u6587\u5B57\u3001\u6570\u5B57\u3001\u8A18\u53F7\uFF08#?!@$%^&*-\uFF09\u3092\u7D44\u307F\u5408\u308F\u305B\u3066\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+E0003={0}\u306F\u5FC5\u9808\u5165\u529B\u3067\u3059\u3002
+E0004=\u30E6\u30FC\u30B6\u30FC\u540D\u307E\u305F\u306F\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u9593\u9055\u3063\u3066\u3044\u307E\u3059\u3002
+E0005=\u73FE\u5728\u30ED\u30B0\u30A4\u30F3\u4E2D\u306E\u30E6\u30FC\u30B6\u30FC\u306F\u524A\u9664\u3067\u304D\u307E\u305B\u3093\u3002
+E0006=\u679D\u756A\u306F999\u306B\u306A\u308B\u306E\u3067\u3001\u767B\u9332\u3067\u304D\u307E\u305B\u3093\u3002
+E0007=\u8A72\u5F53\u30C7\u30FC\u30BF\u306F\u65E2\u306B\u5225\u306E\u30E6\u30FC\u30B6\u30FC\u3088\u308A\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F\u3002
+E0008=\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002
+E0009={0}\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+E0010=\u30E6\u30FC\u30B6\u30FC\u540D\u304C\u9593\u9055\u3063\u3066\u3044\u307E\u3059\u3002
+E0011=\u8A72\u5F53\u691C\u5B9A\u7A2E\u985E\u306F\u65E2\u306B\u7D10\u4ED8\u3051\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001\u5B8C\u5168\u306B\u524A\u9664\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
+E0012={0}\u306E\u91CD\u8907\u767B\u9332\u306F\u3067\u304D\u307E\u305B\u3093\u3002
+E0013=\u8A72\u5F53\u691C\u5B9A\u7A2E\u985E\u306F\u65E2\u306B\u7D10\u4ED8\u3051\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001\u4E26\u3073\u9806\u3092\u4FEE\u6B63\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
+E0014={0}\u306F10\u4EF6\u3092\u4E0A\u56DE\u3063\u3066\u306F\u306A\u3089\u306A\u3044\u3002
+E0015=\u8A8D\u8A3C\u60C5\u5831\u304C\u8AA4\u3063\u3066\u3044\u308B\u305F\u3081\u3001<br>\u6210\u7E3E\u60C5\u5831\u306E\u53D6\u5F97\u304C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002
+E0016={0}\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3002
+E0017=\u3054\u5165\u529B\u3044\u305F\u3060\u3044\u305F\u6210\u7E3E\u60C5\u5831\u306F\u5F15\u7D99\u304E\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+E0018={0}\u304C\u5272\u308A\u5F53\u3066\u3089\u308C\u3066\u3044\u308B\u305F\u3081\u3001\u524A\u9664\u3067\u304D\u307E\u305B\u3093\u3002
+E0019=\u4E26\u3073\u9806\u306F\u9806\u756A\u3067\u306F\u306A\u3044\u306E\u3067\u3001\u4FEE\u6B63\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+E0020=\u751F\u6DAF\u5B66\u7FD2\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u53D6\u5F97\u3057\u3066\u304B\u3089\u518D\u5EA6\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+E0021=\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u30ED\u30C3\u30AF\u3055\u308C\u3066\u3044\u307E\u3059\u3002<br>\u203B30\u5206\u5F8C\u306B\u30ED\u30C3\u30AF\u304C\u81EA\u52D5\u89E3\u9664\u3055\u308C\u307E\u3059\u306E\u3067\u3001\u89E3\u9664\u5F8C\u306B\u518D\u5EA6\u30ED\u30B0\u30A4\u30F3\u3092\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002
+E0022=\u3054\u5165\u529B\u3044\u305F\u3060\u3044\u305F\u6210\u7E3E\u60C5\u5831\u306F\u65E2\u306B\u5225\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u3088\u308A{0}\u3055\u308C\u307E\u3057\u305F\u3002
+E0023={0}\u306F\u5FC5\u9808\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+E0024=\u30D5\u30A1\u30A4\u30EB\u306E\u30B5\u30A4\u30BA\u306F{0}\u4EE5\u4E0B\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+E0025={0}\u30D5\u30A1\u30A4\u30EB\u306E\u30B5\u30A4\u30BA\u304C0M\u3067\u3042\u308B\u304B\u3001\u30C7\u30FC\u30BF\u306E\u4EF6\u6570\u304C0\u4EF6\u3067\u3042\u308B\u304B\u3002\u30C7\u30FC\u30BF\u3092\u8FFD\u52A0\u3057\u305F\u5F8C\u3001\u518D\u5EA6\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+E0026={0}\u306E\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8({1})\u304C\u4E0D\u6B63\u3067\u3059\u3002\u6B63\u3057\u3044\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u306ECSV\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+E0027=\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u5BFE\u8C61\u304C{0}\u306E\u5834\u5408\u3001{1}\u4EE5\u5916\u30D5\u30A1\u30A4\u30EB({2})\u3092\u9078\u629E\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
+E0028={0}\u30D5\u30A1\u30A4\u30EB\u306E{1}\u9805\u76EE\u500B\u6570\u304C{2}\u500B\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u9805\u76EE\u500B\u6570\u3092\u8ABF\u6574\u3057\u3066\u3001\u518D\u5EA6\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+E0029={0}\u304C\u5165\u529B\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+E0030={0}\u306E\u6841\u6570\u306F{1}\u6841\u4EE5\u4E0A\u306B\u306A\u308B\u3002
+E0031=\u300C\u691C\u5B9A\u7A2E\u985E\u300D\u3068\u300C\u691C\u5B9A\u3054\u3068\u306E\u53D7\u9A13\u7279\u5B9AID\u300D\u306E\u7D44\u307F\u5408\u308F\u305B\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\u3002
+E0032=CSV\u30D5\u30A1\u30A4\u30EB\u306E\u4E2D\u8EAB\u306E{0}\u3068{1}\u304C\u4E0D\u4E00\u81F4\u3067\u3059\u3002
+E0033={0}\u306E\u6574\u5408\u6027\u304C\u4E0D\u6B63\u3067\u3059\u3002
+E0034=\u300C\u691C\u5B9A\u7A2E\u985E\u300D\u3068\u300C\u691C\u5B9A\u3054\u3068\u306E\u53D7\u9A13\u7279\u5B9AID\u300D\u306E\u7D44\u307F\u5408\u308F\u305B\u306F\u6210\u7E3E\u30D8\u30C3\u30C0\u60C5\u5831\u306B\u5B58\u5728\u3042\u308A\u307E\u305B\u3093\u3002
+E0035=\u691C\u5B9A\u7A2E\u985E\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\u3002
+E0036={0}\u306B\u65E2\u306B\u5B58\u5728\u3042\u308A\u307E\u3059\u3002
+E0037={0}\u304C{1}\u4EE5\u5916\u306B\u306A\u308B\u3002
+E0038=\u4E0B\u8A18\u306E\u5F15\u7D99\u304E\u60C5\u5831\u306F\u65E2\u306B\u7D10\u4ED8\u3051\u3055\u308C\u307E\u3057\u305F\u3002
+E0039=\u8A72\u5F53\u300C\u691C\u5B9A\u7A2E\u985E\u300D\u306F\u691C\u5B9A\u7A2E\u985E\u60C5\u5831\u306B\u5B58\u5728\u3042\u308A\u307E\u305B\u3093\u3002
+E0040=\u4E26\u3073\u9806\u306F\u9806\u756A\u3067\u306F\u306A\u3044\u3067\u3059\u3002
+E0041=\u4E26\u3073\u9806\u306F\u91CD\u8907\u306B\u306A\u308B\u3002
+E0042=\u8A66\u9A13\u57FA\u672C\u60C5\u5831\u306F\u65E2\u306B\u524A\u9664\u3055\u308C\u3066\u304A\u308A\u307E\u3059\u3002\u305D\u306E\u305F\u3081\u3001\u30B7\u30B9\u30C6\u30E0\u7BA1\u7406\u8005\u306B\u3054\u9023\u7D61\u3044\u305F\u3060\u304D\u3001\u60C5\u5831\u3092\u8FFD\u52A0\u3057\u305F\u5F8C\u3001\u518D\u5EA6\u7D10\u4ED8\u3051\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
+E0043=\u6700\u65B0\u3067\u306F\u306A\u3044\u30E1\u30FC\u30EB\u306E\u30ED\u30B0\u30A4\u30F3\u30EA\u30F3\u30AF\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u305F\u969B\u306E\u30A8\u30E9\u30FC
+E0044=\u8A8D\u8A3C\u30C8\u30FC\u30AF\u30F3\u304C\u7121\u52B9\u3067\u3059\u3002
+E0045=\u8A8D\u8A3C\u30C8\u30FC\u30AF\u30F3\u306E\u6709\u52B9\u671F\u9650\u304C\u5207\u308C\u307E\u3057\u305F\u3002
+E0046=\u30B7\u30B9\u30C6\u30E0\u7BA1\u7406\u8005\u306E\u30E6\u30FC\u30B6\u30FC\u306B\u306F\u64CD\u4F5C\u3092\u8A31\u53EF\u3057\u307E\u305B\u3093\u3002
+E0047=\u30D5\u30A1\u30A4\u30EB\u306F\u5909\u66F4\u3055\u308C\u3066\u3044\u308B\u306E\u3067\u3001\u3082\u3046\u4E00\u5EA6\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+E0048=\u78BA\u8A8D\u7528\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3068\u65B0\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002
+E0049=\u30E6\u30FC\u30B6\u30FC\u306F\u7981\u6B62\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u7BA1\u7406\u8005\u306B\u304A\u554F\u3044\u5408\u308F\u305B\u304F\u3060\u3055\u3044\u3002
+E0050=\u30ED\u30B0\u30A4\u30F3\u30E6\u30FC\u30B6\u30FC\uFF1A{0}\u304C\u5B58\u5728\u3057\u307E\u305B\u3093\u3002
+E0051={0}\u306E\u6841\u6570\u306F{1}\u6841\u4EE5\u4E0A\u3001\u3082\u3057\u304F\u306F\u30B5\u30ED\u30B2\u30FC\u30C8\u30DA\u30A2\u304C\u542B\u307E\u308C\u6700\u9577\u30D0\u30A4\u30C8\u6570\u3092\u8D85\u904E
+E0052=\u30E6\u30FC\u30B6\u30FC\u540D\u307E\u305F\u306F\u30D1\u30B9\u30EF\u30FC\u30C9\u306F\u5165\u529B\u5FC5\u8981\u3067\u3059\u3002
+E0053=\u30D1\u30B9\u30EF\u30FC\u30C9\u304C{0}\u56DE\u9593\u9055\u3048\u3066\u304A\u308A\u3001\u30A2\u30AB\u30A6\u30F3\u30C8\u306F{1}\u5206\u30ED\u30C3\u30AF\u3055\u308C\u3066\u3044\u307E\u3059\u3002
+E0054=\u30ED\u30FC\u30EB\u306B\u30A2\u30AF\u30BB\u30B9\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002
+E0055={0}\u306B\u5B58\u5728\u3057\u307E\u305B\u3093\u3002
+E0056={0}\u306F\u65E5\u4ED8\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+E0057=\u300C\u691C\u5B9A\u7A2E\u985E\u300D\u3068\u300C\u691C\u5B9A\u3054\u3068\u306E\u53D7\u9A13\u7279\u5B9AID\u300D\u306E\u7D44\u307F\u5408\u308F\u305B\u306F\u8907\u6570\u306E\u30D5\u30A1\u30A4\u30EB\u3067\u53D6\u308A\u8FBC\u3080\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
+E0058=Excel\u4EE5\u5916\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u9078\u629E\u3067\u304D\u307E\u305B\u3093\u3002
+E0059=\u8A72\u5F53\u691C\u5B9A\u7A2E\u985E\u306F\u65E2\u306B\u7D10\u4ED8\u3051\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001{0}\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
+E0060=\u8A8D\u8A3C\u9805\u76EE\u30DE\u30B9\u30BF\u306B\u304A\u3051\u308B\u8A8D\u8A3C\u9805\u76EE\u306E\u500B\u6570\u304C\u5909\u66F4\u3055\u308C\u305F\u305F\u3081\u3001<br>\u7D10\u4ED8\u3051\u3092\u884C\u3046\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002
+E0061=\u6B8B\u5FF5\u306A\u304C\u3089\u3001\u30A2\u30AF\u30BB\u30B9IP\u306F\u30B7\u30B9\u30C6\u30E0\u30D6\u30E9\u30C3\u30AF\u30EA\u30B9\u30C8\u306B\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u3059.
+E0062=\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u30E6\u30FC\u30B6\u30FC\uFF1A{0}\u304C\u5B58\u5728\u3057\u307E\u305B\u3093\u3002
 
-EM001=文字数は1~64で入力してください。
-EM002=並び順は1~10で入力してください。
-EM003={0}は必須入力です。
-EM004={0}は{1}のみで入力してください。
-EM005={0}は{1}文字以下で入力してください。
-EM006={0}が不正です。
+EM001=\u6587\u5B57\u6570\u306F1\uFF5E64\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+EM002=\u4E26\u3073\u9806\u306F1\uFF5E10\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+EM003={0}\u306F\u5FC5\u9808\u5165\u529B\u3067\u3059\u3002
+EM004={0}\u306F{1}\u306E\u307F\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+EM005={0}\u306F{1}\u6587\u5B57\u4EE5\u4E0B\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+EM006={0}\u304C\u4E0D\u6B63\u3067\u3059\u3002
 
-I0001=成功しました。
-I0002=失敗しました。
-I0003=取込に成功しました。
-I0004=取込に失敗しました。
-I0008=ログインしました。
-I0009=ログアウトしました。
+I0001=\u6210\u529F\u3057\u307E\u3057\u305F\u3002
+I0002=\u5931\u6557\u3057\u307E\u3057\u305F\u3002
+I0003=\u53D6\u8FBC\u306B\u6210\u529F\u3057\u307E\u3057\u305F\u3002
+I0004=\u53D6\u8FBC\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002
+I0008=\u30ED\u30B0\u30A4\u30F3\u3057\u307E\u3057\u305F\u3002
+I0009=\u30ED\u30B0\u30A2\u30A6\u30C8\u3057\u307E\u3057\u305F\u3002
+I0010=\u8A8D\u8A3C\u30B3\u30FC\u30C9\u3092\u9001\u4FE1\u3057\u307E\u3057\u305F\u3002
 
-label.nokaMei=農家名
-label.nokaMeiKn=農家名(カナ)
-label.nokaCd=農家ID
+label.nokaMei=\u8FB2\u5BB6\u540D
+label.nokaMeiKn=\u8FB2\u5BB6\u540D\uFF08\u30AB\u30CA\uFF09
+label.nokaCd=\u8FB2\u5BB6ID
 
-label.branchNo=枝番
-label.orderNo=並び順
-label.itemLabel=項目ラベル
-label.charType=文字種
-label.charCount=文字数
-label.isInput=入力要否
-label.keyWord=キーワード
-label.profileId=プロファイルID
-label.profileInfo=プロファイル情報
-label.listDisplayItem=一覧表示項目
-label.mailAddress=メールアドレス
-label.roleName=ロール名
-label.remark=備考
-label.userName=アカウント
-label.nickName=ユーザー名称
-label.password=パスワード
-label.role=ロール
-label.attachInfoConnect=紐付け
-label.attachInfoRelieve=解除
-label.halfAlphabetNumericSymbol=半角英数字記号
-label.halfAlphabetNumeric=半角英数字
-label.halfAlphabet=半角英字
-label.halfNumeric=半角数字
-label.kana=カナ
-label.menuAuthority=メニュー権限
+label.branchNo=\u679D\u756A
+label.orderNo=\u4E26\u3073\u9806
+label.itemLabel=\u9805\u76EE\u30E9\u30D9\u30EB
+label.charType=\u6587\u5B57\u7A2E
+label.charCount=\u6587\u5B57\u6570
+label.isInput=\u5165\u529B\u8981\u5426
+label.keyWord=\u30AD\u30FC\u30EF\u30FC\u30C9
+label.profileId=\u30D7\u30ED\u30D5\u30A1\u30A4\u30EBID
+label.profileInfo=\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u60C5\u5831
+label.listDisplayItem=\u4E00\u89A7\u8868\u793A\u9805\u76EE
+label.mailAddress=\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9
+label.roleName=\u30ED\u30FC\u30EB\u540D
+label.remark=\u5099\u8003
+label.userName=\u30A2\u30AB\u30A6\u30F3\u30C8
+label.nickName=\u30E6\u30FC\u30B6\u30FC\u540D\u79F0
+label.password=\u30D1\u30B9\u30EF\u30FC\u30C9
+label.role=\u30ED\u30FC\u30EB
+label.attachInfoConnect=\u7D10\u4ED8\u3051
+label.attachInfoRelieve=\u89E3\u9664
+label.halfAlphabetNumericSymbol=\u534A\u89D2\u82F1\u6570\u5B57\u8A18\u53F7
+label.halfAlphabetNumeric=\u534A\u89D2\u82F1\u6570\u5B57
+label.halfAlphabet=\u534A\u89D2\u82F1\u5B57
+label.halfNumeric=\u534A\u89D2\u6570\u5B57
+label.kana=\u30AB\u30CA
+label.menuAuthority=\u30E1\u30CB\u30E5\u30FC\u6A29\u9650
 label.csvExtension=CSV
 label.xlsxExtension=EXCEL
 label.errorLF=LF
 label.errorUtf8=UTF-8
-label.input=入力否の場合、キーワード
-label.parameterInvalid=パラメータエラー
-label.forbidden=遷移元システムID不正
-label.authenticateError=認証エラー
-label.newAdd=新規登録
-label.edit=編集
+label.input=\u5165\u529B\u5426\u306E\u5834\u5408\u3001\u30AD\u30FC\u30EF\u30FC\u30C9
+label.parameterInvalid=\u30D1\u30E9\u30E1\u30FC\u30BF\u30A8\u30E9\u30FC
+label.forbidden=\u9077\u79FB\u5143\u30B7\u30B9\u30C6\u30E0ID\u4E0D\u6B63
+label.authenticateError=\u8A8D\u8A3C\u30A8\u30E9\u30FC
+label.newAdd=\u65B0\u898F\u767B\u9332
+label.edit=\u7DE8\u96C6