| | |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.primefaces.event.FileUploadEvent; |
| | | import org.primefaces.model.UploadedFile; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.dao.DataAccessException; |
| | | import org.springframework.dao.DataIntegrityViolationException; |
| | |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.DecimalFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | SysSequenceService sysSequenceService; |
| | | @Resource |
| | | private SysUserService sysUserService; |
| | | @Resource |
| | | private BaseMetaService baseMetaService; |
| | | |
| | | @Value("${activeEnv}") |
| | | private String activeEnv; |
| | | |
| | | @Transactional(propagation = Propagation.REQUIRED) |
| | | public List<OpeApply> getOpeApplyList(String reagentName, Timestamp startDeadline, Timestamp endDeadline, Integer status, |
| | | public List<OpeApply> getOpeApplyList(String reagentName, Timestamp startDeadline, String controlProduct,Timestamp endDeadline, Integer status, |
| | | String applyUserId, String approveUserId, String queryCas, |
| | | Integer first, Integer pageSize,String applyCode,String applyUserName) { |
| | | Integer first, Integer pageSize,String applyCode,String applyUserName,Byte isShow) { |
| | | try { |
| | | Map<String, Object> params = new HashMap<String, Object>(); |
| | | if (StringUtils.isNotBlank(reagentName)) { |
| | |
| | | params.put("startDeadline", startDeadline); |
| | | params.put("endDeadline", endDeadline); |
| | | params.put("status", status); |
| | | params.put("isShow", isShow); |
| | | params.put("controlProduct", controlProduct); |
| | | |
| | | if (StringUtils.isNotBlank(applyUserId)) { |
| | | SysUser sysUser = sysUserService.getSysUser(applyUserId); |
| | |
| | | } |
| | | |
| | | @Transactional(propagation = Propagation.REQUIRED) |
| | | public int getOpeApplyTotalCount(String reagentName, Timestamp startDeadline, Timestamp endDeadline, Integer status, |
| | | String applyUserId, String approveUserId, String queryCas,String applyCode,String applyUserName) { |
| | | public int getOpeApplyTotalCount(String reagentName, Timestamp startDeadline,String controlProduct, Timestamp endDeadline, Integer status, |
| | | String applyUserId, String approveUserId, String queryCas,String applyCode,String applyUserName,Byte isShow) { |
| | | try { |
| | | Map<String, Object> params = new HashMap<String, Object>(); |
| | | if (StringUtils.isNotBlank(reagentName)) { |
| | |
| | | params.put("startDeadline", startDeadline); |
| | | params.put("endDeadline", endDeadline); |
| | | params.put("status", status); |
| | | params.put("isShow", isShow); |
| | | params.put("controlProduct", controlProduct); |
| | | |
| | | if (StringUtils.isNotBlank(applyUserId)) { |
| | | SysUser sysUser = sysUserService.getSysUser(applyUserId); |
| | |
| | | public boolean updateSelectedOpeApplyStatus(String memo, List<String> applyIds, String adminUserId, List<String> adminApplyIds,List<String> firstUserIds) { |
| | | boolean apply = false, adminApply = false; |
| | | if (!CollectionUtils.isEmpty(applyIds)) { |
| | | apply = this.updateOpeApplyStatus(ApplyStatus.APPROVED, memo, applyIds); |
| | | if("gslab".equalsIgnoreCase(activeEnv)){ |
| | | apply = this.updateOpeApplyStatus(ApplyStatus.Price_CONFIRM, memo, applyIds); |
| | | }else{ |
| | | apply = this.updateOpeApplyStatus(ApplyStatus.APPROVED, memo, applyIds); |
| | | } |
| | | } |
| | | if (!CollectionUtils.isEmpty(adminApplyIds)) { |
| | | adminApply = this.updateOpeApplyAdminStatus2(memo, adminApplyIds, adminUserId,firstUserIds); |
| | |
| | | params.put("productSn",productSn); |
| | | params.put("applyCode",applyCode); |
| | | if (isExpired) { |
| | | params.put("status",ApplyStatus.EXPIRED); |
| | | params.put("status",ApplyStatus.EXPIRED.getKey()); |
| | | }else{ |
| | | params.put("status", status); |
| | | } |
| | |
| | | params.put("productSn",productSn); |
| | | params.put("applyCode",applyCode); |
| | | if (isExpired) { |
| | | params.put("status",ApplyStatus.EXPIRED); |
| | | params.put("status",ApplyStatus.EXPIRED.getKey()); |
| | | }else{ |
| | | params.put("status", status); |
| | | } |
| | |
| | | for (int index = 0; index < totalCells; index++) { |
| | | String cellInfo = ""; |
| | | if (row.getCell(index) != null) { |
| | | if (row.getCell(index).getCellTypeEnum() == CellType.BLANK && index != 9) { |
| | | if (row.getCell(index).getCellType() == CellType.BLANK && index != 9) { |
| | | throw new BusinessException(ExceptionEnumCode.PARAM_NULL, "第" + ++i + "行:除了课题组都不能为空"); |
| | | } |
| | | |
| | | if (row.getCell(index).getCellTypeEnum() == CellType.NUMERIC) { |
| | | cellInfo = String.valueOf(row.getCell(index).getNumericCellValue()); |
| | | if (row.getCell(index).getCellType() == CellType.NUMERIC) { |
| | | DecimalFormat df = new DecimalFormat("#######"); //格式化number String字符 |
| | | cellInfo = df.format(row.getCell(index).getNumericCellValue()); |
| | | }else{ |
| | | cellInfo = row.getCell(index).getStringCellValue(); |
| | | } |
| | |
| | | if (applyUser == null) throw new BusinessException(ExceptionEnumCode.PARAM_NO_EXIST, i+"行:申购人不存在或者申购人姓名存在重复,导入失败"); |
| | | //课题组名称 |
| | | String objective = valuesList.get(9); |
| | | String applyDateStr = valuesList.get(10); |
| | | |
| | | String format = "yyyy-MM-dd"; |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat(format); |
| | | Date applyDate = null; |
| | | try { |
| | | applyDate = dateFormat.parse(applyDateStr); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | throw new BusinessException(ExceptionEnumCode.PARAM_NO_EXIST, i+"行:申购日期不合法,应如2016-10-09,导入失败"); |
| | | int cellnum = 10; |
| | | CellType type = row.getCell(cellnum).getCellType(); |
| | | Object value = row.getCell(cellnum); |
| | | if (null == value || StringUtils.isBlank(value.toString())) { |
| | | throw new BusinessException(ExceptionEnumCode.PARAM_NO_EXIST, i+"行,申购日期不能为空"); |
| | | } else { |
| | | if (type.equals(CellType.NUMERIC)) { |
| | | try { |
| | | applyDate = row.getCell(cellnum).getDateCellValue(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new BusinessException(ExceptionEnumCode.PARAM_NO_EXIST, i+"行,申购日期解析错误,请检查是否有无效字符"); |
| | | } |
| | | } else if (type.equals(CellType.STRING)) { |
| | | String cellInfo = row.getCell(10).getStringCellValue(); |
| | | try { |
| | | applyDate = dateFormat.parse(cellInfo); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | throw new BusinessException(ExceptionEnumCode.PARAM_NO_EXIST, i+"行:申购日期不合法,应如2016-10-09,导入失败"); |
| | | } |
| | | } else { |
| | | throw new BusinessException(ExceptionEnumCode.PARAM_NO_EXIST, i+"行:申购日期解析错误,请检查是否有无效字符"); |
| | | } |
| | | } |
| | | |
| | | //选择的审批人姓名 |
| | | String approveUserName = valuesList.get(11); |
| | | //根据姓名获取用户信息的id |
| | |
| | | //申购数量 |
| | | opeApply.setNum(num); |
| | | //申购人 |
| | | opeApply.setApplyUserId(user.getId()); |
| | | opeApply.setApplyUserId(applyUser.getId()); |
| | | //选择的审批人 |
| | | opeApply.setApproveUserId(approveUser.getId()); |
| | | //选择的课题组信息 |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public OpeApplyReserve getOpeApplyReserveListByNameForRowData(String rowKey) { |
| | | return opeApplyDao.getOpeApplyReserveListByNameForRowData(rowKey); |
| | | } |
| | | |
| | | @Override |
| | | public int getOpeApplySupplerRequireMngTotalCount(SysUser user,String reagentName, Timestamp startDeadline, Timestamp endDeadline, int status, byte isShow) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("reagentName",reagentName ); |
| | | params.put("startDeadline", startDeadline); |
| | | params.put("endDeadline", endDeadline); |
| | | params.put("status", status); |
| | | params.put("isShow", isShow); |
| | | //看到供应商是自己的单位的数据 |
| | | String company = baseMetaService.getBaseMetaValue(user.getCompany()); |
| | | if (user.getSeeFlag().getKey() != SeeFlag.MANAGE.getKey() |
| | | && user.getSeeFlag().getKey() != SeeFlag.LEADING.getKey()) { |
| | | params.put("company", company); |
| | | } |
| | | return this.opeApplyDao.getOpeApplySupplerRequireMngTotalCount(params); |
| | | } |
| | | |
| | | @Override |
| | | public List<OpeApply> getOpeApplySupplerRequireMngList(SysUser user,String reagentName, Timestamp startDeadline, Timestamp endDeadline, int status, int first, int pageSize, byte isShow) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("reagentName", reagentName); |
| | | params.put("startDeadline", startDeadline); |
| | | params.put("endDeadline", endDeadline); |
| | | params.put("status", status); |
| | | params.put("isShow", isShow); |
| | | //看到供应商是自己的单位的数据 |
| | | String company = baseMetaService.getBaseMetaValue(user.getCompany()); |
| | | if (user.getSeeFlag().getKey() != SeeFlag.MANAGE.getKey() |
| | | && user.getSeeFlag().getKey() != SeeFlag.LEADING.getKey()) { |
| | | params.put("company", company); |
| | | } |
| | | |
| | | return this.opeApplyDao.getOpeApplySupplerRequireMngList(params); |
| | | } |
| | | |
| | | } |