|
@@ -4,25 +4,26 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ims.common.utils.Constant;
|
|
|
+import com.ims.common.utils.StringUtils;
|
|
|
import com.ims.eval.cache.CacheContext;
|
|
|
import com.ims.eval.config.CustomException;
|
|
|
import com.ims.eval.dao.ResponsibilityIndicatorInfoMapper;
|
|
|
import com.ims.eval.entity.DeptResponsibility;
|
|
|
import com.ims.eval.entity.Indicator;
|
|
|
-import com.ims.eval.entity.OrganizationEvaluationInfo;
|
|
|
import com.ims.eval.entity.ResponsibilityIndicatorInfo;
|
|
|
import com.ims.eval.entity.dto.request.ResponsibilityIndicatorInfoUpdateDTO;
|
|
|
import com.ims.eval.entity.dto.response.IndicatorResDTO;
|
|
|
-import com.ims.eval.entity.dto.response.MyuserResDTO;
|
|
|
-import com.ims.eval.entity.dto.response.OrganizationEvaluationInfoResDTO;
|
|
|
import com.ims.eval.entity.dto.response.ResponsibilityIndicatorInfoResDTO;
|
|
|
import com.ims.eval.service.IDeptResponsibilityService;
|
|
|
import com.ims.eval.service.IIndicatorService;
|
|
|
import com.ims.eval.service.IResponsibilityIndicatorInfoService;
|
|
|
import com.ims.eval.service.IUserService;
|
|
|
import com.ims.eval.util.MathCalculatorUtil;
|
|
|
+import org.apache.commons.io.output.ByteArrayOutputStream;
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFCell;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
+import org.apache.poi.ss.util.CellRangeAddressList;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -30,9 +31,13 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static com.ims.eval.util.ExcelUtil.readExcel;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 责任书指标明细
|
|
@@ -225,36 +230,32 @@ public class ResponsibilityIndicatorInfoServiceImpl extends ServiceImpl<Responsi
|
|
|
.map(map -> String.valueOf(map.get("id"))) // 提取每个Map中key为"id"的值,并转换成String
|
|
|
.collect(Collectors.toList()); // 将提取的值收集到List中
|
|
|
if(null == idList || idList.size()<=0){
|
|
|
- throw new CustomException("未查询导数据");
|
|
|
+ throw new CustomException("未查询到数据");
|
|
|
}
|
|
|
List<IndicatorResDTO> indicatorResDTOS = indicatorService.getGroupChildCodeByIds(idList);
|
|
|
|
|
|
- //根据指标id和指标名分组
|
|
|
- Map<String, List<IndicatorResDTO>> groupedMap = indicatorResDTOS.stream()
|
|
|
- .collect(Collectors.groupingBy(dto -> dto.getIndicatorId() + "," + dto.getIndicatorName())); // 根据indicatorId和indicatorName进行分组
|
|
|
-
|
|
|
if (titlemark) {
|
|
|
// 遍历分组后的Map
|
|
|
Map title = new LinkedHashMap();//保存所有的指标名
|
|
|
- for (Map.Entry<String, List<IndicatorResDTO>> entry : groupedMap.entrySet()) {
|
|
|
|
|
|
- List<IndicatorResDTO> groupedList = entry.getValue(); // 获取分组后的List
|
|
|
- if(null == groupedList || groupedList.size()<=0){
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 进一步处理每个分组
|
|
|
- List<Map> titleArray = new ArrayList<>();
|
|
|
- for (IndicatorResDTO dto : groupedList) {
|
|
|
+ for (IndicatorResDTO dto : indicatorResDTOS) {
|
|
|
+ List<Map> titleArray = new ArrayList<>();
|
|
|
// 处理每个分组中的元素
|
|
|
Map titlemap = new LinkedHashMap();
|
|
|
titlemap.put("childName",dto.getChildName());//子指标名
|
|
|
- titlemap.put("key", dto.getOptionName());//名称
|
|
|
+ titlemap.put("key", dto.getDeptName());//名称
|
|
|
titlemap.put("code",dto.getChildCode()+"_"+dto.getOptionCode());//名称
|
|
|
titlemap.put("flag", dto.getIsQuantified());//是否量化
|
|
|
titleArray.add(titlemap);
|
|
|
+ title.put(dto.getChildName(), titleArray);
|
|
|
}
|
|
|
- title.put(entry.getKey().split(",")[1], titleArray);
|
|
|
- }
|
|
|
+
|
|
|
+ //状态标题头
|
|
|
+ List<Map<String,String>> titleStateArray = new ArrayList<>();
|
|
|
+ Map titleStateMap = new LinkedHashMap();
|
|
|
+ titleStateMap.put("state","填报状态");
|
|
|
+ titleStateArray.add(titleStateMap);
|
|
|
+ title.put("状态",titleStateArray);
|
|
|
|
|
|
data.put("title",title);
|
|
|
titlemark = false;
|
|
@@ -347,7 +348,7 @@ public class ResponsibilityIndicatorInfoServiceImpl extends ServiceImpl<Responsi
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return false;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -356,7 +357,7 @@ public class ResponsibilityIndicatorInfoServiceImpl extends ServiceImpl<Responsi
|
|
|
Map data = new HashMap();
|
|
|
//设置数据头
|
|
|
//获取指标名称
|
|
|
-
|
|
|
+ String[] values = new String[]{"不合格", "待确认", "已确认"};
|
|
|
boolean titlemark = true;//标记生成标题
|
|
|
Map<String ,List<Map<String,String>>> title = new LinkedHashMap();//保存所有的指标名
|
|
|
List<Map> indicatorMap = getResponsibilityIndicatorList(responsibilityId, binSection, binStage,request);
|
|
@@ -369,33 +370,39 @@ public class ResponsibilityIndicatorInfoServiceImpl extends ServiceImpl<Responsi
|
|
|
}
|
|
|
List<IndicatorResDTO> indicatorResDTOS = indicatorService.getGroupChildCodeByIds(idList);
|
|
|
|
|
|
- //根据指标id和指标名分组
|
|
|
- Map<String, List<IndicatorResDTO>> groupedMap = indicatorResDTOS.stream()
|
|
|
- .collect(Collectors.groupingBy(dto -> dto.getIndicatorId() + "," + dto.getIndicatorName())); // 根据indicatorId和indicatorName进行分组
|
|
|
+// //根据指标id和指标名分组
|
|
|
+// Map<String, List<IndicatorResDTO>> groupedMap = indicatorResDTOS.stream()
|
|
|
+// .collect(Collectors.groupingBy(dto -> dto.getIndicatorId() + "," + dto.getIndicatorName())); // 根据indicatorId和indicatorName进行分组
|
|
|
|
|
|
if (titlemark) {
|
|
|
// 遍历分组后的Map
|
|
|
- for (Map.Entry<String, List<IndicatorResDTO>> entry : groupedMap.entrySet()) {
|
|
|
+// for (Map.Entry<String, List<IndicatorResDTO>> entry : groupedMap.entrySet()) {
|
|
|
+//
|
|
|
+// List<IndicatorResDTO> groupedList = entry.getValue(); // 获取分组后的List
|
|
|
+// if(null == groupedList || groupedList.size()<=0){
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// // 进一步处理每个分组
|
|
|
|
|
|
- List<IndicatorResDTO> groupedList = entry.getValue(); // 获取分组后的List
|
|
|
- if(null == groupedList || groupedList.size()<=0){
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 进一步处理每个分组
|
|
|
- List<Map<String,String>> titleArray = new ArrayList<>();
|
|
|
- for (IndicatorResDTO dto : groupedList) {
|
|
|
- // 处理每个分组中的元素
|
|
|
+
|
|
|
+ for (IndicatorResDTO dto : indicatorResDTOS) {
|
|
|
Map titlemap = new LinkedHashMap();
|
|
|
- titlemap.put("childName",dto.getChildName());//子指标名
|
|
|
- titlemap.put("key", dto.getOptionName());//名称
|
|
|
- titlemap.put("code",dto.getChildCode()+"_"+dto.getOptionCode());//名称
|
|
|
- titlemap.put("flag", dto.getIsQuantified());//是否量化
|
|
|
+ List<Map<String,String>> titleArray = new ArrayList<>();
|
|
|
+ // 处理每个分组中的元素
|
|
|
+ titlemap.put(dto.getChildCode()+"_"+dto.getOptionCode(),dto.getDeptName());//名称
|
|
|
titleArray.add(titlemap);
|
|
|
+ title.put(dto.getChildName(), titleArray);
|
|
|
}
|
|
|
- title.put(entry.getKey().split(",")[1], titleArray);
|
|
|
- }
|
|
|
|
|
|
- data.put("title",title);
|
|
|
+// }
|
|
|
+
|
|
|
+ //状态标题头
|
|
|
+ List<Map<String,String>> titleStateArray = new ArrayList<>();
|
|
|
+ Map titleStateMap = new LinkedHashMap();
|
|
|
+ titleStateMap.put("state","填报状态");
|
|
|
+ titleStateArray.add(titleStateMap);
|
|
|
+ title.put("状态",titleStateArray);
|
|
|
+
|
|
|
titlemark = false;
|
|
|
}
|
|
|
|
|
@@ -418,28 +425,25 @@ public class ResponsibilityIndicatorInfoServiceImpl extends ServiceImpl<Responsi
|
|
|
(oldValue, newValue) -> oldValue)); // 解决键重复的情况
|
|
|
|
|
|
|
|
|
- Map indicatormap = new HashMap();
|
|
|
+ LinkedHashMap indicatormap = new LinkedHashMap();
|
|
|
// 进一步处理每个分组
|
|
|
+ String state = "不合格";
|
|
|
for (IndicatorResDTO d : indicatorResDTOS) {
|
|
|
boolean mark = true;//标记给公司名赋值
|
|
|
if (mark) {
|
|
|
indicatormap.put("organizationShortName", resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getOrganizationShortName());//公司名
|
|
|
indicatormap.put("organizationId", resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getOrganizationId());//公司id
|
|
|
- indicatormap.put("state",resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getState());
|
|
|
- indicatormap.put("IS_LH_state","3");
|
|
|
+ String state2 = resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getState();//(-1:不合格;0:待确认;1:已确认)
|
|
|
+ state = stateConvert(state2,true);
|
|
|
mark = false;
|
|
|
}
|
|
|
//指标属性
|
|
|
indicatormap.put(d.getChildCode() + "_" + d.getOptionCode(), null == resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getNonQuantifiedValue() ? "" : resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getNonQuantifiedValue());
|
|
|
- //指标id
|
|
|
- indicatormap.put("ID_" + d.getChildCode() + "_" + d.getOptionCode(), resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getId());
|
|
|
- //是否量化
|
|
|
- indicatormap.put("IS_LH_" +d.getChildCode() + "_" + d.getOptionCode(),resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getIsQuantified()?"1":"2");
|
|
|
}
|
|
|
+ indicatormap.put("state",state);//状态
|
|
|
datamapList.add(indicatormap);
|
|
|
}
|
|
|
|
|
|
- data.put("value", datamapList);
|
|
|
|
|
|
|
|
|
|
|
@@ -448,7 +452,7 @@ public class ResponsibilityIndicatorInfoServiceImpl extends ServiceImpl<Responsi
|
|
|
DeptResponsibility responsibility = deptResponsibilityService.getById(responsibilityId);
|
|
|
// 国电电力2023年关键业绩指标一览表(工程公司)
|
|
|
StringBuilder sb = new StringBuilder("国电电力").append(responsibility.getYear()).append("年关键业绩指标一览表(");
|
|
|
- sb.append(CacheContext.bseIdObject.get(binStage).getStageName()).append(")");
|
|
|
+ sb.append(CacheContext.bsnIdObject.get(binSection).getSectionName()).append(")");
|
|
|
// 创建Workbook对象
|
|
|
Workbook workbook = new XSSFWorkbook();
|
|
|
|
|
@@ -506,13 +510,20 @@ public class ResponsibilityIndicatorInfoServiceImpl extends ServiceImpl<Responsi
|
|
|
header3Cell2.setCellValue("organizationId");
|
|
|
|
|
|
|
|
|
-
|
|
|
Integer colsize = 2;
|
|
|
Integer optioncols = 3;
|
|
|
for (String key : title.keySet()) {//存在多个标题
|
|
|
List<Map<String,String>> titleArray2 = title.get(key);
|
|
|
Cell headerCellcolsize = headerRow1.createCell(colsize+1);
|
|
|
headerCellcolsize.setCellValue(key);
|
|
|
+
|
|
|
+
|
|
|
+ //设置宽度
|
|
|
+ int contentWidth = headerCellcolsize.getStringCellValue().length() * 310;
|
|
|
+ contentWidth = (contentWidth<=4000) ? 4000 :5000;
|
|
|
+ // 设置指定列的宽度为计算得到的宽度值
|
|
|
+ sheet.setColumnWidth(colsize+1, contentWidth);
|
|
|
+
|
|
|
headerCellcolsize.setCellStyle(cellStyle);
|
|
|
headerCellcolsize.setCellStyle(cellStyle);
|
|
|
|
|
@@ -543,14 +554,232 @@ public class ResponsibilityIndicatorInfoServiceImpl extends ServiceImpl<Responsi
|
|
|
}
|
|
|
|
|
|
|
|
|
+ Integer rowdate = 4;
|
|
|
+ for (Map<String,String > datamaps : datamapList) {
|
|
|
+ Integer colsdata = 1;
|
|
|
+ Row headerRowdate = sheet.createRow(rowdate);
|
|
|
+ Cell dataCell0 = headerRowdate.createCell(0);
|
|
|
+ dataCell0.setCellValue(rowdate-3);
|
|
|
+ dataCell0.setCellStyle(cellStyle);
|
|
|
+ for (String datakey: datamaps.keySet()) {
|
|
|
+
|
|
|
+ Cell dataCell1 = headerRowdate.createCell(colsdata);
|
|
|
+ dataCell1.setCellValue(datamaps.get(datakey).toString());
|
|
|
+ dataCell1.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+ if("state".equals(datakey)){
|
|
|
+ // 创建一个数据验证对象
|
|
|
+ DataValidationHelper validationHelper = sheet.getDataValidationHelper();
|
|
|
+ DataValidationConstraint constraint = validationHelper.createExplicitListConstraint(values);
|
|
|
+ // 设置下拉列表的位置范围为
|
|
|
+ CellRangeAddressList addressList = new CellRangeAddressList(rowdate, rowdate, colsdata, colsdata); // 行索引和列索引从0开始计数
|
|
|
+ // 创建数据验证对象
|
|
|
+ DataValidation validation = validationHelper.createValidation(constraint, addressList);
|
|
|
+
|
|
|
+ // 将数据验证对象应用于单元格
|
|
|
+ sheet.addValidationData(validation);
|
|
|
+ }
|
|
|
+
|
|
|
+ colsdata++;
|
|
|
+ }
|
|
|
+ rowdate++;
|
|
|
+ }
|
|
|
+
|
|
|
+ //隐藏行
|
|
|
+ sheet.getRow(3).setZeroHeight(true);
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, colsize));
|
|
|
+ header0Cell0.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+ // 将Workb
|
|
|
+ // ook写入字节数组输出流
|
|
|
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
|
+ workbook.write(outputStream);
|
|
|
|
|
|
- return new byte[0];
|
|
|
+ // 将字节数组作为响应体返回,并设置响应头
|
|
|
+ byte[] excelBytes = outputStream.toByteArray();
|
|
|
+ return excelBytes;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean importExcel(MultipartFile file, HttpServletRequest request) throws Exception {
|
|
|
+ List<LinkedHashMap<String, Object>> dataList = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+ try {
|
|
|
+ //获取原始的文件名
|
|
|
+ String originalFilename = file.getOriginalFilename();
|
|
|
+ //获取文件类型
|
|
|
+ String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1, originalFilename.length());
|
|
|
+ //获取输入流
|
|
|
+ InputStream is = file.getInputStream();
|
|
|
+ Workbook workbook = readExcel(fileType, is);
|
|
|
+
|
|
|
+ Sheet sheet = workbook.getSheetAt(0);
|
|
|
+ // 获取总列数和起始行索引
|
|
|
+ int totalColumns = sheet.getRow(3).getLastCellNum();
|
|
|
+ int startingRowIndex = 4;
|
|
|
+
|
|
|
+ Row headerRow = sheet.getRow(3);
|
|
|
+
|
|
|
+ // 遍历每一行数据
|
|
|
+ for (int i = startingRowIndex; i <= sheet.getLastRowNum(); i++) {
|
|
|
+ Row row = sheet.getRow(i);
|
|
|
+ LinkedHashMap<String, Object> dataMap = new LinkedHashMap<>();
|
|
|
+
|
|
|
+ // 遍历每一列数据
|
|
|
+ for (int j = 0; j < totalColumns; j++) {
|
|
|
+ Cell headerCell = headerRow.getCell(j);
|
|
|
+ Cell cell = row.getCell(j);
|
|
|
+
|
|
|
+ String columnName = headerCell.getStringCellValue();
|
|
|
+ String cellValue = "";
|
|
|
+
|
|
|
+ // 根据单元格类型读取对应内容
|
|
|
+ if (cell != null) {
|
|
|
+ switch (cell.getCellType()) {
|
|
|
+ case HSSFCell.CELL_TYPE_STRING:
|
|
|
+ cellValue = cell.getStringCellValue();
|
|
|
+ break;
|
|
|
+ case HSSFCell.CELL_TYPE_NUMERIC:
|
|
|
+ cellValue = String.valueOf(cell.getNumericCellValue());
|
|
|
+ break;
|
|
|
+ case HSSFCell.CELL_TYPE_BOOLEAN:
|
|
|
+ cellValue = String.valueOf(cell.getBooleanCellValue());
|
|
|
+ break;
|
|
|
+ case HSSFCell.CELL_TYPE_BLANK:
|
|
|
+ cellValue = "";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dataMap.put(columnName, cellValue);
|
|
|
+ }
|
|
|
+ dataList.add(dataMap);
|
|
|
+ }
|
|
|
+ workbook.close();
|
|
|
+
|
|
|
+ for(Map<String, Object> map : dataList){
|
|
|
+ Map<String,String > idMap = new HashMap();
|
|
|
+ Map<String,String > valueMap = new HashMap();
|
|
|
+ for (String key : map.keySet()) {
|
|
|
+ String value = String.valueOf(map.get(key));
|
|
|
+ if(key.startsWith("zhidmap")){
|
|
|
+ String[] zhidmap = key.split(",");
|
|
|
+ idMap.put("respId",zhidmap[1].split("=")[1]);
|
|
|
+ continue;
|
|
|
+ }if(key.startsWith("organization")){
|
|
|
+ idMap.put(key,value);
|
|
|
+ continue;
|
|
|
+ }if(key.startsWith("state")){
|
|
|
+ idMap.put(key,value);
|
|
|
+ continue;
|
|
|
+ }else {
|
|
|
+ valueMap.put(key,value);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<ResponsibilityIndicatorInfo> responsibilityInfos =new ArrayList<>();
|
|
|
+ for (Map.Entry<String,String > entry : valueMap.entrySet()) {
|
|
|
+ //organizationEvaluationId 考评记录id
|
|
|
+ // organizationId 组织id
|
|
|
+ // childOptionCode 组合子指标和指标项
|
|
|
+ List<ResponsibilityIndicatorInfo> responsibilityInfoList = getResponsibilityInfooByOptionCodeList(idMap.get("respId"),idMap.get("organizationId"),entry.getKey());
|
|
|
+ ResponsibilityIndicatorInfo info = new ResponsibilityIndicatorInfo();
|
|
|
+ ResponsibilityIndicatorInfo oriinfo = null;
|
|
|
+ if(null !=responsibilityInfoList && responsibilityInfoList.size()>0){
|
|
|
+ oriinfo = responsibilityInfoList.get(0);//原始数据
|
|
|
+ info.setId(oriinfo.getId());
|
|
|
+ }
|
|
|
+ if (oriinfo.getIsQuantified()) {
|
|
|
+
|
|
|
+ if (MathCalculatorUtil.isNumber(String.valueOf(entry.getValue()))) {
|
|
|
+ info.setQuantifiedValue(Double.valueOf(entry.getValue()));
|
|
|
+ } else {
|
|
|
+ info.setQuantifiedValue(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ info.setNonQuantifiedValue(entry.getValue());
|
|
|
+ String state2 = idMap.get("state").toString();
|
|
|
+ String state = stateConvert(state2,false);
|
|
|
+ info.setState(state);
|
|
|
+ responsibilityInfos.add(info);
|
|
|
+ }
|
|
|
+ this.saveOrUpdateBatch(responsibilityInfos);
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ResponsibilityIndicatorInfo> getResponsibilityInfooByOptionCodeList(String responsibilityId, String organizationId, String childOptionCode) {
|
|
|
|
|
|
|
|
|
- return false;
|
|
|
+ QueryWrapper<ResponsibilityIndicatorInfo> qw = new QueryWrapper<>();
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(responsibilityId)) {
|
|
|
+ qw.lambda().eq(ResponsibilityIndicatorInfo::getDeptResponsibilityId, responsibilityId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(organizationId)) {
|
|
|
+ qw.lambda().eq(ResponsibilityIndicatorInfo::getOrganizationId, organizationId);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(childOptionCode)) {
|
|
|
+ qw.eq("CONCAT(child_code, '_', option_code)", childOptionCode);
|
|
|
+ }
|
|
|
+ List<ResponsibilityIndicatorInfo> list = baseMapper.selectList(qw);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 状态抓换 (-1:不合格;0:待确认;1:已确认)
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String stateConvert(String state,boolean flge) {
|
|
|
+// (-1:不合格;0:待确认;1:已确认)
|
|
|
+ String state2 = "";
|
|
|
+ if (flge) {
|
|
|
+ if(StringUtils.isEmpty(state)){
|
|
|
+ state2 = "待确认";
|
|
|
+ return state2;
|
|
|
+ }
|
|
|
+
|
|
|
+ switch (state) {
|
|
|
+ case "-1":
|
|
|
+ state2 = "不合格";
|
|
|
+ break;
|
|
|
+ case "0":
|
|
|
+ state2 = "待确认";
|
|
|
+ break;
|
|
|
+ case "1":
|
|
|
+ state2 = "已确认";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ state2 = "待确认";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if(StringUtils.isEmpty(state)){
|
|
|
+ state2 = "0";
|
|
|
+ return state2;
|
|
|
+ }
|
|
|
+ switch (state) {
|
|
|
+ case "不合格":
|
|
|
+ state2 = "-1";
|
|
|
+ break;
|
|
|
+ case "待确认":
|
|
|
+ state2 = "0";
|
|
|
+ break;
|
|
|
+ case "已确认":
|
|
|
+ state2 = "1";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ state2 = "0";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return state2;
|
|
|
}
|
|
|
}
|