| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.fzzy.igds.constant.Constant; |
| | | import com.fzzy.igds.constant.RedisConst; |
| | | import com.fzzy.igds.mapper.InoutConfMapper; |
| | | import com.fzzy.igds.mapper.InoutSysConfMapper; |
| | | import com.fzzy.igds.domain.Dept; |
| | | import com.fzzy.igds.domain.InoutConf; |
| | | import com.fzzy.igds.domain.InoutSysConf; |
| | | import com.fzzy.igds.mapper.InoutConfMapper; |
| | | import com.fzzy.igds.mapper.InoutSysConfMapper; |
| | | import com.fzzy.igds.utils.ContextUtil; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | |
| | | public class InoutConfService { |
| | | @Resource |
| | | private ISysDeptService iSysDeptService; |
| | | @Resource |
| | | private CoreDeptService deptService; |
| | | @Resource |
| | | private InoutConfMapper inoutConfMapper; |
| | | @Resource |
| | |
| | | * @return |
| | | */ |
| | | public List<InoutConf> getInoutConfList(String companyId, String deptId) { |
| | | QueryWrapper<InoutConf> queryWrapper = new QueryWrapper<>(); |
| | | |
| | | if (StringUtils.isEmpty(companyId)) { |
| | | companyId = ContextUtil.getCompanyId(); |
| | | } |
| | | if (StringUtils.isEmpty(deptId)) { |
| | | deptId = ContextUtil.subDeptId(null); |
| | | } |
| | | QueryWrapper<InoutConf> queryWrapper = new QueryWrapper<>(); |
| | | |
| | | queryWrapper.eq("dept_id", deptId); |
| | | queryWrapper.eq("company_id", companyId); |
| | | |
| | | if (StringUtils.isNotEmpty(deptId)) { |
| | | queryWrapper.eq("dept_id", deptId); |
| | | }else { |
| | | queryWrapper.likeRight("dept_id", ContextUtil.subDeptId(null)); |
| | | } |
| | | |
| | | return inoutConfMapper.selectList(queryWrapper); |
| | | } |
| | |
| | | * 设置缓存 |
| | | * |
| | | * @param companyId |
| | | * @param deptId |
| | | */ |
| | | public void flushInoutConfCache(String companyId, String deptId) { |
| | | List<InoutConf> list = this.getInoutConfList(companyId, deptId); |
| | | String key = RedisConst.buildKey(companyId, Constant.CACHE_INOUT_CONF_LIST, deptId); |
| | | redisCache.setCacheObject(key, list); |
| | | public void flushInoutConfCache(String companyId) { |
| | | List<Dept> depts = deptService.listDept(null, companyId, null); |
| | | if(null == depts || depts.isEmpty()){ |
| | | return; |
| | | } |
| | | List<InoutConf> inoutConfList; |
| | | for (Dept dept : depts) { |
| | | inoutConfList = this.getInoutConfList(companyId, dept.getId()); |
| | | if(null == inoutConfList || inoutConfList.isEmpty()){ |
| | | continue; |
| | | } |
| | | String key = RedisConst.buildKey(companyId, Constant.CACHE_INOUT_CONF_LIST, dept.getId()); |
| | | redisCache.setCacheObject(key, inoutConfList); |
| | | } |
| | | } |
| | | |
| | | /** |