fd3ce59369f9159893d8a57cdc8ccc88fe7d3496.svn-base 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. package com.sinosoft.em.evaluate.scoreGrade.service;
  2. import java.io.FileNotFoundException;
  3. import java.io.FileOutputStream;
  4. import java.io.IOException;
  5. import java.io.UnsupportedEncodingException;
  6. import java.util.List;
  7. import java.util.Map;
  8. import java.util.UUID;
  9. import javax.servlet.http.HttpServletRequest;
  10. import javax.servlet.http.HttpServletResponse;
  11. import javax.ws.rs.POST;
  12. import javax.ws.rs.Path;
  13. import javax.ws.rs.ProduceMime;
  14. import javax.ws.rs.core.Context;
  15. import org.apache.log4j.Logger;
  16. import org.apache.poi.hssf.usermodel.HSSFCell;
  17. import org.apache.poi.hssf.usermodel.HSSFCellStyle;
  18. import org.apache.poi.hssf.usermodel.HSSFRow;
  19. import org.apache.poi.hssf.usermodel.HSSFSheet;
  20. import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  21. import org.apache.poi.hssf.util.HSSFColor;
  22. import org.apache.poi.ss.usermodel.CellStyle;
  23. import org.apache.poi.hssf.util.Region;
  24. import org.apache.poi.ss.usermodel.Cell;
  25. import com.formaction.Utils;
  26. import com.formaction.service.CRUDServiceImpl;
  27. import com.formaction.vo.Msg;
  28. import com.persistence.service.exception.PersistenceException;
  29. import com.sinosoft.common.upLoad.service.UploadManageImpl;
  30. import com.sinosoft.em.evaluate.scoreGrade.dao.PengGuExcel;
  31. import com.sinosoft.em.evaluate.scoreGrade.dao.ScoreGradeDao;
  32. import com.sinosoft.lz.system.logon.vo.LoginInfo;
  33. @Path("/ScoreGradeService/")
  34. public class ScoreGradeServiceImpl implements ScoreGradeService {
  35. @Context
  36. private org.apache.cxf.jaxrs.ext.MessageContext mc;
  37. private final Logger log = Logger.getLogger(getClass());
  38. @ProduceMime("application/json")
  39. @POST
  40. @Path("/getScoreGradeById")
  41. public String getScoreGradeById(String params) {
  42. String id = Utils.getParameter("id", params) == null ? "" : Utils
  43. .getParameter("id", params);
  44. try {
  45. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  46. return scoreGradeDao.getScoreGradeById(id);
  47. } catch (PersistenceException e) {
  48. // TODO Auto-generated catch block
  49. e.printStackTrace();
  50. }
  51. return null;
  52. }
  53. @ProduceMime("application/json")
  54. @POST
  55. @Path("/getScoreGradeTrunkIds")
  56. public String getScoreGradeTrunkIds(String params) {
  57. String condition = Utils.getParameter("condition", params) == null ? "" : Utils
  58. .getParameter("condition", params);
  59. String evalId = Utils.getParameter("evalId", params) == null ? "" : Utils
  60. .getParameter("evalId", params);
  61. try {
  62. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  63. return scoreGradeDao.getScoreGradeTrunkIds(condition,evalId);
  64. } catch (PersistenceException e) {
  65. // TODO Auto-generated catch block
  66. e.printStackTrace();
  67. }
  68. return null;
  69. }
  70. //保存==================================================
  71. @ProduceMime("application/json")
  72. @POST
  73. @Path("/saveSocre")
  74. public Msg saveSocre(String params) {
  75. String rows = Utils.getParameter("rows", params) == null ? "" : Utils
  76. .getParameter("rows", params);
  77. String evalId = Utils.getParameter("evalId", params) == null ? "" : Utils
  78. .getParameter("evalId", params);
  79. String resultTrunk = Utils.getParameter("resultTrunk", params) == null ? "" : Utils
  80. .getParameter("resultTrunk", params);
  81. //填报人
  82. String realName = Utils.getParameter("realName", params) == null ? "" : Utils
  83. .getParameter("realName", params);
  84. //填报部门
  85. String deptName = Utils.getParameter("deptName", params) == null ? "" : Utils
  86. .getParameter("deptName", params);
  87. //填报时间
  88. String dateTime = Utils.getParameter("dateTime", params) == null ? "" : Utils
  89. .getParameter("dateTime", params);
  90. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  91. return scoreGradeDao.saveSocre(rows,evalId,resultTrunk,realName,deptName,dateTime);
  92. }
  93. //重置=========================================================
  94. @ProduceMime("application/json")
  95. @POST
  96. @Path("/reloadSocre")
  97. public String reloadSocre(String params) {
  98. String condition = Utils.getParameter("condition", params) == null ? "" : Utils
  99. .getParameter("condition", params);
  100. String evalId = Utils.getParameter("evalId", params) == null ? "" : Utils
  101. .getParameter("evalId", params);
  102. try {
  103. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  104. return scoreGradeDao.reloadSorce(condition,evalId);
  105. } catch (PersistenceException e) {
  106. // TODO Auto-generated catch block
  107. e.printStackTrace();
  108. }
  109. return null;
  110. }
  111. /**
  112. * ====导出============================================================
  113. * @throws FileNotFoundException
  114. */
  115. @ProduceMime("application/json")
  116. @POST
  117. @Path("/ExportgetScoreGradeTrunkIds")
  118. public String ExportgetScoreGradeTrunkIds(String params) throws FileNotFoundException {
  119. String condition = Utils.getParameter("condition", params) == null ? "" : Utils
  120. .getParameter("condition", params);
  121. String evalId = Utils.getParameter("evalId", params) == null ? "" : Utils
  122. .getParameter("evalId", params);
  123. // resultTrunk
  124. String resultTrunk = Utils.getParameter("resultTrunk", params) == null ? "" : Utils
  125. .getParameter("resultTrunk", params);
  126. //评分单位
  127. String [] result = resultTrunk.split(",");
  128. try {
  129. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  130. List<Map<String,String>> list = scoreGradeDao.ExportgetScoreGradeTrunkIds(condition,evalId);
  131. HttpServletRequest request = mc.getHttpServletRequest();
  132. String filePath = request.getRealPath("excels");
  133. String fileName = UUID.randomUUID().toString()+".xls";
  134. FileOutputStream out = new FileOutputStream(filePath+"/"+fileName);
  135. log.info(filePath+"/"+fileName);
  136. try {
  137. HSSFWorkbook workbook = new HSSFWorkbook();
  138. CellStyle cellStyle=workbook.createCellStyle();
  139. cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 居中
  140. cellStyle.setWrapText(true);//设置自动换行
  141. //加边框
  142. cellStyle.setBottomBorderColor(HSSFColor.BLACK.index);
  143. cellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
  144. cellStyle.setLeftBorderColor(HSSFColor.BLACK.index);
  145. cellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
  146. cellStyle.setRightBorderColor(HSSFColor.BLACK.index);
  147. cellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
  148. cellStyle.setTopBorderColor(HSSFColor.BLACK.index);
  149. //一页
  150. HSSFSheet childSheet = workbook.createSheet();
  151. //设置列宽
  152. childSheet.setColumnWidth(0, 5000);
  153. childSheet.setColumnWidth(1, 5000);
  154. childSheet.setColumnWidth(2, 5000);
  155. childSheet.setColumnWidth(3, 5000);
  156. childSheet.setColumnWidth(4, 5000);
  157. childSheet.setColumnWidth(5, 5000);
  158. childSheet.setColumnWidth(6, 5000);
  159. // 起始行 // 结束行 // 其实列 // 结束列
  160. childSheet.addMergedRegion(new Region(0, (short)0, 0,(short)6));
  161. CellStyle cellStyle1=workbook.createCellStyle();
  162. cellStyle1.setWrapText(true); //换行
  163. HSSFRow row0 = childSheet.createRow(0);
  164. row0.setHeight((short)1000);
  165. HSSFCell cell00 = row0.createCell(0);
  166. cell00.setCellType(Cell.CELL_TYPE_STRING); //按照String类型读取
  167. cell00.setCellValue(" ");
  168. cell00.setCellStyle(cellStyle1);
  169. childSheet.addMergedRegion(new Region(1, (short)0, 1,(short)6));
  170. HSSFCell cell10 = childSheet.createRow(1).createCell(0);
  171. cell10.setCellType(Cell.CELL_TYPE_STRING); //按照String类型读取
  172. cell10.setCellValue("评估评分表");
  173. cell10.setCellStyle(cellStyle);
  174. HSSFRow row2 = childSheet.createRow(2);
  175. HSSFCell cell20 = row2.createCell(0);
  176. cell20.setCellType(Cell.CELL_TYPE_STRING); //按照String类型读取
  177. cell20.setCellValue("体系名");
  178. HSSFCell cell21 = row2.createCell(1);
  179. cell21.setCellType(Cell.CELL_TYPE_STRING); //按照String类型读取
  180. cell21.setCellValue("一级项目");
  181. HSSFCell cell22 = row2.createCell(2);
  182. cell22.setCellType(Cell.CELL_TYPE_STRING); //按照String类型读取
  183. cell22.setCellValue("二级项目");
  184. HSSFCell cell23 = row2.createCell(3);
  185. cell23.setCellType(Cell.CELL_TYPE_STRING); //按照String类型读取
  186. cell23.setCellValue("三级项目");
  187. HSSFCell cell24 = row2.createCell(4);
  188. cell24.setCellType(Cell.CELL_TYPE_STRING); //按照String类型读取
  189. cell24.setCellValue("评价内容");
  190. //循环评分单位 表头
  191. for(int i = 0;i<result.length;i++){
  192. String[] res = result[i].split("\\$");
  193. HSSFCell cell25 = row2.createCell(5+i);
  194. cell25.setCellType(Cell.CELL_TYPE_STRING); //按照String类型读取
  195. cell25.setCellValue(res[1]);
  196. }
  197. System.out.println("list.size()++++++++++++++++++++++++++++++++++++++++++++++++++++++"+list.size());
  198. int listSize=list.size();
  199. for (int r = 3 ; r < list.size()+3; r++) {// 循环该 子sheet row
  200. //获取数据中的每个值
  201. Map<String,String> detail = list.get(listSize+2-r);
  202. HSSFRow rows = childSheet.createRow(r);
  203. HSSFCell cell0 = rows.createCell(0);
  204. cell0.setCellType(Cell.CELL_TYPE_STRING);
  205. cell0.setCellValue(detail.get("TRUNK_NAME"));//体系名
  206. HSSFCell cell1 = rows.createCell(1);
  207. cell1.setCellType(Cell.CELL_TYPE_STRING);
  208. cell1.setCellValue(detail.get("LEVEL_ONE"));
  209. HSSFCell cell2 = rows.createCell(2);
  210. cell2.setCellType(Cell.CELL_TYPE_STRING);
  211. cell2.setCellValue(detail.get("LEVEL_TWO"));
  212. HSSFCell cell3 = rows.createCell(3);
  213. cell3.setCellType(Cell.CELL_TYPE_STRING);
  214. cell3.setCellValue(detail.get("LEVEL_THREE"));
  215. HSSFCell cell4 = rows.createCell(4);
  216. cell4.setCellType(Cell.CELL_TYPE_STRING);
  217. cell4.setCellValue(detail.get("DETAIL"));
  218. for(int i = 0;i<result.length;i++){
  219. String[] res = result[i].split("\\$");
  220. HSSFCell cell5 = rows.createCell(5+i);
  221. cell5.setCellType(Cell.CELL_TYPE_STRING);
  222. String sdf = "a"+res[0]+"$";
  223. String dsdf = detail.get(sdf);
  224. if(dsdf==null||"".equals(dsdf)){
  225. dsdf = "";
  226. }
  227. cell5.setCellValue(dsdf);
  228. }
  229. }
  230. workbook.write(out);
  231. out.close();
  232. } catch (IOException e) {
  233. // TODO Auto-generated catch block
  234. e.printStackTrace();
  235. }
  236. log.info(fileName);
  237. return fileName;
  238. } catch (PersistenceException e) {
  239. // TODO Auto-generated catch block
  240. e.printStackTrace();
  241. }
  242. return null;
  243. }
  244. //导入=====================================================================
  245. @SuppressWarnings("unused")
  246. @POST
  247. @ProduceMime("text/html")
  248. @Path("/importExcel/")
  249. public String importExcel(@Context HttpServletRequest request,
  250. @Context HttpServletResponse response) throws UnsupportedEncodingException {
  251. //评分单位ids
  252. String resultTrunk =new String(request.getParameter("resultTrunk").getBytes("iso-8859-1"),"UTF-8")==null?"":new String(request.getParameter("resultTrunk").getBytes("iso-8859-1"),"UTF-8") ;
  253. //条件筛选
  254. String condition=request.getParameter("condition") == null?"":request.getParameter("condition");
  255. String evalId=request.getParameter("evalId")==null?"":request.getParameter("evalId");
  256. //获取任务id
  257. Msg msg = new Msg();
  258. UploadManageImpl upload = new UploadManageImpl();
  259. msg =upload.uploadDutyFilePath(request, response);
  260. if(msg.getSucsess()=="false"){
  261. String ret="{success : " + msg.getSucsess() + " , info : '" + msg.getInfo() + "',ObjectID:'ObjectID'}";
  262. return "";
  263. }
  264. String resultString=msg.getInfo();
  265. LoginInfo loginInfo = (LoginInfo) request.getSession().getAttribute("loginInfo");
  266. if(resultString!=null&& !"".equals(resultString)){
  267. String[] strs = resultString.split(";");
  268. String flag = strs[0];//true
  269. String info = strs[1];//success
  270. String path = strs[2];//路径
  271. if("true".equals(flag)){
  272. PengGuExcel doExcel = new PengGuExcel();
  273. msg.setInfo(doExcel.readExcel(path,condition,evalId,resultTrunk));
  274. if(msg.getSucsess().equals("false")){
  275. msg.setInfo("3");
  276. }
  277. }
  278. }
  279. String retString = "{success : '" + msg.getSucsess() + "' , info : '" + msg.getInfo() + "',ObjectID:'ObjectID'}";
  280. log.info("msginfo=========="+msg.getInfo());
  281. String ms = msg.getInfo();
  282. String ms2 = msg.getSucsess();
  283. return ms ;
  284. }
  285. @ProduceMime("application/json")
  286. @POST
  287. @Path("/getScoreGradeLevelOneTotal")
  288. public String getScoreGradeLevelOneTotal(String params) {
  289. String gradeId = Utils.getParameter("gradeId", params) == null ? "" : Utils
  290. .getParameter("gradeId", params);
  291. String companyId = Utils.getParameter("companyId", params) == null ? "" : Utils
  292. .getParameter("companyId", params);
  293. String trunkId = Utils.getParameter("trunkId", params) == null ? "" : Utils
  294. .getParameter("trunkId", params);
  295. try {
  296. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  297. return scoreGradeDao.getScoreGradeLevelOneTotal(gradeId,companyId,trunkId);
  298. } catch (PersistenceException e) {
  299. // TODO Auto-generated catch block
  300. e.printStackTrace();
  301. }
  302. return null;
  303. }
  304. /**
  305. * 根据公司和评估指标获得一级项目及下级项目的总和
  306. * @param params
  307. * @return
  308. */
  309. @ProduceMime("application/json")
  310. @POST
  311. @Path("/getScoreGradeId")
  312. public String getScoreGradeId(String params) {
  313. String gradeId = Utils.getParameter("gradeId", params) == null ? "" : Utils
  314. .getParameter("gradeId", params);
  315. String trunkId = Utils.getParameter("trunkId", params) == null ? "" : Utils
  316. .getParameter("trunkId", params);
  317. try {
  318. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  319. return scoreGradeDao.getScoreGradeId(gradeId,trunkId);
  320. } catch (PersistenceException e) {
  321. // TODO Auto-generated catch block
  322. e.printStackTrace();
  323. }
  324. return null;
  325. }
  326. /**
  327. * 根据公司和评估指标获得一级项目及下级项目的分值总和
  328. * @param params
  329. * @return
  330. */
  331. @ProduceMime("application/json")
  332. @POST
  333. @Path("/getScoreGradeTotalId")
  334. public String getScoreGradeTotalId(String params) {
  335. String gradeId = Utils.getParameter("gradeId", params) == null ? "" : Utils
  336. .getParameter("gradeId", params);
  337. String trunkId = Utils.getParameter("trunkId", params) == null ? "" : Utils
  338. .getParameter("trunkId", params);
  339. try {
  340. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  341. return scoreGradeDao.getScoreGradeTotalId(gradeId,trunkId);
  342. } catch (PersistenceException e) {
  343. // TODO Auto-generated catch block
  344. e.printStackTrace();
  345. }
  346. return null;
  347. }
  348. /**
  349. * 根据公司和评估指标获得二级项目及下级项目的总和
  350. * @param params
  351. * @return
  352. */
  353. @ProduceMime("application/json")
  354. @POST
  355. @Path("/getScoreGradeTwoId")
  356. public String getScoreGradeTwoId(String params) {
  357. String gradeId = Utils.getParameter("gradeId", params) == null ? "" : Utils
  358. .getParameter("gradeId", params);
  359. String companyId = Utils.getParameter("companyId", params) == null ? "" : Utils
  360. .getParameter("companyId", params);
  361. String level = Utils.getParameter("level", params) == null ? "" : Utils
  362. .getParameter("level", params);
  363. String score = Utils.getParameter("score", params) == null ? "" : Utils
  364. .getParameter("score", params);
  365. try {
  366. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  367. return scoreGradeDao.getScoreGradeTwoId(gradeId,companyId,level,score);
  368. } catch (PersistenceException e) {
  369. // TODO Auto-generated catch block
  370. e.printStackTrace();
  371. }
  372. return null;
  373. }
  374. @ProduceMime("application/json")
  375. @POST
  376. @Path("/getDetailScoreById")
  377. public String getDetailScoreById(String params) {
  378. String gradeId = Utils.getParameter("gradeId", params) == null ? "" : Utils
  379. .getParameter("gradeId", params);
  380. try {
  381. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  382. return scoreGradeDao.getDetailScoreById(gradeId);
  383. } catch (PersistenceException e) {
  384. // TODO Auto-generated catch block
  385. e.printStackTrace();
  386. }
  387. return null;
  388. }
  389. @ProduceMime("application/json")
  390. @POST
  391. @Path("/getDetailScoreByIdChart")
  392. public String getDetailScoreByIdChart(String params) {
  393. String gradeId = Utils.getParameter("gradeId", params) == null ? "" : Utils
  394. .getParameter("gradeId", params);
  395. try {
  396. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  397. return scoreGradeDao.getDetailScoreByIdChart(gradeId);
  398. } catch (PersistenceException e) {
  399. // TODO Auto-generated catch block
  400. e.printStackTrace();
  401. }
  402. return null;
  403. }
  404. @ProduceMime("application/json")
  405. @POST
  406. @Path("/getDetailScoreByIdChartLine")
  407. public String getDetailScoreByIdChartLine(String params) {
  408. String gradeId = Utils.getParameter("gradeId", params) == null ? "" : Utils
  409. .getParameter("gradeId", params);
  410. try {
  411. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  412. return scoreGradeDao.getDetailScoreByIdChartLine(gradeId);
  413. } catch (PersistenceException e) {
  414. // TODO Auto-generated catch block
  415. e.printStackTrace();
  416. }
  417. return null;
  418. }
  419. /* *//**
  420. * 获取柱图数据
  421. * @param params
  422. * @return
  423. *//*
  424. @ProduceMime("application/json")
  425. @POST
  426. @Path("/getColumnData")
  427. public String getColumnData(String params) {
  428. String gradeId = Utils.getParameter("gradeId", params) == null ? "" : Utils.getParameter("gradeId", params);
  429. try {
  430. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  431. return scoreGradeDao.getScoreData(gradeId);
  432. } catch (PersistenceException e) {
  433. // TODO Auto-generated catch block
  434. e.printStackTrace();
  435. }
  436. return null;
  437. }*/
  438. /**
  439. * 获取柱图数据
  440. * @param params
  441. * @return
  442. */
  443. @ProduceMime("application/json")
  444. @POST
  445. @Path("/getLineData")
  446. public String getLineData(String params) {
  447. String gradeId = Utils.getParameter("gradeId", params) == null ? "" : Utils.getParameter("gradeId", params);
  448. try {
  449. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  450. return scoreGradeDao.getLineData(gradeId);
  451. } catch (PersistenceException e) {
  452. // TODO Auto-generated catch block
  453. e.printStackTrace();
  454. }
  455. return null;
  456. }
  457. /**
  458. * @param params
  459. * @return
  460. */
  461. @ProduceMime("application/json")
  462. @POST
  463. @Path("/getlei_da_Data")
  464. public String getlei_da_Data(String params) {
  465. String gradeId = Utils.getParameter("gradeId", params) == null ? "" : Utils.getParameter("gradeId", params);
  466. String companyIdName = Utils.getParameter("companyIdName", params) == null ? "" : Utils.getParameter("companyIdName", params);
  467. try {
  468. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  469. return scoreGradeDao.Lei_Da_Data(gradeId,companyIdName);
  470. } catch (PersistenceException e) {
  471. // TODO Auto-generated catch block
  472. e.printStackTrace();
  473. }
  474. return null;
  475. }
  476. /**
  477. * 获得==雷达图==数据
  478. * @param params
  479. * @return
  480. */
  481. @ProduceMime("application/json")
  482. @POST
  483. @Path("/getXiaJilei_da_Data")
  484. public String getXiaJilei_da_Data(String params) {
  485. String gradeId = Utils.getParameter("gradeId", params) == null ? "" : Utils.getParameter("gradeId", params);
  486. String companyIdName = Utils.getParameter("companyIdName", params) == null ? "" : Utils.getParameter("companyIdName", params);
  487. String jibie = Utils.getParameter("jibie", params) == null ? "" : Utils.getParameter("jibie", params);
  488. String jiaoBiaoName = Utils.getParameter("jiaoBiaoName", params) == null ? "" : Utils.getParameter("jiaoBiaoName", params);
  489. String title12 = Utils.getParameter("title12", params) == null ? "" : Utils.getParameter("title12", params);
  490. try {
  491. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  492. return scoreGradeDao.xiaJiLei_Da_Data(gradeId,companyIdName,jibie,jiaoBiaoName,title12);
  493. } catch (PersistenceException e) {
  494. // TODO Auto-generated catch block
  495. e.printStackTrace();
  496. }
  497. return null;
  498. }
  499. /**
  500. * 根据不同体系下一级项目评分标准的得分占比例
  501. * @param params
  502. * @return
  503. */
  504. @ProduceMime("application/json")
  505. @POST
  506. @Path("/getSystemData")
  507. public String getSystemData(String params) {
  508. String gradeId = Utils.getParameter("gradeId", params) == null ? "" : Utils.getParameter("gradeId", params);
  509. try {
  510. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  511. return scoreGradeDao.getSystemData(gradeId);
  512. } catch (PersistenceException e) {
  513. // TODO Auto-generated catch block
  514. e.printStackTrace();
  515. }
  516. return null;
  517. }
  518. @ProduceMime("application/json")
  519. @POST
  520. @Path("/getSystemErjiData")
  521. public String getSystemErjiData(String params) {
  522. //体系id 也就是 评分分数表中 评分id
  523. String gradeId = Utils.getParameter("gradeId", params) == null ? "" : Utils.getParameter("gradeId", params);
  524. //公司id
  525. String company_id = Utils.getParameter("company_id", params) == null ? "" : Utils.getParameter("company_id", params);
  526. //分数级别
  527. String socreGrade = Utils.getParameter("socreGrade", params) == null ? "" : Utils.getParameter("socreGrade", params);
  528. //一级项目的名字
  529. String YijiName = Utils.getParameter("YijiName", params) == null ? "" : Utils.getParameter("YijiName", params);
  530. try {
  531. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  532. return scoreGradeDao.getSystemErjiData(gradeId,company_id,socreGrade,YijiName);
  533. } catch (PersistenceException e) {
  534. // TODO Auto-generated catch block
  535. e.printStackTrace();
  536. }
  537. return null;
  538. }
  539. @ProduceMime("application/json")
  540. @POST
  541. @Path("/getCompanyWeight")
  542. public String getCompanyWeight(String params) {
  543. String gradeId = Utils.getParameter("gradeId", params) == null ? "" : Utils
  544. .getParameter("gradeId", params);
  545. String companyId = Utils.getParameter("companyId", params) == null ? "" : Utils
  546. .getParameter("companyId", params);
  547. String trunkId = Utils.getParameter("trunkId", params) == null ? "" : Utils
  548. .getParameter("trunkId", params);
  549. try {
  550. ScoreGradeDao scoreGradeDao = new ScoreGradeDao();
  551. if(trunkId.equals("")){
  552. String weight = scoreGradeDao.getCompanyWeight(companyId, gradeId);
  553. return weight;
  554. }else{
  555. String score = scoreGradeDao.getCompanyTrunkScore(companyId, gradeId, trunkId);
  556. return score;
  557. }
  558. } catch (PersistenceException e) {
  559. // TODO Auto-generated catch block
  560. e.printStackTrace();
  561. }
  562. return null;
  563. }
  564. }