|  |  |  | 
|---|
|  |  |  | package com.ld.igds.m.view; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.bstek.bdf2.core.business.IUser; | 
|---|
|  |  |  | import com.bstek.dorado.annotation.DataProvider; | 
|---|
|  |  |  | import com.bstek.dorado.annotation.DataResolver; | 
|---|
|  |  |  | import com.ld.igds.constant.Constant; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.ld.igds.m.service.InoutCommonService; | 
|---|
|  |  |  | import com.ld.igds.models.DicTrigger; | 
|---|
|  |  |  | import com.ld.igds.models.InoutSysConf; | 
|---|
|  |  |  | import com.ld.igds.util.ContextUtil; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import org.springframework.beans.BeanUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 出入库流程配置 | 
|---|
|  |  |  | 
|---|
|  |  |  | * @throws Exception | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @DataProvider | 
|---|
|  |  |  | public InoutSysConf getSysConfData(Map<String, Object> param) { | 
|---|
|  |  |  | List<InoutSysConf> list = inoutConfService.getSysConfData(param); | 
|---|
|  |  |  | InoutSysConf inoutSysConf; | 
|---|
|  |  |  | if (list.isEmpty()) { | 
|---|
|  |  |  | inoutSysConf = new InoutSysConf(); | 
|---|
|  |  |  | saveSysConfData(inoutSysConf); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | inoutSysConf = list.get(0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return inoutSysConf; | 
|---|
|  |  |  | public InoutSysConf getSysConfData() { | 
|---|
|  |  |  | IUser u = ContextUtil.getLoginUser(); | 
|---|
|  |  |  | return  inoutConfService.getSysConfData(u.getCompanyId(),ContextUtil.subDeptId(u)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @DataResolver | 
|---|
|  |  |  | public String saveSysConfData(InoutSysConf data) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(null == data.getDeptId()){ | 
|---|
|  |  |  | data.setDeptId(ContextUtil.subDeptId(null)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null == data.getCompanyId()){ | 
|---|
|  |  |  | data.setCompanyId(ContextUtil.getCompanyId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | inoutConfService.saveSysConfData(data); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | InoutSysConf newData = new InoutSysConf(); | 
|---|
|  |  |  | BeanUtils.copyProperties(data, newData); | 
|---|
|  |  |  | BeanUtils.copyProperties(data, newData); | 
|---|
|  |  |  | inoutManagerService.flushInoutSysConfCache(newData); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|