|
|
@@ -9,6 +9,7 @@ import com.izouma.wenlvju.domain.*;
|
|
|
import com.izouma.wenlvju.dto.PageQuery;
|
|
|
import com.izouma.wenlvju.dto.ReviewTime;
|
|
|
import com.izouma.wenlvju.enums.AuthorityName;
|
|
|
+import com.izouma.wenlvju.enums.OrganizationGrade;
|
|
|
import com.izouma.wenlvju.enums.RateStatus;
|
|
|
import com.izouma.wenlvju.exception.BusinessException;
|
|
|
import com.izouma.wenlvju.repo.*;
|
|
|
@@ -610,7 +611,7 @@ public class RateService {
|
|
|
/**
|
|
|
* 发短信
|
|
|
*
|
|
|
- * @param announcement
|
|
|
+ * @param announcement 是否公告短信
|
|
|
*/
|
|
|
public void batchSendSms(boolean announcement) {
|
|
|
List<Rate> rates = rateRepo.findAllByStatusAndYear(RateStatus.SUBMIT_PAPER_MATERIALS, String.valueOf(LocalDate.now()
|
|
|
@@ -622,19 +623,53 @@ public class RateService {
|
|
|
} else {
|
|
|
njwlSmsService.sendSms(phones, "请你单位在5个工作日内将纸质申请材料(2份)送属地区文化和旅游局文化行政主管部门,逾期不送,作自动放弃处理。");
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 等级
|
|
|
*/
|
|
|
- public void grade(double excellent,double eligible) {
|
|
|
+ public void gradeRatio(double excellent, double eligible, Long userId) {
|
|
|
List<Rate> rates = rateRepo.findAllByStatusAndYear(RateStatus.SUBMIT_GRADE, String.valueOf(LocalDate.now()
|
|
|
.getYear()));
|
|
|
rates.sort(Comparator.comparingInt(Rate::getSort));
|
|
|
- int excellentSum = (int) Math.round(rates.size() * excellent);
|
|
|
- List<Rate> excellentList = rates.subList(0, excellentSum);
|
|
|
- int eligibleSum = (int) Math.round(rates.size() * eligible);
|
|
|
-// List<Rate> eligibleList = rates.subList(total);
|
|
|
+ int size = rates.size();
|
|
|
+ int excellentSum = (int) Math.round(size * excellent / 100);
|
|
|
+ if (excellentSum >= size) {
|
|
|
+ rates.forEach(rate -> {
|
|
|
+ rate.setGrade(OrganizationGrade.EXCELLENT);
|
|
|
+ rate.setStatus(RateStatus.SUBMIT_PAPER_MATERIALS);
|
|
|
+ RateAudit rateAudit = RateAudit.builder()
|
|
|
+ .userId(userId)
|
|
|
+ .rateId(rate.getId())
|
|
|
+ .remark("市政管理员已评审完成,请你单位在5个工作日内将纸质申请材料(2份)送属地区文化行政主管部门。")
|
|
|
+ .status(RateStatus.SUBMIT_PAPER_MATERIALS.toString())
|
|
|
+ .build();
|
|
|
+ rateAuditRepo.save(rateAudit);
|
|
|
+ });
|
|
|
+ rateRepo.saveAll(rates);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ int eligibleSum = (int) Math.round(size * eligible / 100);
|
|
|
+ int total = eligibleSum + excellentSum;
|
|
|
+ for (int i = 0; i < size; i++) {
|
|
|
+ Rate rate = rates.get(i);
|
|
|
+ if (i < excellentSum) {
|
|
|
+ rate.setGrade(OrganizationGrade.EXCELLENT);
|
|
|
+ } else if (i < total) {
|
|
|
+ rate.setGrade(OrganizationGrade.ELIGIBLE);
|
|
|
+ } else {
|
|
|
+ rate.setGrade(OrganizationGrade.NOT_ELIGIBLE);
|
|
|
+ }
|
|
|
+ rate.setStatus(RateStatus.SUBMIT_PAPER_MATERIALS);
|
|
|
+ RateAudit rateAudit = RateAudit.builder()
|
|
|
+ .userId(userId)
|
|
|
+ .rateId(rate.getId())
|
|
|
+ .remark("市政管理员已评审完成,请你单位在5个工作日内将纸质申请材料(2份)送属地区文化行政主管部门。")
|
|
|
+ .status(RateStatus.SUBMIT_PAPER_MATERIALS.toString())
|
|
|
+ .build();
|
|
|
+ rateAuditRepo.save(rateAudit);
|
|
|
+ }
|
|
|
+ rateRepo.saveAll(rates);
|
|
|
}
|
|
|
}
|