|
@@ -11,10 +11,13 @@ import com.ruoyi.system.api.domain.BsExpert;
|
|
|
import com.ruoyi.system.api.domain.SysUser;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.swing.event.AncestorEvent;
|
|
|
-import java.util.List;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @author GMCS
|
|
@@ -51,6 +54,12 @@ public class ExpertMarkController extends BaseController{
|
|
|
@Autowired
|
|
|
private IBidCommitteeService bidCommitteeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IBidQuoteService bidQuoteService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IScoreSummaryService scoreSummaryService;
|
|
|
+
|
|
|
// 查询全部评分细则
|
|
|
@GetMapping("/getMarkDetail")
|
|
|
public AjaxResult getMarkDetail(@RequestParam("sid") Long sid){
|
|
@@ -183,9 +192,19 @@ public class ExpertMarkController extends BaseController{
|
|
|
|
|
|
// 获取打分情况
|
|
|
@GetMapping("/getMark")
|
|
|
- public AjaxResult getMark(Long sid){
|
|
|
+ public AjaxResult getMark(@RequestParam("sid") Long sid,@RequestParam("hid") Long hid){
|
|
|
Long userId = SecurityUtils.getLoginUser().getSysUser().getUserId();
|
|
|
|
|
|
+ Integer isLeader = 0;
|
|
|
+
|
|
|
+ BidCommittee bidCommittee = new BidCommittee();
|
|
|
+ bidCommittee.setSid(sid);
|
|
|
+ bidCommittee.setUserId(userId);
|
|
|
+ List<BidCommittee> bidCommittees = bidCommitteeService.selectBidCommitteeList(bidCommittee);
|
|
|
+ if(!CollectionUtils.isEmpty(bidCommittees)){
|
|
|
+ isLeader = bidCommittees.get(0).getIsLeader();
|
|
|
+ }
|
|
|
+
|
|
|
BsExpert bsExpert = bidInfoService.getExpertByUserId(userId);
|
|
|
Long jid = bsExpert.getJid();
|
|
|
String jName = bsExpert.getjName();
|
|
@@ -202,14 +221,17 @@ public class ExpertMarkController extends BaseController{
|
|
|
bidExamine.setSid(sid);
|
|
|
bidExpertExamine.setJid(jid);
|
|
|
bidExpertExamine.setSid(sid);
|
|
|
+ bidExpertExamine.setHid(hid);
|
|
|
|
|
|
bidTech.setSid(sid);
|
|
|
bidExpertTech.setJid(jid);
|
|
|
bidExpertTech.setSid(sid);
|
|
|
+ bidExpertTech.setHid(hid);
|
|
|
|
|
|
bidRespond.setSid(sid);
|
|
|
bidExpertRespond.setJid(jid);
|
|
|
- bidExpertTech.setSid(sid);
|
|
|
+ bidExpertRespond.setSid(sid);
|
|
|
+ bidExpertRespond.setHid(hid);
|
|
|
|
|
|
BidInfo info = bidInfoService.getInfoBySid(sid);
|
|
|
List<BidExamine> bidExamines = bidExamineService.selectBidExamineList(bidExamine);
|
|
@@ -221,25 +243,67 @@ public class ExpertMarkController extends BaseController{
|
|
|
|
|
|
Mark mark = new Mark();
|
|
|
mark.setSid(sid);
|
|
|
- mark.setsName(info.getsName());
|
|
|
+ mark.setsName(info==null?"":info.getsName());
|
|
|
mark.setJid(jid);
|
|
|
- mark.setuKaiTime(info.getuKaiTime());
|
|
|
- mark.setuKaiPosition(info.getuKaiPosition());
|
|
|
+ mark.setuKaiTime(info==null?"":info.getuKaiTime());
|
|
|
+ mark.setuKaiPosition(info==null?"":info.getuKaiPosition());
|
|
|
mark.setjName(jName);
|
|
|
- mark.setBidExpertExamines(examineDetails);
|
|
|
+ if(isLeader == 1){
|
|
|
+ mark.setBidExpertExamines(examineDetails);
|
|
|
+ mark.setBidExpertResponds(respondDetails);
|
|
|
+ }
|
|
|
+
|
|
|
mark.setBidExpertTeches(techDetails);
|
|
|
- mark.setBidExpertResponds(respondDetails);
|
|
|
mark.setExamineList(bidExamines);
|
|
|
mark.setBidRespondList(bidResponds);
|
|
|
mark.setBidTechList(bidTeches);
|
|
|
-
|
|
|
- return success( );
|
|
|
+ mark.setIsLeader(Long.valueOf(isLeader));
|
|
|
+ return success(mark);
|
|
|
}
|
|
|
|
|
|
// 获取整体打分情况
|
|
|
@GetMapping("/getMarkAll")
|
|
|
public AjaxResult getMarkAll(Long sid){
|
|
|
- return success();
|
|
|
+
|
|
|
+ BidInfo bidInfo = new BidInfo();
|
|
|
+ bidInfo.setSid(sid);
|
|
|
+ BidInfo info = bidInfoService.getInfoBySid(sid);
|
|
|
+
|
|
|
+ BidCommittee bidCommittee = new BidCommittee();
|
|
|
+ bidCommittee.setSid(sid);
|
|
|
+
|
|
|
+ BidExamine bidExamine = new BidExamine();
|
|
|
+ BidRespond bidRespond = new BidRespond();
|
|
|
+ BidTech bidTech = new BidTech();
|
|
|
+ BidExpertExamine bidExpertExamine = new BidExpertExamine();
|
|
|
+ BidExpertRespond bidExpertRespond = new BidExpertRespond();
|
|
|
+ BidExpertTech bidExpertTech = new BidExpertTech();
|
|
|
+
|
|
|
+ Mark mark = new Mark();
|
|
|
+ bidExamine.setSid(sid);
|
|
|
+ bidTech.setSid(sid);
|
|
|
+ bidRespond.setSid(sid);
|
|
|
+ bidExpertExamine.setSid(sid);
|
|
|
+ bidExpertRespond.setSid(sid);
|
|
|
+ bidExpertTech.setSid(sid);
|
|
|
+
|
|
|
+ List<BidExamine> bidExamines = bidExamineService.selectBidExamineList(bidExamine);
|
|
|
+ List<BidRespond> bidResponds = bidRespondService.selectBidRespondList(bidRespond);
|
|
|
+ List<BidTech> bidTeches = bidTechService.selectBidTechList(bidTech);
|
|
|
+ List<BidExpertExamine> examineDetails = bidExpertExamineService.selectBidExpertExamineList(bidExpertExamine);
|
|
|
+ List<BidExpertRespond> respondDetails = bidExpertRespondService.selectBidExpertRespondList(bidExpertRespond);
|
|
|
+ List<BidExpertTech> techDetails = bidExpertTechService.selectBidExpertTechList(bidExpertTech);
|
|
|
+ mark.setSid(sid);
|
|
|
+ mark.setsName(info.getsName());
|
|
|
+ mark.setuKaiTime(info.getuKaiTime());
|
|
|
+ mark.setuKaiPosition(info.getuKaiPosition());
|
|
|
+ mark.setBidExpertExamines(examineDetails);
|
|
|
+ mark.setBidExpertResponds(respondDetails);
|
|
|
+ mark.setBidExpertTeches(techDetails);
|
|
|
+ mark.setExamineList(bidExamines);
|
|
|
+ mark.setBidRespondList(bidResponds);
|
|
|
+ mark.setBidTechList(bidTeches);
|
|
|
+ return success(mark);
|
|
|
}
|
|
|
|
|
|
// 专家打分
|
|
@@ -289,4 +353,184 @@ public class ExpertMarkController extends BaseController{
|
|
|
}
|
|
|
return success("打分完成");
|
|
|
}
|
|
|
+
|
|
|
+ // 投标报价得分计算
|
|
|
+ @GetMapping("/getQuoteScore")
|
|
|
+ public AjaxResult getQuoteScore(@RequestParam("sid") Long sid){
|
|
|
+ BidQuote bidQuote = new BidQuote();
|
|
|
+ bidQuote.setSid(sid);
|
|
|
+ bidQuote.setAudit(1L);
|
|
|
+ List<BidQuote> bidQuotes = bidQuoteService.selectBidQuoteList(bidQuote);
|
|
|
+ List<QuoteScore> scores = new ArrayList<>();
|
|
|
+
|
|
|
+ if(bidQuotes.size() == 0){
|
|
|
+ return success("没有报价信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal fullScore = new BigDecimal("7.00");
|
|
|
+
|
|
|
+ BigDecimal middle = new BigDecimal(0);
|
|
|
+ if(bidQuotes.size() >= 5){
|
|
|
+ for (int i = 0; i < bidQuotes.size() ; i++) {
|
|
|
+ if(i != 0 && i != bidQuotes.size() - 1){
|
|
|
+ middle = middle.add(bidQuotes.get(i).getQuotePrice());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ middle = middle.divide(new BigDecimal(bidQuotes.size() - 2),2, RoundingMode.HALF_UP);
|
|
|
+ } else {
|
|
|
+ for (int i = 0; i < bidQuotes.size(); i++) {
|
|
|
+ middle = middle.add(bidQuotes.get(i).getQuotePrice());
|
|
|
+ }
|
|
|
+ middle = middle.divide(new BigDecimal(bidQuotes.size()),2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ BigDecimal standard = middle.multiply(new BigDecimal("0.01"));
|
|
|
+ for(BidQuote item :bidQuotes){
|
|
|
+ String hName = bidInfoService.getSupplierByhid(item.getHid());
|
|
|
+ QuoteScore score = new QuoteScore();
|
|
|
+ score.setSid(sid);
|
|
|
+ score.setHid(item.getHid());
|
|
|
+ score.sethName(hName);
|
|
|
+ score.setLevel(middle);
|
|
|
+ score.setQuotePrice(item.getQuotePrice());
|
|
|
+ BigDecimal percent = item.getQuotePrice().subtract(middle).divide(middle,4,RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
+ score.setPercent(percent);
|
|
|
+ BigDecimal relScore = new BigDecimal(0);
|
|
|
+
|
|
|
+ if(item.getQuotePrice().compareTo(middle) > 0){
|
|
|
+ BigDecimal divide = item.getQuotePrice().subtract(middle).divide(standard,2,RoundingMode.HALF_UP);
|
|
|
+ divide = divide.setScale(0,RoundingMode.DOWN);
|
|
|
+ if(divide.compareTo(new BigDecimal(0)) == 0){
|
|
|
+ relScore = fullScore.subtract(item.getQuotePrice().subtract(middle).divide(standard,2,RoundingMode.HALF_UP).multiply(new BigDecimal("0.6")));
|
|
|
+ } else {
|
|
|
+ relScore = fullScore.subtract(divide.multiply(new BigDecimal("0.6")));
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if(item.getQuotePrice().compareTo(middle) < 0){
|
|
|
+ BigDecimal divide = middle.subtract(item.getQuotePrice()).divide(standard,2,RoundingMode.HALF_UP);
|
|
|
+ divide = divide.setScale(0,RoundingMode.DOWN);
|
|
|
+ if(divide.compareTo(new BigDecimal(0)) == 0){
|
|
|
+ relScore = fullScore.subtract(middle.subtract(item.getQuotePrice()).divide(standard,2,RoundingMode.HALF_UP).multiply(new BigDecimal("0.6")));
|
|
|
+ } else{
|
|
|
+ relScore = fullScore.subtract(divide.multiply(new BigDecimal("0.5")));
|
|
|
+ }
|
|
|
+ } else{
|
|
|
+ relScore = fullScore;
|
|
|
+ }
|
|
|
+ score.setScore(relScore);
|
|
|
+ scores.add(score);
|
|
|
+ }
|
|
|
+ return success(scores);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 评委评分汇总
|
|
|
+ @GetMapping("/getTotal")
|
|
|
+ public AjaxResult getTotal(@RequestParam("sid") Long sid){
|
|
|
+ List<TotalScore> list = new ArrayList<>();
|
|
|
+
|
|
|
+ BidQuote bidQuote = new BidQuote();
|
|
|
+ bidQuote.setSid(sid);
|
|
|
+ bidQuote.setAudit(1L);
|
|
|
+ List<BidQuote> bidQuotes = bidQuoteService.selectBidQuoteList(bidQuote);
|
|
|
+
|
|
|
+ if(bidQuotes.size() == 0){
|
|
|
+ return success("没有报价信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal fullScore = new BigDecimal("7.00");
|
|
|
+
|
|
|
+ BigDecimal middle = new BigDecimal(0);
|
|
|
+ if(bidQuotes.size() >= 5){
|
|
|
+ for (int i = 0; i < bidQuotes.size() ; i++) {
|
|
|
+ if(i != 0 && i != bidQuotes.size() - 1){
|
|
|
+ middle = middle.add(bidQuotes.get(i).getQuotePrice());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ middle = middle.divide(new BigDecimal(bidQuotes.size() - 2),2, RoundingMode.HALF_UP);
|
|
|
+ } else {
|
|
|
+ for (int i = 0; i < bidQuotes.size(); i++) {
|
|
|
+ middle = middle.add(bidQuotes.get(i).getQuotePrice());
|
|
|
+ }
|
|
|
+ middle = middle.divide(new BigDecimal(bidQuotes.size()),2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ BigDecimal standard = middle.multiply(new BigDecimal("0.01"));
|
|
|
+
|
|
|
+ for(BidQuote item : bidQuotes){
|
|
|
+ TotalScore totalScore = new TotalScore();
|
|
|
+ totalScore.setSid(sid);
|
|
|
+ String hName = bidInfoService.getSupplierByhid(item.getHid());
|
|
|
+ totalScore.setHid(item.getHid());
|
|
|
+ totalScore.sethName(hName);
|
|
|
+
|
|
|
+ BigDecimal priceScore = new BigDecimal(0);
|
|
|
+
|
|
|
+ if(item.getQuotePrice().compareTo(middle) > 0){
|
|
|
+ BigDecimal divide = item.getQuotePrice().subtract(middle).divide(standard,2,RoundingMode.HALF_UP);
|
|
|
+ divide = divide.setScale(0,RoundingMode.DOWN);
|
|
|
+ if(divide.compareTo(new BigDecimal(0)) == 0){
|
|
|
+ priceScore = fullScore.subtract(item.getQuotePrice().subtract(middle).divide(standard,2,RoundingMode.HALF_UP).multiply(new BigDecimal("0.6")));
|
|
|
+ } else {
|
|
|
+ priceScore = fullScore.subtract(divide.multiply(new BigDecimal("0.6")));
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if(item.getQuotePrice().compareTo(middle) < 0){
|
|
|
+ BigDecimal divide = middle.subtract(item.getQuotePrice()).divide(standard,2,RoundingMode.HALF_UP);
|
|
|
+ divide = divide.setScale(0,RoundingMode.DOWN);
|
|
|
+ if(divide.compareTo(new BigDecimal(0)) == 0){
|
|
|
+ priceScore = fullScore.subtract(middle.subtract(item.getQuotePrice()).divide(standard,2,RoundingMode.HALF_UP).multiply(new BigDecimal("0.6")));
|
|
|
+ } else{
|
|
|
+ priceScore = fullScore.subtract(divide.multiply(new BigDecimal("0.5")));
|
|
|
+ }
|
|
|
+ } else{
|
|
|
+ priceScore = fullScore;
|
|
|
+ }
|
|
|
+
|
|
|
+ totalScore.setPriceScore(priceScore);
|
|
|
+ List<TechScore> techScores = bidInfoService.getTechScore(sid);
|
|
|
+ List<TechScore> techScores1 = new ArrayList<>();
|
|
|
+
|
|
|
+ int size = 0;
|
|
|
+ Double total = 0.0;
|
|
|
+ for (TechScore techScore : techScores){
|
|
|
+ if(techScore.getHid().equals(item.getHid())){
|
|
|
+ size++;
|
|
|
+ total += techScore.getScore();
|
|
|
+ techScores1.add(techScore);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ totalScore.setTechList(techScores1);
|
|
|
+ BigDecimal averageScore = new BigDecimal(total.toString()).divide(new BigDecimal(String.valueOf(size)),2,RoundingMode.HALF_UP);
|
|
|
+ totalScore.setAverScore(averageScore);
|
|
|
+ totalScore.setTotalScore(averageScore.add(priceScore));
|
|
|
+ totalScore.setSize(size);
|
|
|
+ list.add(totalScore);
|
|
|
+ }
|
|
|
+
|
|
|
+ Collections.sort(list);
|
|
|
+//
|
|
|
+// scoreSummaryService.deleteScoreSummaryBySid(sid);
|
|
|
+// for (int i = 0; i < list.size(); i++){
|
|
|
+// list.get(i).setSize(i+1);
|
|
|
+//
|
|
|
+// ScoreSummary scoreSummary = new ScoreSummary();
|
|
|
+// scoreSummary.setSid(sid);
|
|
|
+// scoreSummary.setHid(list.get(i).getHid());
|
|
|
+// scoreSummary.sethName(list.get(i).gethName());
|
|
|
+// List<TechScore> techList = list.get(i).getTechList();
|
|
|
+// String scoreInfo = "";
|
|
|
+// for(TechScore item : techList){
|
|
|
+// scoreInfo+=item.getjName()+","+item.getScore().toString()+";";
|
|
|
+// }
|
|
|
+// scoreSummary.setScoreInfo(scoreInfo);
|
|
|
+// scoreSummary.setPriceScore(list.get(i).getPriceScore());
|
|
|
+// scoreSummary.setAverScore(list.get(i).getAverScore());
|
|
|
+// scoreSummary.setTotalScore(list.get(i).getTotalScore());
|
|
|
+// scoreSummary.setSort(Long.valueOf(i+1));
|
|
|
+// scoreSummaryService.insertScoreSummary(scoreSummary);
|
|
|
+// }
|
|
|
+
|
|
|
+ return success(list);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|