|  |  |  | 
|---|
|  |  |  | import com.ld.igds.phone35.param.Phone35InoutCommonParam; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.springframework.stereotype.Component; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.HashMap; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 新版手机3.5,数据查询 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @author chen | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Component | 
|---|
|  |  |  | public class HPhoneServiceImpl extends HibernateDao { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询用户 | 
|---|
|  |  |  | * @param username | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public DefaultUser getUserByUsername(String username) { | 
|---|
|  |  |  | String hql = " from " + DefaultUser.class.getName() + " where username =:username"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询用户 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param username | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public DefaultUser getUserByUsername(String username) { | 
|---|
|  |  |  | String hql = " from " + DefaultUser.class.getName() + " where username =:username"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("username", username); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("username", username); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<DefaultUser> list = this.query(hql, args); | 
|---|
|  |  |  | if(list == null || list.isEmpty()){ | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return list.get(0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<DefaultUser> list = this.query(hql, args); | 
|---|
|  |  |  | if (list == null || list.isEmpty()) { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return list.get(0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取库区列表信息 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<DefaultDept> listDept(String companyId) { | 
|---|
|  |  |  | String hql = " from " + DefaultDept.class.getName() + " where companyId =:companyId and val =:val"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取库区列表信息 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<DefaultDept> listDept(String companyId) { | 
|---|
|  |  |  | String hql = " from " + DefaultDept.class.getName() + " where companyId =:companyId and val =:val"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | //库区启用 | 
|---|
|  |  |  | args.put("val", Constant.YN_Y); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | //库区启用 | 
|---|
|  |  |  | args.put("val", Constant.YN_Y); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " and parentId is not null"; | 
|---|
|  |  |  | hql += " order by id"; | 
|---|
|  |  |  | hql += " and parentId is not null"; | 
|---|
|  |  |  | hql += " order by id"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取仓库列表信息 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param deptId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<Depot> listDepot(String companyId, String deptId) { | 
|---|
|  |  |  | String hql = " from " + Depot.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取仓库列表信息 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param deptId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<Depot> listDepot(String companyId, String deptId) { | 
|---|
|  |  |  | String hql = " from " + Depot.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(deptId)){ | 
|---|
|  |  |  | hql += " and deptId =:deptId"; | 
|---|
|  |  |  | args.put("deptId", deptId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | hql += " order by id"; | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(deptId)) { | 
|---|
|  |  |  | hql += " and deptId =:deptId"; | 
|---|
|  |  |  | args.put("deptId", deptId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | hql += " order by id"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询出入库信息,用于查询出入库记录、待值仓列表等 | 
|---|
|  |  |  | * @param param | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<InoutRecord> listInoutRecord(Phone35InoutCommonParam param) { | 
|---|
|  |  |  | String hql = " from " + InoutRecord.class.getName() + " where companyId =:companyId" | 
|---|
|  |  |  | + " and recordStatus <>:recordStatus1 and recordStatus <>:recordStatus2"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询出入库信息,用于查询出入库记录、待值仓列表等 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param param | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<InoutRecord> listInoutRecord(Phone35InoutCommonParam param) { | 
|---|
|  |  |  | String hql = " from " + InoutRecord.class.getName() + " where companyId =:companyId" | 
|---|
|  |  |  | + " and recordStatus <>:recordStatus1 "; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", param.getCompanyId()); | 
|---|
|  |  |  | args.put("recordStatus1", InoutConstant.RECORD_STATUS_DEL); | 
|---|
|  |  |  | args.put("recordStatus2", InoutConstant.RECORD_STATUS_ERROR); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", param.getCompanyId()); | 
|---|
|  |  |  | args.put("recordStatus1", InoutConstant.RECORD_STATUS_DEL); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(param.getDeptId())){ | 
|---|
|  |  |  | hql += " and deptId =:deptId"; | 
|---|
|  |  |  | args.put("deptId", param.getDeptId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(param.getDeptId())){ | 
|---|
|  |  |  | hql += " and progress =:progress"; | 
|---|
|  |  |  | args.put("progress", param.getProgress()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(param.getType())){ | 
|---|
|  |  |  | hql += " and type =:type"; | 
|---|
|  |  |  | args.put("type", param.getType()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != param.getStartTime()){ | 
|---|
|  |  |  | hql += " and completeTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", param.getStartTime()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != param.getEndTime()){ | 
|---|
|  |  |  | hql += " and completeTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", param.getEndTime()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(param.getPlateNum())){ | 
|---|
|  |  |  | hql += " and plateNum =:plateNum"; | 
|---|
|  |  |  | args.put("plateNum", "%" + param.getPlateNum() + "%"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(param.getType())){ | 
|---|
|  |  |  | hql += " and intelCard =:intelCard"; | 
|---|
|  |  |  | args.put("intelCard", param.getIntelCard()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | hql += " order by registerTime"; | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(param.getDeptId())) { | 
|---|
|  |  |  | hql += " and deptId =:deptId"; | 
|---|
|  |  |  | args.put("deptId", param.getDeptId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(param.getProgress())) { | 
|---|
|  |  |  | hql += " and progress =:progress"; | 
|---|
|  |  |  | args.put("progress", param.getProgress()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(param.getType())) { | 
|---|
|  |  |  | hql += " and type =:type"; | 
|---|
|  |  |  | args.put("type", param.getType()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != param.getStartTime()) { | 
|---|
|  |  |  | hql += " and completeTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", param.getStartTime()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != param.getEndTime()) { | 
|---|
|  |  |  | hql += " and completeTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", param.getEndTime()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(param.getPlateNum())) { | 
|---|
|  |  |  | hql += " and plateNum =:plateNum"; | 
|---|
|  |  |  | args.put("plateNum", "%" + param.getPlateNum() + "%"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(param.getIntelCard())) { | 
|---|
|  |  |  | hql += " and intelCard =:intelCard"; | 
|---|
|  |  |  | args.put("intelCard", param.getIntelCard()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | hql += " order by registerTime"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据组织编码、库区编码、流水id查询出入库信息 | 
|---|
|  |  |  | * 用于判断当前数据是否在值仓流程 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param deptId | 
|---|
|  |  |  | * @param id | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public InoutRecord getInoutRecord(String companyId, String deptId, String id, String intelCard) { | 
|---|
|  |  |  | String hql = " from " + InoutRecord.class.getName() + " where" + " and recordStatus <>:recordStatus1 and recordStatus <>:recordStatus2"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据组织编码、库区编码、流水id查询出入库信息 | 
|---|
|  |  |  | * 用于判断当前数据是否在值仓流程 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param deptId | 
|---|
|  |  |  | * @param id | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public InoutRecord getInoutRecord(String companyId, String deptId, String id, String intelCard) { | 
|---|
|  |  |  | String hql = " from " + InoutRecord.class.getName() + " where" + " recordStatus <>:recordStatus1 "; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | args.put("recordStatus1", InoutConstant.RECORD_STATUS_DEL); | 
|---|
|  |  |  | args.put("recordStatus2", InoutConstant.RECORD_STATUS_ERROR); | 
|---|
|  |  |  | args.put("recordStatus1", InoutConstant.RECORD_STATUS_DEL); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(companyId)){ | 
|---|
|  |  |  | hql += " and companyId =:companyId"; | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(deptId)){ | 
|---|
|  |  |  | hql += " and deptId =:deptId"; | 
|---|
|  |  |  | args.put("deptId", deptId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(id)){ | 
|---|
|  |  |  | hql += " and id =:id"; | 
|---|
|  |  |  | args.put("id", id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(intelCard)){ | 
|---|
|  |  |  | hql += " and intelCard =:intelCard"; | 
|---|
|  |  |  | args.put("intelCard", intelCard); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | hql += " order by registerTime"; | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(companyId)) { | 
|---|
|  |  |  | hql += " and companyId =:companyId"; | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(deptId)) { | 
|---|
|  |  |  | hql += " and deptId =:deptId"; | 
|---|
|  |  |  | args.put("deptId", deptId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(id)) { | 
|---|
|  |  |  | hql += " and id =:id"; | 
|---|
|  |  |  | args.put("id", id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(intelCard)) { | 
|---|
|  |  |  | hql += " and intelCard =:intelCard"; | 
|---|
|  |  |  | args.put("intelCard", intelCard); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | hql += " order by registerTime desc"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<InoutRecord> list = this.query(hql, args); | 
|---|
|  |  |  | if(null == list || list.isEmpty()){ | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return list.get(0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<InoutRecord> list = this.query(hql, args); | 
|---|
|  |  |  | if (null == list || list.isEmpty()) { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return list.get(0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询仓房信息数据----接口1103使用 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param deptId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<Building> listBuilding(String companyId, String deptId) { | 
|---|
|  |  |  | String hql = " from " + Building.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询仓房信息数据----接口1103使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param deptId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<Building> listBuilding(String companyId, String deptId) { | 
|---|
|  |  |  | String hql = " from " + Building.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(deptId)){ | 
|---|
|  |  |  | hql += " and deptId =:deptId"; | 
|---|
|  |  |  | args.put("deptId", deptId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(deptId)) { | 
|---|
|  |  |  | hql += " and deptId =:deptId"; | 
|---|
|  |  |  | args.put("deptId", deptId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " order by id desc"; | 
|---|
|  |  |  | hql += " order by id desc"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据仓房id获取仓房信息 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param id | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public Building getBuilding(String companyId, String id) { | 
|---|
|  |  |  | if(StringUtils.isEmpty(id)){ | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String hql = " from " + Building.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据仓房id获取仓房信息 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param id | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public Building getBuilding(String companyId, String id) { | 
|---|
|  |  |  | if (StringUtils.isEmpty(id)) { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String hql = " from " + Building.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " and id =:id"; | 
|---|
|  |  |  | args.put("id", id); | 
|---|
|  |  |  | hql += " and id =:id"; | 
|---|
|  |  |  | args.put("id", id); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " order by id desc"; | 
|---|
|  |  |  | hql += " order by id desc"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<Building> buildings = this.query(hql, args); | 
|---|
|  |  |  | if(buildings == null || buildings.isEmpty()){ | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return buildings.get(0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<Building> buildings = this.query(hql, args); | 
|---|
|  |  |  | if (buildings == null || buildings.isEmpty()) { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return buildings.get(0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询文件信息数据----接口1112使用 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<FileInfo> listFiles(String companyId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + FileInfo.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询文件信息数据----接口1112使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<FileInfo> listFiles(String companyId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + FileInfo.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | if(null != startTime){ | 
|---|
|  |  |  | hql += " and createTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != endTime){ | 
|---|
|  |  |  | hql += " and createTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | if (null != startTime) { | 
|---|
|  |  |  | hql += " and createTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != endTime) { | 
|---|
|  |  |  | hql += " and createTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " order by createTime desc"; | 
|---|
|  |  |  | hql += " order by createTime desc"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询质检数据----接口1201使用 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<MQuality> listQuality(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + MQuality.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询质检数据----接口1201使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<MQuality> listQuality(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + MQuality.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(depotId)){ | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(depotId)) { | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(null != startTime){ | 
|---|
|  |  |  | hql += " and time >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != endTime){ | 
|---|
|  |  |  | hql += " and time <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != startTime) { | 
|---|
|  |  |  | hql += " and time >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != endTime) { | 
|---|
|  |  |  | hql += " and time <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " order by time desc"; | 
|---|
|  |  |  | hql += " order by time desc"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 询质检明细数据----接口1202使用 | 
|---|
|  |  |  | * @param checkId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<CheckItem> listQualityDetail(String checkId) { | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 询质检明细数据----接口1202使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param checkId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<CheckItem> listQualityDetail(String checkId) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String hql = " from " + CheckItem.class.getName() + " where checkId =:checkId"; | 
|---|
|  |  |  | String hql = " from " + CheckItem.class.getName() + " where checkId =:checkId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("checkId", checkId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("checkId", checkId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询倒仓信息数据----接口1309使用 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<InoutStockChange> listStockChange(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + InoutStockChange.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询倒仓信息数据----接口1309使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<InoutStockChange> listStockChange(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + InoutStockChange.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(depotId)){ | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(depotId)) { | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(null != startTime){ | 
|---|
|  |  |  | hql += " and updateTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != endTime){ | 
|---|
|  |  |  | hql += " and updateTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != startTime) { | 
|---|
|  |  |  | hql += " and updateTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != endTime) { | 
|---|
|  |  |  | hql += " and updateTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " order by updateTime desc"; | 
|---|
|  |  |  | hql += " order by updateTime desc"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询损溢单数据----接口1311使用 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<InoutLossOver> listLossOver(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + InoutLossOver.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询损溢单数据----接口1311使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<InoutLossOver> listLossOver(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + InoutLossOver.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(depotId)){ | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(depotId)) { | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(null != startTime){ | 
|---|
|  |  |  | hql += " and submitTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != endTime){ | 
|---|
|  |  |  | hql += " and submitTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != startTime) { | 
|---|
|  |  |  | hql += " and submitTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != endTime) { | 
|---|
|  |  |  | hql += " and submitTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " order by submitTime"; | 
|---|
|  |  |  | hql += " order by submitTime"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询粮食性质变更信息----接口1312使用 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<InoutVarietyChange> listFoodVarietyChange(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + InoutVarietyChange.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询粮食性质变更信息----接口1312使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<InoutVarietyChange> listFoodVarietyChange(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + InoutVarietyChange.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(depotId)){ | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(depotId)) { | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(null != startTime){ | 
|---|
|  |  |  | hql += " and changeTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != endTime){ | 
|---|
|  |  |  | hql += " and changeTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != startTime) { | 
|---|
|  |  |  | hql += " and changeTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != endTime) { | 
|---|
|  |  |  | hql += " and changeTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " order by changeTime"; | 
|---|
|  |  |  | hql += " order by changeTime"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询温湿度信息----接口1401使用 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<Grain> listGrain(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + Grain.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询温湿度信息----接口1401使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<Grain> listGrain(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + Grain.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(depotId)){ | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(depotId)) { | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(null != startTime){ | 
|---|
|  |  |  | hql += " and receiveDate >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != endTime){ | 
|---|
|  |  |  | hql += " and receiveDate <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != startTime) { | 
|---|
|  |  |  | hql += " and receiveDate >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != endTime) { | 
|---|
|  |  |  | hql += " and receiveDate <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " order by receiveDate"; | 
|---|
|  |  |  | hql += " order by receiveDate"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询粮情配置信息----接口1402使用 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<DepotConf> listDepotConf(String companyId, String depotId) { | 
|---|
|  |  |  | String hql = " from " + DepotConf.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询粮情配置信息----接口1402使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<DepotConf> listDepotConf(String companyId, String depotId) { | 
|---|
|  |  |  | String hql = " from " + DepotConf.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(depotId)){ | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(depotId)) { | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " order by depotId"; | 
|---|
|  |  |  | hql += " order by depotId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询通风信息----接口1403使用 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<MAreationData> listAreationData(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + MAreationData.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询通风信息----接口1403使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<MAreationData> listAreationData(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + MAreationData.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(depotId)){ | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(depotId)) { | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(null != startTime){ | 
|---|
|  |  |  | hql += " and updateTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != endTime){ | 
|---|
|  |  |  | hql += " and updateTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != startTime) { | 
|---|
|  |  |  | hql += " and updateTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != endTime) { | 
|---|
|  |  |  | hql += " and updateTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " order by updateTime"; | 
|---|
|  |  |  | hql += " order by updateTime"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询熏蒸信息----接口1404使用 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<DrugLog> listDrugLog(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + DrugLog.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询熏蒸信息----接口1404使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<DrugLog> listDrugLog(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + DrugLog.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(depotId)){ | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(depotId)) { | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(null != startTime){ | 
|---|
|  |  |  | hql += " and updateTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != endTime){ | 
|---|
|  |  |  | hql += " and updateTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != startTime) { | 
|---|
|  |  |  | hql += " and updateTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != endTime) { | 
|---|
|  |  |  | hql += " and updateTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " order by updateTime"; | 
|---|
|  |  |  | hql += " order by updateTime"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询虫害信息----接口1405使用 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<Pest> listPest(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + Pest.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询虫害信息----接口1405使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<Pest> listPest(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + Pest.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(depotId)){ | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(depotId)) { | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(null != startTime){ | 
|---|
|  |  |  | hql += " and receiveDate >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != endTime){ | 
|---|
|  |  |  | hql += " and receiveDate <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != startTime) { | 
|---|
|  |  |  | hql += " and receiveDate >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != endTime) { | 
|---|
|  |  |  | hql += " and receiveDate <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " order by receiveDate"; | 
|---|
|  |  |  | hql += " order by receiveDate"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询虫害信息----接口1408使用 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<Gas> listGas(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + Gas.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询虫害信息----接口1408使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param depotId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<Gas> listGas(String companyId, String depotId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + Gas.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(depotId)){ | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(depotId)) { | 
|---|
|  |  |  | hql += " and depotId =:depotId"; | 
|---|
|  |  |  | args.put("depotId", depotId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(null != startTime){ | 
|---|
|  |  |  | hql += " and receiveDate >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != endTime){ | 
|---|
|  |  |  | hql += " and receiveDate <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != startTime) { | 
|---|
|  |  |  | hql += " and receiveDate >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != endTime) { | 
|---|
|  |  |  | hql += " and receiveDate <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " order by receiveDate"; | 
|---|
|  |  |  | hql += " order by receiveDate"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询轮换计划信息----接口1501使用 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param type | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<InoutPlan> listPlan(String companyId, String type, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + InoutPlan.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询轮换计划信息----接口1501使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param type | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<InoutPlan> listPlan(String companyId, String type, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + InoutPlan.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(type)){ | 
|---|
|  |  |  | hql += " and type =:type"; | 
|---|
|  |  |  | args.put("type", type); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(type)) { | 
|---|
|  |  |  | hql += " and type =:type"; | 
|---|
|  |  |  | args.put("type", type); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(null != startTime){ | 
|---|
|  |  |  | hql += " and createTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != endTime){ | 
|---|
|  |  |  | hql += " and createTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != startTime) { | 
|---|
|  |  |  | hql += " and createTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != endTime) { | 
|---|
|  |  |  | hql += " and createTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " order by createTime"; | 
|---|
|  |  |  | hql += " order by createTime"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询轮换明细计划信息----接口1502使用 | 
|---|
|  |  |  | * @param planId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<InoutPlanDetail> getPlanDetail(String planId) { | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询轮换明细计划信息----接口1502使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param planId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<InoutPlanDetail> getPlanDetail(String planId) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String hql = " from " + InoutPlanDetail.class.getName() + " where planId =:planId"; | 
|---|
|  |  |  | String hql = " from " + InoutPlanDetail.class.getName() + " where planId =:planId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("planId", planId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("planId", planId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询合同信息----接口1503使用 | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<InoutContract> listContract(String companyId, Date startTime, Date endTime){ | 
|---|
|  |  |  | String hql = " from " + InoutContract.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询合同信息----接口1503使用 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param companyId | 
|---|
|  |  |  | * @param startTime | 
|---|
|  |  |  | * @param endTime | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<InoutContract> listContract(String companyId, Date startTime, Date endTime) { | 
|---|
|  |  |  | String hql = " from " + InoutContract.class.getName() + " where companyId =:companyId"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<String, Object>(); | 
|---|
|  |  |  | args.put("companyId", companyId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(null != startTime){ | 
|---|
|  |  |  | hql += " and createTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(null != endTime){ | 
|---|
|  |  |  | hql += " and createTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != startTime) { | 
|---|
|  |  |  | hql += " and createTime >:startTime"; | 
|---|
|  |  |  | args.put("startTime", startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != endTime) { | 
|---|
|  |  |  | hql += " and createTime <:endTime"; | 
|---|
|  |  |  | args.put("endTime", endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hql += " order by createTime"; | 
|---|
|  |  |  | hql += " order by createTime"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.query(hql, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|