| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.moral.entity.*;
|
| | | import com.moral.mapper.DictionaryDataMapper;
|
| | | import org.apache.commons.lang3.StringUtils;
|
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
| | | import org.springframework.stereotype.Service;
|
| | |
| | | import com.moral.common.exception.BusinessException;
|
| | | import com.moral.common.util.ResourceUtil;
|
| | | import com.moral.common.util.ValidateUtil;
|
| | | import com.moral.entity.Account;
|
| | | import com.moral.entity.Menu;
|
| | | import com.moral.entity.Organization;
|
| | | import com.moral.entity.Role;
|
| | | import com.moral.mapper.AccountMapper;
|
| | | import com.moral.mapper.OrganizationMapper;
|
| | | import com.moral.service.AccountService;
|
| | |
| | | private OrganizationMapper organizationMapper;
|
| | |
|
| | |
|
| | |
|
| | | @Override
|
| | | public Map<String, Object> getAccountInfoById(String accountId) {
|
| | | Map<String, Object> result = new HashMap<String, Object>();
|
| | |
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public Map<String, Object> webLogin(Map<String, Object> parameters) {
|
| | |
| | | return result;
|
| | | }
|
| | |
|
| | | @Resource
|
| | | DictionaryDataMapper dictionaryDataMapper;
|
| | |
|
| | | @Override
|
| | | public Map<String, Object> bsWebLogin(Map<String, Object> parameters) {
|
| | | Map<String, Object> result = new HashMap<String, Object>();
|
| | | Account account = new Account();
|
| | | account.setAccountName((String) parameters.get("account"));
|
| | | String rawPassword = (String) parameters.get("password");
|
| | | account = accountMapper.selectOne(account);
|
| | | boolean isValid = account == null ? false : encoder.matches(rawPassword, account.getPassword());
|
| | | if (!isValid) {
|
| | | result.put("msg", "用户名及密码输入错误!");
|
| | | result.put("accountId", -1);
|
| | | } else {
|
| | | result = judgeAccountInfo(account);
|
| | | if (!result.get("accountId").equals(-1)){
|
| | | String regionCode = getRegionCodeByAccount(account);
|
| | | if(!ObjectUtils.isEmpty(regionCode))
|
| | | result.put("regionCode",regionCode);
|
| | | }
|
| | |
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | /**
|
| | | * @Description: 根据id获取默认显示的地区码
|
| | | * @Param: [params]
|
| | | * @return: java.util.Map<java.lang.String , java.lang.Object>
|
| | | * @Author: 下雨听风
|
| | | * @Date: 2020/11/25
|
| | | */
|
| | | private String getRegionCodeByAccount(Account account) {
|
| | | Organization organization = new Organization();
|
| | | organization.setId(account.getOrganizationId());
|
| | | organization = organizationMapper.selectOne(organization);
|
| | | Map<String, Object> regionCodeAndType = getRegionCodeAndTypeByOrg(organization);
|
| | | if(ObjectUtils.isEmpty(regionCodeAndType))
|
| | | return null;
|
| | | return (String) regionCodeAndType.get("regionCode");
|
| | | }
|
| | |
|
| | | public static Map<String,Object> getRegionCodeAndTypeByOrg(Organization organization){
|
| | | Map<String,Object> result = new HashMap<>();
|
| | | String regionCode = "";
|
| | | String regionType = "";
|
| | | Long villageCode = organization.getVillageCode();
|
| | | Long townCode = organization.getTownCode();
|
| | | Integer areaCode = organization.getAreaCode();
|
| | | Integer cityCode = organization.getCityCode();
|
| | | Integer provinceCode = organization.getProvinceCode();
|
| | |
|
| | | if(!ObjectUtils.isEmpty(villageCode)){
|
| | | regionCode = String.valueOf(villageCode);
|
| | | regionType = "village";
|
| | | }else if(!ObjectUtils.isEmpty(townCode)){
|
| | | regionCode = String.valueOf(townCode);
|
| | | regionType = "town";
|
| | | }else if(!ObjectUtils.isEmpty(areaCode)){
|
| | | regionCode = String.valueOf(areaCode);
|
| | | regionType = "area";
|
| | | }else if(!ObjectUtils.isEmpty(cityCode)){
|
| | | regionCode = String.valueOf(cityCode);
|
| | | regionType = "city";
|
| | | }else if(!ObjectUtils.isEmpty(provinceCode)){
|
| | | regionCode = String.valueOf(provinceCode);
|
| | | regionType = "province";
|
| | | }else{
|
| | | return null;
|
| | | }
|
| | | result.put("regionCode",regionCode);
|
| | | result.put("regionType",regionType);
|
| | | return result;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|