MaxKey 3 anni fa
parent
commit
633247aca1
24 ha cambiato i file con 370 aggiunte e 95 eliminazioni
  1. 1 0
      build.gradle
  2. 1 0
      config/build_docker.gradle
  3. 1 0
      config/build_jar.gradle
  4. 1 0
      config/build_standard.gradle
  5. 1 0
      gradle.properties
  6. 30 3
      maxkey-core/src/main/java/org/maxkey/entity/AccountsStrategy.java
  7. 0 11
      maxkey-core/src/main/java/org/maxkey/entity/apps/Apps.java
  8. 7 0
      maxkey-persistence/src/main/java/org/maxkey/persistence/mapper/AccountsMapper.java
  9. 96 17
      maxkey-persistence/src/main/java/org/maxkey/persistence/service/AccountsService.java
  10. 22 20
      maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/AccountsStrategyMapper.xml
  11. 0 6
      maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/AppsMapper.xml
  12. 14 0
      maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/AccountsController.java
  13. 9 1
      maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/AccountsStrategyController.java
  14. 4 1
      maxkey-webs/maxkey-web-mgt/src/main/resources/messages/message.properties
  15. 4 1
      maxkey-webs/maxkey-web-mgt/src/main/resources/messages/message_en.properties
  16. 4 1
      maxkey-webs/maxkey-web-mgt/src/main/resources/messages/message_zh_CN.properties
  17. 17 1
      maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/accounts/accountsAdd.ftl
  18. 22 2
      maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/accountsstrategy/accountsStrategyAdd.ftl
  19. 17 5
      maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/accountsstrategy/accountsStrategyList.ftl
  20. 22 2
      maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/accountsstrategy/accountsStrategyUpdate.ftl
  21. 91 0
      maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/accountsstrategy/selectAccountsStrategy.ftl
  22. 3 12
      maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/apps/appAddCommon.ftl
  23. 1 10
      maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/apps/appUpdateCommon.ftl
  24. 2 2
      setEnvVars.bat

+ 1 - 0
build.gradle

@@ -402,6 +402,7 @@ subprojects {
          implementation  group: 'org.codehaus.woodstox', name: 'stax2-api', version: "${stax2apiVersion}"
          implementation  group: 'org.reflections', name: 'reflections', version: '0.9.11'
          implementation  group: 'io.prometheus', name: 'simpleclient', version: '0.5.0'
+         implementation  group: 'com.belerweb', name: 'pinyin4j', version: "${pinyin4jVersion}"
          
           //阿里云
          implementation  group: 'com.aliyun', name: 'aliyun-java-sdk-core', version: "${aliyunjavasdkcoreVersion}"

+ 1 - 0
config/build_docker.gradle

@@ -352,6 +352,7 @@ subprojects {
          implementation  group: 'org.codehaus.woodstox', name: 'stax2-api', version: "${stax2apiVersion}"
          implementation  group: 'org.reflections', name: 'reflections', version: '0.9.11'
          implementation  group: 'io.prometheus', name: 'simpleclient', version: '0.5.0'
+         implementation  group: 'com.belerweb', name: 'pinyin4j', version: "${pinyin4jVersion}"
          
           //阿里云
          implementation  group: 'com.aliyun', name: 'aliyun-java-sdk-core', version: "${aliyunjavasdkcoreVersion}"

+ 1 - 0
config/build_jar.gradle

@@ -352,6 +352,7 @@ subprojects {
          implementation  group: 'org.codehaus.woodstox', name: 'stax2-api', version: "${stax2apiVersion}"
          implementation  group: 'org.reflections', name: 'reflections', version: '0.9.11'
          implementation  group: 'io.prometheus', name: 'simpleclient', version: '0.5.0'
+         implementation  group: 'com.belerweb', name: 'pinyin4j', version: "${pinyin4jVersion}"
          
           //阿里云
          implementation  group: 'com.aliyun', name: 'aliyun-java-sdk-core', version: "${aliyunjavasdkcoreVersion}"

+ 1 - 0
config/build_standard.gradle

@@ -388,6 +388,7 @@ subprojects {
          implementation  group: 'org.codehaus.woodstox', name: 'stax2-api', version: "${stax2apiVersion}"
          implementation  group: 'org.reflections', name: 'reflections', version: '0.9.11'
          implementation  group: 'io.prometheus', name: 'simpleclient', version: '0.5.0'
+         implementation  group: 'com.belerweb', name: 'pinyin4j', version: "${pinyin4jVersion}"
          
           //阿里云
          implementation  group: 'com.aliyun', name: 'aliyun-java-sdk-core', version: "${aliyunjavasdkcoreVersion}"

+ 1 - 0
gradle.properties

@@ -143,6 +143,7 @@ aopallianceVersion              =1.0
 aspectjtoolsVersion             =1.9.4
 evictorVersion                  =1.0.0
 lettuceVersion                  =6.1.4.RELEASE
+pinyin4jVersion                 =2.5.1
 #xml
 jdomVersion                     =2.0.2
 dom4jVersion                    =1.6.1

+ 30 - 3
maxkey-core/src/main/java/org/maxkey/entity/AccountsStrategy.java

@@ -42,17 +42,20 @@ public class AccountsStrategy extends JpaBaseEntity implements Serializable {
     private String name;
     @Column
     private String appId;
+    private byte[] appIcon;
     @Column
     private String appName;
     @Column
     private String mapping;
-
     @Column
     String filters ;
-    
     @Column
     String orgIdsList;
     @Column
+    String suffixes;
+    @Column
+    String createType;
+    @Column
     String status;
     @Column
     String description;
@@ -173,7 +176,31 @@ public class AccountsStrategy extends JpaBaseEntity implements Serializable {
         this.mapping = mapping;
     }
 
-    @Override
+    public byte[] getAppIcon() {
+		return appIcon;
+	}
+
+	public void setAppIcon(byte[] appIcon) {
+		this.appIcon = appIcon;
+	}
+
+	public String getCreateType() {
+		return createType;
+	}
+
+	public void setCreateType(String createType) {
+		this.createType = createType;
+	}
+
+	public String getSuffixes() {
+		return suffixes;
+	}
+
+	public void setSuffixes(String suffixes) {
+		this.suffixes = suffixes;
+	}
+
+	@Override
     public String toString() {
         StringBuilder builder = new StringBuilder();
         builder.append("AccountsStrategy [id=");

+ 0 - 11
maxkey-core/src/main/java/org/maxkey/entity/apps/Apps.java

@@ -140,9 +140,6 @@ public class Apps extends JpaBaseEntity implements Serializable {
     
     @Column
     private String adapter;
-    
-    @Column
-    protected int accountMgmt;
 
     protected Accounts appUser;
     @Column
@@ -586,14 +583,6 @@ public class Apps extends JpaBaseEntity implements Serializable {
 		this.adapterName = adapterName;
 	}
 
-	public int getAccountMgmt() {
-		return accountMgmt;
-	}
-
-	public void setAccountMgmt(int accountMgmt) {
-		this.accountMgmt = accountMgmt;
-	}
-
 	@Override
 	public String toString() {
 		StringBuilder builder = new StringBuilder();

+ 7 - 0
maxkey-persistence/src/main/java/org/maxkey/persistence/mapper/AccountsMapper.java

@@ -22,6 +22,8 @@ package org.maxkey.persistence.mapper;
 
 import java.util.List;
 
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import org.apache.mybatis.jpa.persistence.IJpaBaseMapper;
 import org.maxkey.entity.Accounts;
 import org.maxkey.entity.AccountsStrategy;
@@ -37,4 +39,9 @@ public  interface AccountsMapper extends IJpaBaseMapper<Accounts> {
     public List<UserInfo> queryUserNotInStrategy(AccountsStrategy strategy);
     
     public long deleteByStrategy(AccountsStrategy strategy);
+    
+    public List<Accounts> queryByAppIdAndDate(Accounts account);
+    
+    @Select("select * from mxk_accounts where appid=#{appId} and	relatedusername=#{relatedUsername}")
+    public List<Accounts> queryByAppIdAndAccount(@Param ("appId") String appId,@Param ("relatedUsername") String relatedUsername);
 }

+ 96 - 17
maxkey-persistence/src/main/java/org/maxkey/persistence/service/AccountsService.java

@@ -34,6 +34,13 @@ import org.maxkey.util.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
 
+import net.sourceforge.pinyin4j.PinyinHelper;
+import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
+import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
+import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
+import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
+import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
+
 @Repository
 public class AccountsService  extends JpaBaseService<Accounts>{
 
@@ -133,22 +140,7 @@ public class AccountsService  extends JpaBaseService<Accounts>{
            account.setUserId(user.getId());
            account.setUsername(user.getUsername());
            account.setDisplayName(user.getDisplayName());
-           
-           if(strategy.getMapping().equalsIgnoreCase("username")) {
-               account.setRelatedUsername(user.getUsername());
-           }else if(strategy.getMapping().equalsIgnoreCase("mobile")) {
-               account.setRelatedUsername(user.getMobile());
-           }else if(strategy.getMapping().equalsIgnoreCase("email")) {
-               account.setRelatedUsername(user.getEmail());
-           }else if(strategy.getMapping().equalsIgnoreCase("employeeNumber")) {
-               account.setRelatedUsername(user.getEmployeeNumber());
-           }else if(strategy.getMapping().equalsIgnoreCase("windowsAccount")) {
-               account.setRelatedUsername(user.getWindowsAccount());
-           }else if(strategy.getMapping().equalsIgnoreCase("idCardNo")) {
-               account.setRelatedUsername(user.getIdCardNo());
-           }else {
-               account.setRelatedUsername(user.getUsername());
-           }
+           account.setRelatedUsername(generateAccount(user,strategy));
            account.setRelatedPassword(ReciprocalUtils.encode(userInfoService.randomPassword()));
            
            account.setCreateType("automatic");
@@ -160,7 +152,9 @@ public class AccountsService  extends JpaBaseService<Accounts>{
        deleteByStrategy(strategy);
    }
    public void refreshAllByStrategy() {
-       for( AccountsStrategy strategy : accountsStrategyService.query(null)) {
+	   AccountsStrategy queryStrategy = new AccountsStrategy();
+	   queryStrategy.setCreateType("automatic");
+       for( AccountsStrategy strategy : accountsStrategyService.query(queryStrategy)) {
            refreshByStrategy(strategy);
        }
    }
@@ -174,4 +168,89 @@ public class AccountsService  extends JpaBaseService<Accounts>{
        return getMapper().deleteByStrategy(strategy);
    }
 	
+	
+   public List<Accounts> queryByAppIdAndDate(Accounts account) {
+       return getMapper().queryByAppIdAndDate(account);
+   }
+   
+   public List<Accounts> queryByAppIdAndAccount(String appId,String relatedUsername){
+	   return getMapper().queryByAppIdAndAccount(appId,relatedUsername);
+   }
+   
+   
+   public String generateAccount(UserInfo  userInfo,AccountsStrategy accountsStrategy) {
+   	String shortAccount = generateAccount(userInfo,accountsStrategy,true);
+   	String account = generateAccount(userInfo,accountsStrategy,false);
+   	String accountResult = shortAccount;
+   	List<Accounts> AccountsList =getMapper().queryByAppIdAndAccount(accountsStrategy.getAppId(),shortAccount +accountsStrategy.getSuffixes());
+   	if(!AccountsList.isEmpty()) {
+   		if(accountsStrategy.getMapping().equalsIgnoreCase("email")) {
+   			accountResult = account;
+   			AccountsList =getMapper().queryByAppIdAndAccount(accountsStrategy.getAppId(),account + accountsStrategy.getSuffixes());
+   		}
+   		if(!AccountsList.isEmpty()) {
+	    		for(int i =1 ;i < 100 ;i++) {
+	    			accountResult = account + i;
+	    			AccountsList =getMapper().queryByAppIdAndAccount(accountsStrategy.getAppId(),accountResult + accountsStrategy.getSuffixes());
+	    			if(AccountsList.isEmpty())break;
+	    		}
+   		}
+   	}
+   	if(StringUtils.isNotBlank(accountsStrategy.getSuffixes())){
+   		accountResult = accountResult + accountsStrategy.getSuffixes();
+   	}
+       return accountResult;
+   }
+   
+   
+	private String generateAccount(UserInfo  userInfo,AccountsStrategy strategy,boolean isShort) {
+		String account = "";
+    	if(strategy.getMapping().equalsIgnoreCase("username")) {
+    		account = userInfo.getUsername();
+    	}else if(strategy.getMapping().equalsIgnoreCase("mobile")) {
+    		account = userInfo.getMobile();
+    	}else if(strategy.getMapping().equalsIgnoreCase("email")) {
+    		try {
+	    		if(isShort) {
+	    			account = getPinYinShortName(userInfo.getDisplayName());
+	    		}else {
+	    			account = getPinYinName(userInfo.getDisplayName());
+	    		}
+    		}catch(Exception e) {
+    			e.printStackTrace();
+    		}
+    	}else if(strategy.getMapping().equalsIgnoreCase("employeeNumber")) {
+    		account = userInfo.getEmployeeNumber();
+    	}else if(strategy.getMapping().equalsIgnoreCase("windowsAccount")) {
+    		account = userInfo.getWindowsAccount();
+    	}else if(strategy.getMapping().equalsIgnoreCase("idCardNo")) {
+    		account = userInfo.getIdCardNo();
+    	}else {
+    		account = userInfo.getUsername();
+    	}
+    	
+        return account;
+	}
+	
+	public static String getPinYinName(String name) throws BadHanyuPinyinOutputFormatCombination {
+        HanyuPinyinOutputFormat pinyinFormat = new        HanyuPinyinOutputFormat();
+        pinyinFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
+        pinyinFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
+        pinyinFormat.setVCharType(HanyuPinyinVCharType.WITH_V);
+        return PinyinHelper.toHanYuPinyinString(name, pinyinFormat, "",false);
+    }
+	
+	public static String getPinYinShortName(String name) throws BadHanyuPinyinOutputFormatCombination {
+		char[] strs = name.toCharArray();
+		String pinyinName = "";
+		for(int i=0;i<strs.length;i++) {
+			if(i == 0) {
+				pinyinName += getPinYinName(strs[i]+"");
+			}else {
+				pinyinName += getPinYinName(strs[i]+"").charAt(0);
+			}
+		}
+		return pinyinName;
+    }
+	
 }

+ 22 - 20
maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/AccountsStrategyMapper.xml

@@ -3,27 +3,29 @@
 <mapper namespace="org.maxkey.persistence.mapper.AccountsStrategyMapper">
 
 	<sql id="where_statement">
-    	<if test="id != null and id != ''">
-			and	id	=	#{id}
-		</if> 
-		<if test="appId != null and appId != ''">
-			and	appid	=	#{appId}
-		</if> 
-		<if test="name != null and name != ''">
-			and	name	=	#{name}
-		</if>
+        <if test="id != null and id != ''">
+            and mas.id  =   #{id}
+        </if> 
+        <if test="appId != null and appId != ''">
+            and mas.appid   =   #{appId}
+        </if> 
+        <if test="name != null and name != ''">
+            and mas.name    =   #{name}
+        </if>
     </sql>
     
-	
-	
-	<select id="queryPageResults" parameterType="AccountsStrategy" resultType="AccountsStrategy">
-		select
-			*
-		from
-			mxk_accounts_strategy
-		where
-			 (1=1)	
-		<include refid="where_statement"/>
-	</select>
+    
+    
+    <select id="queryPageResults" parameterType="AccountsStrategy" resultType="AccountsStrategy">
+        select
+            mas.*,
+            ma.icon appicon
+        from
+            mxk_accounts_strategy mas,
+            mxk_apps    ma
+        where
+             mas.appid = ma.id
+        <include refid="where_statement"/>
+    </select>
 	
 </mapper>

+ 0 - 6
maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/AppsMapper.xml

@@ -21,9 +21,6 @@
 		<if test="vendor != null and vendor != ''">
 			and vendor 		= #{vendor}
 		</if>
-		<if test="accountMgmt == 1 or accountMgmt == 2">
-			and accountmgmt = #{accountMgmt}
-		</if>
 		
 	</sql>
 	
@@ -71,7 +68,6 @@
 			
 			principal,
 			credentials,
-			accountmgmt,
 			
 			visible,
 			
@@ -113,7 +109,6 @@
 			
 			#{principal},
 			#{credentials},
-			#{accountMgmt},
 			
 			#{visible},
 			
@@ -162,7 +157,6 @@
 			</if>
 			principal			=	#{principal},
 			credentials			=	#{credentials},
-			accountmgmt			=	#{accountMgmt},
 			visible				=	#{visible},
 			sortindex			=	#{sortIndex},
 			

+ 14 - 0
maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/AccountsController.java

@@ -21,7 +21,10 @@ import org.apache.mybatis.jpa.persistence.JpaPageResults;
 import org.maxkey.constants.ConstantsOperateMessage;
 import org.maxkey.crypto.ReciprocalUtils;
 import org.maxkey.entity.Accounts;
+import org.maxkey.entity.AccountsStrategy;
+import org.maxkey.entity.UserInfo;
 import org.maxkey.persistence.service.AccountsService;
+import org.maxkey.persistence.service.AccountsStrategyService;
 import org.maxkey.persistence.service.AppsService;
 import org.maxkey.persistence.service.UserInfoService;
 import org.maxkey.web.WebContext;
@@ -49,6 +52,10 @@ public class AccountsController {
 	AccountsService accountsService;
 	
 	@Autowired
+	@Qualifier("accountsStrategyService")
+	AccountsStrategyService accountsStrategyService;
+	
+	@Autowired
 	@Qualifier("appsService")
 	protected AppsService appsService;
 	
@@ -142,4 +149,11 @@ public class AccountsController {
 		
 	}
 	
+    @ResponseBody
+    @RequestMapping(value = "/generate")
+    public String generate(@ModelAttribute("appAccounts") Accounts appAccounts) {
+    	AccountsStrategy accountsStrategy = accountsStrategyService.get(appAccounts.getStrategyId());
+       	UserInfo  userInfo  = userInfoService.get(appAccounts.getUserId());
+    	return accountsService.generateAccount(userInfo,accountsStrategy);
+    }
 }

+ 9 - 1
maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/AccountsStrategyController.java

@@ -57,12 +57,20 @@ public class AccountsStrategyController {
 		return new ModelAndView("accountsstrategy/accountsstrategyList");
 	}
 
+	@RequestMapping(value={"/select"})
+	public ModelAndView selectAccountsStrategyList(){
+		return new ModelAndView("accountsstrategy/selectAccountsStrategy");
+	}
 	
 	@RequestMapping(value = { "/grid" })
 	@ResponseBody
 	public JpaPageResults<AccountsStrategy> queryDataGrid(@ModelAttribute("accountsStrategy") AccountsStrategy accountsStrategy) {
 		_logger.debug(""+accountsStrategy);
-		return accountsStrategyService.queryPageResults(accountsStrategy);
+		JpaPageResults<AccountsStrategy> accountsStrategyList =accountsStrategyService.queryPageResults(accountsStrategy);
+		for (AccountsStrategy strategy : accountsStrategyList.getRows()){
+			WebContext.setAttribute(strategy.getId(), strategy.getAppIcon());
+		}
+		return accountsStrategyList;
 	}
 
 	

+ 4 - 1
maxkey-webs/maxkey-web-mgt/src/main/resources/messages/message.properties

@@ -313,7 +313,6 @@ apps.extendAttr.parameter.type=\u7c7b\u578b
 apps.extendAttr.parameter.value=\u503c
 apps.principal=\u51ed\u8bc1
 apps.credentials=\u79d8\u94a5
-apps.accountMgmt=\u8D26\u53F7\u7BA1\u7406
 #adapter
 apps.adapter.name=\u540D\u79F0
 apps.adapter.adapter=\u9002\u914D\u5668
@@ -456,6 +455,10 @@ accounts.strategy.name=\u7B56\u7565\u540D\u79F0
 accounts.strategy.mapping=\u8D26\u53F7\u6620\u5C04
 accounts.strategy.filters=\u7528\u6237\u6761\u4EF6
 accounts.strategy.orgidslist=\u673A\u6784\u5217\u8868
+accounts.strategy.suffixes=\u540E\u7F00
+accounts.strategy.createType=\u65B9\u5F0F
+accounts.strategy.createType.manual=\u624B\u52A8
+accounts.strategy.createType.automatic=\u81EA\u52A8
 #socials.provider
 socials.provider.id=\u7F16\u53F7
 socials.provider.provider=\u63D0\u4F9B\u8005

+ 4 - 1
maxkey-webs/maxkey-web-mgt/src/main/resources/messages/message_en.properties

@@ -316,7 +316,6 @@ apps.extendAttr.parameter.type=type
 apps.extendAttr.parameter.value=value
 apps.principal=principal
 apps.credentials=credentials
-apps.accountMgmt=AccountMgmt
 
 #adapter
 apps.adapter.name=name
@@ -464,6 +463,10 @@ accounts.strategy.name=name
 accounts.strategy.mapping=mapping
 accounts.strategy.filters=filters
 accounts.strategy.orgidslist=orgIdsList
+accounts.strategy.suffixes=suffixes
+accounts.strategy.createType=createType
+accounts.strategy.createType.manual=manual
+accounts.strategy.createType.automatic=automatic
 
 socials.provider.id=Id
 socials.provider.provider=Provider

+ 4 - 1
maxkey-webs/maxkey-web-mgt/src/main/resources/messages/message_zh_CN.properties

@@ -315,7 +315,6 @@ apps.extendAttr.parameter.type=\u7c7b\u578b
 apps.extendAttr.parameter.value=\u503c
 apps.principal=\u51ed\u8bc1
 apps.credentials=\u79d8\u94a5
-apps.accountMgmt=\u8D26\u53F7\u7BA1\u7406
 apps.adapter.name=\u540D\u79F0
 apps.adapter.adapter=\u9002\u914D\u5668
 apps.adapter.protocol=\u534F\u8BAE
@@ -461,6 +460,10 @@ accounts.strategy.name=\u7B56\u7565\u540D\u79F0
 accounts.strategy.mapping=\u8D26\u53F7\u6620\u5C04
 accounts.strategy.filters=\u7528\u6237\u6761\u4EF6
 accounts.strategy.orgidslist=\u673A\u6784\u5217\u8868
+accounts.strategy.suffixes=\u540E\u7F00
+accounts.strategy.createType=\u65B9\u5F0F
+accounts.strategy.createType.manual=\u624B\u52A8
+accounts.strategy.createType.automatic=\u81EA\u52A8
 #socials.provider
 socials.provider.id=\u7F16\u53F7
 socials.provider.provider=\u63D0\u4F9B\u8005

+ 17 - 1
maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/accounts/accountsAdd.ftl

@@ -17,6 +17,19 @@
                 $("#relatedPassword").val(data+"");
             }); 
         });
+        
+        $("#generateAccountBtn").on("click",function(){
+            $.post("<@base/>/accounts/generate/", {
+                        _method:"post",
+                        userId : $("#userId").val(),
+                        appId : $("#appId").val(),
+                        strategyId : $("#strategyId").val(),
+                        currTime:(new Date()).getTime()
+                        }, function(data) {
+                $("#relatedUsername").val(data+"");
+            }); 
+        });
+        
         $("#view").on("click",function(){
             if($("#relatedPassword").attr("type")=="text"){
                 $("#relatedPassword").attr("type","password");
@@ -73,7 +86,7 @@
 				</td>
 				<td>
 				    <input class="button btn btn-primary mr-3 window"  type="button"    id="selectAppsubmitBtn" value="<@locale code="button.text.select" />"
-                      wurl="<@base/>/apps/select?accountMgmt=1"
+                      wurl="<@base/>/accountsstrategy/select"
                                     wwidth="800"
                                     wheight="620"
                                     target="window"/>
@@ -86,6 +99,7 @@
 
 				</td>
 				<td>
+				    <input class="button btn btn-primary mr-3"  type="button"    id="generateAccountBtn" value="<@locale code="button.text.generate" />"/>
                 </td>
 			</tr>
 			<tr>
@@ -104,7 +118,9 @@
 					<input id="_method" type="hidden" name="_method"  value="post"/>
 					<input id="status" type="hidden" name="status"  value="1"/>
 					<input type="hidden" id="userId" name="userId" class="userId" title="" value="${model.userId!}"/>
+					<input type="hidden" id="strategyId" name="strategyId" class="strategyId" title="" value="${model.strategyId!}"/>
 					<input type="hidden" id="appId" name="appId" class="appId" title="" value="${model.appId!}"/>
+					<input type="hidden" id="createType" name="createType"  title="" value="manual"/>
 			   		<input class="button btn btn-primary mr-3"  type="submit"    id="submitBtn" value="<@locale code="button.text.save" />"/>
 					<input class="button btn btn-secondary mr-3"  type="button"    id="closeBtn" value="<@locale code="button.text.cancel" /> "/>	
 					

+ 22 - 2
maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/accountsstrategy/accountsStrategyAdd.ftl

@@ -215,6 +215,26 @@ function showOrgsTree() {
 				</td>
 			</tr>
 			<tr>
+                <th><@locale code="accounts.strategy.suffixes" />:</th>
+                <td nowrap>
+                    <input type="text" id="suffixes" name="suffixes" class="form-control" title="" value=""   />
+                </td>
+            </tr>
+            <tr>
+                <th><@locale code="accounts.strategy.createType" />:</th>
+                <td nowrap>
+                    <select id="createType" name="createType" class="form-control form-select"   >
+                        <option value="manual"  selected >
+                            <@locale code="accounts.strategy.createType.manual" />
+                        </option>
+                        <option value="automatic"   >
+                            <@locale code="accounts.strategy.createType.automatic" />
+                        </option>
+                    </select>
+                    
+                </td>
+            </tr>
+			<tr>
 				<th><@locale code="accounts.strategy.orgidslist" />:</th>
 				<td nowrap>
 					<input type="text" id="orgIdsListName" name="orgIdsListName"   readonly  class="form-control" title="" value=""   onclick="showOrgsTree();"/>
@@ -224,13 +244,13 @@ function showOrgsTree() {
 			<tr>
 				<th><@locale code="accounts.strategy.filters" />:</th>
 				<td nowrap>
-					<textarea id="filters" name="filters" class="form-control"  rows="4" cols="20"></textarea>
+					<textarea id="filters" name="filters" class="form-control"  rows="3" cols="20"></textarea>
 				</td>
 			</tr>
 			<tr>
                 <th><@locale code="common.text.description" />:</th>
                 <td nowrap>
-                    <textarea id="description" name="description" class="form-control"  rows="3" cols="20"></textarea>
+                    <textarea id="description" name="description" class="form-control"  rows="2" cols="20"></textarea>
                 </td>
             </tr>
 			

+ 17 - 5
maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/accountsstrategy/accountsStrategyList.ftl

@@ -5,8 +5,17 @@
 	<#include  "../layout/common.cssjs.ftl"/>
 	<script type="text/javascript">	
 		function dynamicFormatter(value, row, index){
-	  		return value=='0'? '<@locale code="common.text.no" />':'<@locale code="common.text.yes" />';
-		};
+            return value=='0'? '<@locale code="common.text.no" />':'<@locale code="common.text.yes" />';
+        };
+        function createTypeFormatter(value, row, index){
+            return value=='manual'? 
+                '<@locale code="accounts.strategy.createType.manual" />'
+                :'<@locale code="accounts.strategy.createType.automatic" />';
+        };
+        
+        function iconFormatter(value, row, index){
+            return "<img width='30'  border='0px' src='<@base/>/image/"+value+"'/>";
+        };
 	</script>
 </head>
 <body> 
@@ -96,9 +105,12 @@
                     <th data-checkbox="true"></th>
                     <th data-sortable="true" data-field="id"   data-visible="false">Id</th>
                     <th data-field="name"><@locale code="accounts.strategy.name"/></th>
-                    <th data-field="appName" ><@locale code="app.name"/></th>
-                    <th data-field="status"  data-formatter="dynamicFormatter"><@locale code="accounts.strategy.status"/></th>
-                    <th data-field="description"><@locale code="common.text.description"/></th>
+                    <th data-field="id"  data-formatter="iconFormatter"><@locale code="apps.icon"/></th>
+                    <th data-field="appId" data-visible="false"><@locale code="apps.id"/></th>
+                    <th data-field="appName" ><@locale code="apps.name"/></th>
+                    <th data-field="createType"  data-formatter="createTypeFormatter" ><@locale code="accounts.strategy.createType" /></th>
+                    <th data-field="status"  data-formatter="dynamicFormatter"><@locale code="common.text.status"/></th>
+                    <th data-field="description"   data-visible="false"><@locale code="common.text.description"/></th>
                     <th data-field="createdBy"    data-visible="false"><@locale code="common.text.createdby"/></th>
                     <th data-field="createdDate"  data-visible="false"><@locale code="common.text.createddate"/></th>
                     <th data-field="modifiedBy"   data-visible="false"><@locale code="common.text.modifiedby"/></th>

+ 22 - 2
maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/accountsstrategy/accountsStrategyUpdate.ftl

@@ -225,6 +225,26 @@ function showOrgsTree() {
                     </select>
                 </td>
             </tr>
+            <tr>
+                <th><@locale code="accounts.strategy.suffixes" />:</th>
+                <td nowrap>
+                    <input type="text" id="suffixes" name="suffixes" class="form-control" title="" value="${model.suffixes!}" />
+                </td>
+            </tr>
+            <tr>
+                <th><@locale code="accounts.strategy.createType" />:</th>
+                <td nowrap>
+                    <select id="createType" name="createType" class="form-control form-select"   >
+                        <option value="manual"  <#if model.createType?contains("manual")>selected</#if> >
+                            <@locale code="accounts.strategy.createType.manual" />
+                        </option>
+                        <option value="automatic" <#if model.createType?contains("automatic")>selected</#if>  >
+                            <@locale code="accounts.strategy.createType.automatic" />
+                        </option>
+                    </select>
+                    
+                </td>
+            </tr>
 		<tr>
 				<th><@locale code="accounts.strategy.orgidslist" />:</th>
 				<td nowrap>
@@ -235,13 +255,13 @@ function showOrgsTree() {
 		<tr>
 			<th><@locale code="accounts.strategy.filters" />:</th>
 			<td nowrap>
-				<textarea id="filters" name="filters" class="form-control"  rows="4" cols="20">${model.filters!}</textarea>
+				<textarea id="filters" name="filters" class="form-control"  rows="3" cols="20">${model.filters!}</textarea>
 			</td>
 		</tr>
 		<tr>
                 <th><@locale code="common.text.description" />:</th>
                 <td nowrap>
-                	<textarea id="description" name="description" class="form-control"  rows="3" cols="20">${model.description!}</textarea>
+                	<textarea id="description" name="description" class="form-control"  rows="2" cols="20">${model.description!}</textarea>
                 </td>
             </tr>
 		<tr>

+ 91 - 0
maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/accountsstrategy/selectAccountsStrategy.ftl

@@ -0,0 +1,91 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<#include  "../layout/header.ftl"/>
+	<#include  "../layout/common.cssjs.ftl"/>
+	<script type="text/javascript">	
+		function dynamicFormatter(value, row, index){
+	  		return value=='0'? '<@locale code="common.text.no" />':'<@locale code="common.text.yes" />';
+		};
+		function createTypeFormatter(value, row, index){
+	  		return value=='manual'? 
+	  			'<@locale code="accounts.strategy.createType.manual" />'
+	  			:'<@locale code="accounts.strategy.createType.automatic" />';
+		};
+		
+		function iconFormatter(value, row, index){
+  			return "<img width='30'  border='0px' src='<@base/>/image/"+value+"'/>";
+		};
+		
+		$(function () {
+			$("#selectBtn").on("click",function(){
+				var seldata=$.dataGridSelRowsData("#datagrid"); 
+				console.log(seldata[0].id+" - "+seldata[0].name);
+				$(".strategyId", window.parent.document).val(seldata[0].id);
+				$(".appId", window.parent.document).val(seldata[0].appId);
+				$(".appName", window.parent.document).val(seldata[0].appName);
+				$.closeWindow();
+			 			
+			});
+		});
+		
+	</script>
+</head>
+<body> 
+			<table  class="table table-bordered">
+ 				<tr>
+		 			<td width="120px"><@locale code="accounts.strategy.name"/>:</td>
+		 			<td width="375px">
+		 				<form id="basic_search_form">
+			 				<input class="form-control" type="text" name="name"  style ="width:150px;float:left;">
+			 				<input  class="button btn btn-primary mr-3"    id="searchBtn" type="button" size="50" value="<@locale code="button.text.search"/>">
+				 			<!--<input  class="button btn btn-secondary"  id="advancedSearchExpandBtn" type="button" size="50"  value="<@locale code="button.text.expandsearch"/>" expandValue="<@locale code="button.text.expandsearch"/>"  collapseValue="<@locale code="button.text.collapsesearch"/>">
+					 		-->
+					 	</form>
+		 			</td>
+		 			<td colspan="2">
+		 				<div >
+		 					<input class="button btn btn-primary mr-3"   id="selectBtn" type="button" value="<@locale code="button.text.select"/>" />
+				 		</div>
+		 			</td>
+		 		</tr>
+		 	</table>
+		
+			 <div id="advanced_search">
+	            <form id="advanced_search_form">
+	                
+	            </form>
+	        </div>
+            <table  data-url="<@base/>/accountsstrategy/grid"
+                id="datagrid"
+                    data-toggle="table"
+                    data-classes="table table-bordered table-hover table-striped"
+                    data-click-to-select="true"
+                    data-pagination="true"
+                    data-total-field="records"
+                    data-page-list="[10, 25, 50, 100]"
+                    data-search="false"
+                    data-locale="zh-CN"
+                    data-query-params="dataGridQueryParams"
+                    data-query-params-type="pageSize"
+                    data-side-pagination="server">
+            <thead>
+                <tr>
+                    <th data-checkbox="true"></th>
+                    <th data-sortable="true" data-field="id"   data-visible="false">Id</th>
+                    <th data-field="name"><@locale code="accounts.strategy.name"/></th>
+                    <th data-field="id"  data-formatter="iconFormatter"><@locale code="apps.icon"/></th>
+                    <th data-field="appId" data-visible="false"><@locale code="apps.id"/></th>
+                    <th data-field="appName" ><@locale code="apps.name"/></th>
+                    <th data-field="createType"  data-formatter="createTypeFormatter" ><@locale code="accounts.strategy.createType" /></th>
+                    <th data-field="status"  data-formatter="dynamicFormatter"><@locale code="common.text.status"/></th>
+                    <th data-field="createdBy"    data-visible="false"><@locale code="common.text.createdby"/></th>
+                    <th data-field="createdDate"  data-visible="false"><@locale code="common.text.createddate"/></th>
+                    <th data-field="modifiedBy"   data-visible="false"><@locale code="common.text.modifiedby"/></th>
+                    <th data-field="modifiedDate" data-visible="false"><@locale code="common.text.modifieddate"/></th>
+        
+                </tr>
+            </thead>
+        </table>	
+</body>
+</html>

+ 3 - 12
maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/apps/appAddCommon.ftl

@@ -24,24 +24,15 @@
          </td>
       </tr>
       <tr>
-         <th><@locale code="apps.loginUrl"/>:</th>
+         <th></th>
          <td colspan="3">
             <input type="text" class="form-control"  id="loginUrl" name="loginUrl" size="100"  title="" value=""  required=""   />
          </td>
       </tr>
       <tr>
-         <th><@locale code="apps.logoutUrl"/>:</th>
-         <td colspan="3">
-            <input type="text" class="form-control"  id="logoutUrl" name="logoutUrl" size="100"  title="" value=""  required=""   />
-         </td>
-      </tr>
-      <tr>
-         <th><@locale code="apps.accountMgmt"/>:</th>
+         <th><@locale code="apps.loginUrl"/>:</th>
          <td>
-         	<select  id="accountMgmt" name="accountMgmt" class="form-control  form-select" >
-				<option value="1" ><@locale code="common.text.status.enabled"/></option>
-				<option value="2" selected ><@locale code="common.text.status.disabled"/></option>
-			</select>
+         	<input type="text" class="form-control"  id="logoutUrl" name="logoutUrl" size="100"  title="" value=""   />
          </td>
          <th><@locale code="apps.logoutType"/></th>
          <td>

+ 1 - 10
maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/apps/appUpdateCommon.ftl

@@ -31,17 +31,8 @@
       </tr>
       <tr>
          <th><@locale code="apps.logoutUrl"/>:</th>
-         <td colspan="3">
-            <input type="text" class="form-control" id="logoutUrl" name="logoutUrl"  title="" value="${model.logoutUrl!}"  required="" />
-         </td>
-      </tr>
-      <tr>
-         <th><@locale code="apps.accountMgmt"/>:</th>
          <td>
-         	<select  id="accountMgmt" name="accountMgmt" class="form-control  form-select" >
-				<option value="1" <#if 1==model.accountMgmt!>selected</#if> ><@locale code="common.text.status.enabled"/></option>
-				<option value="2" <#if 2==model.accountMgmt!>selected</#if> ><@locale code="common.text.status.disabled"/></option>
-			</select>
+         <input type="text" class="form-control" id="logoutUrl" name="logoutUrl"  title="" value="${model.logoutUrl!}" />
          </td>
          <th><@locale code="apps.logoutType"/></th>
          <td>

+ 2 - 2
setEnvVars.bat

@@ -1,7 +1,7 @@
 echo off
 echo set env
-set JAVA_HOME=D:\IDE\jdk-17
-set GRADLE_HOME=D:\IDE\gradle-7.2
+set JAVA_HOME=D:\IDE\jdk-8.0.312.7
+set GRADLE_HOME=C:\IDE\gradle-7.2
 
 call %JAVA_HOME%/bin/java -version
 call %GRADLE_HOME%/bin/gradle -version