| | |
| | | package com.ld.igds.m.service.impl; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.ld.igds.constant.RedisConst; |
| | | import com.ld.igds.inout.InoutConstant; |
| | | import com.ld.igds.inout.dto.InoutParam; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.*; |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 出入库开始前的各种配置 --- 包含流程配置、出入库设备配置、通知单等 |
| | |
| | | @Repository(InoutCommonService.BEAN_ID) |
| | | public class InoutCommonServiceImpl implements InoutCommonService { |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private InoutCommonMapper inoutManagerMapper; |
| | | @Resource |
| | | private InoutCommonMapper inoutCommonMapper; |
| | | |
| | | @Override |
| | | public void flushInoutSysConfCache(InoutSysConf data) { |
| | | |
| | | String key = RedisConst.buildKey(data.getCompanyId(), InoutConstant.CACHE_INOUT_SYS_CONF, data.getDeptId()); |
| | | |
| | | String key = RedisConst.buildKey(data.getDeptId(), InoutConstant.CACHE_INOUT_SYS_CONF); |
| | | redisUtil.set(key, data); |
| | | } |
| | | |
| | | @Override |
| | | public InoutSysConf getCacheInoutSysConf(String companyId, String deptId) { |
| | | if (null == companyId || null == deptId) { |
| | | return null; |
| | | } |
| | | // 从缓存中获取已有的组织编码 |
| | | String key = RedisConst.buildKey(companyId, InoutConstant.CACHE_INOUT_SYS_CONF, deptId); |
| | | |
| | | String key = RedisConst.buildKey(deptId, InoutConstant.CACHE_INOUT_SYS_CONF); |
| | | return (InoutSysConf) redisUtil.get(key); |
| | | } |
| | | |
| | | @Override |
| | | public List<InoutSysConf> getCacheInoutSysConf(String companyId) { |
| | | if (StringUtils.isEmpty(companyId)) { |
| | | return null; |
| | | } |
| | | |
| | | String pattern = RedisConst.buildKey(companyId, InoutConstant.CACHE_INOUT_SYS_CONF); |
| | | |
| | | Set<String> keys = redisUtil.keys(pattern); |
| | | if (null == keys || keys.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | List<InoutSysConf> list = new ArrayList<>(); |
| | | for (String key : keys) { |
| | | list.add((InoutSysConf) redisUtil.get(key)); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public void flushInoutConfCache(String companyId, String deptId) { |
| | | List<InoutConf> list = inoutManagerMapper.listInoutConf(companyId, deptId); |
| | | |
| | | List<InoutConf> list = inoutCommonMapper.listInoutConf(companyId, deptId); |
| | | |
| | | String key = RedisConst.buildKey(companyId, InoutConstant.CACHE_INOUT_CONF_LIST, deptId); |
| | | |
| | | redisUtil.set(key, list); |
| | | |
| | | log.debug("---更新出入库配置信息缓存----"); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @SuppressWarnings("unchecked") |
| | | @Override |
| | | public List<InoutConf> getCacheInoutConf(String companyId, String deptId) { |
| | | if (null == companyId || null == deptId) { |
| | | return null; |
| | | } |
| | | String key = RedisConst.buildKey(companyId, |
| | | InoutConstant.CACHE_INOUT_CONF_LIST, deptId); |
| | | |
| | | String key = RedisConst.buildKey(companyId, InoutConstant.CACHE_INOUT_CONF_LIST, deptId); |
| | | return (List<InoutConf>) redisUtil.get(key); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public void updateInoutConfStatus(String ip, Integer port, String status) { |
| | | inoutManagerMapper.updateInoutConfStatus(ip, port, status); |
| | | inoutCommonMapper.updateInoutConfStatus(ip, port, status); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (StringUtils.isNotEmpty(param.getKey())) { |
| | | param.setKey("%" + param.getKey() + "%"); |
| | | } |
| | | return inoutManagerMapper.listCustomer(param); |
| | | return inoutCommonMapper.listCustomer(param); |
| | | } |
| | | |
| | | // @Override |
| | | // public List<InoutCustomer> listCustomerByNoticeIn(InoutParam param) { |
| | | // if (StringUtils.isEmpty(param.getCompanyId())) { |
| | | // param.setCompanyId(ContextUtil.getCompanyId()); |
| | | // } |
| | | // //设置当前年份 |
| | | // Date date = new Date(); |
| | | // if (null != param.getStart()) { |
| | | // date = param.getStart(); |
| | | // } |
| | | // param.setYear(DateFormatUtils.format(date, "yyyy")); |
| | | // |
| | | // if (StringUtils.isNotEmpty(param.getKey())) { |
| | | // param.setKey("%" + param.getKey() + "%"); |
| | | // } |
| | | // //设置通知单完成状态 |
| | | // param.setType(InoutConstant.COMPLETE_STATUS_NONE); |
| | | // return inoutManagerMapper.listCustomerByNoticeIn(param); |
| | | // } |
| | | |
| | | // @Override |
| | | // public List<InoutCustomer> listCustomerByNoticeOut(InoutParam param) { |
| | | // if (StringUtils.isEmpty(param.getCompanyId())) { |
| | | // param.setCompanyId(ContextUtil.getCompanyId()); |
| | | // } |
| | | // |
| | | // //设置当前年份 |
| | | // Date date = new Date(); |
| | | // if (null != param.getStart()) { |
| | | // date = param.getStart(); |
| | | // } |
| | | // param.setYear(DateFormatUtils.format(date, "yyyy")); |
| | | // |
| | | // if (StringUtils.isNotEmpty(param.getKey())) { |
| | | // param.setKey("%" + param.getKey() + "%"); |
| | | // } |
| | | // //设置通知单完成状态 |
| | | // param.setType(InoutConstant.COMPLETE_STATUS_NONE); |
| | | // return inoutManagerMapper.listCustomerByNoticeOut(param); |
| | | // } |
| | | |
| | | @Override |
| | | public int updateCustomer(NoticeInData data) { |
| | | return inoutManagerMapper.updateCustomer(data); |
| | | return inoutCommonMapper.updateCustomer(data); |
| | | } |
| | | |
| | | @Override |
| | |
| | | companyId = ContextUtil.getCompanyId(); |
| | | } |
| | | |
| | | return inoutManagerMapper.getMaxCustomerId(companyId); |
| | | return inoutCommonMapper.getMaxCustomerId(companyId); |
| | | } |
| | | |
| | | // @Override |
| | | // public InoutNoticeIn getInoutNoticeIn(NoticeInParam param) { |
| | | // List<InoutNoticeIn> list = inoutManagerMapper.listNoticeIn(param); |
| | | // if (null == list || list.isEmpty()) { |
| | | // return null; |
| | | // } |
| | | // return list.get(0); |
| | | // } |
| | | |
| | | |
| | | @Override |
| | | public int updateNoticeIn(NoticeInData data) { |
| | | int i = inoutManagerMapper.updateNoticeIn(data); |
| | | int i = inoutCommonMapper.updateNoticeIn(data); |
| | | if (i == 0) { |
| | | log.info("系统中没有更新到当前用户任务信息,新增一个客户任务!"); |
| | | |
| | |
| | | param.setName("入库通知单"); |
| | | param.setCreateUser(data.getCreateUser()); |
| | | param.setId(data.getId()); |
| | | inoutManagerMapper.addNoticeIn(param); |
| | | inoutCommonMapper.addNoticeIn(param); |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | @Override |
| | | public List<InoutNoticeIn> getUnComNoticeIn(String companyId) { |
| | | return inoutManagerMapper.getUnComNoticeIn(companyId); |
| | | return inoutCommonMapper.getUnComNoticeIn(companyId); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (StringUtils.isEmpty(param.getDeptId())) { |
| | | param.setDeptId(ContextUtil.subDeptId(null)); |
| | | } |
| | | inoutManagerMapper.reSumNoticeInComplete(param); |
| | | inoutCommonMapper.reSumNoticeInComplete(param); |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Integer queryNoticeOut(NoticeParam param) { |
| | | return inoutManagerMapper.queryNoticeOut(param); |
| | | return inoutCommonMapper.queryNoticeOut(param); |
| | | } |
| | | |
| | | @Override |
| | | public Integer queryNoticeIn(NoticeParam param) { |
| | | return inoutManagerMapper.queryNoticeIn(param); |
| | | return inoutCommonMapper.queryNoticeIn(param); |
| | | } |
| | | |
| | | // @Override |
| | | // public InoutNoticeOut getInoutNoticeOut(NoticeOutParam param) { |
| | | // List<InoutNoticeOut> list = inoutManagerMapper.getNoticeOut(param); |
| | | // if (null == list || list.isEmpty()) { |
| | | // return null; |
| | | // } |
| | | // return list.get(0); |
| | | // } |
| | | |
| | | @Override |
| | | public List<InoutNoticeOut> getUnComNoticeOut(String companyId) { |
| | | return inoutManagerMapper.getUnComNoticeOut(companyId); |
| | | return inoutCommonMapper.getUnComNoticeOut(companyId); |
| | | } |
| | | |
| | | |
| | |
| | | if (StringUtils.isEmpty(param.getDeptId())) { |
| | | param.setDeptId(ContextUtil.subDeptId(null)); |
| | | } |
| | | inoutManagerMapper.reSumNoticeOutComplete(param); |
| | | inoutCommonMapper.reSumNoticeOutComplete(param); |
| | | return null; |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<InoutNoticeIn> listNoticeIn(NoticeParam param) { |
| | | return inoutManagerMapper.listNoticeIn(param); |
| | | return inoutCommonMapper.listNoticeIn(param); |
| | | } |
| | | |
| | | @Override |
| | | public List<InoutNoticeOut> listNoticeOut(NoticeParam param) { |
| | | return inoutManagerMapper.listNoticeOut(param); |
| | | return inoutCommonMapper.listNoticeOut(param); |
| | | } |
| | | |
| | | |
| | | } |