| | |
| | | import com.ld.igds.check.service.CoreCheckStandardService; |
| | | import com.ld.igds.util.ContextUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<CheckItemData> getCheckItemById(String checkId, String companyId) { |
| | | return checkStandardMapper.getCheckItemById(checkId, companyId); |
| | | List<CheckItemData> result = checkStandardMapper.getCheckItemById(checkId, companyId); |
| | | for (CheckItemData data : result) { |
| | | if (data.getUpperLimit() > 0.0 && StringUtils.isNotEmpty(data.getOperaSymbol())) { |
| | | data.setOperaSymbolValue(data.getOperaSymbol() + " " + data.getUpperLimit()); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<CheckItemData> getCheckItemByStandard(String checkId, String companyId, |
| | | String deptId, String foodVariety) { |
| | | public List<CheckItemData> getCheckItemByStandard(String companyId,String checkId,String foodVariety) { |
| | | |
| | | List<CheckItemData> result = new ArrayList<>(); |
| | | |
| | | if (StringUtils.isEmpty(foodVariety)) { |
| | | return result; |
| | | } |
| | | List<CheckStandardData> list = this.getCheckStandard(companyId, deptId, foodVariety); |
| | | |
| | | if (StringUtils.isEmpty(companyId)) { |
| | | companyId = ContextUtil.getDefaultCompanyId(); |
| | | } |
| | | |
| | | List<CheckStandardData> list = checkStandardMapper.getCheckStandard(companyId, foodVariety); |
| | | if (null == list) { |
| | | return result; |
| | | } |
| | |
| | | CheckItemData item; |
| | | for (CheckStandardData data : list) { |
| | | item = new CheckItemData(); |
| | | BeanUtils.copyProperties(data, item); |
| | | item.setCheckId(checkId); |
| | | item.setCompanyId(companyId); |
| | | item.setStandardId(data.getStandardId()); |
| | | item.setStandardName(data.getStandardName()); |
| | | item.setUnit(data.getUnit()); |
| | | item.setUpperLimit(data.getUpperLimit()); |
| | | item.setRuleNum(data.getRuleNum()); |
| | | item.setRuleAdd(data.getRuleAdd()); |
| | | item.setRuleAddEnd(data.getRuleAddEnd()); |
| | | item.setRuleReduce(data.getRuleReduce()); |
| | | item.setOperaSymbol(data.getOperaSymbol()); |
| | | |
| | | if (data.getUpperLimit() > 0.0) { |
| | | item.setStandardValue(data.getUpperLimit() + ""); |
| | | if(null != data.getOperaSymbol()){ |
| | | item.setStandardValue(data.getOperaSymbol() +" " + data.getUpperLimit()); |
| | | } |
| | | if (null != data.getUpperLimit() && data.getUpperLimit() > 0.0 && StringUtils.isNotEmpty(data.getOperaSymbol())) { |
| | | item.setOperaSymbolValue(data.getOperaSymbol() + " " + data.getUpperLimit()); |
| | | } |
| | | result.add(item); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<CheckStandardData> getCheckStandard(String companyId, String deptId, String foodVariety) { |
| | | if (StringUtils.isEmpty(companyId)) { |
| | | companyId = ContextUtil.getDefaultCompanyId(); |
| | | } |
| | | if (StringUtils.isEmpty(deptId)) { |
| | | companyId = ContextUtil.subDeptId(ContextUtil.getLoginUser()); |
| | | } |
| | | |
| | | return checkStandardMapper.getCheckStandard(companyId, deptId, foodVariety); |
| | | } |
| | | |
| | | } |