| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.CateParamSelectMapper; |
| | | import com.doumee.dao.business.model.CateParamSelect; |
| | | import com.doumee.service.CateParamSelectService; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private CateParamSelectMapper cateParamSelectMapper; |
| | | |
| | |
| | | |
| | | @Override |
| | | @Async |
| | | public void dealGroupVals(Integer companyId) { |
| | | Boolean isGrouping = (Boolean)redisTemplate.opsForValue().get(companyId+"_isGrouping"); |
| | | @Transactional |
| | | public void dealCateParamSelect() { |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | Boolean isGrouping = (Boolean)redisTemplate.opsForValue().get(loginUserInfo.getCompanyId()+Constants.CATE_PARAM_OPEN); |
| | | if(isGrouping!=null && isGrouping ){ |
| | | return; |
| | | } |
| | | redisTemplate.opsForValue().set(companyId+"_isGrouping",true); |
| | | redisTemplate.opsForValue().set(loginUserInfo.getCompanyId()+Constants.CATE_PARAM_OPEN,true); |
| | | try { |
| | | //---------TODO-------任康 |
| | | |
| | | //删除企业下历史数据 |
| | | cateParamSelectMapper.delete(new QueryWrapper<CateParamSelect>().exists(" select 1 from category c where c.id = cate_param_select.category_id and c.company_id = "+loginUserInfo.getCompanyId()+" ")); |
| | | //新增当前企业可以使用的数据 |
| | | cateParamSelectMapper.insertBatch(loginUserInfo.getCompanyId(),loginUserInfo.getId()); |
| | | }catch (Exception e){ |
| | | |
| | | e.printStackTrace(); |
| | | }finally { |
| | | redisTemplate.opsForValue().set(companyId+"_isGrouping",false); |
| | | redisTemplate.opsForValue().set(loginUserInfo.getCompanyId()+Constants.CATE_PARAM_OPEN,false); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |