/** * */ package com.product.admin.service; import com.product.admin.config.CmnConst; import com.product.common.lang.StringUtils; import com.product.core.cache.DataPoolCacheImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.product.core.dao.BaseDao; import com.product.core.entity.FieldSetEntity; import com.product.core.exception.BaseException; import com.product.core.service.support.AbstractBaseService; import com.product.core.spring.context.SpringMVCContextHolder; import com.product.module.sys.entity.SystemUser; /** * Copyright LX-BASE * * @Title: * @Project: LX-BASE-SERVER * @Date: 2020年6月12日 下午6:29:16 * @Author: 郑盟 * @Description: */ @Component public class UserDefaultLanguageService extends AbstractBaseService { @Autowired public BaseDao baseDao; /** * 修改员工默认语言 * @param fs * @return * @throws BaseException */ public boolean updateLanguage(FieldSetEntity fs) throws BaseException { String userId = null; SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); if (currentUser != null) { userId = currentUser.getUuid(); } if (StringUtils.isEmpty(userId) || StringUtils.isEmpty(fs.getString(CmnConst.LANGUAGE_CODE))) { return false; } boolean update = baseDao.executeUpdate("UPDATE product_sys_users SET default_language=? where uuid =?", new Object[]{fs.getString("language_code"), userId}); if (update && currentUser != null) { //2020年12月30日11:57:37 xupengcheng 更新用户默认语言 currentUser.setLanguageCode(fs.getString(CmnConst.LANGUAGE_CODE)); currentUser.setDefault_language(fs.getString(CmnConst.LANGUAGE_CODE)); //token与用户关联,放入缓存中 DataPoolCacheImpl.getInstance().updateSessionUser(currentUser); } return update; } }