|
@@ -7,6 +7,7 @@ import com.dgtly.common.core.controller.ApiBaseController;
|
|
|
import com.dgtly.common.core.domain.AjaxResult;
|
|
import com.dgtly.common.core.domain.AjaxResult;
|
|
|
import com.dgtly.common.core.domain.ParameterObject;
|
|
import com.dgtly.common.core.domain.ParameterObject;
|
|
|
import com.dgtly.common.core.domain.Ztree;
|
|
import com.dgtly.common.core.domain.Ztree;
|
|
|
|
|
+import com.dgtly.common.utils.StringUtils;
|
|
|
import com.dgtly.common.utils.bean.EnDecoderUtil;
|
|
import com.dgtly.common.utils.bean.EnDecoderUtil;
|
|
|
import com.dgtly.common.utils.bean.HexUtils;
|
|
import com.dgtly.common.utils.bean.HexUtils;
|
|
|
import com.dgtly.common.utils.http.HttpUtils;
|
|
import com.dgtly.common.utils.http.HttpUtils;
|
|
@@ -28,11 +29,13 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
import java.net.URLDecoder;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import static com.dgtly.common.utils.bean.EnDecoderUtil.DESdecode;
|
|
import static com.dgtly.common.utils.bean.EnDecoderUtil.DESdecode;
|
|
@@ -478,6 +481,11 @@ public class WxController extends ApiBaseController {
|
|
|
return AjaxResult.error(301,"根据Ticket获取用户信息失败");
|
|
return AjaxResult.error(301,"根据Ticket获取用户信息失败");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ JdbcTemplate jdbcTemplate;
|
|
|
@ApiOperation(value = "根据账户密码获取用户信息",notes = "参数:{'username':'1','password':'xxx'}" +
|
|
@ApiOperation(value = "根据账户密码获取用户信息",notes = "参数:{'username':'1','password':'xxx'}" +
|
|
|
" 错误:301 密码错误" +
|
|
" 错误:301 密码错误" +
|
|
|
"错误:302 查无此人")
|
|
"错误:302 查无此人")
|
|
@@ -485,31 +493,44 @@ public class WxController extends ApiBaseController {
|
|
|
@ApiImplicitParam(name = "params" , paramType = "body")
|
|
@ApiImplicitParam(name = "params" , paramType = "body")
|
|
|
})
|
|
})
|
|
|
@PostMapping("/getUserByPassWord")
|
|
@PostMapping("/getUserByPassWord")
|
|
|
- public Object getUserByPassWord(){
|
|
|
|
|
- ParameterObject obj = getParameterObject();
|
|
|
|
|
|
|
+ public Object getUserByPassWord() {
|
|
|
|
|
+ ParameterObject obj = getParameterObject();
|
|
|
obj.checkParameterNotNull("username,password");
|
|
obj.checkParameterNotNull("username,password");
|
|
|
String username = obj.getString("username");
|
|
String username = obj.getString("username");
|
|
|
String password = obj.getString("password");
|
|
String password = obj.getString("password");
|
|
|
SysUser user = sysUserService.selectUserByLoginName(username);
|
|
SysUser user = sysUserService.selectUserByLoginName(username);
|
|
|
- if(user==null){
|
|
|
|
|
- return AjaxResult.error(302,"查无此人");
|
|
|
|
|
|
|
+ if (user == null) {
|
|
|
|
|
+ return AjaxResult.error(302, "查无此人");
|
|
|
}
|
|
}
|
|
|
- String pass = EncryptPassWordClass.encryptPassword(user.getLoginName(),password,user.getSalt());
|
|
|
|
|
- if(pass.equals(user.getPassword())){
|
|
|
|
|
- List<Ztree> author = sysUserOrderAuthorService.userAuthorTreeDataFmt(user.getUserId());
|
|
|
|
|
- if (author.size() > 0 && author.get(0).getChildren().size() > 1) {
|
|
|
|
|
- user.setAuthorType("TUC");
|
|
|
|
|
- } else if (author.size() > 0 && author.get(0).getChildren().size() == 1) {//设置BUSINESS_UNIT
|
|
|
|
|
- user.setAuthorType(author.get(0).getChildren().get(0).getCode());
|
|
|
|
|
- }else{
|
|
|
|
|
- user.setAuthorType("DIY");//默认diy
|
|
|
|
|
|
|
+ String pass = EncryptPassWordClass.encryptPassword(user.getLoginName(), password, user.getSalt());
|
|
|
|
|
+ if (pass.equals(user.getPassword())) {
|
|
|
|
|
+ List<Map<String, Object>> loginTypeList = jdbcTemplate.queryForList("select dict_label,dict_value from sys_dict_data where dict_type='system_login_type' ");
|
|
|
|
|
+ if ("1".equals(user.getIsShopAccount())) {
|
|
|
|
|
+ List<Map<String, Object>> result = new ArrayList<>();
|
|
|
|
|
+ for (int i = 0; i < loginTypeList.size(); i++) {
|
|
|
|
|
+ ConcurrentHashMap m = new ConcurrentHashMap<>();
|
|
|
|
|
+ m.put("shopType", loginTypeList.get(i).get("dict_label"));
|
|
|
|
|
+ m.put("shopTypeValue", loginTypeList.get(i).get("dict_value"));
|
|
|
|
|
+ List<Map<String, Object>> shopList = jdbcTemplate.queryForList("select shop_code,shop_name,sales_level from sys_user_shop_ext where user_id=? and is_shop_type=? and del_flag='0'", user.getUserId(), loginTypeList.get(i).get("dict_value"));
|
|
|
|
|
+ m.put("shopList", shopList);
|
|
|
|
|
+ result.add(m);
|
|
|
|
|
+ }
|
|
|
|
|
+ user.setLoginTypeList(result);
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Ztree> author = sysUserOrderAuthorService.userAuthorTreeDataFmt(user.getUserId());
|
|
|
|
|
+ if (author.size() > 0 && author.get(0).getChildren().size() > 1) {
|
|
|
|
|
+ user.setAuthorType("TUC");
|
|
|
|
|
+ } else if (author.size() > 0 && author.get(0).getChildren().size() == 1) {//设置BUSINESS_UNIT
|
|
|
|
|
+ user.setAuthorType(author.get(0).getChildren().get(0).getCode());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ user.setAuthorType("DIY");//默认diy
|
|
|
|
|
+ }
|
|
|
|
|
+ user.setAuthor(author);
|
|
|
|
|
+ return AjaxResult.success().putKV("sysUser", user);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return AjaxResult.error(301, "密码错误");
|
|
|
}
|
|
}
|
|
|
- user.setAuthor(author);
|
|
|
|
|
- return AjaxResult.success().putKV("sysUser",user);
|
|
|
|
|
- }else{
|
|
|
|
|
- return AjaxResult.error(301,"密码错误");
|
|
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "JS-SDK使用权限签名算法", notes = "参数:agent,非必填值为1获取应用签名, 否则获取企业签名")
|
|
@ApiOperation(value = "JS-SDK使用权限签名算法", notes = "参数:agent,非必填值为1获取应用签名, 否则获取企业签名")
|
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|